/* ============================================================
   Donor Dinner RSVP — formal, letterpress treatment
   Plays on Table Church brand: Deep Purple + Equity, subdued.
   ============================================================ */

/* ---------- Fonts ---------- */
@font-face {
  font-family: 'Equity';
  src: url('/fonts/Equity OT B Regular.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Equity';
  src: url('/fonts/Equity OT B Bold.otf') format('opentype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Equity';
  src: url('/fonts/Equity OT B Italic.otf') format('opentype');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Equity';
  src: url('/fonts/Equity OT B Bold Italic.otf') format('opentype');
  font-weight: 700;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Bebas Neue Pro';
  src: url('/fonts/BebasNeuePro-Book.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Bebas Neue Pro';
  src: url('/fonts/BebasNeuePro-Regular.otf') format('opentype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Bebas Neue Pro';
  src: url('/fonts/BebasNeuePro-Bold.otf') format('opentype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  /* Brand colors, subdued for formal treatment */
  --ink:        #2C2D38;    /* darker than charcoal for body text */
  --charcoal:   #484954;    /* official */
  --purple:     #5F65BE;    /* official, use sparingly */
  --purple-dim: #4A4F95;    /* darker purple for hover */
  --green:      #ACE3C9;    /* official, only as soft success accent */
  --green-dim:  #7DB29A;    /* darker green */
  --gray:       #E0E2EC;    /* official soft gray */
  --gray-dim:   #B8BCC9;
  --cream:      #FAF6EE;    /* warm paper background */
  --cream-card: #FFFDF8;    /* slightly brighter card */
  --rule:       #C9B98F;    /* warm bronze ornamental rule */

  --serif: 'Equity', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --display: 'Bebas Neue Pro', 'Bebas Neue', Impact, sans-serif;

  --radius:    4px;
  --radius-lg: 6px;
  --transition: 180ms ease;
}

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 17px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--serif);
  background: var(--cream);
  color: var(--ink);
  line-height: 1.6;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Subtle paper texture via gradient */
  background-image:
    radial-gradient(at 12% 18%, rgba(95,101,190,0.03) 0px, transparent 50%),
    radial-gradient(at 88% 82%, rgba(172,227,201,0.04) 0px, transparent 50%);
}

img { display: block; max-width: 100%; height: auto; }

.hidden { display: none !important; }

/* ---------- State containers ---------- */
.state {
  min-height: 100dvh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 3rem 1.25rem 4rem;
}

.state-loading,
.state-invalid,
.state-success {
  align-items: center;
}

/* ---------- Spinner (initial load) ---------- */
.spinner {
  width: 32px;
  height: 32px;
  border: 2px solid rgba(72,73,84,0.15);
  border-top-color: var(--purple);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Letter / card ---------- */
.letter {
  width: 100%;
  max-width: 560px;
  background: var(--cream-card);
  border: 1px solid rgba(72,73,84,0.08);
  border-radius: var(--radius-lg);
  padding: 3rem 2rem 2.5rem;
  box-shadow:
    0 1px 0 rgba(0,0,0,0.02),
    0 8px 32px -16px rgba(72,73,84,0.18);
}

.card {
  width: 100%;
  max-width: 480px;
  background: var(--cream-card);
  border: 1px solid rgba(72,73,84,0.08);
  border-radius: var(--radius-lg);
  padding: 3rem 2rem;
  text-align: center;
  box-shadow:
    0 1px 0 rgba(0,0,0,0.02),
    0 8px 32px -16px rgba(72,73,84,0.18);
}

.card-narrow { max-width: 420px; }

@media (min-width: 600px) {
  .letter { padding: 4rem 3.5rem 3rem; }
}

/* ---------- Letter head ---------- */
.letter-head { text-align: center; margin-bottom: 2.25rem; }

.mark {
  width: 48px;
  height: 48px;
  margin: 0 auto 1.25rem;
  opacity: 0.85;
}

.kicker {
  font-family: var(--display);
  font-weight: 500;
  font-size: 0.78rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--purple);
  margin-bottom: 1.25rem;
}

.rule {
  position: relative;
  height: 1px;
  background: var(--rule);
  margin: 1.5rem auto;
  max-width: 220px;
  opacity: 0.55;
}
.rule::before,
.rule::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 4px;
  height: 4px;
  background: var(--rule);
  border-radius: 50%;
  transform: translateY(-50%);
  opacity: 0.8;
}
.rule::before { left: -8px; }
.rule::after  { right: -8px; }

/* ---------- Letter body ---------- */
.letter-body { font-size: 1.0625rem; line-height: 1.7; }
.letter-body p { margin: 0 0 1.1em; }
.letter-body p:last-child { margin-bottom: 0; }

.salutation {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.2rem;
  color: var(--charcoal);
}

#display-name {
  font-style: italic;
  font-weight: 700;
  color: var(--charcoal);
}

.event-card {
  text-align: center;
  margin: 1.75rem 0;
  padding: 1.5rem 1rem;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  background: rgba(250, 246, 238, 0.5);
}

.event-line {
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.55;
  color: var(--charcoal);
}

.event-line em {
  font-style: italic;
}

.event-place {
  margin-top: 0.4em;
  font-size: 0.95rem;
  color: var(--charcoal);
}

.event-note {
  display: block;
  font-size: 0.82rem;
  color: rgba(72,73,84,0.65);
  font-style: italic;
  margin-top: 0.15em;
}

.closing {
  margin-top: 2rem !important;
  font-style: italic;
  color: var(--charcoal);
}

.signature {
  display: inline-block;
  margin-top: 0.25em;
  font-style: italic;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--purple);
}

