/* Aangan Studio — components. Every one is shown live in /kitchen-sink/.
   Components read semantic tokens only (tokens.css). The work pieces live in pieces.css. */

/* ---------- Logo ---------- */
.logo { display: block; width: var(--logo-w, 8.5rem); aspect-ratio: var(--logo-ratio); color: currentColor; }

/* ---------- Chapter marker: the rooms of the house, in Bangla numerals ---------- */
.chapter { display: inline-flex; align-items: center; gap: var(--space-4); color: var(--ink-soft); font-size: var(--step--1); letter-spacing: 0.04em; }
.chapter__num { font-size: 1.35rem; line-height: 1; color: var(--lamp-ink); font-weight: 400; }
.chapter::before { content: ""; order: 1; width: 2.5rem; height: 1px; background: var(--lamp-line); }
.chapter__name { order: 2; }

/* ---------- Buttons ---------- */
.btn {
  --btn-bg: transparent;
  --btn-ink: var(--ink);
  --btn-fill: var(--lamp);
  --btn-fill-ink: var(--on-lamp);
  position: relative; isolation: isolate;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 3.1rem;
  padding: 0.7rem 1.7rem 0.62rem;
  border-radius: var(--radius-touch);
  border: 1px solid transparent;
  background: var(--btn-bg); color: var(--btn-ink);
  font-weight: 500; font-size: var(--step-0); letter-spacing: 0.02em; line-height: 1.2;
  text-decoration: none; overflow: hidden;
  transition: color var(--dur-2) var(--ease-out), border-color var(--dur-2) var(--ease-out), transform var(--dur-2) var(--ease-out), box-shadow var(--dur-3) var(--ease-out);
}
/* Fill rises from the base, like lamplight filling a window. */
.btn::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: var(--btn-fill); border-radius: inherit;
  transform: translateY(101%);
  transition: transform var(--dur-3) var(--ease-out);
}
.btn svg { width: 1.1em; height: 1.1em; flex: none; }
.btn:active { transform: scale(0.98); }
.btn--primary { --btn-bg: var(--lamp); --btn-ink: var(--on-lamp); --btn-fill: var(--ink); --btn-fill-ink: var(--bg); }
.btn--ghost { border-color: var(--line-strong); }
@media (hover: hover) and (pointer: fine) {
  .btn:hover { color: var(--btn-fill-ink); border-color: var(--btn-fill); }
  .btn:hover::before { transform: translateY(0); }
  .btn--primary:hover { box-shadow: 0 0 2.5rem 0 var(--glow); }
}
.btn:focus-visible { color: var(--btn-fill-ink); }
.btn:focus-visible::before { transform: translateY(0); }

.btn-icon {
  display: inline-grid; place-items: center;
  width: 2.75rem; height: 2.75rem; border-radius: 50%;
  border: 1px solid var(--line-strong); color: var(--ink);
  transition: background-color var(--dur-2) var(--ease-out), color var(--dur-2) var(--ease-out), border-color var(--dur-2);
}
.btn-icon svg { width: 1.2rem; height: 1.2rem; }
@media (hover: hover) and (pointer: fine) { .btn-icon:hover { background: var(--ink); color: var(--bg); border-color: var(--ink); } }

.link {
  color: var(--link); text-decoration: none;
  background: linear-gradient(currentColor, currentColor) 0 100% / 100% 1px no-repeat;
  transition: background-size var(--dur-3) var(--ease-out), color var(--dur-2);
  padding-bottom: 0.15em;
}
@media (hover: hover) and (pointer: fine) { .link:hover { background-size: 0 1px; background-position: 100% 100%; color: var(--lamp-ink); } }

/* ---------- Theme switch ---------- */
.theme-toggle .i-sun, .theme-toggle .i-moon { grid-area: 1 / 1; transition: transform var(--dur-3) var(--ease-out), opacity var(--dur-2); }
.theme-toggle .i-moon { opacity: 0; transform: rotate(-60deg) scale(0.6); }
:root[data-scheme="dark"] .theme-toggle .i-sun { opacity: 0; transform: rotate(60deg) scale(0.6); }
:root[data-scheme="dark"] .theme-toggle .i-moon { opacity: 1; transform: none; }

/* ---------- Header ---------- */
.header { position: fixed; inset: 0 0 auto; z-index: 50; color: var(--ink); transition: transform var(--dur-3) var(--ease-out); }
.header::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: var(--bg); border-bottom: 1px solid var(--line);
  opacity: 0; transition: opacity var(--dur-2) var(--ease-out);
}
.header.is-solid::before { opacity: 0.96; }
.header.is-hidden { transform: translateY(-100%); }
.header.is-over-scene { --ink: var(--scene-ink); --line-strong: rgb(242 234 219 / 0.4); --lamp: var(--scene-lamp); --on-lamp: #1A1206; --bg: var(--scene-bg); --line: var(--scene-line); }
.header__bar { display: flex; align-items: center; gap: var(--space-5); min-height: 4.75rem; }
.header__brand { --logo-w: 7rem; color: inherit; margin-right: auto; padding-block: var(--space-2); }
.header__nav { display: none; }
.header__nav ul { display: flex; gap: var(--space-6); }
.header__nav a { text-decoration: none; font-size: 0.95rem; letter-spacing: 0.03em; position: relative; padding-block: var(--space-2); }
.header__nav a::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0.2rem; height: 1px; background: var(--lamp); transform: scaleX(0); transform-origin: right; transition: transform var(--dur-3) var(--ease-out); }
.header__nav a[aria-current="true"]::after { transform: scaleX(1); transform-origin: left; }
@media (hover: hover) and (pointer: fine) { .header__nav a:hover::after { transform: scaleX(1); transform-origin: left; } }
.header__actions { display: flex; align-items: center; gap: var(--space-3); }
.header__cta { display: none; }
@media (min-width: 64rem) {
  .header__nav { display: block; }
  .header__cta { display: inline-flex; min-height: 2.6rem; padding-block: 0.5rem 0.42rem; font-size: 0.95rem; }
  .header__menu-btn { display: none; }
}

