/* ── dark studio chapters: truth · problem · steps · studio · reel ── */

/* ===== truth (typewriter in a selection box) ===== */
.truth { padding: 0 var(--gutter); height: 240vh; }
.truth-pin { position: sticky; top: 0; height: 100vh; height: 100svh; display: grid; place-items: center; align-content: center; gap: 56px; }
.truth .label--center { font-size: var(--t-small); }
.selbox {
  position: relative;
  width: min(880px, 100%);
  transition: width .9s var(--ease-in-out), opacity var(--slow) var(--ease-out), transform var(--slow) var(--ease-out);
  will-change: transform;
}
.selbox.is-fit { width: min(640px, 100%); }
.selbox {
  padding: clamp(40px, 6vw, 76px) clamp(24px, 5vw, 64px);
  background: rgba(255,255,255,.035);
  border: 1px solid var(--line-d2);
  backdrop-filter: blur(6px);
  opacity: 0; transform: translateY(24px) scale(.98);
}
.selbox.is-in { opacity: 1; transform: none; }
.selbox.is-in.is-live { transition: none; } /* scroll drives size; no CSS easing to fight it */
.handle {
  position: absolute; width: 7px; height: 7px; background: var(--chalk); border-radius: 1px;
  box-shadow: 0 0 0 1px var(--studio);
}
.h-tl { left: -4px; top: -4px; } .h-tr { right: -4px; top: -4px; }
.h-bl { left: -4px; bottom: -4px; } .h-br { right: -4px; bottom: -4px; }
.h-mr { right: -4px; top: 50%; translate: 0 -50%; border-radius: 3px; width: 9px; height: 9px; }
.h-bm { bottom: -4px; left: 50%; translate: -50% 0; border-radius: 3px; width: 9px; height: 9px; }
.selbox-text {
  font-size: clamp(1.15rem, 2vw, 1.55rem); line-height: 1.35; letter-spacing: -.02em;
  color: var(--chalk-dim); text-align: center; font-weight: 400; min-height: 3.5em;
}
.selbox-text b { color: var(--chalk); font-weight: 500; }
.inline-sel {
  background: none; color: var(--chalk); position: relative; padding: 0 .1em;
  outline: 1px solid transparent; outline-offset: 2px; transition: outline-color var(--normal);
}
.inline-sel.is-lit { outline-color: var(--line-d2); }
.inline-sel::before, .inline-sel::after {
  content: ""; position: absolute; width: 5px; height: 5px; background: var(--chalk);
  top: -4px; opacity: 0; transition: opacity var(--normal);
}
.inline-sel.is-lit::before, .inline-sel.is-lit::after { opacity: 1; }
.inline-sel::before { left: -4px; } .inline-sel::after { right: -4px; }
.tw-cursor { display: inline-block; width: 2px; height: 1em; background: var(--chalk); vertical-align: -.15em; margin-left: 2px; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ===== problem (cards collapse to pills, then the flip) ===== */
.problem { padding: 0 var(--gutter); height: 280vh; }
.problem-pin {
  position: sticky; top: 0; height: 100vh; height: 100svh;
  display: grid; grid-template-rows: auto 1fr; gap: 0;
  padding: 14vh 0 10vh;
}
.problem-head { display: flex; justify-content: space-between; align-items: flex-start; }
.problem-cards {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px;
  align-self: center; position: relative; z-index: 1;
}
.pcard {
  position: relative; height: clamp(260px, 44vh, 400px);
  border-radius: 14px; padding: 22px;
  background: linear-gradient(180deg, var(--studio-3), var(--studio-2));
  border: 1px solid var(--line-d);
  display: flex; flex-direction: column; justify-content: space-between;
  overflow: hidden;
  transform-origin: left center;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06);
}
.pcard-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 18%; filter: saturate(.92); }
.pcard::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(8,9,16,.62) 0%, rgba(8,9,16,.06) 38%, rgba(8,9,16,.12) 62%, rgba(8,9,16,.8) 100%); }
.pcard-tag, .pcard-body { position: relative; z-index: 1; }
.pcard-tag { font-size: .78rem; color: var(--chalk); white-space: nowrap; font-weight: 500; text-shadow: 0 1px 8px rgba(0,0,0,.5); }
.pcard-body strong { display: block; font-size: clamp(1.3rem, 1.9vw, 1.7rem); font-weight: 400; letter-spacing: -.03em; line-height: 1.1; color: var(--chalk); font-family: var(--font-display); }
.pcard-body p { font-size: var(--t-small); color: var(--chalk); max-width: 24ch; line-height: 1.4; text-shadow: 0 1px 8px rgba(0,0,0,.5); }
.pcard-icon { width: 22px; height: 22px; stroke: var(--chalk-dim); fill: none; stroke-width: 1.4; stroke-linecap: round; opacity: 0; position: absolute; bottom: 22px; left: 50%; translate: -50% 0; }

