/* ===========================================================
   Happy Birthday Joel! — joelnapalan.com
   Core styles (hero, cake, balloons, buttons, finale, footer)
   =========================================================== */

:root {
  --pink: #ff5e7e;
  --rose: #ff8fab;
  --gold: #ffd166;
  --mint: #06d6a0;
  --sky: #4cc9f0;
  --violet: #b388ff;
  --grape: #9b5de5;
  --ink: #20123a;
  --font: "Trebuchet MS", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: #fff;
  text-align: center;
  overflow-x: hidden;
  background: linear-gradient(125deg, #1b1035, #3a0ca3, #7209b7, #f72585, #4361ee);
  background-size: 320% 320%;
  animation: bgshift 20s ease infinite;
}

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

/* Confetti canvas sits above everything but never blocks clicks */
#confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
}

/* ---------- Floating balloons ---------- */
.balloons {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.balloon {
  position: absolute;
  bottom: -200px;
  width: 64px;
  height: 80px;
  border-radius: 50% 50% 48% 48%;
  opacity: 0.85;
  filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.25));
  animation: float-up linear infinite;
}
.balloon::before { /* the knot */
  content: "";
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 8px solid currentColor;
}
.balloon::after { /* the string */
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  width: 1px;
  height: 90px;
  background: rgba(255, 255, 255, 0.45);
  transform: translateX(-50%);
}
.balloon:nth-child(1) { left: 6%;  color: var(--pink);   background: radial-gradient(circle at 35% 30%, #fff7, var(--pink));   animation-duration: 17s; animation-delay: 0s; }
.balloon:nth-child(2) { left: 20%; color: var(--gold);   background: radial-gradient(circle at 35% 30%, #fff7, var(--gold));   animation-duration: 21s; animation-delay: 3s;  width: 52px; height: 66px; }
.balloon:nth-child(3) { left: 34%; color: var(--mint);   background: radial-gradient(circle at 35% 30%, #fff7, var(--mint));   animation-duration: 19s; animation-delay: 6s; }
.balloon:nth-child(4) { left: 49%; color: var(--sky);    background: radial-gradient(circle at 35% 30%, #fff7, var(--sky));    animation-duration: 23s; animation-delay: 1.5s; width: 70px; height: 88px; }
.balloon:nth-child(5) { left: 63%; color: var(--violet); background: radial-gradient(circle at 35% 30%, #fff7, var(--violet)); animation-duration: 18s; animation-delay: 4.5s; }
.balloon:nth-child(6) { left: 76%; color: var(--rose);   background: radial-gradient(circle at 35% 30%, #fff7, var(--rose));   animation-duration: 22s; animation-delay: 7.5s; width: 56px; height: 70px; }
.balloon:nth-child(7) { left: 88%; color: var(--grape);  background: radial-gradient(circle at 35% 30%, #fff7, var(--grape));  animation-duration: 20s; animation-delay: 2.5s; }
.balloon:nth-child(8) { left: 95%; color: var(--gold);   background: radial-gradient(circle at 35% 30%, #fff7, var(--gold));   animation-duration: 24s; animation-delay: 9s;  width: 48px; height: 60px; }

@keyframes float-up {
  0%   { transform: translateY(0) rotate(-4deg); }
  50%  { transform: translateY(-55vh) rotate(4deg); }
  100% { transform: translateY(-115vh) rotate(-4deg); }
}

/* ---------- Layout shells ---------- */
.hero, main, .footer { position: relative; z-index: 2; }

.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 18px 70px;
}
.hero-inner { max-width: 900px; width: 100%; }

.eyebrow {
  display: inline-block;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  font-weight: 700;
  font-size: clamp(0.7rem, 2.4vw, 0.95rem);
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(4px);
  margin: 0 0 18px;
}

.title {
  margin: 0;
  font-size: clamp(2.6rem, 11vw, 7rem);
  line-height: 0.95;
  font-weight: 900;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}
.title .w {
  display: inline-block;
  background: linear-gradient(90deg, var(--gold), var(--rose), var(--sky), #b5ffd9, var(--gold));
  background-size: 220% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shine 7s linear infinite, pop 0.7s cubic-bezier(0.2, 0.8, 0.2, 1.2) backwards;
  animation-delay: 0s, calc(var(--i, 0) * 0.18s + 0.2s);
  padding: 0 0.12em;
}
.title .name {
  background: linear-gradient(90deg, #fff, var(--gold), var(--pink), #fff);
  background-size: 220% auto;
  -webkit-background-clip: text;
  background-clip: text;
  filter: drop-shadow(0 6px 22px rgba(255, 94, 126, 0.55));
}

@keyframes shine { to { background-position: 220% center; } }
@keyframes pop {
  from { opacity: 0; transform: translateY(46px) rotate(-7deg) scale(0.6); }
  to   { opacity: 1; transform: none; }
}

.subtitle {
  font-size: clamp(1.05rem, 3.6vw, 1.7rem);
  font-weight: 600;
  margin: 18px auto 6px;
  max-width: 28ch;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

.born-badge {
  display: inline-block;
  margin-top: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  font-size: clamp(0.8rem, 2.6vw, 1rem);
  color: #fff;
  opacity: 0.9;
}

/* ---------- Birthday cake (pure CSS) ---------- */
.cake-wrap { margin: 34px auto 8px; }
.cake {
  position: relative;
  width: 230px;
  height: 188px;
  margin: 0 auto;
  cursor: pointer;
  animation: rise 0.9s ease 0.4s backwards;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(40px) scale(0.85); }
  to   { opacity: 1; transform: none; }
}

.candles {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 16px;
  z-index: 3;
}
.num-candle {
  position: relative;
  width: 48px;
  height: 78px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 900;
  font-size: 2.5rem;
  text-shadow: 0 2px 3px rgba(0, 0, 0, 0.35);
  background: repeating-linear-gradient(45deg, var(--pink) 0 9px, #fff 9px 18px);
  box-shadow: inset 0 -6px 10px rgba(0, 0, 0, 0.18), 0 6px 12px rgba(0, 0, 0, 0.2);
}
.flame {
  position: absolute;
  top: -30px;
  left: 50%;
  width: 20px;
  height: 30px;
  transform: translateX(-50%);
  border-radius: 50% 50% 50% 50% / 64% 64% 40% 40%;
  background: radial-gradient(circle at 50% 70%, #fff3b0, #ffb703 45%, #fb5607 90%);
  box-shadow: 0 0 18px 6px rgba(255, 170, 30, 0.7);
  transform-origin: center bottom;
  animation: flicker 0.18s ease-in-out infinite alternate;
}
@keyframes flicker {
  from { transform: translateX(-50%) scale(1) rotate(-2deg); opacity: 0.95; }
  to   { transform: translateX(-50%) scale(1.12, 1.18) rotate(2deg); opacity: 1; }
}
.cake.candles-out .flame {
  opacity: 0;
  transform: translateX(-50%) scaleY(0.1);
  box-shadow: none;
  transition: opacity 0.25s, transform 0.25s;
  animation: none;
}

.icing {
  position: absolute;
  left: 8px;
  right: 8px;
  top: 84px;
  height: 44px;
  background: var(--rose);
  border-radius: 14px 14px 8px 8px;
}
.icing::before { /* drips */
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 30px;
  height: 26px;
  background:
    radial-gradient(14px 22px at 18px 0, var(--rose) 50%, transparent 51%),
    radial-gradient(14px 26px at 58px 0, var(--rose) 50%, transparent 51%),
    radial-gradient(14px 20px at 98px 0, var(--rose) 50%, transparent 51%),
    radial-gradient(14px 26px at 140px 0, var(--rose) 50%, transparent 51%),
    radial-gradient(14px 22px at 182px 0, var(--rose) 50%, transparent 51%),
    radial-gradient(14px 24px at 210px 0, var(--rose) 50%, transparent 51%);
}
.body {
  position: absolute;
  left: 0;
  right: 0;
  top: 110px;
  height: 64px;
  border-radius: 12px;
  background: linear-gradient(var(--violet), var(--grape));
  box-shadow: inset 0 -10px 16px rgba(0, 0, 0, 0.22);
  overflow: hidden;
}
.body::after { /* sprinkle dots */
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(3px 3px at 20% 40%, var(--gold) 50%, transparent 51%),
    radial-gradient(3px 3px at 40% 65%, var(--sky) 50%, transparent 51%),
    radial-gradient(3px 3px at 62% 38%, var(--mint) 50%, transparent 51%),
    radial-gradient(3px 3px at 78% 60%, var(--gold) 50%, transparent 51%),
    radial-gradient(3px 3px at 88% 35%, var(--pink) 50%, transparent 51%),
    radial-gradient(3px 3px at 12% 70%, var(--rose) 50%, transparent 51%);
}
.plate {
  position: absolute;
  left: -18px;
  right: -18px;
  bottom: 0;
  height: 18px;
  background: linear-gradient(#ffffff, #d9d9f3);
  border-radius: 50% / 70%;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.3);
}
.cake-hint {
  margin: 14px 0 0;
  font-size: 0.95rem;
  opacity: 0.8;
  font-style: italic;
}

/* ---------- Buttons ---------- */
.wish-btn {
  font-family: inherit;
  font-weight: 800;
  font-size: clamp(1rem, 3.2vw, 1.2rem);
  color: var(--ink);
  padding: 0.85em 1.8em;
  margin-top: 24px;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  background: linear-gradient(135deg, var(--gold), var(--rose));
  box-shadow: 0 12px 30px rgba(255, 143, 171, 0.5);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.wish-btn:hover { transform: translateY(-3px) scale(1.04); box-shadow: 0 18px 38px rgba(255, 143, 171, 0.6); }
.wish-btn:active { transform: translateY(0) scale(0.98); }
.wish-btn:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }

/* ---------- Scroll cue ---------- */
.scroll-cue {
  margin-top: 54px;
  font-weight: 600;
  font-size: 0.95rem;
  opacity: 0.85;
  animation: bob 1.8s ease-in-out infinite;
}
@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(8px); }
}

/* ---------- Reveal-on-scroll utility ---------- */
.reveal {
  opacity: 0;
  transform: translateY(34px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.reveal.visible { opacity: 1; transform: none; }

/* ---------- Finale ---------- */
.finale {
  max-width: 720px;
  margin: 40px auto 0;
  padding: 60px 22px 90px;
}
.finale h2 {
  font-size: clamp(1.8rem, 6vw, 3rem);
  margin: 0 0 14px;
}
.finale p {
  font-size: clamp(1.05rem, 3.4vw, 1.35rem);
  line-height: 1.6;
  margin: 0 auto;
  max-width: 46ch;
  opacity: 0.95;
}

/* ---------- Footer ---------- */
.footer {
  padding: 26px 18px 40px;
  font-size: 0.9rem;
  opacity: 0.8;
}
.footer a { color: #fff; }

/* ---------- Timeline ---------- */
.timeline-section { padding: 30px 18px 20px; }

.section-title {
  font-size: clamp(1.8rem, 6.5vw, 3.2rem);
  margin: 0 0 8px;
  font-weight: 900;
  background: linear-gradient(90deg, #fff, var(--gold), var(--rose), #fff);
  background-size: 220% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shine 8s linear infinite;
}
.section-sub {
  font-size: clamp(1rem, 3.2vw, 1.25rem);
  opacity: 0.9;
  margin: 0 auto 48px;
  max-width: 46ch;
}

.timeline {
  list-style: none;
  margin: 0 auto;
  padding: 0;
  max-width: 960px;
  position: relative;
}
.timeline::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 4px;
  margin-left: -2px;
  border-radius: 4px;
  background: linear-gradient(180deg, var(--gold), var(--rose), var(--sky), var(--mint));
  opacity: 0.85;
}

.t-item {
  position: relative;
  width: 50%;
  padding: 0 44px 44px 0;
  text-align: right;
}
.t-item[data-side="right"] {
  margin-left: 50%;
  padding: 0 0 44px 44px;
  text-align: left;
}

.t-dot {
  position: absolute;
  top: 8px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  border: 4px solid var(--rose);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.15);
  z-index: 2;
}
.t-item[data-side="left"] .t-dot { right: -10px; }
.t-item[data-side="right"] .t-dot { left: -10px; }

.t-card {
  display: inline-block;
  text-align: left;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(8px);
  border-radius: 18px;
  padding: 18px 20px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.25);
  max-width: 420px;
}
.t-emoji { font-size: 1.9rem; line-height: 1; }
.t-year {
  display: block;
  font-weight: 900;
  font-size: 1.5rem;
  margin: 4px 0 2px;
  color: var(--gold);
  letter-spacing: 0.02em;
}
.t-head { margin: 2px 0 6px; font-size: 1.15rem; }
.t-text { margin: 0; line-height: 1.55; opacity: 0.92; font-size: 0.98rem; }

.t-badge {
  display: inline-block;
  margin-left: 6px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--gold);
  padding: 3px 10px;
  border-radius: 999px;
  vertical-align: middle;
}

.t-item.milestone .t-card {
  background: linear-gradient(135deg, rgba(255, 209, 102, 0.24), rgba(255, 143, 171, 0.24));
  border-color: rgba(255, 209, 102, 0.75);
  box-shadow: 0 16px 42px rgba(255, 143, 171, 0.35);
}
.t-item.milestone .t-dot {
  width: 26px;
  height: 26px;
  top: 5px;
  background: var(--gold);
  border-color: #fff;
}
.t-item[data-side="left"].milestone .t-dot { right: -13px; }
.t-item[data-side="right"].milestone .t-dot { left: -13px; }

/* Reveal slide direction for timeline cards */
.t-item[data-side="left"].reveal { transform: translate(-40px, 20px); }
.t-item[data-side="right"].reveal { transform: translate(40px, 20px); }
.t-item.reveal.visible { transform: none; }

@media (max-width: 760px) {
  .timeline::before { left: 22px; }
  .t-item,
  .t-item[data-side="right"] {
    width: 100%;
    margin-left: 0;
    text-align: left;
    padding: 0 0 34px 56px;
  }
  .t-item[data-side="left"] .t-dot,
  .t-item[data-side="right"] .t-dot { left: 12px; right: auto; }
  .t-item[data-side="left"].milestone .t-dot,
  .t-item[data-side="right"].milestone .t-dot { left: 9px; right: auto; }
  .t-card { max-width: none; }
  .t-item[data-side="left"].reveal,
  .t-item[data-side="right"].reveal { transform: translateY(24px); }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  body { animation: none; }
  .balloon { animation: none; display: none; }
  .title .w { animation: none; }
  .flame { animation: none; }
  .scroll-cue { animation: none; }
  html { scroll-behavior: auto; }
  .reveal { transition: none; }
}
