/* =========================================================
   Dallin's 21st — styles
   Fun & celebratory: bold gradient, bouncy headline,
   floating balloons, party accents. Mobile-first.
   ========================================================= */

:root {
  --c1: #2563eb;   /* royal blue (primary accent) */
  --c2: #0ea5e9;   /* sky blue   */
  --c3: #1e3a8a;   /* deep navy (titles)          */
  --c4: #22d3ee;   /* bright cyan */
  --gold: #ffd25a; /* premium gold accent         */
  --ink: #152238;  /* dark navy text              */
  --card-bg: rgba(255, 255, 255, 0.96);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  color: #fff;
  min-height: 100vh;
  overflow-x: hidden;
  /* Animated blue party gradient */
  background: linear-gradient(135deg, #0a1733, var(--c3), var(--c1), var(--c2));
  background-size: 400% 400%;
  animation: gradientShift 16s ease infinite;
}

@keyframes gradientShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Confetti canvas sits above the background, below content */
#confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
}

/* Content above confetti */
.page {
  position: relative;
  z-index: 10;
  max-width: 820px;
  margin: 0 auto;
  padding: 0 20px 60px;
  text-align: center;
}

/* ===================== HERO ===================== */
.hero {
  min-height: 92vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 40px 0;
}

.eyebrow {
  font-size: clamp(0.95rem, 3.5vw, 1.25rem);
  letter-spacing: 2px;
  text-transform: uppercase;
  font-weight: 700;
  opacity: 0;
  animation: fadeIn 0.8s ease 0.2s forwards;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

.headline {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
  font-weight: 900;
  text-shadow: 0 6px 24px rgba(0, 0, 0, 0.3);
}

.headline .line { display: block; }

.headline .line-1 { font-size: clamp(1.8rem, 9vw, 3.6rem); }
.headline .line-2,
.headline .line-3 {
  font-size: clamp(3rem, 19vw, 7.5rem);
  background: linear-gradient(180deg, #fff, var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 4px 14px rgba(0, 0, 0, 0.25));
}

/* Bouncy entrance, staggered per line */
.headline .line { opacity: 0; animation: popIn 0.7s cubic-bezier(0.17, 0.89, 0.32, 1.28) forwards; }
.headline .line-1 { animation-delay: 0.35s; }
.headline .line-2 { animation-delay: 0.55s; }
.headline .line-3 { animation-delay: 0.8s; }

@keyframes popIn {
  0%   { opacity: 0; transform: scale(0.3) translateY(30px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

.subhead {
  font-size: clamp(1rem, 4vw, 1.5rem);
  font-weight: 600;
  opacity: 0;
  animation: fadeIn 0.9s ease 1.1s forwards;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
  max-width: 28ch;
}

.headline .line-1 sup { font-size: 0.45em; vertical-align: super; }

.badge {
  display: inline-block;
  font-size: clamp(0.8rem, 3.2vw, 1rem);
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 8px 18px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.35);
  opacity: 0;
  animation: fadeIn 0.9s ease 1s forwards;
}

.big-age {
  font-size: clamp(7rem, 40vw, 16rem);
  font-weight: 900;
  line-height: 0.9;
  margin-top: 10px;
  background: linear-gradient(180deg, #fff, var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 40px rgba(255, 210, 90, 0.35));
  animation: pulse 2.4s ease-in-out infinite;
  user-select: none;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 0.85; }
  50%      { transform: scale(1.05); opacity: 1; }
}

/* ===================== PHOTO ===================== */
.photo-section { margin: 20px 0 50px; }

.photo-frame {
  width: clamp(180px, 55vw, 280px);
  height: clamp(180px, 55vw, 280px);
  margin: 0 auto 14px;
  border-radius: 50%;
  padding: 8px;
  background: linear-gradient(135deg, #fff, var(--gold));
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35);
  animation: floatCard 5s ease-in-out infinite;
}

.photo-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.photo-placeholder {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: none; /* shown via JS only if the image fails to load */
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--c3), var(--c1));
  font-size: clamp(4rem, 20vw, 7rem);
}

.photo-caption {
  font-weight: 600;
  font-size: clamp(0.9rem, 3.5vw, 1.1rem);
  opacity: 0.95;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

@keyframes floatCard {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-12px); }
}

/* ===================== SECTION HEADINGS ===================== */
.section-title {
  font-size: clamp(1.6rem, 7vw, 2.6rem);
  font-weight: 900;
  margin-bottom: 6px;
  text-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}
.section-sub {
  font-size: clamp(0.95rem, 3.6vw, 1.15rem);
  font-weight: 600;
  opacity: 0.95;
  margin-bottom: 26px;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

/* ===================== PHOTO TIMELINE ===================== */
.timeline-section { margin: 20px 0 54px; }

.timeline {
  display: grid;
  gap: 22px;
  grid-template-columns: 1fr;
}

.phase {
  background: var(--card-bg);
  color: var(--ink);
  border-radius: 20px;
  padding: 18px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.28);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
}

.phase-frame {
  position: relative;
  width: clamp(150px, 48vw, 200px);
  height: clamp(150px, 48vw, 200px);
  flex: none;
  border-radius: 18px;
  padding: 6px;
  background: linear-gradient(135deg, var(--c2), var(--c1));
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.25);
}