/* ---------- Menu ---------- */
.menu {
  position: fixed; inset: 0; z-index: 60;
  display: grid; grid-template-rows: auto 1fr auto;
  padding: 0 var(--gutter) var(--space-6);
  visibility: hidden; opacity: 0;
  transition: opacity 0.6s var(--ease-out), visibility 0s linear 0.6s;
}
.menu.is-open { visibility: visible; opacity: 1; transition: opacity 0.6s var(--ease-out), visibility 0s; }
.menu__top { display: flex; align-items: center; justify-content: space-between; min-height: 4.75rem; }
.menu__top .logo { --logo-w: 7rem; }
.menu > nav { align-self: center; }
.menu__list { display: flex; flex-direction: column; gap: var(--space-2); }
.menu__link {
  display: inline-block; font-family: var(--font-display);
  font-size: clamp(2.4rem, 11vw, 4rem); line-height: 1.12; text-decoration: none;
  transform: translateY(1rem); opacity: 0;
  transition: transform 0.9s var(--ease-out), opacity 0.9s var(--ease-out), color var(--dur-2);
}
.menu.is-open .menu__link { transform: none; opacity: 1; transition-delay: calc(0.15s + var(--i, 0) * 0.07s); }
.menu__link:focus-visible, .menu__link:active { color: var(--lamp); }
.menu__foot { display: grid; gap: var(--space-2); color: var(--ink-soft); }
@media (prefers-reduced-motion: reduce) { .menu, .menu.is-open, .menu__link { transition: none; } .menu__link { transform: none; opacity: 1; } }

/* ---------- Hero: the courtyard at dusk ---------- */
/* --hero-pad and --hero-title set the title's place and size; the scene (hero-gl.js) and the stills' placement
   below keep the dome clear of the title with them. */
.hero {
  position: relative; height: 100svh; min-height: 34rem; overflow: hidden; isolation: isolate;
  --hero-pad: clamp(5.5rem, 11svh, 7.5rem); --hero-title: clamp(2.8rem, 0.9rem + 5.2vw, 6.4rem);
}
.hero__still, .hero__gl { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero__still img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 72%; }
/* Every still is baked larger than any screen it serves and without the vignette (tools/still.py): the opening
   one is the scene's own first frame, lamps not yet lit; the lit one (.is-lit, and reduced motion) stands in for
   the scene when there are no scripts or no WebGL. The block below places them with the shader's layout maths
   (hero-gl.js, resize) and draws the shader's vignette over them, both measured from the hero box as the canvas
   is, so the scene fades in over the opening still without a seam and the lamps light once. Browsers without
   container queries keep the cover framing above. */
.hero { container-type: size; }
/* Only a screen squarer than the portrait bake (wider than 0.78 per 1 tall) reaches past it: the scene's own
   sky and water colours meet it there. */
