/* Wedding invitation: matches the printed card (cream stock, engraved
   frame, Monsieur La Doulaise script, letter-spaced EB Garamond).
   Card measurements come from the 599 x 838 px photo of the card; the
   cards scale with `cqw' (1% of the card's width). */

@font-face {
  font-family: "Monsieur La Doulaise";
  src: url("fonts/monsieur-la-doulaise.woff2") format("woff2");
  font-display: swap;
}
@font-face {
  font-family: "EB Garamond";
  src: url("fonts/eb-garamond.woff2") format("woff2");
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "EB Garamond";
  src: url("fonts/eb-garamond-italic.woff2") format("woff2");
  font-style: italic;
  font-display: swap;
}

:root {
  --paper: #faf1e8;
  --ink: #48433d;
  --ink-strong: #34302b;
  --muted: #6d655c;
  --table: #ebe0d3;
  --error: #8a2a1c;
  --script: "Monsieur La Doulaise", "Snell Roundhand", cursive;
  --serif: "EB Garamond", Garamond, "Times New Roman", serif;
}

* { box-sizing: border-box; }

html {
  background: var(--table);
  background-image: radial-gradient(ellipse at 50% 0%, #f3eae0 0%, var(--table) 70%);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--serif);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body { margin: 0; }

main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(28px, 6vw, 64px);
  padding: clamp(14px, 5vw, 64px) clamp(10px, 3vw, 24px) clamp(40px, 8vw, 96px);
}

p, h1, h2 { margin: 0; font-weight: normal; }

a { color: inherit; text-decoration-thickness: 0.05em; text-underline-offset: 0.18em; }
a:hover { color: var(--ink-strong); }
:focus-visible { outline: 2px solid var(--ink-strong); outline-offset: 3px; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

/* ---------- the cards ---------- */

.card {
  container-type: inline-size;
  position: relative;
  width: min(100%, 620px);
  background: var(--paper);
  box-shadow: 0 1px 2px rgb(60 40 20 / .10), 0 8px 28px rgb(60 40 20 / .13);
}

/* Front: the frame is drawn over the whole card; text sits inside it. */
.front { aspect-ratio: 599 / 838; }

.front .frame {
  position: absolute;
  left: 2.67%;
  top: 1.07%;
  width: 94.49%;
  height: auto;
  pointer-events: none;
  user-select: none;
}

.front .inside {
  position: absolute;
  inset: 24.6% 17% 16% 17%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.invited, .line, .follow, .kindly {
  font-style: italic;
  letter-spacing: .2em;
}

.invited { font-size: 2.75cqw; }

.names {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 2.6cqw;
  font-family: var(--script);
  color: var(--ink-strong);
  line-height: 1;
}
.names .name { font-size: 8.9cqw; white-space: nowrap; }
.names .and {
  display: flex;
  align-items: center;
  gap: 3.1cqw;
  font-size: 6.6cqw;
  margin: 1.4cqw 0 2.3cqw;
}
.names .and::before, .names .and::after {
  content: "";
  width: 13cqw;
  border-top: max(1px, .2cqw) solid var(--ink);
  transform: translateY(-.3cqw);
}

.date, .church, .phone {
  text-transform: uppercase;
  letter-spacing: .14em;
}
.date { font-size: 3.1cqw; margin-top: 4.6cqw; }
.line { font-size: 2.8cqw; margin-top: 1.25cqw; }
.church { font-size: 2.85cqw; letter-spacing: .15em; margin-top: 4.35cqw; line-height: 1.17; }
.address { margin-top: 1.7cqw; }
.address a { text-decoration: none; }
.address a:hover, .address a:focus-visible { text-decoration: underline; }
.follow { font-size: 2.45cqw; margin-top: 2.6cqw; }

/* Wider screens: put each line exactly where it is on the printed card
   (vertical centres measured from the photo, % of card height). */
@media (min-width: 561px) {
  .front .inside { inset: 0; display: block; }
  .front .inside > *, .front .names > * {
    position: absolute;
    left: 0;
    right: 0;
    margin: 0;
    transform: translateY(-50%);
  }
  .front .names { display: contents; }
  .front .names .and { justify-content: center; }
  .front .invited { top: 26.05%; }
  .front .names .name:first-child { top: 35.3%; }
  .front .names .and { top: 44.1%; }
  .front .names .name:last-child { top: 51.5%; }
  .front .date { top: 60.25%; }
  .front .year { top: 63.55%; }
  .front .time { top: 66.95%; }
  .front .church { top: 73.05%; }
  .front .address { top: 77.8%; }
  .front .follow { top: 81.6%; }
}

/* Back: crest with the couple's initials, then the reply.  Padding is
   on .sheet: cqw measures the card's content box, so the card itself
   has none. */
.reply .sheet {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 14cqw 9cqw 10cqw;
}

.crest {
  position: relative;
  width: 55cqw;
  container-type: inline-size;
}
.crest img { display: block; width: 100%; height: auto; }
.crest .initials {
  position: absolute;
  inset: 0;
  font-family: var(--script);
  color: var(--ink-strong);
  font-size: 18.6cqw;
  line-height: 1;
}
/* Glyph positions measured from the back of the printed card. */
.crest .initial-e { position: absolute; left: 34.1%; top: 32%; }
.crest .initial-s { position: absolute; left: 41.7%; top: 48.4%; }

.kindly {
  font-size: 2.6cqw;
  line-height: 1.5;
  margin-top: 6cqw;
}
.phone { font-size: 2.95cqw; letter-spacing: .2em; margin-top: 8.6cqw; }
.phone a { text-decoration: none; }

.divider {
  display: flex;
  align-items: center;
  gap: 3cqw;
  width: 100%;
  margin-top: 9cqw;
  font-family: var(--script);
  font-size: 6cqw;
  color: var(--ink-strong);
  line-height: 1.2;
}
.divider::before, .divider::after {
  content: "";
  flex: 1;
  border-top: max(1px, .2cqw) solid var(--ink);
}

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

.rsvp {
  width: 100%;
  margin-top: 5cqw;
  text-align: left;
  font-size: max(17px, 2.9cqw);
  color: var(--ink-strong);
}

.rsvp .field, .rsvp fieldset { margin: 0 0 1.6em; }

.rsvp label, .rsvp legend {
  display: block;
  font-style: italic;
  letter-spacing: .1em;
}
.rsvp .optional, .rsvp .hint { color: var(--muted); }
.rsvp .hint { font-style: italic; font-size: .85em; margin-top: .1em; }

.rsvp input[type="text"], .rsvp input[type="email"], .rsvp textarea, .rsvp select {
  display: block;
  width: 100%;
  margin-top: .35em;
  padding: .4em .1em;
  border: 0;
  border-bottom: 1px solid var(--ink);
  border-radius: 0;
  background: transparent;
  color: var(--ink-strong);
  font: inherit;
  font-size: max(17px, 1em);
}
.rsvp textarea {
  border: 1px solid #b9aea1;
  padding: .45em .55em;
  resize: vertical;
  min-height: 4.5em;
}
.rsvp select {
  width: auto;
  min-width: 5em;
  appearance: none;
  padding-right: 1.6em;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%),
                    linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position: calc(100% - .75em) 55%, calc(100% - .45em) 55%;
  background-size: .3em .3em;
  background-repeat: no-repeat;
}
.rsvp input:focus, .rsvp textarea:focus, .rsvp select:focus {
  outline: none;
  border-color: var(--ink-strong);
  box-shadow: 0 1px 0 var(--ink-strong);
}
.rsvp textarea:focus { box-shadow: inset 0 0 0 1px var(--ink-strong); }

.rsvp fieldset { border: 0; padding: 0; min-width: 0; }
.rsvp legend { padding: 0; }
.rsvp .options {
  display: flex;
  flex-wrap: wrap;
  gap: .3em 1.6em;
  margin-top: .3em;
}
.rsvp .options label {
  display: flex;
  align-items: center;
  gap: .5em;
  font-style: normal;
  letter-spacing: .04em;
  padding: .25em 0;
  cursor: pointer;
}
.rsvp input[type="radio"] {
  width: 1.05em;
  height: 1.05em;
  margin: 0;
  accent-color: var(--ink-strong);
}

.rsvp button {
  display: block;
  margin: 2.2em auto 0;
  padding: .7em 2.4em;
  border: 1px solid var(--ink-strong);
  border-radius: 0;
  background: transparent;
  color: var(--ink-strong);
  font: inherit;
  font-size: max(16px, .9em);
  text-transform: uppercase;
  letter-spacing: .22em;
  cursor: pointer;
}
.rsvp button:hover { background: var(--ink-strong); color: var(--paper); }

.rsvp .trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.rsvp .error-summary, .rsvp .notice {
  border: 1px solid var(--error);
  color: var(--error);
  padding: .7em 1em;
  margin-bottom: 1.6em;
}
.rsvp .error-summary ul { margin: .3em 0 0; padding-left: 1.2em; }
.rsvp .field-error { color: var(--error); font-style: italic; margin-top: .15em; }
.rsvp [aria-invalid="true"] input,
.rsvp input[aria-invalid="true"] { border-color: var(--error); }

/* ---------- thank you ---------- */

.thanks .sheet { padding-bottom: 12cqw; }
.thanks .script {
  font-family: var(--script);
  font-size: 11cqw;
  color: var(--ink-strong);
  margin-top: 6cqw;
  line-height: 1.1;
}
.thanks .kindly { margin-top: 4cqw; }

/* ---------- small screens ----------
   The front card keeps its proportions, so on a phone its type would be
   tiny.  Enlarge it and tighten the spacing so lines still fit inside
   the frame (they may wrap; the layout flows). */

@media (max-width: 560px) {
  main { padding-left: 8px; padding-right: 8px; }
  .front .inside { inset: 23.5% 15.5% 15% 15.5%; }
  .invited, .line, .follow { letter-spacing: .07em; }
  .invited { font-size: 3.55cqw; }
  .line { font-size: 3.45cqw; margin-top: .9cqw; }
  .follow { font-size: 3.2cqw; }
  .date, .church { font-size: 3.6cqw; letter-spacing: .07em; }
  .date { margin-top: 3.6cqw; }
  .church { margin-top: 3.4cqw; }
  .names .name { font-size: 10cqw; }
  .kindly { font-size: 4.1cqw; letter-spacing: .06em; }
  .phone { font-size: 4.2cqw; letter-spacing: .12em; }
  .divider { font-size: 8cqw; }
  .reply .sheet { padding: 12cqw 6cqw 12cqw; }
  .crest { width: 68cqw; }
}

@media (prefers-reduced-motion: no-preference) {
  .card { animation: settle .9s ease-out both; }
  .card + .card { animation-delay: .12s; }
  @keyframes settle {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: none; }
  }
}

@media print {
  html { background: none; }
  .card { box-shadow: none; animation: none; break-inside: avoid; }
  .rsvp, .divider { display: none; }
}

/* ---------- the couple's guest list ---------- */

.admin main { align-items: stretch; max-width: 1200px; margin: 0 auto; gap: 18px; }
.admin h1 { font-family: var(--script); font-size: 64px; color: var(--ink-strong); line-height: 1; }
.admin .totals { font-size: 22px; }
.admin .table-wrap { overflow-x: auto; background: var(--paper); box-shadow: 0 1px 2px rgb(60 40 20 / .1); }
.admin table { border-collapse: collapse; width: 100%; font-size: 17px; }
.admin th, .admin td { text-align: left; vertical-align: top; padding: 10px 12px; border-bottom: 1px solid #e2d6c8; }
.admin th { font-style: italic; font-weight: normal; letter-spacing: .06em; white-space: nowrap; }
.admin td.pre { white-space: pre-line; max-width: 22em; }
.admin tr.removed td { color: #a1978c; text-decoration: line-through; }
.admin tr.removed td:last-child { text-decoration: none; }
.admin .flag { display: block; font-size: 14px; font-style: italic; color: var(--error); }
.admin button.small { font: inherit; font-size: 14px; padding: 4px 10px; background: transparent; border: 1px solid var(--ink); cursor: pointer; }
