/* ============================================================= */
/*  DESIGN TOKENS                                                 */
/* ============================================================= */
:root {
  --paper:      #f6f3ec;   /* warm off-white background      */
  --paper-2:    #efeae0;   /* slightly deeper panel          */
  --ink:        #23201b;   /* near-black text                */
  --ink-soft:   #6b655b;   /* muted body / captions          */
  --line:       #d9d2c4;   /* hairline borders               */
  --accent:     #7c8768;   /* muted sage                     */
  --accent-dk:  #5f6a4e;   /* darker sage (hover)            */
  --white:      #fffdf8;

  --serif: "Fraunces", Georgia, serif;
  --sans:  "DM Sans", system-ui, sans-serif;

  --maxw: 1120px;
  --gutter: clamp(1.25rem, 5vw, 4rem);
  --radius: 4px;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:    #1a1815;
    --paper-2:  #211e1a;
    --ink:      #ece7dd;
    --ink-soft: #a49d90;
    --line:     #3a352d;
    --accent:   #9caa83;
    --accent-dk:#b3c09a;
    --white:    #242019;
  }
}

/* ============================================================= */
/*  RESET / BASE                                                 */
/* ============================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; scroll-padding-top: 5rem; }

body {
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }

::selection { background: var(--accent); color: var(--white); }

/* ============================================================= */
/*  BUTTONS                                                      */
/* ============================================================= */
.btn {
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.82rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0.95rem 2.1rem;
  border-radius: 100px;
  cursor: pointer;
  transition: all 0.3s var(--ease);
  border: 1px solid transparent;
  min-height: 44px;
}
.btn--solid   { background: var(--accent); color: var(--white); }
.btn--solid:hover   { background: var(--accent-dk); transform: translateY(-2px); }
.btn--outline { border-color: var(--ink); color: var(--ink); background: transparent; }
.btn--outline:hover { background: var(--ink); color: var(--paper); transform: translateY(-2px); }

/* ============================================================= */
/*  NAV                                                          */
/* ============================================================= */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem var(--gutter);
  background-color: var(--paper); /* solid fallback if color-mix unsupported (older iOS) */
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  -webkit-backdrop-filter: blur(12px); /* Safari / iOS */
  backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.4s var(--ease), padding 0.4s var(--ease);
}
.nav.is-scrolled { border-bottom-color: var(--line); padding-top: 0.7rem; padding-bottom: 0.7rem; }

.nav__brand {
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.nav__amp { color: var(--accent); font-style: italic; }

.nav__menu { display: flex; align-items: center; gap: 2rem; }
.nav__menu a {
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
  transition: color 0.25s var(--ease);
  position: relative;
}
.nav__menu a:hover { color: var(--ink); }
.nav__menu a:not(.nav__cta)::after {
  content: "";
  position: absolute; left: 0; bottom: -4px;
  width: 0; height: 1px; background: var(--accent);
  transition: width 0.3s var(--ease);
}
.nav__menu a:not(.nav__cta):hover::after { width: 100%; }

.nav__cta {
  border: 1px solid var(--ink);
  border-radius: 100px;
  padding: 0.5rem 1.3rem !important;
  color: var(--ink) !important;
}
.nav__cta:hover { background: var(--ink); color: var(--paper) !important; }

.nav__toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none; border: none; cursor: pointer;
  width: 44px; height: 44px;
  align-items: center; justify-content: center;
  position: relative;
  z-index: 20; /* keep the close (X) button above the open panel */
}
.nav__toggle span {
  display: block; width: 24px; height: 2px;
  background: var(--ink); transition: transform 0.3s var(--ease), opacity 0.3s var(--ease);
}
.nav.is-open .nav__toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav.is-open .nav__toggle span:nth-child(2) { opacity: 0; }
.nav.is-open .nav__toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ============================================================= */
/*  HERO                                                         */
/* ============================================================= */
.hero {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 6rem var(--gutter) 3rem;
  position: relative;
  background:
    radial-gradient(120% 80% at 50% 0%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 60%),
    var(--paper);
}
.hero__inner { max-width: 820px; }

.hero__eyebrow {
  font-size: 0.8rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 1.8rem;
}
.hero__names {
  font-family: var(--serif);
  font-weight: 300;
  line-height: 0.98;
  font-size: clamp(3.6rem, 15vw, 9rem);
  letter-spacing: -0.01em;
  display: flex;
  flex-direction: column;
}
.hero__amp {
  font-style: italic;
  color: var(--accent);
  font-size: 0.62em;
  margin: 0.1em 0;
}
.hero__meta {
  margin-top: 2rem;
  font-size: clamp(0.95rem, 2.5vw, 1.1rem);
  color: var(--ink-soft);
  letter-spacing: 0.02em;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}