.hero__still { background: linear-gradient(#08193D 60%, #0E1830 75%); }
/* still:start (written by tools/still.py) */
.hero__still img {
  --s: min(max(100cqh / 947.37, 100cqw / 1440), max((74cqh - var(--hero-pad) - 2.14 * var(--hero-title)) / 320.22, 100cqw / 2181.82));
  position: absolute; max-width: none; object-fit: fill;
  width: calc(var(--s) * 2182); height: calc(var(--s) * 1081);
  left: calc(50cqw - var(--s) * 1091); top: calc(74cqh - var(--s) * 800);
}
@media (orientation: portrait) {
  .hero__still img {
    width: calc(100cqh * 940 / 1200); height: calc(100cqh * 1465 / 1200);
    left: calc(50cqw - 100cqh * 470 / 1200); top: calc(clamp(44cqh, var(--hero-pad) + 2.89 * var(--hero-title) + 22.24cqh, 66cqh) - 100cqh * 792 / 1200);
  }
}
.hero__still::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(111.11% 90.91% at 50% 50%, rgb(0 0 0 / 0.0) 0%, rgb(0 0 0 / 0.0023) 5%, rgb(0 0 0 / 0.009) 10%, rgb(0 0 0 / 0.0203) 15%, rgb(0 0 0 / 0.036) 20%, rgb(0 0 0 / 0.0563) 25%, rgb(0 0 0 / 0.081) 30%, rgb(0 0 0 / 0.1102) 35%, rgb(0 0 0 / 0.144) 40%, rgb(0 0 0 / 0.1823) 45%, rgb(0 0 0 / 0.225) 50%, rgb(0 0 0 / 0.2723) 55%, rgb(0 0 0 / 0.324) 60%, rgb(0 0 0 / 0.3803) 65%, rgb(0 0 0 / 0.441) 70%, rgb(0 0 0 / 0.5062) 75%);
}
/* still:end */
.hero__gl { opacity: 0; transition: opacity 1.6s var(--ease-out); touch-action: pan-y; }
.hero__gl.is-ready { opacity: 1; }
.hero__inner {
  position: relative; z-index: 1; height: 100%;
  display: grid; grid-template-rows: auto 1fr auto;
  padding-top: var(--hero-pad); padding-bottom: clamp(1.5rem, 4svh, 2.75rem);
  pointer-events: none;
}
.hero__inner a, .hero__inner button { pointer-events: auto; }
/* Rises and fades with every scroll frame over the canvas: its own layer, so the glowing title is drawn once. */
.js-motion .hero__inner { will-change: transform, opacity; }
.hero__title {
  text-align: center; max-width: 14ch; margin-inline: auto;
  font-size: var(--hero-title); line-height: 1.02;
  text-shadow: 0 0.12em 1.4em rgb(5 12 32 / 0.6);
}
.hero__foot { display: grid; gap: var(--space-5); align-items: end; }
.hero__lede { font-size: var(--step-1); line-height: 1.55; max-width: 32ch; color: var(--ink); text-shadow: 0 1px 1.2rem rgb(5 12 32 / 0.9); }
.hero__actions { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.hero__cue { display: none; justify-self: center; width: 1px; height: 3.5rem; background: var(--line); position: relative; overflow: hidden; }
/* Moved by transform, not `top`: an endless layout animation re-ran style, layout and paint every frame on every screen. */
.hero__cue::after { content: ""; position: absolute; left: 0; top: -40%; width: 1px; height: 40%; background: var(--lamp); animation: cue 2.6s var(--ease-in-out) infinite; }
@keyframes cue { to { transform: translateY(350%); } }   /* -40% to 100% of the track = 3.5 of its own heights */
@media (min-width: 56rem) {
  .hero__foot { grid-template-columns: 1fr auto 1fr; }
  .hero__cue { display: block; }
  .hero__actions { justify-self: end; }
}
@media (prefers-reduced-motion: reduce) { .hero__cue::after { animation: none; } }

/* ---------- Chapter 1: the courtyard ---------- */
.intro { display: grid; gap: var(--space-8); align-items: center; }
@media (min-width: 60rem) { .intro { grid-template-columns: 6fr 5fr; gap: var(--space-9); } }
.intro__text { display: grid; gap: var(--space-6); max-width: 36rem; }
.intro__text p { color: var(--ink-soft); font-size: var(--step-1); line-height: 1.7; }
.statement { font-family: var(--font-display); font-size: var(--step-3); line-height: 1.12; max-width: 18ch; }

/* ---------- Alpona: rice-paste art on the aangan floor, drawn from the middle outward ---------- */
/* Always the evening floor, in both themes: ivory paste on indigo, lamplight at the centre. */
.alpona { width: min(100%, 32rem); justify-self: center; margin: 0; }
.alpona__floor {
  position: relative; aspect-ratio: 1; overflow: hidden; border-radius: 0.5rem;
  background: radial-gradient(75% 75% at 50% 50%, #15306A, #0B1A40 62%, #081230);
  box-shadow: 0 2.5rem 5rem -2.5rem rgb(0 0 0 / 0.55);
}
.alpona__glow { position: absolute; left: 50%; top: 50%; width: 78%; aspect-ratio: 1; translate: -50% -50%; pointer-events: none; }
.alpona__glow::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(closest-side, rgb(255 204 126 / 0.36), rgb(217 165 74 / 0.12) 46%, transparent);
  animation: glow-breathe 5s ease-in-out infinite alternate;
}
@keyframes glow-breathe { from { opacity: 0.75; } to { opacity: 1; } }
.alpona__art { position: absolute; inset: 4%; width: 92%; height: 92%; overflow: visible; }
/* Its own layer, so drawing it never repaints the floor and glow under it */
.js-motion .alpona__art { will-change: transform; }
/* Widths in the drawing's units; never non-scaling-stroke (it breaks the pathLength dash). */
.alpona__art path { fill: none; stroke: #EEE4CF; stroke-width: 2.3; stroke-linecap: round; stroke-linejoin: round; }
.alpona__art .alpona__fill, .alpona__art .alpona__dot { fill: #EEE4CF; stroke: none; }
@media (prefers-reduced-motion: reduce) { .alpona__glow::before { animation: none; } }

/* ---------- Chapter 2: the crafts ---------- */
.crafts { display: grid; gap: var(--space-8); }
@media (min-width: 60rem) { .crafts { grid-template-columns: 5fr 7fr; gap: var(--space-9); align-items: start; } }
.crafts__aside { display: grid; gap: var(--space-6); }
@media (min-width: 60rem) { .crafts__aside { position: sticky; top: 14svh; } }
.crafts__window { position: relative; width: min(100%, 19rem); aspect-ratio: 3 / 4; display: none; }
@media (min-width: 60rem) { .crafts__window { display: block; } }
.crafts__window::before {
  content: ""; position: absolute; inset: 0;
  -webkit-mask: var(--arch) center / 100% 100% no-repeat; mask: var(--arch) center / 100% 100% no-repeat;
  background: radial-gradient(70% 55% at 50% 62%, var(--glow), transparent 75%), var(--surface);
}
.crafts__window svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
/* Each ornament draws on its own layer, so drawing it never redraws the masked window and text around it. */
.js-motion .crafts__window svg { will-change: transform; }
.pattern { color: var(--lamp); opacity: 0; transition: opacity 0.9s var(--ease-out); }
.pattern path, .pattern circle, .pattern line { fill: none; stroke: currentColor; stroke-width: 0.6; stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset 2.2s var(--ease-out); }
.pattern.is-on { opacity: 1; }
.pattern.is-on path, .pattern.is-on circle, .pattern.is-on line { stroke-dashoffset: 0; }
.crafts__outline { color: var(--lamp-line); }
.crafts__outline path { fill: none; stroke: currentColor; stroke-width: 1; vector-effect: non-scaling-stroke; }
.craft-list { border-top: 1px solid var(--line); }
.craft { display: grid; grid-template-columns: 1fr; gap: var(--space-2); padding-block: clamp(1.5rem, 1rem + 1.6vw, 2.6rem); border-bottom: 1px solid var(--line); transition: opacity var(--dur-3) var(--ease-out); }
.craft__name { font-family: var(--font-display); font-size: var(--step-3); line-height: 1.05; transition: color var(--dur-3) var(--ease-out); }
.craft__line { color: var(--ink-soft); max-width: 38ch; }
.craft__icon { display: none; width: 3.25rem; aspect-ratio: 3 / 4; position: relative; }
.craft__icon svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.js-motion .craft-list .craft { opacity: 0.38; }
.js-motion .craft-list .craft.is-on { opacity: 1; }
.craft.is-on .craft__name { color: var(--lamp-ink); }
@media (max-width: 59.99rem) {
  .craft { grid-template-columns: 1fr 3.25rem; column-gap: var(--space-5); align-items: center; }
  .craft__icon { display: block; grid-row: 1 / 3; grid-column: 2; }
  .craft__icon .pattern { opacity: 1; }
  .craft__icon .pattern * { stroke-width: 1; vector-effect: non-scaling-stroke; }
  .craft.is-seen .craft__icon .pattern *, html:not(.js-motion) .craft__icon .pattern * { stroke-dashoffset: 0; }
}

/* ---------- Chapter 3: the work, hung like an exhibition ---------- */
.work-head { display: grid; gap: var(--space-5); margin-bottom: var(--space-9); max-width: 46rem; }
.work-head p { color: var(--ink-soft); font-size: var(--step-1); line-height: 1.65; }
.case { display: grid; gap: var(--space-7); }
.case + .case { margin-top: var(--space-9); }
@media (min-width: 60rem) { .case { grid-template-columns: 4fr 8fr; gap: var(--space-9); align-items: start; } }
.case__aside { display: grid; gap: var(--space-5); align-content: start; }
@media (min-width: 60rem) { .case__aside { position: sticky; top: 16svh; } }
.case__no { color: var(--lamp-ink); font-size: var(--step--1); letter-spacing: 0.05em; }
.case__brief { color: var(--ink-soft); max-width: 34ch; }
.case__list { display: grid; border-top: 1px solid var(--line); }
.case__list li { display: flex; align-items: center; gap: var(--space-3); padding-block: var(--space-3); border-bottom: 1px solid var(--line); color: var(--ink-soft); transition: color var(--dur-3) var(--ease-out); }
.case__list li::before { content: ""; width: 0.45rem; height: 0.45rem; border-radius: 50%; border: 1px solid var(--lamp-line); transition: background-color var(--dur-3), box-shadow var(--dur-3); }
.case__list li.is-on { color: var(--ink); }
.case__list li.is-on::before { background: var(--lamp); border-color: var(--lamp); box-shadow: 0 0 0.9rem 0.2rem var(--glow); }
.case__pieces { display: grid; gap: var(--space-8); }
.piece { display: grid; gap: var(--space-4); }
/* Every piece hangs on the same lit wall: one light, one ground. */
.piece__stage {
  position: relative; isolation: isolate; display: grid; place-items: center;
  padding: clamp(2rem, 1rem + 4vw, 4.5rem) clamp(1.25rem, 0.5rem + 4vw, 4.5rem);
  overflow: hidden;
}
/* The lit ground is a layer of its own, drawn once: the stage's opening clip then only crops finished
   layers. Painted on the stage itself, the clip redrew this gradient every frame of every reveal. */
.piece__stage::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(60% 55% at 50% 45%, var(--glow), transparent 70%), var(--bg-alt);
}
.js-motion .piece__stage::before { will-change: transform; }
.piece__stage > .piece__art { width: 100%; }
.piece__cap { display: flex; justify-content: space-between; gap: var(--space-4); color: var(--ink-soft); font-size: var(--step--1); }
.piece__cap b { color: var(--ink); font-weight: 450; }
.piece__toggle {
  position: absolute; right: var(--space-4); bottom: var(--space-4); z-index: 3;
  display: inline-flex; align-items: center; gap: var(--space-2);
  min-height: 2.25rem; padding: 0.3rem 0.9rem;
  border-radius: var(--radius-touch); border: 1px solid var(--line-strong);
  color: var(--ink-soft); font-size: 0.8rem;
  opacity: 0; transition: opacity var(--dur-2);
}
.piece__toggle svg { width: 0.85rem; height: 0.85rem; }
.piece__toggle .i-play { display: none; }
.piece.is-paused .piece__toggle .i-play { display: block; }
.piece.is-paused .piece__toggle .i-pause { display: none; }
.piece__stage:hover .piece__toggle, .piece__toggle:focus-visible, .piece.is-paused .piece__toggle { opacity: 1; }
/* Touch: the button is always shown, so the stage makes room for it under the art. */
@media (hover: none) {
  .piece__toggle { opacity: 1; }
  .piece__stage { padding-bottom: calc(var(--space-4) * 2 + 2.25rem); }
}
.work-note { margin-top: var(--space-8); color: var(--ink-soft); font-size: var(--step--1); max-width: 60ch; }

/* ---------- Chapter 4: the house, drawn as a plan ---------- */
.house-head { display: grid; gap: var(--space-5); margin-bottom: var(--space-8); }
@media (min-width: 60rem) { .house-head { grid-template-columns: 6fr 5fr; align-items: end; gap: var(--space-9); } }
.house-head p { color: var(--ink-soft); font-size: var(--step-1); line-height: 1.65; }
.plan { width: 100%; height: auto; overflow: visible; color: var(--lamp); }
/* Widths in plan units, never non-scaling-stroke: that breaks the pathLength dash the walls draw with. */
.plan .wall { fill: none; stroke: var(--lamp-line); stroke-width: 1.2; }
.plan .wall--thin { stroke-width: 0.7; stroke: var(--line-strong); }
.plan .pool { fill: light-dark(rgb(14 42 94 / 0.08), rgb(40 80 160 / 0.28)); stroke: var(--lamp-line); stroke-width: 1; }
.plan .room { fill: transparent; transition: fill var(--dur-3) var(--ease-out); }
.plan .room-g:hover .room, .plan .room-g:focus-within .room { fill: var(--glow); }
.plan text { fill: var(--ink-soft); font-family: var(--font-body); font-size: 15px; text-anchor: middle; letter-spacing: 0.02em; }
.plan .label-wing { fill: var(--lamp-ink); font-size: 13px; letter-spacing: 0.08em; }
.plan .plan__logo { color: var(--ink); }
.plan .col { fill: var(--lamp-line); }
/* The plan carries the names; the lists are its source and stay for screen readers. */
.house-list { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; margin: 0; }
.house-list h3 { color: var(--lamp-ink); font-size: var(--step--1); letter-spacing: 0.05em; margin-bottom: var(--space-3); font-family: var(--font-body); }
.house-list ul { display: grid; gap: var(--space-1); color: var(--ink-soft); }
.plan--tall text { font-size: 17px; }
.plan--tall .label-wing { font-size: 13px; }
.plan--tall { max-width: 30rem; margin-inline: auto; }
.plan--tall .wall { stroke-width: 1.6; }
.plan--tall .pool { stroke-width: 1.4; }
.join { display: grid; gap: var(--space-5); align-items: center; margin-top: var(--space-9); padding-top: var(--space-7); border-top: 1px solid var(--line); }
@media (min-width: 56rem) { .join { grid-template-columns: 1fr auto; } }

/* ---------- Chapter 5: the arcade; a lamp lights for each step ---------- */
.arcade { position: relative; }
.arcade__stage { display: grid; gap: var(--space-8); padding-block: var(--space-9); align-content: center; }
.arcade__row { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-6) var(--space-4); }
@media (min-width: 56rem) { .arcade__row { grid-template-columns: repeat(6, 1fr); gap: var(--space-5); } }
.bay { display: grid; gap: var(--space-4); justify-items: center; text-align: center; }
.bay__arch { position: relative; width: 100%; max-width: 9.5rem; aspect-ratio: 2 / 3; }
.bay__arch::before {
  content: ""; position: absolute; inset: 0;
  -webkit-mask: var(--arch) center / 100% 100% no-repeat; mask: var(--arch) center / 100% 100% no-repeat;
  background: radial-gradient(60% 45% at 50% 55%, rgb(242 170 70 / 0.55), transparent 75%), var(--surface);
  opacity: 0.35;
  transition: opacity 1.2s var(--ease-out);
}
.bay__arch svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; color: var(--lamp-line); }
.bay__arch svg path { fill: none; stroke: currentColor; stroke-width: 1; vector-effect: non-scaling-stroke; }
.bay__flame {
  position: absolute; left: 50%; top: 46%; width: 14%; aspect-ratio: 1 / 1.6; translate: -50% -50%;
  border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%;
  background: radial-gradient(circle at 50% 70%, #FFF1C8, #F5B451 45%, rgb(232 120 40 / 0) 72%);
  box-shadow: 0 0 1.6rem 0.6rem rgb(242 170 70 / 0.45);
  opacity: 0; scale: 0.6;
  transition: opacity 1s var(--ease-out), scale 1.2s var(--ease-out);
}
.js-motion .bay.is-lit .bay__flame { opacity: 1; scale: 1; animation: flicker 3.2s ease-in-out infinite; }
.js-motion .bay.is-lit .bay__arch::before { opacity: 1; }
html:not(.js-motion) .bay__flame { opacity: 1; scale: 1; }
html:not(.js-motion) .bay__arch::before { opacity: 1; }
@keyframes flicker { 0%, 100% { transform: scale(1) rotate(-1deg); } 40% { transform: scale(1.06, 0.96) rotate(1.5deg); } 70% { transform: scale(0.97, 1.04) rotate(-0.5deg); } }
.bay__num { color: var(--lamp-ink); font-size: 1.1rem; line-height: 1; }
.bay__name { font-family: var(--font-display); font-size: var(--step-1); line-height: 1.2; }
.bay__text { color: var(--ink-soft); font-size: var(--step--1); max-width: 18ch; }
.js-motion .arcade { height: 260svh; }
.js-motion .arcade__stage { position: sticky; top: 0; min-height: 100svh; padding-block: var(--space-8); }
@media (prefers-reduced-motion: reduce) { .bay__flame { animation: none !important; } }

/* ---------- Chapter 6: a letter to the studio ---------- */
.letter-wrap { display: grid; gap: var(--space-8); }
@media (min-width: 60rem) { .letter-wrap { grid-template-columns: 4fr 7fr; gap: var(--space-9); align-items: start; } .letter-wrap__side { position: sticky; top: 14svh; } }
.letter-wrap__side { display: grid; gap: var(--space-6); }
.letter { padding: clamp(1.5rem, 0.8rem + 3.5vw, 4rem); background: var(--surface); border-top: 1px solid var(--lamp-line); }

/* ---------- Forms ---------- */
.form { display: grid; gap: var(--space-5); }
.form__row { display: grid; gap: var(--space-5); }
@media (min-width: 40rem) { .form__row { grid-template-columns: 1fr 1fr; } }
.field { display: grid; gap: var(--space-2); align-content: start; border: 0; padding: 0; min-width: 0; }
.field__label { font-weight: 450; }
.field__label .opt { color: var(--ink-soft); font-weight: 350; }
.field__hint { font-size: var(--step--1); color: var(--ink-soft); }
.field__error { font-size: var(--step--1); color: var(--danger); font-weight: 450; }
.field__error:empty { display: none; }
/* Fields are lines on paper, not boxes. */
.input, .textarea, .select {
  width: 100%; min-height: 3rem;
  padding: 0.6rem 0 0.5rem;
  border: 0; border-bottom: 1px solid var(--line-strong); border-radius: 0;
  background: transparent; color: var(--ink);
  transition: border-color var(--dur-2), box-shadow var(--dur-2);
}
.textarea { min-height: 7.5rem; resize: vertical; line-height: 1.6; }
.select {
  appearance: none; padding-right: 2rem;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 0.9rem) 55%, calc(100% - 0.5rem) 55%;
  background-size: 0.4rem 0.4rem; background-repeat: no-repeat;
}
/* The dropdown wears the theme: styled list where the browser allows it, themed colours everywhere else. */
.select option { background-color: var(--surface); color: var(--ink); }
@supports (appearance: base-select) {
  .select, .select::picker(select) { appearance: base-select; }
  .select { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); background-image: none; padding-right: 0.25rem; cursor: pointer; }
  .select::picker-icon { color: var(--lamp); transition: rotate var(--dur-2) var(--ease-out); }
  .select:open::picker-icon { rotate: 180deg; }
  .select::picker(select) {
    margin-block: 0.4rem; padding: 0.4rem; min-width: anchor-size(width);
    border: 1px solid var(--line-strong); border-radius: 0.6rem;
    background: var(--surface); color: var(--ink);
    box-shadow: 0 1.5rem 3rem -1rem rgb(0 0 0 / 0.45);
    opacity: 0; translate: 0 -0.4rem;
    transition: opacity 0.25s var(--ease-out), translate 0.35s var(--ease-out), overlay 0.35s allow-discrete, display 0.35s allow-discrete;
  }
  .select:open::picker(select) { opacity: 1; translate: 0 0; }
  @starting-style { .select:open::picker(select) { opacity: 0; translate: 0 -0.4rem; } }
  .select option { padding: 0.65rem 0.85rem; border-radius: 0.4rem; background: transparent; transition: background-color var(--dur-1), color var(--dur-1); }
  .select option:hover, .select option:focus-visible { background: var(--glow); color: var(--lamp-ink); outline: none; }
  .select option:checked { color: var(--lamp-ink); }
  .select option::checkmark { color: var(--lamp); }
}
.input:hover, .textarea:hover, .select:hover { border-color: var(--ink); }
.input:focus-visible, .textarea:focus-visible, .select:focus-visible { outline: none; border-color: var(--lamp); box-shadow: 0 1px 0 0 var(--lamp); }
.input[aria-invalid="true"], .textarea[aria-invalid="true"], .select[aria-invalid="true"] { border-color: var(--danger); }
/* Picker: pick several, or write your own (picker.js). A text field with a <datalist> becomes a line of chips
   over the same themed list as the dropdowns; the field keeps "a, b, c" for the form. A comma or Enter ends
   a need of the visitor's own. Without the script it is a plain field with suggestions. */
