/* Caitlin & Drew — generated from tokens.json */
:root, [data-theme="paper"] {
  --white: #ffffff; /* Card paper: the save the date and invitation cards, and any panel that holds text beside a photo. */
  --champagne-100: #f7efe1; /* Page ground behind the envelope and every section. */
  --champagne-300: #ecdcc0; /* Envelope liner and photo placeholders. */
  --champagne-500: #dcc59f; /* Shading on champagne panels. Decorative only: no text sits on it. */
  --burgundy-500: #8c2a3e; /* Hover state of burgundy buttons. */
  --burgundy-700: #6d1a2b; /* Names, headings and the primary button; the envelope behind its paper while the paper loads. As text it reads on white, champagne-100 and champagne-300. */
  --burgundy-900: #4a0f1c; /* Envelope folds, the darkening over the flap's paper (at half strength), pressed buttons and the focus ring on light grounds. */
  --gold-300: #d9bd82; /* Text, hairlines and the focus ring on burgundy-700 and burgundy-900. */
  --gold-500: #b8924a; /* Foil hairlines, card borders and short rules on light grounds. Never text on a light ground: under 3:1 on white. */
  --gold-700: #7f6026; /* Small caps labels on white and champagne-100. Not for text on champagne-300, where it falls to 4.3:1. */
  --ink: #2a1a1c; /* Body copy on white, champagne-100 and champagne-300. */
  --ink-muted: #6b5557; /* Secondary copy and captions on white, champagne-100 and champagne-300. */
  --on-burgundy: #fbf3e4; /* Text on burgundy-500, burgundy-700 and burgundy-900 fills. */
  --shadow-card: 0 12px 32px rgba(74, 15, 28, 0.16); /* Lifts a card off the page or out of the envelope. */
  --shadow-seal: 0 2px 6px rgba(42, 26, 28, 0.4); /* Seats the wax seal on the flap, and lifts the seal button. */
  --shadow-flap: 0 3px 6px rgba(42, 26, 28, 0.7); /* Lifts the envelope's flap off its body. */
  --shadow-pocket: 0 2px 5px rgba(42, 26, 28, 0.45); /* Lifts the envelope's pocket off the card behind it. */
}
:root {
  --space-1: 4px; /* Gap between an eyebrow and the line it labels. */
  --space-2: 8px; /* Tight gaps inside a card; inset of the seal's inner ring. */
  --space-3: 16px; /* Inset of a card's gold border; gap between buttons. */
  --space-4: 24px; /* Page side padding on a phone; button side padding. */
  --space-6: 40px; /* Padding inside a card; gap between blocks in a section. */
  --space-8: 64px; /* Gap between sections of the page. */
  --radius-none: 0; /* The envelope and photographs: paper has square corners. */
  --radius-sm: 2px; /* Cards and buttons: a barely softened paper edge. */
  --radius-full: 50%; /* The wax seal, and the round top of an arch panel. */
  --font-display: "Cormorant Garamond", Garamond, "Times New Roman", serif;
  --font-caps: Cinzel, "Cormorant Garamond", serif;
  --font-body: "EB Garamond", Garamond, Georgia, serif;
  --font-script: "Pinyon Script", "Snell Roundhand", cursive;
  --text-names: 500 44px/1.05 var(--font-display); /* The couple's names on the card and the first screen. burgundy-700. */
  --text-names-inline: 500 30px/1.15 var(--font-display); /* The names on one line, under the photograph on the photo card. burgundy-700. The ampersand between them is set in the monogram face at 26px. */
  --text-heading: 500 32px/1.15 var(--font-display); /* Section headings on the invitation page. burgundy-700. */
  --text-date: italic 500 24px/1.3 var(--font-display); /* The date and other single-line highlights. ink. */
  --text-eyebrow: 500 12px/16px var(--font-caps); /* Small engraved caps above a name or number. gold-700 on white and champagne-100; gold-300 on burgundy. */
  --text-label: 500 14px/20px var(--font-caps); /* Button text and the venue line. */
  --text-body: 400 18px/28px var(--font-body); /* Paragraphs: the story, travel notes, schedule details. ink. */
  --text-small: 400 15px/22px var(--font-body); /* Captions and footnotes. ink-muted. Nothing in EB Garamond or Cormorant is set smaller; only the Cinzel caps styles are. */
  --text-monogram: 400 32px/1 var(--font-script); /* The ampersand between the names, and nothing else: 32px between stacked names, 26px within names-inline. The monogram itself is part of the seal art. */
}
.names {
  font-family: var(--font-display);
  font-size: 44px;
  line-height: 1.05;
  font-weight: 500;
  letter-spacing: 0;
}
.names-inline {
  font-family: var(--font-display);
  font-size: 30px;
  line-height: 1.15;
  font-weight: 500;
  letter-spacing: 0;
}
.heading {
  font-family: var(--font-display);
  font-size: 32px;
  line-height: 1.15;
  font-weight: 500;
  letter-spacing: 0;
}
.date {
  font-family: var(--font-display);
  font-size: 24px;
  line-height: 1.3;
  font-weight: 500;
  letter-spacing: 0;
  font-style: italic;
}
.eyebrow {
  font-family: var(--font-caps);
  font-size: 12px;
  line-height: 16px;
  font-weight: 500;
  letter-spacing: 0.24em;
}
.label {
  font-family: var(--font-caps);
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
  letter-spacing: 0.16em;
}
.body {
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 28px;
  font-weight: 400;
  letter-spacing: 0;
}
.small {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 22px;
  font-weight: 400;
  letter-spacing: 0;
}
.monogram {
  font-family: var(--font-script);
  font-size: 32px;
  line-height: 1;
  font-weight: 400;
  letter-spacing: 0;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-gutter: stable both-edges; }
