:root {
  --rose: #f2a4b8;
  --rose-deep: #e88aa3;
  --blush: #fce4ec;
  --nude: #fff5f7;
  --cream: #fff8f0;
  --deep: #6d3b47;
  --soft: #e8afc0;
  --gold: #f9d9a8;
  --text: #5a2d3a;
  --muted: #9d6677;
  --ink: rgba(90, 45, 58, 0.92);

  --max-content: 480px;
  --radius-lg: 24px;
  --radius-md: 16px;
  --shadow-soft: 0 12px 40px rgba(242, 164, 184, 0.18);
  --ease-out: cubic-bezier(.22, 1, .36, 1);
}

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

html {
  scroll-behavior: auto; /* lenis takes over */
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Nunito', 'Sarabun', system-ui, sans-serif;
  background: var(--nude);
  color: var(--text);
  overflow-x: hidden;
  min-height: 100svh;
  position: relative;
  line-height: 1.6;
}

/* ── 3D canvas ── */
#scene3d {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100svh;
  z-index: 0;
  pointer-events: none;
  display: block;
}

/* CSS fallback aura (sits below canvas; canvas covers it on success) */
.aura-fallback {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, #ffd6e3 0%, transparent 70%),
    radial-gradient(ellipse 60% 50% at 80% 80%, #ffecd4 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 10% 90%, #fde4f0 0%, transparent 60%),
    var(--nude);
}
.aura {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  animation: aura-pulse 6s ease-in-out infinite;
  mix-blend-mode: screen;
  pointer-events: none;
}
.aura-1 { width: 320px; height: 320px; background: rgba(242,164,184,0.20); top: 10%; left: 12%; animation-delay: 0s; }
.aura-2 { width: 220px; height: 220px; background: rgba(249,217,168,0.18); top: 60%; right: 8%; animation-delay: 2s; }
.aura-3 { width: 260px; height: 260px; background: rgba(248,200,220,0.18); bottom: 5%; left: 40%; animation-delay: 4s; }
@keyframes aura-pulse {
  0%, 100% { transform: scale(1); opacity: .65; }
  50%      { transform: scale(1.12); opacity: 1; }
}

/* ── Cursor (desktop only) ── */
.cursor, .cursor-trail { display: none; }
@media (hover: hover) and (pointer: fine) {
  body { cursor: none; }
  .cursor {
    display: block;
    width: 16px; height: 16px;
    background: var(--rose);
    border-radius: 50%;
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    mix-blend-mode: multiply;
    transition: transform .15s ease;
    transform: translate(-50%, -50%);
    top: 0; left: 0;
  }
  .cursor-trail {
    display: block;
    width: 8px; height: 8px;
    background: var(--soft);
    border-radius: 50%;
    position: fixed;
    pointer-events: none;
    z-index: 9998;
    opacity: .6;
    transform: translate(-50%, -50%);
    top: 0; left: 0;
  }
}

/* ── Scroll progress ── */
.scroll-progress {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 0;
  background: linear-gradient(to right, var(--rose), var(--gold));
  z-index: 9997;
  border-radius: 0 2px 2px 0;
  transition: width .12s linear;
}

/* ── Layout & sections ── */
.content-section, .message-section {
  position: relative;
  z-index: 2;
}

.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  z-index: 2;
}

.hero-content {
  text-align: center;
  max-width: 420px;
  margin: 0 auto;
}

.hero-emoji {
  font-size: clamp(40px, 12vw, 72px);
  display: block;
  animation: float 4s ease-in-out infinite;
  margin-bottom: .25rem;
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-10px); }
}

.hero-sub {
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-size: clamp(13px, 3.5vw, 16px);
  color: var(--muted);
  letter-spacing: .08em;
  margin-bottom: 1rem;
  opacity: 0;
  animation: fade-up 1s ease .3s forwards;
}

