:root {
  --paper: #f3ece0;
  --paper-2: #ebe2d2;
  --ink: #1c1814;
  --muted: #6b5f52;
  --accent: #a63d2f;
  --sage: #5a6b58;
  --rule: rgba(28, 24, 20, 0.18);
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Work Sans', system-ui, -apple-system, sans-serif;
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* paper grain via subtle noise overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.35;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.1  0 0 0 0 0.08  0 0 0 0 0.06  0 0 0 0.6 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

#bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.5;
}

.page {
  position: relative;
  z-index: 1;
  max-width: 40rem;
  margin: 0 auto;
  padding: 0 1.25rem 4rem;
}

/* MASTHEAD */
.masthead {
  display: flex;
  justify-content: space-between;
  padding: 1.25rem 0 0.75rem;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--rule);
}

/* HERO */
.hero {
  padding: 3rem 0 2.5rem;
}

.kicker {
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 1rem;
}

.headline {
  font-family: 'Fraunces', serif;
  font-weight: 400;
  font-size: clamp(2.6rem, 11vw, 4.2rem);
  line-height: 1.05;
  margin: 0 0 1.25rem;
  letter-spacing: -0.01em;
}

.headline em {
  font-style: italic;
  font-weight: 400;
  color: var(--accent);
}

.lede {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: 1.15rem;
  color: var(--muted);
  max-width: 30rem;
  margin: 0 0 0.75rem;
}

.sig-hand {
  font-family: 'Caveat', cursive;
  font-size: 1.5rem;
  color: var(--ink);
  margin: 0 0 2rem;
  transform: rotate(-2deg);
  display: inline-block;
}

/* HERO PHOTO (overlapping card) */
.hero-photo {
  margin: 0 0 2rem;
  width: 62%;
  max-width: 16rem;
  margin-left: auto;
  background: #fff;
  padding: 0.5rem 0.5rem 1.8rem;
  box-shadow: 0 10px 24px rgba(28,24,20,0.18);
  transform: rotate(4deg);
  position: relative;
}
.hero-photo::after {
  content: '';
  position: absolute;
  top: -0.6rem;
  right: 1.2rem;
  width: 2.6rem;
  height: 0.9rem;
  background: rgba(243, 236, 224, 0.9);
  border: 1px solid rgba(28,24,20,0.15);
  transform: rotate(-6deg);
}
.hero-photo .ph { aspect-ratio: 4/5; }
.hero-photo figcaption {
  text-align: center;
  font-family: 'Caveat', cursive;
  font-size: 1rem;
  color: var(--ink);
  margin-top: 0.5rem;
}

/* COUNTDOWN wrap (dark ticket) */
.countdown-wrap {
  background: var(--ink);
  color: var(--paper);
  padding: 1.25rem 1rem;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
  position: relative;
}
.countdown-wrap::before {
  content: 'vé vào cửa';
  position: absolute;
  top: -0.7rem;
  left: 1rem;
  background: var(--accent);
  color: var(--paper);
  font-size: 0.65rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 0.2rem 0.6rem;
  border-radius: 0.2rem;
}
.countdown-wrap .stamp {
  background: rgba(243, 236, 224, 0.08);
  border-color: rgba(243, 236, 224, 0.4);
  color: var(--paper);
}
.countdown-wrap .stamp span { color: var(--paper); }
.countdown-wrap .stamp small { color: rgba(243, 236, 224, 0.6); }
.countdown-wrap .cd-note { color: rgba(243, 236, 224, 0.7); }

/* COUNTDOWN stamps */
.countdown {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.stamp {
  border: 1.5px dashed var(--ink);
  border-radius: 0.35rem;
  padding: 0.5rem 0.7rem;
  min-width: 3.6rem;
  text-align: center;
  background: var(--paper-2);
  transform: rotate(-1deg);
}

.stamp:nth-child(2) { transform: rotate(1.5deg); }
.stamp:nth-child(3) { transform: rotate(-0.5deg); }
.stamp:nth-child(4) { transform: rotate(2deg); }

.stamp span {
  display: block;
  font-family: 'Fraunces', serif;
  font-size: 1.6rem;
  line-height: 1;
}

.stamp small {
  display: block;
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 0.2rem;
}

.cd-note {
  font-family: 'Caveat', cursive;
  font-size: 1.2rem;
  color: var(--muted);
  margin: 0.75rem 0 1.5rem;
}

.music-btn {
  appearance: none;
  background: none;
  border: 1px solid var(--ink);
  color: var(--ink);
  padding: 0.5rem 1.1rem;
  border-radius: 999px;
  font-family: 'Work Sans', sans-serif;
  font-size: 0.85rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.music-btn:hover { background: var(--ink); color: var(--paper); }

/* RULE */
.rule {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 0;
}

/* SECTIONS */
.section {
  padding: 3rem 0;
}

.section-title {
  font-family: 'Fraunces', serif;
  font-size: clamp(1.7rem, 7vw, 2.3rem);
  margin: 0 0 0.35rem;
  font-weight: 400;
}

.section-sub {
  font-family: 'Caveat', cursive;
  font-size: 1.15rem;
  color: var(--muted);
  margin: 0 0 1.75rem;
}

/* TIMELINE */
.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 1px dashed var(--rule);
  padding-left: 1.25rem;
}

.timeline li {
  position: relative;
  padding: 0.85rem 0;
  display: grid;
  grid-template-columns: 2rem 1fr;
  gap: 0.75rem;
  align-items: baseline;
}

.timeline li::before {
  content: '';
  position: absolute;
  left: -1.55rem;
  top: 1.35rem;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--paper);
  border: 1.5px solid var(--ink);
}

