/* =========================================================
   Happy Birthday · "ที่รัก"
   Theme: Warm golden hour — sunset peach · amber · cream
   Mobile-first. Scales up to tablet/desktop with min-width queries.
   ========================================================= */

:root {
  --cream:    #fff6e9;
  --peach:    #ffd9a8;
  --apricot:  #ffc285;
  --amber:    #ff9e5e;
  --coral:    #ff7e6b;
  --rose:     #ff6f91;
  --gold:     #f0a93c;
  --brown:    #5a3526;   /* warm text on light */
  --brown-soft:#8a5a3e;
  --deep:     #3a2030;   /* deep plum for the message section */
  --deep-2:   #5b2a3a;

  --shadow-warm: 0 18px 40px -18px rgba(120, 60, 20, 0.45);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  --maxw: 1100px;
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: "Mali", "Segoe UI", system-ui, sans-serif;
  color: var(--brown);
  background: var(--cream);
  line-height: 1.65;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }

/* ---------- Reveal-on-scroll ---------- */
.reveal {
  opacity: 0;
  transform: translateY(26px) scale(0.98);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
  will-change: opacity, transform;
}
.reveal.is-visible { opacity: 1; transform: none; }

/* =========================================================
   MUSIC TOGGLE
   ========================================================= */
.music-toggle {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  right: 14px;
  z-index: 60;
  width: 46px; height: 46px;
  border: none; border-radius: 50%;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow-warm);
  font-size: 1.25rem; line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: transform 0.25s var(--ease), background 0.25s;
}
.music-toggle:hover { transform: scale(1.08); }
.music-toggle:active { transform: scale(0.94); }
.music-toggle.is-muted { opacity: 0.6; }
.music-toggle.is-playing { animation: pulse-soft 1.4s ease-in-out infinite; }

@keyframes pulse-soft {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 158, 94, 0.5); }
  50%      { box-shadow: 0 0 0 12px rgba(255, 158, 94, 0); }
}

/* =========================================================
   HERO
   ========================================================= */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: clamp(1.2rem, 5vw, 3rem) 1.1rem 5rem;
  overflow: hidden;
  isolation: isolate;
}

/* golden-hour sky gradient */
.hero__sky {
  position: absolute; inset: 0; z-index: -3;
  background:
    radial-gradient(120% 80% at 50% 18%, #fff3dc 0%, #ffe1b0 28%, #ffc285 52%, #ff9e6b 74%, #ff7e76 100%);
}
/* glowing sun behind the cake */
.hero__sun {
  position: absolute;
  z-index: -2;
  top: 42%; left: 50%;
  width: min(120vw, 760px); aspect-ratio: 1;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(255,255,235,0.95) 0%, rgba(255,221,150,0.55) 32%, rgba(255,180,120,0) 66%);
  animation: sun-breathe 7s ease-in-out infinite;
  pointer-events: none;
}
@keyframes sun-breathe {
  0%, 100% { transform: translate(-50%, -50%) scale(1);   opacity: 0.95; }
  50%      { transform: translate(-50%, -50%) scale(1.07); opacity: 1; }
}

