/* ==========================================================================
   Autumn wedding theme — tokens first, components never use raw hex.
   Contrast checked (WCAG AA) against --c-bg / --c-surface:
   ink 14:1 · ink-muted 6.7:1 · rust 5.2:1 · olive 6.1:1 · error 6.5:1
   --c-gold is decorative only (4.0:1) — never for body text.
   ========================================================================== */
:root {
  --c-bg: #F5EDE0;          /* parchment */
  --c-surface: #FBF6EE;     /* card */
  --c-ink: #2B1D14;         /* espresso */
  --c-ink-muted: #6A4B3A;   /* walnut */
  --c-rust: #A3461F;        /* burnt orange — primary */
  --c-rust-deep: #8A3A18;   /* pressed / hover */
  --c-olive: #5C5A2A;       /* secondary accent */
  --c-burgundy: #6B2626;
  --c-gold: #B8862F;        /* ornaments only */
  --c-border: #E0CDB4;
  --c-border-strong: #B79C7E;
  --c-error: #9B2C1F;
  --c-success: #3F5A2A;
  --c-on-primary: #FBF6EE;

  --f-script: 'Great Vibes', 'Snell Roundhand', cursive;
  --f-serif: 'Cormorant Infant', 'Cormorant Garamond', Georgia, serif;
  --f-ui: 'Jost', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px;
  --space-5: 24px; --space-6: 32px; --space-7: 48px; --space-8: 64px;

  --radius: 6px;
  --shadow-card: 0 1px 2px rgba(43, 29, 20, .06), 0 12px 32px -12px rgba(43, 29, 20, .22);
  --ease-out: cubic-bezier(.2, .7, .2, 1);
  --dur: 220ms;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--c-bg);
  color: var(--c-ink);
  font-family: var(--f-serif);
  font-size: 1.1875rem;     /* 19px — Cormorant runs small */
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
h1, h2, h3, p { margin: 0; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.skip-link {
  position: absolute; left: var(--space-4); top: -100px; z-index: 100;
  background: var(--c-ink); color: var(--c-surface); padding: var(--space-3) var(--space-4);
  font-family: var(--f-ui); border-radius: var(--radius);
}
.skip-link:focus { top: var(--space-4); }

:focus-visible { outline: 3px solid var(--c-rust); outline-offset: 3px; }

/* ---- Hero --------------------------------------------------------------- */
.hero {
  position: relative;
  aspect-ratio: 4 / 5;          /* portrait crop on phones */
  max-height: 88dvh;
  overflow: hidden;
  background: var(--c-ink);
}
.hero img {
  width: 100%; height: 100%; object-fit: cover;
  object-position: 54% 72%;     /* keeps the couple centred in the crop */
}
.hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to bottom, rgba(43, 29, 20, 0) 50%, rgba(43, 29, 20, .55) 100%);
}
.eyebrow {
  margin-bottom: var(--space-3);
  font-family: var(--f-ui); font-size: .8125rem; font-weight: 500;
  letter-spacing: .32em; text-transform: uppercase; color: var(--c-olive);
}

/* ---- Sheet (content card overlapping hero) ------------------------------ */
.sheet {
  position: relative; z-index: 2;
  margin: calc(-1 * var(--space-6)) auto 0;
  max-width: 720px;
  background: var(--c-surface);
  border-radius: 20px 20px 0 0;
  padding: var(--space-7) var(--space-4) var(--space-7);
  padding-bottom: max(var(--space-7), env(safe-area-inset-bottom));
  box-shadow: 0 -12px 32px -16px rgba(43, 29, 20, .35);
}

.intro { text-align: center; }
.names {
  font-family: var(--f-script); font-weight: 400;
  font-size: clamp(3rem, 13vw, 5.25rem); line-height: 1.05;
  color: var(--c-burgundy);
  display: flex; flex-direction: column; align-items: center;
}
.names__amp {
  font-family: var(--f-serif); font-style: italic; font-size: .6em;
  color: var(--c-rust); margin: var(--space-1) 0;
}
.lede {
  margin-top: var(--space-3);
  font-style: italic; font-size: 1.375rem; color: var(--c-ink-muted);
}
.sprig { color: var(--c-gold); display: flex; justify-content: center; margin: var(--space-5) 0; }