body { margin: 0; background: var(--champagne-100); color: var(--ink); font: var(--text-body); }
h1, p, figure { margin: 0; }

.page {
  max-width: 420px;
  margin: 0 auto;
  padding: var(--space-8) var(--space-4);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-8);
}

/* Sealed: the envelope covers the page, which stays laid out (the opening measures it). */
.sealed .page { visibility: hidden; }
.sealed body, .opening body { overflow: hidden; }

:focus-visible { outline: 2px solid var(--burgundy-900); outline-offset: 2px; }

.eyebrow {
  font: var(--text-eyebrow);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--gold-700);
}

/* InviteCard: the photo version with the footnote, as the design system's guide sets it. */
.card {
  position: relative;
  width: min(340px, 100%);
  height: 476px;
  padding: var(--space-6) 76px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
  background: var(--white);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-card);
}
/* Layers, bottom to top: the gold border, the vines, the live text. */
.card::before {
  content: "";
  position: absolute;
  inset: var(--space-3);
  border: 1px solid var(--gold-500);
  pointer-events: none;
  z-index: 0;
}
.card > :not(.vine) { position: relative; z-index: 2; }

/* The vine pair, sized to the card's height and split down the middle; each half pushed 18px
   past its edge and trimmed there by the card's overflow. */
.vine {
  position: absolute;
  top: 0;
  width: 158px;
  height: 100%;
  z-index: 1;
  pointer-events: none;
  background-repeat: no-repeat;
  background-size: auto 100%;
  background-image: url(../img/vines-1428.webp);
  background-image: image-set(url(../img/vines-952.webp) 2x, url(../img/vines-1428.webp) 3x);
}
.vine-l { left: -18px; background-position: left top; }
.vine-r { right: -18px; background-position: right top; }

.photo {
  flex: none;
  width: 156px;
  height: 200px;
  padding: 3px;
  border: 1px solid var(--gold-500);
  border-radius: 78px 78px 0 0;
  background: var(--white);
}
.photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 50%;
  border-radius: 75px 75px 0 0;
}

