:root {
  --ink: #1d120d;
  --bg: #e9dccb;
  --clay: #a34a26;
  --cream: #f2ece1;
  --night: #120806;
  --title: 'Syne', system-ui, sans-serif;
  --serif: 'Instrument Serif', Georgia, serif;
  --sans: 'Instrument Sans', system-ui, sans-serif;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --gutter: 20px;
  --toast-bg: #1d120d;
  --toast-radius: 999px;
  color-scheme: light;
}

html { background: var(--bg); }
body { background: var(--bg); color: var(--ink); font: 400 16px/1.5 var(--sans); }
:focus-visible { outline: 2px solid var(--clay); outline-offset: 3px; }
h2 { font: 400 clamp(46px, 12.6vw, 104px)/0.96 var(--serif); letter-spacing: -0.02em; }
h2 em { color: var(--clay); }

/* Layers: title below, 3D in the middle, everything else on top */
.stage { position: fixed; z-index: 1; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.stage-fallback { display: none; }
.no-webgl .stage { display: none; }
.no-webgl .stage-fallback { position: fixed; z-index: 1; top: 12svh; left: 50%; display: block; width: 44vw; max-width: 300px; fill: var(--clay); transform: translateX(-50%); }
.no-webgl .studio-drag, .no-webgl .fire { display: none; }

.loader { position: fixed; z-index: 90; inset: 0; display: grid; place-items: center; background: var(--night); color: #ffb37a; font: 800 clamp(64px, 20vw, 200px)/1 var(--title); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; transition: clip-path 900ms var(--ease); clip-path: inset(0); }
.loader.is-off { clip-path: inset(0 0 100% 0); pointer-events: none; }

.top { position: fixed; z-index: 30; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: flex-start; padding: 14px var(--gutter); color: var(--ink); pointer-events: none; }
.top a { pointer-events: auto; }
.top { transition: opacity 240ms; }
.top.is-off { opacity: 0; }
.top.is-off a { pointer-events: none; }
.brand { font: 800 18px/1 var(--title); letter-spacing: -0.02em; text-decoration: none; }
.hud { display: grid; justify-items: end; gap: 2px; }
.hud b { font: 800 clamp(26px, 6.6vw, 44px)/1 var(--title); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.hud span { font-size: 12px; font-weight: 600; }

/* Story */
.chapter { position: relative; z-index: 2; height: 150svh; padding: 0 var(--gutter); }
.chapter.is-dark { color: #f6e9dc; }
.chapter.is-dark h2 em { color: #ff9c5f; }
.cap { position: sticky; top: 63svh; display: grid; gap: 8px; max-width: 520px; }
.cap span { font-size: 13px; font-weight: 600; }
.cap h2 { font-size: clamp(42px, 11.6vw, 92px); }
.cap p { max-width: 420px; font-size: 16px; line-height: 1.4; }

.hero { height: 130svh; }
.hero-title { position: fixed; z-index: 0; top: 25svh; left: 0; right: 0; color: var(--clay); font: 800 14.6vw/1 var(--title); letter-spacing: -0.04em; text-align: center; white-space: nowrap; opacity: var(--title-on, 1); transform: translateY(var(--title-y, 0)); }
.hero-foot { position: absolute; top: calc(100svh - 92px); left: var(--gutter); right: var(--gutter); display: flex; justify-content: space-between; align-items: end; gap: 16px; font-weight: 600; font-size: 14px; }
.hero-hint { text-align: right; }
.hero-hint span { display: inline-block; animation: nudge 1800ms ease-in-out infinite; }

/* Studio */
.studio { position: relative; z-index: 2; display: grid; grid-template-rows: auto 1fr auto; height: 100svh; min-height: 640px; padding: 66px var(--gutter) 20px; }
.studio-drag { position: absolute; z-index: 1; inset: 0; touch-action: pan-y; cursor: ew-resize; }
.studio-head, .studio-panel { position: relative; z-index: 2; }
.studio-head { pointer-events: none; }
.studio-head h2 { font-size: clamp(40px, 11vw, 80px); }
.studio-hint { font-size: 14px; font-weight: 600; transition: opacity 400ms; }
.studio-hint.is-off { opacity: 0; }
.studio-panel { grid-row: 3; display: grid; gap: 10px; padding: 14px; border-radius: 24px; background: rgba(255, 252, 246, 0.86); backdrop-filter: blur(12px); box-shadow: 0 16px 40px rgba(29, 18, 13, 0.14); }
.studio-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 9px 14px; border: 1.5px solid var(--ink); border-radius: 999px; font-size: 14px; font-weight: 600; transition: background-color 180ms, color 180ms; }
.chip.is-active { background: var(--ink); color: var(--cream); }
.glaze { position: relative; width: 44px; height: 44px; border-radius: 50%; background: var(--swatch); box-shadow: inset 0 -6px 10px rgba(0, 0, 0, 0.25), inset 0 4px 6px rgba(255, 255, 255, 0.35); transition: transform 240ms var(--ease); }
.glaze.is-active { transform: scale(1.12); outline: 2px solid var(--ink); outline-offset: 2px; }
.studio-buy { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.studio-buy p { display: grid; gap: 0; line-height: 1.15; }
.studio-buy b { font: 800 26px/1 var(--title); letter-spacing: -0.02em; }
.studio-buy span { font-size: 13px; }
.fire { min-height: 54px; padding: 0 22px; border-radius: 999px; background: var(--clay); color: #fff8f0; font-weight: 700; transition: transform 160ms var(--ease), background-color 200ms; }
.fire:hover { background: #7c3414; }
.fire:active { transform: scale(0.97); }
.fire:disabled { opacity: 0.6; cursor: wait; }

/* After the story: opaque sections cover the 3D stage */
.after { position: relative; z-index: 3; background: var(--cream); border-radius: 32px 32px 0 0; }
.shop { padding: 64px var(--gutter); }
.shop-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 28px; }
.shop-card { display: grid; gap: 6px; }
.shop-card button { display: block; width: 100%; overflow: hidden; border-radius: 18px; background: #e4d8c6; }
.shop-card img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; transition: transform 700ms var(--ease); }
.shop-card button:hover img { transform: scale(1.05); }
.shop-card b { font: 400 22px/1.05 var(--serif); }
.shop-card span { font-size: 13px; color: #6a584d; }

.classes { padding: 40px var(--gutter) 72px; }
.class-list { margin-top: 28px; border-top: 1.5px solid var(--ink); }
.class-list li { display: grid; grid-template-columns: 58px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 16px 0; border-bottom: 1.5px solid var(--ink); }
.class-list b { font: 800 15px/1.1 var(--title); }
.class-list h3 { font: 400 25px/1.05 var(--serif); }
.class-list p { color: #6a584d; font-size: 13px; line-height: 1.3; }
.class-list button { min-height: 44px; padding: 0 14px; border: 1.5px solid var(--ink); border-radius: 999px; font-weight: 700; transition: background-color 180ms, color 180ms; }
.class-list button:hover { background: var(--ink); color: var(--cream); }

.pitch { display: grid; gap: 18px; justify-items: start; padding: 80px var(--gutter); background: var(--night); color: #f6e9dc; }
.pitch h2 { font-size: clamp(54px, 15vw, 150px); }
.pitch h2 em { color: #ff9c5f; }
.pitch-kicker { font-size: 13px; font-weight: 600; }
.pitch-text { max-width: 520px; font-size: 18px; line-height: 1.4; }
.pitch-cta { display: inline-flex; align-items: center; min-height: 58px; padding: 0 28px; border-radius: 999px; background: #ff9c5f; color: var(--night); font-weight: 700; font-size: 17px; text-decoration: none; transition: transform 180ms var(--ease); }
.pitch-cta:hover { transform: translateY(-2px); }
.pitch-sign { width: 170px; margin-top: 18px; }

.foot { position: relative; z-index: 3; display: grid; gap: 10px; padding: 20px var(--gutter); background: var(--cream); font-size: 14px; }
.foot nav { display: flex; flex-wrap: wrap; gap: 8px 16px; font-weight: 500; }
body > .consent-settings { position: relative; z-index: 3; }

.sheet { width: min(calc(100% - 28px), 460px); max-height: 92dvh; padding: 18px; border: 0; border-radius: 28px; background: var(--cream); color: var(--ink); }
.sheet::backdrop { background: rgba(18, 8, 6, 0.7); backdrop-filter: blur(4px); }
.sheet[open] { display: grid; gap: 12px; animation: pop 600ms var(--ease); }
.sheet img { width: 100%; max-height: 42dvh; object-fit: contain; border-radius: 18px; background: #e4d8c6; }
.sheet h2 { font-size: 46px; }
.sheet dl { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; margin: 0; }
.sheet dt { font-size: 12px; font-weight: 600; color: #6a584d; }
.sheet dd { font: 400 21px/1.1 var(--serif); }
.sheet-note { font-size: 13px; line-height: 1.35; color: #6a584d; }

@keyframes nudge { 50% { transform: translateY(5px); } }
@keyframes pop { from { transform: translateY(20px) scale(0.96); opacity: 0; } }

@media (min-width: 760px) {
  :root { --gutter: 40px; }
  .hero-title { top: 27svh; font-size: 14.6vw; }
  .chapter { display: grid; align-items: start; }
  .cap { top: 30svh; }
  .cap-b { justify-self: end; }
  .studio { grid-template-columns: 1fr 380px; grid-template-rows: auto 1fr; }
  .studio-head { grid-column: 1; }
  .studio-panel { grid-column: 2; grid-row: 2; align-self: end; }
  .shop-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
  .class-list li { grid-template-columns: 100px minmax(0, 1fr) auto; gap: 24px; }
  .foot { grid-template-columns: 1fr auto; }
}

@media (prefers-reduced-motion: reduce) { .loader { display: none; } }