.picker { position: relative; }
.picker.is-enhanced > input { position: absolute; inset: 0; opacity: 0; pointer-events: none; }
.picker.is-enhanced > datalist { display: none; }
.picker__box { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); height: auto; padding-right: 2.5rem; cursor: text; }
.picker__chips { display: contents; }
.picker__box:focus-within { border-color: var(--lamp); box-shadow: 0 1px 0 0 var(--lamp); }
.picker[aria-invalid="true"] .picker__box { border-color: var(--danger); }
.picker__text { flex: 1 1 9rem; min-width: 7rem; min-height: 2.25rem; padding: 0; border: 0; outline: none; background: none; color: inherit; font: inherit; }
.picker__text::placeholder { color: var(--ink-soft); opacity: 1; }
.picker__toggle {
  position: absolute; right: 0; bottom: 0.4rem; display: grid; place-items: center; width: 2.25rem; height: 2.25rem;
  border: 0; background: none; color: var(--lamp); cursor: pointer;
}
.picker__toggle svg { width: 1.1rem; height: 1.1rem; transition: rotate var(--dur-2) var(--ease-out); }
.picker.is-open .picker__toggle svg { rotate: 180deg; }
/* A need that is picked: an ink pill, like a ticked choice, that settles in and shrinks away when removed. */
.picker__chip {
  display: inline-flex; align-items: center; gap: 0.1rem; max-width: 100%; min-height: 2.4rem; padding: 0 0.2rem 0 0.95rem;
  border-radius: var(--radius-touch); background: var(--ink); color: var(--bg); line-height: 1.2;
  animation: picker-chip-in var(--dur-2) var(--ease-out) both;
}
.picker__chip > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker__chip.is-leaving { animation: picker-chip-out var(--dur-1) ease forwards; pointer-events: none; }
@keyframes picker-chip-in { from { opacity: 0; transform: translateY(0.3rem) scale(0.9); } }
@keyframes picker-chip-out { to { opacity: 0; transform: scale(0.9); } }
.picker__remove {
  display: grid; place-items: center; flex: none; width: 2rem; height: 2rem; border: 0; border-radius: 50%;
  background: none; color: inherit; opacity: 0.7; cursor: pointer; transition: opacity var(--dur-1), background-color var(--dur-1);
}
.picker__remove svg { width: 0.8rem; height: 0.8rem; }
.picker__remove:focus-visible { opacity: 1; outline: 2px solid var(--focus); outline-offset: 1px; }
@media (hover: hover) and (pointer: fine) { .picker__remove:hover { opacity: 1; background: color-mix(in srgb, var(--bg) 18%, transparent); } }
/* The list: the dropdowns' own panel. */
.picker__list {
  position: absolute; left: 0; right: 0; top: calc(100% + 0.4rem); z-index: 40;
  max-height: min(20rem, 50vh); overflow-y: auto; overscroll-behavior: contain;
  margin: 0; padding: 0.4rem; list-style: none;
  border: 1px solid var(--line-strong); border-radius: 0.6rem;
  background: var(--surface); color: var(--ink); box-shadow: 0 1.5rem 3rem -1rem rgb(0 0 0 / 0.45);
  animation: picker-in 0.35s var(--ease-out);
}
.picker__list[hidden], .picker__list.is-empty { display: none; }
.picker__list.is-closing { animation: picker-out 0.17s ease forwards; pointer-events: none; }
.picker--up .picker__list { top: auto; bottom: calc(100% + 0.4rem); }
@keyframes picker-in { from { opacity: 0; transform: translateY(-0.4rem); } }
@keyframes picker-out { to { opacity: 0; transform: translateY(-0.3rem); } }
.picker__option {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  min-height: 2.75rem; padding: 0.55rem 0.85rem; border-radius: 0.4rem; cursor: pointer; user-select: none;
  transition: background-color var(--dur-1), color var(--dur-1);
}
.picker__option[hidden] { display: none; }
.picker__option.is-active { background: var(--glow); color: var(--lamp-ink); }
@media (hover: hover) and (pointer: fine) { .picker__option:hover { background: var(--glow); color: var(--lamp-ink); } }
.picker__option[aria-selected="true"] { color: var(--lamp-ink); }
.picker__option svg { flex: none; width: 1rem; height: 1rem; color: var(--lamp); opacity: 0; }
.picker__option[aria-selected="true"] svg { opacity: 1; }
.picker__add { justify-content: flex-start; }
.picker__add svg { order: -1; opacity: 1; }
@media (prefers-reduced-motion: reduce) {
  .picker__list, .picker__chip { animation: none !important; }
  .picker__toggle svg { transition: none; }
}
.form-status { display: grid; gap: var(--space-3); padding: var(--space-5); border-left: 2px solid var(--lamp); background: var(--surface); }
.form-status[hidden] { display: none; }