.names {
  margin-top: var(--space-3);
  font: var(--text-names-inline);
  color: var(--burgundy-700);
  white-space: nowrap;
}
.names:focus { outline: none; }
/* The monogram token is 32px (stacked names); within names-inline the InviteCard guide sets it at 26px. */
.names .amp { font: var(--text-monogram); font-size: 26px; padding: 0 2px; }

.card .eyebrow { margin-top: var(--space-2); }
.date { margin-top: var(--space-2); font: var(--text-date); color: var(--ink); }
.place { margin-top: var(--space-1); font: var(--text-small); color: var(--ink-muted); }
.foot { margin-top: var(--space-4); font: var(--text-small); font-style: italic; color: var(--ink-muted); }
/* Below 375px the one-line footnote reaches the roses; a narrower measure wraps it onto two
   lines, "Formal invitation / to follow" (owner's decision, 2026-12-04). Measured in EB Garamond
   italic 15px: "Formal invitation" is about 100px and "Formal invitation to" 115px, so 7em
   (105px) breaks after "invitation"; 8em would leave "follow" alone on the second line. */
@media (max-width: 374.98px) {
  .foot { max-width: 7em; margin-inline: auto; }
}

.after-card { display: flex; flex-direction: column; align-items: center; gap: var(--space-6); }

.countdown { display: flex; }
.countdown[hidden] { display: none; }
.cell { min-width: 72px; padding: 0 var(--space-3); text-align: center; border-left: 1px solid var(--gold-500); }
.cell:first-child { border-left: 0; }
.num {
  display: block;
  font: var(--text-names);
  color: var(--burgundy-700);
  font-variant-numeric: lining-nums tabular-nums;
}
.unit {
  display: block;
  margin-top: var(--space-1);
  font: var(--text-eyebrow);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--gold-700);
}

/* Design-system request 6: four cells are 430px wide; phones show three, tighter. */
@media (max-width: 479.98px) {
  .cell-seconds { display: none; }
  .cell { padding: 0 var(--space-2); }
}
@media (prefers-reduced-motion: reduce) {
  .cell-seconds { display: none; }
}

.actions { display: flex; flex-direction: column; align-items: center; gap: var(--space-3); }

.button {
  min-height: 48px;
  padding: 0 var(--space-4);
  border: 1px solid var(--burgundy-700);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--burgundy-700);
  font: var(--text-label);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
}
.button:hover { border-color: var(--burgundy-500); color: var(--burgundy-500); }
.button-primary { background: var(--burgundy-700); color: var(--on-burgundy); }
.button-primary:hover { background: var(--burgundy-500); border-color: var(--burgundy-500); color: var(--on-burgundy); }
.button-primary:active { background: var(--burgundy-900); border-color: var(--burgundy-900); }

/* Design-system request 2: the two calendars, under the button once it is pressed. */
.calendar-choices { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-3); }
.calendar-choices[hidden] { display: none; }

.link {
  font: var(--text-body);
  color: var(--burgundy-700);
  text-decoration: underline;
  text-decoration-color: var(--gold-500);
  text-underline-offset: 4px;
}

.stage {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  background: var(--champagne-100);
}
.sealed .stage, .opening .stage { display: flex; }
.stage.is-settling { background: transparent; }

/* 320 x 200 in design units; narrows with the page on small phones. */
.envelope {
  position: relative;
  width: min(320px, 100vw - 2 * var(--space-4));
  aspect-ratio: 8 / 5;
  isolation: isolate;
  cursor: pointer; /* a tap anywhere on it opens it (main.js) */
}
/* Older browsers without aspect-ratio: the same 8:5 box from its width. */
@supports not (aspect-ratio: 1) {
  .envelope { height: min(200px, (100vw - 2 * var(--space-4)) * 0.625); }
}

/* Paint order, back to front: inside of the envelope, the card, the pocket, the flap, the seal. */
.env-back { position: absolute; inset: 0; z-index: 0; }
.env-slot { position: absolute; left: 0; right: 0; bottom: 0; top: -300%; z-index: 2; overflow: hidden; pointer-events: none; }
.pocket { position: absolute; inset: 0; z-index: 3; filter: drop-shadow(var(--shadow-pocket)); }
.flap {
  position: absolute;
  inset: 0;
  z-index: 4;
  transform-origin: 50% 0;
  transform: perspective(900px) rotateX(0deg);
  transform-style: preserve-3d;
}

