/* Betty & Kevin · Save the Date. Light page, photo-booth strip, simple RSVP. */

:root {
  --red: #e50000;
  --red-soft: rgba(229, 0, 0, .05);
  --red-faint: rgba(229, 0, 0, .35);
  --red-hint: rgba(229, 0, 0, .6);  /* placeholder text: readable, but clearly not an answer */
  --page: #fdfcfa;
  /* Three fonts, one job each: Momo Signature (the name), EB Garamond (all reading text),
     Dongle Regular (small capital-letter labels, in three sizes). */
  --serif: "EB Garamond", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --script: "Pinyon Script", "Snell Roundhand", "Apple Chancery", cursive;
  --caps: "Dongle", "Avenir Next", system-ui, sans-serif; /* was "Josefin Sans" */
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--red);
  font-family: var(--serif);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
::selection { background: rgba(229, 0, 0, .14); }
:focus-visible { outline: 1.5px solid var(--red); outline-offset: 3px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ───────── Layout ───────── */
.page {
  width: min(100% - 48px, 1000px);
  margin: 0 auto;
  padding: 32px 0 80px;
}
.main-col { max-width: 540px; margin: 0 auto; }

@media (min-width: 880px) {
  .page {
    display: grid;
    grid-template-columns: 230px minmax(0, 540px);
    justify-content: center;
    column-gap: clamp(56px, 8vw, 110px);
    padding: clamp(56px, 10vh, 110px) 0 120px;
  }
  .strip-col { position: relative; }
  .strip-col { padding-top: 8px; }
  /* Sticks once its bottom reaches the viewport; --stick-top is set in main.js */
  .photos { position: sticky; top: var(--stick-top, 48px); }
  .main-col { margin: 0; }
}

/* ───────── Photos: square crops on a white card ───────── */
.photos {
  display: grid;
  gap: 16px;
  padding: 16px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(60, 40, 30, .06), 0 18px 40px -22px rgba(60, 40, 30, .3);
}
.photos img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  object-position: var(--pos, 50% 50%);
  filter: grayscale(1);
}
/* Phones and tablets: a 3 × 2 grid above the letter */
@media (max-width: 879px) {
  .strip-col { margin: 8px auto 48px; max-width: 480px; }
  .photos { grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 8px; }
}

/* ───────── Letter ───────── */
.letterhead { text-align: center; margin-bottom: clamp(44px, 9vw, 64px); }
.kicker, .caps-lg, .caps-md {
  margin: 0;
  font-family: var(--caps); font-size-adjust: cap-height .7; font-weight: 400; text-transform: uppercase;
  line-height: 1.3;
}
.kicker { font-size: clamp(17px, 4.6vw, 22px); letter-spacing: .12em; padding-left: .12em; }
.script {
  margin: .05em 0 .12em;
  font-family: var(--script); font-weight: 400;
  font-size: clamp(54px, 16vw, 118px);
  line-height: 1.05;
  letter-spacing: 0;
  white-space: nowrap;
  /* Wider than the column on desktop: center it on the column instead of spilling right */
  width: max-content;
  position: relative; left: 50%;
  transform: translateX(-50%) rotate(-2deg);
}
/* ── Heading: "Chang Chang" (tilted script) with "Our Love Story" on its own straight line below ── */
.lockup {
  margin: .05em 0 0;
  font-weight: 400;
  text-align: center;
}
.lockup__name {
  display: block;
  font-family: "Momo Signature", var(--script); /* was "Imperial Script" */
  font-size: clamp(38px, 11.4vw, 70px); /* Momo Signature is wide: about 7.5em for "Chang Chang" */
  line-height: 1.3;
  letter-spacing: 0;
  white-space: nowrap;
  /* centered on the column even when wider than it, and tilted like a signature */
  width: max-content;
  position: relative; left: 50%;
  transform: translateX(-50%) rotate(-2deg);
}
.lockup__tag {
  display: block;
  margin-top: .9em; /* clear of the long g tails above */
  font-family: var(--caps); font-size-adjust: cap-height .7; font-weight: 400; /* Dongle Regular */
  font-size: clamp(17px, 4.6vw, 22px);
  line-height: 1.3;
  letter-spacing: .12em; padding-left: .12em;
  text-transform: uppercase;
}
/* "Dear friend," like the rest of the letter */
#greeting {
  font-family: var(--serif);
  font-style: normal; font-weight: 400;
  letter-spacing: 0;
}
.caps-lg { font-size: clamp(17px, 4.6vw, 22px); letter-spacing: .12em; padding-left: .12em; } /* Dongle, large */
.caps-md { margin-top: .8em; line-height: 1.7; font-size: clamp(13px, 3.6vw, 16px); /* Dongle, medium */ letter-spacing: .14em; padding-left: .14em; }