.hero-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(36px, 11vw, 64px);
  line-height: 1.1;
  color: var(--deep);
  margin-bottom: 1.2rem;
  opacity: 0;
  animation: fade-up 1s ease .55s forwards;
}
.hero-title span {
  color: var(--rose);
  display: block;
  font-style: italic;
}

.hero-desc {
  font-size: clamp(13px, 3.8vw, 15px);
  color: var(--muted);
  line-height: 1.85;
  font-weight: 300;
  opacity: 0;
  animation: fade-up 1s ease .8s forwards;
  margin-bottom: 2rem;
}

.hero-scroll-hint {
  opacity: 0;
  animation: fade-up 1s ease 1.2s forwards;
  font-size: 22px;
}
.scroll-arrow {
  display: inline-block;
  animation: bounce-hint 2s ease infinite;
}
@keyframes bounce-hint {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(8px); }
}
@keyframes fade-up {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.content-section {
  padding: clamp(56px, 12vw, 88px) clamp(20px, 6vw, 40px);
  max-width: var(--max-content);
  margin: 0 auto;
}

.section-label {
  font-size: 11px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--rose);
  font-weight: 600;
  margin-bottom: .55rem;
  opacity: 0;
  transition: opacity .8s var(--ease-out);
}
.section-label.visible { opacity: 1; }

.section-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(28px, 8vw, 40px);
  color: var(--deep);
  line-height: 1.2;
  margin-bottom: 1rem;
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .9s var(--ease-out), transform .9s var(--ease-out);
  transition-delay: .08s;
}
.section-title.visible { opacity: 1; transform: none; }

.section-body {
  font-size: clamp(14px, 4vw, 15px);
  line-height: 1.9;
  color: var(--muted);
  font-weight: 300;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity .9s var(--ease-out), transform .9s var(--ease-out);
  transition-delay: .2s;
  margin-bottom: 1.5rem;
}
.section-body.visible { opacity: 1; transform: none; }

/* ── Reasons grid ── */
.reasons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 1rem;
}
.reason-card {
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 20px;
  padding: 18px 14px;
  text-align: center;
  border: 1.5px solid rgba(242, 164, 184, 0.18);
  box-shadow: 0 4px 18px rgba(242, 164, 184, 0.10);
  opacity: 0;
  transform: translateY(18px) scale(.97);
  transition: opacity .7s var(--ease-out), transform .7s var(--ease-out), box-shadow .3s ease, border-color .3s ease;
}
.reason-card.visible { opacity: 1; transform: none; }
.reason-card:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 12px 28px rgba(242, 164, 184, 0.22);
  border-color: var(--rose);
}
.reason-emoji { font-size: 28px; display: block; margin-bottom: 4px; }
.reason-text { font-size: 12.5px; color: var(--text); font-weight: 600; line-height: 1.45; }

/* ── Timeline ── */
.timeline-section { padding-bottom: clamp(40px, 8vw, 60px); }
.timeline-status {
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  padding: 12px 0;
}
.timeline-status.error { color: var(--rose-deep); }
.timeline-status[hidden] { display: none; }

.timeline {
  position: relative;
  margin-top: 1.5rem;
  padding-left: 38px;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 14px;
  top: 8px; bottom: 8px;
  width: 2px;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    var(--rose) 8%,
    var(--gold) 50%,
    var(--rose) 92%,
    transparent 100%
  );
  opacity: .7;
  border-radius: 2px;
}

.timeline-month {
  position: relative;
  margin-bottom: 36px;
  opacity: 0;
  transform: translateX(-16px);
  transition: opacity .8s var(--ease-out), transform .8s var(--ease-out);
}
.timeline-month.visible { opacity: 1; transform: none; }

.timeline-month::before {
  content: '';
  position: absolute;
  left: -30px; top: 4px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--rose), var(--soft));
  box-shadow: 0 0 0 4px rgba(255, 255, 255, .85), 0 4px 12px rgba(242, 164, 184, .5);
}

