/*
 * Save-the-date card for Emilia & Ronan.
 *
 * Ported from the original static save-the-date.css, with three changes:
 *   - sizes are clamped rather than purely vh-based, so the card survives short
 *     laptop viewports and stacks into a single column on a phone;
 *   - the global `letter-spacing: -5px` is now per-element and in `em`, so the
 *     tracking scales with the type instead of collapsing the small text;
 *   - the photo carries a gradient scrim, because the top third of it is white
 *     roses and white text was unreadable against them.
 */

:root {
  --green: #06402B;
  --green-deep: #042f1f;
  --paper: #fffdf8;
  --ink: #1c1c1a;
  --ink-soft: #6f6f68;
  --display: "Cinzel", "Lancelot", Georgia, "Times New Roman", serif;
  --body: "Lancelot", Georgia, "Times New Roman", serif;
  --cursive: "Monsieur La Doulaise", "Snell Roundhand", cursive;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* The `hidden` attribute is only `display: none` in the user agent stylesheet,
   so any author rule setting `display` on the same element silently beats it —
   which is how a panel marked hidden stayed on screen. Anything toggled by
   JavaScript relies on this rule holding. */
[hidden] {
  display: none !important;
}

body {
  background: var(--green);
  color: var(--ink);
  font-family: var(--body);
  font-optical-sizing: auto;
  min-height: 100svh;
  -webkit-font-smoothing: antialiased;
}

/* The card alone, centred in the viewport: the public save-the-date. */
.card-stage {
  display: flex;
  padding: clamp(16px, 4vw, 40px);
  min-height: 100svh;
}

/* The card at the top of a page that continues below it — a guest's own page,
   where the form follows. Sized so a little of what comes next is visible,
   which is what invites the scroll. */
.card-stage--top {
  min-height: auto;
  align-items: center;
  padding-bottom: 0;
}

/* ---------------------------------------------------------------- the card */

.save-the-date {
  display: flex;
  margin: auto;
  background: var(--paper);
  box-shadow: 0 24px 60px rgb(0 0 0 / 0.35);
  max-width: 100%;
}

/* Only where the card is a fixed side-by-side shape. Below 720px it stacks and
   sizes itself from its contents; forcing a height there clipped the info panel
   and pushed its footer out onto the page background. */
@media (min-width: 721px) {
  .card-stage--top .save-the-date {
    height: min(72vh, 700px);
  }
}

/* ------------------------------------------------------------- photo panel */

/* The photo and the titles occupy the same grid cell, which is how you stack
   two elements without taking either out of flow. Flex cannot do this: it
   arranges siblings beside or beneath each other, never on top. The photo is a
   real <img> rather than a background so the browser can pick a 54KB variant
   for a phone instead of the 4.3MB original, and so it can carry alt text. */
.save-the-date__photo {
  display: grid;
  grid-template-areas: "stack";
  flex: 0 0 auto;
  overflow: hidden;
  color: #fff;
}

.save-the-date__photo > * {
  grid-area: stack;
}

.save-the-date__photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Nothing sits between the type and the photograph — no scrim, no tint, no
   filter. It is a professional photograph and any overlay heavy enough to
   guarantee contrast also recolours it. Legibility is handled entirely on the
   text, with a shadow that darkens only the letterforms themselves. */
.save-the-date__titles {
  align-self: start;
  z-index: 1;
  padding: clamp(14px, 3.2vh, 28px) clamp(12px, 2.4vw, 22px);
  text-align: center;
  text-shadow: 0 1px 2px rgb(0 0 0 / 0.5), 0 2px 12px rgb(0 0 0 / 0.45);
}

.save-the-date__titles h1 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(1.5rem, 4.4vh, 2.6rem);
  letter-spacing: -0.02em;
  line-height: 1.08;
}

.save-the-date__couple {
  font-family: var(--display);
  font-size: clamp(1.15rem, 3.3vh, 1.95rem);
  letter-spacing: -0.015em;
  margin-top: 0.35em;
}