.details { margin: 0; display: grid; gap: var(--space-3); }
.details dd { margin: 0; }
.details__day {
  display: block; font-family: var(--f-ui); font-size: .8125rem; font-weight: 500;
  letter-spacing: .28em; text-transform: uppercase; color: var(--c-olive);
}
.details__date {
  display: block; font-size: clamp(1.75rem, 7vw, 2.25rem); font-weight: 500; line-height: 1.2;
}
.details__venue { font-size: 1.3125rem; color: var(--c-ink-muted); }
.countdown {
  margin-top: var(--space-4);
  font-family: var(--f-ui); font-size: .9375rem; color: var(--c-olive);
  font-variant-numeric: tabular-nums;
}

/* ---- RSVP --------------------------------------------------------------- */
.rsvp {
  margin: var(--space-7) auto 0; max-width: 440px;
  scroll-margin-top: var(--space-5);
}
.rsvp:focus { outline: none; }
.rsvp__title {
  text-align: center; font-family: var(--f-ui); font-weight: 500;
  font-size: .875rem; letter-spacing: .4em; text-transform: uppercase;
  color: var(--c-rust); margin-bottom: var(--space-4);
}
.rsvp__title::before, .rsvp__title::after {
  content: ""; display: inline-block; vertical-align: middle;
  width: 32px; height: 1px; background: var(--c-gold); margin: 0 var(--space-3);
}

.panel {
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: var(--space-5) var(--space-4);
  display: grid; gap: var(--space-4);
  animation: rise var(--dur) var(--ease-out);
}
.panel[hidden] { display: none; }
.panel__intro { text-align: center; font-size: 1.1875rem; }
.panel__hello { display: block; font-style: italic; color: var(--c-ink-muted); }
.panel__intro strong { font-weight: 600; font-size: 1.5rem; }
.hint { text-align: center; color: var(--c-ink-muted); font-size: 1.0625rem; margin-top: calc(-1 * var(--space-3)); }