.timeline-month-label {
  font-family: 'Playfair Display', serif;
  font-size: clamp(17px, 4.5vw, 20px);
  color: var(--deep);
  margin-bottom: 4px;
}
.timeline-month-count {
  font-size: 11px;
  color: var(--rose);
  letter-spacing: .1em;
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 12px;
}

.timeline-photos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
  margin-top: 8px;
}
.timeline-photo {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: 12px;
  overflow: hidden;
  background: var(--blush);
  cursor: pointer;
  border: 1.5px solid rgba(255, 255, 255, .85);
  box-shadow: 0 4px 14px rgba(242, 164, 184, .18);
  transition: transform .3s var(--ease-out), box-shadow .3s ease;
}
.timeline-photo:hover, .timeline-photo:focus-visible {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 10px 24px rgba(242, 164, 184, .35);
  outline: none;
}
.timeline-photo img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity .5s ease;
}
.timeline-photo img.loaded { opacity: 1; }

/* ── Upload button ── */
.upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 32px auto 0;
  padding: 12px 22px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--rose), var(--rose-deep));
  color: white;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .05em;
  border: none;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(232, 138, 163, .35);
  transition: transform .25s var(--ease-out), box-shadow .25s ease;
  position: relative;
  z-index: 2;
}
.upload-btn:hover, .upload-btn:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(232, 138, 163, .5);
  outline: none;
}
.upload-btn-icon { font-size: 14px; }
.timeline-section { display: flex; flex-direction: column; }
.timeline-section .upload-btn { align-self: center; }