/* Crossfading slideshow inside each frame */
.slideshow {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 14px;
  overflow: hidden;
}
.slideshow .slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 1.4s ease-in-out;
}
.slideshow .slide.active { opacity: 1; }
/* Before JS takes over (or if JS is disabled), show the first slide */
.slideshow:not(.ready) .slide:first-of-type { opacity: 1; }

/* Blue tint so photos match the colour scheme */
.slideshow .tint {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(160deg,
    rgba(37, 99, 235, 0.38),
    rgba(14, 165, 233, 0.22) 55%,
    rgba(30, 58, 138, 0.42));
  mix-blend-mode: multiply;
}
.phase-ph {
  width: 100%;
  height: 100%;
  border-radius: 14px;
  display: none; /* shown via JS only if the image is missing */
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--c3), var(--c4));
  font-size: clamp(3rem, 14vw, 4.5rem);
}

.phase-label {
  font-weight: 800;
  font-size: clamp(1rem, 4vw, 1.2rem);
  color: var(--c3);
}
.phase-label span {
  display: inline-block;
  margin-left: 6px;
  font-size: 0.8em;
  font-weight: 700;
  color: #fff;
  background: var(--c1);
  padding: 2px 10px;
  border-radius: 999px;
  vertical-align: middle;
}
.phase-caption {
  font-size: clamp(0.92rem, 3.6vw, 1.05rem);
  line-height: 1.55;
  margin-top: 6px;
}

/* ===================== RIGHTS & RESPONSIBILITIES ===================== */
.rights-section { margin-bottom: 54px; }

.rights {
  display: grid;
  gap: 18px;
  grid-template-columns: 1fr;
  margin-top: 24px;
}
.right-card {
  background: var(--card-bg);
  color: var(--ink);
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.25);
  text-align: left;
}
.right-icon { font-size: 2.2rem; display: block; margin-bottom: 8px; }
.right-card h3 {
  font-size: clamp(1.1rem, 4.5vw, 1.35rem);
  color: var(--c3);
  margin-bottom: 6px;
}
.right-card p { font-size: clamp(0.92rem, 3.6vw, 1.05rem); line-height: 1.55; }

/* ===================== MESSAGE ===================== */
.message-section { margin-bottom: 50px; }

.card {
  background: var(--card-bg);
  color: var(--ink);
  border-radius: 24px;
  padding: clamp(24px, 6vw, 44px);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.3);
  text-align: left;
}

.card-title {
  text-align: center;
  font-size: clamp(1.4rem, 6vw, 2rem);
  margin-bottom: 18px;
  color: var(--c3);
}

.message {
  font-size: clamp(1rem, 4vw, 1.2rem);
  line-height: 1.7;
}

.signature {
  margin-top: 22px;
  font-size: clamp(1.05rem, 4.2vw, 1.3rem);
  text-align: right;
  color: var(--c1);
}

/* ===================== FOOTER ===================== */
.footer { display: flex; flex-direction: column; align-items: center; gap: 18px; }

