/* =========================================================================
   Founder's Office OS — design system
   Warm, editorial, coffee-house. Refined-minimalist. Mobile-first (390px).
   ========================================================================= */

/* ---- Fonts (self-import from Google Fonts; no config needed) ------------- */
@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,400..900;1,9..144,400..600&family=Hanken+Grotesk:wght@400..700&display=swap');

/* ---- Tokens -------------------------------------------------------------- */
:root {
  /* Ink — dark-roast espresso */
  --ink:        #2A1D16;
  --ink-soft:   #4A3A2E;
  --ink-faint:  #7A6A5C;

  /* Paper — warm oat-milk, not pure white */
  --paper:      #F4ECE1;
  --paper-2:    #EDE2D3;   /* raised surfaces */
  --paper-3:    #E4D6C3;   /* rules, wells */

  /* Accent — burnt caramel / amber */
  --accent:     #B4632B;
  --accent-2:   #9A4E1E;   /* pressed / deep */
  --accent-tint:#EBD9C6;

  /* Dark espresso (hero / footer) */
  --espresso:   #1D140E;
  --espresso-2: #33241A;
  --cream:      #F4ECE1;
  --amber:      #DB8A41;   /* brighter accent that sings on dark */

  /* Semantic (kept warm, not clinical) */
  --good:       #5C7A4A;
  --warn:       #B4632B;

  /* Type */
  --display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --body:    'Hanken Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Rhythm */
  --gap:  1rem;
  --pad:  1.25rem;
  --maxw: 62rem;
  --radius: 14px;

  /* Warm shadow */
  --shadow-sm: 0 1px 2px rgba(42, 29, 22, 0.06), 0 2px 8px rgba(42, 29, 22, 0.05);
  --shadow-md: 0 4px 14px rgba(42, 29, 22, 0.10), 0 12px 34px rgba(42, 29, 22, 0.08);
  --glow: 0 6px 30px color-mix(in srgb, var(--accent) 22%, transparent);

  /* Motion — one primary easing, one confident easing, a 4-step duration scale.
     Coherence (everything decelerates the same way) is most of the premium feel. */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);      /* out-quint — primary */
  --ease-expo: cubic-bezier(0.16, 1, 0.3, 1);  /* out-expo — big reveals */
  --dur-fast: 150ms;
  --dur: 240ms;
  --dur-slow: 420ms;
  --dur-slower: 700ms;
}

/* Cross-document view transitions — pages cross-fade like one continuous
   surface. Progressive enhancement; unsupported browsers just navigate. */
@view-transition { navigation: auto; }
::view-transition-old(root),
::view-transition-new(root) { animation-duration: var(--dur-slow); animation-timing-function: var(--ease); }
/* Keep the nav visually persistent across the fade. */
.topnav { view-transition-name: topnav; }

/* Scroll progress bar (injected by app.js). Scroll-driven where supported. */
.scrollbar {
  position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 100;
  transform-origin: 0 50%; transform: scaleX(0);
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}
@supports (animation-timeline: scroll()) {
  .scrollbar { animation: sb-grow linear both; animation-timeline: scroll(root block); transform: none; }
}
@keyframes sb-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }

::selection { background: var(--accent-tint); color: var(--ink); }

/* ---- Reset --------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  background-color: var(--paper);
  /* subtle paper grain — inline SVG fractal noise, no network request */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
button { font-family: inherit; }

/* ---- Layout -------------------------------------------------------------- */
.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--pad); }

.section { padding-block: clamp(3rem, 9vw, 5.5rem); }
.section + .section { border-top: 1px solid var(--paper-3); }

.section__eyebrow {
  font-family: var(--body);
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-2);
  margin: 0 0 0.6rem;
}
.section__title {
  font-family: var(--display);
  font-optical-sizing: auto;
  font-weight: 580;
  font-size: clamp(2rem, 7.5vw, 3.5rem);
  line-height: 1.0;
  letter-spacing: -0.02em;
  margin: 0 0 0.85rem;
  text-wrap: balance;
}
.section__lead {
  max-width: 40ch;
  color: var(--ink-soft);
  font-size: 1.05rem;
  margin: 0 0 2rem;
}

