/* BranchEagle website.
   Palette from the logo: ink #2b2b2b, cream #f6efe6. One accent: amber,
   used like a reviewer's highlighter for what needs a person. Type:
   Bricolage Grotesque (display + text) and JetBrains Mono (code, numbers),
   self-hosted with font-display: optional so fonts never shift the layout. */

@font-face {
  font-family: "Bricolage Grotesque";
  src: url("assets/fonts/bricolage-grotesque-latin.woff2") format("woff2");
  font-weight: 200 800;
  font-stretch: 75% 100%;
  font-display: optional;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("assets/fonts/jetbrains-mono-latin.woff2") format("woff2");
  font-weight: 100 800;
  font-display: optional;
}

:root {
  --ink: #2b2b2b;
  --cream: #f6efe6;
  --paper: #fbf8f3;
  --line: #e2d8ca;
  --muted: #6a645b;
  --muted-dark: #b9b0a3;
  --amber: #f2b705;
  --text: #3f3c37;
  --sans: "Bricolage Grotesque", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --wrap: 1240px;
  --gutter: clamp(16px, 4vw, 48px);
  --header: 64px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0; background: var(--cream); color: var(--ink);
  font: 400 1.0625rem/1.6 var(--sans);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
/* amber alone is 1.7:1 on cream: an ink ring with an amber halo reads on every band */
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; box-shadow: 0 0 0 6px var(--amber); border-radius: 4px; }
code, kbd, pre { font-family: var(--mono); font-size: .86em; font-variant-ligatures: none; }
code { background: rgba(43, 43, 43, .07); padding: .08em .35em; border-radius: 4px; }
kbd {
  display: inline-block; min-width: 1.7em; padding: .05em .4em; text-align: center;
  border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px;
  background: var(--paper); font-size: .8em; line-height: 1.5;
}
h1, h2, h3, h4 { margin: 0; font-weight: 750; letter-spacing: -.02em; line-height: 1.08; }
p { margin: 0 0 1em; text-wrap: pretty; }
li { text-wrap: pretty; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding-inline: var(--gutter); }
.skip { position: absolute; left: -999px; top: 8px; z-index: 50; background: var(--ink); color: var(--cream); padding: .5rem 1rem; border-radius: 6px; }
.skip:focus { left: 8px; }

/* "Coming soon": dashed, like a requirement with no code yet */
.soon {
  display: inline-block; vertical-align: .12em; white-space: nowrap;
  font: 600 .7rem/1 var(--sans); letter-spacing: .01em;
  padding: .32em .6em; border-radius: 999px;
  border: 1.5px dashed currentColor; color: var(--muted);
}
.avail {
  display: inline-block; vertical-align: .12em; white-space: nowrap;
  font: 600 .7rem/1 var(--sans); padding: .38em .66em; border-radius: 999px;
  background: var(--amber); color: var(--ink);
}

