/* ===========================================================================
   Frieda & Isaac — wedding site
   Mobile-first. Base styles target 375px; breakpoints at 600px and 900px.

   PALETTE & CONTRAST RULES (important — do not repurpose these)

   Sage-forward. Isaac's palette has only one dark value, so --ink is a
   deepened sage derived from --sage: the supplied #90958F is 2.8:1 on ivory
   and cannot carry text. Ratios below are against --ivory.

     --ink    #3D443C  9.1:1 → body text, footer ground, button fill
     --muted  #5A6159  5.8:1 → helper text
     --accent #566651  4.7:1 → required *, rule diamond, focus ring (passes AA)
     --sage   #90958F  2.8:1 → BORDERS ONLY, never text
     --slate  #7D8D9D  3.1:1 → non-text only (fills, tints)
     --ivory  #F5F6F4        → page ground, and text on --ink / on the hero scrim

   Over the hero photo every piece of text is --ivory: nothing else in the
   palette clears 3:1 against the scrim.
   =========================================================================== */

@font-face {
  font-family: 'Cormorant Garamond';
  /* Variable font: one file covers the whole 300-700 weight axis, so the
     600 headings and 400 body cost a single 37KB request. */
  src: url('../assets/fonts/cormorant-garamond-latin.woff2') format('woff2-variations'),
       url('../assets/fonts/cormorant-garamond-latin.woff2') format('woff2');
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink:    #3D443C;                    /* deepened sage — the only AA-safe dark */
  --muted:  #5A6159;
  --accent: #566651;
  --slate:  #7D8D9D;
  --sage:   #90958F;
  --ivory:  #F5F6F4;

  --band:  #DDE2DA;                     /* pale sage tint behind the form */
  --tint:  rgba(144, 149, 143, 0.16);
  --card:  #FFFFFF;

  --serif: 'Cormorant Garamond', 'Cormorant', Georgia, 'Times New Roman', serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

  --wrap: 1080px;
  --wrap-narrow: 580px;
  --radius: 3px;
  --tap: 48px;                          /* minimum tap target */
  --gap: 0.85rem;                       /* vertical rhythm between fields */
}

/* --------------------------------------------------------------- reset --- */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--ivory);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { max-width: 100%; height: auto; display: block; }
[hidden] { display: none !important; }

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 400;
  margin: 0;
  line-height: 1.15;
}

p { margin: 0 0 1rem; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

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

/* ------------------------------------------------------------- helpers --- */

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -60px;
  left: 1rem;
  z-index: 100;
  background: var(--ink);
  color: var(--ivory);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius);
  text-decoration: none;
  transition: top 0.15s ease;
}
.skip-link:focus { top: 1rem; }

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: 20px;
}
.wrap--narrow { max-width: var(--wrap-narrow); }

/* Decorative rule with a centre diamond */
.rule {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 1.4rem 0;
}
.rule::before, .rule::after {
  content: '';
  height: 1px;
  width: 56px;
  background: var(--sage);
}
.rule__diamond {
  width: 6px; height: 6px;
  background: var(--accent);
  transform: rotate(45deg);
}
/* On dark grounds the sage rule disappears; go translucent ivory instead. */
.rule--light::before, .rule--light::after { background: rgba(245, 246, 244, 0.5); }
.rule--light .rule__diamond { background: var(--ivory); }

.req { color: var(--accent); }

/* ---------------------------------------------------------------- hero --- */

.hero {
  position: relative;
  isolation: isolate;
  display: flex;
  /* Content sits low: the couple occupy the upper half of the frame, so
     centred text would land squarely on their faces. */
  align-items: flex-end;
  justify-content: center;
  min-height: 600px;
  min-height: clamp(560px, 94svh, 900px);
  padding-block: clamp(3rem, 10vw, 5rem) clamp(2.5rem, 7vw, 4rem);
  padding-top: calc(clamp(3rem, 10vw, 5rem) + env(safe-area-inset-top, 0px));
  text-align: center;
  overflow: hidden;
  background: var(--ink);   /* shows while the photo decodes */
}

.hero__bg {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* The couple sit left-of-centre and about 43% down the frame. On phones the
     landscape photo is cropped hard on the sides, so bias horizontally to keep
     them in shot; the desktop hero is nearly the photo's own 3:2 ratio and
     barely crops at all. */
  object-position: 42% 38%;
}

.hero__scrim {
  position: absolute;
  inset: 0;
  z-index: -1;
  /* Sage wash in the palette, weighted to the bottom: light across the upper
     frame so the couple stay visible, deep underneath where the text sits. */
  background:
    linear-gradient(to bottom,
      rgba(42, 48, 41, 0.34) 0%,
      rgba(42, 48, 41, 0.20) 28%,
      rgba(42, 48, 41, 0.42) 58%,
      rgba(42, 48, 41, 0.78) 82%,
      rgba(42, 48, 41, 0.88) 100%);
}

