/* ===== Tokens ===== */
:root {
  --bg:        #ffffff;
  --ink:       #5b6591;
  --ink-soft:  #7d86a8;
  --muted:     #9aa0b8;
  --accent:    #8a3b52;
  --line:      #e7e9f0;
  --panel:     #f7f8fb;
  --serif:  "EB Garamond", Georgia, serif;
  --script: "Sacramento", cursive;
  --ease:   cubic-bezier(.22,.61,.36,1);
}

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

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;              /* the deck scrolls, not the body */
}
em { font-style: italic; }

/* ===== Full-page scroll deck ===== */
.deck {
  height: 100dvh;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;
}
.deck::-webkit-scrollbar { display: none; }

.panel {
  height: 100dvh;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6rem clamp(1.5rem, 6vw, 6rem) 4rem;
  position: relative;
}
.panel--center { flex-direction: column; }

/* ===== Top bar ===== */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 40;
  display: flex; align-items: center; gap: 1.1rem;
  padding: 1rem 1.5rem;
  background: rgba(255,255,255,.82);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar__title { font-family: var(--script); font-size: 1.75rem; color: var(--ink); text-decoration: none; line-height: 1; }
.topbar__sep { opacity: 1; }
.topbar__date { font-size: 1.2rem; }
.menu-btn { display: flex; flex-direction: column; gap: 4px; background: none; border: none; cursor: pointer; padding: 4px; }
.menu-btn span { width: 24px; height: 2px; background: var(--ink); display: block; transition: background .2s; }

/* ===== Drawer ===== */
.drawer {
  position: fixed; inset: 0 auto 0 0; z-index: 60;
  width: 300px; max-width: 80vw; background: #fff;
  border-right: 1px solid var(--line);
  transform: translateX(-100%); transition: transform .35s var(--ease);
  padding: 5rem 2rem 2rem;
}
.drawer.open { transform: none; }
.drawer ul { list-style: none; }
.drawer li { border-bottom: 1px solid var(--line); }
.drawer a { display: block; padding: .85rem 0; color: var(--ink); text-decoration: none; font-size: 1.1rem; cursor: pointer; }
.drawer a:hover { color: var(--accent); }
.drawer__close { position: absolute; top: 1rem; right: 1.2rem; background: none; border: none; font-size: 2rem; color: var(--ink); cursor: pointer; line-height: 1; }
.scrim { position: fixed; inset: 0; z-index: 55; background: rgba(40,44,66,.35); }

/* ===== Side dot nav ===== */
.dots {
  position: fixed; right: 1.4rem; top: 50%; transform: translateY(-50%);
  z-index: 40; display: flex; flex-direction: column; gap: .85rem;
}
.dot {
  width: 10px; height: 10px; border-radius: 50%; padding: 0;
  border: 1.5px solid var(--ink-soft); background: transparent; cursor: pointer;
  transition: background .3s, transform .3s, border-color .3s;
}
.dot:hover { border-color: var(--accent); }
.dot.is-active { background: var(--accent); border-color: var(--accent); transform: scale(1.35); }

