/* ===========================================
   For Jaanpakhi — A Love Letter Made of Code
   Aesthetic: editorial-romance, mobile-first
   =========================================== */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400;1,500&family=Fraunces:ital,opsz,wght@0,9..144,300;0,9..144,400;0,9..144,500;0,9..144,600;1,9..144,400&family=Caveat:wght@400;500;600&display=swap');

:root {
  --paper:      #F8F1E5;
  --paper-soft: #FAF6EC;
  --paper-deep: #F0E7D6;
  --ink:        #2A1E1B;
  --ink-soft:   #5C4A44;
  --ink-faint:  #8B786E;
  --wine:       #6B1A2A;
  --wine-deep:  #4A0F1D;
  --rose:       #C19594;
  --gold:       #B89968;
  --gold-soft:  #D4BB8C;
  --lily:       #FEFCF7;
  --whisper:    rgba(107, 26, 42, 0.08);
  --whisper-2:  rgba(107, 26, 42, 0.16);
  --shadow-1:   0 2px 8px rgba(42, 30, 27, 0.06);
  --shadow-2:   0 12px 36px rgba(42, 30, 27, 0.12);
  --shadow-3:   0 24px 60px rgba(42, 30, 27, 0.18);
}

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

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

body {
  background: var(--paper);
  color: var(--ink);
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 400;
  font-size: 17px;
  line-height: 1.7;
  overflow-x: hidden;
  font-feature-settings: 'liga', 'kern';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Subtle paper grain texture using SVG noise */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.35;
  z-index: 1;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 240 240' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' /%3E%3CfeColorMatrix values='0 0 0 0 0.165 0 0 0 0 0.118 0 0 0 0 0.106 0 0 0 0.06 0' /%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' /%3E%3C/svg%3E");
}

/* Soft warm vignette */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(ellipse at top, transparent 30%, rgba(107, 26, 42, 0.04) 100%);
}

/* ============== Typography ============== */
h1, h2, h3, .display {
  font-family: 'Cormorant Garamond', 'Times New Roman', serif;
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.15;
  color: var(--ink);
}

h1 { font-size: clamp(2.4rem, 9vw, 4.2rem); font-weight: 300; }
h2 { font-size: clamp(1.9rem, 7vw, 2.8rem); font-weight: 400; }
h3 { font-size: clamp(1.3rem, 5vw, 1.7rem); font-weight: 500; }

.italic { font-style: italic; }
.serif-italic {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-weight: 400;
}

.handwritten {
  font-family: 'Caveat', cursive;
  font-weight: 500;
}

.eyebrow {
  font-family: 'Fraunces', serif;
  font-size: 0.72rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 500;
}

.caption {
  font-family: 'Caveat', cursive;
  font-size: 1.2rem;
  color: var(--ink-soft);
  line-height: 1.4;
}

/* ============== Layout ============== */
main {
  position: relative;
  z-index: 2;
}

.scene {
  padding: 6rem 1.5rem;
  max-width: 540px;
  margin: 0 auto;
  position: relative;
}

.scene-narrow {
  max-width: 460px;
}

.scene-divider {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--gold);
  font-size: 1.6rem;
  letter-spacing: 0.6em;
}

/* ============== Lily decorative SVG ============== */
.lily-mark {
  display: block;
  margin: 2rem auto;
  width: 48px;
  height: 48px;
  opacity: 0.7;
}

.lily-mark.large {
  width: 72px;
  height: 72px;
}

/* ============== HERO ============== */
.hero {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 4rem 1.5rem;
  position: relative;
}

.hero-eyebrow {
  margin-bottom: 2.5rem;
  opacity: 0;
  animation: fadeUp 1.2s ease-out 0.3s forwards;
}

.hero-name {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-weight: 300;
  font-size: clamp(3.6rem, 16vw, 6rem);
  color: var(--wine);
  line-height: 1;
  margin-bottom: 1.5rem;
  opacity: 0;
  animation: fadeUp 1.6s ease-out 0.7s forwards;
}

.hero-tagline {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-weight: 300;
  font-size: 1.25rem;
  color: var(--ink-soft);
  margin-bottom: 4rem;
  max-width: 320px;
  line-height: 1.5;
  opacity: 0;
  animation: fadeUp 1.6s ease-out 1.4s forwards;
}

.counter {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 2rem;
  opacity: 0;
  animation: fadeUp 1.6s ease-out 2.1s forwards;
}

.counter-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 64px;
}

