/* =============================================================================
   Guest-facing styling — first pass at the printed invitation's look.

   Taken from the paper design: warm blush paper, deep forest-green ink, a
   handwriting script for names and section titles, and a serif set in small
   caps with wide tracking for every label. Lots of air, nothing boxed in.

   SECURITY: no @import, no @font-face, no url() pointing anywhere off this
   origin. A single request to a font CDN would hand the invitation token to a
   third party via the Referer header — see the note in index.html.

   Consequence: the script face is whatever the device already has. iOS/macOS
   get Snell Roundhand (close to the card), Windows gets Segoe Script, Android
   falls back to its generic cursive and looks noticeably different. Dropping in
   a self-hosted, licensed font file later means changing --font-script and
   adding one @font-face with a local path — nothing else here has to move.

   Mobile first throughout: the link arrives by QR code off a printed card, so
   very nearly every guest opens this on a phone.
   ============================================================================= */

:root {
  /* Sampled from the invitation. --paper is the card, --paper-raised the
     lighter inner panel the info booklet is printed on. */
  --paper: #f3e3d5;
  --paper-raised: #f8ece1;

  --ink: #17372b;           /* deep forest green — script, headings, rules */
  --ink-body: #2b3a32;      /* body copy: near-black, a touch warmer */
  --ink-muted: #6b7a70;

  --rule: rgba(23, 55, 43, 0.16);
  --rule-strong: rgba(23, 55, 43, 0.38);

  --font-script: "Snell Roundhand", "Segoe Script", "Bradley Hand",
    "Brush Script MT", cursive;
  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia,
    "Times New Roman", serif;

  /* Tracked small caps. The single most recognisable thing about the card —
     every label on it is set this way. */
  --tracking-label: 0.26em;

  --measure: 33rem;

  /* The card is printed on paper; it has one appearance. Without this, mobile
     browsers in dark mode may invert it into something that isn't the design. */
  color-scheme: light;
}

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

body {
  margin: 0;
  padding: clamp(2.5rem, 9vw, 5rem) 1.5rem clamp(3rem, 10vw, 6rem);

  background-color: var(--paper);
  color: var(--ink-body);

  font-family: var(--font-serif);
  font-size: 1rem;
  line-height: 1.75;

  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}

#app {
  max-width: var(--measure);
  margin: 0 auto;
}

/* --- Shared type ---------------------------------------------------------- */

/* The tracked, upper-case label. Letter-spacing adds trailing space to the last
   character, which visibly breaks centring — the negative margin takes it back. */
.eyebrow {
  margin: 0;
  font-size: 0.7rem;
  line-height: 2;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--ink);
  margin-right: calc(var(--tracking-label) * -1);
}

/* Script, used exactly where the card uses it: names, dates, section titles. */
.script {
  font-family: var(--font-script);
  font-weight: 400;
  color: var(--ink);
  line-height: 1.15;
  letter-spacing: 0.01em;
}

/* --- Masthead ------------------------------------------------------------- */

.masthead {
  margin-bottom: clamp(2.5rem, 8vw, 4rem);
}

.masthead .eyebrow {
  max-width: 14em; /* wraps like the card's stacked label, not one long line */
}

.masthead-couple {
  font-family: var(--font-script);
  font-weight: 400;
  color: var(--ink);
  line-height: 1.05;
  letter-spacing: 0.01em;

  /* Big, and the first thing you see — as on the cover. clamp keeps it from
     wrapping mid-name on a narrow phone. */
  font-size: clamp(2.75rem, 15vw, 4.5rem);
  margin: 1.25rem 0 0;
}

/* The pre-rendered names. Sized as a share of the column rather than in absolute units, so
   it scales with everything else; the SVG's own viewBox supplies the aspect ratio, so
   height follows on its own and the page doesn't reflow once it loads.

   Centred rather than left-aligned like the rest of the masthead — the card itself has it
   flush left, but centred reads better once it's a standalone image on a plain page rather
   than one element among several on a printed layout. A deliberate departure from the card,
   not an oversight. */
.masthead-couple-image {
  display: block;
  width: 100%;
  max-width: 27rem; /* was 22rem — the column comfortably fits it larger */
  margin: 0 auto;
  height: auto;
}