/* ---- Header -------------------------------------------------------------- */
.masthead { padding-block: clamp(2.5rem, 8vw, 4rem) clamp(1.5rem, 5vw, 2.5rem); }
.masthead__banner {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-size: 0.74rem; letter-spacing: 0.08em; text-transform: uppercase;
  font-weight: 600; color: var(--ink-soft);
  background: var(--paper-2);
  border: 1px solid var(--paper-3);
  padding: 0.4rem 0.8rem; border-radius: 999px;
  margin-bottom: 1.4rem;
}
.masthead__banner .dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-tint);
}
.masthead__name {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(2.4rem, 10vw, 4.4rem);
  line-height: 0.98;
  letter-spacing: -0.02em;
  margin: 0 0 0.5rem;
}
.masthead__role {
  display: block;
  font-family: var(--display);
  font-style: italic;
  font-weight: 400;
  color: var(--accent-2);
  margin-top: 0.1rem;
}
.masthead__line {
  max-width: 46ch;
  color: var(--ink-soft);
  font-size: 1.1rem;
  margin: 1rem 0 1.6rem;
}
.linkrow { display: flex; flex-wrap: wrap; gap: 0.55rem; }
.linkrow a {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 0.9rem; font-weight: 600;
  color: var(--ink);
  background: var(--paper-2);
  border: 1px solid var(--paper-3);
  padding: 0.5rem 0.9rem; border-radius: 999px;
  transition: transform 0.2s var(--ease), border-color 0.2s var(--ease), background 0.2s var(--ease);
}
.linkrow a:hover { text-decoration: none; transform: translateY(-1px); border-color: var(--accent); background: var(--paper); }

/* ---- Dark espresso hero (Home) ------------------------------------------- */
.hero {
  position: relative; overflow: hidden; isolation: isolate;
  background:
    radial-gradient(130% 95% at 50% -12%, var(--espresso-2), var(--espresso) 60%);
  color: var(--cream);
  padding-block: clamp(3.5rem, 12vw, 7rem) clamp(3rem, 9vw, 5rem);
}
/* Breathing amber roast-glow */
.hero__glow {
  position: absolute; z-index: -1; pointer-events: none;
  width: min(80vw, 640px); aspect-ratio: 1; left: 50%; top: -14%; translate: -50% 0;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 60%, transparent), transparent 62%);
  filter: blur(46px); opacity: 0.42; animation: glow-breathe 7s var(--ease) infinite;
}
@keyframes glow-breathe {
  0%, 100% { opacity: 0.36; scale: 1; }
  50%      { opacity: 0.6; scale: 1.08; }
}
/* One-shot light sweep across the hero on load — the signature moment */
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(105deg, transparent 42%, rgba(255,255,255,0.07) 50%, transparent 58%);
  transform: translateX(-120%); animation: hero-scan 1.5s var(--ease-expo) 0.35s 1 both;
}
@keyframes hero-scan { to { transform: translateX(120%); } }
/* Faint grid texture for depth */
.hero::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: 0.5;
  background-image:
    linear-gradient(color-mix(in srgb, var(--cream) 5%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--cream) 5%, transparent) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: radial-gradient(120% 100% at 50% 0%, #000, transparent 70%);
}
.hero__inner { position: relative; }
.hero .masthead__banner {
  background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.14);
  color: color-mix(in srgb, var(--cream) 82%, transparent);
}
.hero .masthead__name { color: var(--cream); font-size: clamp(2.9rem, 13vw, 6rem); letter-spacing: -0.03em; }
.hero .masthead__role { color: var(--amber); }
.hero .masthead__line { color: color-mix(in srgb, var(--cream) 78%, transparent); }
.hero .linkrow a {
  color: var(--cream); background: rgba(255,255,255,0.07); border-color: rgba(255,255,255,0.16);
}
.hero .linkrow a:hover { background: rgba(255,255,255,0.13); border-color: var(--amber); }
/* Scroll cue */
.hero__cue {
  display: inline-flex; align-items: center; gap: 0.5rem; margin-top: 2rem;
  font-size: 0.76rem; letter-spacing: 0.14em; text-transform: uppercase; font-weight: 600;
  color: color-mix(in srgb, var(--cream) 60%, transparent);
}
.hero__cue span { width: 18px; height: 26px; border: 1.5px solid currentColor; border-radius: 10px; position: relative; }
.hero__cue span::after {
  content: ""; position: absolute; left: 50%; top: 5px; translate: -50% 0;
  width: 3px; height: 6px; border-radius: 2px; background: var(--amber);
  animation: cue 1.6s var(--ease) infinite;
}
@keyframes cue { 0% { opacity: 0; top: 5px; } 40% { opacity: 1; } 100% { opacity: 0; top: 13px; } }