.counter-num {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 400;
  font-size: clamp(2rem, 8vw, 2.6rem);
  color: var(--wine);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.counter-label {
  font-family: 'Fraunces', serif;
  font-size: 0.6rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-top: 0.5rem;
}

.counter-since {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 0.95rem;
  color: var(--ink-faint);
  opacity: 0;
  animation: fadeUp 1.6s ease-out 2.4s forwards;
}

.scroll-cue {
  position: absolute;
  bottom: 2.5rem;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Caveat', cursive;
  font-size: 1rem;
  color: var(--gold);
  opacity: 0;
  animation: fadeIn 2s ease-out 3s forwards, bob 2.6s ease-in-out 4s infinite;
}

/* ============== Section openers ============== */
.scene-eyebrow {
  text-align: center;
  margin-bottom: 1.2rem;
}

.scene-title {
  text-align: center;
  margin-bottom: 1rem;
}

.scene-date {
  text-align: center;
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  color: var(--ink-faint);
  font-size: 1rem;
  margin-bottom: 3rem;
  letter-spacing: 0.04em;
}

.prose {
  font-size: 1.05rem;
  line-height: 1.75;
  color: var(--ink);
  margin-bottom: 1.4rem;
}

.prose-faint {
  color: var(--ink-soft);
}

/* ============== Chat bubbles ============== */
.chat {
  margin: 2.5rem 0;
}

.bubble {
  max-width: 78%;
  padding: 0.85rem 1.1rem;
  border-radius: 1.2rem;
  margin-bottom: 0.6rem;
  font-size: 1rem;
  line-height: 1.5;
  font-family: 'Fraunces', serif;
  position: relative;
  box-shadow: var(--shadow-1);
}

.bubble.him {
  background: var(--wine);
  color: var(--lily);
  margin-left: auto;
  border-bottom-right-radius: 0.4rem;
}

.bubble.her {
  background: var(--paper-soft);
  color: var(--ink);
  border: 1px solid var(--whisper);
  border-bottom-left-radius: 0.4rem;
}

.bubble-time {
  font-family: 'Fraunces', serif;
  font-size: 0.7rem;
  color: var(--ink-faint);
  letter-spacing: 0.06em;
  margin-bottom: 0.3rem;
  padding: 0 0.4rem;
}

.bubble-time.him { text-align: right; }

/* ============== Pull-quote (for big moments) ============== */
.pullquote {
  margin: 3rem 0;
  padding: 2.5rem 1.5rem;
  text-align: center;
  border-top: 1px solid var(--whisper);
  border-bottom: 1px solid var(--whisper);
  position: relative;
}

.pullquote::before {
  content: '"';
  position: absolute;
  top: -0.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--paper);
  padding: 0 1rem;
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 2.5rem;
  color: var(--gold);
  line-height: 1;
}

.pullquote-text {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: clamp(1.25rem, 5.5vw, 1.6rem);
  font-weight: 400;
  color: var(--wine);
  line-height: 1.4;
  letter-spacing: -0.005em;
  margin-bottom: 0.8rem;
}

.pullquote-cite {
  font-family: 'Fraunces', serif;
  font-size: 0.72rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* ============== Silence section (the gap) ============== */
.silence {
  padding: 6rem 1.5rem;
  text-align: center;
  background: linear-gradient(180deg, var(--paper) 0%, var(--paper-deep) 50%, var(--paper) 100%);
}

.silence-day {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  color: var(--ink-faint);
  font-size: 1rem;
  margin: 0.5rem 0;
  opacity: 0.4;
}

.silence-day.bold {
  color: var(--wine);
  font-style: normal;
  font-size: 1.15rem;
  font-weight: 500;
  opacity: 0.85;
  margin: 1rem 0;
  letter-spacing: 0.06em;
}

/* ============== Photos / Polaroids ============== */
.photo {
  margin: 2.5rem auto;
  max-width: 360px;
  position: relative;
}

.photo-frame {
  background: var(--lily);
  padding: 0.8rem 0.8rem 0.6rem;
  box-shadow: var(--shadow-2);
  transform: rotate(-1deg);
  transition: transform 0.6s ease, box-shadow 0.6s ease;
}

.photo-frame.tilt-r {
  transform: rotate(1.5deg);
}

.photo-frame.tilt-r2 {
  transform: rotate(2deg);
}

.photo-frame.tilt-l2 {
  transform: rotate(-2deg);
}

.photo-frame.tilt-l3 {
  transform: rotate(-3deg);
}

.photo-frame img {
  display: block;
  width: 100%;
  height: auto;
  background: var(--paper-deep);
}

.photo-caption {
  font-family: 'Caveat', cursive;
  font-size: 1.15rem;
  color: var(--ink);
  text-align: center;
  margin-top: 0.6rem;
  padding: 0 0.4rem 0.2rem;
  line-height: 1.3;
}

.photo-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
  margin: 2rem 0;
}