/* The rendered paper over burgundy-700 while it loads. */
.paper {
  position: absolute;
  inset: 0;
  background-color: var(--burgundy-700);
  background-image: url(../img/paper-1280.webp);
  background-repeat: no-repeat;
  background-size: 112.5% auto;
  background-position: 50% 20%;
}
.paper-dark::after { content: ""; position: absolute; inset: 0; background: var(--burgundy-900); opacity: 0.5; }
.pocket .paper { clip-path: polygon(0 0, 50% 48%, 100% 0, 100% 100%, 0 100%); }

/* The flap: a different crop of the same paper, darkened, scalloped to a point 2/3 down. */
.flap-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.flap-front { filter: drop-shadow(var(--shadow-flap)); }
.flap-back { transform: rotateY(180deg); }
.flap .paper { clip-path: var(--flap-shape); background-size: 131.25% auto; background-position: 100% 76%; }

.folds, .flap-edge, .liner { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.folds path { fill: none; stroke: var(--burgundy-900); stroke-opacity: 0.8; stroke-width: 1; vector-effect: non-scaling-stroke; }
.flap-edge path { fill: none; stroke: var(--burgundy-500); stroke-opacity: 0.7; stroke-width: 0.8; vector-effect: non-scaling-stroke; }
.liner polygon { fill: var(--champagne-300); }
.liner path { fill: none; stroke: var(--gold-500); stroke-width: 1; vector-effect: non-scaling-stroke; }

/* 80px on the 320px envelope (owner's pick), centred just above the flap's point, as in the Envelope preview; never under 64px.
   Percent margins resolve against the envelope's width, so a square seal centres exactly. */
.seal, .seal-half {
  --seal-size: max(64px, 25%);
  position: absolute;
  left: 50%;
  top: 55%;
  width: var(--seal-size);
  height: auto;
  aspect-ratio: 1;
  margin: calc(var(--seal-size) / -2) 0 0 calc(var(--seal-size) / -2);
}

.seal {
  z-index: 6;
  padding: 0;
  border: 0;
  border-radius: var(--radius-full);
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 150ms ease-out, filter 150ms ease-out;
}
.seal-img { display: block; width: 100%; height: auto; filter: drop-shadow(var(--shadow-seal)); }
@media (hover: hover) {
  .seal:hover { transform: scale(1.03); }
}
.seal:active { transform: scale(0.98); filter: brightness(1.08); }
.seal:focus-visible { outline: 2px solid var(--gold-300); outline-offset: 3px; }

/* The crack: the same art twice, each masked to one side of a jagged line. The outer corners
   reach past the image so the seal's shadow isn't cut off. */
.seal-half { filter: drop-shadow(var(--shadow-seal)); }
.seal-half[hidden] { display: none; }
.seal-top {
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  clip-path: polygon(-10% -10%, 110% -10%, 110% 50%, 84% 55%, 70% 48%, 56% 54%, 44% 47%, 30% 55%, 18% 49%, -10% 52%);
}
.seal-bottom {
  z-index: 5;
  clip-path: polygon(-10% 52%, 18% 49%, 30% 55%, 44% 47%, 56% 54%, 70% 48%, 84% 55%, 110% 50%, 110% 110%, -10% 110%);
}

@media (prefers-reduced-motion: reduce) {
  .seal { transition: none; }
  .seal:hover, .seal:active { transform: none; }
}

/* MuteControl: an outlined button on the page ground, fixed in the top-right corner. */
.mute {
  position: fixed;
  z-index: 20;
  top: calc(env(safe-area-inset-top, 0px) + var(--space-3));
  right: calc(env(safe-area-inset-right, 0px) + var(--space-3));
  background: var(--champagne-100);
}
.mute:hover { background: var(--champagne-100); }
.mute[hidden] { display: none; }