/* ---------- header ---------- */
.top {
  position: sticky; top: 0; z-index: 20; height: var(--header);
  background: rgba(246, 239, 230, .92);
  backdrop-filter: saturate(1.2) blur(10px); -webkit-backdrop-filter: saturate(1.2) blur(10px);
  border-bottom: 1px solid rgba(43, 43, 43, .08);
}
.nav { display: flex; align-items: center; justify-content: space-between; height: 100%; gap: 1rem; }
.brand { display: block; width: 168px; flex: none; }
.links { display: flex; align-items: center; gap: clamp(.6rem, 2vw, 1.6rem); font-size: .95rem; font-weight: 500; }
.links a { text-decoration: none; }
.links a:hover { text-decoration: underline; }
.nav-cta { background: var(--ink); color: var(--cream); padding: .45rem .9rem; border-radius: 8px; }
.nav-cta:hover { background: #000; text-decoration: none !important; }
@media (max-width: 720px) {
  .brand { width: 132px; }
  .links a:not(.nav-cta) { display: none; }
}

/* ---------- scroll story ---------- */
.story { position: relative; }
.stage {
  position: sticky; top: var(--header); height: calc(100vh - var(--header)); height: calc(100svh - var(--header));
  overflow: hidden; background: var(--cream);
  --scrim: 1;
}
#scene { display: block; width: 100%; height: 100%; }
/* the cream scrim keeps the pinned text readable; story.js thins it while the camera moves */
.stage::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  opacity: var(--scrim);
  --text-end: calc(max(0px, (100% - var(--wrap)) / 2) + var(--gutter) + 600px);
  background: linear-gradient(90deg, rgba(246,239,230,.97) 0, rgba(246,239,230,.92) var(--text-end), rgba(246,239,230,0) calc(var(--text-end) + 220px));
}
.chapters { position: relative; margin-top: calc(-100vh + var(--header)); margin-top: calc(-100svh + var(--header)); }
/* each chapter: the headline pins while the scene holds, then fades for the camera move */
.chapter { height: 210vh; height: 210svh; }
.chapter:first-child { height: 190vh; height: 190svh; }
.chapter:last-child { height: 230vh; height: 230svh; }
.card {
  position: sticky; top: calc(var(--header) + 8vh);
  max-width: var(--wrap); margin: 0 auto; padding-inline: var(--gutter);
}
.card > * { max-width: 560px; }
.step {
  font: 500 .85rem/1 var(--mono); color: var(--muted); margin-bottom: 1.1rem;
  display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
}
.step span:first-child { color: var(--ink); background: var(--amber); padding: .3em .45em; border-radius: 3px; }
.card h1, .card h2 {
  font-weight: 800; font-stretch: 75%; letter-spacing: -.035em; line-height: .88;
  margin-bottom: 1.2rem; text-wrap: balance;
}
/* type rhythm: big open, quieter middle, big close */
.ch-0 h1 { font-size: clamp(3.6rem, 8.6vw, 8.8rem); max-width: 9ch; }
.ch-1 h2 { font-size: clamp(2.8rem, 5.4vw, 5.2rem); max-width: 11ch; }
.ch-2 h2 { font-size: clamp(3rem, 6.4vw, 6.2rem); }
.ch-3 h2 { font-size: clamp(2.4rem, 4.2vw, 4rem); }
.ch-4 h2 { font-size: clamp(3rem, 6vw, 5.8rem); }
.ch-5 h2 { font-size: clamp(3.4rem, 8vw, 8.2rem); max-width: 9ch; }
.sub { font-weight: 750; font-size: clamp(1.4rem, 2.2vw, 2rem); line-height: 1.1; letter-spacing: -.02em; margin-bottom: .8rem; }
.sub span { display: block; margin-top: .5rem; font-weight: 400; font-size: 1.04rem; line-height: 1.55; letter-spacing: 0; color: var(--text); }
.ch-1 .card p { max-width: 34ch; }
.card .value { font-weight: 650; color: var(--ink); }
.card p { color: var(--text); font-size: 1.08rem; max-width: 44ch; }
.actions { display: flex; gap: 1rem; flex-wrap: wrap; align-items: center; margin-top: 1.4rem; }
.btn {
  display: inline-flex; align-items: center; min-height: 46px; padding: .55rem 1.1rem;
  border-radius: 9px; border: 1.5px solid var(--ink); font-weight: 600; text-decoration: none;
}
.btn.primary { background: var(--ink); color: var(--cream); }
.btn.primary:hover { background: #000; }
.btn.link { border-color: transparent; padding-inline: .2rem; text-decoration: underline; }
.rungs { list-style: none; counter-reset: r; padding: 0; margin: 1.2rem 0 0; display: grid; gap: .35rem; font-size: .95rem; }
.rungs li { counter-increment: r; display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.rungs li::before { content: counter(r); font: 700 .8rem/1 var(--mono); width: 1.4rem; color: var(--muted); }
.rungs b { font-weight: 650; }
/* with the 3D ladder on screen, the list would say it twice */
@media (min-width: 901px) { .js:not(.no-canvas) .rungs { display: none; } }

/* HUD: a hairline trust rule on the right edge and a rolling line count */
.hud {
  position: absolute; right: var(--gutter); top: 12%; bottom: 10%; z-index: 2;
  display: flex; flex-direction: column; align-items: flex-end; justify-content: flex-end;
  pointer-events: none; transition: opacity .3s;
}
.hud.off, .hud.under { opacity: 0; }
.rule { position: absolute; right: 0; top: 0; bottom: 5.4rem; width: 2px; background: rgba(43, 43, 43, .14); }
.fill { position: absolute; left: 0; right: 0; bottom: 0; height: 8%; background: var(--amber); }
.rule-label { position: absolute; right: 10px; top: 0; font: 500 .72rem/1 var(--mono); color: var(--muted); writing-mode: vertical-rl; }
.count { display: grid; text-align: right; }
.count b { font: 600 clamp(2.4rem, 4.4vw, 3.6rem)/1 var(--mono); letter-spacing: -.04em; font-variant-numeric: tabular-nums; color: var(--ink); }
.count span { font-size: .8rem; color: var(--muted); max-width: 15ch; margin-left: auto; line-height: 1.3; margin-top: .35rem; }

/* below 1200px the scrim alone is too narrow: the pinned text gets its own backing */
@media (max-width: 1200px) {
  .card > * { max-width: none; }
  .card { max-width: 600px; margin-left: var(--gutter); padding: 1.3rem 1.4rem .6rem; background: rgba(246, 239, 230, .93); border-radius: 14px; }
  .stage::after { background: none; }
}

/* no JS or no WebGL: chapters read as a plain column */
.no-js .stage, .no-canvas .stage { display: none; }
.no-js .chapters, .no-canvas .chapters { margin-top: 0; }
.no-js .chapter, .no-canvas .chapter { height: auto; padding-block: 3.5rem; border-bottom: 1px solid var(--line); }
.no-js .card, .no-canvas .card { position: static; background: none; margin-inline: auto; }

@media (max-width: 900px) {
  /* each chapter opens with the scene alone, then the text slides in over a short scrim */
  .chapter, .chapter:first-child, .chapter:last-child { height: auto; padding-top: 70svh; padding-bottom: 45svh; }
  .chapter:first-child { padding-top: 2svh; padding-bottom: 65svh; }
  .chapter:last-child { padding-bottom: 80svh; }
  .card { position: relative; top: 0; margin: 0 12px; padding: 1.1rem 1.1rem .5rem; box-shadow: 0 12px 30px -18px rgba(43, 43, 43, .4); }
  .card p { font-size: 1rem; margin-bottom: .7em; }
  .ch-0 h1 { font-size: clamp(3rem, 15vw, 4.6rem); }
  .ch-1 h2 { font-size: clamp(2.3rem, 10.5vw, 3.2rem); }
  .ch-2 h2, .ch-4 h2 { font-size: clamp(2.6rem, 12.5vw, 3.8rem); }
  .ch-3 h2 { font-size: clamp(2.2rem, 10vw, 3rem); }
  .ch-5 h2 { font-size: clamp(3rem, 14vw, 4.4rem); }
  .rungs { font-size: .85rem; gap: .2rem; }
  .hud { right: 10px; top: 8%; bottom: 3%; }
  .rule { bottom: 3.6rem; }
  .count b { font-size: 1.9rem; }
  .count span { font-size: .7rem; max-width: 12ch; }
  .rule-label { display: none; }
  .no-js .chapter, .no-canvas .chapter { padding-block: 2.5rem; }
}

/* ---------- three readers ---------- */
.readers { background: var(--paper); padding-block: clamp(4rem, 9vw, 7rem); position: relative; z-index: 1; border-top: 1px solid var(--line); }
.section-title {
  font-size: clamp(2.6rem, 6vw, 5.6rem); font-weight: 800; letter-spacing: -.035em;
  font-stretch: 75%; line-height: .9; margin-bottom: 2rem; text-wrap: balance;
}
.readers-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1.2rem 2rem; }
.readers-head .section-title { max-width: 12ch; margin-bottom: 0; }
.tabs { display: none; gap: .4rem; padding: .3rem; border: 1.5px solid var(--ink); border-radius: 999px; }
.tabs-on .tabs { display: inline-flex; }
.tab {
  font: 650 1rem/1 var(--sans); color: var(--ink); background: none; border: 0; cursor: pointer;
  padding: .75rem 1.15rem; border-radius: 999px; min-height: 44px;
}
.tab[aria-selected="true"] { background: var(--ink); color: var(--cream); }
.role { padding-top: clamp(2.5rem, 5vw, 4rem); }
.role + .role { border-top: 1px solid var(--line); margin-top: 3rem; }
.tabs-on .role + .role { border: 0; margin: 0; }
.role-grid { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 7fr); gap: clamp(2rem, 5vw, 4.5rem); align-items: start; }
.who { font: 500 .85rem/1 var(--mono); margin-bottom: 1rem; color: var(--muted); }
.role h3 { font-size: clamp(1.9rem, 3vw, 2.8rem); font-weight: 800; font-stretch: 80%; line-height: .98; margin-bottom: 1.3rem; text-wrap: balance; }
.role ul { margin: 0; padding: 0; list-style: none; display: grid; gap: .9rem; }
.role li { padding-left: 1.1rem; position: relative; color: var(--text); }
.role li::before { content: ""; position: absolute; left: 0; top: .62em; width: 6px; height: 6px; border-radius: 50%; background: var(--ink); }
.shot { margin: 0; }
.shot img { border-radius: 12px; border: 1px solid var(--line); box-shadow: 0 30px 60px -36px rgba(43,43,43,.55); background: #fff; }
.shot figcaption { font-size: .88rem; color: var(--muted); margin-top: .8rem; }
.artefact-title { font-weight: 650; margin-bottom: .6rem; }
.gates { width: 100%; border-collapse: collapse; font-size: 1rem; }
.gates th { text-align: left; font-weight: 600; font-size: .8rem; color: var(--muted); padding: .5rem .2rem; border-bottom: 2px solid var(--ink); }
.gates td { padding: .72rem .2rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.gates td:last-child { width: 5rem; text-align: right; }
.lvl { display: inline-block; font: 600 .78rem/1 var(--mono); padding: .32em .6em; border-radius: 4px; }
.lvl.block { background: var(--ink); color: var(--cream); }
.lvl.warn { border: 1px solid var(--muted); color: var(--ink); }
.small { font-size: .9rem; color: var(--muted); margin-top: .9rem; }
.facts { margin: 0; display: grid; border-top: 2px solid var(--ink); }
.facts div { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 1.4rem; padding: 1.2rem 0; border-bottom: 1px solid var(--line); }
.facts dt { font-weight: 800; font-stretch: 80%; font-size: clamp(1.4rem, 2.2vw, 1.9rem); line-height: 1; letter-spacing: -.02em; }
.facts dd { margin: 0; color: var(--text); }

/* ---------- what it will never do ---------- */
.never-band { background: var(--ink); color: var(--cream); padding-block: clamp(4.5rem, 10vw, 8rem); }
.never-title { font: 500 .95rem/1 var(--mono); color: var(--muted-dark); margin-bottom: 2.4rem; letter-spacing: 0; }
.never { list-style: none; margin: 0; padding: 0; display: grid; gap: clamp(1.4rem, 3vw, 2.4rem); }
.never s {
  display: block; font-weight: 800; font-stretch: 75%; letter-spacing: -.035em; line-height: .95;
  font-size: clamp(2.2rem, 5vw, 4.4rem);
  text-decoration: line-through; text-decoration-color: var(--amber); text-decoration-thickness: .09em;
}
.never span { display: block; margin-top: .55rem; color: var(--muted-dark); font-size: 1.02rem; }
@media (min-width: 1000px) {
  .never li { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 2rem; align-items: center; }
  .never span { margin: 0; }
}

/* ---------- get started: the ending, on ink ---------- */
.start { padding-block: clamp(4.5rem, 10vw, 8rem) clamp(3.5rem, 7vw, 5rem); background: var(--ink); color: var(--cream); --eW: clamp(150px, 17vw, 250px); }
.start-title {
  font-weight: 800; font-stretch: 75%; letter-spacing: -.04em; line-height: .9;
  font-size: clamp(2.8rem, 7.4vw, 7.6rem); white-space: nowrap; margin-bottom: clamp(2rem, 4vw, 3rem);
}
/* the eagle's amber branch runs out of the mark and into the $ of the install line */
.start-row { position: relative; display: grid; grid-template-columns: var(--eW) minmax(0, 1fr); align-items: end; }
.start-eagle { width: var(--eW); height: auto; padding-bottom: 3.4rem; }
.start-branch {
  position: absolute; left: calc(var(--eW) * .41); top: calc(var(--eW) * .78 - 4px);
  width: calc(var(--eW) * .59 + 2px); bottom: 2.6rem;
  border-left: 6px solid var(--amber); border-bottom: 6px solid var(--amber); border-bottom-left-radius: 30px;
}
.hero-code {
  margin: 0; padding: clamp(1rem, 2vw, 1.4rem) clamp(1rem, 2.2vw, 1.6rem); overflow-x: auto;
  background: #1f1f1f; color: var(--cream); border-radius: 14px; border: 1px solid #45433f;
  font-size: clamp(1rem, 2.2vw, 2rem); line-height: 1.3; white-space: pre-wrap; overflow-wrap: anywhere;
}
.hero-code code { background: none; padding: 0; font-size: inherit; }
.hero-code code::before { content: "$ "; color: var(--amber); }
.start-notes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.6rem 2.4rem; margin-top: 2.4rem; color: #ddd3c6; font-size: .98rem; }
.start code { background: rgba(246, 239, 230, .1); }
.start .hero-code code { background: none; }

/* definition and FAQ: plain, quotable text */
.card .def { margin-top: 1.6rem; font-size: .92rem; color: var(--muted); max-width: 52ch; }
.card .def b { color: var(--ink); }
.faq { background: var(--paper); padding-block: clamp(4rem, 9vw, 7rem); border-top: 1px solid var(--line); }
.faq-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(2rem, 5vw, 4.5rem); align-items: start; }
.faq .section-title { max-width: 10ch; }
.faq-list { border-top: 2px solid var(--ink); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary {
  cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: 1rem; align-items: center;
  padding: 1.2rem 0; font-weight: 800; font-stretch: 80%; font-size: clamp(1.4rem, 2.4vw, 2.1rem); line-height: 1.02; letter-spacing: -.025em; min-height: 44px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font: 600 1.2rem/1 var(--mono); flex: none; }
.faq details[open] summary::after { content: "−"; }
.faq details p { color: var(--text); max-width: 60ch; padding-bottom: 1.3rem; margin: 0; font-size: 1.08rem; }

/* footer */
.foot { background: var(--ink); padding-block: 2rem; font-size: .9rem; color: var(--muted-dark); border-top: 1px solid #45433f; }
.foot a { color: var(--muted-dark); }
.foot-in { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1.4rem; }
.foot-mark { width: 34px; height: auto; }
.foot-in .legal { margin-left: auto; display: flex; flex-wrap: wrap; gap: .4rem 1rem; }
.legal a { color: var(--muted-dark); }

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .role-grid, .faq-grid { grid-template-columns: minmax(0, 1fr); }
  .start-notes { grid-template-columns: minmax(0, 1fr); }
  .start-title { white-space: normal; }
}
@media (max-width: 600px) {
  .start { --eW: 110px; }
  .start-row { grid-template-columns: minmax(0, 1fr); }
  .start-eagle { padding-bottom: 1.6rem; }
  .start-branch { width: 0; border-bottom: 0; border-radius: 0; bottom: auto; height: calc(1.6rem + 6px); top: calc(var(--eW) * .78 - 4px); }
  .hero-code { margin-left: calc(var(--eW) * .41 - 1rem + 3px); }
  .facts div { grid-template-columns: minmax(0, 1fr); gap: .4rem; }
  .tabs { width: 100%; }
  .tab { flex: 1; padding-inline: .5rem; font-size: .9rem; }
  .foot-in .legal { margin-left: 0; }
}