/* ---- Pull-quote (editorial signature) ------------------------------------ */
.pullquote {
  font-family: var(--display); font-weight: 500; font-style: italic;
  font-size: clamp(1.5rem, 5.5vw, 2.6rem); line-height: 1.18; letter-spacing: -0.01em;
  color: var(--ink); max-width: 22ch; text-wrap: balance;
  padding-left: 1.1rem; border-left: 3px solid var(--accent);
}
.pullquote b { color: var(--accent-2); font-weight: 600; font-style: normal; }

/* ---- Top nav (persistent across pages) ----------------------------------- */
.topnav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.1) blur(8px);
  -webkit-backdrop-filter: saturate(1.1) blur(8px);
  border-bottom: 1px solid var(--paper-3);
}
.topnav__inner {
  width: 100%; max-width: var(--maxw); margin-inline: auto;
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.6rem var(--pad);
}
.topnav__brand {
  font-family: var(--display); font-weight: 600; font-size: 1.05rem;
  color: var(--ink); letter-spacing: -0.01em; white-space: nowrap; flex: 0 0 auto;
}
.topnav__brand:hover { text-decoration: none; color: var(--accent-2); }
.topnav__links {
  display: flex; align-items: center; gap: 0.25rem;
  overflow-x: auto; scrollbar-width: none; -ms-overflow-style: none;
  margin-left: auto; padding-block: 0.1rem;
}
.topnav__links::-webkit-scrollbar { display: none; }
.topnav__links a {
  flex: 0 0 auto;
  font-size: 0.88rem; font-weight: 600; color: var(--ink-soft);
  padding: 0.4rem 0.75rem; border-radius: 999px; white-space: nowrap;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.topnav__links a:hover { text-decoration: none; background: var(--paper-2); color: var(--ink); }
.topnav__links a[aria-current="page"] {
  color: var(--accent-2); background: var(--accent-tint);
}

/* Slimmer page header for interior pages */
.page-head { padding-block: clamp(2rem, 7vw, 3.25rem) 0; }

/* ---- Cards / surfaces ---------------------------------------------------- */
.card {
  background: var(--paper-2);
  border: 1px solid var(--paper-3);
  border-radius: var(--radius);
  padding: var(--pad);
  box-shadow: var(--shadow-sm);
}

/* Tool cards (Home) */
.tools { display: grid; gap: 0.9rem; }
@media (min-width: 640px) { .tools { grid-template-columns: 1fr 1fr; } }
.tool {
  display: grid; gap: 0.3rem; align-content: start;
  background: var(--paper-2); border: 1px solid var(--paper-3); border-radius: var(--radius);
  padding: 1.25rem; color: var(--ink);
  transition: transform 0.2s var(--ease), border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.tool:hover { text-decoration: none; border-color: var(--accent); box-shadow: var(--shadow-md), var(--glow); }
/* Magnetic tilt (fine-pointer only; driven by app.js custom props) */
@media (pointer: fine) {
  .tool {
    transform: perspective(900px) rotateX(var(--ty, 0deg)) rotateY(var(--tx, 0deg)) translateY(var(--lift, 0px));
    transition: transform var(--dur-slow) var(--ease), border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  }
  .tool[data-tilt="on"] { transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
  .tool::after {
    content: ""; position: absolute; inset: 0; z-index: 1; border-radius: inherit; pointer-events: none;
    opacity: 0; transition: opacity var(--dur) var(--ease);
    background: radial-gradient(220px circle at var(--mx, 50%) var(--my, 50%), color-mix(in srgb, var(--accent) 16%, transparent), transparent 60%);
  }
  .tool[data-tilt="on"]::after { opacity: 1; }
}
.tool { position: relative; }
.tool__n { font-family: var(--display); font-weight: 600; font-size: 0.95rem; color: var(--accent-2); }
.tool__t { font-family: var(--display); font-weight: 600; font-size: 1.35rem; line-height: 1.1; }
.tool__d { font-size: 0.92rem; color: var(--ink-soft); }

.illus-tag {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--accent-2);
  background: var(--accent-tint);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  padding: 0.3rem 0.65rem; border-radius: 6px;
}

/* =========================================================================
   F3 — Channel-mix P&L / EBITDA bridge
   ========================================================================= */
.pnl { display: grid; gap: 1.25rem; }
@media (min-width: 820px) {
  .pnl { grid-template-columns: 1.05fr 0.95fr; align-items: start; }
}

/* Sliders */
.channels { display: grid; gap: 1.1rem; }
.channel__head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem;
  margin-bottom: 0.35rem;
}
.channel__name { font-weight: 700; font-size: 0.98rem; }
.channel__name .swatch {
  display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 0.45rem;
  vertical-align: middle;
}
.channel__pct { font-family: var(--display); font-weight: 600; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.channel__rationale { font-size: 0.82rem; color: var(--ink-faint); margin: 0.3rem 0 0; }

.channel__margin {
  display: flex; align-items: center; gap: 0.5rem; margin-top: 0.55rem;
  font-size: 0.85rem; color: var(--ink-soft);
}
.channel__margin label { white-space: nowrap; }
.margin-input {
  width: 4.2rem; font-family: var(--body); font-size: 0.9rem; font-weight: 600;
  color: var(--ink); text-align: right;
  background: var(--paper); border: 1px solid var(--paper-3); border-radius: 8px;
  padding: 0.3rem 0.45rem;
}
.margin-input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Range input — themed per channel via --ch */
input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 8px; margin: 0.2rem 0;
  border-radius: 999px;
  background: var(--paper-3);
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--ch, var(--accent));
  border: 3px solid var(--paper);
  box-shadow: var(--shadow-sm);
  transition: transform 0.12s var(--ease);
}
input[type="range"]::-webkit-slider-thumb:active { transform: scale(1.12); }
input[type="range"]::-moz-range-thumb {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--ch, var(--accent)); border: 3px solid var(--paper);
  box-shadow: var(--shadow-sm);
}
input[type="range"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.fixed-cost {
  margin-top: 1.1rem; padding-top: 1.1rem; border-top: 1px solid var(--paper-3);
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
}
.fixed-cost label { font-weight: 600; font-size: 0.92rem; }
.fixed-cost .field { display: inline-flex; align-items: center; gap: 0.3rem; }
.fixed-cost .field .prefix { color: var(--ink-faint); }
.cost-input {
  width: 6rem; font-family: var(--display); font-weight: 600; font-size: 1.05rem;
  color: var(--ink); text-align: right; font-variant-numeric: tabular-nums;
  background: var(--paper); border: 1px solid var(--paper-3); border-radius: 8px;
  padding: 0.35rem 0.5rem;
}
.cost-input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.pnl__reset {
  margin-top: 0.9rem; font-size: 0.82rem; font-weight: 600; color: var(--ink-faint);
  background: none; border: none; cursor: pointer; padding: 0; text-decoration: underline;
  text-underline-offset: 3px;
}
.pnl__reset:hover { color: var(--accent-2); }

/* Readout / bridge panel */
.readout { display: grid; gap: 1rem; }
.stat-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.stat {
  background: var(--paper); border: 1px solid var(--paper-3); border-radius: 12px;
  padding: 0.85rem 0.95rem;
}
.stat__label { font-size: 0.74rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-faint); font-weight: 600; }
.stat__value { font-family: var(--display); font-weight: 600; font-size: 1.7rem; line-height: 1.1; font-variant-numeric: tabular-nums; margin-top: 0.15rem; }
.stat__value.accent { color: var(--accent-2); }
.stat__sub { font-size: 0.78rem; color: var(--ink-faint); }