/* --- Sections ------------------------------------------------------------- */

section {
  margin-top: clamp(2.75rem, 9vw, 4.5rem);
}

/* Section titles are script on the card ("Informationen", "Rsvp"), not caps. */
section > h2 {
  font-family: var(--font-script);
  font-weight: 400;
  font-size: clamp(1.9rem, 7vw, 2.4rem);
  line-height: 1.1;
  color: var(--ink);
  margin: 0 0 1.25rem;
}

/* A hairline above each section, echoing the folds and edges of the card. */
section + section {
  border-top: 1px solid var(--rule);
  padding-top: clamp(2.25rem, 8vw, 3.5rem);
}

/* Opens the RSVP block — that block has no heading of its own, so this line carries it. */
.greeting {
  font-family: var(--font-script);
  color: var(--ink);
  font-size: clamp(1.5rem, 6vw, 1.9rem);
  line-height: 1.25;
  margin: 0 0 1rem;
}

/* --- Date / time / place strip -------------------------------------------- */

/* The card's "unser tag" panel turned on its side: three captioned icons across, with the
   panel's own script title dropped since the icons and captions say it already. */
.details {
  list-style: none;
  margin: clamp(2.5rem, 9vw, 4rem) 0;
  padding: clamp(1.75rem, 6vw, 2.5rem) 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);

  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  align-items: start;
}

.detail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  text-align: center;
}

/* Captions are tighter than a standalone label: three of them sit side by side on a phone
   and "Standesamt Ahrensburg" has to wrap without looking like it broke. */
.detail .eyebrow {
  font-size: clamp(0.55rem, 2.4vw, 0.68rem);
  letter-spacing: 0.14em;
  line-height: 1.8;
  margin-right: -0.14em;
  text-wrap: balance;
}

.detail-icon {
  width: clamp(2.75rem, 13vw, 3.75rem);
  height: auto;

  color: var(--ink);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* The day number is type, not line art — it must be filled and not stroked, or it renders
   as a heavy outline. */
.detail-icon text {
  fill: currentColor;
  stroke: none;
  font-family: var(--font-serif);
  font-size: 15px;
  letter-spacing: 0.06em;
}

.detail-icon [fill="currentColor"] {
  stroke: none;
}

/* Draws in the paper colour to knock a gap out of the line beneath it — how the rings are
   made to interlock rather than merely overlap. Slightly heavier than the line it cuts. */
.detail-icon .cut {
  stroke: var(--paper);
  stroke-width: 3.2;
}

.intro {
  margin: 0 0 2rem;
  max-width: 30rem;
}

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

form {
  margin: 0;
}

/* fieldset/legend stay for the accessibility grouping — each guest's radios are
   a named group — but every default border and inset is stripped off. */
.guest {
  border: 0;
  margin: 0;
  padding: 1.5rem 0;
  border-top: 1px solid var(--rule);
}

.guest:last-of-type {
  border-bottom: 1px solid var(--rule);
}

/* A <legend> is normally laid into the fieldset's top border, which here left the rule
   running out of the guest's name like a strikethrough. Floating it takes it out of that
   special positioning and makes it behave as an ordinary block, so the rule above stays
   unbroken. width:100% keeps the choices below it rather than beside it. */
.guest-name {
  float: left;
  width: 100%;

  font-family: var(--font-script);
  color: var(--ink);
  font-size: 1.65rem;
  line-height: 1.2;
  padding: 0;
  margin-bottom: 0.5rem;
}

.choice {
  /* A flex container establishes its own formatting context and would otherwise sit
     alongside the floated legend above instead of below it. */
  clear: both;

  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0;
}

.choice label {
  flex: 1;
  padding: 0.5rem 0;
  cursor: pointer;
  color: var(--ink-body);
  transition: color 0.15s ease;
}

/* The chosen answer sits up in full-strength ink; the others stay quieter. */
.choice:has(input:checked) label {
  color: var(--ink);
}

.choice input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  width: 1.05rem;
  height: 1.05rem;
  margin: 0;
  border: 1px solid var(--rule-strong);
  border-radius: 50%;
  background: transparent;
  display: grid;
  place-content: center;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.choice input[type="radio"]::before {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--ink);
  transform: scale(0);
  transition: transform 0.15s ease;
}

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

