:root {
  color-scheme: dark;
  --ink: #040506;
  --ink-raised: #090b0e;
  --ink-soft: #101216;
  --ivory: #eee4d2;
  --ivory-dim: #a79e90;
  --champagne: #d2b577;
  --bronze: #8b6a3b;
  --line: rgba(220, 190, 128, 0.16);
  --line-strong: rgba(224, 190, 119, 0.34);
  --rail: clamp(1.25rem, 5.8vw, 5.4rem);
  --display: 'Velox Chronos Display', Georgia, serif;
  --sans: 'Inter', system-ui, sans-serif;
  --ease: cubic-bezier(.22, .74, .18, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html {
  background: var(--ink);
  scroll-behavior: auto;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  min-width: 300px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: var(--ink);
  color: var(--ivory);
  font-family: var(--sans);
  font-weight: 300;
}

button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }

::selection {
  color: #090603;
  background: var(--champagne);
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 0.8rem;
  left: 50%;
  translate: -50% -160%;
  padding: 0.7rem 1rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #11100e;
  color: var(--ivory);
  font-size: 0.72rem;
  text-decoration: none;
  transition: translate 180ms ease;
}

.skip-link:focus { translate: -50% 0; }

/* -------------------------------------------------------------------------- */
/* Immersive hall                                                             */
/* -------------------------------------------------------------------------- */

#lab {
  position: fixed;
  z-index: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  background: var(--ink);
}

#boot-veil { background: var(--ink) !important; }

#progressBar {
  position: fixed;
  z-index: 24;
  top: 0;
  left: 0;
  width: 100%;
  height: 1px;
  transform: scaleX(0);
  transform-origin: left;
  background: linear-gradient(90deg, transparent, var(--champagne));
  opacity: 0.62;
  pointer-events: none;
}

#grain {
  position: fixed;
  z-index: 21;
  inset: -36px;
  opacity: 0.022;
  pointer-events: none;
  mix-blend-mode: soft-light;
  animation: grain 1.1s steps(2) infinite;
}

@keyframes grain {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(13px, -9px, 0); }
}

body::before {
  content: '';
  position: fixed;
  z-index: 20;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, .26), transparent 18%, transparent 76%, rgba(0, 0, 0, .42)),
    radial-gradient(ellipse at center, transparent 42%, rgba(0, 0, 0, .24) 82%, rgba(0, 0, 0, .55) 100%);
}

.chrome {
  position: fixed;
  z-index: 30;
}

.topbar {
  top: 0;
  right: 0;
  left: 0;
  display: flex;
  align-items: center;
  padding: clamp(1.2rem, 3vw, 2rem) var(--rail);
  pointer-events: none;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.78rem;
  color: var(--ivory);
  pointer-events: auto;
  text-decoration: none;
}

.brand-mark {
  width: 24px;
  height: 24px;
  filter: saturate(.72) brightness(1.2);
}

.brand-word {
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  white-space: nowrap;
}

.brand-word b {
  color: var(--champagne);
  font-weight: 500;
}

.rail {
  top: 50%;
  right: clamp(0.9rem, 2.3vw, 2.35rem);
  display: grid;
  gap: 0.18rem;
  translate: 0 -50%;
}

.rail button {
  width: 52px;
  height: 25px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.6rem;
  padding: 0;
  border: 0;
  background: none;
  color: rgba(238, 228, 210, .34);
  cursor: pointer;
}

.rail-label {
  width: 1.7rem;
  overflow: hidden;
  opacity: 0;
  font-size: 0.52rem;
  font-weight: 500;
  letter-spacing: 0.24em;
  text-align: right;
  transition: opacity 260ms var(--ease), color 260ms var(--ease);
}

.rail-tick {
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: currentColor;
  transition: width 320ms var(--ease), background-color 320ms var(--ease), box-shadow 320ms var(--ease);
}

.rail button:hover .rail-label,
.rail button:focus-visible .rail-label,
.rail button[aria-current='true'] .rail-label { opacity: 1; }

.rail button[aria-current='true'] { color: var(--champagne); }
.rail button[aria-current='true'] .rail-tick {
  width: 20px;
  box-shadow: 0 0 18px rgba(226, 183, 103, .38);
}

