/* The opening scene: a Parisian building drawn in section, pinned while the camera goes down floor by floor.
   Default rules = the static stacked version (no script, reduced motion, low frame rate).
   html.is-scene = the pinned descent driven by GSAP ScrollTrigger and Lenis (js/scene.js). */

/* ---------- Drawing colours: one progress variable --k (0 = daylight, 1 = cellar) mixes every line ---------- */
.stage, .dw-use {
  --k: 0;
  --valve: 1;
  --ln: color-mix(in oklab, var(--primary), var(--on-stage) calc(var(--k) * 100%));
  --ink: color-mix(in oklab, var(--foreground), var(--on-stage) calc(var(--k) * 100%));
  --ground: color-mix(in oklab, var(--background), var(--stage) calc(var(--k) * 100%));
  --hatch: color-mix(in oklab, var(--border), var(--stage-line) calc(var(--k) * 100%));
  --cap: color-mix(in oklab, var(--foreground), var(--on-stage) calc(var(--k) * 100%));
}
.dw .cave { --ln: var(--on-stage); --ink: var(--on-stage); --ground: var(--stage); --hatch: var(--stage-line); }
.dw { overflow: hidden; }
.dw .ln {
  fill: none; stroke: var(--ln); stroke-width: 1; vector-effect: non-scaling-stroke;
  stroke-linecap: round; stroke-linejoin: round;
}
.dw .ln.soft, .dw .ln.lead, .dw .ln.gbox { stroke: color-mix(in oklab, var(--ln) 70%, var(--ground)); }
.dw .ln.ink { stroke: var(--ink); }
.dw .ln.deep { stroke-width: 2.25; stroke: var(--ink); }
.dw .ln.dash { stroke-dasharray: 4 4; stroke: color-mix(in oklab, var(--ln) 70%, var(--ground)); }
.dw .ln.grout { stroke: color-mix(in oklab, var(--ln) 32%, var(--ground)); }
.dw .ln.dim { stroke: color-mix(in oklab, var(--ln) 50%, var(--ground)); stroke-dasharray: 2 3; }
.dw .ln.seam { stroke: color-mix(in oklab, var(--ln) 80%, var(--ground)); }
.dw .ln.dot, .dw .dot { fill: var(--ln); }
.dw .hatch { fill: url(#hatch); stroke: none; }
.dw .soil { fill: url(#soil); stroke: none; }
.dw .hatch-ln { stroke: var(--hatch); stroke-width: 1; }
.dw .pipe { fill: var(--ground); stroke: none; }
.dw .thread {
  fill: none; stroke: var(--material); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round;
}
.dw .water { fill: none; stroke: var(--material); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round; }
.dw .water.drop { stroke-width: 1.5; }
.dw .water-fill, .dw .water-fill-soft { fill: var(--material); stroke: none; }
.dw .stain { fill: color-mix(in oklab, var(--material) 26%, var(--ground)); stroke: color-mix(in oklab, var(--ln) 70%, var(--ground)); stroke-width: 1; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }
.dw .plomb-pipe { fill: none; stroke: color-mix(in oklab, var(--on-stage) 55%, var(--stage)); stroke-width: 8; stroke-linecap: butt; }
.dw .valve-body { fill: color-mix(in oklab, var(--ground), var(--brand-accent) calc(var(--valve) * 100%)); stroke: var(--ln); stroke-width: 1; vector-effect: non-scaling-stroke; }
.dw .cave-ground { fill: var(--stage); stroke: none; }
.dw .anno {
  font-family: var(--font-label); font-weight: 500; font-size: 12px; letter-spacing: 0.12em; fill: var(--ln);
  font-variant-numeric: tabular-nums;
}
.dw .anno-sm { font-size: 11.5px; }
.dw .anno-xs { font-size: 10.5px; }
.dw .gest .anno { font-size: 10.5px; letter-spacing: 0.06em; }
.dw .anno-mark { font-size: 14px; fill: var(--ink); }
.dw .fname { font-family: var(--font-heading); font-weight: 700; font-size: 28px; letter-spacing: -0.01em; fill: var(--ink); }
.dw .union .ln { stroke-width: 1; }
/* lines drawn on by DrawSVG keep user-space dashes, so they scale with the camera */
.dw .branch, .dw .branch-dye, .dw .flabel .lead, .dw .roof-line, .dw .load-draw-wall { vector-effect: none; }
.dw .branch, .dw .branch-dye { stroke-width: 2; }
.dw .flabel.is-near .fname { text-decoration: underline; text-decoration-color: var(--material); }
.dw [id="fuite-mark"] .ln { stroke-width: 2; }
.dw .lever { transform-box: fill-box; }

/* ---------- Load: the roof outline and attic walls draw in as 1px strokes over 900ms ---------- */

/* ---------- Hero, static stacked version (default) ---------- */
.descent { padding: 0; background: var(--background); }
.descent .stage { position: relative; container-type: inline-size; padding-top: var(--header-h); }
.descent .drawing { position: relative; }
.descent .drawing .dw { width: 100%; height: auto; }
.descent .poster.cms-in {
  position: absolute; z-index: 3; top: calc(var(--header-h) + clamp(calc(var(--space-1) * 7), 5vh, var(--space-8))); left: var(--content-left); right: var(--content-right);
  display: block; max-width: none; margin: 0; pointer-events: none;
}
.poster > * { pointer-events: auto; }
.poster-text { max-width: 74rem; }
.level.cms-eyebrow { margin-bottom: 1.4rem; font-size: var(--label-size); }
.poster .level-txt { background: var(--ground); padding: 2px var(--space-2) 2px var(--space-1); }
.hero-title {
  font-size: var(--h-size) !important; line-height: 1.02; letter-spacing: -0.02em; margin: 0 0 1.4rem !important;
  max-width: 9.9em; color: var(--foreground);
}
.hero-title .line { display: block; }
.hero-sub, .hero-zone { max-width: min(21.5rem, 24cqw); margin: 0; }
.hero-sub { font-size: clamp(1.06rem, 1.3vw, 1.22rem); line-height: 1.6; margin-bottom: 0.4rem; }
.hero-zone { color: var(--muted-foreground); font-size: 0.98rem; }
.hero-sub > span, .hero-zone > span { background: var(--background); box-decoration-break: clone; -webkit-box-decoration-break: clone; padding: 1px var(--space-2) 2px; margin-left: calc(var(--space-2) * -1); }
.strengths { display: none; }
.hero-call-wrap { display: inline-block; margin-top: 1.6rem; }
.photo { margin: 0; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 6px 6px 0; }
.photo img { border-radius: calc(var(--radius) - 1px); filter: saturate(0.84) contrast(1.04) brightness(1.02); }
.photo figcaption {
  font-family: var(--font-label); font-weight: 500; font-size: 11px; letter-spacing: 0; text-transform: none;
  color: var(--muted-foreground); padding: 6px 2px 7px;
}
/* the poster's photo sits in column 3, across the attic slab line */
.photo-hero { position: absolute; left: calc(354 / 1440 * 100cqw); width: clamp(200px, 18.4cqw, 300px); transform: rotate(-1.2deg); top: calc(var(--header-h) + 552 / 1440 * 100cqw); }
.poster { top: 0; bottom: 0; padding-top: calc(var(--header-h) + clamp(calc(var(--space-1) * 7), 5vh, var(--space-8))); }

/* captions beside each floor, in Merriweather italic (static version) */
.beats { list-style: none; margin: 0; padding: 0; position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.beat { position: absolute; font-style: italic; font-size: 1.02rem; line-height: 1.55; color: var(--cap); max-width: 15rem; }
.beat .beat-n { display: block; font-style: normal; font-family: var(--font-label); font-weight: 500; font-size: 11px; letter-spacing: 0.12em; color: var(--muted-foreground); margin-bottom: var(--space-1); }
.beat[data-beat="1"] { display: none; }
.beat[data-floor] { left: calc(306 / 1440 * 100%); }
.beat[data-floor="5"] { left: calc(1150 / 1440 * 100%); top: calc(var(--header-h) + 684 / 1440 * 100cqw); max-width: 16rem; }
.beat[data-floor="4"] { top: calc(var(--header-h) + 1010 / 1440 * 100cqw); }
.beat[data-floor="3"] { top: calc(var(--header-h) + 1580 / 1440 * 100cqw); }
.beat[data-floor="2"] { top: calc(var(--header-h) + 2150 / 1440 * 100cqw); }
.beat[data-floor="1"] { top: calc(var(--header-h) + 2720 / 1440 * 100cqw); }
.beat[data-floor="-1"] { left: calc(640 / 1440 * 100%); top: calc(var(--header-h) + 3290 / 1440 * 100cqw); color: var(--on-stage); }
.beat[data-floor="-1"] .beat-n { color: var(--on-stage); }
.beat[data-beat="8"] { display: none; }
/* static: the floor-5 label would sit under the poster text, the poster already names the level */
html:not(.is-scene) .dw .flabel[data-floor="5"] { display: none; }
.pcards, .sfloors { display: none; }
.riser-hero { display: none; }
.scene-end {
  position: relative; background: var(--stage); color: var(--on-stage);
  padding: 0 var(--content-right) clamp(var(--space-7), 6vw, calc(var(--space-8) * 1.25)) calc(var(--riser-x) - 1px);
}
.scene-end::before { content: ""; display: block; height: 2px; }
.end-call {
  border: 1px solid var(--material) !important; min-height: 60px; font-size: 1.15rem; padding: var(--space-4) 28px var(--space-4) 40px; overflow: hidden;
}
.end-call .end-fill { position: absolute; inset: 0; background: var(--primary); z-index: -1; }
.end-call::before { display: none; }
#poster-callouts .anno { font-size: 12px; }

/* ---------- Phone, static ---------- */
@media (max-width: 760px) {
  .riser-hero { display: block; z-index: 0; }
  .descent .stage { padding-top: var(--header-h); }
  .poster { position: relative; top: auto; left: auto; right: auto; bottom: auto; padding: 22px var(--content-right) 0 var(--content-left); }
  .poster-text { display: flex; flex-direction: column; }
  .hero-title { font-size: clamp(2.2rem, 10.4vw, 2.7rem) !important; max-width: 9.6em; margin-bottom: 1.1rem !important; }
  .hero-sub { font-size: 1.02rem; }
  .hero-sub, .hero-zone { max-width: none; }
  .strengths {
    display: block; list-style: none; margin: var(--space-4) 0 0; padding: 0; order: 5;
    font-family: var(--font-label); font-weight: 500; font-size: 11.5px; letter-spacing: 0.1em; text-transform: uppercase; line-height: 1.35;
    color: var(--primary); width: 52%; max-width: calc(100% - 40% - 14px);
  }
  .strengths li { padding: 7px 0 7px 14px; border-top: 1px solid var(--border); position: relative; background: var(--ground); }
  .strengths li::before { content: ""; position: absolute; left: 0; top: 50%; width: 7px; height: 1px; background: var(--primary); }
  .hero-call-wrap { order: 7; display: block; margin-top: 1.1rem; }
  .hero-call { width: 100%; }
  .poster .photo-hero { position: absolute; top: auto; left: auto; right: var(--content-right); width: 38%; bottom: 76px; transform: rotate(1.3deg); }
  .descent .drawing { margin-top: var(--space-2); }
  .descent .drawing .dw { width: 100%; }
  html:not(.is-scene) .descent .beat[data-floor] { display: none; }
  html:not(.is-scene) .descent .stage { display: flex; flex-direction: column; }
  html:not(.is-scene) .descent .poster.cms-in { order: -1; position: relative; top: auto; bottom: auto; left: auto; right: auto; padding: 22px var(--content-right) 0 var(--content-left); }
  html:not(.is-scene) .descent .beats { position: absolute; width: 1px; height: 1px; overflow: clip; clip-path: inset(50%); }
  html:not(.is-scene) #poster-callouts { display: none; }
  html:not(.is-scene) .sfloors { display: block; position: relative; z-index: 1; }
  .sfloor { margin: 0; padding: 18px var(--content-right) 22px var(--content-left); border-top: 1px solid var(--primary); position: relative; }
  .sfloor figcaption { padding-top: 10px; display: grid; gap: 2px; }
  .sfloor-cap { font-style: italic; font-size: 1rem; line-height: 1.55; }
  .sfloor-cave { background: var(--stage); color: var(--on-stage); }
  .sfloor-cave .pcard-lvl, .sfloor-cave .pcard-name { color: var(--on-stage); }
  .scene-end { padding: 0 var(--content-right) 2.5rem var(--content-left); }
  .end-call { width: 100%; padding-left: 22px; }
  .scene-end::after {
    content: ""; position: absolute; left: calc(var(--riser-x) - 1px); top: 0; height: 34px; width: calc(var(--content-left) - var(--riser-x) + 1px);
    border-left: 2px solid var(--material); border-bottom: 2px solid var(--material); border-bottom-left-radius: 10px;
  }
}
.pcard-lvl { font-family: var(--font-label); font-weight: 500; font-size: 11px; letter-spacing: 0.12em; color: var(--muted-foreground); }
.pcard-name { font-family: var(--font-heading); font-weight: 700; font-size: 1.3rem; line-height: 1.15; color: var(--foreground); }

/* ---------- The pinned descent ---------- */
.is-scene .descent .stage {
  height: 100svh; overflow: clip; padding-top: 0;
  background: var(--ground);
}
.is-scene .descent .drawing { position: absolute; inset: 0; height: auto; margin: 0; }
.is-scene .descent .drawing .dw { position: absolute; inset: 0; width: 100%; height: 100%; }
.is-scene .beats { inset: auto auto 0 0; position: absolute; left: var(--content-left); bottom: clamp(32px, 7vh, 72px); width: min(34rem, 60vw); height: 5.5rem; }
.is-scene .beat { left: 0 !important; top: auto !important; bottom: 0; max-width: none; opacity: 0; display: block; font-size: clamp(1.05rem, 1.35vw, 1.3rem); background: var(--ground); padding: 6px var(--space-3) 6px 0; }
.is-scene .beat > span:not(.beat-n) { display: inline; }
.is-scene .beat .beat-n { color: var(--cap); opacity: 0.86; }
.is-scene .beat[data-floor="-1"], .is-scene .beat[data-floor="-1"] .beat-n { color: var(--cap); }
.is-scene .scene-end {
  position: absolute; z-index: 4; left: calc(var(--riser-x) - 1px); bottom: clamp(118px, 17vh, 170px); padding: 0; background: transparent;
  visibility: hidden;
}
.is-scene .end-call { min-width: min(30rem, 34vw); justify-content: flex-start; }
.is-scene .end-call .end-fill { transform-origin: left center; }

@media (min-width: 761px) {
  .is-scene .poster .photo-hero { top: auto; bottom: 62px; }
  .is-scene .beat[data-beat="8"] { bottom: 150px; }
  .is-scene .scene-end { width: 30.7%; bottom: calc(11.67% - 30px); }
  .is-scene .end-call { width: 100%; min-width: 0; }
}

/* phone, pinned: riser on the left edge, one floor at a time, the floor card at the top */
@media (max-width: 760px) {
  .is-scene .descent .stage { padding-top: 0; }
  .is-scene .riser-hero { display: block; z-index: 3; top: 0; bottom: 0; background: var(--ground); border-color: var(--ln); }
  .is-scene .poster { position: absolute; top: var(--header-h); left: 0; right: 0; bottom: auto; padding-top: 18px; }
  .is-scene .strengths { margin-bottom: 0; }
  .is-scene .pcards { display: block; position: absolute; z-index: 3; top: calc(var(--header-h) + 14px); left: var(--content-left); right: var(--content-right); height: 150px; }
  .is-scene .pcard { position: absolute; inset: 0 0 auto 0; display: grid; gap: 3px; opacity: 0; visibility: hidden; background: var(--ground); padding-bottom: var(--space-2); }
  .is-scene .pcard .pcard-lvl { color: var(--cap); }
  .is-scene .pcard .pcard-name { color: var(--cap); background: var(--ground); justify-self: start; padding-right: var(--space-2); }
  .is-scene .pcard-row { display: flex; gap: var(--space-2); margin-top: var(--space-2); }
  .is-scene .pcard-row svg { width: 54px; height: 54px; background: var(--ground); }
  .is-scene .pcard-row .gbox, .is-scene .pcard-row .anno { display: none; }
  .is-scene #poster-callouts { display: none; }
  .is-scene .dw .flabel, .is-scene .dw .gests { display: none; }
  .is-scene .dw .anno { font-size: 15px; }
  .is-scene .dw .anno-sm { font-size: 14px; }
  .is-scene .dw .anno-xs { font-size: 12px; }
  .is-scene .beats { left: var(--content-left); right: var(--content-right); width: auto; bottom: 86px; height: 5.2rem; }
  .is-scene .beat { font-size: 1.02rem; background: var(--ground); padding: var(--space-1) var(--space-2) var(--space-1) 0; }
  .is-scene .scene-end { left: var(--content-left); right: var(--content-right); bottom: 150px; }
  .is-scene .end-call { width: 100%; min-width: 0; }
  .is-scene .scene-end::after { display: none; }
}
/* the pcards reference the gesture drawings through <use>: the clones only inherit, so the lines are set on <use> */
.pcard-row use { fill: none; stroke: var(--primary); stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }
