/* Corn Dog Day — 2001-style sunrise invitation */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --gold: #f2b950;
  --ease-epic: cubic-bezier(0.22, 1, 0.36, 1);
}

html, body {
  height: 100%;
  background: #000;
  color: #fff;
  font-family: "Futura", "Avenir Next", "Century Gothic", "Segoe UI", sans-serif;
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
}

#stage {
  position: fixed;
  inset: 0;
  height: 100dvh;
  overflow: hidden;
}

/* ---------- Starfield ---------- */
.stars {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 4s ease;
  background-image:
    radial-gradient(1px 1px at 12% 18%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 28% 64%, #dfe9ff 50%, transparent 51%),
    radial-gradient(1px 1px at 41% 32%, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 55% 12%, #ffe9c9 50%, transparent 51%),
    radial-gradient(1px 1px at 63% 48%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 74% 26%, #dfe9ff 50%, transparent 51%),
    radial-gradient(1px 1px at 86% 58%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 8% 44%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 34% 8%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 92% 14%, #ffe9c9 50%, transparent 51%),
    radial-gradient(1px 1px at 48% 72%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 18% 78%, #dfe9ff 50%, transparent 51%);
}
.phase-sunrise .stars { opacity: 0.9; }

/* ---------- Planet horizon & sun ---------- */
.horizon {
  position: absolute;
  left: -25vw;
  bottom: -22vh;
  width: 150vw;
  height: 40vh;
  border-radius: 50% 50% 0 0 / 100% 100% 0 0;
  background: radial-gradient(ellipse at 50% 0%, #1a1206 0%, #05030a 60%);
  box-shadow: 0 -2px 18px rgba(242, 185, 80, 0.25);
  z-index: 2;
}

.sun {
  position: absolute;
  left: 50%;
  bottom: 6vh;
  width: 34vmin;
  height: 34vmin;
  border-radius: 50%;
  background: radial-gradient(circle, #fff6d8 0%, #ffd766 35%, #f29b2a 70%, transparent 72%);
  filter: blur(2px);
  transform: translate(-50%, 60vmin);
  transition: transform 26s var(--ease-epic), filter 8s ease;
  z-index: 1;
}
.phase-sunrise .sun { transform: translate(-50%, 26vmin); }
.phase-climax .sun {
  transform: translate(-50%, -4vmin) scale(1.35);
  filter: blur(0);
  transition-duration: 8s;
}

/* ---------- God rays ---------- */
.rays {
  position: absolute;
  left: 50%;
  top: 46%;
  width: 200vmax;
  height: 200vmax;
  transform: translate(-50%, -50%);
  background: repeating-conic-gradient(
    from 0deg,
    rgba(255, 226, 150, 0.16) 0deg 6deg,
    transparent 6deg 18deg
  );
  -webkit-mask-image: radial-gradient(circle, #000 0%, transparent 55%);
  mask-image: radial-gradient(circle, #000 0%, transparent 55%);
  opacity: 0;
  transition: opacity 5s ease;
  animation: spin 90s linear infinite;
  animation-play-state: paused;
  z-index: 3;
  pointer-events: none;
}
.phase-climax .rays { opacity: 1; animation-play-state: running; }

@keyframes spin { to { transform: translate(-50%, -50%) rotate(360deg); } }

/* ---------- Foods ---------- */
.food-layer { position: absolute; inset: 0; z-index: 4; }

.food {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: calc(16vmin * var(--s, 1));
  height: auto;
  opacity: 0;
  transform: translateY(45vh) rotate(var(--rot, 0deg)) scale(0.6);
  filter: drop-shadow(0 0 6px rgba(0, 0, 0, 0.6));
}

/* entrance: rise from beyond the horizon like a celestial body */
.phase-tots .tots .food,
.phase-mozz .mozz-sticks .food,
.phase-oreos .oreos .food {
  animation: ascend 5s var(--ease-epic) var(--d, 0s) forwards,
             drift 7s ease-in-out calc(var(--d, 0s) + 5s) infinite alternate;
}

@keyframes ascend {
  to { opacity: 1; transform: translateY(0) rotate(var(--rot, 0deg)) scale(1); }
}
@keyframes drift {
  from { translate: 0 0; }
  to   { translate: 0 -2.5vh; }
}

/* climax: converge into a halo around the corn dog (id beats entrance-rule specificity) */
#stage.phase-climax .food {
  animation: none;
  opacity: 1;
  left: 50%;
  top: 44%;
  transform: translate(calc(var(--hx) - 50%), calc(var(--hy) - 50%))
             rotate(var(--rot, 0deg)) scale(0.85);
  transition: left 3s var(--ease-epic), top 3s var(--ease-epic), transform 3s var(--ease-epic),
              filter 3s ease;
  filter: drop-shadow(0 0 14px rgba(255, 224, 140, 0.9));
}

/* ---------- Monolith corn dog ---------- */
.monolith {
  position: absolute;
  left: 50%;
  top: 44%;
  width: 22vmin;
  height: auto;
  transform: translate(-50%, 90vh) scale(0.7);
  opacity: 0;
  transition: transform 6s var(--ease-epic), opacity 2s ease, filter 4s ease;
  z-index: 5;
}
.phase-climax .monolith {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  filter: drop-shadow(0 0 30px rgba(255, 230, 160, 0.95))
          drop-shadow(0 0 80px rgba(255, 200, 90, 0.6));
}

/* ---------- Menu ticker ---------- */
#menu {
  position: absolute;
  left: 0;
  right: 0;
  bottom: max(2.5vh, env(safe-area-inset-bottom));
  max-width: min(78vw, 42rem);
  margin-inline: auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35em 0.9em;
  list-style: none;
  z-index: 6;
  pointer-events: none;
  font-size: clamp(0.7rem, 2.6vw, 1rem);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  text-shadow: 0 0 10px rgba(242, 185, 80, 0.5);
}
#menu li { animation: menu-slide 1.2s var(--ease-epic) both; white-space: nowrap; }
#menu li + li::before { content: "\00b7"; padding-right: 0.7em; opacity: 0.6; }
@keyframes menu-slide {
  from { opacity: 0; transform: translateX(-70vw); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ---------- Bloom flash ---------- */
.bloom {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 44%, rgba(255, 250, 235, 0.95), rgba(255, 240, 200, 0.35) 45%, transparent 75%);
  opacity: 0;
  z-index: 6;
  pointer-events: none;
  transition: opacity 2.5s ease;
}
.phase-bloom .bloom { opacity: 1; }
.phase-finale .bloom { opacity: 0; transition-duration: 4s; }

/* ---------- Finale: title + invite ---------- */
.finale {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4vh;
  text-align: center;
  padding: 6vw;
  z-index: 7;
  opacity: 0;
  visibility: hidden;
  transition: opacity 3s ease;
  background: radial-gradient(circle at 50% 110%, rgba(60, 40, 8, 0.75), rgba(0, 0, 0, 0.85) 70%);
}
.phase-finale .finale { opacity: 1; visibility: visible; }

.title {
  font-size: clamp(2.6rem, 12vw, 6rem);
  font-weight: 700;
  letter-spacing: 0.28em;
  margin-right: -0.28em; /* optically recenter tracked text */
  line-height: 1.15;
  color: var(--gold);
  text-shadow: 0 0 24px rgba(242, 185, 80, 0.55);
}

.invite { display: grid; gap: 1.1rem; font-size: clamp(1rem, 4.4vw, 1.4rem); letter-spacing: 0.08em; }
.tagline { opacity: 0.75; font-style: italic; }
.when { font-size: clamp(1.3rem, 6vw, 2rem); font-weight: 700; color: #fff; }
.where, .rsvp { opacity: 0.85; }

#replay {
  margin-top: 1.5rem;
  justify-self: center;
}

.credit { font-size: 0.65rem; opacity: 0.45; letter-spacing: 0.05em; margin-top: 1rem; line-height: 1.6; }
.credit a { color: inherit; }

/* ---------- Overlay & buttons ---------- */
#overlay {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5vh;
  background: #000;
  z-index: 10;
  transition: opacity 1.5s ease;
}
#overlay.hidden { opacity: 0; pointer-events: none; }

.overlay-title {
  font-size: clamp(1.4rem, 7vw, 2.4rem);
  letter-spacing: 0.4em;
  margin-right: -0.4em;
  color: var(--gold);
  opacity: 0.85;
}

button {
  font: inherit;
  letter-spacing: 0.12em;
  color: #fff;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 999px;
  padding: 0.9em 2.2em;
  min-height: 48px;
  cursor: pointer;
  transition: background 0.3s, color 0.3s;
}
button:hover, button:focus-visible { background: var(--gold); color: #000; border-color: var(--gold); }

.hint { font-size: 0.85rem; opacity: 0.5; letter-spacing: 0.15em; }

#skip {
  position: fixed;
  right: max(3vw, env(safe-area-inset-right));
  bottom: max(3vh, env(safe-area-inset-bottom));
  z-index: 9;
  font-size: 0.8rem;
  padding: 0.6em 1.2em;
  opacity: 0.6;
  border-color: rgba(255, 255, 255, 0.3);
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .sun, .rays, .food, .monolith, .bloom, #menu li { animation: none !important; transition: none !important; }
}
