/* Homepage only. Loads after base.css; section spacing comes from .band. */

/* ---------- Hero and the story: one hall, one sticky map ---------- */

.hero {
  --seat-face-cushion: #9DA2C6;
  --seat-resold-cushion: #B83F52;
  --light-x: 76%;
  --light-y: 30%;
  padding-top: clamp(1.5rem, 1rem + 3vw, 3.5rem);
  /* The sheet below reaches back into this room. */
  padding-bottom: calc(var(--band) + 1rem);
}
.story-grid {
  display: grid;
  gap: clamp(2rem, 1.5rem + 2vw, 3rem) clamp(2rem, 1rem + 4vw, 4.5rem);
  align-items: start;
}
.hero-copy { max-width: 36rem; }
.hero h1 { font-size: clamp(2.9rem, 1.4rem + 5vw, 4.5rem); line-height: 1.05; }
.hero .lede { color: var(--muted-dark); }
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.75rem;
  margin-top: 2rem;
}

.story-stage { position: relative; min-width: 0; }

/* Mobile: the map hangs at the top while the steps scroll beneath it. */
@media (max-width: 61.99rem) {
  .story-stage {
    position: sticky;
    top: 0;
    z-index: 5;
    margin-inline: calc(-1 * var(--gutter));
    padding: 0.5rem var(--gutter) 0.75rem;
    background: var(--house);
    border-bottom: 1px solid rgb(169 129 58 / 0.55);
  }
}

@media (min-width: 62rem) {
  .story-grid { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
  .hero-copy {
    grid-column: 1;
    grid-row: 1;
    align-self: center;
    min-height: min(34rem, calc(100vh - 12rem));
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
  .story-stage {
    grid-column: 2;
    grid-row: 1 / span 2;
    position: sticky;
    top: 5.75rem;
  }
  .story-steps { grid-column: 1; grid-row: 2; }
}

/* ---------- Seat map in perspective ---------- */

.seatmap { position: relative; }
.seatmap-view {
  position: relative;
  z-index: 1;
  display: flow-root;
  perspective: 950px;
  perspective-origin: 50% 100%;
}
/* The tilt lives on the div, not the svg: Chromium mis-hit-tests svg children under a 3D-transformed root.
   seatmap.js adds up to 3deg to --tilt-x / --tilt-y while the pointer moves. */
.seatmap-frame {
  --tilt-base: 40deg;
  margin-block: -24% 0.75rem;
  transform: rotateX(calc(var(--tilt-base) + var(--tilt-x, 0deg))) rotateY(var(--tilt-y, 0deg));
  transform-origin: 50% 100%;
}
.seatmap-frame svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: calc(100vh - 19rem);
}
@media (max-width: 61.99rem) {
  .seatmap-frame { --tilt-base: 24deg; margin-block: -6% 0.4rem; }
  .seatmap-frame svg { max-height: 23vh; }
}

.stage-line { fill: none; stroke: var(--brass-light); stroke-width: 3; stroke-linecap: round; }
.stage-label { font-family: var(--font-display); font-weight: 800; font-size: 20px; fill: var(--muted-dark); text-anchor: middle; }
.row-letter {
  font-family: var(--font-body);
  font-size: 12px;
  fill: var(--muted-dark);
  text-anchor: middle;
  dominant-baseline: central;
}

/* A chair seen from behind: a cushion further away, a taller and narrower backrest in front. */
.seat { cursor: default; }
.chair-hit { fill: transparent; stroke: none; pointer-events: all; }
.chair-seat, .chair-back { stroke-width: 1.2; pointer-events: all; }
.seat-face .chair-back { fill: var(--seat-face-dark); stroke: var(--seat-face-dark); }
.seat-face .chair-seat { fill: var(--seat-face-cushion); stroke: var(--seat-face-cushion); }
.seat-resold .chair-back { fill: var(--seat-resold-dark); stroke: var(--seat-resold-dark); }
.seat-resold .chair-seat { fill: var(--seat-resold-cushion); stroke: var(--seat-resold-cushion); }
.seat-open .chair-back, .seat-open .chair-seat { fill: none; stroke: var(--seat-open-dark); stroke-width: 1.6; }
.seat:hover .chair-back, .seat:hover .chair-seat { stroke: var(--haze); stroke-width: 2.4; }

.legend {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.5rem;
  margin-top: 0.5rem;
  font-size: 1rem;
  color: var(--haze);
}
.legend li { display: flex; align-items: center; gap: 0.5rem; }
.swatch { width: 0.9rem; height: 0.8rem; border-radius: 2px; border: 2px solid transparent; }
.swatch-face { background: var(--seat-face-dark); border-color: var(--seat-face-dark); }
.swatch-resold { background: var(--seat-resold-dark); border-color: var(--seat-resold-dark); }
.swatch-open { border-color: var(--seat-open-dark); }
.note { margin-top: 0.4rem; font-size: 0.95rem; color: var(--fg-muted); }

.tooltip {
  position: absolute;
  z-index: 3;
  left: 0; top: 0;
  padding: 0.45rem 0.7rem;
  background: var(--paper);
  color: var(--ink);
  font-size: 0.95rem;
  line-height: 1.35;
  border-radius: 2px;
  white-space: nowrap;
  pointer-events: none;
}
.tooltip[hidden] { display: none; }
.tooltip strong { display: block; font-weight: 600; }

/* ---------- Controls under the map ---------- */

.sim {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--seat-open-dark);
}
.sim-controls { display: grid; gap: 0.9rem; }
.sim-time { display: flex; align-items: flex-end; gap: 1.25rem; }
.sim-play { min-width: 5.5rem; flex: none; }
.sim-range { flex: 1; min-width: 0; }
.sim-range-head { display: flex; justify-content: space-between; gap: 1rem; font-weight: 600; }
.sim-range input[type="range"] {
  display: block;
  width: 100%;
  margin: 0.4rem 0 0.1rem;
  accent-color: var(--brass-light);
}
.sim-range-ends { display: flex; justify-content: space-between; gap: 1rem; font-size: 0.95rem; color: var(--muted-dark); }