/* Small label used on the RSVP card */
.eyebrow {
  margin: 0 0 16px;
  font-family: var(--caps); font-size-adjust: cap-height .7; font-weight: 400; font-size: 13px; /* Dongle, small */
  letter-spacing: .42em; padding-left: .42em; text-transform: uppercase;
}
/* "RSVP" on the reply card: same size as the venue and date line */
.rsvp .eyebrow { font-size: clamp(13px, 3.6vw, 16px); }

/* The letter */
.body { font-weight: 400; font-size: clamp(16.5px, 4.3vw, 18.5px); line-height: 1.7; letter-spacing: 0; }
.body p { margin: 0 0 1.1em; }
.signoff { margin-top: 1.6em; }
.body :lang(zh-Hans) { font-family: "Songti SC", "Noto Serif SC", "Source Han Serif SC", serif; font-weight: 400; font-size: .92em; }
.body :lang(zh-Hant) { font-family: "Songti TC", "Noto Serif TC", "Source Han Serif TC", serif; font-weight: 400; font-size: .92em; }
.signoff p { margin: 0; }
.signoff p + p { margin-top: 1.1em; }
.follow {
  margin: -.35em 0 1.4em;
  text-align: center;
  font-family: var(--script); font-size: clamp(26px, 7vw, 32px); line-height: 1.1;
  transform: rotate(-2deg);
}

/* ───────── RSVP (on the page: just the name) ───────── */
.rsvp {
  /* A white card with one thin red line inset from the edge, like a postcard */
  position: relative;
  margin: clamp(64px, 12vw, 104px) auto 0;
  max-width: 500px;
  padding: clamp(44px, 9vw, 60px) clamp(28px, 8vw, 52px) clamp(40px, 8vw, 52px);
  background: #fff;
  box-shadow: 0 1px 3px rgba(120, 30, 20, .08), 0 24px 48px -24px rgba(120, 30, 20, .3);
  text-align: center;
  --tilt: -1.2deg;
  transition: transform .5s cubic-bezier(.22, 1, .36, 1), box-shadow .5s ease, opacity .9s ease;
}
.rsvp::before { content: ""; position: absolute; inset: 12px; border: 1.5px solid var(--red); pointer-events: none; }
.js .rsvp[data-reveal] { transform: translateY(40px) rotate(var(--tilt)) scale(.97); }
.js .rsvp[data-reveal].in, .rsvp { transform: rotate(var(--tilt)); }
.rsvp:hover, .rsvp:focus-within { transform: rotate(0) translateY(-4px) !important; box-shadow: 0 1px 3px rgba(120, 30, 20, .08), 0 32px 56px -24px rgba(120, 30, 20, .34); }
@media (prefers-reduced-motion: reduce) { .rsvp, .js .rsvp[data-reveal] { transform: none !important; } }
.rsvp__title {
  margin: 0 0 .7em;
  font-weight: 500;
  font-size: clamp(30px, 7vw, 40px); line-height: 1.1;
}

.namebar {
  display: flex; align-items: stretch; gap: 12px;
  max-width: 420px; margin: 4px auto 0;
}
.namebar input {
  flex: 1; min-width: 0;
  background: transparent; color: var(--red);
  border: 0; border-bottom: 1px solid var(--red); border-radius: 0;
  padding: 8px 2px 6px;
  font: inherit; font-size: 18px; line-height: 1.3;
  outline: 0;
}
.namebar input::placeholder { color: var(--red-hint); }
.namebar input:focus { border-bottom-width: 2px; padding-bottom: 5px; }
.namebar .btn { padding-left: 26px; padding-right: 22px; flex: none; }
/* Personal link: we already know the name, so it's just the button */
.namebar--known { justify-content: center; }
.namebar--known input { display: none; }
.namebar--known .btn { padding-left: calc(56px + .3em); padding-right: 56px; }
/* hide the native datalist arrow in Chrome */
.namebar input::-webkit-calendar-picker-indicator { opacity: 0; }