@media (min-width: 480px) {
  .photo-grid {
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
  }
  .photo-grid .photo {
    margin: 0;
    max-width: 100%;
  }
}

/* ============== Stats / By the Numbers ============== */
.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2rem;
  margin: 2.5rem 0;
}

.stat {
  background: var(--paper-soft);
  border: 1px solid var(--whisper);
  padding: 1.6rem 1rem;
  text-align: center;
  border-radius: 4px;
  position: relative;
}

.stat-num {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 400;
  font-size: clamp(1.8rem, 7vw, 2.2rem);
  color: var(--wine);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.stat-label {
  font-family: 'Fraunces', serif;
  font-size: 0.66rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-top: 0.7rem;
  line-height: 1.3;
}

.stat-full {
  grid-column: 1 / -1;
  background: var(--wine);
  color: var(--lily);
  border-color: transparent;
}

.stat-full .stat-num,
.stat-full .stat-label {
  color: var(--lily);
}

.stat-full .stat-label {
  opacity: 0.75;
}

/* ============== Glossary (Our Language) ============== */
.glossary-item {
  border-top: 1px solid var(--whisper);
  padding: 1.6rem 0;
}

.glossary-item:last-child {
  border-bottom: 1px solid var(--whisper);
}

.glossary-term {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 1.5rem;
  color: var(--wine);
  margin-bottom: 0.6rem;
  letter-spacing: -0.005em;
}

.glossary-def {
  font-family: 'Fraunces', serif;
  font-size: 0.98rem;
  line-height: 1.65;
  color: var(--ink-soft);
}

.glossary-source {
  display: block;
  font-family: 'Fraunces', serif;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-top: 0.6rem;
  font-style: normal;
  opacity: 0.8;
}

/* ============== Names section ============== */
.name-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  justify-content: center;
  margin: 2rem 0;
}

.name-pill {
  background: var(--paper-soft);
  border: 1px solid var(--whisper-2);
  border-radius: 999px;
  padding: 0.5rem 1.1rem;
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 1rem;
  color: var(--wine);
  letter-spacing: 0.01em;
}

.name-pill .count {
  font-family: 'Fraunces', serif;
  font-style: normal;
  font-size: 0.7rem;
  color: var(--ink-faint);
  margin-left: 0.4rem;
  letter-spacing: 0.06em;
}

.name-pill.special {
  background: var(--wine);
  color: var(--lily);
  border-color: var(--wine);
  font-size: 1.15rem;
}

.name-pill.special .count {
  color: var(--gold-soft);
}

/* ============== The Letter ============== */
.letter {
  background: var(--lily);
  border: 1px solid var(--whisper);
  padding: 2.5rem 1.8rem;
  margin: 3rem 0;
  box-shadow: var(--shadow-2);
  position: relative;
}

.letter::before,
.letter::after {
  content: '';
  position: absolute;
  width: 24px;
  height: 24px;
  border: 1.5px solid var(--gold);
  opacity: 0.6;
}

.letter::before {
  top: 0.6rem;
  left: 0.6rem;
  border-right: none;
  border-bottom: none;
}

.letter::after {
  bottom: 0.6rem;
  right: 0.6rem;
  border-left: none;
  border-top: none;
}

.letter-greeting {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 1.5rem;
  color: var(--wine);
  margin-bottom: 1.8rem;
  text-align: center;
  line-height: 1.3;
}

.letter-body {
  font-family: 'Fraunces', serif;
  font-size: 1.02rem;
  line-height: 1.85;
  color: var(--ink);
  text-align: justify;
  text-justify: inter-word;
  hyphens: auto;
}

.letter-sig {
  margin-top: 2rem;
  text-align: right;
  font-family: 'Caveat', cursive;
  font-size: 1.6rem;
  color: var(--wine);
}

.letter-date {
  text-align: right;
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 0.92rem;
  color: var(--ink-faint);
  margin-top: 0.4rem;
}

/* ============== Closing ============== */
.closing {
  padding: 6rem 1.5rem 4rem;
  text-align: center;
  max-width: 480px;
  margin: 0 auto;
}

.closing-line {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: clamp(1.4rem, 6vw, 1.9rem);
  color: var(--wine);
  line-height: 1.4;
  margin-bottom: 2rem;
}