/* ---------- RSVP form ---------- */
.rsvp { margin-top: 2rem; }

.section-label {
  font-family: var(--display);
  font-weight: 500;
  font-size: 0.85rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--purple);
  text-align: center;
  margin-bottom: 1.75rem;
}

.edit-notice {
  background: rgba(172,227,201,0.25);
  border-left: 3px solid var(--green-dim);
  padding: 0.65rem 0.9rem;
  font-size: 0.92rem;
  font-style: italic;
  color: var(--charcoal);
  margin-bottom: 1.5rem;
  border-radius: 0 var(--radius) var(--radius) 0;
}

form { display: flex; flex-direction: column; gap: 1.5rem; }

.field-group { display: flex; flex-direction: column; gap: 0.5rem; }

.field-row {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 1rem;
}

@media (max-width: 480px) {
  .field-row { grid-template-columns: 1fr; }
}

fieldset.field-group { border: none; padding: 0; margin: 0; }

.field-legend {
  font-family: var(--display);
  font-weight: 500;
  font-size: 0.78rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--charcoal);
  margin-bottom: 0.3rem;
}

/* Radio cards */
.radio-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
}

@media (min-width: 480px) {
  .radio-row {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  }
}

.radio-card {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.7rem 0.85rem;
  background: var(--cream);
  border: 1px solid var(--gray);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.radio-card:hover {
  border-color: var(--purple);
}

.radio-card:has(input:checked) {
  border-color: var(--purple);
  background: rgba(95,101,190,0.06);
}

.radio-card input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--gray-dim);
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
  cursor: pointer;
  transition: border-color var(--transition);
  margin: 0;
}

.radio-card input[type="radio"]:checked {
  border-color: var(--purple);
}

.radio-card input[type="radio"]:checked::after {
  content: '';
  position: absolute;
  top: 2.5px;
  left: 2.5px;
  width: 8px;
  height: 8px;
  background: var(--purple);
  border-radius: 50%;
}

.radio-label {
  font-family: var(--serif);
  font-size: 0.98rem;
  color: var(--ink);
}

/* Inputs */
input[type="text"],
input[type="number"],
input[type="email"],
textarea {
  font-family: var(--serif);
  font-size: 1rem;
  color: var(--ink);
  background: var(--cream);
  border: 1px solid var(--gray);
  border-radius: var(--radius);
  padding: 0.6rem 0.75rem;
  width: 100%;
  outline: none;
  transition: border-color var(--transition), background var(--transition);
  -webkit-appearance: none;
  appearance: none;
}

input[type="number"] { max-width: 100%; }

input:focus, textarea:focus {
  border-color: var(--purple);
  background: var(--cream-card);
}

textarea { resize: vertical; min-height: 60px; line-height: 1.5; }

input::placeholder, textarea::placeholder {
  color: rgba(72,73,84,0.45);
  font-style: italic;
}

/* Conditional sections */
.conditional-yes,
.conditional-plus-one,
.childcare-detail {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.conditional-yes.hidden,
.conditional-plus-one.hidden,
.childcare-detail.hidden {
  display: none !important;
}

/* Error */
.error-message {
  background: rgba(199, 70, 70, 0.08);
  border-left: 3px solid #c74646;
  color: #8B3434;
  padding: 0.65rem 0.9rem;
  font-size: 0.92rem;
  border-radius: 0 var(--radius) var(--radius) 0;
}

/* Submit */
.btn-primary {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--cream);
  background: var(--purple);
  border: none;
  border-radius: var(--radius);
  padding: 1rem 1.5rem;
  cursor: pointer;
  transition: background var(--transition), transform 100ms ease;
  -webkit-tap-highlight-color: transparent;
}
.btn-primary:hover { background: var(--purple-dim); }
.btn-primary:active { transform: scale(0.99); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-loading.hidden { display: none; }

/* Success / invalid pages */
.display {
  font-family: var(--serif);
  font-weight: 700;
  font-style: italic;
  font-size: 1.6rem;
  line-height: 1.25;
  color: var(--charcoal);
  margin: 0.5rem 0 1rem;
}

.lede {
  font-size: 1.05rem;
  color: var(--ink);
  margin-bottom: 1.25rem;
  line-height: 1.6;
}

.muted {
  font-size: 0.9rem;
  color: rgba(72,73,84,0.7);
}
.muted a, .muted a:visited {
  color: var(--purple);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