/* ===== Hero ===== */
.panel--hero { padding: 0; }
.hero__img { position: absolute; inset: 0; }
.hero__img img { width: 100%; height: 100%; object-fit: cover; }
.hero__veil { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(20,24,45,.25) 0%, rgba(20,24,45,.15) 40%, rgba(20,24,45,.55) 100%); }
.hero__overlay { position: relative; z-index: 2; text-align: center; color: #fff; padding: 1.5rem; }
.hero__eyebrow { text-transform: uppercase; letter-spacing: .35em; font-size: .72rem; opacity: .9; margin-bottom: 1rem;
  animation: rise .9s var(--ease) both .1s; }
.hero__names { font-family: var(--script); font-weight: 400; font-size: clamp(3.6rem, 11vw, 8rem); line-height: 1.1; padding-top: .1em; text-shadow: 0 2px 30px rgba(0,0,0,.3);
  animation: rise 1s var(--ease) both .25s; }
.hero__names em { display: inline-block; transform: scale(.8); opacity: .9; }
.hero__date { font-size: clamp(1rem, 2.4vw, 1.35rem); letter-spacing: .05em; margin-top: 1rem;
  animation: rise 1s var(--ease) both .4s; }

.countdown { display: flex; gap: 1.6rem; justify-content: center; margin-top: 2rem; flex-wrap: wrap; animation: rise 1s var(--ease) both .55s; }
.countdown__unit { min-width: 58px; }
.countdown__num { font-family: var(--serif); font-size: 2rem; display: block; line-height: 1.1; }
.countdown__label { text-transform: uppercase; letter-spacing: .2em; font-size: .6rem; opacity: .85; }

.scroll-cue {
  position: absolute; bottom: 2rem; left: 50%; transform: translateX(-50%); z-index: 3;
  background: none; border: none; color: #fff; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: .3rem;
  font-family: var(--serif); font-size: .7rem; letter-spacing: .28em; text-transform: uppercase;
  animation: rise 1s var(--ease) both .8s;
}
.scroll-cue__arrow { font-size: 1.2rem; animation: bob 1.8s ease-in-out infinite; }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(6px); } }
@keyframes rise { from { opacity: 0; transform: translateY(26px); } to { opacity: 1; transform: none; } }

/* ===== Split layout ===== */
.split {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: clamp(2rem, 5vw, 5rem); align-items: center;
  width: 100%; max-width: 1180px; max-height: 100%;
}
.split--reverse .split__media { order: 2; }

.split__media { position: relative; width: 100%; aspect-ratio: 4 / 5; max-height: 74vh; border-radius: 3px; overflow: hidden; background: var(--panel); }
.split__media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .6s var(--ease); }
.split__media img.is-active, .split__media img:only-child { opacity: 1; }
.split__media--map { aspect-ratio: 4 / 3; align-self: center; }
.split__media--map iframe { width: 100%; height: 100%; border: 0; }
/* Show a landscape photo whole (no cropping) — resize to fit inside the frame */
.split__media--contain { aspect-ratio: 3 / 2; background: var(--panel); }
.split__media--contain img { object-fit: contain; }

/* Schedule: shrink the shared image frame a bit and pull it toward the text (no grey sides) */
#panel-4 .split__media { max-width: 82%; margin-right: auto; }


.split__body { max-height: 78vh; overflow-y: auto; scrollbar-width: thin; }
.split__body p { margin-bottom: 1rem; }
.split__body .signoff { font-style: italic; margin-top: 1.2rem; }

/* ===== Headings ===== */
.script { font-family: var(--script); font-weight: 400; color: var(--ink); font-size: clamp(2.8rem, 5.5vw, 4rem); line-height: 1.2; padding-top: .12em; margin-bottom: 1rem; }
.script-sm { font-family: var(--script); font-size: 1.7rem; line-height: 1.3; color: var(--ink); margin: 1.2rem 0 .3rem; }
/* RSVP heading — refined serif instead of the script font */
.script--rsvp { font-family: "Playfair Display", Georgia, serif; font-weight: 500; letter-spacing: .01em; padding-top: 0; }

