/* ==========================================================
   Design tokens
========================================================== */
:root {
  --ivory: #FAF6EF;
  --ivory-deep: #F1EADD;
  --sage: #4F5F44;
  --sage-light: #8CA07E;
  --sage-pale: #E7EBE1;
  --gold: #B4915A;
  --gold-light: #D9C39B;
  --charcoal: #2E2B26;
  --charcoal-soft: #5C574E;
  --white: #FFFFFF;

  --font-display-th: 'Noto Serif Thai', serif;
  --font-display-en: 'Cormorant Garamond', serif;
  --font-body: 'Sarabun', sans-serif;

  --radius: 4px;
  --max-width: 720px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--ivory);
  color: var(--charcoal);
  font-family: var(--font-body);
  font-weight: 300;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }

/* ==========================================================
   Shared type + section rhythm
========================================================== */
.eyebrow {
  font-family: var(--font-display-en);
  font-style: italic;
  font-size: 15px;
  letter-spacing: 0.14em;
  color: var(--gold);
  text-transform: lowercase;
  margin: 0 0 8px;
}
.eyebrow.center { text-align: center; }

.section-title {
  font-family: var(--font-display-th);
  font-weight: 500;
  font-size: 30px;
  color: var(--charcoal);
  margin: 0 0 40px;
}
.section-title.center { text-align: center; }

.section-sub {
  color: var(--charcoal-soft);
  font-size: 15px;
  margin: -24px 0 36px;
}
.section-sub.center { text-align: center; }

section {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 96px 28px;
}

.branch-divider { width: 160px; margin: 0 auto 32px; color: var(--sage-light); opacity: 0.7; }
.branch-divider.top { margin-bottom: 24px; }
.branch-divider svg { width: 100%; height: auto; }

/* ==========================================================
   1. Cover
========================================================== */
.cover {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at top, var(--ivory-deep) 0%, var(--ivory) 60%);
  transition: opacity 0.9s ease, visibility 0.9s ease;
}
.cover.is-closing { opacity: 0; visibility: hidden; pointer-events: none; }

.cover-frame {
  text-align: center;
  padding: 40px;
  animation: fadeUp 1.1s ease both;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

.cover-monogram { width: 96px; height: 96px; color: var(--gold); margin-bottom: 20px; }
.monogram-text {
  font-family: var(--font-display-th);
  font-size: 30px;
  fill: currentColor;
}

.cover-eyebrow {
  font-family: var(--font-display-en);
  font-style: italic;
  letter-spacing: 0.2em;
  color: var(--sage-light);
  font-size: 14px;
  margin: 0 0 18px;
  text-transform: lowercase;
}

.cover-names {
  font-family: var(--font-display-th);
  font-weight: 500;
  font-size: 44px;
  color: var(--charcoal);
  margin: 0 0 10px;
}
.cover-names .amp {
  font-family: var(--font-display-en);
  font-style: italic;
  color: var(--gold);
  font-weight: 400;
}

.cover-date {
  font-family: var(--font-display-en);
  font-size: 18px;
  letter-spacing: 0.06em;
  color: var(--charcoal-soft);
  margin: 0 0 40px;
}

.btn-open {
  border: 1px solid var(--gold);
  background: transparent;
  color: var(--charcoal);
  padding: 14px 40px;
  font-family: var(--font-display-th);
  font-size: 15px;
  letter-spacing: 0.05em;
  border-radius: 999px;
  transition: background 0.3s ease, color 0.3s ease;
}
.btn-open:hover { background: var(--gold); color: var(--white); }

/* ==========================================================
   Main content
========================================================== */
.main-content { overflow-x: hidden; }

.reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.8s ease, transform 0.8s ease; }
.reveal.is-visible { opacity: 1; transform: translateY(0); }

/* ==========================================================
   2. Hero + countdown
========================================================== */
.hero { text-align: center; padding-top: 72px; }

.hero-names {
  font-family: var(--font-display-th);
  font-weight: 500;
  font-size: 42px;
  margin: 0 0 18px;
}
.hero-sub { color: var(--charcoal-soft); font-size: 16px; margin: 0 0 48px; }

.countdown { display: flex; justify-content: center; gap: 18px; flex-wrap: wrap; }
.cd-box {
  background: var(--white);
  border: 1px solid var(--sage-pale);
  border-radius: var(--radius);
  padding: 18px 16px;
  min-width: 76px;
}
.cd-box span {
  display: block;
  font-family: var(--font-display-en);
  font-size: 30px;
  color: var(--sage);
}
.cd-box label { font-size: 12px; color: var(--charcoal-soft); letter-spacing: 0.04em; }

/* ==========================================================
   3. Story timeline
========================================================== */
.timeline { position: relative; padding-left: 28px; border-left: 1px solid var(--sage-pale); }
.tl-item { position: relative; padding: 0 0 44px 24px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: '';
  position: absolute;
  left: -33px;
  top: 4px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--gold);
}
.tl-year {
  font-family: var(--font-display-en);
  font-style: italic;
  color: var(--gold);
  font-size: 15px;
  margin-bottom: 4px;
}
.tl-body h3 {
  font-family: var(--font-display-th);
  font-weight: 500;
  font-size: 19px;
  margin: 0 0 6px;
}
.tl-body p { margin: 0; color: var(--charcoal-soft); font-size: 15px; }