.yr {
  font-family: 'Fraunces', serif;
  font-size: 1.05rem;
  color: var(--accent);
  font-style: italic;
}

.timeline h3 {
  margin: 0 0 0.2rem;
  font-family: 'Fraunces', serif;
  font-size: 1.1rem;
  font-weight: 600;
}

.timeline p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

/* COLLAGE */
.collage {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem 1rem;
  align-items: start;
}
.collage .photo:nth-child(1) { grid-column: span 2; transform: rotate(-1.5deg); }
.collage .photo:nth-child(1) .ph { aspect-ratio: 16/9; }

.photo {
  margin: 0;
  background: #fff;
  padding: 0.5rem 0.5rem 1.6rem;
  box-shadow: 0 6px 18px rgba(28,24,20,0.12);
  transform: rotate(var(--r, 0deg));
  position: relative;
}

/* tape */
.photo::before {
  content: '';
  position: absolute;
  top: -0.5rem;
  left: 50%;
  transform: translateX(-50%) rotate(-3deg);
  width: 3.2rem;
  height: 1rem;
  background: rgba(243, 236, 224, 0.85);
  border: 1px solid rgba(28,24,20,0.15);
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

.ph {
  aspect-ratio: 4 / 3;
  background: linear-gradient(135deg, #e8ddc8, #d9ccaf);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-family: 'Caveat', cursive;
  font-size: 1.1rem;
}

.photo figcaption {
  margin: 0.5rem 0 0;
  text-align: center;
  font-family: 'Caveat', cursive;
  font-size: 1rem;
  color: var(--ink);
}

.hint {
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 1.5rem;
  font-style: italic;
}

/* LETTER */
.letter {
  border: 1px solid var(--rule);
  padding: 1.6rem 1.5rem;
  background: var(--paper-2);
  font-family: 'Fraunces', serif;
  font-size: 1.12rem;
  line-height: 1.7;
}

.letter p { margin: 0 0 1rem; }
.letter .sig {
  text-align: right;
  font-family: 'Caveat', cursive;
  font-size: 1.4rem;
  color: var(--accent);
  margin-top: 1rem;
}

/* DARK SECTION */
.section-dark {
  background: var(--ink);
  color: var(--paper);
  margin: 0 -1.25rem;
  padding: 3rem 2.5rem;
}
.section-dark .section-title {
  color: var(--paper);
}
.section-dark .section-sub { color: rgba(243,236,224,0.6); }
.section-dark .letter {
  background: rgba(243,236,224,0.06);
  border-color: rgba(243,236,224,0.2);
  color: var(--paper);
}
.section-dark .letter .sig { color: #ffd6a5; }

/* DOODLE underline on first section title */
.section-title {
  position: relative;
  display: inline-block;
}
.section > .section-title::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -0.35rem;
  width: 60%;
  height: 0.5rem;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 12'><path d='M2 8 Q 30 2 60 7 T 118 6' stroke='%23a63d2f' stroke-width='2.5' fill='none' stroke-linecap='round'/></svg>") no-repeat;
  background-size: 100% 100%;
}

/* Drop cap for letter first paragraph */
.letter p:first-of-type::first-letter {
  font-family: 'Fraunces', serif;
  font-size: 3.2rem;
  line-height: 0.9;
  float: left;
  padding: 0.3rem 0.6rem 0 0;
  color: var(--accent);
  font-style: italic;
}

/* FOOTER */
.footer {
  text-align: center;
  padding: 2.5rem 0 1rem;
  color: var(--muted);
  font-size: 0.8rem;
  font-family: 'Caveat', cursive;
  font-size: 1.05rem;
}

/* Touch & media */
button, .music-btn { touch-action: manipulation; }
img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 0.2rem; }

.teaser {
  font-family: 'Caveat', cursive;
  font-size: 1.1rem;
  color: var(--muted);
  margin: 0.5rem 0 1.5rem;
}

/* Reveal on anniversary day */
#reveal { animation: revealIn 0.7s ease both; }
@keyframes revealIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}

/* Mobile: drop fixed layers for smoother scroll on iOS Safari/Chrome */
@media (max-width: 768px) {
  #bg { display: none; }
  body::before { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  body::before { display: none; }
}