.err { min-height: 1.5em; margin: 12px 0 0; font-size: 16px; }

.done:focus { outline: 0; }
.done__title { margin: .2em 0 .3em; font-weight: 500; font-size: clamp(26px, 6vw, 30px); }
.done p { margin: 0; font-size: 18px; line-height: 1.6; }

.btn {
  font-family: var(--caps); font-size-adjust: cap-height .7; font-weight: 400; font-size: 13px; /* Dongle, small */
  letter-spacing: .3em; text-transform: uppercase;
  color: #fff; background: var(--red);
  border: 1px solid var(--red); border-radius: 0;
  padding: 15px 40px 14px calc(40px + .3em);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.btn:hover { background: #fff; color: var(--red); }
.btn[disabled] { opacity: .55; cursor: progress; }

/* ───────── Pop-up ───────── */
.dlg {
  width: min(100% - 32px, 480px);
  max-height: calc(100% - 32px);
  padding: 0;
  border: 1px solid var(--red);
  background: #fff;
  color: var(--red);
  overflow: auto;
}
.dlg::backdrop { background: rgba(253, 252, 250, .82); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.dlg[open] { animation: dlgIn .35s cubic-bezier(.22, 1, .36, 1); }
.dlg[open]::backdrop { animation: fadeIn .35s ease; }
@keyframes dlgIn { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.dlg form { position: relative; padding: clamp(36px, 8vw, 48px) clamp(24px, 7vw, 44px) clamp(28px, 6vw, 40px); text-align: center; }
.dlg form::before { content: ""; position: absolute; inset: 6px; border: 1px solid var(--red-faint); pointer-events: none; }
.dlg .rsvp__title { margin-bottom: .35em; }
.dlg__sub { margin: 0 0 26px; font-size: 18px; line-height: 1.5; }
.dlg__close {
  position: absolute; top: 14px; right: 16px; z-index: 1;
  width: 36px; height: 36px; padding: 0;
  background: none; border: 0; color: var(--red);
  font: 400 28px/1 var(--serif); cursor: pointer;
}

.field { margin: 0 0 18px; text-align: left; }
.field label {
  display: block; margin-bottom: 2px;
  font-family: var(--caps); font-size-adjust: cap-height .7; font-weight: 400; font-size: 13px; /* Dongle, small */
  line-height: 1.5; /* long labels wrap onto a tight second line */
  letter-spacing: .2em; text-transform: uppercase;
}
.field input {
  display: block; width: 100%;
  background: transparent; color: var(--red);
  border: 0; border-bottom: 1px solid var(--red); border-radius: 0;
  padding: 6px 0 5px;
  font: inherit; font-size: 18px; line-height: 1.3;
  outline: 0;
}
.field input:focus { border-bottom-width: 2px; padding-bottom: 4px; }
.field input::placeholder, .field textarea::placeholder { color: var(--red-hint); }
.field .req { letter-spacing: 0; }

.choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0 0 26px; padding: 0; border: 0; min-width: 0; }
.choice { position: relative; display: flex; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  min-height: 54px; padding: 8px 10px;
  font-size: 18px; line-height: 1.15;
  border: 1px solid var(--red); cursor: pointer;
  transition: background .15s, color .15s;
}
.choice span:hover { background: var(--red-soft); }
.choice input:checked + span { background: var(--red); color: #fff; }
.choice input:focus-visible + span { outline: 1.5px solid var(--red); outline-offset: 3px; }
.dlg .err { margin: 4px 0 10px; }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ───────── Reveal on scroll ───────── */
.js [data-reveal] { opacity: 0; transform: translateY(12px); transition: opacity .9s ease, transform .9s ease; }
.js [data-reveal].in { opacity: 1; transform: none; }
/* Opacity-only fade, for elements that keep their own transform (the script heading) */
.js [data-fade] { opacity: 0; transition: opacity 1.4s ease; }
.js [data-fade].in { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; }
  .js [data-reveal] { opacity: 1; transform: none; }
  .js [data-fade] { opacity: 1; }
}

[hidden] { display: none !important; }

/* ───────── Password screen + unveiling (gate.js) ───────── */
html.locked .page { visibility: hidden; }
html.locked body, html.unveiling body { overflow: hidden; }

/* The veil: a page-colored sheet over everything. It extends below the screen with a soft,
   feathered bottom edge, so when it lifts the letter is uncovered like a cloth being drawn up. */
.gate {
  position: fixed; top: 0; left: 0; right: 0; bottom: -35vh; z-index: 50;
  display: grid; place-items: center;
  padding: 24px 16px calc(24px + 35vh);
  background: var(--page);
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 35vh), transparent);
          mask-image: linear-gradient(to bottom, #000 calc(100% - 35vh), transparent);
  overflow-y: auto;
  transition: transform 2.4s cubic-bezier(.65, 0, .2, 1);
}
.gate--lift { transform: translateY(-140vh); pointer-events: none; }

.gate__form {
  width: min(100%, 420px);
  text-align: center;
  animation: gateIn .6s ease backwards;
  transition: opacity .7s ease, transform .9s ease, filter .7s ease;
}
.gate--leaving .gate__form { opacity: 0; transform: translateY(-14px); filter: blur(6px); pointer-events: none; }
.gate__seal { display: block; width: auto; height: 76px; margin: 0 auto 26px; }
/* The first-date photo on the password screen: matted like a print, with a small gallery-style caption */
.gate__photo { margin: 0 auto 28px; width: min(100%, 300px); }
.gate__photo img { display: block; width: 100%; height: auto; padding: 10px; background: #fff;
  box-shadow: 0 1px 2px rgba(60, 40, 30, .08), 0 14px 32px -18px rgba(60, 40, 30, .35); }
.gate__photo figcaption { margin-top: 10px; text-align: right; font-size: 14px; font-style: italic; line-height: 1.3; opacity: .85; }
@media (max-height: 700px) { .gate__photo { width: min(100%, 220px); } }
/* The question in the same Dongle capitals as the form labels (medium size) */
.gate__q {
  display: block; margin: 0 0 22px;
  font-family: var(--caps); font-size-adjust: cap-height .7; font-weight: 400;
  font-size: clamp(14px, 3.8vw, 16px); line-height: 1.7;
  letter-spacing: .16em; padding-left: .16em; text-transform: uppercase;
  text-wrap: balance;
}
.gate__input {
  display: block; width: 100%;
  background: #fff; color: var(--red);
  border: 1px solid var(--red); border-radius: 0;
  padding: 13px 16px;
  font: inherit; font-size: 18px; line-height: 1.3; text-align: center;
  outline: 0;
  transition: box-shadow .15s;
}
.gate__input:focus { box-shadow: 0 0 0 3px rgba(229, 0, 0, .12); }
.gate__input::placeholder { color: var(--red-hint); }
.gate__err { margin: 10px 0 14px; }
.gate__form .btn { width: 100%; }
.gate--shake { animation: gateShake .4s; }

/* The letter underneath comes into focus as the veil lifts */
html.unveiling .page {
  opacity: 0; transform: scale(.985); filter: blur(10px);
  transition: opacity 2s ease .3s, transform 2.6s cubic-bezier(.2, .7, .2, 1) .2s, filter 2.2s ease .3s;
}
html.unveiling.unveil-go .page { opacity: 1; transform: none; filter: none; }

@keyframes gateIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes gateShake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
@media (prefers-reduced-motion: reduce) {
  .gate__form, .gate--shake { animation: none; }
  .gate, html.unveiling .page { transform: none !important; filter: none !important; }
  .gate--lift { opacity: 0; transition: opacity .6s ease; }
}

/* ───────── RSVP page (rsvp.html) ───────── */
.page.page--single { display: block; width: min(100% - 32px, 560px); }
.page--single .main-col { margin: 0 auto; }
.page--single .letterhead { margin-bottom: clamp(32px, 7vw, 48px); }
.page--single .script { font-size: clamp(54px, 15vw, 96px); }
/* A long form: no tilt, no hover lift */

.sub { margin: -.2em 0 22px; font-size: 18px; line-height: 1.5; }
.link { padding: 0; background: none; border: 0; color: inherit; font: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

.matches__q { margin: 22px 0 10px; font-family: var(--caps); font-size-adjust: cap-height .7; font-weight: 400; font-size: 13px; letter-spacing: .2em; text-transform: uppercase; }
.matches { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.matches label {
  display: flex; align-items: center; gap: 8px; padding: 10px;
  border: 1px solid var(--red-faint); cursor: pointer; text-align: left;
}
.matches label:hover { background: var(--red-soft); }
.matches input { accent-color: var(--red); }
#confirm-guest .btn { margin-top: 16px; padding-inline: 14px; }
.rsvp--wedding { --tilt: 0deg; }

#reply-form { text-align: left; }
#reply-form > .eyebrow, #reply-form > .rsvp__title, #reply-form > .sub { text-align: center; }
#reply-form .btn { display: block; width: 100%; }
.group { margin: 0 0 24px; padding: 0; border: 0; min-width: 0; }
.group legend { padding: 0; margin-bottom: 10px; font-size: 18px; font-style: italic; line-height: 1.4; } /* questions: the one place for italic */
.group .choices { margin: 0; }
.choices--2 { grid-template-columns: 1fr 1fr; }
/* Party questions (hotel, mailing address, accessibility) */
.party { margin: 8px 0 0; padding-top: 30px; }
.address .field { margin-bottom: 14px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 420px) { .field-row { grid-template-columns: 1fr; gap: 0; } }
.choices .choice span { font-size: 18px; text-align: center; }
/* "Keep me in the loop" for people who can't come */
.person__no { margin-top: 4px; }
.person__no .check { align-items: flex-start; font-size: 17px; line-height: 1.4; }
.person__no .check input { margin-top: 3px; }
.choices--2 .choice span { font-size: 18px; text-align: center; }
.check { display: flex; align-items: center; gap: 10px; margin: 0 0 8px; font-size: 18px; line-height: 1.3; cursor: pointer; }
.check input { flex: none; width: 18px; height: 18px; margin: 0; accent-color: var(--red); }
.group .field { margin-top: 12px; }
/* One block per person in the party */
.person { margin: 0 0 30px; padding: 0; border: 0; min-width: 0; }
.person + .person { margin-top: 40px; }
.person__name { padding: 0; margin: 0 0 14px; font-size: 22px; font-weight: 500; line-height: 1.2; }
.person .field { margin: 0 0 16px; }
.field textarea {
  display: block; width: 100%; resize: vertical;
  background: transparent; color: var(--red);
  border: 1px solid var(--red); border-radius: 0; padding: 8px 10px; margin-top: 4px;
  font: inherit; font-size: 18px; line-height: 1.4; outline: 0;
}
.field textarea:focus { box-shadow: 0 0 0 2px rgba(229, 0, 0, .12); }
/* After a "yes": add the weekend to your calendar */
.cal { margin-top: 26px; }
.cal__label { margin: 0 0 12px !important; font-family: var(--caps); font-size-adjust: cap-height .7; font-size: 13px !important; letter-spacing: .2em; padding-left: .2em; text-transform: uppercase; }
.cal__buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cal__buttons .btn { display: flex; align-items: center; justify-content: center; padding: 14px 8px; letter-spacing: .14em; text-decoration: none; }
@media (max-width: 520px) { .cal__buttons { grid-template-columns: 1fr; } } /* stack on phones so the labels fit on one line */
.btn--ghost { background: #fff; color: var(--red); }
.btn--ghost:hover { background: var(--red); color: #fff; }

/* The 張張 seal above "Chang Chang" */
.seal { display: block; width: auto; height: clamp(78px, 20vw, 112px); margin: 0 auto clamp(18px, 4vw, 26px); } /* straight, not tilted */
/* Address suggestions under "Street address" */
.suggest { position: relative; }
.suggest__list {
  position: absolute; z-index: 5; left: 0; right: 0; top: 100%;
  margin: 4px 0 0; padding: 4px 0; list-style: none;
  background: #fff; border: 1px solid var(--red); box-shadow: 0 8px 24px rgba(229, 0, 0, .1);
}
.suggest__item { display: block; padding: 8px 12px; cursor: pointer; line-height: 1.3; }
.suggest__item[aria-selected="true"], .suggest__item:hover { background: var(--red-soft); }
.suggest__street { display: block; font-size: 17px; }
.suggest__place { display: block; font-size: 14px; color: var(--red); opacity: .85; }
/* A problem with one question, shown right under it */
.err--inline { min-height: 0; margin: 8px 0 0; }
.choices + .err--inline { margin: 8px 0 0; }
/* Small help text under a field */
.hint { margin: 6px 0 0; font-size: 15px; line-height: 1.4; opacity: .85; }