.hero__inner { position: relative; color: var(--ivory); }

.hero__names {
  font-size: clamp(3rem, 17vw, 6.5rem);
  letter-spacing: 0.02em;
  color: var(--ivory);
  display: flex;
  flex-direction: column;
  align-items: center;
  /* justify-content matters once this becomes a row at >=600px: without it
     the names sit flex-start and text-align:center cannot reach flex children. */
  justify-content: center;
  gap: 0.1em;
  text-shadow: 0 2px 24px rgba(24, 28, 23, 0.45);
}
.hero__amp {
  font-size: 0.5em;
  font-style: italic;
  opacity: 0.85;
}

.hero__date {
  font-family: var(--serif);
  font-size: clamp(1.25rem, 5.5vw, 1.75rem);
  margin-bottom: 0.35rem;
  text-shadow: 0 1px 16px rgba(24, 28, 23, 0.5);
}

.hero__venue {
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(245, 246, 244, 0.88);
  margin-bottom: 2.25rem;
  text-shadow: 0 1px 12px rgba(24, 28, 23, 0.5);
}
/* On the narrowest phones the venue reads better on two lines. */
.hero__venue-sep { display: none; }
.hero__city { display: block; }

/* ----------------------------------------------------------- countdown --- */

.countdown {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  max-width: 420px;
  margin: 0 auto;
}

.countdown__unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 0.8rem 0.15rem;
  background: rgba(245, 246, 244, 0.10);
  border: 1px solid rgba(245, 246, 244, 0.38);
  border-radius: var(--radius);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

.countdown__num {
  font-family: var(--serif);
  font-size: clamp(1.75rem, 8.5vw, 2.5rem);
  font-weight: 600;
  line-height: 1;
  color: var(--ivory);        /* nothing else in the palette clears 3:1 on the scrim */
  /* Cormorant defaults to oldstyle figures; lining-nums keeps the countdown
     digits an even height, and tabular-nums stops the width jittering each second. */
  font-variant-numeric: lining-nums tabular-nums;
}

.countdown__label {
  font-size: 0.55rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(245, 246, 244, 0.82);
}

.countdown__done {
  font-family: var(--serif);
  font-size: clamp(2rem, 9vw, 3rem);
  color: var(--ivory);
  margin: 0;
}

/* ------------------------------------------------------------- buttons --- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  padding: 0.85rem 2rem;
  font-family: var(--sans);
  font-size: 0.8rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.btn--primary {
  background: var(--ink);
  color: var(--ivory);
}
.btn--primary:hover { background: #4E5A4C; }
.btn--primary:disabled { opacity: 0.55; cursor: not-allowed; }

.btn--block { width: 100%; }

/* ------------------------------------------------------------ sections --- */

.section { padding-block: clamp(2.5rem, 8vw, 4rem); }
.section--rsvp { background: var(--band); }

.section__title {
  font-size: clamp(2rem, 9vw, 2.75rem);
  text-align: center;
  margin-bottom: 0.6rem;
}

.section__intro {
  text-align: center;
  color: var(--muted);
  font-size: 0.92rem;
  max-width: 38ch;
  margin-inline: auto;
  margin-bottom: 1.75rem;
}

/* The form sits on a white card lifted off the tinted band. */
.card {
  background: var(--card);
  border: 1px solid rgba(61, 68, 60, 0.12);
  border-radius: 5px;
  padding: clamp(1.15rem, 5vw, 2rem);
  box-shadow: 0 1px 2px rgba(61, 68, 60, 0.06), 0 8px 24px rgba(61, 68, 60, 0.08);
}

/* ---------------------------------------------------------------- form --- */

.field { margin-bottom: var(--gap); }

/* Paired fields on one line, at every width. */
.row { display: flex; gap: 10px; }
.row > .field { flex: 1 1 0; min-width: 0; }
.row--city .field--city  { flex: 1 1 auto; }
.row--city .field--state { flex: 0 0 62px; }
.row--city .field--zip   { flex: 0 0 88px; }

.label {
  display: block;
  font-size: 0.68rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink);
  margin-bottom: 0.35rem;
  white-space: nowrap;
}
.label__opt {
  text-transform: none;
  letter-spacing: 0;
  color: var(--muted);
  font-size: 0.85em;
}