.celebrate-btn {
  font-size: clamp(1rem, 4vw, 1.25rem);
  font-weight: 800;
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 16px 32px;
  cursor: pointer;
  background: linear-gradient(135deg, var(--c1), var(--c3));
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.celebrate-btn:hover  { transform: translateY(-3px) scale(1.03); box-shadow: 0 14px 36px rgba(0, 0, 0, 0.4); }
.celebrate-btn:active { transform: translateY(0) scale(0.98); }

.footer-note {
  font-size: clamp(0.95rem, 3.8vw, 1.2rem);
  font-weight: 600;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

/* ===================== BALLOONS ===================== */
.balloons {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
}

.balloon {
  position: absolute;
  bottom: -14vh;
  font-size: clamp(2.5rem, 9vw, 4rem);
  animation: floatUp linear infinite;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.2));
}

.balloon.b1 { left: 8%;  animation-duration: 13s; animation-delay: 0s;   }
.balloon.b2 { left: 28%; animation-duration: 17s; animation-delay: 3s;   }
.balloon.b3 { left: 50%; animation-duration: 11s; animation-delay: 1.5s; }
.balloon.b4 { left: 72%; animation-duration: 16s; animation-delay: 5s;   }
.balloon.b5 { left: 88%; animation-duration: 14s; animation-delay: 2.5s; }

@keyframes floatUp {
  0%   { transform: translateY(0) rotate(-6deg); }
  50%  { transform: translateY(-60vh) rotate(6deg); }
  100% { transform: translateY(-120vh) rotate(-6deg); }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===================== DESKTOP TWEAKS ===================== */
@media (min-width: 720px) {
  .page { max-width: 920px; padding-bottom: 80px; }
  .hero { gap: 24px; }

  /* Timeline: photo beside text, alternating sides */
  .phase {
    flex-direction: row;
    text-align: left;
    gap: 24px;
    padding: 22px;
  }
  .phase:nth-child(even) { flex-direction: row-reverse; }
  .phase .phase-body { flex: 1; }

  /* Rights: two columns */
  .rights { grid-template-columns: 1fr 1fr; }
}

/* ===================== REDUCED MOTION ===================== */
@media (prefers-reduced-motion: reduce) {
  body { animation: none; }
  .balloons { display: none; }
  .big-age, .photo-frame { animation: none; }
  .headline .line, .eyebrow, .subhead { opacity: 1; animation: none; }
}

/* =========================================================
   COMING SOON / COUNTDOWN
   ========================================================= */

/* Mode switching: one of these classes is set on <html>. */
#countdown { display: none; }
html.mode-countdown #countdown { display: flex; }
html.mode-countdown .page { display: none; }
html.mode-content  #countdown { display: none; }

#countdown {
  position: relative;
  z-index: 10;
  min-height: 100vh;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  text-align: center;
  padding: 48px 20px;
}

.cd-eyebrow {
  font-size: clamp(0.9rem, 3.6vw, 1.2rem);
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
  opacity: 0;
  animation: fadeIn 0.8s ease 0.1s forwards;
}

.cd-title {
  font-size: clamp(2.8rem, 15vw, 6.5rem);
  font-weight: 900;
  line-height: 1;
  background: linear-gradient(180deg, #fff, var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 4px 16px rgba(0, 0, 0, 0.3));
}

.cd-sub {
  font-size: clamp(1rem, 4vw, 1.4rem);
  font-weight: 600;
  max-width: 24ch;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

.cd-clock {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: clamp(8px, 2.5vw, 18px);
  margin-top: 8px;
}

.cd-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: clamp(74px, 22vw, 120px);
  padding: clamp(14px, 3.5vw, 22px) clamp(10px, 2.5vw, 18px);
  border-radius: 18px;
  background: var(--card-bg);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.3);
}

.cd-num {
  font-size: clamp(2.4rem, 12vw, 4.5rem);
  font-weight: 900;
  line-height: 1;
  color: var(--c3);
  font-variant-numeric: tabular-nums;
}

.cd-lbl {
  font-size: clamp(0.7rem, 2.8vw, 0.95rem);
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--c1);
}

.cd-sep {
  font-size: clamp(2rem, 10vw, 3.6rem);
  font-weight: 900;
  color: var(--gold);
  align-self: center;
  padding-bottom: 20px;
}

.cd-foot {
  font-size: clamp(0.95rem, 3.8vw, 1.2rem);
  font-weight: 600;
  margin-top: 10px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}