/* Waterfall bridge */
.bridge { background: var(--paper); border: 1px solid var(--paper-3); border-radius: 12px; padding: 1rem; }
.bridge__title { font-size: 0.74rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-faint); font-weight: 700; margin: 0 0 0.9rem; }
.waterfall { display: grid; gap: 0.55rem; }
.bar {
  display: grid; grid-template-columns: 8.5rem 1fr auto; align-items: center; gap: 0.6rem;
  font-size: 0.85rem;
}
.bar__label { color: var(--ink-soft); font-weight: 600; }
.bar__track { position: relative; height: 26px; background: var(--paper-3); border-radius: 6px; overflow: hidden; }
.bar__fill {
  position: absolute; top: 0; bottom: 0; border-radius: 6px;
  transition: left 0.45s var(--ease), width 0.45s var(--ease), background 0.3s var(--ease);
}
.bar__val { font-variant-numeric: tabular-nums; font-weight: 700; text-align: right; min-width: 4.5rem; }
.bar.is-total .bar__label { color: var(--ink); font-weight: 800; }
.bar.is-total .bar__val { color: var(--accent-2); }

/* =========================================================================
   AI panels (F1 / F2) — shell only until the function is wired
   ========================================================================= */
.ai-panel { display: grid; gap: 1rem; }
.ai-output {
  background: var(--paper); border: 1px solid var(--paper-3); border-radius: 12px;
  padding: 1.1rem 1.15rem; min-height: 7rem;
  white-space: pre-wrap; font-size: 0.98rem; line-height: 1.62;
}
.ai-output.is-placeholder { color: var(--ink-faint); font-style: italic; }
.ai-caption { font-size: 0.78rem; color: var(--ink-faint); display: flex; align-items: center; gap: 0.45rem; }
.ai-caption .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--good); }
.ai-output.is-error { color: var(--warn); font-style: normal; }

