/* ===== v4: navigation, reading aids, footer and page components ===== */
html { scroll-padding-top: 6rem; }
.readbar { position: fixed; left: 0; top: 0; height: 3px; width: 100%; z-index: 40; transform-origin: 0 50%; transform: scaleX(0); background: linear-gradient(90deg, var(--saffron), var(--saffron-hot)); }
.rail nav { gap: 1.125rem; }
.rail nav a { padding: 0.375rem 2px; }
.menu-btn { display: none; margin-left: auto; width: 2.75rem; height: 2.75rem; border: 0; border-radius: 0.375rem; cursor: pointer; background: rgba(27,28,28,0.9); box-shadow: inset 0 0 0 1px var(--pewter-shadow); color: var(--bone); font: 700 0.8125rem var(--display); letter-spacing: 0.1em; }
.drawer { position: fixed; inset: 0; z-index: 45; background: rgba(11,12,12,0.96); display: none; flex-direction: column; padding: 6rem 1.75rem 1.75rem; gap: 0.375rem; }
.drawer.open { display: flex; }
.drawer a { color: var(--bone); text-decoration: none; font: 800 1.875rem/1.25 var(--display); font-stretch: 75%; text-transform: uppercase; padding: 0.5rem 0; border-bottom: 1px solid var(--iron-edge); }
.drawer a[aria-current="page"] { color: var(--saffron-hot); }
.drawer .close { position: absolute; top: 1.5rem; right: 1.5rem; }
@media (max-width: 1180px) { .rail nav { display: none; } .menu-btn { display: inline-flex; align-items: center; justify-content: center; } .rail .btn-primary { margin-left: 0; } }