.hero__dot { color: var(--accent); }

.hero .btn { margin-top: 2.6rem; }

.hero__scroll {
  position: absolute;
  bottom: 1.6rem; left: 50%;
  transform: translateX(-50%);
  font-size: 1.2rem;
  color: var(--ink-soft);
  animation: bob 2.4s ease-in-out infinite;
}
@keyframes bob { 0%,100% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, 8px); } }

/* Countdown */
.countdown {
  display: flex;
  gap: clamp(1rem, 5vw, 2.6rem);
  justify-content: center;
  margin-top: 2.8rem;
}
.countdown__unit { display: flex; flex-direction: column; align-items: center; min-width: 3.4rem; }
.countdown__unit span {
  font-family: var(--serif);
  font-size: clamp(1.7rem, 6vw, 2.6rem);
  font-weight: 400;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.countdown__unit small {
  font-size: 0.66rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-top: 0.6rem;
}

/* ============================================================= */
/*  SECTIONS (shared)                                            */
/* ============================================================= */
.section {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(4rem, 11vw, 8.5rem) var(--gutter);
}
.section__head {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: clamp(2.5rem, 6vw, 4rem);
}
.section__num {
  font-family: var(--sans);
  font-size: 0.8rem;
  letter-spacing: 0.2em;
  color: var(--accent);
  font-feature-settings: "tnum";
}
.section__title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2rem, 7vw, 3.4rem);
  letter-spacing: -0.01em;
}

/* ============================================================= */
/*  STORY                                                        */
/* ============================================================= */
.story__body { max-width: 620px; }
.story__lead {
  font-family: var(--serif);
  font-size: clamp(1.35rem, 3.5vw, 1.85rem);
  line-height: 1.4;
  font-weight: 300;
  margin-bottom: 1.5rem;
}
.story__body p { color: var(--ink-soft); }

/* ============================================================= */
/*  DETAILS                                                      */
/* ============================================================= */
.details__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}
.detail-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 2rem 1.8rem;
}
.detail-card h3 {
  font-family: var(--sans);
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 500;
  margin-bottom: 1rem;
}
.detail-card__big {
  font-family: var(--serif);
  font-size: 1.7rem;
  line-height: 1.15;
  margin-bottom: 0.7rem;
}
.detail-card p { color: var(--ink-soft); }
.detail-card__link {
  display: inline-block;
  margin-top: 1rem;
  color: var(--accent-dk);
  font-size: 0.9rem;
  letter-spacing: 0.02em;
}
.detail-card__link:hover { text-decoration: underline; }

/* ============================================================= */
/*  SCHEDULE / TIMELINE                                          */
/* ============================================================= */
.timeline { list-style: none; max-width: 680px; }
.timeline__item {
  display: grid;
  grid-template-columns: 5rem 1fr;
  gap: 1.5rem;
  padding: 1.6rem 0;
  border-top: 1px solid var(--line);
}
.timeline__item:last-child { border-bottom: 1px solid var(--line); }
.timeline__time {
  font-family: var(--serif);
  font-size: 1.05rem;
  color: var(--accent-dk);
  padding-top: 0.15rem;
  font-variant-numeric: tabular-nums;
}
.timeline__content h3 { font-family: var(--serif); font-weight: 400; font-size: 1.3rem; margin-bottom: 0.3rem; }
.timeline__content p { color: var(--ink-soft); font-size: 0.95rem; }

/* ============================================================= */
/*  GALLERY                                                      */
/* ============================================================= */
.gallery__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.9rem;
}
.gallery__item {
  border: none; padding: 0; cursor: pointer;
  background: var(--paper-2);
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 4 / 5;
}
.gallery__item img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.6s var(--ease), filter 0.6s var(--ease);
}
.gallery__item:hover img { transform: scale(1.05); filter: brightness(0.95); }

/* ============================================================= */
/*  TRAVEL                                                       */
/* ============================================================= */
.travel__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}
.travel__card {
  padding: 2rem 0;
  border-top: 1px solid var(--line);
}
.travel__card h3 { font-family: var(--serif); font-weight: 400; font-size: 1.4rem; margin-bottom: 0.8rem; }
.travel__card p { color: var(--ink-soft); margin-bottom: 0.6rem; }
.travel__card strong { color: var(--ink); font-weight: 500; }

/* ============================================================= */
/*  REGISTRY                                                     */
/* ============================================================= */
.registry__body { max-width: 620px; }
.registry__note {
  font-family: var(--serif);
  font-size: clamp(1.3rem, 3.5vw, 1.7rem);
  font-weight: 300;
  line-height: 1.4;
  margin-bottom: 2rem;
}
.registry__links { display: flex; flex-wrap: wrap; gap: 1rem; }