.field { display: grid; gap: var(--space-1); }
.field label, .guest legend {
  font-family: var(--f-ui); font-size: .875rem; font-weight: 500; color: var(--c-ink);
}
.field input {
  width: 100%; min-height: 48px;
  padding: var(--space-3) var(--space-4);
  font-family: var(--f-ui); font-size: 1rem;  /* 16px avoids iOS zoom */
  color: var(--c-ink); background: var(--c-surface);
  border: 1px solid var(--c-border-strong); border-radius: var(--radius);
  transition: border-color var(--dur), box-shadow var(--dur);
}
.field input:focus-visible { outline: none; border-color: var(--c-rust); box-shadow: 0 0 0 3px rgba(163, 70, 31, .25); }
.field input[aria-invalid="true"] { border-color: var(--c-error); }
.field__error, .alert {
  font-family: var(--f-ui); font-size: .875rem; color: var(--c-error);
  display: flex; gap: var(--space-2); align-items: flex-start;
}
.field__error::before, .alert::before {
  content: "!"; flex: none; display: inline-grid; place-items: center;
  width: 18px; height: 18px; margin-top: 1px; border-radius: 50%;
  background: var(--c-error); color: var(--c-surface); font-size: .75rem; font-weight: 600;
}
.alert { background: #F6E3DD; border-radius: var(--radius); padding: var(--space-3); line-height: 1.45; }
.field__error[hidden], .alert[hidden] { display: none; }

/* Guest response rows */
.guests { display: grid; gap: var(--space-3); }
.guest {
  margin: 0; padding: var(--space-4); border: 1px solid var(--c-border); border-radius: var(--radius);
  background: var(--c-surface);
}
.guest legend { float: left; width: 100%; padding: 0; margin-bottom: var(--space-3); font-size: 1rem; }
.guest legend + * { clear: both; }
.guest__prev { display: block; font-weight: 400; font-size: .8125rem; color: var(--c-ink-muted); margin-top: 2px; }
.choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-2); }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; margin: 0; pointer-events: none; }
.choice span {
  display: flex; align-items: center; justify-content: center; min-height: 48px; padding: var(--space-2);
  font-family: var(--f-ui); font-size: .9375rem; text-align: center;
  border: 1px solid var(--c-border-strong); border-radius: var(--radius);
  color: var(--c-ink); background: var(--c-surface);
  transition: background-color var(--dur), color var(--dur), border-color var(--dur), transform 120ms;
  cursor: pointer; user-select: none;
}
.choice input:checked + span { background: var(--c-rust); border-color: var(--c-rust); color: var(--c-on-primary); }
.choice input:checked + span::before { content: "✓\00a0"; }
.choice input:focus-visible + span { outline: 3px solid var(--c-rust); outline-offset: 2px; }
.choice input:active + span { transform: scale(.97); }
@media (hover: hover) {
  .choice:hover input:not(:checked) + span { border-color: var(--c-rust); background: #F7E9DE; }
}
.guest[aria-invalid="true"] { border-color: var(--c-error); }

/* Buttons */
.btn {
  -webkit-appearance: none; appearance: none;
  display: inline-flex; justify-content: center; align-items: center; gap: var(--space-2);
  min-height: 52px; width: 100%; padding: var(--space-3) var(--space-5);
  font-family: var(--f-ui); font-size: .9375rem; font-weight: 500; letter-spacing: .14em; text-transform: uppercase;
  border-radius: var(--radius); border: 1px solid transparent; cursor: pointer;
  touch-action: manipulation;
  transition: background-color var(--dur), color var(--dur), transform 120ms, opacity var(--dur);
}
.btn:active { transform: scale(.98); }
.btn--primary { background: var(--c-rust); color: var(--c-on-primary); }
.btn--primary:hover { background: var(--c-rust-deep); }
.btn--secondary { background: transparent; color: var(--c-rust); border-color: var(--c-rust); }
.btn--secondary:hover { background: #F7E9DE; }
.btn--link {
  background: none; min-height: 44px; color: var(--c-ink-muted); text-transform: none; letter-spacing: 0;
  font-size: .9375rem; text-decoration: underline; text-underline-offset: 3px;
}
.btn[aria-busy="true"] { opacity: .7; cursor: progress; }
.btn[aria-busy="true"] .btn__label::after {
  content: ""; display: inline-block; width: 14px; height: 14px; margin-left: var(--space-2); vertical-align: -2px;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  animation: spin .7s linear infinite;
}

/* Thank-you */
.panel--thanks { text-align: center; justify-items: center; }
.thanks__icon { color: var(--c-success); }
.thanks__title { font-family: var(--f-script); font-weight: 400; font-size: 3rem; line-height: 1; color: var(--c-burgundy); }
.thanks__title:focus { outline: none; }
.summary { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); width: 100%; }
.summary li {
  display: flex; justify-content: space-between; gap: var(--space-4);
  padding: var(--space-2) 0; border-bottom: 1px dashed var(--c-border);
  font-family: var(--f-ui); font-size: .9375rem;
}
.summary li:last-child { border-bottom: 0; }
.summary b { font-weight: 500; color: var(--c-rust); }

.foot {
  margin-top: var(--space-7); text-align: center;
  font-style: italic; color: var(--c-ink-muted);
}

@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Larger screens ----------------------------------------------------- */
@media (min-width: 600px) {
  .sheet { padding-left: var(--space-7); padding-right: var(--space-7); }
  .panel { padding: var(--space-6); }
}
@media (min-width: 768px) {
  .hero { aspect-ratio: 16 / 10; max-height: 82dvh; }
  .hero img { object-position: 52% 92%; }   /* keep the couple's feet above the card */
  .sheet {
    margin-top: calc(-1 * var(--space-6));
    margin-bottom: var(--space-8);
    border-radius: 20px;
    padding-top: var(--space-8); padding-bottom: var(--space-8);
    box-shadow: var(--shadow-card);
  }
}
@media (min-width: 1200px) {
  .hero { aspect-ratio: auto; height: 78dvh; max-height: none; }
}
@media (orientation: landscape) and (max-height: 500px) {
  .hero { aspect-ratio: auto; height: 90dvh; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