.sim-mode { min-width: 0; margin: 0; padding: 0; border: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.sim-mode legend { width: 100%; padding: 0; margin-bottom: 0.2rem; font-weight: 600; }
.sim-mode label {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 2.75rem;
  padding: 0.3rem 1rem 0.3rem 0.8rem;
  border: 1.5px solid var(--seat-open-dark);
  border-radius: 2px;
  cursor: pointer;
}
.sim-mode input { margin: 0; accent-color: var(--brass-light); }
.sim-mode label:has(input:checked) { background: var(--haze); border-color: var(--haze); color: var(--house); }
.sim-mode label:has(input:checked) input { accent-color: var(--house); }
.sim-mode label:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 3px; }
.sim-mode input:focus-visible { outline: none; }

.sim-summary {
  min-height: 2.9em;
  margin-top: 0.9rem;
  font-size: var(--step-0);
  line-height: 1.4;
  font-weight: 600;
  text-wrap: pretty;
}

@media (max-width: 61.99rem) {
  .sim { margin-top: 0.5rem; padding-top: 0.6rem; }
  .sim-controls { gap: 0.5rem; }
  .sim-range-ends, .sim .note, .sim-time { display: none; }
  .sim-mode legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .sim-mode { flex-wrap: nowrap; gap: 0.4rem; }
  .sim-mode label { flex: 1 1 0; min-height: 2.5rem; padding: 0.2rem 0.5rem; font-size: 0.95rem; justify-content: center; text-align: center; line-height: 1.2; }
  .sim-play { min-width: 4.5rem; }
  .sim-summary { min-height: 2.6em; margin-top: 0.4rem; font-size: 0.95rem; line-height: 1.3; }
  .legend { font-size: 0.85rem; gap: 0.1rem 0.9rem; margin-top: 0.25rem; }
}

/* ---------- The story: steps in the left column ---------- */

.story-steps h2 { font-size: var(--step-3); }
.story-intro { margin-top: 1.25rem; max-width: 30rem; color: var(--muted-dark); }
.steps { margin-top: clamp(1.5rem, 4vw, 3rem); }
.step {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 62vh;
  padding-left: clamp(1.1rem, 3vw, 1.75rem);
  border-left: 2px solid var(--seat-open-dark);
}
.step h3 { font-size: clamp(1.9rem, 1.4rem + 1.8vw, 2.9rem); color: var(--muted-dark); }
.step p { max-width: 29rem; margin-top: 0.9rem; color: var(--muted-dark); }
.step.is-active { border-left-color: var(--brass-light); }
.step.is-active h3, .step.is-active p { color: var(--haze); }
@media (max-width: 61.99rem) {
  .step { min-height: 44vh; justify-content: flex-start; padding-top: 1.5rem; }
}