/* ---------- Contacts ---------- */
.contacts { display: grid; border-top: 1px solid var(--line); }
.contact { display: grid; grid-template-columns: 2.5rem 1fr; gap: var(--space-4); align-items: center; padding-block: var(--space-4); border-bottom: 1px solid var(--line); text-decoration: none; }
.contact__icon { display: grid; place-items: center; width: 2.5rem; height: 2.5rem; border-radius: 50%; border: 1px solid var(--lamp-line); color: var(--lamp-ink); transition: background-color var(--dur-2), color var(--dur-2); }
.contact__icon svg { width: 1.1rem; height: 1.1rem; }
.contact__label { display: block; font-size: var(--step--1); color: var(--ink-soft); }
.contact__value { display: block; font-size: clamp(1rem, 0.9rem + 0.5vw, 1.2rem); overflow-wrap: anywhere; line-height: 1.35; }
@media (hover: hover) and (pointer: fine) { .contact:hover .contact__icon { background: var(--lamp); color: var(--on-lamp); border-color: var(--lamp); } }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: var(--space-6); z-index: 80;
  display: flex; align-items: center; gap: var(--space-3);
  padding: 0.75rem 1.3rem 0.65rem; border-radius: var(--radius-touch);
  background: var(--ink); color: var(--bg);
  translate: -50% 150%; opacity: 0;
  transition: translate var(--dur-3) var(--ease-out), opacity var(--dur-2);
  pointer-events: none;
}
.toast svg { width: 1.1rem; height: 1.1rem; color: var(--lamp); }
.toast.is-shown { translate: -50% 0; opacity: 1; }