.station {
  position: fixed;
  z-index: 26;
  pointer-events: none;
  transition: opacity 180ms linear;
}

.station--bottom {
  left: 50%;
  bottom: clamp(6.5rem, 13vh, 9rem);
  width: min(980px, calc(100vw - 12rem));
  translate: -50% 0;
}

.station--center {
  top: 50%;
  left: 50%;
  width: min(700px, calc(100vw - 12rem));
  translate: -50% -50%;
}

.doors {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(0.8rem, 2.2vw, 1.6rem);
  margin: 0;
  padding: 0;
  list-style: none;
}

.door {
  min-height: 54px;
  display: grid;
  place-items: center;
  padding: 1rem 1.2rem;
  border: 1px solid rgba(222, 188, 119, .18);
  border-radius: 999px;
  background: rgba(5, 6, 7, .72);
  box-shadow: 0 18px 45px rgba(0, 0, 0, .24);
  color: var(--ivory);
  font-size: 0.63rem;
  font-weight: 500;
  letter-spacing: 0.28em;
  text-align: center;
  text-decoration: none;
  text-transform: uppercase;
  pointer-events: auto;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: color 260ms var(--ease), border-color 260ms var(--ease), background 260ms var(--ease), translate 260ms var(--ease);
}

.door:hover,
.door:focus-visible {
  border-color: rgba(227, 192, 120, .44);
  background: rgba(16, 14, 10, .9);
  color: var(--champagne);
  translate: 0 -2px;
  outline: none;
}

.panel {
  max-height: min(82vh, 690px);
  overflow-y: auto;
  padding: clamp(1.4rem, 3vw, 2.2rem);
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(6, 8, 10, .93);
  box-shadow: 0 34px 110px rgba(0, 0, 0, .56), inset 0 1px 0 rgba(255, 255, 255, .025);
  pointer-events: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--bronze) transparent;
  backdrop-filter: blur(22px) saturate(.76);
  -webkit-backdrop-filter: blur(22px) saturate(.76);
}

.station-head {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.numeral,
.eyebrow {
  color: var(--champagne);
  font-size: 0.59rem;
  font-weight: 500;
  letter-spacing: 0.34em;
  text-transform: uppercase;
}

.station-head .numeral { color: var(--bronze); }

.intake {
  display: grid;
  gap: 0.82rem;
  margin-top: 1.1rem;
}

.field {
  display: grid;
  gap: 0.46rem;
}

.field > span {
  color: #aa9470;
  font-size: 0.57rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  line-height: 1.45;
  text-transform: uppercase;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.82rem;
}

.field input,
.field select {
  width: 100%;
  height: 46px;
  padding: 0 0.9rem;
  border: 1px solid rgba(220, 190, 128, .14);
  border-radius: 10px;
  outline: none;
  background: rgba(255, 255, 255, .026);
  color: var(--ivory);
  font-size: 0.85rem;
  font-weight: 300;
  transition: border-color 220ms ease, background 220ms ease, box-shadow 220ms ease;
}

.field select {
  appearance: none;
  padding-right: 2.5rem;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--bronze) 50%),
    linear-gradient(135deg, var(--bronze) 50%, transparent 50%);
  background-position: calc(100% - 17px) 20px, calc(100% - 12px) 20px;
  background-repeat: no-repeat;
  background-size: 5px 5px, 5px 5px;
}

.field input::placeholder { color: rgba(238, 228, 210, .27); }

.field input:focus,
.field select:focus {
  border-color: rgba(222, 186, 113, .52);
  background-color: rgba(255, 255, 255, .044);
  box-shadow: 0 0 0 3px rgba(210, 181, 119, .07);
}

.cta {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  padding: 0.78rem 1.3rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(12, 11, 9, .72);
  color: var(--champagne);
  cursor: pointer;
  font-size: 0.61rem;
  font-weight: 500;
  letter-spacing: 0.28em;
  text-decoration: none;
  text-transform: uppercase;
  transition: color 240ms var(--ease), background 240ms var(--ease), border-color 240ms var(--ease), translate 240ms var(--ease);
}