/* Form controls (ask box, decision picker) */
.control {
  width: 100%; font-family: var(--body); font-size: 0.95rem; color: var(--ink);
  background: var(--paper); border: 1px solid var(--paper-3); border-radius: 10px;
  padding: 0.65rem 0.8rem;
}
.control:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
select.control { appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237A6A5C' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.9rem center; padding-right: 2.2rem;
}
.ai-controls { display: grid; gap: 0.6rem; }
.ai-controls label,
.ask-box label { font-size: 0.82rem; font-weight: 600; color: var(--ink-soft); }
.ai-controls .btn { justify-self: start; }

/* Read-only mix summary strip (Board page) */
.mix { background: var(--paper-2); border: 1px solid var(--paper-3); border-radius: var(--radius); padding: var(--pad); display: grid; gap: 0.8rem; }
.mix__stats { display: flex; flex-wrap: wrap; gap: 1.2rem; font-size: 0.95rem; color: var(--ink-soft); }
.mix__stats strong { font-family: var(--display); font-weight: 600; font-size: 1.15rem; color: var(--ink); }
.mix__chips { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.mix__chip {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 0.82rem; font-weight: 600; color: var(--ink-soft);
  background: var(--paper); border: 1px solid var(--paper-3); border-radius: 999px;
  padding: 0.3rem 0.7rem;
}
.mix__chip .swatch { width: 9px; height: 9px; border-radius: 3px; }
.mix__note { font-size: 0.82rem; color: var(--ink-faint); margin: 0; }

.ask-box { margin-top: 0.35rem; padding-top: 1rem; border-top: 1px solid var(--paper-3); display: grid; gap: 0.6rem; }
.ask-row { display: flex; gap: 0.5rem; }
.ask-row .control { flex: 1; }
.ask-row .btn { flex: 0 0 auto; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  font-family: var(--body); font-weight: 700; font-size: 0.95rem;
  color: var(--paper); background: var(--accent);
  border: 1px solid var(--accent-2); border-radius: 10px;
  padding: 0.7rem 1.15rem; cursor: pointer;
  transition: transform 0.15s var(--ease), background 0.2s var(--ease), box-shadow 0.2s var(--ease);
  box-shadow: var(--shadow-sm);
}
.btn:hover { background: var(--accent-2); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.55; cursor: progress; transform: none; }
.btn--ghost { color: var(--ink); background: var(--paper-2); border-color: var(--paper-3); box-shadow: none; }
.btn--ghost:hover { background: var(--paper); border-color: var(--accent); }

/* =========================================================================
   F4 — First 90 days (CSS-only tabs, no JS)
   ========================================================================= */
.tabs { margin-top: 0.5rem; }
.tab-in { position: absolute; opacity: 0; pointer-events: none; }
.tabs__row { display: inline-flex; gap: 0.3rem; background: var(--paper-2); border: 1px solid var(--paper-3); border-radius: 999px; padding: 0.3rem; margin-bottom: 1.5rem; }
.tab {
  cursor: pointer; font-weight: 700; font-size: 0.9rem; color: var(--ink-soft);
  padding: 0.5rem 1.1rem; border-radius: 999px; font-variant-numeric: tabular-nums;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.tab:hover { color: var(--ink); }
.tab-panel { display: none; }
/* Map each checked radio to its tab label + panel */
#p1:checked ~ .tabs__row label[for="p1"],
#p2:checked ~ .tabs__row label[for="p2"],
#p3:checked ~ .tabs__row label[for="p3"] { background: var(--accent); color: var(--paper); }
#p1:checked ~ .tabs__panels .tab-panel[data-panel="1"],
#p2:checked ~ .tabs__panels .tab-panel[data-panel="2"],
#p3:checked ~ .tabs__panels .tab-panel[data-panel="3"] { display: block; }
.tab-in:focus-visible ~ .tabs__row label { outline: 2px solid var(--accent); outline-offset: 2px; }

.steps { margin: 0; padding-left: 1.3rem; display: grid; gap: 1rem; }
.steps li { padding-left: 0.3rem; color: var(--ink-soft); }
.steps li::marker { color: var(--accent-2); font-family: var(--display); font-weight: 600; }
.steps strong { color: var(--ink); }

/* =========================================================================
   F5 — Three tensions
   ========================================================================= */
.tensions { display: grid; gap: 0.9rem; }
.tension {
  display: grid; grid-template-columns: auto 1fr; gap: 0.9rem; align-items: start;
  background: var(--paper-2); border: 1px solid var(--paper-3); border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
}
.tension__n { font-family: var(--display); font-weight: 600; font-size: 1.3rem; color: var(--accent-2); }
.tension__q { margin: 0; color: var(--ink-soft); font-size: 1rem; line-height: 1.55; }

/* =========================================================================
   F5 — Positioning map (2x2)
   ========================================================================= */
.pmap-wrap { margin-top: 0.5rem; }
.pmap {
  position: relative; width: 100%; aspect-ratio: 1 / 1; max-width: 560px; margin-inline: auto;
  background: var(--paper-2); border: 1px solid var(--paper-3); border-radius: var(--radius);
  overflow: hidden;
}
/* Quadrant grid lines */
.pmap::before, .pmap::after { content: ""; position: absolute; background: var(--paper-3); }
.pmap::before { left: 50%; top: 0; bottom: 0; width: 1px; }
.pmap::after { top: 50%; left: 0; right: 0; height: 1px; }
.pmap__axis { position: absolute; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-faint); }
.pmap__axis.x0 { left: 0.6rem; top: 50%; transform: translateY(-50%); }
.pmap__axis.x1 { right: 0.6rem; top: 50%; transform: translateY(-50%); text-align: right; }
.pmap__axis.y0 { bottom: 0.5rem; left: 50%; transform: translateX(-50%); }
.pmap__axis.y1 { top: 0.5rem; left: 50%; transform: translateX(-50%); }
.pmap__open {
  position: absolute; border: 1px dashed color-mix(in srgb, var(--accent) 45%, transparent);
  background: color-mix(in srgb, var(--accent) 7%, transparent); border-radius: 8px;
}
.pmap__open-label { position: absolute; font-size: 0.66rem; font-weight: 700; color: var(--accent-2); letter-spacing: 0.04em; }
.marker {
  position: absolute; transform: translate(-50%, 50%);
  display: grid; place-items: center; cursor: pointer;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--ink-soft); border: 2px solid var(--paper);
  transition: transform var(--dur) var(--ease), background var(--dur) var(--ease);
}
.marker:hover, .marker:focus-visible { transform: translate(-50%, 50%) scale(1.35); outline: none; z-index: 5; }
.marker[data-me="1"] { background: var(--accent); width: 18px; height: 18px; box-shadow: 0 0 0 4px var(--accent-tint); }
.marker__dot { display: none; }
.marker__label {
  position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  font-size: 0.72rem; font-weight: 700; color: var(--ink); white-space: nowrap;
  background: var(--paper); border: 1px solid var(--paper-3); border-radius: 6px; padding: 0.15rem 0.4rem;
  opacity: 0; pointer-events: none; transition: opacity var(--dur) var(--ease);
}
.marker[data-me="1"] .marker__label { opacity: 1; }
.marker:hover .marker__label, .marker:focus-visible .marker__label { opacity: 1; }
.pmap__read {
  margin-top: 1rem; background: var(--paper-2); border: 1px solid var(--paper-3); border-radius: 12px;
  padding: 0.9rem 1.05rem; min-height: 3.6rem; font-size: 0.95rem; color: var(--ink-soft);
}
.pmap__read strong { color: var(--ink); }
.pmap__read.is-placeholder { color: var(--ink-faint); font-style: italic; }