/* ---------- Cursor: a small ring of lamplight, for mouse users only ---------- */
.cursor { display: none; }
@media (hover: hover) and (pointer: fine) {
  .js-motion .cursor {
    display: grid; place-items: center;
    position: fixed; left: 0; top: 0; z-index: 95;
    width: 1.75rem; height: 1.75rem; margin: -0.875rem 0 0 -0.875rem;
    border-radius: 50%; border: 1px solid rgb(226 176 90 / 0.7);
    pointer-events: none;
    transition: width 0.5s var(--ease-out), height 0.5s var(--ease-out), margin 0.5s var(--ease-out), background-color 0.5s, opacity 0.4s;
  }
  .cursor span { font-size: 0.72rem; letter-spacing: 0.04em; color: #1A1206; opacity: 0; transition: opacity 0.3s; }
  .cursor.is-link { width: 2.75rem; height: 2.75rem; margin: -1.375rem 0 0 -1.375rem; background: rgb(226 176 90 / 0.14); }
  .cursor.is-label { width: 4.25rem; height: 4.25rem; margin: -2.125rem 0 0 -2.125rem; background: rgb(226 176 90 / 0.92); }
  .cursor.is-label span { opacity: 1; }
  .cursor.is-gone { opacity: 0; }
}

/* ---------- Footer ---------- */
.footer { padding-top: var(--space-9); padding-bottom: var(--space-6); overflow: hidden; }
.footer__grid { display: grid; gap: var(--space-7); }
@media (min-width: 56rem) { .footer__grid { grid-template-columns: 6fr 3fr 3fr; } }
.footer__title { max-width: 11ch; }
.footer__col { display: grid; gap: var(--space-3); align-content: start; }
.footer__col h2 { font-size: var(--step--1); color: var(--ink-soft); letter-spacing: 0.04em; }
.footer__col ul { display: grid; gap: var(--space-2); }
.footer__col a { text-decoration: none; }
@media (hover: hover) and (pointer: fine) { .footer__col a:hover { color: var(--lamp); } }
.footer__marks { position: relative; margin-top: var(--space-9); }
.footer__mark { --logo-w: 100%; color: var(--ink); }
/* Rises with every scroll frame: moved as a layer, never redrawn. */
.js-motion .footer__mark[data-mark-rise] { will-change: transform, opacity; }
/* The name, reflected in the courtyard pool. */
.footer__mark--water {
  transform: scaleY(-1); margin-top: -3%; opacity: 0.18;
  -webkit-mask: linear-gradient(to top, #000, transparent 70%); mask: linear-gradient(to top, #000, transparent 70%);
}
.footer__base {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-3) var(--space-5);
  margin-top: var(--space-5); padding-top: var(--space-5); border-top: 1px solid var(--line);
  color: var(--ink-soft); font-size: var(--step--1);
}
.footer__base button { text-decoration: underline; text-underline-offset: 0.2em; }
.footer__credit { font-size: 0.75rem; letter-spacing: 0.04em; opacity: 0.75; }
.footer__credit a { text-decoration: none; }
@media (hover: hover) and (pointer: fine) { .footer__credit a:hover { color: var(--lamp); } }
.footer__base button[hidden] { display: none; }