/* On this page */
.toc { position: sticky; top: 5.25rem; z-index: 4; display: flex; gap: 0.5rem; flex-wrap: wrap; padding: 0.625rem var(--pad); margin: 0 0 0.5rem; pointer-events: none; }
.toc a { pointer-events: auto; text-decoration: none; padding: 0.4375rem 0.75rem; border-radius: 1rem; font: 600 0.8125rem var(--text); color: var(--bone-2); background: rgba(20,21,21,0.88); box-shadow: inset 0 0 0 1px var(--iron-edge); backdrop-filter: blur(0.375rem); }
.toc a:hover { color: var(--bone); box-shadow: inset 0 0 0 1px var(--pewter-shadow); }
.toc a.on { color: #140A02; background: var(--saffron-hot); box-shadow: none; }
@media (max-width: 760px) { .toc { display: none; } }

.backtop { position: fixed; left: 1.375rem; bottom: 1.375rem; z-index: 30; width: 2.875rem; height: 2.875rem; border-radius: 50%; border: 0; cursor: pointer; color: var(--bone); background: rgba(27,28,28,0.92); box-shadow: inset 0 0 0 1px var(--pewter-shadow); opacity: 0; pointer-events: none; transition: opacity .3s; font: 800 1.125rem var(--display); }
.backtop.show { opacity: 1; pointer-events: auto; }

/* Footer */
.foot { position: relative; z-index: 1; margin-top: 8vh; padding: 3.5rem var(--pad) 2.5rem; background: linear-gradient(180deg, rgba(11,12,12,0.6), #0b0c0c 30%); border-top: 1px solid var(--iron-edge); }
.foot-grid { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 2rem; }
.foot h4 { margin: 0 0 0.75rem; color: var(--pewter); }
.foot a { display: block; color: var(--bone-2); text-decoration: none; padding: 0.25rem 0; font-size: 0.9375rem; }
.foot a:hover { color: var(--bone); }
.foot .brandline { font: 800 1.375rem/1.1 var(--display); font-stretch: 75%; text-transform: uppercase; color: var(--bone); }
.foot p { color: var(--pewter); font-size: 0.875rem; margin: 0.625rem 0 0; max-width: 34em; }
.foot .base { margin-top: 2.25rem; padding-top: 1.125rem; border-top: 1px solid #1d1e1e; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.75rem; color: var(--pewter); font-size: 0.8125rem; }
@media (max-width: 900px) { .foot-grid { grid-template-columns: 1fr 1fr; } }

/* Shared section rhythm */
.band { padding: 12vh var(--pad); }
.band.tight { padding-top: 6vh; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(1.5rem, 4vw, 4rem); align-items: start; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.125rem; }
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.card { padding: 1.875rem 1.625rem 1.75rem; }
.card h3 { font: 800 1.625rem/1.05 var(--display); font-stretch: 75%; text-transform: uppercase; color: var(--bone); margin: 0.75rem 0 0.625rem; }
.card p { margin: 0; font-size: 1rem; line-height: 1.6; color: var(--bone-2); }
.card ul { margin: 0.75rem 0 0; padding-left: 1.125rem; color: var(--bone-2); font-size: 0.9688rem; line-height: 1.55; }
.card .k { color: var(--saffron-hot); }
.lead { font-size: clamp(1.125rem, 1.35vw, 1.375rem); color: var(--bone-2); max-width: 40em; margin: 0; padding: 0 1.375rem; }
.lead strong { color: var(--bone); font-weight: 600; }
@media (max-width: 1000px) { .grid2, .grid3, .grid4 { grid-template-columns: 1fr; } }

/* Ledger strip */
.ledger-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0 var(--pad); }
.ledger-strip div { padding: 1.625rem 1.5rem; border-right: 1px solid var(--iron-edge); }
.ledger-strip div:last-child { border-right: 0; }
.ledger-strip b { display: block; font: 800 clamp(1.875rem, 3vw, 2.875rem)/1 var(--display); font-stretch: 75%; color: var(--bone); }
.ledger-strip span { display: block; margin-top: 0.5rem; color: var(--pewter); font-size: 0.9062rem; }
@media (max-width: 900px) { .ledger-strip { grid-template-columns: 1fr 1fr; } .ledger-strip div:nth-child(2) { border-right: 0; } }

/* Problem stats */
.stat { padding: 2.125rem 1.875rem; }
.stat b { display: block; font: 800 clamp(3.5rem, 6vw, 6rem)/0.9 var(--display); font-stretch: 75%; color: var(--saffron-hot); }
.stat p { margin: 0.875rem 0 0; color: var(--bone); font-size: 1.125rem; }
.stat cite { display: block; margin-top: 0.625rem; font-style: normal; color: var(--pewter); font-size: 0.8438rem; }

/* Offer ladder */
.ladder { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; position: relative; }
.ladder .rung { padding: 1.625rem 1.375rem; position: relative; }
.ladder .rung + .rung { border-left: 1px solid var(--iron-edge); }
.ladder .when { color: var(--saffron-hot); }
.ladder h3 { font: 800 1.75rem/1 var(--display); font-stretch: 75%; text-transform: uppercase; color: var(--bone); margin: 0.625rem 0 0.5rem; }
.ladder .price { font: 700 1.125rem var(--display); color: var(--bone); margin: 0 0 0.5rem; }
.ladder p { margin: 0; color: var(--bone-2); font-size: 0.9688rem; line-height: 1.55; }
.ladder-rail { position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--iron-edge); }
.ladder-rail i { position: absolute; left: 0; top: 0; height: 3px; width: 0; background: linear-gradient(90deg, var(--saffron-hot), var(--green-text)); }
@media (max-width: 1000px) { .ladder { grid-template-columns: 1fr; } .ladder .rung + .rung { border-left: 0; border-top: 1px solid var(--iron-edge); } }

/* FAQ */
.faq { display: grid; gap: 0.625rem; }
.faq details { border-radius: 0.5rem; background: #171818; box-shadow: inset 0 0 0 1px var(--iron-edge); }
.faq summary { cursor: pointer; list-style: none; padding: 1.125rem 1.375rem; display: flex; justify-content: space-between; gap: 1rem; color: var(--bone); font: 650 1.125rem/1.35 var(--text); }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--saffron-hot); font: 800 1.375rem/1 var(--display); transition: transform .25s; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { margin: 0; padding: 0 1.375rem 1.25rem; color: var(--bone-2); font-size: 1.0312rem; line-height: 1.6; }

/* Founder strip */
.fstrip { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 2rem; align-items: center; padding: 2.5rem 2.375rem; }
.fstrip blockquote { margin: 0; font: 750 clamp(1.5rem, 2.2vw, 2.125rem)/1.18 var(--display); font-stretch: 87.5%; color: var(--bone); }
.fstrip .who { color: var(--pewter); margin-top: 1rem; }
@media (max-width: 900px) { .fstrip { grid-template-columns: 1fr; } }

/* Steppers for play-once diagrams */
.stepper { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-top: 1rem; }
.stepper button { border: 0; cursor: pointer; padding: 0.5625rem 0.875rem; border-radius: 0.375rem; font: 650 0.8125rem var(--display); font-stretch: 87.5%; letter-spacing: 0.1em; text-transform: uppercase; color: var(--bone-2); background: #181919; box-shadow: inset 0 0 0 1px var(--iron-edge); }
.stepper button[aria-pressed="true"] { color: #140A02; background: var(--saffron-hot); box-shadow: none; }
.stepper .sp { flex: 1; }

/* Week timeline */
.weeks svg { width: 100%; height: auto; display: block; }

/* Services */
.svc-stage { position: relative; height: min(70vh, 38.75rem); border-radius: 0.75rem; overflow: hidden; background: radial-gradient(50rem 25rem at 50% 60%, #1a1612, #0d0e0e); box-shadow: inset 0 0 0 1px var(--iron-edge); }
.svc-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.svc-tabs { display: grid; gap: 0.5rem; }
.svc-tabs button { text-align: left; border: 0; cursor: pointer; padding: 1rem 1.125rem; border-radius: 0.5rem; background: transparent; color: var(--bone-2); box-shadow: inset 0 0 0 1px transparent; font: 380 0.9688rem/1.5 var(--text); display: grid; grid-template-columns: 2.375rem 1fr; gap: 0.75rem; }
.svc-tabs button b { display: block; color: var(--bone); font: 750 1.1875rem/1.2 var(--display); font-stretch: 87.5%; text-transform: uppercase; margin-bottom: 0.25rem; }
.svc-tabs button .n { font: 800 1.5rem/1 var(--display); font-stretch: 75%; color: var(--pewter-shadow); }
.svc-tabs button[aria-selected="true"] { background: #1B1C1C; box-shadow: inset 0 0 0 1px var(--iron-edge), inset 3px 0 0 var(--saffron-hot); }
.svc-tabs button[aria-selected="true"] .n { color: var(--saffron-hot); }
.svc-detail { position: absolute; left: 1.375rem; right: 1.375rem; bottom: 1.25rem; padding: 1.125rem 1.25rem; border-radius: 0.5rem; background: rgba(17,18,19,0.86); box-shadow: inset 0 0 0 1px var(--iron-edge); backdrop-filter: blur(0.25rem); }
.svc-detail h3 { margin: 0 0 0.375rem; font: 800 1.5rem var(--display); font-stretch: 75%; text-transform: uppercase; color: var(--bone); }
.svc-detail ul { margin: 0; padding-left: 1.125rem; color: var(--bone-2); font-size: 0.9375rem; }

/* Security boundary */
.boundary svg { width: 100%; height: auto; display: block; }
.own { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.75rem; }
.own div { padding: 1.125rem 1.25rem; border-radius: 0.5rem; background: #171818; box-shadow: inset 0 0 0 1px var(--iron-edge); display: flex; justify-content: space-between; align-items: center; gap: 0.625rem; color: var(--bone); font-size: 1rem; }
.own div span { color: var(--green-text); font: 750 0.8125rem var(--display); letter-spacing: 0.14em; text-transform: uppercase; }
@media (max-width: 900px) { .own { grid-template-columns: 1fr; } }

/* Pricing */
.tiers { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.tier { padding: 1.875rem 1.5rem 1.625rem; display: flex; flex-direction: column; }
.tier.feature { box-shadow: inset 0 0 0 1px var(--saffron-hot), 0 1.25rem 3.75rem rgba(236,124,12,0.12), 0 1.875rem 4.375rem rgba(0,0,0,0.5); }
.tier .amt { font: 800 2.75rem/1 var(--display); font-stretch: 75%; color: var(--bone); margin: 0.875rem 0 0.25rem; }
.tier .per { color: var(--pewter); font-size: 0.875rem; }
.tier ul { margin: 1rem 0 0; padding-left: 1.125rem; color: var(--bone-2); font-size: 0.9375rem; line-height: 1.6; flex: 1; }
.calc { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: 1.75rem; padding: 2.125rem 2rem; }
.calc label { display: block; color: var(--bone-2); font-size: 0.9375rem; margin: 0 0 1rem; }
.calc label b { float: right; color: var(--bone); font-family: var(--display); }
.calc input[type=range] { width: 100%; accent-color: #EC7C0C; margin-top: 0.5rem; }
.calc .result { font: 800 clamp(2.125rem, 3.4vw, 3.25rem)/1 var(--display); font-stretch: 75%; color: var(--saffron-hot); }
.calc svg { width: 100%; height: auto; display: block; }
@media (max-width: 1000px) { .tiers, .calc { grid-template-columns: 1fr; } }

/* Worked examples */
.ex-tabs { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.125rem; }
.ex-tabs button { border: 0; cursor: pointer; padding: 0.75rem 1rem; border-radius: 0.5rem; color: var(--bone-2); background: #181919; box-shadow: inset 0 0 0 1px var(--iron-edge); font: 650 0.9375rem var(--text); }
.ex-tabs button[aria-selected="true"] { color: var(--bone); background: #232423; box-shadow: inset 0 0 0 1px var(--saffron-hot); }
.ex-intro { margin: 0 0 0.875rem; color: var(--bone-2); max-width: 52em; }
.ex-intro b { color: var(--bone); }

/* ===== Fluid scale: one root size drives every rem, from phones to 55-inch screens ===== */
html { font-size: clamp(16px, 0.35vw + 11px, 26px); }
:root { --maxw: clamp(1100px, 82vw, 2600px); --pad: max(clamp(20px, 4vw, 72px), calc((100vw - var(--maxw)) / 2)); }
@media (min-width: 2200px) { .rail { left: var(--pad); right: var(--pad); } }

/* Film control pills: text labels need width; the narration button stands out */
.film-controls .ctl { width: auto; min-width: 2.75rem; padding: 0 1rem; border-radius: 1.375rem; white-space: nowrap; }
.film-controls .ctl-voice { background: rgba(209,103,11,0.16); box-shadow: inset 0 0 0 1px var(--saffron-hot); color: var(--bone); }
.film-controls .ctl-voice[aria-pressed="true"] { background: rgba(28,82,33,0.35); box-shadow: inset 0 0 0 1px #3fa35a; color: var(--bone); }
.film-controls .ctl:focus-visible, .scrub:focus-visible { outline: 2px solid var(--saffron-hot); outline-offset: 3px; }
/* Skip link: hidden until focused */
.skiplink { position: absolute; left: 1rem; top: -4rem; z-index: 1000; padding: 0.75rem 1.125rem; border-radius: 0.5rem; background: var(--bone); color: #111213; font: 700 0.9375rem var(--display); text-decoration: none; transition: top .2s; }
.skiplink:focus { top: 1rem; }

/* About timeline: years light up as the rail fills */
.timeline li::before { transition: background .3s, box-shadow .3s; }
.timeline li.on::before { background: var(--saffron-hot); box-shadow: 0 0 0 4px rgba(236,124,12,0.18); }
.legend button { transition: background .25s, box-shadow .25s; }
/* Services fallback when WebGL is unavailable */
.svc-stage.no-gl canvas { display: none; }
.svc-stage.no-gl .svc-detail { position: static; margin: 1.25rem; }
.svc-stage.no-gl { height: auto; }

/* Phones: footer columns may shrink below their longest word; the long email wraps; the rail never pushes past the edge */
.foot-grid { grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr)); }
.foot a { overflow-wrap: anywhere; }
@media (max-width: 900px) { .foot-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .foot-grid > div:first-child { grid-column: 1 / -1; } }
@media (max-width: 420px) { .foot-grid { grid-template-columns: minmax(0, 1fr); } }
.rail .brand { min-width: 0; flex: 0 1 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail .btn, .menu-btn { flex: none; }

/* Two-column layouts take their column split from --cols, so the phone rule below can always override it */
.grid2 { grid-template-columns: var(--cols, minmax(0, 1fr) minmax(0, 1fr)); }
@media (max-width: 1000px) { .grid2 { grid-template-columns: minmax(0, 1fr); } }

/* The hidden attribute always wins over component display rules */
[hidden] { display: none !important; }
.rail.tight nav { display: none; }
.rail.tight .menu-btn { display: inline-flex; align-items: center; justify-content: center; }
.rail.tight .btn-primary { margin-left: 0; }
/* Brand stacks on two lines below very wide screens, so the full nav fits on 14-inch laptops */
.rail .brand span { white-space: nowrap; }
@media (max-width: 1899px) {
  .rail .brand { line-height: 1.02; overflow: visible; text-overflow: clip; white-space: normal; }
  .rail .brand span { display: block; }
  .rail { gap: 1.25rem; }
  .rail nav { gap: 0.9rem; }
}
@media (max-width: 1500px) { .rail nav a { letter-spacing: 0.08em; } .rail nav { gap: 0.75rem; } }


/* The rail is a cast-iron plate in its own right, so page content never shows through it while scrolling */
.rail {
  --nut: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' viewBox='0 0 22 22'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='1' y2='1'%3E%3Cstop offset='0' stop-color='%23d3c5ad'/%3E%3Cstop offset='.45' stop-color='%238b8273'/%3E%3Cstop offset='1' stop-color='%2333302b'/%3E%3C/linearGradient%3E%3CradialGradient id='b' cx='.38' cy='.32' r='.75'%3E%3Cstop offset='0' stop-color='%23b3a793'/%3E%3Cstop offset='1' stop-color='%23262422'/%3E%3C/radialGradient%3E%3C/defs%3E%3Ccircle cx='11' cy='11.6' r='10' fill='%23000' opacity='.55'/%3E%3Cpolygon points='11,1.6 19.1,6.3 19.1,15.7 11,20.4 2.9,15.7 2.9,6.3' fill='url(%23g)' stroke='%23161514' stroke-width='.8'/%3E%3Cpolygon points='11,3.4 17.5,7.2 17.5,14.8 11,18.6 4.5,14.8 4.5,7.2' fill='none' stroke='%23ffffff' stroke-opacity='.12' stroke-width='.6'/%3E%3Ccircle cx='11' cy='11' r='4.8' fill='url(%23b)' stroke='%2322201e' stroke-width='.8'/%3E%3Ccircle cx='11' cy='11' r='1.9' fill='%23171818'/%3E%3C/svg%3E");
  background-image: var(--nut), var(--nut), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .8 0 0 0 0 .75 0 0 0 0 .68 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E"), linear-gradient(180deg, #2c2d2c 0%, #212221 46%, #1a1b1b 100%);
  background-size: 1.125rem 1.125rem, 1.125rem 1.125rem, 160px 160px, auto;
  background-position: 0.5rem 50%, calc(100% - 0.5rem) 50%, 0 0, 0 0;
  background-repeat: no-repeat, no-repeat, repeat, no-repeat;
  border-radius: 0.5rem; padding-left: 2.125rem; padding-right: 2.125rem;
  box-shadow: inset 0 1px 0 rgba(201,188,166,0.26), inset 0 0 0 1px #3b3934, inset 0 -2px 0 #8a5a36, 0 0.75rem 2.25rem rgba(0,0,0,0.6);
}
@media (max-width: 600px) { .rail { background-size: 0.875rem 0.875rem, 0.875rem 0.875rem, 160px 160px, auto; background-position: 0.375rem 50%, calc(100% - 0.375rem) 50%, 0 0, 0 0; padding-left: 1.5rem; padding-right: 1.5rem; } }

/* Film controls stay clear of the floating Ask the Lab button */
@media (min-width: 601px) { .film-ui { padding-right: calc(var(--pad) + 11rem); } }
@media (max-width: 600px) { .film-ui { padding-bottom: 5.25rem; } }
/* Services on phones and small tablets: the shape on top, the detail card below it */
@media (max-width: 760px) {
  .svc-stage { height: auto; display: flex; flex-direction: column; }
  .svc-stage canvas { position: relative; inset: auto; height: 19rem; }
  .svc-detail { position: static; margin: 0 1rem 1rem; }
}

/* About timeline progress line (drawn here so the list holds only list items) */
.timeline::after { content: ""; position: absolute; left: 2rem; top: 2.5rem; width: 2px; height: var(--fill, 0); background: linear-gradient(180deg, var(--saffron-hot), var(--green-text)); }