/* =========================================================================
   Footer
   ========================================================================= */
.footer { padding-block: clamp(2.5rem, 7vw, 4rem); color: var(--ink-soft); }
.footer__made { font-size: 0.82rem; color: var(--ink-faint); margin-top: 1.2rem; }
.footer__made em { font-style: italic; }

/* Dark espresso footer (full-bleed bookend) */
.footer--dark { background: var(--espresso); padding-block: clamp(2.75rem, 8vw, 4.5rem); }
.footer--dark .footer__inner { color: color-mix(in srgb, var(--cream) 78%, transparent); }
.footer--dark .linkrow a { color: var(--cream); background: rgba(255,255,255,0.07); border-color: rgba(255,255,255,0.16); }
.footer--dark .linkrow a:hover { background: rgba(255,255,255,0.13); border-color: var(--amber); }
.footer--dark .footer__made { color: color-mix(in srgb, var(--cream) 52%, transparent); }

/* =========================================================================
   Motion — page-load staggered reveal
   ========================================================================= */
[data-reveal] {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity var(--dur-slower) var(--ease), transform var(--dur-slower) var(--ease);
}
[data-reveal].is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  [data-reveal] { opacity: 1; transform: none; }
  /* The wildcard above does NOT reach view-transition pseudo-elements — kill them explicitly. */
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) { animation: none !important; }
}