/* ==========================================================
   4. Couple note
========================================================== */
.couple-note { text-align: center; background: var(--sage-pale); max-width: 100%; }
.couple-note > * { max-width: var(--max-width); margin-left: auto; margin-right: auto; }

.note-quote {
  font-family: var(--font-display-th);
  font-size: 19px;
  line-height: 2;
  color: var(--charcoal);
  margin: 0 0 28px;
  font-weight: 400;
}
.note-signature {
  font-family: var(--font-display-en);
  font-style: italic;
  color: var(--sage);
  font-size: 16px;
}

/* ==========================================================
   5. Event details
========================================================== */
.event-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 40px;
}
.event-card {
  background: var(--white);
  border: 1px solid var(--sage-pale);
  border-radius: var(--radius);
  padding: 28px 20px;
  text-align: center;
}
.event-icon { display: inline-block; width: 30px; height: 30px; color: var(--gold); margin-bottom: 12px; }
.event-icon svg { width: 100%; height: 100%; }
.event-card h3 { font-family: var(--font-display-th); font-size: 16px; font-weight: 500; margin: 0 0 6px; }
.event-card p { margin: 0; font-size: 14px; color: var(--charcoal-soft); }

.map-link { display: block; width: fit-content; margin: 0 auto; }

/* ==========================================================
   6. Gallery
========================================================== */
.gallery-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.gallery-item { border: none; padding: 0; background: none; overflow: hidden; border-radius: var(--radius); aspect-ratio: 4/5; }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease; }
.gallery-item:hover img { transform: scale(1.05); }

.lightbox {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(46, 43, 38, 0.92);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.lightbox[hidden] { display: none; }
.lightbox img { max-height: 86vh; border-radius: var(--radius); }
.lightbox-close {
  position: absolute; top: 20px; right: 24px;
  background: none; border: none; color: var(--white);
  font-size: 32px; line-height: 1;
}

/* ==========================================================
   7 & 9. Forms (RSVP + guestbook)
========================================================== */
.form-card {
  background: var(--white);
  border: 1px solid var(--sage-pale);
  border-radius: var(--radius);
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.form-card label { font-size: 14px; color: var(--charcoal-soft); display: flex; flex-direction: column; gap: 6px; }
.form-card input,
.form-card select,
.form-card textarea {
  font-family: var(--font-body);
  font-size: 15px;
  padding: 11px 13px;
  border: 1px solid var(--sage-pale);
  border-radius: var(--radius);
  background: var(--ivory);
  color: var(--charcoal);
  resize: vertical;
}
.form-card input:focus,
.form-card select:focus,
.form-card textarea:focus {
  outline: 2px solid var(--sage-light);
  outline-offset: 1px;
}

.btn-solid, .btn-outline {
  font-family: var(--font-display-th);
  font-size: 15px;
  padding: 13px 24px;
  border-radius: 999px;
  border: 1px solid var(--sage);
  transition: background 0.25s ease, color 0.25s ease;
}
.btn-solid { background: var(--sage); color: var(--white); }
.btn-solid:hover { background: var(--charcoal); border-color: var(--charcoal); }
.btn-outline { background: transparent; color: var(--sage); }
.btn-outline:hover { background: var(--sage); color: var(--white); }

.form-status { font-size: 14px; margin: 0; min-height: 20px; color: var(--sage); }
.form-status.error { color: #B34A3E; }

/* ==========================================================
   8. Gift
========================================================== */
.gift-card {
  background: var(--white);
  border: 1px solid var(--sage-pale);
  border-radius: var(--radius);
  padding: 32px;
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.qr-box { background: var(--ivory); padding: 10px; border-radius: var(--radius); }
.qr-box img { width: 180px; height: 180px; }
.gift-name { font-family: var(--font-display-th); font-weight: 500; font-size: 17px; margin: 0 0 4px; }
.gift-account { color: var(--charcoal-soft); font-size: 14px; margin: 0 0 16px; }

/* ==========================================================
   9. Wish list
========================================================== */
.wish-list { margin-top: 32px; display: flex; flex-direction: column; gap: 14px; }
.wish-item {
  background: var(--white);
  border: 1px solid var(--sage-pale);
  border-left: 3px solid var(--gold);
  border-radius: var(--radius);
  padding: 16px 20px;
}
.wish-item .wish-name { font-family: var(--font-display-th); font-weight: 500; font-size: 15px; color: var(--sage); margin: 0 0 4px; }
.wish-item .wish-message { margin: 0; font-size: 14px; color: var(--charcoal-soft); }
.wish-empty { color: var(--charcoal-soft); font-size: 14px; text-align: center; }

/* ==========================================================
   Footer
========================================================== */
.site-footer {
  text-align: center;
  padding: 80px 28px 60px;
  color: var(--charcoal-soft);
}
.footer-monogram { width: 56px; height: 56px; color: var(--gold); margin-bottom: 16px; }
.footer-names { font-family: var(--font-display-th); font-size: 22px; color: var(--charcoal); margin: 2px 0 24px; }

/* ==========================================================
   Responsive
========================================================== */
@media (min-width: 640px) {
  .event-grid { grid-template-columns: repeat(4, 1fr); }
  .cover-names { font-size: 56px; }
  .hero-names { font-size: 52px; }
}

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