/* ---------- Load: the lights go down (the one orchestrated motion) ---------- */

@media (prefers-reduced-motion: no-preference) {
  .hero,
  .site-header[data-theme="dark"] { animation: house-down 0.9s ease-out both; }
  .hero { animation: house-down 0.9s ease-out both, lamp 1.4s ease-out 0.3s both; }
  .seat { animation: light 0.3s ease-out both; animation-delay: calc(0.45s + var(--row) * 0.085s); }
  .chair-seat, .chair-back { transition: fill 0.3s, stroke 0.3s; transition-delay: calc(var(--row) * 22ms); }
  .step h3, .step p { transition: color 0.3s; }
  .step { transition: border-color 0.3s; }
  .seatmap-frame { will-change: transform; }
}
@keyframes house-down { from { background-color: #2A3157; } }
@keyframes lamp { from { --light-a: 0; } }
@keyframes light { from { opacity: 0.08; } }

/* ---------- Two ways to get a price wrong: printed on one sheet ---------- */

.wrong-grid { display: grid; gap: clamp(2rem, 1.5rem + 2vw, 3rem); }
.wrong h2 { max-width: 12ch; }
.wrong .after { margin-top: 1.5rem; }
.wrong-sheet { margin-top: 0; }
.pair { display: grid; gap: 3rem; }
.pair-item p { margin-top: 0.75rem; max-width: 34rem; }
.chart { margin-top: 1.5rem; max-width: 30rem; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.chart .axis, .chart .tick { stroke: var(--muted); stroke-width: 1.25; }
.chart .line-face { stroke: var(--ink); stroke-width: 2.75; }
.chart .line-resold { stroke: var(--seat-resold); stroke-width: 2.75; }
.chart .line-sold { stroke: var(--velvet); stroke-width: 2.75; }
.chart .line-capacity { stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 5 5; }
.chart-text { font-family: var(--font-body); font-size: 14px; fill: var(--muted); }
.chart-text-ink { fill: var(--ink); font-weight: 600; }
.chart-text-resold { fill: var(--seat-resold); font-weight: 600; }
.chart-text-sold { fill: var(--velvet); font-weight: 600; }
.chart figcaption { margin-top: 0.25rem; }

@media (min-width: 48rem) {
  .pair { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2.5rem; }
}
@media (min-width: 62rem) {
  .wrong-grid { grid-template-columns: minmax(0, 3fr) minmax(0, 9fr); align-items: start; gap: clamp(2rem, 4vw, 4rem); }
  /* The sheet reaches back over the arc into the hall above. */
  .wrong-sheet { margin-top: calc(-1 * (var(--band) + var(--arc) + 2.5rem)); }
}

/* ---------- What we're working on ---------- */

.building { overflow-x: clip; }
.building .signage {
  top: calc(var(--arc) + 1.5rem);
  font-size: clamp(3.6rem, 11vw, 11rem);
}
.building h2 { max-width: 16ch; }
.intro { margin-top: 1.25rem; max-width: 34rem; }
.directions { margin-top: 3rem; }
.directions > div {
  display: grid;
  gap: 0.75rem 3rem;
  padding-block: clamp(1.5rem, 3vw, 2.5rem);
  border-top: 1px solid var(--empty);
}
.directions > div:last-child { border-bottom: 1px solid var(--empty); }
.directions dt { font-size: clamp(2.2rem, 1.4rem + 3.4vw, 4.25rem); line-height: 0.95; }
.directions dd { max-width: 24rem; }
@media (min-width: 48rem) {
  .directions > div { grid-template-columns: minmax(0, 7fr) minmax(0, 4fr); align-items: baseline; }
}

/* ---------- Doors to the hall ---------- */

.doors { display: grid; grid-template-columns: minmax(0, 26rem); gap: 3.5rem; justify-content: center; }
.door {
  position: relative;
  display: block;
  width: min(100%, 26rem);
  color: var(--haze);
  text-decoration: none;
}
/* The lit sign over the entrance. */
.door-sign {
  display: block;
  width: fit-content;
  margin: 0 auto 0.9rem;
  padding: 0.3rem 1.1rem 0.4rem;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.1;
  color: #FFE9BE;
  background: var(--house);
  border: 1px solid var(--brass);
  border-radius: 2px;
  text-shadow: 0 0 0.6rem rgb(246 215 154 / 0.75);
  box-shadow: 0 0 1.6rem -0.2rem rgb(217 178 106 / 0.45);
  transition: box-shadow 250ms ease-out;
}
.door-frame {
  position: relative;
  display: block;
  aspect-ratio: 4 / 5;
  border: 4px solid var(--brass);
  border-bottom-width: 6px;
  border-radius: 2px;
  perspective: 900px;
  transition: transform 150ms ease-out, box-shadow 250ms ease-out, border-color 250ms;
}
/* The light inside the hall, visible when the door opens. */
.door-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 90% at 50% 100%, #F6D79A, #C9923F 50%, #5A3E16);
  opacity: 0.8;
}
.door-leaf {
  position: absolute;
  inset: 0;
  background-color: var(--house);
  transform-origin: 0 50%;
  transition: transform 250ms ease-out;
}
/* Two leaves, each with a tall and a short recessed panel; the seam runs between them. */
.door-panels {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  padding: 0.9rem;
}
.door-panels i {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  padding-inline: 0.45rem;
}
.door-panels i::before, .door-panels i::after {
  content: "";
  border: 1px solid rgb(169 129 58 / 0.55);
  box-shadow: inset 0 0 0 4px rgb(255 255 255 / 0.025);
}
.door-panels i::before { flex: 3; }
.door-panels i::after { flex: 2; }
.door-panels i:first-child { border-right: 2px solid rgb(0 0 0 / 0.55); }
.door-panels i:last-child { border-left: 1px solid rgb(169 129 58 / 0.35); }
/* The nameplate on the leaves, so the words sit mid-door, clear of the seam. */
.door-body {
  position: absolute;
  left: 12%;
  right: 12%;
  top: 42%;
  transform: translateY(-50%);
  padding: 1.1rem 1.2rem 1.25rem;
  text-align: center;
  background: var(--house);
  border: 1px solid rgb(169 129 58 / 0.7);
}
.door-title {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 1.6rem + 2vw, 3.2rem);
  font-weight: 800;
  line-height: 0.95;
}
.door-text { display: block; margin-top: 0.7rem; color: var(--muted-dark); font-size: 1rem; line-height: 1.45; text-wrap: pretty; }
.door-handle {
  position: absolute;
  right: calc(50% + 0.7rem);
  top: 66%;
  width: 0.5rem;
  height: 5.5rem;
  border-radius: 0.25rem;
  background: linear-gradient(90deg, #8A6528, var(--brass-light) 45%, #FFE9BE 60%, #A9813A);
  box-shadow: 0 2px 4px rgb(0 0 0 / 0.6);
}
.door-handle-r { right: auto; left: calc(50% + 0.7rem); }
.door:hover .door-frame, .door:focus-visible .door-frame {
  transform: translateY(-2px);
  border-color: var(--brass-light);
  box-shadow: var(--raise), 0 0 3.5rem -0.5rem rgb(217 178 106 / 0.5);
}
.door:hover .door-sign, .door:focus-visible .door-sign { box-shadow: 0 0 2.4rem 0 rgb(217 178 106 / 0.7); }
.door:focus-visible { outline: 3px solid var(--focus); outline-offset: 8px; }
.door:hover .door-title, .door:focus-visible .door-title {
  text-decoration: underline;
  text-decoration-color: var(--brass-light);
  text-decoration-thickness: 3px;
  text-underline-offset: 0.12em;
}
@media (prefers-reduced-motion: no-preference) {
  .door:hover .door-leaf, .door:focus-visible .door-leaf { transform: rotateY(8deg); }
}
@media (min-width: 48rem) {
  .doors { grid-template-columns: repeat(2, minmax(0, 26rem)); gap: 5rem; }
}
@media (max-width: 30rem) {
  .door-frame { aspect-ratio: auto; min-height: 21rem; }
  .door-body { left: 8%; right: 8%; padding-inline: 0.9rem; }
}

/* ---------- The name ---------- */

.name-line {
  max-width: 40rem;
  font-size: var(--step-1);
  line-height: 1.5;
  text-wrap: pretty;
}

@media (max-width: 47.99rem) {
  .building .signage { top: auto; bottom: 0.5rem; }
}