/* Small screens: stack stat pairs a touch tighter */
@media (max-width: 400px) {
  body { font-size: 16px; }
  .bar { grid-template-columns: 6.2rem 1fr auto; font-size: 0.8rem; }
  .bar__val { min-width: 3.8rem; }
}

/* =========================================================================
   DARK ESPRESSO TREATMENT (across all pages)
   Dramatic dark bands + dark nav on every page; tools stay on warm paper.
   ========================================================================= */
:root {
  --cream-soft: #CDBBA8;   /* muted cream for body text on dark bands */
}

/* Cohesive dark nav on every page */
.topnav {
  background: color-mix(in srgb, var(--espresso) 90%, transparent);
  border-bottom: 1px solid rgba(244, 236, 225, 0.10);
}
.topnav__brand { color: var(--cream); }
.topnav__brand:hover { color: var(--amber); }
.topnav__links a { color: var(--cream-soft); }
.topnav__links a:hover { background: rgba(244, 236, 225, 0.08); color: var(--cream); }
.topnav__links a[aria-current="page"] { color: var(--espresso); background: var(--amber); }

/* Full-bleed dark bands: home hero + interior page heads */
.band-dark {
  position: relative; overflow: hidden;
  background: radial-gradient(120% 150% at 50% -25%, #2E2018 0%, var(--espresso) 62%);
  color: var(--cream);
}
.band-dark > .wrap { position: relative; z-index: 1; }
.band-dark .section__eyebrow { color: var(--amber); }
.band-dark .section__title,
.band-dark .masthead__name { color: var(--cream); }
.band-dark .section__lead,
.band-dark .masthead__line { color: var(--cream-soft); }
.band-dark .masthead__role { color: var(--amber); }
.band-dark .masthead__banner {
  background: rgba(244, 236, 225, 0.06); border-color: rgba(244, 236, 225, 0.15); color: var(--cream-soft);
}
.band-dark .linkrow a {
  background: rgba(244, 236, 225, 0.06); border-color: rgba(244, 236, 225, 0.16); color: var(--cream);
}
.band-dark .linkrow a:hover { background: rgba(244, 236, 225, 0.12); border-color: var(--amber); }
.band-dark .illus-tag {
  background: rgba(217, 138, 74, 0.16); border-color: rgba(217, 138, 74, 0.4); color: var(--amber);
}

/* Interior page-head band spacing */
.pagehead { padding-block: clamp(2.75rem, 8vw, 4.5rem); }
.pagehead .section__lead { margin-bottom: 0; }

/* Home hero as a dark band */
.masthead.band-dark { padding-block: clamp(3rem, 9vw, 5rem) clamp(2.5rem, 7vw, 4rem); }

/* Bolder editorial type */
.masthead__name { font-size: clamp(2.9rem, 12vw, 5.6rem); letter-spacing: -0.03em; line-height: 0.94; }
.section__title { letter-spacing: -0.02em; }

/* Signature moment: a slow breathing amber glow behind the headline */
.band-dark::before {
  content: ""; position: absolute; left: 50%; top: 42%; z-index: 0;
  width: min(78vw, 660px); aspect-ratio: 1; transform: translate(-50%, -50%);
  border-radius: 50%; pointer-events: none; filter: blur(44px);
  background: radial-gradient(circle, color-mix(in srgb, var(--amber) 42%, transparent) 0%, transparent 66%);
  animation: glow-breathe 7s var(--ease) infinite;
}
@media (prefers-reduced-motion: reduce) { .band-dark::before { animation: none; opacity: 0.2; } }

/* =========================================================================
   Hero imagery + atmosphere (OOMPH)
   Drop a photo at assets/img/hero.jpg and the hero becomes photographic;
   a missing file degrades gracefully to the espresso base. Steam is pure CSS.
   ========================================================================= */
.hero__photo {
  position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    linear-gradient(180deg, rgba(29,20,14,0.66) 0%, rgba(29,20,14,0.86) 68%, var(--espresso) 100%),
    url('img/hero.jpg');
  background-size: cover; background-position: center;
}
.hero__steam { position: absolute; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.hero__steam span {
  position: absolute; bottom: -12%; width: 90px; height: 90px; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--cream) 22%, transparent), transparent 66%);
  filter: blur(18px); opacity: 0; animation: steam 9s ease-in-out infinite;
}
.hero__steam span:nth-child(1) { left: 16%; animation-delay: 0s; }
.hero__steam span:nth-child(2) { left: 46%; width: 68px; height: 68px; animation-delay: 3s; }
.hero__steam span:nth-child(3) { left: 72%; width: 112px; height: 112px; animation-delay: 6s; }
@keyframes steam {
  0%   { transform: translateY(0) scale(0.8); opacity: 0; }
  22%  { opacity: 0.5; }
  60%  { opacity: 0.32; }
  100% { transform: translateY(-330px) scale(1.45); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) { .hero__steam { display: none; } }

/* =========================================================================
   CINEMATIC IMAGERY (across the site)
   Photos self-hosted in assets/img and layered UNDER dark scrims so text
   stays readable. Each surface takes its image via a --*-img custom prop set
   inline per page; a missing file degrades gracefully to the espresso base.
   ========================================================================= */

/* Home hero: slow Ken Burns push on the photo layer */
.hero__photo { animation: kenburns 26s ease-out infinite alternate; will-change: transform; }
@keyframes kenburns { from { transform: scale(1.04); } to { transform: scale(1.15); } }
@media (prefers-reduced-motion: reduce) { .hero__photo { animation: none; } }

/* Why-this-exists intro statement */
.why__lead {
  font-family: var(--display); font-weight: 500;
  font-size: clamp(1.6rem, 5vw, 2.6rem); line-height: 1.15; letter-spacing: -0.015em;
  color: var(--ink); max-width: 22ch; margin: 0 0 1.1rem; text-wrap: balance;
}
.why__body { max-width: 48ch; color: var(--ink-soft); font-size: 1.08rem; margin: 0; }

/* Interior page-head bands: coffee photo on its own brightened layer (the
   source shots are near-black; brightness lifts them so they clearly read),
   under a moderate scrim. text-shadow keeps the copy legible over the photo. */
.pagehead.band-dark { background: var(--espresso); }
.pagehead.band-dark::before { display: none; }   /* photo replaces the glow here */
.band-photo {
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: var(--band-img, none) center/cover no-repeat;
  filter: brightness(1.05) saturate(1.1) contrast(1.02);
}
.pagehead.band-dark::after {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  /* Vertical darkening keeps top copy legible; the diagonal layer adds extra
     protection under the left-aligned text while the image still reads lower/right. */
  background:
    linear-gradient(180deg, rgba(20,13,9,0.72) 0%, rgba(20,13,9,0.52) 55%, rgba(20,13,9,0.58) 100%),
    linear-gradient(105deg, rgba(20,13,9,0.5) 0%, rgba(20,13,9,0.12) 52%, transparent 100%);
}
.pagehead.band-dark > .wrap { position: relative; z-index: 2; }
.band-dark .section__eyebrow,
.band-dark .section__title,
.band-dark .section__lead,
.band-dark .masthead__name,
.band-dark .masthead__line { text-shadow: 0 1px 18px rgba(0, 0, 0, 0.6); }

/* Four rooms: dark cinematic image tiles.
   The CSS background image is the fallback; when the WebGL fx canvas mounts it
   covers this. The scrim is an overlay (::before) so it sits above the canvas
   but below the text. */
.tool {
  color: var(--cream);
  align-content: end; min-height: 12.5rem;
  border-color: rgba(244, 236, 225, 0.14);
  overflow: hidden;
  background:
    var(--tool-img, none) center/cover no-repeat,
    var(--espresso);
}
.tool::before {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(180deg, rgba(26,17,11,0.22) 0%, rgba(26,17,11,0.55) 46%, rgba(26,17,11,0.94) 100%);
}
.tool__n { color: var(--amber); text-shadow: 0 1px 12px rgba(0, 0, 0, 0.55); }
.tool__t, .tool__d { text-shadow: 0 1px 12px rgba(0, 0, 0, 0.6); }
.tool__t { color: var(--cream); }
.tool__d { color: var(--cream-soft); }
.tool__n, .tool__t, .tool__d { position: relative; z-index: 2; }
.tool:hover { border-color: var(--amber); box-shadow: var(--shadow-md), var(--glow); }

/* WebGL displacement canvas layered under the scrim (tiles + band photos) */
.fx-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; z-index: 0; pointer-events: none; }

/* WebGL hero shader — self-contained drifting warm "coffee smoke" light.
   Blended over the photo; degrades gracefully (canvas stays blank) if the
   context can't be created, and is disabled under reduced-motion. */
.hero__gl {
  position: absolute; inset: 0; z-index: -1; width: 100%; height: 100%;
  pointer-events: none; mix-blend-mode: screen; opacity: 0.7;
}
@media (prefers-reduced-motion: reduce) { .hero__gl { display: none; } }
