:root {
  --bg: #0b1026;
  --bg-deep: #070b1c;
  --gold: #c8a96a;
  --cream: #f0e2c4;
  --star: #f5ead1;
  --line: #6b7bb5;
  --muted: #8f9bc4;
  --planet: #e8b962;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--cream);
  font-family: Georgia, "Times New Roman", serif;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}

body::before { /* faint starfield wash */
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(1200px 700px at 50% -10%, #182150 0%, transparent 70%),
    radial-gradient(900px 600px at 10% 110%, #131a3c 0%, transparent 70%);
  pointer-events: none;
}

button {
  font: inherit;
  color: var(--cream);
  background: transparent;
  border: 1px solid var(--gold);
  border-radius: 999px;
  padding: .55rem 1.1rem;
  cursor: pointer;
  transition: background .2s, opacity .2s;
}
button:hover { background: rgba(200, 169, 106, .14); }
button:disabled { opacity: .25; cursor: default; }

/* --- gate ---------------------------------------------------------- */

#gate {
  position: relative;
  min-height: 100dvh;
  display: grid;
  place-content: center;
  gap: 1rem;
  padding: 2rem;
  text-align: center;
  animation: fade-in 1.2s ease both;
}
#gate h1 {
  margin: 0;
  font-size: clamp(1.4rem, 6vw, 2.2rem);
  font-weight: 400;
  letter-spacing: .12em;
  color: var(--gold);
}
#gate .q { margin: 0 0 .5rem; font-size: clamp(1rem, 4.5vw, 1.25rem); }
#gate-form { display: flex; gap: .5rem; justify-content: center; flex-wrap: wrap; }
#answer {
  font: inherit;
  padding: .55rem .9rem;
  min-width: min(62vw, 16rem);
  color: var(--cream);
  background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(200, 169, 106, .45);
  border-radius: 999px;
  text-align: center;
}
#answer:focus { outline: none; border-color: var(--gold); }
#hint { min-height: 1.4em; margin: 0; color: var(--muted); font-size: .9rem; }
#gate.shake { animation: shake .4s; }

.fade-out { animation: fade-out .7s ease forwards; }

/* --- carousel ------------------------------------------------------ */

#app { animation: fade-in 1.4s ease both; }

#track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
#track::-webkit-scrollbar { display: none; }

.slide {
  flex: 0 0 100%;
  scroll-snap-align: center;
  min-height: 100dvh;
  display: grid;
  align-content: start;
  justify-items: center;
  gap: .75rem;
  padding: clamp(1rem, 4vw, 2rem) 1rem 6rem;
}

/* The projection is north-up, east-LEFT: this is the sky as you see it lying
   on your back looking up, which is mirrored from a map of the ground. */
.sky-wrap {
  position: relative;
  width: min(92vw, 34rem);
  padding: 1.15rem;
}

.sky {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, #0d1433 0%, var(--bg-deep) 75%);
  border: 1px solid rgba(200, 169, 106, .5);
  box-shadow: 0 0 60px rgba(90, 110, 200, .18) inset, 0 8px 40px rgba(0, 0, 0, .5);
  touch-action: pan-y;
}

.cp {
  position: absolute;
  font-size: .7rem;
  letter-spacing: .15em;
  color: var(--line);
  pointer-events: none;
}
.cp.n { top: 0; left: 50%; transform: translateX(-50%); }
.cp.s { bottom: 0; left: 50%; transform: translateX(-50%); }
.cp.e { left: .15rem; top: 50%; transform: translateY(-50%); }
.cp.w { right: .15rem; top: 50%; transform: translateY(-50%); }

.slider {
  width: min(84vw, 26rem);
  accent-color: var(--gold);
  margin: .25rem 0 0;
}
.offset { font-size: .78rem; color: var(--muted); letter-spacing: .1em; }

.label {
  margin: .75rem 0 0;
  font-size: clamp(1.3rem, 6vw, 2rem);
  font-weight: 400;
  letter-spacing: .06em;
  text-align: center;
}
.date { margin: 0; color: var(--gold); font-size: 1rem; }
.place { margin: 0; color: var(--muted); font-size: .9rem; }
.moon { margin: 0; color: var(--line); font-size: .78rem; letter-spacing: .08em; }

.caption {
  max-width: 32rem;
  margin: .6rem 0 0;
  text-align: center;
  line-height: 1.65;
  color: rgba(240, 226, 196, .88);
  font-size: clamp(.95rem, 3.8vw, 1.05rem);
}
.photo {
  width: min(80vw, 20rem);
  border-radius: .6rem;
  border: 1px solid rgba(200, 169, 106, .35);
  margin-top: .4rem;
}

/* finale */
.slide.finale .sky {
  border-color: var(--gold);
  box-shadow: 0 0 90px rgba(232, 185, 98, .25) inset, 0 0 60px rgba(232, 185, 98, .18);
}
.slide.finale.revealed .sky-wrap { animation: bloom 2.4s ease both; }
.slide.finale .label { color: var(--gold); }
.finale-msg {
  max-width: 30rem;
  text-align: center;
  line-height: 1.8;
  font-size: clamp(1rem, 4.2vw, 1.15rem);
  color: var(--gold);
  opacity: 0;
}
.slide.finale.revealed .finale-msg { animation: fade-in 2s ease 1.4s both; }

/* --- nav / audio --------------------------------------------------- */

#nav {
  position: fixed;
  left: 50%;
  bottom: max(1rem, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .4rem .6rem;
  background: rgba(7, 11, 28, .8);
  backdrop-filter: blur(8px);
  border-radius: 999px;
  border: 1px solid rgba(200, 169, 106, .25);
}
#nav button { padding: .35rem .8rem; border-color: rgba(200, 169, 106, .5); }
#dots { display: flex; gap: .5rem; }
#dots i {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: rgba(240, 226, 196, .3);
  transition: background .3s, transform .3s;
}
#dots i.on { background: var(--gold); transform: scale(1.35); }

#audio-btn {
  position: fixed;
  top: max(1rem, env(safe-area-inset-top));
  right: 1rem;
  width: 2.5rem; height: 2.5rem;
  padding: 0;
  line-height: 1;
  opacity: .55;
}
#audio-btn[aria-pressed="true"] { opacity: 1; background: rgba(200, 169, 106, .2); }

/* --- animations ---------------------------------------------------- */

@keyframes fade-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; } }
@keyframes fade-out { to { opacity: 0; visibility: hidden; } }
@keyframes shake {
  25% { transform: translateX(-7px); } 75% { transform: translateX(7px); }
}
@keyframes bloom {
  0% { transform: scale(.94); opacity: .3; filter: blur(6px); }
  100% { transform: scale(1); opacity: 1; filter: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; }
}