.cta svg { width: 16px; height: 16px; flex: 0 0 auto; }
.cta--wide { width: 100%; margin-top: 0.08rem; }
.cta:hover,
.cta:focus-visible {
  border-color: rgba(232, 202, 141, .64);
  background: var(--champagne);
  color: #0b0906;
  translate: 0 -1px;
  outline: none;
}
.cta:disabled { opacity: .44; cursor: wait; }

.form-note {
  margin: 0.9rem 0 0;
  color: rgba(220, 211, 195, .47);
  font-size: 0.66rem;
  line-height: 1.55;
}

.form-status {
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(210, 181, 119, .045);
  color: var(--ivory-dim);
  font-size: 0.76rem;
  line-height: 1.6;
}

.form-status strong { color: var(--ivory); font-weight: 500; }
.form-status code {
  display: block;
  margin-top: 0.7rem;
  padding: 0.8rem;
  overflow: auto;
  border-radius: 8px;
  background: rgba(0, 0, 0, .34);
  color: var(--ivory-dim);
  font: 0.68rem/1.55 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre-wrap;
}

.next {
  left: 50%;
  bottom: clamp(1.3rem, 3.8vh, 2.3rem);
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  translate: -50% 0;
  border: 1px solid rgba(220, 184, 108, .28);
  border-radius: 999px;
  background: rgba(6, 7, 8, .72);
  color: var(--champagne);
  cursor: pointer;
  box-shadow: 0 16px 38px rgba(0, 0, 0, .28);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: opacity 360ms ease, border-color 220ms ease, background 220ms ease, translate 220ms ease;
}

.next svg { width: 18px; height: 18px; }
.next:hover,
.next:focus-visible {
  border-color: rgba(226, 190, 119, .62);
  background: rgba(20, 16, 10, .9);
  translate: -50% 2px;
  outline: none;
}

html[data-at='intake'] .next { opacity: 0; pointer-events: none; }

.foot {
  position: fixed;
  z-index: 29;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.15rem var(--rail);
  border-top: 1px solid rgba(220, 190, 128, .1);
  background: rgba(4, 5, 6, .88);
  color: rgba(222, 213, 197, .46);
  font-size: 0.56rem;
  letter-spacing: 0.2em;
  opacity: 0;
  pointer-events: none;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  transition: opacity 360ms ease;
}

html[data-at='intake'] .foot { opacity: 1; pointer-events: auto; }

.foot nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 1.35rem;
}

.foot a {
  color: inherit;
  text-decoration: none;
  transition: color 180ms ease;
}
.foot a:hover,
.foot a:focus-visible { color: var(--champagne); outline: none; }

html.has-3d { scrollbar-width: none; }
html.has-3d::-webkit-scrollbar { display: none; }

/* -------------------------------------------------------------------------- */
/* Flat fallback and editorial pages                                          */
/* -------------------------------------------------------------------------- */

.no-3d #grain,
.no-3d #progressBar,
.no-3d .rail,
.no-3d .next { display: none; }

.no-3d #main {
  min-height: 100vh;
  padding: 8rem var(--rail) 7rem;
  background:
    radial-gradient(circle at 50% 24%, rgba(149, 101, 37, .14), transparent 30rem),
    var(--ink);
}

.no-3d .station {
  position: relative;
  inset: auto;
  width: min(760px, 100%);
  margin: 0 auto 4rem;
  translate: none;
  opacity: 1 !important;
  visibility: visible !important;
}

.no-3d .foot {
  position: relative;
  opacity: 1;
  pointer-events: auto;
}

.page-ambient {
  position: fixed;
  z-index: -1;
  inset: 0;
  background:
    radial-gradient(ellipse at 78% 12%, rgba(133, 91, 35, .1), transparent 32rem),
    radial-gradient(ellipse at 14% 84%, rgba(70, 86, 105, .08), transparent 34rem),
    var(--ink);
}

.page {
  width: min(1120px, calc(100% - var(--rail) * 2));
  min-height: calc(100vh - 76px);
  margin: 0 auto;
  padding: clamp(8.5rem, 17vh, 11rem) 0 clamp(5rem, 10vh, 7rem);
}