/* ===== Tabs ===== */
.tabs { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.tab { background: none; border: none; cursor: pointer; font-family: var(--serif); font-size: 1.05rem; color: var(--ink); padding: 0; }
.tab.is-active { color: var(--accent); text-decoration: underline; text-underline-offset: 4px; }
.tabs__sep { color: var(--muted); }
.panel-tab { display: none; }
.panel-tab.is-active { display: block; }

.event-day { font-weight: 500; font-size: 1.1rem; margin-top: .8rem; }
.event-field { margin-top: .7rem; }
.addr { color: var(--ink-soft); margin-bottom: .6rem; }
.link { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.link:hover { color: var(--accent); }
.muted { color: var(--muted); }

/* ===== RSVP ===== */
.rsvp-wrap { width: 100%; max-width: 600px; text-align: center; }
.rsvp-intro { color: var(--ink-soft); margin-bottom: 1.6rem; }
.rsvp { display: flex; flex-direction: column; gap: 1rem; text-align: left; }
.rsvp__row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.rsvp label { display: flex; flex-direction: column; gap: .35rem; font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.rsvp input, .rsvp select, .rsvp textarea { font-family: var(--serif); font-size: 1rem; color: var(--ink); padding: .65rem .8rem; border: 1px solid var(--line); border-radius: 3px; background: #fff; text-transform: none; letter-spacing: normal; }
.rsvp input:focus, .rsvp select:focus, .rsvp textarea:focus { outline: none; border-color: var(--accent); }
.btn { display: inline-block; align-self: center; margin-top: .3rem; background: var(--accent); color: #fff; border: none; cursor: pointer; font-family: var(--serif); font-size: .8rem; letter-spacing: .18em; text-transform: uppercase; text-decoration: none; padding: .8rem 2.4rem; border-radius: 2px; transition: opacity .2s; }
.btn:hover { opacity: .9; }
.footer-line { margin-top: 2rem; color: var(--muted); font-style: italic; }

/* ===== Family: vertical gallery of full (uncropped) photos ===== */
.panel--tall { align-items: flex-start; overflow-y: auto; }
.gallery-col { width: 100%; max-width: 760px; margin: 0 auto; }
.gallery-col > .script { text-align: left; }
.gallery-col .tabs { margin-bottom: 1.6rem; }
.fam { margin-bottom: 2.2rem; }
.fam img { width: 100%; height: auto; display: block; border-radius: 3px; }
.fam figcaption { margin-top: .6rem; }
.fam--placeholder .fam__ph {
  width: 100%; aspect-ratio: 3 / 2; border: 1px dashed var(--line); border-radius: 3px;
  display: flex; align-items: center; justify-content: center; text-align: center;
  color: var(--muted); background: var(--panel); padding: 1rem; line-height: 1.5;
}
.fam--placeholder code { font-family: ui-monospace, Menlo, monospace; font-size: .8rem; background: #eef0f6; padding: 1px 5px; border-radius: 3px; }
.panel--tall .panel-tab { display: none; }
.panel--tall .panel-tab.is-active { display: block; }

/* ===== Dedicated RSVP page ===== */
.rsvp-page { overflow: auto; }               /* normal scroll, not the deck */
.rsvp-shell {
  min-height: calc(100dvh - 60px);
  display: grid; grid-template-columns: 1fr 1fr;
}
.rsvp-shell__media { position: relative; min-height: 40vh; }
.rsvp-shell__media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.rsvp-shell__veil { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(20,24,45,.15), rgba(20,24,45,.55)); }
/* Invite illustration: show whole, uncropped, on white */
.rsvp-shell__media--invite { background: #fff; display: flex; align-items: center; justify-content: center; padding: clamp(1rem, 3vw, 2.5rem); }
.rsvp-shell__media--invite img { position: static; width: auto; height: auto; max-width: 88%; max-height: 82%; object-fit: contain; }
.rsvp-shell__caption { position: absolute; left: 0; right: 0; bottom: 2rem; text-align: center; color: #fff; z-index: 2; padding: 0 1.5rem; }
.rsvp-shell__eyebrow { text-transform: uppercase; letter-spacing: .3em; font-size: .7rem; opacity: .9; }
.rsvp-shell__title { font-size: clamp(3rem, 7vw, 5rem); color: #fff; margin: .2rem 0; }
.rsvp-shell__sub { font-size: .95rem; opacity: .9; }

.rsvp-shell__body { display: flex; flex-direction: column; justify-content: center; padding: clamp(2rem, 6vw, 5rem) clamp(1.5rem, 5vw, 4rem); max-width: 620px; }
.rsvp-shell__body h2.script { font-size: clamp(2.4rem, 5vw, 3.4rem); }

.rsvp-step { display: none; }
.rsvp-step.is-active { display: block; animation: rise .5s var(--ease) both; }
.rsvp-step .rsvp { margin-top: 1.4rem; }

.events-field { border: 1px solid var(--line); border-radius: 4px; padding: 1rem 1.1rem; }
.events-field legend { font-size: .75rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); padding: 0 .4rem; }
.event-checks { display: flex; flex-wrap: wrap; gap: .8rem 1.4rem; }
.event-check { display: flex; align-items: center; gap: .5rem; font-size: 1rem; text-transform: none; letter-spacing: normal; color: var(--ink); cursor: pointer; }
.event-check input { width: 18px; height: 18px; accent-color: var(--accent); }

.form-msg { font-size: .95rem; margin-top: .4rem; min-height: 1.2em; }
.form-msg--error { color: var(--accent); }
.form-msg--ok { color: #3a7a4e; }

@media (max-width: 820px) {
  .rsvp-shell { grid-template-columns: 1fr; }
  .rsvp-shell__media { min-height: 42vh; }
}

/* ===== Reveal animations (fire when panel becomes active) ===== */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.reveal-media img { }
.split__media { opacity: 0; transform: translateX(-40px); transition: opacity .8s var(--ease), transform .8s var(--ease); }
.split--reverse .split__media { transform: translateX(40px); }

.panel.active .reveal { opacity: 1; transform: none; }
.panel.active .split__media { opacity: 1; transform: none; }
/* stagger the text blocks */
.panel.active .reveal:nth-child(1) { transition-delay: .12s; }
.panel.active .reveal:nth-child(2) { transition-delay: .20s; }
.panel.active .reveal:nth-child(3) { transition-delay: .28s; }
.panel.active .reveal:nth-child(4) { transition-delay: .36s; }
.panel.active .reveal:nth-child(5) { transition-delay: .44s; }
.panel.active .reveal:nth-child(6) { transition-delay: .52s; }
.panel.active .reveal:nth-child(7) { transition-delay: .60s; }

/* ===== Mobile ===== */
@media (max-width: 820px) {
  .dots { display: none; }
  .topbar__title { font-size: 1.1rem; }
  .split { grid-template-columns: 1fr; gap: 1.4rem; max-height: none; }
  .split--reverse .split__media { order: 0; }         /* image always on top on mobile */
  /* Show the whole photo — no cropping heads on portrait shots.
     Keep the fixed frame + stacked images (needed for tab cross-fade),
     but 'contain' fits any orientation inside without cropping. */
  .split__media { aspect-ratio: 3 / 4; max-height: 48vh; transform: translateY(30px); background: var(--panel); }
  .split__media img { object-fit: contain; }
  .split__media--map { aspect-ratio: 4 / 3; }
  .split--reverse .split__media { transform: translateY(30px); }
  .split__body { max-height: none; overflow: visible; }
  .rsvp__row { grid-template-columns: 1fr; }

  /* Panels grow with content; snapping relaxes to "proximity" so a tall
     panel (RSVP, Schedule) never traps the scroll near its bottom. */
  .deck { scroll-snap-type: y proximity; }
  .panel { height: auto; min-height: 100dvh; scroll-snap-stop: normal;
           padding: 6rem 1.4rem 3.5rem; }

  /* Larger tap targets & no zoom-on-focus (iOS zooms if input < 16px) */
  .rsvp input, .rsvp select, .rsvp textarea { font-size: 16px; padding: .8rem; }
  .btn { padding: .95rem 2.4rem; }
  .tab { padding: .2rem 0; }                            /* easier to tap */
  .hero__names { font-size: clamp(3rem, 15vw, 5rem); }
}

/* Very short landscape phones: don't force full-height hero cropping */
@media (max-height: 480px) {
  .panel { min-height: auto; padding-top: 5rem; padding-bottom: 2.5rem; }
  .panel--hero { min-height: 100dvh; }
}

/* Respect reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .reveal, .split__media { transition: none; opacity: 1; transform: none; }
  .hero__eyebrow, .hero__names, .hero__date, .countdown, .scroll-cue { animation: none; opacity: 1; }
  .deck { scroll-behavior: auto; }
}
