:root {
  --bg: #100e0c;
  --bg-2: #181512;
  --ink: #f3eadf;
  --muted: #a3988c;
  --faint: #6f675e;
  --line: rgba(243, 234, 223, 0.14);
  --gold: #e4b56a;
  --gold-dim: rgba(228, 181, 106, 0.35);
  --void: #070605;
  --serif: "Fraunces", "Iowan Old Style", Palatino, "Palatino Linotype", serif;
  --sans: "Outfit", "Avenir Next", "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --nav: 4.25rem;
  --pad: clamp(1.25rem, 4vw, 4rem);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 300;
  font-size: 1.05rem;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
button, textarea, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  background: var(--ink);
  color: var(--bg);
  padding: 0.5rem 0.8rem;
  z-index: 50;
}
.skip:focus { top: 1rem; }

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.grain {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.18;
  mix-blend-mode: overlay;
  z-index: 40;
}

.nav {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  height: var(--nav);
  padding: 0 var(--pad);
  background: rgba(16, 14, 12, 0.78);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
.brand {
  font-family: var(--serif);
  text-decoration: none;
  letter-spacing: -0.03em;
  font-size: 1.15rem;
}
.nav nav { display: flex; gap: 1.25rem; }
.nav a {
  text-decoration: none;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.nav a:hover,
.nav a:focus-visible,
.nav a[aria-current="true"] { color: var(--ink); }

.hero, .section { padding: clamp(3rem, 8vw, 6.5rem) var(--pad); }
.hero { min-height: calc(100vh - var(--nav)); display: flex; flex-direction: column; justify-content: flex-end; }
.eyebrow, .index, .counter, .bookend-label, .lid-kicker, .film-index {
  font-family: var(--mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: var(--muted);
}
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(16rem, 0.6fr);
  gap: clamp(2rem, 6vw, 6rem);
  align-items: end;
}
.hero-kicker {
  margin: 0 0 0.4rem;
  color: var(--gold);
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(5.5rem, 16vw, 11rem);
  line-height: 0.82;
  letter-spacing: -0.045em;
}
.lede {
  max-width: 38rem;
  margin: 1.5rem 0 0;
  font-size: 1.2rem;
  color: var(--ink);
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem 1.5rem; margin-top: 2rem; }
.text-link {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  border-bottom: 1px solid var(--gold-dim);
  padding-bottom: 0.2rem;
}
.text-link:hover, .text-link:focus-visible { border-color: var(--gold); color: var(--gold); }

.bookends {
  display: grid;
  gap: 2rem;
  border-left: 1px solid var(--line);
  padding-left: 1.5rem;
}
.bookend-when {
  margin: 0.35rem 0 0;
  font-family: var(--serif);
  font-size: 1.8rem;
  letter-spacing: -0.03em;
}
.bookend-place, .bookend-city { margin: 0; }
.bookend-city { color: var(--muted); }

.section-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1rem 1.25rem;
  align-items: start;
  margin-bottom: 1.5rem;
}
.index, .counter { margin: 0.7rem 0 0; }
h2 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2.4rem, 5vw, 4rem);
  letter-spacing: -0.04em;
  line-height: 0.95;
}
.section-copy { margin: 0.55rem 0 0; max-width: 36rem; color: var(--muted); }
.section-head.light .section-copy { color: #c9bfb2; }

.stage-wrap { position: relative; }
.stage {
  position: relative;
  display: block;
  width: 100%;
  height: min(62vh, 640px);
  padding: 0;
  border: 0;
  background: #070605;
  overflow: hidden;
  text-align: left;
}
.stage::before, .stage::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1.35rem;
  z-index: 2;
  pointer-events: none;
  background: radial-gradient(circle at 50% 14px, #100e0c 4px, transparent 4.6px) 0 0 / 100% 28px repeat-y;
}
.stage::before { left: 0; }
.stage::after { right: 0; }
.stage:focus-visible { outline: 1px solid var(--gold); outline-offset: 3px; }
.stage-media, .frame-face, .lightbox-frame {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 80% at 20% 10%, rgba(228, 181, 106, 0.16), transparent 45%),
    radial-gradient(80% 70% at 90% 90%, rgba(90, 40, 20, 0.45), transparent 50%),
    linear-gradient(160deg, #1a1612, #0a0908 70%);
}
.stage-media img, .frame-face img, .lightbox-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.stage-meta {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 2.4rem;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.72));
  font-family: var(--serif);
  font-size: 1.35rem;
}
.latent-stage {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-left: 8%;
  gap: 0.2rem;
}
.latent-no {
  font-family: var(--serif);
  font-size: clamp(4rem, 8vw, 7rem);
  line-height: 0.85;
  letter-spacing: -0.05em;
}
.latent-word, .latent-city {
  font-family: var(--mono);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.75rem;
  color: var(--muted);
}
#stage-caption { color: var(--muted); font-family: var(--sans); font-size: 0.95rem; align-self: end; }
.stage-nav, .lightbox-nav {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.75rem;
}
.stage-nav { justify-content: space-between; align-items: center; }
.stage-moves { display: flex; gap: 0.5rem; }
.photo-status {
  min-height: 1.2em;
  margin: 0.7rem 0 0;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
}
.stage-nav button, .lightbox-nav button, .lightbox-close, .leg-switch button, .seal, .release {
  background: transparent;
  border: 1px solid var(--line);
  padding: 0.45rem 0.8rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.stage-nav button:hover, .lightbox-nav button:hover, .lightbox-close:hover, .leg-switch button:hover, .seal:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.film {
  display: flex;
  gap: 0.65rem;
  overflow-x: auto;
  padding: 1rem 0 0.4rem;
  scroll-snap-type: x mandatory;
  scrollbar-color: var(--gold-dim) transparent;
}
.film:focus-visible { outline: 1px solid var(--gold); }
.frame {
  flex: 0 0 clamp(8.5rem, 18vw, 12rem);
  scroll-snap-align: start;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
}
.frame-window {
  position: relative;
  display: block;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: #070605;
  outline: 1px solid transparent;
}
.frame[aria-current="true"] .frame-window { outline-color: var(--gold); }
.frame-face { position: absolute; }
.latent {
  position: absolute;
  inset: auto 0.6rem 0.55rem 0.6rem;
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(243, 234, 223, 0.72);
}
.frame figcaption, .frame-label {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.4rem;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.frame[aria-current="true"] .frame-label { color: var(--ink); }

html:not(.is-unlocked) { overflow: hidden; }
.gate {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  background: #000;
  padding: 1.5rem;
}
html.is-unlocked .gate { display: none; }
.gate-card {
  position: relative;
  width: min(100%, 22rem);
  padding: 1.6rem 1.5rem 1.35rem;
  background: #070707;
  border: 1px solid rgba(228, 181, 106, 0.45);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}
.gate-kicker {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
}
.gate-title {
  margin: 0.35rem 0 1.15rem;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 2.4rem;
  line-height: 0.95;
  letter-spacing: -0.03em;
}
.gate-label {
  display: block;
  margin: 0.75rem 0 0.3rem;
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.gate-card input {
  width: 100%;
  padding: 0.55rem 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  outline: none;
}
.gate-card input:focus { border-bottom-color: var(--gold); }
.gate-status {
  min-height: 1.2em;
  margin: 0.85rem 0 0;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
}
.gate-enter {
  margin-top: 0.85rem;
  background: transparent;
  border: 1px solid var(--line);
  padding: 0.5rem 0.9rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.gate-enter:hover { border-color: var(--gold); color: var(--gold); }
.gate-streak {
  position: absolute;
  left: 0;
  top: 46%;
  width: 100%;
  height: 2px;
  background: var(--gold);
  transform: scaleX(0);
  transform-origin: left center;
  pointer-events: none;
}
.gate.is-shaking .gate-card { animation: gate-shake 0.4s ease; }
.gate.is-swiping .gate-streak { animation: gate-streak 0.28s ease forwards; }
.gate.is-swiping .gate-card { animation: gate-swipe 0.62s cubic-bezier(0.7, 0, 0.2, 1) forwards; }
.gate.is-swiping { animation: gate-veil 0.45s ease 0.28s forwards; }
@keyframes gate-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-7px); }
  60% { transform: translateX(6px); }
}
@keyframes gate-streak {
  0% { transform: scaleX(0); opacity: 1; }
  70% { transform: scaleX(1); opacity: 1; }
  100% { transform: scaleX(1); opacity: 0; }
}
@keyframes gate-swipe {
  0% { transform: translateX(0) rotate(0deg); opacity: 1; }
  35% { transform: translateX(6%) rotate(1deg); }
  100% { transform: translateX(130%) rotate(7deg); opacity: 0; }
}
@keyframes gate-veil {
  to { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .gate.is-swiping .gate-card,
  .gate.is-swiping .gate-streak,
  .gate.is-swiping { animation: none; }
  .gate.is-swiping { opacity: 0; }
}
.frame-label span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leg-switch { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.leg-switch button[aria-pressed="true"] {
  border-color: var(--gold);
  color: var(--bg);
  background: var(--gold);
}

.route-layout {
  display: grid;
  grid-template-columns: minmax(16rem, 22rem) minmax(0, 1fr);
  gap: 1rem;
  min-height: 72vh;
}
.route-list-wrap {
  max-height: 72vh;
  overflow: auto;
  border-top: 1px solid var(--line);
  scrollbar-color: var(--gold-dim) transparent;
}
.route-list { list-style: none; margin: 0; padding: 0; }
.route-list button {
  width: 100%;
  display: grid;
  grid-template-columns: 4.4rem 1fr;
  gap: 0.15rem 0.85rem;
  padding: 0.75rem 0.7rem;
  text-align: left;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
}
.route-list button[aria-current="true"] { background: rgba(228, 181, 106, 0.08); }
.route-list .when { font-family: var(--mono); font-size: 0.72rem; color: var(--gold); line-height: 1.35; letter-spacing: 0.04em; text-transform: uppercase; }
.route-list .city { font-family: var(--serif); font-size: 1.25rem; letter-spacing: -0.03em; }
.route-list .venue { grid-column: 2; color: var(--muted); font-size: 0.88rem; }
.show-group {
  padding: 0.85rem 0.7rem 0.2rem;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--faint);
}

.map-wrap { position: relative; min-height: 72vh; background: #0b0a09; }
#map { position: absolute; inset: 0; background: #0b0a09; }
.map-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 2rem;
  text-align: center;
  color: var(--muted);
}
.leaflet-container { background: #0b0a09; font-family: var(--sans); }
.leaflet-tile-pane {
  filter: grayscale(1) invert(1) brightness(0.82) contrast(0.92) sepia(0.25);
}
.leaflet-control-attribution {
  background: rgba(16, 14, 12, 0.8) !important;
  color: var(--faint) !important;
  font-size: 10px !important;
}
.leaflet-control-attribution a { color: var(--muted) !important; }
.leaflet-bar a {
  background: #161310 !important;
  color: var(--ink) !important;
  border-bottom-color: var(--line) !important;
}
.pin-wrap { background: transparent !important; border: none !important; }
.pin {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1.5px solid var(--gold);
  background: #100e0c;
  box-shadow: 0 0 0 4px rgba(228, 181, 106, 0.12);
}
.pin.is-active {
  background: var(--gold);
  transform: scale(1.35);
}
.leaflet-popup-content-wrapper, .leaflet-popup-tip {
  background: #161310;
  color: var(--ink);
  border-radius: 0;
  box-shadow: none;
}
.leaflet-popup-content { margin: 0.85rem 1rem; }
.leaflet-popup-content strong {
  display: block;
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 500;
}
.leaflet-popup-content span { display: block; color: var(--muted); font-size: 0.88rem; }
.leaflet-popup-content em {
  display: block;
  margin-top: 0.35rem;
  font-family: var(--mono);
  font-style: normal;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
}
.route-line { filter: drop-shadow(0 0 2px rgba(228, 181, 106, 0.35)); }

.box-section {
  background:
    radial-gradient(ellipse at 50% 30%, rgba(228, 181, 106, 0.08), transparent 42%),
    #050403;
  min-height: 100vh;
}
.relic { max-width: 44rem; margin: 1rem auto 0; }
.relic-box {
  background: #070605;
  border: 1px solid rgba(228, 181, 106, 0.45);
  box-shadow:
    inset 0 1px 0 rgba(255, 236, 200, 0.16),
    0 30px 80px rgba(0, 0, 0, 0.45);
}
.relic-lid {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-start;
  gap: 0.35rem;
  width: 100%;
  min-height: 22rem;
  padding: 1.6rem;
  text-align: left;
  background:
    linear-gradient(180deg, rgba(255, 244, 220, 0.06), transparent 30%),
    linear-gradient(165deg, #16130f, #070605 62%);
  border: 0;
  transition: min-height 0.55s ease, opacity 0.35s ease, padding 0.55s ease;
}
.relic-lid::after {
  content: "";
  position: absolute;
  left: 10%;
  right: 10%;
  top: 46%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(242, 215, 162, 0.9), transparent);
  box-shadow: 0 0 16px rgba(242, 215, 162, 0.55);
}
.relic.is-open .relic-lid {
  min-height: 0;
  height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
  overflow: hidden;
  pointer-events: none;
}
.lid-title {
  font-family: var(--serif);
  font-size: clamp(3rem, 8vw, 5rem);
  line-height: 0.9;
  letter-spacing: -0.04em;
}
.lid-for { color: var(--muted); }
.lid-hint {
  margin-top: 1.2rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
}
.relic-cavity {
  display: flex;
  flex-direction: column;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  padding: 0 1.4rem;
  background:
    radial-gradient(80% 50% at 50% 0%, rgba(242, 215, 162, 0.08), transparent 55%),
    var(--void);
  transition: max-height 0.65s ease, opacity 0.45s ease, padding 0.65s ease;
}
.relic.is-open .relic-cavity {
  max-height: 40rem;
  opacity: 1;
  padding: 1.35rem 1.4rem 1.15rem;
}
.seam {
  height: 2px;
  margin: 0 0 1rem;
  background: linear-gradient(90deg, transparent, #f2d7a2, transparent);
  box-shadow: 0 0 18px rgba(242, 215, 162, 0.85);
}
.cavity-q {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.7rem, 3vw, 2.3rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
}
.cavity-note { margin: 0.7rem 0 0; color: var(--muted); font-size: 0.95rem; }
#wish-form { display: flex; flex-direction: column; flex: 1; margin-top: 0.8rem; }
textarea {
  width: 100%;
  flex: 1;
  min-height: 6.5rem;
  resize: none;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 0.4rem 0;
  outline: none;
}
textarea::placeholder { color: #5c554c; }
textarea:focus { border-bottom-color: var(--gold); }
.cavity-row, .cavity-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
}
.cavity-row { margin-top: 0.8rem; }
#wish-count { font-family: var(--mono); font-size: 0.72rem; color: var(--faint); }
.seal { border-color: var(--gold-dim); color: var(--gold); white-space: nowrap; }
.cavity-row { flex-wrap: wrap; }
.relic.is-shaking .relic-box { animation: shake 0.4s linear; }
@keyframes shake {
  20% { transform: translateX(-6px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(2px); }
}
.relic-status {
  min-height: 1.4rem;
  margin: 0.9rem 0 0;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
}
.plates { list-style: none; margin: 0.4rem 0 0; padding: 0; display: grid; gap: 0.6rem; }
.plate {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.8rem;
  align-items: start;
  padding: 0.9rem 1rem;
  background: linear-gradient(180deg, #1a1611, #0c0b09);
  border: 1px solid var(--gold-dim);
}
.plate-no { font-family: var(--mono); font-size: 0.72rem; color: var(--gold); }
.plate p { margin: 0; font-family: var(--serif); font-size: 1.25rem; font-style: italic; letter-spacing: -0.02em; }
.plate time { display: block; margin-top: 0.3rem; font-family: var(--mono); font-style: normal; font-size: 0.68rem; letter-spacing: 0.08em; color: var(--faint); }
.release { padding: 0.3rem 0.45rem; color: var(--faint); }

.lightbox {
  width: min(1100px, calc(100vw - 2rem));
  height: min(86vh, 820px);
  padding: 0;
  border: 1px solid var(--line);
  background: #070605;
  color: var(--ink);
}
.lightbox::backdrop { background: rgba(0, 0, 0, 0.82); }
.lightbox-frame { position: absolute; inset: 0 0 4.5rem; }
.lightbox-caption {
  position: absolute;
  left: 1rem;
  right: 8rem;
  bottom: 0.8rem;
}
.lightbox-caption p { margin: 0; }
#lightbox-place { font-family: var(--serif); font-size: 1.4rem; }
#lightbox-caption { color: var(--muted); }
.lightbox-close { position: absolute; top: 0.8rem; right: 0.8rem; z-index: 2; background: rgba(0, 0, 0, 0.45); }
.lightbox-nav { position: absolute; right: 0.8rem; bottom: 0.8rem; z-index: 2; }

.colophon {
  padding: 2rem var(--pad) 3rem;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

:focus-visible { outline: 1px solid var(--gold); outline-offset: 3px; }
::selection { background: var(--gold); color: var(--bg); }

@media (max-width: 860px) {
  .hero-grid, .section-head, .route-layout { grid-template-columns: 1fr; }
  .bookends { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); padding-top: 1.5rem; }
  .counter { justify-self: start; }
  .route-list-wrap, .map-wrap, #map { max-height: none; min-height: 0; }
  .route-list-wrap { max-height: 22rem; }
  .map-wrap { height: 68vh; }
  .nav nav { gap: 0.75rem; }
  .lightbox-caption { right: 1rem; bottom: 3.4rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .relic-lid, .relic-cavity, .relic.is-shaking .relic-box { transition: none; animation: none; }
}