.page-header {
  max-width: 1020px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: clamp(2rem, 5vh, 3.8rem);
  color: rgba(228, 216, 196, .48);
  font-size: 0.58rem;
  font-weight: 500;
  letter-spacing: 0.28em;
  text-decoration: none;
  text-transform: uppercase;
  transition: color 180ms ease, translate 180ms ease;
}
.back-link:hover,
.back-link:focus-visible { color: var(--champagne); translate: -3px 0; outline: none; }

.page-header > .eyebrow {
  display: inline-block;
  margin-left: 1.15rem;
  padding-left: 1.15rem;
  border-left: 1px solid var(--line);
}

.display {
  margin: 1rem 0 clamp(2.7rem, 6vh, 4.5rem);
  color: var(--ivory);
  font-family: var(--display);
  font-size: clamp(3.4rem, 7.2vw, 7.1rem);
  font-weight: 400;
  letter-spacing: -0.035em;
  line-height: 0.94;
}

.block {
  width: min(720px, 100%);
  padding: clamp(2rem, 4.4vh, 3rem) 0;
  border-top: 1px solid var(--line);
  color: var(--ivory-dim);
  font-size: clamp(0.95rem, 1.4vw, 1.08rem);
  line-height: 1.78;
}

.block p { margin: 0 0 1rem; }
.block p:last-child { margin-bottom: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 0.8rem; margin-top: 1.6rem; }
.lede { color: var(--ivory-dim); line-height: 1.7; }

.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 680ms var(--ease), transform 680ms var(--ease);
}
.reveal.visible { opacity: 1; transform: none; }

.page + .foot {
  position: relative;
  opacity: 1;
  pointer-events: auto;
}

/* -------------------------------------------------------------------------- */
/* Responsive                                                                 */
/* -------------------------------------------------------------------------- */

@media (max-width: 820px) {
  :root { --rail: 1.15rem; }

  .topbar { padding-top: max(1.15rem, env(safe-area-inset-top)); }
  .brand-mark { width: 22px; height: 22px; }
  .brand-word { font-size: 0.58rem; letter-spacing: 0.27em; }

  .rail { right: 0.65rem; }
  .rail button { width: 30px; }
  .rail-label { display: none; }

  .station,
  .station--bottom,
  .station--center {
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    translate: none;
  }

  .station--bottom { bottom: 5.2rem; padding: 0 1rem; }
  .doors { grid-template-columns: 1fr; gap: 0.55rem; }
  .door { min-height: 45px; padding: 0.72rem 1rem; background: rgba(5, 6, 7, .84); }

  .station--center {
    height: 100svh;
    display: flex;
    align-items: flex-end;
    padding: max(5.4rem, env(safe-area-inset-top)) 0 max(4.8rem, env(safe-area-inset-bottom));
  }

  .panel {
    width: calc(100% - 1rem);
    max-height: calc(100svh - 9.8rem);
    margin: 0 auto;
    padding: 1.15rem;
    border-radius: 18px;
    background: rgba(6, 8, 10, .96);
  }

  .intake { gap: 0.7rem; margin-top: 0.9rem; }
  .field-row { grid-template-columns: 1fr; gap: 0.7rem; }
  .field input, .field select { height: 43px; font-size: 0.82rem; }
  .form-note { font-size: 0.6rem; }

  .next { bottom: max(1.05rem, env(safe-area-inset-bottom)); width: 44px; height: 44px; }

  .foot {
    padding: 0.9rem 1rem max(0.9rem, env(safe-area-inset-bottom));
  }
  .foot > span { display: none; }
  .foot nav { width: 100%; justify-content: center; gap: 1rem; }

  .page {
    width: calc(100% - 2.3rem);
    padding-top: 7.2rem;
  }
  .display { font-size: clamp(3rem, 16vw, 4.8rem); line-height: 0.98; }
  .page + .foot { justify-content: center; }
}

@media (max-height: 720px) and (min-width: 821px) {
  .station--center { width: min(660px, calc(100vw - 11rem)); }
  .panel { max-height: 84vh; padding: 1.25rem 1.55rem; }
  .intake { gap: 0.56rem; margin-top: 0.72rem; }
  .field input, .field select { height: 40px; }
  .form-note { margin-top: 0.6rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
  #grain { animation: none; }
}