.problem-flip {
  position: absolute; right: 0; top: 50%; translate: 0 -40%;
  width: min(360px, 40%); opacity: 0; pointer-events: none;
}
.problem-flip h3 { font-size: var(--t-h3); font-weight: 500; letter-spacing: -.02em; margin-top: 44px; }
.problem-flip p { font-size: var(--t-small); color: var(--chalk-dim); margin-top: 12px; max-width: 34ch; }
.mini-cta { display: inline-flex; flex-direction: column; align-items: center; gap: 8px; font-size: var(--t-micro); color: var(--chalk); margin-left: 60%; }
.mini-cta img { width: 74px; height: 92px; object-fit: cover; object-position: top; border-radius: 10px; border: 1px solid var(--line-d2); }
.mini-cta:hover img { filter: brightness(1.1); }

/* ===== steps · a tilting 3D scene that flips between beats ===== */
.steps { text-align: center; padding: 0 var(--gutter); height: 420vh; }
.steps-pin { position: sticky; top: 0; height: 100vh; height: 100svh; display: grid; align-content: center; justify-items: center; padding: 8vh 0 6vh; }
.steps .h2--center + * { margin-top: clamp(24px, 4vh, 56px); }
.steps-stage { display: grid; gap: clamp(40px, 6vw, 80px); justify-items: center; }
.step-scene {
  --tone: var(--ember); --glow: var(--ember-glow);
  perspective: 1200px; width: min(680px, 94vw); height: clamp(340px, 44vh, 420px);
  display: grid; place-items: center;
}
.step-scene[data-tone="lime"] { --tone: var(--lime); --glow: var(--lime-glow); }
.step-scene[data-tone="sky"]  { --tone: var(--sky);  --glow: var(--sky-glow); }
.step-group { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; will-change: transform; }
.step-card {
  position: absolute; left: 50%; top: 50%; translate: -50% -50%;
  width: min(440px, 80vw); height: 84%;
  border-radius: 22px; padding: 22px;
  background:
    radial-gradient(110% 80% at 50% 115%, var(--glow), transparent 68%),
    linear-gradient(180deg, color-mix(in oklab, var(--tone) 58%, var(--studio-2)), color-mix(in oklab, var(--tone) 22%, var(--studio-2)));
  border: 1px solid color-mix(in oklab, var(--tone) 55%, transparent);
  box-shadow: 0 50px 120px -30px var(--glow), var(--shadow-float);
  transition: background var(--slow) var(--ease-out), border-color var(--slow), box-shadow var(--slow);
  backface-visibility: hidden;
}
.step-card-title { font-size: var(--t-small); color: var(--chalk); }
.step-side { position: absolute; top: 50%; translate: 0 -50%; font-size: var(--t-small); color: var(--chalk-dim); }
.step-side--l { left: 26px; } .step-side--r { right: 26px; }
.step-scene[data-tone="lime"] .step-side, .step-scene[data-tone="lime"] .step-card-title { color: #0D1638; }
.step-face {
  position: absolute; left: 50%; top: 52%; translate: -50% -50%;
  width: 160px; height: 160px; border-radius: 50%; object-fit: cover; object-position: 50% 12%;
  filter: grayscale(.2) contrast(1.05);
  box-shadow: 0 0 0 10px color-mix(in oklab, var(--tone) 55%, transparent);
  transition: box-shadow var(--slow);
}
.step-chips { position: absolute; inset: 0; transform-style: preserve-3d; pointer-events: none; }
.chip {
  position: absolute; left: var(--x); top: var(--y);
  display: grid; grid-template-columns: 36px 1fr; grid-template-rows: auto auto; column-gap: 8px; align-items: center;
  padding: 6px 10px 6px 6px; border-radius: 12px;
  background: rgba(20,20,20,.9); border: 1px solid var(--line-d2);
  box-shadow: 0 18px 40px rgba(0,0,0,.45);
  font-size: var(--t-micro); color: var(--chalk); text-align: left; white-space: nowrap;
  animation: float 5s ease-in-out infinite; animation-delay: var(--d, 0s);
  backface-visibility: hidden;
}
.chip img { grid-row: 1 / 3; width: 36px; height: 36px; object-fit: cover; border-radius: 8px; }
.chip b { font-weight: 500; } .chip i { font-style: normal; color: var(--chalk-dim); font-size: .66rem; }
.chip--pill { grid-template-columns: 1fr; padding: 6px 10px; border-radius: 999px; }
.chip--btn { grid-template-columns: 1fr; padding: 8px 14px; border-radius: 999px; background: var(--chalk); color: var(--ink); font-weight: 500; box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.chip--card { grid-template-columns: 1fr; grid-template-rows: auto auto; padding: 6px; row-gap: 6px; }
.chip--card img { width: 84px; height: 104px; border-radius: 8px; grid-row: auto; }
.chip--card.chip--sq img { height: 84px; }
.chip--card b { padding: 0 4px 2px; }
.chip--tone { background: color-mix(in oklab, var(--tone) 70%, #111); border-color: transparent; }
@keyframes float { 50% { translate: 0 -8px; } }

.steps-track {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 28px;
  width: min(1100px, 100%); text-align: left;
}
.step button { display: flex; align-items: center; gap: 12px; width: 100%; }
.step-num {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none;
  border: 1px solid var(--line-d2); font-size: var(--t-micro); color: var(--chalk-dim);
  transition: background var(--normal), color var(--normal);
}
.step.is-active .step-num, .step.is-done .step-num { background: var(--chalk); color: var(--ink); border-color: var(--chalk); }
.step-dots {
  flex: 1; height: 6px;
  background-image: radial-gradient(circle, var(--chalk-faint) 2.4px, transparent 2.6px);
  background-size: 14px 6px; background-repeat: repeat-x; background-position: 0 50%;
  position: relative; overflow: hidden;
}
.step-dots::after {
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(circle, var(--chalk) 2.4px, transparent 2.6px);
  background-size: 14px 6px; background-repeat: repeat-x; background-position: 0 50%;
  clip-path: inset(0 100% 0 0);
}
.step.is-done .step-dots::after { clip-path: inset(0 0 0 0); }
.step.is-active .step-dots::after { animation: fill var(--dur, 4.6s) linear forwards; }
.steps.is-scrubbed .step.is-active .step-dots::after { animation: none; clip-path: inset(0 calc(100% - var(--fill, 0%)) 0 0); }
@keyframes fill { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
.step-copy { margin-top: 18px; opacity: .35; transition: opacity var(--normal); }
.step.is-active .step-copy, .step.is-done .step-copy { opacity: 1; }
.step-copy b { font-size: var(--t-small); font-weight: 500; display: block; }
.step-copy p { font-size: var(--t-micro); color: var(--chalk-dim); margin-top: 6px; max-width: 26ch; line-height: 1.45; }

/* ===== studio (node canvas that grows into the reel) ===== */
.studio { padding: 0 var(--gutter); height: 320vh; }
.studio-pin {
  position: sticky; top: 0; height: 100vh; height: 100svh;
  display: flex; flex-direction: column; justify-content: center; gap: clamp(20px, 3vh, 40px);
  padding: 9vh 0 6vh;
}
.studio-head { display: flex; justify-content: space-between; align-items: flex-start; }
.canvas {
  position: relative; height: clamp(420px, 62vh, 720px); border-radius: 22px;
  background: var(--studio-2); border: 1px solid var(--line-d);
  background-image: radial-gradient(rgba(255,255,255,.09) 1px, transparent 1.2px); background-size: 16px 16px;
  box-shadow: inset 0 0 120px rgba(0,0,0,.6);
  display: grid; grid-template-columns: 1fr minmax(240px, 30%) 1fr; align-items: center;
  padding: 0 clamp(16px, 4vw, 56px);
}
.canvas-tools {
  position: absolute; top: 18px; left: 50%; translate: -50% 0; display: flex; gap: 6px; z-index: 6;
  font-size: var(--t-micro); color: var(--chalk-dim);
}
.node--stage { margin-top: 44px; }
.canvas-tools span { padding: 4px 10px; border-radius: 6px; background: rgba(255,255,255,.05); border: 1px solid var(--line-d); }
.node { position: relative; z-index: 2; }
.node-title {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 8px; border-radius: 999px;
  background: var(--studio-3); border: 1px solid var(--line-d2); font-size: var(--t-micro); color: var(--chalk);
}
.node-title i { font-style: normal; width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line-d2); font-size: .7rem; color: var(--chalk-dim); }
.node-row { display: flex; gap: 10px; margin-top: 14px; }
.node--model { align-self: end; margin-bottom: 30px; justify-self: start; }
.node--bg { grid-column: 1; grid-row: 1; align-self: start; margin-top: 30px; justify-self: start; }
.canvas { grid-template-rows: 1fr 1fr; }
.node--model { grid-row: 1; align-self: end; margin-bottom: 18px; }
.node--bg { grid-row: 2; align-self: start; margin-top: 18px; }
.node--stage { grid-column: 2; grid-row: 1 / 3; align-self: center; }
.node--clothes { grid-column: 3; grid-row: 1 / 3; align-self: center; justify-self: end; }
.face, .swatch {
  width: 58px; height: 58px; border-radius: 10px; overflow: hidden; background: var(--white);
  border: 2px solid transparent; transition: transform var(--fast) var(--ease-out), border-color var(--fast);
}
.face img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 8%; }
.face:hover, .swatch:hover, .garment:hover { transform: translateY(-2px); }
.face.is-on, .swatch.is-on, .garment.is-on { border-color: var(--chalk); }
.swatch { background: var(--bg); }
.node--stage {
  width: 100%; aspect-ratio: 3 / 4; border-radius: 16px; overflow: hidden; max-height: 100%;
  will-change: transform; z-index: 5;
  background: var(--stage-bg, linear-gradient(160deg, #8a8f99, #3e434c));
  border: 1px solid var(--line-d2); box-shadow: var(--shadow-float);
  transition: background var(--slow);
}
.stage-img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(.25) contrast(1.04); transition: opacity var(--normal); }
.stage-img.is-swapping { opacity: 0; }
.stage-bar {
  position: absolute; left: 10px; right: 10px; bottom: 10px; display: flex; gap: 6px; flex-wrap: wrap;
  font-size: .62rem; color: var(--chalk);
}
.stage-bar span { padding: 4px 8px; border-radius: 999px; background: rgba(10,10,10,.75); border: 1px solid var(--line-d2); }
.stage-reel { position: absolute; inset: 0; opacity: 0; pointer-events: none; }
.stage-reel::after { content: ""; position: absolute; inset: 0; background: radial-gradient(60% 50% at 50% 50%, rgba(10,10,20,.55), rgba(10,10,20,.15) 70%, rgba(10,10,20,.35)); }
/* the reels are portrait (9:16): show them whole on a blurred copy of the current look, never crop the head */
.stage-reel .reel-bg { position: absolute; inset: -40px; background: #101018 center / cover no-repeat; filter: blur(28px) brightness(.55) saturate(1.1); }
.stage-reel .reel-video { position: relative; width: 100%; height: 100%; object-fit: contain; object-position: 50% 50%; filter: contrast(1.03); }
.node--stage.is-grown { max-height: none; aspect-ratio: auto; grid-column: auto; grid-row: auto; }
.node--stage.is-grown .reel-video { transform: scale(1.18); } /* trims the letterbox baked into the generated reels */ /* auto placement → the canvas box is the containing block */
.reel-caption {
  position: absolute; inset: 0; z-index: 56; display: grid; place-content: center; text-align: center;
  color: var(--chalk); font-size: clamp(2rem, 5vw, 4.4rem); letter-spacing: -.04em; line-height: 1; font-weight: 400;
  text-shadow: 0 2px 30px rgba(0,0,0,.6), 0 0 2px rgba(0,0,0,.6); opacity: 0; pointer-events: none;
  font-family: var(--font-display);
}
.reel-caption span { display: block; }
.node--stage.is-grown { z-index: 55; }
.node--clothes { display: grid; justify-items: center; gap: 26px; }
.node-grid { display: grid; grid-template-columns: repeat(3, 60px); gap: 12px; }
.node-grid--picked { grid-template-columns: repeat(auto-fit, 60px); min-height: 60px; justify-content: center; width: 204px; }
.node-title--clothes i { order: 2; }
.garment.is-new { animation: pop .5s var(--ease-out) both; }
@keyframes pop { from { opacity: 0; transform: translateY(-10px) scale(.8); } }
.stage-live { position: absolute; inset: 0; opacity: 0; transition: opacity var(--slow); pointer-events: none; }
.stage-live video { width: 100%; height: 100%; object-fit: cover; }
.node--stage.is-live .stage-live { opacity: 1; }
.stage-status {
  position: absolute; top: 10px; left: 10px; font-size: .62rem; padding: 4px 8px; border-radius: 999px;
  background: rgba(10,10,10,.75); border: 1px solid var(--line-d2); color: var(--chalk);
  opacity: 0; transition: opacity var(--normal);
}
.node--stage.is-busy .stage-status, .node--stage.is-live .stage-status, .node--stage.is-done .stage-status { opacity: 1; }
.node--stage { cursor: pointer; }
.node--stage.is-busy .stage-img { filter: grayscale(.25) contrast(1.04) blur(6px); transform: scale(1.04); }
.stage-img { transition: opacity var(--normal), filter var(--slow), transform var(--slow); }
.garment { width: 60px; height: 60px; border-radius: 10px; overflow: hidden; background: var(--white); border: 2px solid transparent; transition: transform var(--fast) var(--ease-out), border-color var(--fast); }
.garment img { width: 100%; height: 100%; object-fit: cover; }
.wires { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none; }
.wires path { fill: none; stroke: var(--line-d2); stroke-width: 1.4; stroke-linecap: round; }
.wires path.is-hot { stroke: var(--chalk); }
.wires path.is-drawing { stroke: var(--chalk); stroke-dasharray: var(--len); stroke-dashoffset: var(--len); animation: draw .7s var(--ease-out) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }


@media (max-width: 900px) {
  .problem { height: auto; padding: var(--section) var(--gutter); }
  .problem-pin { position: static; height: auto; padding: 0; display: grid; gap: 36px; }
  .problem-cards { grid-template-columns: repeat(2, 1fr); }
  .pcard { height: 340px; padding: 16px; }
  .pcard-body p { font-size: var(--t-micro); }
  .problem-flip { position: static; translate: none; width: 100%; margin-top: 8px; opacity: 1; pointer-events: auto; }
  .mini-cta { margin-left: 0; flex-direction: row; }
  .steps-track { grid-template-columns: 1fr 1fr; }
  .step-scene { height: 400px; }
  .canvas { height: auto; grid-template-columns: 1fr 1fr; grid-template-rows: auto auto auto; gap: 28px; padding: 70px 20px 28px; }
  .node--model, .node--bg { grid-row: auto; margin: 0; }
  .node--stage { grid-column: 1 / 3; grid-row: auto; max-width: 320px; justify-self: center; }
  .node--clothes { grid-column: 1 / 3; grid-row: auto; justify-self: center; }
  .wires { display: none; }
  .studio, .steps { height: auto; padding: var(--section) var(--gutter); }
  .steps-pin { position: static; height: auto; padding: 0; }
  .studio-pin { position: static; height: auto; padding: 0; }
}
@media (max-width: 560px) {
  .steps-track { grid-template-columns: 1fr; }
  .problem-cards { gap: 10px; }
}