/* ============================================================= */
/*  RSVP                                                         */
/* ============================================================= */
.rsvp { max-width: 640px; }
.rsvp__deadline { color: var(--ink-soft); margin-bottom: 2.5rem; margin-top: -2rem; }
.rsvp__form { display: flex; flex-direction: column; gap: 1.5rem; }

.field { display: flex; flex-direction: column; gap: 0.5rem; }
.field label, .field__label {
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 500;
}
.field input,
.field select,
.field textarea {
  font-family: var(--sans);
  font-size: 1rem;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
  width: 100%;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.field textarea { resize: vertical; }

.radio-row { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 0.2rem; }
.radio {
  display: flex; align-items: center; gap: 0.55rem;
  padding: 0.75rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 100px;
  cursor: pointer;
  font-size: 0.95rem;
  text-transform: none; letter-spacing: 0; color: var(--ink);
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}
.radio:hover { border-color: var(--accent); }
.radio input { accent-color: var(--accent); width: auto; }
.radio:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }

.rsvp__submit { align-self: flex-start; margin-top: 0.5rem; }
.rsvp__status { font-size: 0.95rem; min-height: 1.2rem; }
.rsvp__status.is-ok    { color: var(--accent-dk); }
.rsvp__status.is-error { color: #b4523f; }

/* ============================================================= */
/*  FOOTER                                                       */
/* ============================================================= */
.footer {
  text-align: center;
  padding: clamp(3.5rem, 9vw, 6rem) var(--gutter);
  border-top: 1px solid var(--line);
  background: var(--paper-2);
}
.footer__names { font-family: var(--serif); font-size: 2rem; font-weight: 300; }
.footer__date { color: var(--accent-dk); letter-spacing: 0.3em; margin: 0.6rem 0 1.4rem; font-size: 0.9rem; }
.footer__q { color: var(--ink-soft); font-size: 0.9rem; }
.footer__q a { color: var(--accent-dk); }
.footer__q a:hover { text-decoration: underline; }

/* ============================================================= */
/*  LIGHTBOX                                                     */
/* ============================================================= */
.lightbox {
  position: fixed; inset: 0;
  background: color-mix(in srgb, #0d0b08 88%, transparent);
  display: flex; align-items: center; justify-content: center;
  padding: 2rem;
  opacity: 0; pointer-events: none;
  transition: opacity 0.35s var(--ease);
  z-index: 200;
}
.lightbox.is-open { opacity: 1; pointer-events: auto; }
.lightbox img { max-width: 92vw; max-height: 88vh; border-radius: var(--radius); box-shadow: 0 20px 60px rgba(0,0,0,0.5); }
.lightbox__close {
  position: absolute; top: 1.2rem; right: 1.6rem;
  font-size: 2.4rem; line-height: 1;
  color: #fff; background: none; border: none; cursor: pointer;
  width: 44px; height: 44px;
}

/* ============================================================= */
/*  SCROLL REVEAL                                                */
/* ============================================================= */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
.reveal.is-visible { opacity: 1; transform: none; }

/* ============================================================= */
/*  RESPONSIVE                                                   */
/* ============================================================= */
@media (min-width: 640px) {
  .details__grid { grid-template-columns: repeat(3, 1fr); }
  .gallery__grid {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-flow: dense;
  }
  .gallery__item--wide { grid-column: span 2; aspect-ratio: 3 / 2; }
  .travel__grid { grid-template-columns: repeat(3, 1fr); }
  .travel__card { padding: 0; border-top: none; }
}

@media (min-width: 900px) {
  .gallery__grid { grid-template-columns: repeat(3, 1fr); }
  .gallery__item--wide { grid-column: span 2; }
}

/* Mobile nav */
@media (max-width: 760px) {
  .nav__toggle { display: flex; }
  .nav__menu {
    position: fixed;
    top: 0;
    right: 0;
    /* Explicit viewport height — do NOT rely on bottom:0, because the nav's
       backdrop-filter makes it the containing block for this fixed panel. */
    height: 100vh;
    height: 100dvh; /* dynamic vh: correct with iOS Safari's collapsing toolbar */
    width: min(78vw, 320px);
    z-index: 10;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 1.8rem;
    padding: 2rem 2.4rem;
    background: var(--paper);
    border-left: 1px solid var(--line);
    transform: translateX(100%);
    transition: transform 0.4s var(--ease);
  }
  .nav.is-open .nav__menu { transform: translateX(0); }
  .nav__menu a { font-size: 1.15rem; color: var(--ink); }
  .nav__cta { align-self: flex-start; }
}

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