/* ==========================================================================
   CESTA – seeker landing page of Velká Lóže Zemí Českých
   Night → day scroll story. Everything the JS engine (static/js/cesta.js)
   touches is a CSS custom property on <html> or one of the class hooks listed
   in BUILD.md; the rest is pure CSS. No frameworks, no resets beyond this one.
   ========================================================================== */

/* --------------------------------------------------------------------------
   0. Registered scalar properties (typed numbers, safe in calc()).
   They do NOT inherit on purpose: the engine writes each one on the element that
   consumes it (see cesta.js `C`), so a per-frame change re-styles a handful of
   elements instead of the ~4 000 inlined SVG nodes under <html>. Night values
   are the initial values; the day/final state is set per consumer in §1b.
   -------------------------------------------------------------------------- */
@property --p        { syntax: '<number>'; inherits: false; initial-value: 0; }
@property --day      { syntax: '<number>'; inherits: false; initial-value: 0; }
@property --carve    { syntax: '<number>'; inherits: false; initial-value: 0; }
@property --stars    { syntax: '<number>'; inherits: false; initial-value: 1; }
@property --lantern  { syntax: '<number>'; inherits: false; initial-value: 1; }
@property --rest     { syntax: '<number>'; inherits: false; initial-value: 0; }
@property --brothers { syntax: '<number>'; inherits: false; initial-value: 0; }
@property --moon-y   { syntax: '<number>'; inherits: false; initial-value: 13; }
@property --moon-o   { syntax: '<number>'; inherits: false; initial-value: 1; }
@property --sun-y    { syntax: '<number>'; inherits: false; initial-value: 76; }
@property --sun-o    { syntax: '<number>'; inherits: false; initial-value: 0; }
@property --rope-h   { syntax: '<number>'; inherits: false; initial-value: 4000; }
@property --bob-y    { syntax: '<number>'; inherits: false; initial-value: 4000; }
/* derived, typed so their computed value only changes when the rounded number does */
@property --snap     { syntax: '<number>'; inherits: false; initial-value: 0; }
@property --dq       { syntax: '<number>'; inherits: true;  initial-value: 0; }
@property --accent   { syntax: '<color>';  inherits: true;  initial-value: #d6bd8a; }

/* --------------------------------------------------------------------------
   1. Tokens – night values are the defaults (BRIEF §4, p = 0)
   -------------------------------------------------------------------------- */
:root {
  --c-sky-top: #060914; --c-sky-mid: #0c1430; --c-sky-bottom: #1a2244;
  --c-far: #1d2545; --c-far-2: #161c38; --c-mid: #141a30; --c-mid-light: #202a4c;
  --c-near: #0b0f1c; --c-near-light: #1a2140;
  --c-stone-light: #aeb8d6; --c-stone-mid: #6d7799; --c-stone-shadow: #3b4463; --c-rough: #4a5272;
  --c-rim: #93a2d9; --c-flame: #ffb24a; --c-gold: #C8AA6E; --c-rope: #b89b6a; --c-brass: #b0894a;
  --c-ink: #f3efe6; --c-card: rgba(8,12,24,.55);

  /* static page tokens */
  --paper: #f6f1e8; --paper-2: #efe8dc; --card-paper: #fffdf9;
  --ink-day: #1d1a16; --ink-soft: #3a352e; --ink-muted: #5f584d;
  --gold-deep: #76602f; --gold-line: #d9c9a4;
  --stone-border: #8f8677; --stone-input: #fbf8f2; --stone-rule: #e3dbcc;
  --error: #8a2626;
  --f-display: "Cinzel", "Times New Roman", serif;
  --f-serif: "Playfair Display", Georgia, serif;
  --f-sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

  /* layout */
  --rope-x: 74vw;
  --gutter: 6vw;
  --card-w: clamp(300px, 32vw, 520px);
  --finale-pad: 148px;
  --card-left: calc(94vw - min(49vw, 640px));   /* left edge of the form card (desktop grid, see §11) */
  --depth-k: 1;
  --card-night: rgba(8,12,24,.6); --card-day: rgba(255,250,242,.8);
  color-scheme: dark;
}
@media (max-width: 1359px) { :root { --rope-x: 77vw; } }
@media (max-width: 1023px) { :root { --rope-x: 80vw; --gutter: 5vw; --finale-pad: 132px;
  --card-left: max(var(--gutter), calc((100vw - 640px) / 2)); } }
@media (max-width: 767px)  { :root { --rope-x: 86vw; --gutter: 16px; --finale-pad: 112px; } }

/* day palette: no-JS fallback, server flag after a failed POST, Konami noon */
html.no-js, html.is-final, html.is-noon {
  --c-sky-top: #6fa8dc; --c-sky-mid: #bcd9f1; --c-sky-bottom: #e9eef2;
  --c-far: #a7b7cc; --c-far-2: #8b9db3; --c-mid: #6c7a8a; --c-mid-light: #9aa9bb;
  --c-near: #3b3a3f; --c-near-light: #5a5753;
  --c-stone-light: #f7f3ec; --c-stone-mid: #d9d2c8; --c-stone-shadow: #9a948b; --c-rough: #aaa49a;
  --c-rim: #fff1c9;
  --c-ink: #1d1a16; --c-card: rgba(255,250,242,.72);
  color-scheme: light;
}
/* 1b. final scene state without the engine (no-JS, server re-render after a failed POST,
   thank-you page): day scalars on their consumers – statue carved, sculptor at rest,
   brothers present, stars/lantern out, sun up. */
:is(html.no-js, html.is-final) :is(.layer--front, .gauge__fill) { --p: 1; }
:is(html.no-js, html.is-final) :is(.top, .steps .card, .layer--statue) { --day: 1; }
:is(html.no-js, html.is-final) :is(.layer--stars > svg, #st-rim, .sc-back-rim, .layer--sculptor > svg) { --stars: 0; }
:is(html.no-js, html.is-final) :is(.layer--bench, #bn-lit, #bn-glow) { --lantern: 0; }
:is(html.no-js, html.is-final) :is(#sc-pose-work, #sc-pose-rest) { --rest: 1; }
:is(html.no-js, html.is-final) :is(#br-old, #br-broad, #br-young) { --brothers: 1; }
:is(html.no-js, html.is-final) .layer--moon { --moon-o: 0; --moon-y: 22; }
:is(html.no-js, html.is-final) .layer--sun { --sun-o: 1; --sun-y: 18; }

/* --------------------------------------------------------------------------
   2. Reset & base
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
/* no CSS scroll-behavior: smooth – it would turn every programmatic scrollTo into an animation
   (debug ?p=, tests); the in-page anchors are smooth-scrolled by cesta.js instead */
html { -webkit-text-size-adjust: 100%; background: var(--c-sky-top); }
body {
  margin: 0; min-height: 100vh;
  font: 400 17px/1.6 var(--f-sans);
  color: var(--ink-day);
  background: var(--paper);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  overflow-x: clip;
}
h1, h2, h3, p, ul, ol, figure, fieldset { margin: 0; }
ul, ol { padding: 0; }
fieldset { padding: 0; border: 0; min-width: 0; }
legend { padding: 0; }
img, svg, canvas { display: block; max-width: 100%; }
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
summary { cursor: pointer; }
::selection { background: var(--c-gold); color: #1d1a16; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
:focus-visible { outline: 2px solid var(--c-gold); outline-offset: 3px; }

/* --------------------------------------------------------------------------
   3. Skip link, header
   -------------------------------------------------------------------------- */
.skip {
  position: fixed; top: 10px; left: 10px; z-index: 100;
  padding: 10px 16px; border-radius: 4px;
  background: #1d1a16; color: #f6f1e8; font: 500 14px/1.2 var(--f-sans);
  text-decoration: none; transform: translateY(-200%); transition: transform .2s;
}
.skip:focus { transform: none; outline-color: #fff; }

.top {
  position: absolute; top: 0; left: 0; right: 0; z-index: 8;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px var(--gutter); transition: color .3s;
  /* the header sits on the sky, which gets light earlier than the cards: ink snaps at day ≈ .61 (p ≈ .52) */
  color: color-mix(in srgb, #1d1a16 calc(clamp(0, (var(--day) - .60) * 50, 1) * 100%), #f3efe6);
  text-shadow: 0 1px 14px color-mix(in srgb, var(--c-sky-mid) 85%, transparent), 0 0 3px color-mix(in srgb, var(--c-sky-mid) 70%, transparent);
}
.top__logo { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; min-height: 44px; }
.top__logo img { width: 44px; height: 44px; object-fit: contain; }
.top__name { font: 600 12px/1.2 var(--f-display); letter-spacing: .16em; text-transform: uppercase; }
.top__nav { display: flex; align-items: center; gap: 22px; }
.top__main { font: 400 14px/1.2 var(--f-sans); letter-spacing: .02em; text-decoration: none; opacity: .82; padding: 12px 0; }
.top__main:hover, .top__main:focus-visible { opacity: 1; text-decoration: underline; text-underline-offset: 4px; }
.top__cta {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 20px;
  border: 1px solid var(--c-gold); border-radius: 999px;
  font: 500 13px/1 var(--f-sans); letter-spacing: .08em; text-transform: uppercase; text-decoration: none;
  color: inherit; transition: background-color .25s, color .25s;
}
.top__cta:hover, .top__cta:focus-visible { background: var(--c-gold); color: #1d1a16; }
@media (max-width: 767px) {
  .top { padding: 12px 16px; }
  .top__name { display: none; }
  .top__main { display: none; }
  .top__cta { min-height: 40px; padding: 0 16px; font-size: 12px; }
}

/* --------------------------------------------------------------------------
   4. Rope, hook, bob
   -------------------------------------------------------------------------- */
.rope {
  position: fixed; top: 0; left: var(--rope-x); width: 0; height: 100vh; z-index: 3;
  pointer-events: none; transform-origin: 50% 0;
  animation: rope-sway 5.2s ease-in-out infinite;
}
.rope__hook {
  position: absolute; top: -4px; left: 50%; width: 12px; height: 12px; margin-left: -6px;
  border: 2.5px solid var(--c-brass); border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.25);
}
.rope__line {
  position: absolute; top: 6px; left: 0; width: 2px; margin-left: -1px;
  height: calc(var(--rope-h) * 1px); max-height: 200vh;
  background: repeating-linear-gradient(180deg, var(--c-rope) 0 5px, color-mix(in srgb, var(--c-rope) 70%, #000) 5px 7px);
  transform-origin: 50% 0;
}
html.js .rope__line { animation: rope-drop .6s cubic-bezier(.3,.7,.2,1) .7s both; }
.rope__line::after {
  content: ""; position: absolute; left: -1px; top: 0; width: 4px; height: 18vh;
  background: linear-gradient(180deg, transparent, var(--c-gold) 50%, transparent);
  opacity: 0; filter: blur(1px);
}
.rope.is-pulse .rope__line::after { animation: rope-pulse .4s linear both; }
.rope__bob {
  position: absolute; top: calc(var(--bob-y) * 1px); left: 0; width: 40px; height: 80px; margin-left: -20px;
  opacity: 0; transition: opacity .22s;
}
.rope__bob svg { width: 100%; height: 100%; }
.rope.is-visible .rope__bob { opacity: 1; }
.rope.is-landed { animation: rope-swing 3.2s cubic-bezier(.3,.4,.3,1) both, rope-idle 6s ease-in-out 3.2s infinite; }
.rope.is-swinging { animation: rope-swing-big 3.4s cubic-bezier(.3,.4,.3,1) both, rope-idle 6s ease-in-out 3.4s infinite; }
html.no-js .rope { display: none; }
@media (max-width: 767px) { .rope__bob { width: 28px; height: 56px; margin-left: -14px; } }

@keyframes rope-sway  { 0%, 100% { transform: rotate(.6deg); } 50% { transform: rotate(-.6deg); } }
@keyframes rope-idle  { 0%, 100% { transform: rotate(.4deg); } 50% { transform: rotate(-.4deg); } }
@keyframes rope-drop  { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes rope-pulse { from { opacity: 1; transform: translateY(-18vh); } to { opacity: 0; transform: translateY(100vh); } }
@keyframes rope-swing {
  0% { transform: rotate(2.4deg); } 25% { transform: rotate(-1.6deg); } 48% { transform: rotate(1deg); }
  68% { transform: rotate(-.5deg); } 85% { transform: rotate(.2deg); } 100% { transform: rotate(0deg); }
}
@keyframes rope-swing-big {
  0% { transform: rotate(3.8deg); } 25% { transform: rotate(-2.6deg); } 48% { transform: rotate(1.6deg); }
  68% { transform: rotate(-.8deg); } 85% { transform: rotate(.3deg); } 100% { transform: rotate(0deg); }
}

/* --------------------------------------------------------------------------
   5. Gauge (24palcové měřítko)
   -------------------------------------------------------------------------- */
.gauge {
  position: fixed; left: 14px; top: 50%; z-index: 6; width: 18px; height: 36vh;
  translate: 0 -50%; opacity: .9; cursor: help;
}
.gauge__ticks { position: absolute; inset: 0 0 0 4px; display: flex; flex-direction: column; justify-content: space-between; }
.gauge__ticks i { display: block; width: 7px; height: 1px; background: color-mix(in srgb, var(--c-ink) 55%, transparent); transition: background-color .3s; }
.gauge__ticks i:nth-child(6n+1) { width: 14px; }
.gauge__fill {
  position: absolute; left: 0; bottom: 0; width: 2px; height: 100%;
  background: var(--c-gold); transform-origin: 50% 100%; transform: scaleY(var(--p));
  box-shadow: 0 0 6px color-mix(in srgb, var(--c-gold) 50%, transparent);
}
.gauge.is-full .gauge__fill { animation: gauge-glow 2s ease-out both; }
.gauge:focus-visible { outline-offset: 6px; }
@keyframes gauge-glow { 0% { box-shadow: 0 0 6px var(--c-gold); } 40% { box-shadow: 0 0 18px var(--c-gold), 0 0 32px color-mix(in srgb, var(--c-gold) 60%, transparent); } 100% { box-shadow: 0 0 6px color-mix(in srgb, var(--c-gold) 50%, transparent); } }
@media (max-width: 767px) {
  .gauge { left: 0; right: 0; top: 0; width: auto; height: 3px; translate: none; }
  .gauge__ticks { inset: 0; flex-direction: row; }
  .gauge__ticks i { width: 1px; height: 3px; }
  .gauge__ticks i:nth-child(6n+1) { width: 1px; height: 5px; }
  .gauge__fill { top: 0; bottom: auto; width: 100%; height: 2px; transform-origin: 0 50%; transform: scaleX(var(--p)); }
}

/* --------------------------------------------------------------------------
   6. Story: sticky stage + steps
   -------------------------------------------------------------------------- */
.story { position: relative; display: grid; }
.stage {
  grid-area: 1 / 1; position: sticky; top: 0; align-self: start; z-index: 1;
  width: 100%; height: 100svh; overflow: hidden;
  contain: paint; container-type: size;
  background: var(--c-sky-top);   /* the gradient itself is painted once by .layer--sky */

  /* geometry (art-review composition notes), container units = stage box */
  --u: max(100cqw / 1920, 100cqh / 1080);   /* one colonnade/hills unit under xMidYMax slice */
  --floor: calc(240 * var(--u));              /* terrace edge from the stage bottom */
  --sS: calc(70cqh / 1000);                   /* statue px per user unit */
  --sC: 64cqw;                                /* block centre x */
  --sBottom: 10cqh;                           /* pedestal bottom (behind the slab) */
  --cS: calc(var(--sS) * 1.143);              /* sculptor px per unit */
  --cSoles: 79cqh;
  --bS: calc(23cqw / 900);                    /* brothers px per unit */
  --bLeft: 12cqw;
  --benchW: 70cqw;
  --moon-x: 43cqw; --moon-box: 16cqw;
  --sun-x: 82cqw;  --sun-box: 22cqw;
}
.steps { grid-area: 1 / 1; position: relative; z-index: 4; pointer-events: none; }

.layer { position: absolute; inset: 0; pointer-events: none; }
.layer > svg { position: absolute; display: block; }
.layer--sky { background: linear-gradient(180deg, var(--c-sky-top) 0%, var(--c-sky-mid) 42%, var(--c-sky-bottom) 60%, var(--c-sky-bottom) 100%); }

/* Compositor budget (measured: every full-screen compositor layer costs frames on software
   rasterisers and integrated GPUs, and any style change under <html> re-styles ~4 000 SVG nodes):
   · root layer  = sky gradient + stars (repaints only on palette steps and the stepped twinkle)
   · moon, sun   = two small composited layers (their per-frame transform is compositor-only)
   · .layer--back  = hills + colonnade + vignette + brothers, one static composited layer
   · .layer--front = statue + sculptor + bench in ONE parallax layer (same depth for all three:
                     the slab always covers the pedestal foot, the chisel stays on the stone) */
.layer--front {
  --depth: .09;
  transform: translate(0, calc((var(--p) - .5) * var(--depth) * var(--depth-k) * -100cqh));
  will-change: transform;
}
.layer--back { will-change: transform; }
.layer--moon, .layer--sun { inset: auto; will-change: transform; }

.layer--stars > svg { left: 0; top: 0; width: 114cqw; height: 65cqh; opacity: var(--stars); }
.layer--moon {
  width: var(--moon-box); height: var(--moon-box);
  left: calc(var(--moon-x) - var(--moon-box) / 2); top: calc(-.5 * var(--moon-box));
  transform: translate(0, calc(var(--moon-y) * 1cqh)); opacity: var(--moon-o);
}
.layer--sun {
  width: var(--sun-box); height: var(--sun-box);
  left: calc(var(--sun-x) - var(--sun-box) / 2); top: calc(-.5 * var(--sun-box));
  transform: translate(0, calc(var(--sun-y) * 1cqh)); opacity: var(--sun-o);
}
.layer--moon > svg, .layer--sun > svg, .layer--hills > svg, .layer--colonnade > svg { left: 0; top: 0; width: 100%; height: 100%; }
/* narrow aspect ratios (4:3 tablets, iPad landscape): the colonnade keeps its three columns on the
   left instead of losing the first one to the centred crop – the box gets its full 16:9 width and the
   uniform balustrade is what overflows on the right (stage clips it) */
.layer--colonnade > svg { width: max(100%, calc(100cqh * 1920 / 1080)); max-width: none; }
.layer--brothers > svg {
  width: calc(900 * var(--bS)); height: calc(520 * var(--bS));
  left: var(--bLeft); bottom: calc(var(--floor) - 20 * var(--bS));
}
.layer--statue .carve {
  position: absolute; width: calc(560 * var(--sS)); height: calc(1000 * var(--sS));
  left: calc(var(--sC) - 286.5 * var(--sS)); bottom: var(--sBottom);
}
.layer--statue .carve > svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.layer--statue .dust { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; visibility: hidden; }
.layer--statue .dust.is-busy { visibility: visible; }   /* the canvas layer is only drawn while chips fly */
.carve-edge { display: none; }   /* the SVG's own clipped #st-edge band is used instead */
.layer--sculptor > svg {
  width: calc(520 * var(--cS)); height: calc(760 * var(--cS));
  left: calc(var(--sC) - 199.5 * var(--sS) - 520 * var(--cS)); top: calc(var(--cSoles) - 600 * var(--cS));
  overflow: visible;   /* the raised mallet may graze the sprite's top edge; the stage clips anyway */
  /* no drop-shadow filter (a compositor render surface per frame); the night separation comes
     from the baked --c-rim back-edge slivers, raised while the stars are out (.sc-back-rim) */
}
.layer--bench > svg { width: var(--benchW); height: calc(var(--benchW) * 420 / 1800); right: 0; bottom: 0; }
/* lantern glow: painted inside the bench layer (no blend mode, no extra full-screen layer);
   box = the glow's own extent, centre = the lantern (95.7cqw, 88cqh) */
.layer--bench::after {
  content: ""; position: absolute; right: 0; bottom: 0; width: 62cqw; height: 56cqh;
  background: radial-gradient(42cqw 38cqh at 93% 78.6%, rgba(255,178,74,.30), rgba(255,178,74,.10) 38%, rgba(255,178,74,0) 72%);
  opacity: var(--lantern); pointer-events: none;
}
.layer--bench.is-lantern-out::after { opacity: 0; transition: opacity .3s; }
/* vignette: static (palette-tinted, so it only repaints with the palette) and part of the backdrop layer */
.layer--vignette {
  background: radial-gradient(ellipse 80% 70% at 50% 45%, transparent 55%,
    color-mix(in srgb, color-mix(in srgb, var(--c-sky-top) 50%, #000) 26%, transparent) 100%);
}
/* egg #7: the whole scene dims for ~2 s (a transparent pseudo costs nothing while opacity is 0) */
.stage::after { content: ""; position: absolute; inset: 0; z-index: 2; background: rgba(2,3,8,.6); opacity: 0; transition: opacity .5s; pointer-events: none; }
.stage.is-dim::after { opacity: 1; }

/* ---- statue: two overlaid copies clipped on their wrapper divs (carveY = 45 + 813·carve) */
.carve--block  { clip-path: inset(calc(4.5% + var(--carve) * 81.3%) 0 0 0); }
.carve--statue { clip-path: inset(0 0 calc(95.5% - var(--carve) * 81.3%) 0); }
.layer--statue.is-carved .carve--block, html.no-js .carve--block, html.is-final .carve--block { display: none; }
.layer--statue.is-carved .carve--statue, html.no-js .carve--statue, html.is-final .carve--statue { clip-path: none; }
#stb-statue, #stb-rim, #stb-sunrim, #st-block { display: none; }
#st-edge, #stb-edge {
  opacity: calc(min(var(--carve), 1 - var(--carve)) * 40);
  transform: translateY(calc(36px + var(--carve) * 813px)); transform-box: view-box;
}
#st-rim { opacity: calc(var(--stars) * .9); }
/* day-driven facet opacities use a 40-step quantised copy of --day so the statue repaints 40×, not every frame */
.layer--statue { --dq: calc(round(var(--day) * 40) / 40); }
#st-sunrim { opacity: calc(min(.7, (var(--dq) - .66) * 9) - max(0, (var(--dq) - .78) * 2)); }   /* peaks at sunrise, .26 by full day */
.st-lit, .stb-lit { opacity: calc(.6 + .4 * var(--dq)); }
#stb-block, #st-statue { pointer-events: visiblePainted; cursor: pointer; }

/* ---- sculptor */
#sc-pose-work { opacity: calc(1 - var(--rest)); transform: translateX(calc(var(--rest) * -30px)); transform-box: view-box; }
#sc-pose-rest { opacity: var(--rest); }
/* two-joint strike: the arm is drawn in the HIT position (mallet on the chisel butt); at rest it is
   raised (upper arm −6°, forearm −22°), the swing lands at 27 % of 410 ms (≈ 110 ms – the chips
   are spawned then) and returns without overshoot */
#sc-arm-mallet { transform-box: view-box; transform-origin: 280px 164px; transform: rotate(-6deg); will-change: transform; }
#sc-forearm-mallet { transform-box: view-box; transform-origin: 256px 53px; transform: rotate(-22deg); will-change: transform; }
@keyframes sc-strike-fore  { 0% { transform: rotate(-22deg); animation-timing-function: cubic-bezier(.55,0,1,.45); } 27% { transform: rotate(0deg); animation-timing-function: linear; } 37% { transform: rotate(0deg); animation-timing-function: cubic-bezier(0,.6,.3,1); } 100% { transform: rotate(-22deg); } }
@keyframes sc-strike-upper { 0% { transform: rotate(-6deg);  animation-timing-function: cubic-bezier(.55,0,1,.45); } 27% { transform: rotate(0deg); animation-timing-function: linear; } 37% { transform: rotate(0deg); animation-timing-function: cubic-bezier(0,.6,.3,1); } 100% { transform: rotate(-6deg); } }
.is-striking #sc-forearm-mallet { animation: sc-strike-fore 410ms both; }
.is-striking #sc-arm-mallet { animation: sc-strike-upper 410ms both; }
.sc-back-rim { opacity: calc(.3 + .55 * var(--stars)); }

/* ---- bench & lantern */
.layer--bench [data-tool] { pointer-events: visiblePainted; cursor: pointer; transform-box: fill-box; transform-origin: 50% 100%; transition: filter .4s, transform .3s; }
.layer--bench [data-tool]:hover, .layer--bench [data-tool].is-lit { filter: brightness(1.4) saturate(1.1); }
.layer--bench.is-sweep [data-tool] { animation: bn-catch .4s ease both; }
.layer--bench.is-sweep [data-tool]:nth-child(2)  { animation-delay: .09s; }
.layer--bench.is-sweep [data-tool]:nth-child(3)  { animation-delay: .18s; }
.layer--bench.is-sweep [data-tool]:nth-child(4)  { animation-delay: .27s; }
.layer--bench.is-sweep [data-tool]:nth-child(5)  { animation-delay: .36s; }
.layer--bench.is-sweep [data-tool]:nth-child(6)  { animation-delay: .45s; }
.layer--bench.is-sweep [data-tool]:nth-child(7)  { animation-delay: .54s; }
.layer--bench.is-sweep [data-tool]:nth-child(8)  { animation-delay: .63s; }
.layer--bench.is-sweep [data-tool]:nth-child(9)  { animation-delay: .72s; }
.layer--bench.is-sweep [data-tool]:nth-child(10) { animation-delay: .81s; }
@keyframes bn-catch { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.6) saturate(1.2); } }
/* flame: stepped timing = ~9 repaints/s instead of 60; paused once the lantern is out */
#bn-flame { transform-box: fill-box; transform-origin: 50% 100%; animation: bn-flicker 1.8s steps(4) infinite; }
@keyframes bn-flicker { 0%, 100% { transform: scale(1, 1); } 30% { transform: scale(.94, 1.06); } 55% { transform: scale(1.04, .96); } 80% { transform: scale(.97, 1.03); } }
.stage.is-unlit #bn-flame, html.no-js #bn-flame, html.is-final #bn-flame { animation-play-state: paused; }   /* JS: .stage.is-unlit when --lantern = 0 */
.layer--bench.is-lantern-out #bn-lit, .layer--bench.is-lantern-out #bn-glow { opacity: 0 !important; transition: opacity .25s; }

/* ---- colonnade & brothers */
.layer--colonnade [data-column] { pointer-events: visiblePainted; cursor: pointer; transition: filter .3s; }
.layer--colonnade [data-column]:hover, .layer--colonnade [data-column].is-lit { filter: brightness(1.25); }
.layer--brothers [data-brother].is-lit > [id$="-block"] { filter: brightness(1.25); }
#br-old   { opacity: min(1, calc(var(--brothers) * 3));     transform: translateY(calc((1 - min(1, var(--brothers) * 3)) * 6px)); }
#br-broad { opacity: min(1, calc(var(--brothers) * 3 - 1)); transform: translateY(calc((1 - min(1, max(0, var(--brothers) * 3 - 1))) * 6px)); }
#br-young { opacity: min(1, calc(var(--brothers) * 3 - 2)); transform: translateY(calc((1 - min(1, max(0, var(--brothers) * 3 - 2))) * 6px)); }
#br-broad-arm-mallet { transform-origin: 404px 192px; transform-box: view-box; }

/* ---- stars: twinkle per class, constellation egg, shooting star */
/* twinkle per class with stepped timing: ~12 small repaints/s of the stars layer instead of 60 */
#sk-a-group { animation: sk-twinkle 6s steps(18) infinite; }
#sk-b-group { animation: sk-twinkle 4.5s steps(14) -1.5s infinite; }
#sk-c-group { animation: sk-twinkle 3.2s steps(10) -.7s infinite; }
#sk-a-group circle:nth-child(3n) { animation: sk-twinkle 5s steps(15) -2.2s infinite; }
@keyframes sk-twinkle { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }
/* by day (JS: .stage.is-day when --stars = 0; no-JS/final state) the twinkle is paused and the
   sculptor's night halo filter removed */
:is(.stage.is-day, html.no-js .stage, html.is-final .stage) :is(#sk-a-group, #sk-b-group, #sk-c-group, #sk-a-group circle) { animation-play-state: paused; }
/* while the page scrolls (JS: html.is-scrolling, cleared 180 ms after the last scroll event) the
   decorative loops pause – they resume where they were, and the scroll frame keeps its full budget */
html.is-scrolling #sk-a-group, html.is-scrolling #sk-b-group, html.is-scrolling #sk-c-group, html.is-scrolling #sk-a-group circle,
html.is-scrolling #bn-flame, html.is-scrolling .rope, html.is-scrolling .rope__line, html.is-scrolling .rope__line::after,
html.is-scrolling .cue__line, html.is-scrolling #br-broad-arm-mallet { animation-play-state: paused; }
#sk-brightest { pointer-events: all; cursor: pointer; }
#sk-constellation { opacity: 0; transition: opacity .6s; }
.sk-line { stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset 1.4s ease; }
.sk-line:nth-child(2) { transition-delay: .35s; }
.sk-line:nth-child(3) { transition-delay: .9s; }
.sk-line:nth-child(4) { transition-delay: 1.25s; }
.layer--stars.is-constellation #sk-constellation { opacity: 1; }
.layer--stars.is-constellation .sk-line { stroke-dashoffset: 0; }
.layer--stars.is-shooting #sk-shooting { animation: sk-shoot 1.3s ease-out both; }
@keyframes sk-shoot { 0% { opacity: 0; translate: 0 0; } 15% { opacity: 1; } 100% { opacity: 0; translate: 250px 120px; } }

/* ---- pins (column eggs) & tooltip */
/* column labels (egg #1): fixed elements outside the stage so they sit ABOVE the text cards
   (z 5 > .steps 4, < gauge 6 / header 8); JS sets left/top in viewport px – centred on the column,
   clamped to 8 px side margins and to the band below the header (≥ 72 px) */
.pin {
  position: fixed; z-index: 5; width: min(220px, calc(100vw - 16px));   /* fixed width → the JS clamp is exact */
  left: 50vw; top: 72px;
  transform: translate(-50%, 6px);
  padding: 10px 14px; border-radius: 4px;
  background: rgba(8,12,24,.9); color: #f3efe6; border: 1px solid color-mix(in srgb, var(--c-gold) 55%, transparent);
  box-shadow: 0 10px 30px -12px rgba(0,0,0,.6);
  opacity: 0; transition: opacity .3s, transform .3s; pointer-events: none;
}
.pin.is-open { opacity: 1; transform: translate(-50%, 0); }
.pin__label { display: block; font: 600 15px/1.2 var(--f-display); letter-spacing: .12em; text-transform: uppercase; color: var(--c-gold); margin-bottom: 4px; }
.pin__line { display: block; font: 400 13px/1.45 var(--f-sans); }
.tooltip {
  position: absolute; z-index: 6; max-width: 280px; padding: 10px 14px; border-radius: 4px;
  background: rgba(8,12,24,.9); color: #f3efe6; border: 1px solid color-mix(in srgb, var(--c-gold) 55%, transparent);
  font: 400 14px/1.45 var(--f-sans); opacity: 0; transition: opacity .2s, transform .25s; pointer-events: none;
}
.tooltip.is-open { opacity: 1; }
.tooltip--sheet, html.is-touch .tooltip {
  position: fixed; left: 0; right: 0; bottom: 0; top: auto; max-width: none; min-height: 56px;
  padding: 14px 20px calc(14px + env(safe-area-inset-bottom)); border-radius: 12px 12px 0 0; border-width: 1px 0 0;
  font-size: 15px; transform: translateY(100%); opacity: 1; pointer-events: auto;
}
.tooltip--sheet.is-open, html.is-touch .tooltip.is-open { transform: none; }

/* --------------------------------------------------------------------------
   7. Steps & text cards
   -------------------------------------------------------------------------- */
.step {
  position: relative; min-height: 100svh; display: flex; align-items: center;
  padding: 10svh var(--gutter);
}
.step[data-step="4"] { min-height: 130svh; align-items: flex-start; padding-top: 18svh; }
.step[data-step="5"] { padding-left: min(calc(var(--rope-x) - var(--card-w) / 2), calc(96vw - var(--card-w))); }

.card { position: relative; border-radius: 4px; pointer-events: auto; }
.steps .card {
  --snap: round(clamp(0, calc((var(--day) - .7025) * 50), 1));   /* 0 or 1: ink + card flip together at p ≈ .61 (day ≈ .71), eased only by the 300 ms transition – never a grey-on-grey mid state */
  --accent: color-mix(in srgb, #5e4f31 calc(var(--snap) * 100%), #d6bd8a);   /* small gold text: ≥ 4.5:1 on both card themes */
  width: var(--card-w);
  padding: 32px 36px;
  color: var(--c-ink); background: var(--c-card);
  color: color-mix(in srgb, #1d1a16 calc(var(--snap) * 100%), #f3efe6);
  background-color: color-mix(in srgb, var(--card-day) calc(var(--snap) * 100%), var(--card-night));
  border: 1px solid color-mix(in srgb, var(--c-gold) calc(30% + var(--snap) * 15%), transparent);
  box-shadow: 0 20px 50px -30px rgba(0,0,0,.45);
  transition: color .3s, background-color .3s, border-color .3s, opacity .5s ease, transform .5s ease;
  opacity: 0; transform: translateY(24px);
}
.step.is-active .card, .step--hero .card, html.no-js .steps .card, html.is-final .steps .card, html.reduced-motion .steps .card { opacity: 1; transform: none; }
.steps .card p { font: 400 17px/1.6 var(--f-sans); }
.steps .card p + p { margin-top: .7em; }
.steps .card h2 { font: 600 clamp(22px, 1.9vw, 30px)/1.22 var(--f-display); letter-spacing: .06em; margin: 0 0 16px; text-wrap: balance; }
.steps .card a { color: inherit; text-decoration: underline; text-decoration-color: var(--c-gold); text-underline-offset: 4px; text-decoration-thickness: 1px; }
.steps .card a:hover, .steps .card a:focus-visible { text-decoration-thickness: 2px; }

.eyebrow {
  display: flex; flex-wrap: wrap; gap: 0 .6em; align-items: baseline;
  font: 500 12px/1.4 var(--f-sans); letter-spacing: .18em; text-transform: uppercase;
  color: var(--accent, var(--c-gold));
  margin: 0 0 14px;
}
.eyebrow__num { font: 600 12px/1.4 var(--f-display); letter-spacing: .2em; }
.eyebrow__sep { opacity: .6; }
.eyebrow--touch { display: none; }

/* hero */
.steps .card--hero {   /* no card box in the hero: text on the sky with a soft dark halo */
  background: radial-gradient(ellipse 110% 90% at 30% 50%, color-mix(in srgb, rgba(255,250,242,.72) calc(var(--snap) * 100%), rgba(6,9,20,.62)) 20%, transparent 75%);
  background-color: transparent; border-color: transparent; box-shadow: none; padding: 40px 36px;
}
.card--hero .card__body { transform: translateY(calc(var(--p) * -400px)); opacity: calc(1 - var(--p) * 10); }
html.no-js .card--hero .card__body { transform: none; opacity: 1; }
.card--hero h1 {
  font: 600 clamp(28px, 2.6vw, 40px)/1.15 var(--f-display); letter-spacing: .08em; margin: 0 0 18px; text-wrap: balance;
}
html.js .card--hero h1 { animation: hero-in .8s cubic-bezier(.2,.7,.2,1) .4s both; }
html.js .card--hero .lead, html.js .card--hero .eyebrow { animation: hero-fade .7s ease .6s both; }
.card--hero .lead { font: 300 clamp(16px, 1.15vw, 18px)/1.6 var(--f-sans); }
.lead__br { display: none; }
@media (min-width: 1024px) { .lead__br { display: inline; } }
@keyframes hero-in   { from { opacity: 0; letter-spacing: .28em; } to { opacity: 1; letter-spacing: .08em; } }
@keyframes hero-fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.cue { display: flex; flex-direction: column; gap: 10px; margin-top: 30px; font: 500 12px/1.4 var(--f-sans); letter-spacing: .16em; text-transform: uppercase; opacity: .85; transition: opacity .4s; }
.cue__line { display: block; width: 1px; height: 48px; margin-left: 2px; background: var(--c-gold); transform-origin: 50% 0; animation: cue-breathe 2.6s ease-in-out infinite; }
.cue.is-hidden { opacity: 0; }
.cue.is-hidden .cue__line { animation-play-state: paused; }
.cue__label--touch { display: none; }
@keyframes cue-breathe { 0% { transform: scaleY(.2); opacity: .6; } 50% { transform: scaleY(1); opacity: 1; } 100% { transform: scaleY(.2); opacity: .6; } }

/* step 1 */
.pains { list-style: none; margin: 4px 0 18px; display: grid; gap: 10px; }
.pain {
  position: relative; padding-left: 16px; font: italic 400 17.5px/1.5 var(--f-serif);
  opacity: 0; transform: translateX(-8px); transition: opacity .45s ease, transform .45s ease;
}
.pain::before { content: ""; position: absolute; left: 0; top: .45em; width: 6px; height: 1px; background: var(--c-gold); }
.pain:nth-child(2) { transition-delay: .06s; }
.pain:nth-child(3) { transition-delay: .12s; }
.step.is-active .pain, html.no-js .pain, html.is-final .pain, html.reduced-motion .pain { opacity: 1; transform: none; }
.hinge, .closing { font: 500 16px/1.55 var(--f-sans); letter-spacing: .01em; }

/* step 2 */
.card .intro { font-weight: 300; }
.tools { list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 20px; margin: 16px 0 18px; font: 400 15px/1.5 var(--f-sans); }
.tools li { transition: opacity .3s; }
.tools b { font-weight: 500; color: var(--accent); }
.tools li:hover b { text-decoration: underline; text-underline-offset: 3px; }

/* step 3 */
.prose--lines p { font-size: 16.5px; line-height: 1.55; }
.prose--lines p + p { margin-top: .5em; }
.card .aside { margin-top: 16px; font: 300 15px/1.5 var(--f-sans); opacity: .85; }

/* step 4 */
.card .sentence { font: 400 clamp(19px, 1.5vw, 23px)/1.45 var(--f-serif); }
.card .line { margin-top: 14px; }

/* step 5 */
.lines { display: grid; gap: 4px; margin-bottom: 18px; }
.lines span { display: block; font: 600 clamp(22px, 2vw, 32px)/1.2 var(--f-display); letter-spacing: .08em; }
.lines .lines__quiet { font-weight: 400; font-size: .78em; opacity: .9; margin-top: 4px; }
.conditions { list-style: none; counter-reset: cond; margin: 10px 0 16px; display: grid; gap: 8px; }
.conditions li { position: relative; padding-left: 30px; font: 400 16px/1.5 var(--f-sans); counter-increment: cond; }
.conditions li::before {
  content: counter(cond); position: absolute; left: 0; top: .1em;
  font: 600 13px/1 var(--f-display); color: var(--accent);
  border-bottom: 1px solid currentColor; padding-bottom: 3px;
}
.card .duration { font-size: 16px; opacity: .92; }
.card .cta-line { margin-top: 14px; font-weight: 500; }

/* ------- phones & portrait tablets: bottom-anchored cards over a centred scene */
@media (max-width: 1023px) and (orientation: portrait) {
  .stage {
    --sS: calc(52cqh / 1000); --sC: 53cqw; --sBottom: 22cqh;
    --cS: calc(var(--sS) * .95); --cSoles: 71cqh;
    --bS: calc(48cqw / 900); --bLeft: -4cqw;
    --moon-x: 22cqw; --moon-box: 36cqw; --sun-x: 70cqw; --sun-box: 44cqw;
  }
  .layer--stars > svg { width: 100cqw; }
  .step, .step[data-step="4"], .step[data-step="5"] { align-items: flex-end; padding: 0 var(--gutter) 4svh; }
  .step[data-step="4"] { align-items: flex-start; padding-top: 14svh; }
  /* cards grow with their text (no inner scroll region – keyboard/touch friendly); the scene stays visible above */
  .steps .card { width: min(100%, 600px); padding: 20px 20px 18px; }
  .steps .card h2 { font-size: 22px; margin-bottom: 12px; }
  .card--hero { padding: 26px 22px 24px; background: linear-gradient(180deg, transparent, color-mix(in srgb, rgba(255,250,242,.72) calc(var(--snap) * 100%), rgba(6,9,20,.66)) 30%); }
  .card--hero h1 { font-size: clamp(28px, 7.6vw, 32px); }
  .steps .card p { font-size: 15.5px; line-height: 1.5; }
  .pain { font-size: 16px; }
  .prose--lines p { font-size: 15px; line-height: 1.5; }
  .card .aside { margin-top: 12px; }
  .tools { grid-template-columns: 1fr; gap: 5px; font-size: 14px; margin: 12px 0 14px; }
  .lines { margin-bottom: 14px; }
  .conditions { margin: 8px 0 12px; gap: 6px; }
  .conditions li { font-size: 15px; }
  .cue { margin-top: 18px; }
  .cue__line { height: 28px; }
  .eyebrow--touch { display: flex; color: inherit; opacity: .8; letter-spacing: .14em; margin-bottom: 8px; }
}
@media (max-width: 767px) {
  .stage { --benchW: 162.5cqw; }
  .layer--bench > svg { left: -8.85cqw; right: auto; }
  #bn-gauge, #bn-chisel, #bn-ashlar, #bn-chips, #bn-book, #bn-shadows, #bn-warm { display: none; }
  #bn-trowel, #bn-mallet { transform: translateX(-290px); }
  #bn-lantern, #bn-glow { transform: translateX(-566px); }
  .layer--bench::after { width: 100cqw; height: 40cqh; background: radial-gradient(70cqw 26cqh at 90% 82.5%, rgba(255,178,74,.26), rgba(255,178,74,.08) 40%, rgba(255,178,74,0) 72%); }
  #cl-architrave { display: none; }
  .layer--brothers { display: none; }
  .pin { max-width: 220px; }
}
@media (pointer: coarse) {
  :root { --depth-k: .5; }
  .cue__label--pointer { display: none; }
  .cue__label--touch { display: inline; }
}
html.is-touch { --depth-k: .5; }
html.is-touch .cue__label--pointer { display: none; }
html.is-touch .cue__label--touch { display: inline; }

/* --------------------------------------------------------------------------
   8. Finale: marble step, timeline, form card
   -------------------------------------------------------------------------- */
.finale {
  position: relative; z-index: 2; background: var(--paper); color: var(--ink-day);
  padding: var(--finale-pad) var(--gutter) 104px;
}
.finale::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 12px;
  background: linear-gradient(180deg, #fbf8f2 0%, #efe8dc 55%, #e2d9c8 100%);
  box-shadow: 0 1px 0 #d4cab6, 0 -14px 24px -12px rgba(0,0,0,.35);
}
.finale__grid { display: grid; gap: 56px; max-width: 1400px; margin: 0 auto; }
.finale h2 { font: 600 clamp(26px, 2.4vw, 36px)/1.2 var(--f-display); letter-spacing: .06em; text-wrap: balance; }
.finale__intro { margin: 14px 0 32px; font: 300 19px/1.55 var(--f-sans); color: var(--ink-soft); }
.timeline { list-style: none; counter-reset: tl; position: relative; padding-left: 48px; display: grid; gap: 26px; }
.timeline::before { content: ""; position: absolute; left: 13px; top: 10px; bottom: 10px; width: 1px; background: var(--gold-line); }
.timeline li { position: relative; counter-increment: tl; }
.timeline li::before {
  content: counter(tl); position: absolute; left: -48px; top: -1px; width: 28px; height: 28px;
  display: grid; place-items: center; border-radius: 50%;
  background: var(--paper); border: 1px solid var(--gold-deep); color: var(--gold-deep);
  font: 600 13px/1 var(--f-display);
}
.timeline h3 { font: 600 20px/1.3 var(--f-serif); margin-bottom: 6px; }
.timeline p { font: 400 16px/1.55 var(--f-sans); color: var(--ink-soft); }
.timeline__dur { margin-top: 4px; font-size: 14px !important; color: var(--gold-deep) !important; }
.finale__quote { margin: 36px 0 20px; font: italic 400 clamp(20px, 1.6vw, 24px)/1.45 var(--f-serif); color: var(--ink-day); }
.finale__note { font: 400 14.5px/1.55 var(--f-sans); color: var(--ink-muted); max-width: 52ch; }
.finale a { color: var(--gold-deep); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.finale a:hover, .finale a:focus-visible { color: var(--ink-day); text-decoration-thickness: 2px; }
.finale :focus-visible { outline-color: var(--gold-deep); }

.finale__form { position: relative; }
.finale__plumb {
  position: absolute; left: calc(var(--rope-x) - var(--card-left)); top: calc(-1 * var(--finale-pad));
  width: 2px; height: calc(var(--finale-pad) - 92px); margin-left: -1px;
  background: repeating-linear-gradient(180deg, var(--c-rope) 0 5px, color-mix(in srgb, var(--c-rope) 70%, #000) 5px 7px);
}
.finale__plumb svg { position: absolute; top: 100%; left: 50%; width: 40px; max-width: none; height: 80px; margin-left: -20px; overflow: visible; }
html.js .finale__plumb { display: none; }
@media (max-width: 767px) {
  .finale__plumb { height: calc(var(--finale-pad) - 68px); }
  .finale__plumb svg { width: 28px; height: 56px; margin-left: -14px; }
}

.card--form {
  position: relative; width: min(100%, 640px); margin: 0 auto;
  padding: 40px 44px 36px; border-radius: 6px; color: var(--ink-day);
  background: var(--card-paper); border: 1px solid var(--stone-rule);
  box-shadow: 0 30px 70px -40px rgba(40,30,10,.35), 0 2px 0 #fff inset;
  transition: border-color .4s, transform .3s;
}
.card__contact {
  position: absolute; top: -2px; left: calc(var(--rope-x) - var(--card-left)); width: 160px; height: 4px;
  transform: translateX(-50%); border-radius: 2px;
  background: radial-gradient(closest-side, var(--c-gold), transparent);
  opacity: 0; transition: opacity .4s;
}
.card__eyebrow {
  position: absolute; top: -30px; left: calc(var(--rope-x) - var(--card-left)); transform: translateX(-50%);
  font: 600 12px/1 var(--f-display); letter-spacing: .3em; text-transform: uppercase; color: var(--gold-deep);
  opacity: 0; transition: opacity .5s .2s;
}
.card--form.is-touched { border-color: var(--c-gold); transform: translateY(1px); }
.card--form.is-touched .card__contact, .card--form.is-touched .card__eyebrow,
html.no-js .card__contact, html.no-js .card__eyebrow { opacity: 1; }
.card--form.is-touched .card__contact { animation: contact-pulse 1.2s ease-out both; }
.card--form.is-touched #id_first_name { animation: ring-glow 1.2s ease-out both; }
@keyframes contact-pulse { 0% { opacity: 0; transform: translateX(-50%) scaleX(.3); } 40% { opacity: 1; transform: translateX(-50%) scaleX(1.25); } 100% { opacity: 1; transform: translateX(-50%) scaleX(1); } }
@keyframes ring-glow { 0% { box-shadow: 0 0 0 0 rgba(200,170,110,.0); } 30% { box-shadow: 0 0 0 4px rgba(200,170,110,.55); } 100% { box-shadow: 0 0 0 0 rgba(200,170,110,0); } }
.card__title { font: 600 clamp(22px, 1.8vw, 26px)/1.25 var(--f-display); letter-spacing: .06em; margin-bottom: 26px; }

/* ---- fields */
#lead-form { display: grid; gap: 22px; }
.form-errors {
  padding: 14px 16px; border: 1px solid var(--error); border-left-width: 4px; border-radius: 4px;
  background: #fbf1ee; color: #4a1c1c; font: 400 14.5px/1.5 var(--f-sans);
}
.form-errors__title { font-weight: 500; color: var(--error); margin-bottom: 6px; }
.form-errors ul { list-style: none; display: grid; gap: 4px; }
.form-errors a { color: var(--error); }
.form-errors:focus-visible { outline-color: var(--error); }
.field-pair { display: grid; gap: 18px; }
.field-pair legend { font: 500 14px/1.4 var(--f-sans); letter-spacing: .01em; color: var(--ink-muted); margin-bottom: 10px; }
@media (min-width: 480px) { .field-pair { grid-template-columns: 1fr 1fr; gap: 16px; } .field-pair legend { grid-column: 1 / -1; } }
.field { display: grid; gap: 7px; }
.field > label, .field--region > legend { font: 500 14.5px/1.4 var(--f-sans); letter-spacing: .01em; color: var(--ink-day); }
.field--region > legend { margin-bottom: 8px; }
.field__help { font: 400 13.5px/1.5 var(--f-sans); color: var(--ink-muted); }
.field__help--link { margin-left: 36px; }
.field__hint { font: 400 13.5px/1.5 var(--f-sans); color: var(--gold-deep); }
p.error { font: 500 14px/1.45 var(--f-sans); color: var(--error); }
p.error::before { content: "– "; }
#lead-form input[type="text"], #lead-form input[type="email"], #lead-form input[type="tel"], #lead-form textarea {
  width: 100%; min-height: 48px; padding: 12px 14px; border-radius: 4px;
  border: 1px solid var(--stone-border); background: var(--stone-input); color: var(--ink-day);
  font: 400 16px/1.4 var(--f-sans); box-shadow: inset 0 1px 2px rgba(60,50,30,.06);
  transition: border-color .2s, box-shadow .2s, background-color .2s;
}
#lead-form textarea { min-height: 128px; resize: vertical; line-height: 1.5; }
#lead-form input::placeholder, #lead-form textarea::placeholder { color: #6e675d; opacity: 1; }
#lead-form input:hover, #lead-form textarea:hover { border-color: #6f6758; }
#lead-form input:focus, #lead-form textarea:focus { outline: none; border-color: var(--gold-deep); box-shadow: 0 0 0 3px rgba(118,96,47,.25); background: #fff; }
#lead-form input:focus-visible, #lead-form textarea:focus-visible { outline: 2px solid var(--gold-deep); outline-offset: 2px; }
.field.has-error input, .field.has-error textarea, .field.has-error .pill { border-color: var(--error); }
.field.has-error input:focus, .field.has-error textarea:focus { box-shadow: 0 0 0 3px rgba(138,38,38,.2); }

/* region pills */
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  position: relative; display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 18px;
  border: 1px solid var(--stone-border); border-radius: 999px; background: var(--stone-input);
  font: 400 15px/1 var(--f-sans); color: var(--ink-day); cursor: pointer;
  transition: background-color .2s, border-color .2s, color .2s, box-shadow .2s;
}
.pill input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.pill span::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 10px; border-radius: 50%; border: 1px solid var(--stone-border); vertical-align: 1px; transition: background-color .2s, border-color .2s; }
.pill:hover { border-color: #6f6758; }
.pill:has(input:checked) { background: var(--gold-deep); border-color: var(--gold-deep); color: #fff8e8; font-weight: 500; }
.pill:has(input:checked) span::before { background: #fff8e8; border-color: #fff8e8; }
.pill:has(input:focus-visible) { outline: 2px solid var(--gold-deep); outline-offset: 2px; }
/* region helper lines: CSS fallback (JS toggles [hidden] the same way) */
.field--region:has(input[value="praha"]:checked) [data-help-static],
.field--region:has(input[value="brno"]:checked) [data-help-static],
.field--region:has(input[value="tabor"]:checked) [data-help-static],
.field--region:has(input[value="cr"]:checked) [data-help-static],
.field--region:has(input[value="zahranici"]:checked) [data-help-static] { display: none; }
.field--region:has(input[value="praha"]:checked) [data-help-local],
.field--region:has(input[value="brno"]:checked) [data-help-local],
.field--region:has(input[value="tabor"]:checked) [data-help-local] { display: block; }
.field--region:has(input[value="cr"]:checked) [data-help-far],
.field--region:has(input[value="zahranici"]:checked) [data-help-far] { display: block; }

/* checkboxes */
.field--check { gap: 6px; }
.check { position: relative; display: grid; grid-template-columns: 24px 1fr; gap: 12px; align-items: start; min-height: 44px; padding: 10px 0 0; cursor: pointer; font: 400 15.5px/1.5 var(--f-sans); color: var(--ink-day); }
.check input { position: absolute; top: 10px; left: 0; width: 24px; height: 24px; margin: 0; opacity: 0; cursor: pointer; }
.check__box { width: 24px; height: 24px; border: 1px solid var(--stone-border); border-radius: 4px; background: var(--stone-input); position: relative; pointer-events: none; transition: background-color .2s, border-color .2s; }   /* clicks go to the real (transparent) input underneath */
.check__box::after { content: ""; position: absolute; left: 8px; top: 3px; width: 6px; height: 12px; border: solid #fff8e8; border-width: 0 2px 2px 0; transform: rotate(45deg) scale(0); transition: transform .15s; }
.check:has(input:checked) .check__box { background: var(--gold-deep); border-color: var(--gold-deep); }
.check:has(input:checked) .check__box::after { transform: rotate(45deg) scale(1); }
.check:has(input:focus-visible) .check__box { outline: 2px solid var(--gold-deep); outline-offset: 2px; }
.field.has-error .check__box { border-color: var(--error); }
.field--check .field__help { margin-left: 36px; }
.field--check p.error { margin-left: 36px; }

/* submit */
.field--submit { gap: 14px; margin-top: 6px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 54px; padding: 0 32px;
  border: 1px solid #1d1a16; border-radius: 4px; background: #1d1a16; color: #ead9b3;
  font: 500 15px/1 var(--f-sans); letter-spacing: .12em; text-transform: uppercase; cursor: pointer;
  transition: background-color .25s, color .25s, transform .15s;
}
.btn:hover { background: var(--gold-deep); border-color: var(--gold-deep); color: #fff8e8; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--gold-deep); outline-offset: 3px; }
.under-button { font: 400 13.5px/1.55 var(--f-sans); color: var(--ink-muted); }

@media (min-width: 1024px) {
  .finale__grid { grid-template-columns: 5fr 7fr; gap: 4vw; align-items: start; max-width: none; }
  .card--form { justify-self: end; margin: 0; }
}
/* single column: the form card comes first (the bob lands on it right after the story and the
   fixed rope never runs through the timeline text), the timeline follows */
@media (max-width: 1023px) {
  .finale__form { order: -1; }
}
@media (max-width: 767px) {
  .finale { padding-bottom: 72px; }
  .card--form { padding: 28px 20px 26px; }
  .card__title { margin-bottom: 20px; }
  #lead-form { gap: 18px; }
  .btn { width: 100%; }
}

/* --------------------------------------------------------------------------
   9. FAQ, footer, toast
   -------------------------------------------------------------------------- */
.faq { position: relative; z-index: 2; background: var(--paper-2); color: var(--ink-day); padding: 88px var(--gutter) 96px; }
.faq__inner { max-width: 760px; margin: 0 auto; }
.faq h2 { font: 600 clamp(24px, 2.2vw, 32px)/1.2 var(--f-display); letter-spacing: .06em; }
.faq__intro { margin: 12px 0 30px; font: 300 18px/1.55 var(--f-sans); color: var(--ink-soft); }
.faq__item { border-top: 1px solid #d8cfbd; }
.faq__item:last-of-type { border-bottom: 1px solid #d8cfbd; }
.faq__item summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px 0; min-height: 56px; }
.faq__item summary::-webkit-details-marker { display: none; }
.faq__item summary h3 { font: 600 19px/1.35 var(--f-serif); }
.faq__item summary::after {
  content: ""; flex: 0 0 auto; width: 14px; height: 14px;
  background: linear-gradient(var(--gold-deep), var(--gold-deep)) center / 14px 1px no-repeat,
              linear-gradient(var(--gold-deep), var(--gold-deep)) center / 1px 14px no-repeat;
  transition: transform .3s;
}
.faq__item[open] summary::after { transform: rotate(45deg); }
.faq__item summary:hover h3, .faq__item summary:focus-visible h3 { color: var(--gold-deep); }
.faq__item summary:focus-visible { outline-color: var(--gold-deep); outline-offset: -2px; }
.faq__body { padding: 0 0 22px; max-width: 64ch; }
.faq__body p { font: 400 16.5px/1.6 var(--f-sans); color: var(--ink-soft); }
.faq__body p + p { margin-top: 10px; }
.faq a { color: var(--gold-deep); text-decoration: underline; text-underline-offset: 3px; }
.faq a:hover, .faq a:focus-visible { color: var(--ink-day); }
.faq :focus-visible { outline-color: var(--gold-deep); }
.faq__closing { margin-top: 30px; font: italic 400 18px/1.5 var(--f-serif); color: var(--ink-day); }

.foot { position: relative; z-index: 2; background: #1d1a16; color: #d9d2c8; padding: 56px var(--gutter) 40px; }
.foot__inner { max-width: 1100px; margin: 0 auto; display: grid; gap: 18px; }
.foot__brand { display: flex; align-items: center; gap: 12px; }
.foot__brand img { width: 36px; height: 36px; object-fit: contain; }
.foot__name { font: 600 13px/1.2 var(--f-display); letter-spacing: .16em; text-transform: uppercase; color: var(--c-gold); }
.foot__credo { font: italic 400 17px/1.5 var(--f-serif); color: #efe8dc; }
.foot__links { display: flex; flex-wrap: wrap; gap: 6px 24px; margin-top: 6px; }
.foot__links a { font: 400 14px/1.4 var(--f-sans); color: #e6ddc9; text-decoration: none; padding: 6px 0; border-bottom: 1px solid transparent; }
.foot__links a:hover, .foot__links a:focus-visible { border-bottom-color: var(--c-gold); color: #fff; }
.foot__copy { font: 400 13px/1.5 var(--f-sans); color: #a79f90; margin-top: 10px; }

.toast {
  position: fixed; left: 16px; bottom: 16px; z-index: 50; max-width: min(340px, calc(100vw - 32px));
  padding: 10px 14px; border-radius: 4px;
  background: rgba(8,12,24,.92); color: #f3efe6; border: 1px solid color-mix(in srgb, var(--c-gold) 60%, transparent);
  font: 400 13px/1.45 var(--f-sans); opacity: 0; transform: translateY(8px); transition: opacity .3s, transform .3s; pointer-events: none;
}
.toast.is-open { opacity: 1; transform: none; }

/* --------------------------------------------------------------------------
   10. Thank-you page
   -------------------------------------------------------------------------- */
html.is-thanks .stage { position: relative; }
html.is-thanks #bn-ashlar { transform: scale(1.4); transform-box: fill-box; transform-origin: 50% 100%; }
.finale--thanks { padding-bottom: 96px; }
.finale__thanks { position: relative; max-width: 640px; margin: 0 auto; }
.finale__thanks .finale__plumb { left: 50%; }
.finale__thanks .card__contact { left: 50%; animation: contact-pulse 1.2s ease-out .2s both; opacity: 1; }
.card--thanks h1 { font: 600 clamp(26px, 2.4vw, 34px)/1.2 var(--f-display); letter-spacing: .06em; margin-bottom: 22px; text-wrap: balance; }
.thanks__lines { list-style: none; counter-reset: th; display: grid; gap: 14px; }
.thanks__lines li { position: relative; padding-left: 34px; font: 400 16.5px/1.55 var(--f-sans); color: var(--ink-soft); counter-increment: th; }
.thanks__lines li::before { content: counter(th); position: absolute; left: 0; top: 0; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--gold-deep); color: var(--gold-deep); font: 600 12px/1 var(--f-display); }
.thanks__duration { margin-top: 22px; font: 400 16.5px/1.55 var(--f-sans); color: var(--ink-day); }
.thanks__links { margin-top: 24px; display: flex; flex-wrap: wrap; gap: 6px 18px; font: 400 15px/1.5 var(--f-sans); }
.thanks__quote { margin-top: 30px; padding-top: 22px; border-top: 1px solid var(--stone-rule); font: italic 400 clamp(19px, 1.5vw, 22px)/1.45 var(--f-serif); }
.stage__caption {
  position: absolute; right: 8cqw; bottom: 23cqh; z-index: 5; max-width: 230px; text-align: right;
  padding: 7px 11px; border-radius: 3px; background: rgba(255,250,242,.88); border: 1px solid rgba(118,96,47,.35);
  font: italic 400 14px/1.4 var(--f-serif); color: var(--ink-day); pointer-events: none;
}
.stage__caption::after { content: ""; position: absolute; right: 14px; top: 100%; width: 1px; height: 5.5cqh; background: var(--gold-deep); transform: rotate(-22deg); transform-origin: 50% 0; }
@media (max-width: 767px) { .stage__caption { display: none; } }

/* --------------------------------------------------------------------------
   11. Reduced motion, print
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  :root { --depth-k: 0; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .rope, .rope__line, .rope.is-landed, .rope.is-swinging { animation: none !important; transform: none !important; }
  .rope__line::after, .cue__line { animation: none !important; transform: none !important; opacity: 1; }
  #bn-flame, #sk-a-group, #sk-b-group, #sk-c-group, #sk-a-group circle { animation: none !important; }
  #sc-arm-mallet, #sc-forearm-mallet { animation: none !important; transform: rotate(0deg) !important; }   /* mallet resting on the chisel */
  .layer--statue .dust { display: none; }
  .card, .pain, .card--hero .card__body { opacity: 1 !important; transform: none !important; }
  .card--hero h1, .card--hero .lead, .card--hero .eyebrow { animation: none !important; }
}
html.reduced-motion { --depth-k: 0; }
html.reduced-motion .rope, html.reduced-motion .rope__line, html.reduced-motion #bn-flame,
html.reduced-motion .layer--stars svg *, html.reduced-motion .cue__line { animation: none !important; }
html.reduced-motion #sc-arm-mallet, html.reduced-motion #sc-forearm-mallet { animation: none !important; transform: rotate(0deg) !important; }
html.reduced-motion .layer--statue .dust { display: none; }

@media print {
  html { --c-sky-top: #6fa8dc; --c-sky-mid: #bcd9f1; --c-sky-bottom: #e9eef2; --c-far: #a7b7cc; --c-far-2: #8b9db3; --c-mid: #6c7a8a; --c-mid-light: #9aa9bb;
    --c-near: #3b3a3f; --c-near-light: #5a5753; --c-stone-light: #f7f3ec; --c-stone-mid: #d9d2c8; --c-stone-shadow: #9a948b; --c-rough: #aaa49a; --c-rim: #fff1c9; }
  .layer--statue, .top, .steps .card { --day: 1; }
  .layer--stars > svg, #st-rim, .sc-back-rim, .layer--sculptor > svg { --stars: 0; }
  .layer--bench, #bn-lit, #bn-glow { --lantern: 0; }
  #sc-pose-work, #sc-pose-rest { --rest: 1; }
  #br-old, #br-broad, #br-young { --brothers: 1; }
  .layer--moon { --moon-o: 0; } .layer--sun { --sun-o: 1; --sun-y: 18; }
  body { background: #fff; color: #000; }
  .top, .rope, .gauge, .toast, .tooltip, .pin, .steps, .faq, .skip, .finale__plumb, .under-button, .foot__links { display: none !important; }
  .story { display: block; }
  .stage { position: relative; height: 60vh; break-inside: avoid; transform: none; }
  .layer { transform: none !important; }
  .carve--block { display: none; }
  .carve--statue { clip-path: none; }
  .finale { padding: 24px 0; break-before: avoid; }
  .finale__grid { display: block; }
  .card--form { box-shadow: none; border: 1px solid #999; margin-top: 24px; }
  .finale__note { max-width: none; }
  .foot { background: none; color: #000; padding: 16px 0; }
  .foot__name, .foot__credo { color: #000; }
}