.hero__hearts { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.floaty {
  position: absolute;
  bottom: -10%;
  font-size: 1.5rem;
  opacity: 0;
  will-change: transform, opacity;
  animation: float-up linear infinite;
}
@keyframes float-up {
  0%   { transform: translateY(0) rotate(0deg) scale(0.8); opacity: 0; }
  12%  { opacity: 0.9; }
  88%  { opacity: 0.9; }
  100% { transform: translateY(-118svh) rotate(220deg) scale(1.1); opacity: 0; }
}

.hero__content {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 560px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero__badge {
  font-weight: 600;
  color: var(--brown);
  background: rgba(255,255,255,0.7);
  padding: 0.32em 1.05em;
  border-radius: 999px;
  font-size: 0.95rem;
  box-shadow: 0 6px 18px -10px rgba(120,60,20,0.6);
  margin-bottom: 0.9rem;
  animation: pop-in 0.7s var(--ease) both;
}

.hero__title {
  font-weight: 700;
  font-size: clamp(1.7rem, 7.4vw, 3.9rem);
  line-height: 1.3;
  color: #fff;
  text-shadow: 0 6px 22px rgba(150, 70, 30, 0.35);
  letter-spacing: 0.3px;
  overflow-wrap: anywhere;
  max-width: 100%;
  animation: pop-in 0.8s 0.05s var(--ease) both;
}
.hero__title-accent {
  font-family: "Mali", system-ui, sans-serif;   /* match the rest of the site */
  font-weight: 700;
  color: #fff;
  background: linear-gradient(100deg, #fff 0%, #ffe9c2 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  display: block;
  margin-top: 0.2em;
  padding: 0 0.1em 0.1em;
  font-size: 1.35em;
  line-height: 1.1;
  text-shadow: none;
  filter: drop-shadow(0 6px 16px rgba(150,70,30,0.35));
}

.hero__sub {
  margin-top: 0.7rem;
  font-size: clamp(1rem, 3.4vw, 1.2rem);
  color: var(--brown);
  font-weight: 500;
  max-width: 30ch;
  animation: pop-in 0.8s 0.12s var(--ease) both;
}

@keyframes pop-in {
  from { opacity: 0; transform: translateY(16px) scale(0.96); }
  to   { opacity: 1; transform: none; }
}

/* cake */
.cake {
  position: relative;
  width: min(86vw, 360px);
  margin: clamp(0.5rem, 3vw, 1.4rem) auto 0.4rem;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.cake svg { width: 100%; height: auto; overflow: visible; display: block; }
.cake__hint {
  position: absolute;
  left: 50%; bottom: -0.4rem;
  transform: translateX(-50%);
  font-size: 0.8rem;
  color: var(--brown-soft);
  white-space: nowrap;
  opacity: 0.85;
  pointer-events: none;
  animation: bob 2s ease-in-out infinite;
}
@keyframes bob { 0%,100%{ transform: translate(-50%,0);} 50%{ transform: translate(-50%,4px);} }

/* buttons */
.btn-blow, .btn-replay {
  margin-top: 1.3rem;
  border: none;
  border-radius: 999px;
  font-family: inherit;
  font-weight: 600;
  font-size: clamp(1rem, 3.6vw, 1.18rem);
  color: #fff;
  padding: 0.78em 1.9em;
  cursor: pointer;
  background: linear-gradient(135deg, var(--coral) 0%, var(--amber) 55%, var(--gold) 100%);
  box-shadow: 0 14px 30px -12px rgba(220, 90, 40, 0.7);
  transition: transform 0.2s var(--ease), box-shadow 0.2s, filter 0.2s;
  animation: pop-in 0.8s 0.2s var(--ease) both;
}
.btn-blow:hover, .btn-replay:hover { transform: translateY(-2px) scale(1.03); filter: brightness(1.05); }
.btn-blow:active, .btn-replay:active { transform: translateY(0) scale(0.97); }
.btn-blow.is-hidden { display: none; }

.btn-replay {
  background: rgba(255,255,255,0.82);
  color: var(--brown);
  box-shadow: 0 10px 24px -14px rgba(120,60,20,0.7);
  font-size: 0.98rem;
  padding: 0.62em 1.4em;
}

.wish {
  margin-top: 1.1rem;
  font-size: clamp(1.05rem, 4vw, 1.35rem);
  font-weight: 600;
  color: var(--brown);
  background: rgba(255,255,255,0.66);
  padding: 0.55em 1.1em;
  border-radius: 18px;
  animation: pop-in 0.7s var(--ease) both;
}

/* scroll cue */
.scroll-cue {
  position: absolute;
  bottom: 1.2rem; left: 50%;
  transform: translateX(-50%);
  text-decoration: none;
  color: var(--brown);
  font-size: 0.82rem;
  font-weight: 500;
  display: flex; flex-direction: column; align-items: center; gap: 0.2rem;
  opacity: 0.85;
}
.scroll-cue__arrow { font-size: 1.2rem; animation: bob 1.8s ease-in-out infinite; }

/* =========================================================
   TIMELINE
   ========================================================= */
.timeline {
  background: linear-gradient(180deg, #ff7e76 0%, #ffd9a8 16%, var(--cream) 42%, var(--cream) 100%);
  padding: clamp(2.5rem, 8vw, 5rem) 1.1rem clamp(3rem, 9vw, 6rem);
}

.section-head { text-align: center; max-width: 40ch; margin: 0 auto clamp(2rem, 7vw, 3.5rem); }
.section-title {
  font-weight: 700;
  font-size: clamp(1.5rem, 6vw, 2.4rem);
  color: var(--coral);
  line-height: 1.3;
}
.section-sub { margin-top: 0.5rem; color: var(--brown-soft); font-size: clamp(0.95rem,3.4vw,1.1rem); }

.tl {
  position: relative;
  max-width: var(--maxw);
  margin: 0 auto;
  padding-left: 52px;          /* room for the line + dots on mobile */
}
/* the vertical timeline line */
.tl::before {
  content: "";
  position: absolute;
  top: 6px; bottom: 6px; left: 19px;
  width: 4px;
  border-radius: 4px;
  background: linear-gradient(180deg, var(--coral), var(--amber), var(--gold));
  opacity: 0.55;
}

.tl__year { position: relative; margin-bottom: clamp(2.4rem, 8vw, 4rem); }
.tl__year:last-child { margin-bottom: 0; }

.tl__dot {
  position: absolute;
  left: -52px; top: 0;
  width: 42px; height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--coral), var(--gold));
  color: #fff;
  display: grid; place-items: center;
  font-size: 0.72rem; font-weight: 700;
  box-shadow: 0 8px 18px -8px rgba(220,90,40,0.8), 0 0 0 5px var(--cream);
}

.tl__caption {
  font-weight: 600;
  font-size: clamp(1.05rem, 4vw, 1.3rem);
  color: var(--brown);
  margin-bottom: 0.9rem;
}

.polaroids {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(0.8rem, 3vw, 1.4rem);
}

.polaroid {
  background: #fff;
  padding: 10px 10px 14px;
  border-radius: 6px;
  box-shadow: var(--shadow-warm);
  width: 100%;
  max-width: 260px;
  transform: rotate(var(--tilt, 0deg));
  transition: transform 0.35s var(--ease), box-shadow 0.35s;
  cursor: zoom-in;
}
.polaroid::before {            /* a little tape on top */
  content: "";
  position: absolute;
  margin: -20px auto 0; left: 0; right: 0;
  width: 70px; height: 22px;
  background: rgba(255, 220, 160, 0.55);
  transform: rotate(-3deg);
  border-radius: 2px;
}
.polaroid { position: relative; }
.polaroid img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 3px;
  background: #f2e6d4;
}
.polaroid figcaption {
  font-family: "Charmonman", cursive;
  text-align: center;
  margin-top: 0.5rem;
  color: var(--brown-soft);
  font-size: 1.05rem;
}
.polaroid:hover { transform: rotate(0deg) translateY(-6px) scale(1.02); box-shadow: 0 26px 50px -20px rgba(120,60,20,0.55); z-index: 2; }

/* =========================================================
   MESSAGE
   ========================================================= */
.message {
  position: relative;
  background: linear-gradient(165deg, var(--deep) 0%, var(--deep-2) 55%, #7a3a3f 100%);
  color: #fff6ea;
  text-align: center;
  padding: clamp(4rem, 14vw, 8rem) 1.2rem;
  overflow: hidden;
}
.message::before, .message::after {  /* warm glows */
  content: ""; position: absolute; border-radius: 50%; filter: blur(40px); opacity: 0.5; pointer-events: none;
}
.message::before { width: 320px; height: 320px; background: var(--amber); top: -80px; left: -60px; }
.message::after  { width: 280px; height: 280px; background: var(--rose);  bottom: -70px; right: -50px; }

.message__inner { position: relative; max-width: 30ch; margin: 0 auto; }
.message__heart { font-size: 2.4rem; display: inline-block; animation: heartbeat 1.7s ease-in-out infinite; }
@keyframes heartbeat { 0%,100%{ transform: scale(1);} 15%{ transform: scale(1.18);} 30%{ transform: scale(1);} 45%{ transform: scale(1.12);} }

.message__line {
  font-size: clamp(1.25rem, 6vw, 2rem);
  font-weight: 400;
  margin-top: 0.6rem;
  color: #ffe9d2;
}
.message__line--big {
  font-weight: 700;
  font-size: clamp(1.6rem, 7.5vw, 2.7rem);
  color: #fff;
  margin-top: 1rem;
  line-height: 1.35;
}
.message__promise { margin-top: 1.4rem; font-size: clamp(1.05rem, 4.5vw, 1.4rem); color: #ffd9a8; }
.message__sign {
  font-family: "Mali", system-ui, sans-serif;   /* match the rest of the site */
  font-weight: 700;
  font-size: clamp(1.35rem, 6vw, 2.1rem);
  margin-top: 2.2rem;
  color: #ffd0a0;
}

/* staggered reveal of message lines */
.message__line:nth-child(2) { transition-delay: 0.05s; }
.message__line:nth-child(3) { transition-delay: 0.18s; }
.message__line--big          { transition-delay: 0.32s; }
.message__promise            { transition-delay: 0.5s; }
.message__sign               { transition-delay: 0.7s; }

/* =========================================================
   FOOTER
   ========================================================= */
.footer {
  background: var(--deep);
  color: #ffd9a8;
  text-align: center;
  padding: 2.4rem 1rem 2.8rem;
}
.footer__hbd { font-size: 1.2rem; font-weight: 600; color: #fff6ea; }
.footer__date { font-family: "Charmonman", cursive; font-size: 1.4rem; margin-top: 0.2rem; }

/* =========================================================
   LIGHTBOX
   ========================================================= */
.lightbox {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(40, 18, 28, 0.92);
  display: grid; place-items: center;
  padding: 4vw;
  animation: fade-in 0.3s ease both;
}
.lightbox[hidden] { display: none; }
.lightbox__img { max-width: 92vw; max-height: 88vh; border-radius: 10px; box-shadow: 0 30px 70px rgba(0,0,0,0.6); }
.lightbox__close {
  position: absolute; top: 4vw; right: 5vw;
  width: 44px; height: 44px; border-radius: 50%;
  border: none; background: rgba(255,255,255,0.9); color: var(--brown);
  font-size: 1.2rem; cursor: pointer;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* =========================================================
   CONFETTI canvas
   ========================================================= */
#confetti-canvas {
  position: fixed; inset: 0; z-index: 70;
  pointer-events: none;
}

/* =========================================================
   RESPONSIVE — scale up from mobile
   ========================================================= */
@media (min-width: 720px) {
  .tl { padding-left: 0; }
  .tl::before { left: 50%; transform: translateX(-50%); }
  .tl__year { width: 50%; padding: 0 2.4rem; }
  .tl__year:nth-child(odd)  { left: 0; text-align: right; }
  .tl__year:nth-child(even) { left: 50%; }
  .tl__dot {
    left: auto;
    top: 4px;
  }
  .tl__year:nth-child(odd) .tl__dot  { right: -21px; left: auto; }
  .tl__year:nth-child(even) .tl__dot { left: -21px; }
  .tl__year:nth-child(odd) .polaroids  { justify-content: flex-end; }
  .polaroid { max-width: 220px; }
}

@media (min-width: 720px) and (max-width: 1000px) {
  /* keep dot labels readable */
  .tl__dot { width: 46px; height: 46px; }
}

/* =========================================================
   REDUCED MOTION
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1 !important; transform: none !important; }
  .hero__sun, .scroll-cue__arrow, .message__heart, .floaty { animation: none !important; }
  .floaty { display: none; }
}