.choice input[type="radio"]:checked::before {
  transform: scale(1);
}

.choice input[type="radio"]:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

.validation {
  margin: 1.25rem 0 0;
  color: var(--ink);
  font-style: italic;
}

button[type="submit"] {
  display: block;
  width: 100%;
  margin-top: 2rem;
  padding: 1rem 1.5rem;

  background: transparent;
  border: 1px solid var(--ink);
  border-radius: 0;
  color: var(--ink);

  font-family: var(--font-serif);
  font-size: 0.72rem;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  /* Same trailing-space correction as .eyebrow — centred text inside a button. */
  text-indent: var(--tracking-label);

  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

button[type="submit"]:hover:not(:disabled) {
  background: var(--ink);
  color: var(--paper);
}

button[type="submit"]:disabled {
  opacity: 0.5;
  cursor: default;
}

button[type="submit"]:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

@media (min-width: 30rem) {
  button[type="submit"] {
    width: auto;
    min-width: 16rem;
  }
}

/* --- FAQ ------------------------------------------------------------------ */

details {
  border-bottom: 1px solid var(--rule);
}

details:first-of-type {
  border-top: 1px solid var(--rule);
}

summary {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: 1.1rem 0;
  cursor: pointer;
  color: var(--ink);
  list-style: none; /* hides the default triangle in Firefox */
}

summary::-webkit-details-marker {
  display: none;
}

/* Hand-drawn feel on the card comes from thin line art; a plain +/− is the
   restrained equivalent and needs no image. */
summary::after {
  content: "+";
  margin-left: auto;
  font-size: 1.1rem;
  line-height: 1;
  color: var(--ink-muted);
  transition: transform 0.2s ease;
}

details[open] summary::after {
  content: "−";
}

summary:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

details > p {
  margin: 0 0 1.25rem;
  padding-right: 2rem;
  color: var(--ink-body);
}

/* --- Message screens (landing, confirmation, not found, error) ------------- */

/* These carry the whole page on their own, so they get the cover's treatment:
   one large script line, one quiet paragraph, plenty of room. */
.message-title {
  font-family: var(--font-script);
  font-weight: 400;
  color: var(--ink);
  font-size: clamp(2.25rem, 11vw, 3.25rem);
  line-height: 1.1;
  margin: 0 0 1.5rem;
}

.message-body {
  margin: 0;
  max-width: 28rem;
}

/* A confirmation is followed by the FAQ, so it needs the section rule above it
   that a standalone message screen doesn't. */
.message-body + section {
  margin-top: clamp(2.75rem, 9vw, 4.5rem);
}

/* A screen that is *only* a message — the landing page, not found, an error — centres in
   the viewport instead of clinging to the top of an otherwise empty page. The confirmation
   is excluded by :not(:has(section)), since the FAQ still follows it there.
   Browsers without :has() simply keep the top alignment, which is no worse than before. */
body:has(.message-title):not(:has(section)) {
  display: flex;
  align-items: center;
  min-height: 100vh;
  min-height: 100svh; /* excludes mobile browser chrome, so nothing sits under the URL bar */
}

body:has(.message-title):not(:has(section)) #app {
  width: 100%;
}

/* --- Pre-JS state --------------------------------------------------------- */

#initial-loading {
  margin: 0;
  color: var(--ink-muted);
  font-style: italic;
}

/* --- Creases (wide screens only) ------------------------------------------ */

/* Two hairlines running the full height of the page, flanking the column — the folds of
   the card the invitation is printed on. Only once the viewport is wide enough that they
   sit clear of the text; on a phone there is no room and no card metaphor to carry.

   Absolutely positioned, so they don't become flex items on the centred message screens
   and don't affect layout at all. */
@media (min-width: 62rem) {
  body {
    position: relative;
  }

  body::before,
  body::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--rule);
    pointer-events: none;
  }

  body::before {
    left: calc(50% - (var(--measure) / 2) - 4rem);
  }

  body::after {
    left: calc(50% + (var(--measure) / 2) + 4rem);
  }
}

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