.save-the-date__when {
  font-family: var(--display);
  font-size: clamp(0.7rem, 1.7vh, 0.95rem);
  letter-spacing: 0.04em;
  margin-top: 0.7em;
  text-transform: uppercase;
}

.save-the-date__when span {
  opacity: 0.65;
  margin-inline: 0.35em;
}

/* -------------------------------------------------------------- info panel */

.save-the-date__info {
  display: flex;
  flex-direction: column;
  gap: clamp(14px, 3vh, 30px);
  padding: clamp(20px, 4.5vh, 40px) clamp(18px, 2.6vw, 34px);
}

.save-the-date__programme {
  /* Paired with the footer's `margin-top: auto`, this splits the panel's spare
     height evenly above and below the programme, so the block sits optically
     centred while the footer still rests on the base of the card. */
  margin-top: auto;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(0.78rem, 1.8vh, 1rem);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  text-align: center;
  color: var(--ink-soft);
}

.save-the-date__events {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: clamp(16px, 3.4vh, 32px);
  text-align: center;
}

.save-the-date__events time {
  display: block;
  font-family: var(--display);
  font-size: clamp(1.05rem, 2.7vh, 1.5rem);
  letter-spacing: -0.01em;
  color: var(--green);
}

.save-the-date__events span {
  display: block;
  margin-top: 0.4em;
  font-size: clamp(0.82rem, 1.75vh, 1rem);
  line-height: 1.45;
  text-wrap: balance;
}

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

.save-the-date__footer {
  margin-top: auto;
  padding-top: clamp(18px, 4vh, 36px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6em;
}

.save-the-date__languages {
  font-family: var(--display);
  display: flex;
  gap: 0.75em;
  font-size: clamp(0.68rem, 1.5vh, 0.82rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.save-the-date__languages a {
  color: var(--ink-soft);
  text-underline-offset: 0.25em;
}

.save-the-date__languages a:hover,
.save-the-date__languages a:focus-visible {
  color: var(--green);
}

.save-the-date__languages [aria-current] {
  color: var(--green);
  text-decoration: underline;
  text-underline-offset: 0.25em;
}

.save-the-date__aside {
  color: var(--ink-soft);
  font-size: clamp(0.66rem, 1.45vh, 0.8rem);
  text-align: center;
}

.cursive {
  font-family: var(--cursive);
  font-size: 1.5em;
  line-height: 0.7;
  letter-spacing: 0;
  vertical-align: -0.08em;
}

/* ------------------------------------------------------- responsive layout */

/* Wide: the original side-by-side card. The photo keeps the source image's
   2:3 portrait ratio (3937x5905) and the info panel sits beside it. */
@media (min-width: 721px) {
  .save-the-date {
    height: min(78vh, 760px);
  }

  .save-the-date__photo {
    height: 100%;
    aspect-ratio: 3937 / 5905;
  }

  .save-the-date__info {
    width: clamp(260px, 34vh, 360px);
  }
}

/* Narrow: stack into a single column. The photo is cropped to a friendlier
   ratio so the couple stays visible without pushing the programme off-screen. */
@media (max-width: 720px) {
  body {
    padding: clamp(12px, 4vw, 24px);
  }

  .save-the-date {
    flex-direction: column;
    width: min(92vw, 460px);
  }

  .save-the-date__photo {
    width: 100%;
    aspect-ratio: 4 / 5;
  }

  .save-the-date__photo img {
    object-position: center 32%;
  }

  .save-the-date__titles h1 {
    font-size: clamp(1.5rem, 8vw, 2.2rem);
  }

  .save-the-date__couple {
    font-size: clamp(1.15rem, 6.2vw, 1.7rem);
  }

  .save-the-date__when {
    font-size: clamp(0.68rem, 3vw, 0.85rem);
  }

  .save-the-date__events {
    gap: 22px;
  }

  .save-the-date__events time {
    font-size: clamp(1.05rem, 5vw, 1.35rem);
  }

  .save-the-date__events span,
  .save-the-date__programme {
    font-size: clamp(0.82rem, 3.6vw, 0.98rem);
  }
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