.closing-counter {
  font-family: 'Cormorant Garamond', serif;
  font-size: 0.95rem;
  color: var(--ink-faint);
  font-style: italic;
  margin-bottom: 3rem;
}

.closing-counter strong {
  color: var(--wine);
  font-style: normal;
  font-weight: 500;
}

.closing-sig {
  font-family: 'Caveat', cursive;
  font-size: 1.4rem;
  color: var(--ink-soft);
}

footer {
  padding: 2rem 1.5rem 3rem;
  text-align: center;
  font-family: 'Fraunces', serif;
  font-size: 0.7rem;
  color: var(--ink-faint);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0.6;
}

footer span { color: var(--wine); }

/* ============== Animations ============== */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes bob {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, 8px); }
}

/* Scroll-reveal */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 1.2s ease-out, transform 1.2s ease-out;
}

.reveal.in {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger for children */
.reveal-stagger > * {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 1s ease-out, transform 1s ease-out;
}

.reveal-stagger.in > *:nth-child(1) { transition-delay: 0.05s; opacity: 1; transform: translateY(0); }
.reveal-stagger.in > *:nth-child(2) { transition-delay: 0.18s; opacity: 1; transform: translateY(0); }
.reveal-stagger.in > *:nth-child(3) { transition-delay: 0.31s; opacity: 1; transform: translateY(0); }
.reveal-stagger.in > *:nth-child(4) { transition-delay: 0.44s; opacity: 1; transform: translateY(0); }
.reveal-stagger.in > *:nth-child(5) { transition-delay: 0.57s; opacity: 1; transform: translateY(0); }
.reveal-stagger.in > *:nth-child(6) { transition-delay: 0.70s; opacity: 1; transform: translateY(0); }
.reveal-stagger.in > *:nth-child(7) { transition-delay: 0.83s; opacity: 1; transform: translateY(0); }
.reveal-stagger.in > *:nth-child(8) { transition-delay: 0.96s; opacity: 1; transform: translateY(0); }

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============== GATE ============== */
.gate {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 4rem 1.5rem;
  max-width: 460px;
  margin: 0 auto;
  position: relative;
}

.gate-eyebrow {
  margin-bottom: 1.8rem;
  opacity: 0;
  animation: fadeUp 1.2s ease-out 0.2s forwards;
}

.gate-title {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 300;
  font-size: clamp(2rem, 8vw, 2.8rem);
  color: var(--ink);
  line-height: 1.2;
  margin-bottom: 1.2rem;
  letter-spacing: -0.005em;
  opacity: 0;
  animation: fadeUp 1.4s ease-out 0.5s forwards;
}

.gate-title em {
  color: var(--wine);
}

.gate-sub {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 1.05rem;
  color: var(--ink-soft);
  margin-bottom: 3rem;
  opacity: 0;
  animation: fadeUp 1.4s ease-out 0.9s forwards;
}

.gate-form {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  width: 100%;
  max-width: 380px;
  margin: 0 auto 1.5rem;
  opacity: 0;
  animation: fadeUp 1.4s ease-out 1.3s forwards;
}

.gate-option {
  background: var(--lily);
  border: 1px solid var(--whisper-2);
  padding: 1.1rem 1.4rem;
  font-family: 'Fraunces', serif;
  cursor: pointer;
  text-align: left;
  border-radius: 4px;
  transition: all 0.4s ease;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
  box-shadow: var(--shadow-1);
  -webkit-tap-highlight-color: transparent;
}

.gate-option:hover,
.gate-option:focus-visible {
  background: var(--paper-soft);
  border-color: var(--gold);
  transform: translateY(-2px);
  box-shadow: var(--shadow-2);
  outline: none;
}

.gate-option:active {
  transform: translateY(0);
  background: var(--paper-deep);
}

.gate-song {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 1.4rem;
  color: var(--wine);
  font-weight: 500;
  letter-spacing: -0.005em;
  line-height: 1.1;
}

.gate-artist {
  font-family: 'Fraunces', serif;
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 400;
}

.gate-error {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 1.05rem;
  color: var(--wine);
  margin-top: 1.5rem;
  padding: 1rem 1.4rem;
  border-top: 1px solid var(--whisper);
  border-bottom: 1px solid var(--whisper);
  animation: fadeIn 0.6s ease-out;
}

/* Larger screens — keep mobile-first feel but center nicely */
@media (min-width: 720px) {
  body { font-size: 18px; }
  .scene { padding: 8rem 2rem; }
}