.input {
  width: 100%;
  min-height: var(--tap);
  padding: 0.7rem 0.8rem;
  font-family: var(--sans);
  font-size: 16px;            /* 16px exactly — anything less zooms iOS Safari */
  line-height: 1.5;
  color: var(--ink);
  background: #FFFFFF;
  border: 1px solid var(--sage);
  border-radius: var(--radius);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  -webkit-appearance: none;
  appearance: none;
}
.input::placeholder { color: var(--muted); opacity: 0.6; }
.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(86, 102, 81, 0.22);
  outline: none;
}
.input--invalid { border-color: #A64B3C; }
.input--invalid:focus { box-shadow: 0 0 0 3px rgba(166, 75, 60, 0.18); }

.select {
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath fill='%233D443C' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 12px 8px;
  padding-right: 2.5rem;
}

.textarea { min-height: 84px; resize: vertical; }

.hint {
  font-size: 0.76rem;
  color: var(--muted);
  margin: 0.3rem 0 0;
}
.hint--count { text-align: right; font-variant-numeric: tabular-nums; }
.hint--center { text-align: center; margin-top: 0.8rem; }

.error {
  font-size: 0.82rem;
  color: #8E3D30;             /* 5.9:1 on white — readable, not alarming */
  margin: 0.3rem 0 0;
}

/* --------------------------------------------------------------- toggle --- */

.toggle-group { display: flex; gap: 10px; }

.toggle {
  flex: 1;
  min-height: var(--tap);
  padding: 0.7rem 0.5rem;
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--ink);
  background: #FFFFFF;
  border: 1px solid var(--sage);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.toggle:hover { border-color: var(--accent); }
.toggle[aria-pressed='true'] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--ivory);
}

/* ------------------------------------------------------------- envelope --- */

.envelope {
  background: var(--tint);
  border-left: 2px solid var(--accent);
  padding: 0.7rem 0.85rem;
  margin: 0 0 var(--gap);
}
.envelope__label {
  display: block;
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.25rem;
}
.envelope__line {
  display: block;
  font-family: var(--serif);
  font-size: 1.25rem;
  color: var(--ink);
}

/* -------------------------------------------------------------- notices --- */

.notice {
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  font-size: 0.88rem;
  margin-bottom: 1.1rem;
}
.notice p { margin: 0; }
.notice--error {
  background: #FBF0EE;
  border: 1px solid #D9B5AD;
  color: #7A3327;
}
.notice--setup {
  background: #F0F4EC;
  border: 1px solid var(--accent);
  color: var(--ink);
}
.notice--setup code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85em;
  background: rgba(86, 102, 81, 0.14);
  padding: 0.1em 0.35em;
  border-radius: 2px;
}

/* --------------------------------------------------------------- thanks --- */

.thanks { text-align: center; }
.thanks__title {
  font-size: clamp(2rem, 9vw, 2.75rem);
  margin-bottom: 0.6rem;
}
.thanks__title:focus { outline: none; }
.thanks__body {
  color: var(--muted);
  max-width: 36ch;
  margin-inline: auto;
  margin-bottom: 1.6rem;
}
.thanks__meta {
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 1.4rem;
  margin-bottom: 0;
}

/* --------------------------------------------------------------- footer --- */

.footer {
  background: var(--ink);
  color: var(--ivory);
  text-align: center;
  padding-block: clamp(2.25rem, 8vw, 3.5rem);
  padding-bottom: calc(clamp(2.25rem, 8vw, 3.5rem) + env(safe-area-inset-bottom, 0px));
}
.footer .rule { margin-top: 0; }
.footer__names {
  font-family: var(--serif);
  font-size: clamp(1.75rem, 8vw, 2.25rem);
  margin-bottom: 0.35rem;
}
.footer__date {
  font-family: var(--serif);
  font-size: 1.05rem;
  color: rgba(245, 246, 244, 0.86);
  margin-bottom: 0.3rem;
}
.footer__venue {
  font-size: 0.66rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(245, 246, 244, 0.72);
  margin: 0;
}

/* ===========================================================================
   TABLET — 600px and up
   =========================================================================== */
@media (min-width: 600px) {
  .wrap { padding-inline: 32px; }

  .hero__names { flex-direction: row; gap: 0.25em; align-items: baseline; }
  .hero__venue-sep { display: inline; }
  .hero__city { display: inline; }

  .countdown { gap: 10px; }
  .countdown__unit { padding: 1.05rem 0.5rem; }
  .countdown__label { font-size: 0.6rem; }

  .row { gap: 14px; }
  .row--city .field--state { flex: 0 0 90px; }
  .row--city .field--zip   { flex: 0 0 110px; }

  .btn--block { width: auto; min-width: 240px; display: flex; margin-inline: auto; }
}

/* ===========================================================================
   DESKTOP — 900px and up
   =========================================================================== */
@media (min-width: 900px) {
  .section__intro { font-size: 1rem; }
  .hero__bg { object-position: 45% 38%; }
}