/* ── Upload modal ── */
.upload-modal {
  border: none;
  border-radius: var(--radius-lg);
  padding: 0;
  background: transparent;
  max-width: 380px;
  width: calc(100% - 32px);
}
.upload-modal::backdrop {
  background: rgba(109, 59, 71, .45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.upload-modal[open] { animation: modal-in .35s var(--ease-out); }
@keyframes modal-in {
  from { opacity: 0; transform: translateY(20px) scale(.96); }
  to   { opacity: 1; transform: none; }
}

.upload-form {
  background: linear-gradient(135deg, #fff0f5, var(--cream));
  border-radius: var(--radius-lg);
  padding: 28px 24px 24px;
  border: 1.5px solid rgba(242, 164, 184, .25);
  box-shadow: 0 24px 60px rgba(109, 59, 71, .25);
  position: relative;
}
.upload-close {
  position: absolute;
  top: 10px; right: 14px;
  background: transparent;
  border: none;
  font-size: 26px;
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
}
.upload-close:hover { color: var(--rose-deep); }

.upload-title {
  font-family: 'Playfair Display', serif;
  font-size: 22px;
  color: var(--deep);
  margin-bottom: 4px;
  text-align: center;
}
.upload-sub {
  font-size: 12.5px;
  color: var(--muted);
  text-align: center;
  margin-bottom: 18px;
}

.upload-field {
  display: block;
  margin-bottom: 14px;
}
.upload-field > span {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: .03em;
}
.upload-field input[type="password"],
.upload-field input[type="file"] {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1.5px solid rgba(242, 164, 184, .35);
  background: white;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
}
.upload-field input[type="password"]:focus,
.upload-field input[type="file"]:focus {
  outline: none;
  border-color: var(--rose);
  box-shadow: 0 0 0 3px rgba(242, 164, 184, .2);
}

.upload-preview {
  margin: 4px 0 12px;
  padding: 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .7);
  border: 1px solid rgba(242, 164, 184, .2);
  display: flex;
  gap: 10px;
  align-items: center;
}
.upload-preview img {
  width: 60px; height: 60px;
  object-fit: cover;
  border-radius: 10px;
}
.upload-preview-meta {
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.5;
  flex: 1;
}

.upload-feedback {
  min-height: 18px;
  font-size: 12.5px;
  text-align: center;
  margin-bottom: 12px;
  color: var(--muted);
}
.upload-feedback.success { color: #2d7a4a; }
.upload-feedback.error { color: var(--rose-deep); }

.upload-actions {
  display: flex;
  justify-content: center;
}
.upload-submit {
  padding: 11px 26px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--rose), var(--rose-deep));
  color: white;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  letter-spacing: .03em;
  box-shadow: 0 6px 18px rgba(232, 138, 163, .35);
  transition: transform .2s var(--ease-out), opacity .2s;
}
.upload-submit:hover:not(:disabled) { transform: translateY(-1px); }
.upload-submit:disabled { opacity: .55; cursor: not-allowed; }

/* ── Lightbox ── */
.lightbox {
  border: none;
  padding: 0;
  background: transparent;
  max-width: 100vw;
  max-height: 100vh;
  width: 100%;
  height: 100%;
}
.lightbox::backdrop {
  background: rgba(20, 8, 14, .85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.lightbox-close {
  position: fixed;
  top: 14px; right: 18px;
  background: rgba(255, 255, 255, .15);
  border: none;
  color: white;
  font-size: 28px;
  width: 40px; height: 40px;
  border-radius: 50%;
  cursor: pointer;
  z-index: 2;
}
.lightbox-figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 40px 16px;
  gap: 12px;
}
.lightbox-figure img {
  max-width: 100%;
  max-height: 80vh;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .45);
  object-fit: contain;
}
.lightbox-figure figcaption {
  color: rgba(255, 255, 255, .85);
  font-size: 13px;
  font-family: 'Playfair Display', serif;
  letter-spacing: .04em;
}

/* ── Message section ── */
.message-section {
  background: linear-gradient(135deg, #fff0f5, var(--cream));
  border-radius: 32px;
  padding: clamp(32px, 8vw, 48px) clamp(24px, 6vw, 40px);
  margin: 24px auto 60px;
  max-width: 440px;
  border: 1.5px solid rgba(242, 164, 184, 0.2);
  box-shadow: 0 20px 60px rgba(242, 164, 184, 0.12);
  text-align: center;
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 1s var(--ease-out), transform 1s var(--ease-out);
}
.message-section.visible { opacity: 1; transform: none; }
.big-emoji {
  font-size: 48px;
  margin-bottom: 12px;
  display: block;
  animation: float 4s ease-in-out infinite;
}
.message-text {
  font-family: 'Playfair Display', serif;
  font-size: clamp(18px, 5.5vw, 24px);
  color: var(--deep);
  line-height: 1.6;
  font-style: italic;
  margin-bottom: 12px;
}
.message-sig { font-size: 13px; color: var(--rose); font-weight: 600; }

/* ── Footer ── */
footer {
  text-align: center;
  padding: 36px 20px 56px;
  font-size: 13px;
  color: var(--muted);
  position: relative;
  z-index: 2;
  letter-spacing: .05em;
}
.footer-hearts {
  font-size: 20px;
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 8px;
}
.footer-hearts span { animation: heartbeat 1.6s ease infinite; }
.footer-hearts span:nth-child(2) { animation-delay: .5s; }
.footer-hearts span:nth-child(3) { animation-delay: 1s; }
@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.25); }
}

/* ── Divider ── */
.divider {
  text-align: center;
  padding: 8px;
  font-size: 16px;
  opacity: .4;
  position: relative;
  z-index: 2;
  letter-spacing: 6px;
}

/* ── Heart particles on tap ── */
.heart-particle {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  font-size: 18px;
  transform-origin: center;
  animation: heart-fly 1.2s ease forwards;
}
@keyframes heart-fly {
  0%   { opacity: 1; transform: translate(0,0) scale(.5); }
  70%  { opacity: .8; transform: translate(var(--dx), var(--dy)) scale(1.15); }
  100% { opacity: 0; transform: translate(calc(var(--dx) * 1.3), calc(var(--dy) * 1.5)) scale(.55); }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001s !important;
    transition-duration: .15s !important;
  }
  .aura, .hero-emoji, .big-emoji, .footer-hearts span, .scroll-arrow {
    animation: none !important;
  }
}
