/* The site's look, from the Save the Date: cream paper, navy lettering,
   the names in two blues, a gold frame, and the flowers. Amarante for
   display, Jost for text (both self-hosted, Latin only; licences beside
   them in fonts/). Gold is for lines and ornament only: it's too pale for
   text on cream.

   The gold is gold leaf, debossed: pressed into the paper, so its upper
   edge is in shadow and its lower edge catches the light. Its shine follows
   the guest's tilt, turn, finger or scrolling while they move, and rests
   where it was left (public/light.js moves --light-x, smoothly). The paper has a fine grain.
   Both textures are generated (SVG noise), so there are no image files. */

/* The light's position is a real percentage, so it can move smoothly:
   across the gold (x) and up and down it (y). The foil is taller than the
   gold it fills (250% × 220%), so moving it either way shows. */
@property --light-x {
  syntax: "<percentage>";
  inherits: true;
  initial-value: 50%;
}

@property --light-y {
  syntax: "<percentage>";
  inherits: true;
  initial-value: 50%;
}

/* From one page to the next, the browser holds the last frame and fades
   to the new one, where it can (Chrome, Safari 18.2 on), rather than
   showing a blank page while it loads (Dash: a flash between pages, as from
   the doors to the invitation's page) */
@media (prefers-reduced-motion: no-preference) {
  @view-transition {
    navigation: auto;
  }
}

@font-face {
  font-family: "Amarante";
  src: url("/static/fonts/amarante.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

/* For codes: every look-alike distinct (a slashed 0, an l with a tail, a
   1 with a base, a barred I), so a code is read right. Only letters,
   numbers and the dash. */
@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("/static/fonts/atkinson.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Jost";
  src: url("/static/fonts/jost.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --bg: #fdf9e8; /* the paper */
  --surface: #fffdf6; /* inputs: solid, for reading what's typed */
  --card: rgba(255, 253, 246, 0.6); /* panels: the paper's grain shows through */
  --card-solid: #fffdf6; /* the home page's card, under its gold frame */
  --panel: rgba(253, 249, 232, 0.8); /* an invitation's pages: the paper, the interior showing through */
  --text: #0f2670; /* the navy of "Friday 2 April 2027" */
  --muted: #45507a;
  --line: #e6d7a8;
  --accent: #03459e; /* the deep blue of the names: links and buttons */
  --blue: #0a71b9; /* the lighter blue at the top left of the names */
  --deep-blue: #0e3789; /* the deepest, at their bottom right */
  --gold: #c99a26;
  --plum: #60283f;
  --pink: #e398a6;
  --lilac: #9e7d98;
  --font-names: "Amarante", Georgia, "Times New Roman", serif; /* for names only: Dash and Ro's, and guests' (Dash) */
  --font-text: "Jost", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-code: "Atkinson Hyperlegible", "Jost", system-ui, sans-serif; /* codes: no look-alikes */

  /* Metallic gold: dark, bright and pale bands, as light catches foil */
  --foil: linear-gradient(105deg, #7d5a12 0%, #b8891f 14%, #f7e286 28%, #d9ad3c 38%, #946b15 50%, #c99a26 60%, #fff4c4 72%, #d2a434 82%, #8a6416 100%);
  /* Gold leaf: the foil broken into uneven patches, with a fine grain */
  --leaf-patches: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='l'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.045' numOctaves='2' seed='4' stitchTiles='stitch'/%3E%3CfeComponentTransfer%3E%3CfeFuncR type='discrete' tableValues='.35 .6 .9 1 .7 .45'/%3E%3CfeFuncG type='discrete' tableValues='.35 .6 .9 1 .7 .45'/%3E%3CfeFuncB type='discrete' tableValues='.35 .6 .9 1 .7 .45'/%3E%3CfeFuncA type='linear' slope='0' intercept='1'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23l)'/%3E%3C/svg%3E");
  --leaf-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
  /* Paper: a faint speckle, drawn once and repeated */
  --paper-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='p'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .42 0 0 0 0 .34 0 0 0 0 .18 0 0 0 -1.6 1.05'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' opacity='.22' filter='url(%23p)'/%3E%3C/svg%3E");
  --light-x: 50%; /* where the light falls on the gold: across */
  --light-y: 50%; /* and up and down */
}

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

body {
  margin: 0;
  background: var(--bg) var(--paper-grain);
  color: var(--text);
  font: 1.125rem/1.6 var(--font-text);
}

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  max-width: 44rem;
  margin: 0 auto;
  position: relative;
  padding: 1.25rem 1rem 1rem;
}

/* On the home page the header is only the menu, centred above the card */
.site-header-home {
  justify-content: center;
  padding-bottom: 0;
}

/* The gold rule under the header (not on the home page) */
.site-header:not(.site-header-home)::after {
  content: "";
  position: absolute;
  left: 1rem;
  right: 1rem;
  bottom: 0;
  height: 3px;
  border-radius: 2px;
  background: var(--gold);
}

/* Gold leaf, debossed: the leaf texture over the foil, its shine at --light-x,
   with a shadow along the top edge and light along the bottom. Plain gold
   where a browser can't clip a background to text. */
.site-header:not(.site-header-home)::after {
  background-image: var(--leaf-grain), var(--leaf-patches), var(--foil);
  background-size: 160px, 180px, 250% 220%;
  background-position: 0 0, 0 0, var(--light-x) var(--light-y);
  background-blend-mode: soft-light, multiply, normal;
  box-shadow: inset 0 1px 1px rgba(90, 60, 0, 0.45), 0 1px 0 rgba(255, 255, 255, 0.9);
}


.site-name {
  font: 1.5rem/1.2 var(--font-names);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  text-decoration: none;
}

.site-name .amp {
  display: inline-block;
}

.site-header nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.site-header nav a {
  color: var(--text);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
}

.site-header nav a[aria-current="page"] {
  text-decoration: underline;
  text-decoration-color: var(--gold);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.4em;
}

main {
  max-width: 44rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 4rem;
}

h1,
h2,
h3 {
  font-family: var(--font-text);
  font-weight: 400;
  line-height: 1.2;
  color: var(--accent);
}

h1 {
  font-size: 2.25rem;
  letter-spacing: 0.02em;
}

a {
  color: var(--accent);
  text-underline-offset: 0.2em;
}

/* The home page: the Save the Date, in words, laid out as the card. A
   gold-leaf frame with rounded corners, the names raised and the gold
   ampersand laid over them, then the date and venue, and the code box. */

/* The card fills the screen's height (as far as a portrait card should),
   its parts centred with even gaps between them, which grow with the
   screen's height. */
/* The card in the middle of the screen, both ways, however large the screen */
main:has(> .hero) {
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-sizing: border-box;
  min-height: 100vh;
  min-height: 100svh;
  padding-block: 1rem;
  /* Portrait, like the printed card, however short the screen: no wider
     than about half its height. (A wide, short window otherwise made it
     nearly square, and the flowers, sized by its width, rose into the code
     box's message.) */
  max-width: min(44rem, 55svh);
}

/* While the code box is in use, room below the card, so the page can
   scroll the boxes up into the middle of what the keyboard leaves */
.typing-code main:has(> .hero) {
  padding-bottom: 60vh;
}

/* ...but only the page's own centring scrolls there: not a finger
   (code.js also holds touch scrolling still while typing) */
.typing-code,
.typing-code body {
  overflow: hidden;
}

.hero {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  /* Everything on the card is sized from the card's own width (cqw in
     what's inside it; percentages in its padding, which are of the width),
     as the flowers are: the card scales as a whole, like the printed one,
     and since its width is capped by the screen's height (55svh), it fits
     any screen, wide and short included. (Sized from the screen instead,
     the text and the flowers disagreed on a short window, and the code
     box's message met the flowers.) */
  container-type: inline-size;
  min-height: calc(100vh - 2rem);
  min-height: min(calc(100svh - 2rem), 62rem);
  margin: 0;
  padding: clamp(1.75rem, 7.5%, 3.25rem) clamp(1.5rem, 7%, 2.5rem); /* clear of the frame set in from the edge */
  border: 3px solid var(--gold);
  border-radius: 1.75rem;
  /* The card is a shade lighter than the page, with the same grain */
  background: var(--paper-grain) padding-box, linear-gradient(var(--card-solid), var(--card-solid)) padding-box;
  text-align: center;
}

.kicker {
  margin: 0;
  font-weight: 500;
  font-size: clamp(0.8rem, 4.3cqw, 1.2rem);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.names {
  position: relative;
  margin: 0.75rem 0 0;
  font-family: var(--font-names); /* (headings are otherwise Jost) */
  /* As wide as the card allows: "DASHIELL" fills it, as on the printed card */
  font-size: clamp(2.2rem, 19cqw, 6.25rem);
  line-height: 1;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.names .name {
  display: block;
}

/* The names sit slightly raised, as printed, under one gradient across
   both, as on the card: lightest at the top left, deepest at the bottom
   right. Over it, a soft sheen of lighter blue, angled like the gold's
   bright band, sweeps across the letters as the light moves (--light-x),
   as the gold's does.
   Each line is cut to its letters, so each carries its own copy of both
   layers, laid out as if over both lines (twice a line's height), the
   second line showing the lower half, so they read as one. The sheen is
   1.8 times the width, so as --light-x goes from 0% to 100% its band
   travels from 90% of the way across to 10%: over the names, unhurried
   (Dash: slower, and duller than the gold). */
@supports (background-clip: text) or (-webkit-background-clip: text) {
  .names .name {
    background-image:
      linear-gradient(105deg, transparent 34%, rgba(150, 200, 240, 0.22) 45%, rgba(185, 222, 248, 0.34) 50%, rgba(150, 200, 240, 0.22) 55%, transparent 66%),
      linear-gradient(to bottom right, var(--blue) 15%, var(--accent) 60%, var(--deep-blue));
    background-size: 180% 200%, 100% 200%;
    background-position: var(--light-x) 0, 0 0;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.8)) drop-shadow(0 2px 2px rgba(3, 30, 80, 0.25));
  }

  .names .name ~ .name {
    background-position: var(--light-x) 100%, 0 100%;
  }
}

/* The ampersand, large and laid over the middle of the names */
.names .amp {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.5em;
  letter-spacing: 0;
}

.hero p {
  margin: 0;
}

.when {
  margin: 0;
  font-size: clamp(1.1rem, 7.1cqw, 2rem);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.hero .where {
  margin: 0.4rem 0 0;
  font-size: clamp(0.85rem, 5.3cqw, 1.4rem);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}


/* The painted flowers, arranged as on the Save the Date: a border along the
   card's foot, tall at the corners (lilac on the left, geum on the right)
   and low in the middle, where the code boxes sit as the date does on the
   card. Sizes and heights are shares of the card's width, so the border
   keeps its shape on any screen. Ornament only, hidden from screen readers.
   With the frame, as on the card: in front of the side borders, out to the
   card's edge; along the bottom, stems start behind the line while heads
   and leaves come over it. Balanced so about as much background shows in
   the bottom left as the bottom right (measured: 43% and 47%).
   So each flower is two layers, placed alike:
   .flowers, the whole painting, cut off at the bottom line (so no stem
   shows below it), and over it .flowers-front, a copy of only its heads
   and leaves (the art script removes stems), cut off only by the card's
   edge. */
.flowers,
.flowers-front {
  position: absolute;
  inset: 0;
  z-index: 2; /* in front of the frame */
  container-type: size; /* heights below are shares of its width (cqw) */
  border-radius: 1.75rem;
  overflow: hidden;
  pointer-events: none;
}

.flowers {
  clip-path: inset(0 0 calc(var(--frame-inset) + 1.5px) 0); /* to the middle of the bottom line */
}

.flowers img,
.flowers-front img {
  position: absolute;
  height: auto;
  /* --b: how far the flower's foot is above (or below) the bottom line */
  bottom: calc(var(--b) + var(--frame-inset) + 1.5px);
}

/* The date and venue, and the code box under them, in front of the
   flowers */
.hero-details {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  /* The space above the date (from the names) and below it (to the code
     box): equal to the eye, compact, and a share of the card's width. The
     gap below is less by the label's own leading above its letters. */
  --hero-gap: clamp(2rem, 8cqw, 3rem);
  margin-top: var(--hero-gap);
  gap: max(0px, calc(var(--hero-gap) - 1.75rem));
}

/* Room at the card's foot for the low middle of the border: a share of the
   card's width (a percentage padding is), as the flowers are, so the room
   always matches them and the code box's message never meets them */
.hero:has(> .flowers) {
  padding-bottom: 48%;
}

:is(.flowers, .flowers-front) .lilac-tall { --b: -5cqw; left: -1%; width: 41%; transform: rotate(22deg) scaleX(-1); } /* mirrored, then stood upright */
:is(.flowers, .flowers-front) .geum-tall { --b: -6cqw; right: -8%; width: 40%; }
:is(.flowers, .flowers-front) .hellebore { --b: -6cqw; left: 14%; width: 31%; transform: rotate(-4deg); }
:is(.flowers, .flowers-front) .ranunculus { --b: -17cqw; right: 6%; width: 36%; }
:is(.flowers, .flowers-front) .anemone { --b: -20cqw; left: 34%; width: 33%; }

/* The flowers used twice, disguised: their own tinted copies (petals only,
   made by the art script, so leaves stay green), mirrored, turned or set
   lower so less of them shows above the bottom line */
:is(.flowers, .flowers-front) .lilac-small { --b: -9cqw; right: -5%; width: 28%; transform: rotate(24deg) scaleX(-1); }
:is(.flowers, .flowers-front) .geum-low { --b: -30cqw; left: 46%; width: 25%; transform: scaleX(-1) rotate(-6deg); }
:is(.flowers, .flowers-front) .anemone-small { --b: -25cqw; left: 10%; width: 20%; transform: scaleX(-1) rotate(-8deg); }

/* (The tall lilac has no front copy, so the frame's bottom-left corner shows) */

/* Depth, by the rules of parallax: as if the card were seen from where the
   light is (--light-dx and --light-dy, -1 to 1, from light.js; still
   without it, or with reduced motion), each flower shifts by its distance
   from the gold frame, the plane they're woven through, which stays still.
   Behind it (a negative --depth) a flower moves with the viewer; in front
   of it (positive), against them; the further from the frame, the more.
   Shifts are shares of the card's width (cqw), the same for every flower
   at a depth, however big it is: across up to 1.4% of the card, up and
   down a third of that (Dash: less up and down than across, and less in
   all than 2.5%), well within how far each flower's stems run below the
   bottom line, so no stem end ever shows. A flower's two layers share
   their --depth, so they move as one. */
:is(.flowers, .flowers-front) img {
  translate: calc(var(--light-dx, 0) * var(--depth) * -1.4cqw) calc(var(--light-dy, 0) * var(--depth) * -0.45cqw);
}

:is(.flowers, .flowers-front) .lilac-tall { --depth: -0.8; } /* furthest back: wholly behind the frame */
:is(.flowers, .flowers-front) .geum-tall { --depth: -0.4; }
:is(.flowers, .flowers-front) .lilac-small { --depth: 0.2; }
:is(.flowers, .flowers-front) :is(.ranunculus, .hellebore) { --depth: 0.35; }
:is(.flowers, .flowers-front) .anemone { --depth: 0.6; }
:is(.flowers, .flowers-front) :is(.geum-low, .anemone-small) { --depth: 1; } /* nearest: low, in front */

/* The RSVP's forms: large text and big targets, for any phone and any guest */

.back {
  margin: 0;
}

.progress {
  margin: 0.25rem 0 0;
  color: var(--muted);
}

fieldset {
  margin: 0 0 1.5rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: var(--card);
}

legend {
  padding: 0 0.25rem;
  font-weight: 600;
}

.field {
  display: block;
  margin: 0.75rem 0;
}

.field span {
  display: block;
  margin-bottom: 0.25rem;
}

input[type="text"],
input[type="email"],
input:not([type]) {
  width: 100%;
  min-height: 3rem;
  padding: 0.5rem 0.75rem;
  border: 2px solid var(--muted);
  border-radius: 0.375rem;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.choice {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 3rem;
  cursor: pointer;
}

.choice input {
  width: 1.5rem;
  height: 1.5rem;
  margin: 0;
  accent-color: var(--accent);
  flex: none;
}

details {
  margin: 0.75rem 0;
}

summary {
  min-height: 3rem;
  padding: 0.75rem 0;
  color: var(--accent);
  cursor: pointer;
}

button,
.button {
  display: inline-block;
  min-height: 3rem;
  padding: 0.75rem 1.75rem;
  border: 0;
  border-radius: 0.375rem;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
}

button:hover,
.button:hover {
  background: var(--text);
}

:focus-visible {
  outline: 3px solid var(--text);
  outline-offset: 2px;
}

.errors,
.notice {
  margin: 1rem 0 1.5rem;
  padding: 1rem;
  border-left: 0.375rem solid var(--accent);
  background: var(--card);
}

.errors h2 {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
}

.errors ul {
  margin: 0;
}

.person {
  margin: 0 0 1.5rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: var(--card);
}

.person h2 {
  margin: 0 0 0.5rem;
  font-family: var(--font-names); /* a guest's name */
  font-size: 1.375rem;
}

.person dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.5rem 1rem;
  margin: 0;
}

.person dt {
  font-weight: 600;
}

.person dd {
  margin: 0;
}

.change {
  margin-left: 0.5rem;
  white-space: nowrap;
  font-size: 1rem;
  font-family: var(--font-text);
}

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

/* The RSVP's panels (src/rsvp.ts): one simple question to a panel, its
   answers as big buttons beneath, and nothing else but a small Back and
   dots for how far through (Dash: no page of text first) */
.ask {
  display: flex;
  flex-direction: column;
  text-align: center;
}

/* Back and the dots, on a strip of the paper itself (not see-through),
   across the panel's top: set apart from the question (Dash) */
.ask-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 2.75rem;
  margin: -1.25rem -1.5rem 0;
  padding: 0.375rem 1.5rem;
  border-bottom: 1px solid var(--line);
  border-radius: 1.25rem 1.25rem 0 0;
  background: var(--bg) var(--paper-grain);
}

/* Words on the see-through paper: a soft glow of the paper round them,
   so they read clearly over the interior (Dash) */
:is(.ask, .ask-foot) :is(.ask-question, .field span, legend, .aside, .ask-aside, .errors, .ask-foot p, .answers-summary) {
  text-shadow: 0 0 0.5rem var(--bg), 0 0 1rem var(--bg), 0 0 1.5rem var(--bg);
}

.ask-back {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  color: var(--muted);
  font-size: 1rem;
  text-decoration: none;
}

.ask-back::before {
  content: "\2039";
  margin-right: 0.4rem;
  font-size: 1.5rem;
  line-height: 1;
}

.ask-progress {
  display: flex;
  gap: 0.4rem;
}

.ask-progress i {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 1rem;
  background: var(--line);
  transition: width 0.3s ease, background-color 0.3s ease;
}

.ask-progress .done {
  background: var(--gold);
}

.ask-progress .now {
  width: 1.4rem;
  background: var(--accent);
}

.ask-question {
  margin: 1.75rem auto 1.75rem;
  max-width: 20ch;
  font-family: var(--font-text);
  font-size: clamp(1.75rem, 7vw, 2.5rem);
  font-weight: 400;
  line-height: 1.2;
  text-wrap: balance;
}

.ask-form {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.ask-form > :not(.ask-answers, .picks, input[type="hidden"]),
.ask .answers-summary {
  width: 100%;
  max-width: 26rem;
  text-align: left;
}

.ask .errors {
  align-self: center;
  width: 100%;
  max-width: 26rem;
  margin-top: 0;
  text-align: left;
}

.ask-answers {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.625rem;
  width: 100%;
  margin-top: 1.25rem;
}

/* The answers: quiet, paper-coloured, a fine edge, in words as written
   (Dash: solid blue was too much, as with the home page's button) */
.ask-answers button {
  width: min(100%, 20rem);
  min-height: 3.25rem;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(40, 25, 10, 0.06);
  color: var(--text);
  font-size: 1.125rem;
  font-weight: 450;
  letter-spacing: 0;
  text-transform: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ask-answers button:hover {
  border-color: var(--muted);
  background: var(--surface);
}

/* Continue (not a choice): the same, in the links' blue */
.ask-answers button:not(.answer) {
  color: var(--accent);
  font-weight: 550;
}

/* Boxes to type in, as quiet as the answers: a fine edge */
.ask input[type="text"],
.ask input[type="email"],
.ask input:not([type]) {
  border: 1px solid var(--muted);
  border-radius: 0.75rem;
}

/* The answer given before: a firmer edge and a tick */
.answer.chosen {
  border-color: var(--text);
  box-shadow: inset 0 0 0 1px var(--text);
}

.answer.chosen::before {
  content: "\2713";
  margin-right: 0.5rem;
}

.ask .person-answers {
  margin: 0 0 1.5rem;
  padding: 0;
  border: 0;
  background: none;
}

.ask .person-answers legend {
  margin: 0 auto 0.5rem;
  padding: 0;
  font-family: var(--font-names);
  font-size: 1.375rem;
  font-weight: 400;
  text-align: center;
}

/* The reply card (the first question): each of them with a box to tick if
   they're coming; the whole row is the box's to tap, and a tick is drawn in ink */
.reply-card {
  width: 100%;
  max-width: 22rem;
  margin: 0 auto;
  padding: 0.25rem 1rem;
  border-radius: 0.75rem;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(40, 25, 10, 0.08), 0 6px 18px rgba(40, 25, 10, 0.1);
}

.reply-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 3.5rem;
  cursor: pointer;
}

.reply-row + .reply-row {
  border-top: 1px solid var(--line);
}

.reply-name {
  font-size: 1.15rem;
  text-align: left;
}

.reply-name small {
  font-size: 0.85rem;
  color: var(--muted);
}

.reply-row input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  margin: 0;
  cursor: pointer;
}

.reply-row .box {
  position: relative;
  flex: none;
  width: 1.6rem;
  height: 1.6rem;
  border: 1.5px solid var(--text);
  border-radius: 3px;
  background: var(--surface);
}

.reply-row svg {
  position: absolute;
  left: -0.1rem;
  top: -0.7rem;
  width: 2.2rem;
  height: 2.2rem;
  overflow: visible;
  pointer-events: none;
}

.reply-row path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 40;
  stroke-dashoffset: 40;
}

.reply-row input:checked + .box path {
  stroke-dashoffset: 0;
}

@media (prefers-reduced-motion: no-preference) {
  .reply-row input:checked + .box path {
    transition: stroke-dashoffset 0.3s ease;
  }
}

.reply-row input:focus-visible + .box {
  outline: 3px solid var(--text);
  outline-offset: 2px;
}

/* Chips to tick: who's coming, what they eat */
.picks {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin: 0.5rem 0;
}

.pick {
  position: relative;
  cursor: pointer;
}

.pick input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  cursor: pointer;
}

.pick span {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0.5rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 2rem;
  background: var(--surface);
  color: var(--text);
}

.pick input:checked + span {
  border-color: var(--text);
  box-shadow: inset 0 0 0 1px var(--text);
  background: #f3efe0;
}

.pick input:checked + span::before {
  content: "\2713";
  margin-right: 0.4rem;
}

.pick input:focus-visible + span {
  outline: 3px solid var(--text);
  outline-offset: 2px;
}

.aside,
.ask-aside {
  color: var(--muted);
  font-size: 1rem;
}

.ask-foot {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9375rem;
  text-align: center;
}

.ask-foot p {
  margin: 0.4rem 0;
}

/* Messages: each one with its reply beneath */

.message {
  margin: 0 0 1.5rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: var(--card);
}

.message p {
  margin: 0.5rem 0;
}

.meta {
  color: var(--muted);
}

.meta strong {
  color: var(--text);
}

.reply {
  margin-top: 1rem;
  padding: 0.25rem 0 0.25rem 1rem;
  border-left: 0.375rem solid var(--accent);
}

.hint {
  color: var(--muted);
}

textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 2px solid var(--muted);
  border-radius: 0.375rem;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.cancel {
  margin-left: 1rem;
}

/* Gold leaf on lettering: plain gold where a browser can't clip to text */
.gold-leaf {
  color: var(--gold);
}

@supports (background-clip: text) or (-webkit-background-clip: text) {
  .gold-leaf {
    background-image: var(--leaf-grain), var(--leaf-patches), var(--foil);
    background-size: 160px, 180px, 250% 220%;
    background-position: 0 0, 0 0, var(--light-x) var(--light-y);
    background-blend-mode: soft-light, multiply, normal;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: drop-shadow(0 -1px 0 rgba(90, 60, 0, 0.5)) drop-shadow(0 1px 0 rgba(255, 255, 255, 0.95));
  }
}

/* The home page card: paper to its edge, and a gold-leaf frame set in from
   it, as on the Save the Date, so the flowers can cross the frame and carry
   on outside it. The frame is a ring cut from a gold-leaf panel. */
.hero {
  --frame-inset: clamp(0.6rem, 2.6vw, 1.1rem); /* the gold frame, set in from the edge */
  border: 0;
  background: var(--paper-grain), linear-gradient(var(--card-solid), var(--card-solid));
  box-shadow: 0 1px 2px rgba(90, 60, 0, 0.12);
}

.hero::before {
  content: "";
  position: absolute;
  inset: var(--frame-inset);
  z-index: 1;
  padding: 3px; /* the frame's width */
  border-radius: calc(1.75rem - var(--frame-inset) / 2);
  background-image: var(--leaf-grain), var(--leaf-patches), var(--foil);
  background-size: 160px, 180px, 250% 220%;
  background-position: 0 0, 0 0, var(--light-x) var(--light-y);
  background-blend-mode: soft-light, multiply, normal;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  pointer-events: none;
}

/* Finding an invitation by its code: the box with Open joined to its right,
   and an "i" by the title that opens a tip (a <details>, so it works
   without JavaScript) */
.find {
  display: grid;
  gap: 0.375rem;
  width: min(100%, 22rem);
  margin: 0 auto;
  container-type: inline-size; /* the boxes size themselves to this, not the screen */
  position: relative; /* (checking and accepted sit over it, nothing moving: Dash) */
}

.find-label {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.find label {
  font-weight: 500;
}

/* Without JavaScript: one box with Open joined to its right */
.find-row {
  display: flex;
}

.code-entry {
  position: relative;
  flex: 1;
  min-width: 0;
}

.code-entry input {
  font-family: var(--font-code);
  border-right: 0;
  border-radius: 0.375rem 0 0 0.375rem;
  letter-spacing: 0.08em;
}

.code-boxes,
.open-arrow {
  display: none;
}

.find-row button {
  padding-inline: 1.25rem;
  border-radius: 0 0.375rem 0.375rem 0;
}

/* With public/code.js: six boxes, two groups of three, over the real box
   (still there, invisible, taking the typing); a full code opens itself */
.find-row:has(.boxed) {
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
}

/* Six boxes, the gaps and the dash always fit the card: each box is a
   sixth of the width that's left, within limits. (Browsers too old to
   measure the form fall back to a size from the screen's width.) The fixed
   parts: six 0.375rem gaps and the 0.875rem dash: 3.125rem. */
.code-entry.boxed {
  --box: clamp(1.5rem, 8vw, 2.875rem);
  --box: clamp(1.5rem, calc((100cqi - 3.125rem) / 6), 2.875rem);
  flex: 0 0 auto;
}

.code-entry.boxed input {
  position: absolute;
  z-index: 1;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: transparent;
  caret-color: transparent;
  font-size: 1rem; /* 16px or more, so iPhones don't zoom in */
  opacity: 0;
}

.code-entry.boxed .code-boxes {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.code-boxes span {
  position: relative;
  display: grid;
  place-items: center;
  width: var(--box);
  height: calc(var(--box) * 1.3);
  border: 1.5px solid rgba(69, 80, 122, 0.45);
  border-radius: 0.5rem;
  background: var(--surface);
  /* Pressed slightly into the paper */
  box-shadow: inset 0 1px 2px rgba(15, 38, 112, 0.1), 0 1px 0 rgba(255, 255, 255, 0.9);
  color: var(--text);
  font: 500 calc(var(--box) * 0.6) / 1 var(--font-code);
  transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
}

/* Between the two groups, a short gold-leaf dash, as the code is written */
.code-dash {
  width: 0.625rem;
  height: 2px;
  margin-inline: 0.125rem;
  border-radius: 1px;
  background-image: var(--leaf-grain), var(--leaf-patches), var(--foil);
  background-size: 160px, 180px, 250% 220%;
  background-position: 0 0, 0 0, var(--light-x) var(--light-y);
  background-blend-mode: soft-light, multiply, normal;
}

.code-boxes span.filled {
  border-color: rgba(15, 38, 112, 0.7);
}

/* The box waiting for the next character, while the guest is typing */
.focused .code-boxes span.active {
  border-color: var(--accent);
  box-shadow: inset 0 1px 2px rgba(15, 38, 112, 0.1), 0 0 0 3px rgba(3, 69, 158, 0.16);
}

.focused .code-boxes span.active:empty::after {
  content: "";
  width: 2px;
  height: 45%;
  border-radius: 1px;
  background: var(--accent);
}

/* A wrong code, back from the server: plum until they change it */
.has-error .code-boxes span {
  border-color: var(--plum);
  background-color: #fbf1f3;
  color: var(--plum);
}

/* Each box's place, so the gold glint runs along them one after the other
   (here, not in the page, which allows no inline styles) */
.code-boxes span:nth-of-type(2) {
  --i: 1;
}
.code-boxes span:nth-of-type(3) {
  --i: 2;
}
.code-boxes span:nth-of-type(4) {
  --i: 3;
}
.code-boxes span:nth-of-type(5) {
  --i: 4;
}
.code-boxes span:nth-of-type(6) {
  --i: 5;
}

/* All six in: each box takes a gold edge, one after the other */
.complete .code-boxes span {
  border-color: var(--gold);
  background-color: #fffaf0;
}

/* No Open: a full code opens by itself (Open is only for no JavaScript) */
.find-row:has(.boxed) button {
  display: none;
}

@keyframes code-pop {
  from {
    opacity: 0;
    transform: translateY(0.25rem) scale(0.6);
  }
}

@keyframes code-shake {
  20%,
  60% {
    transform: translateX(-4px);
  }
  40%,
  80% {
    transform: translateX(4px);
  }
}

@keyframes code-caret {
  50% {
    opacity: 0;
  }
}

@keyframes code-glint {
  40% {
    border-color: #f3dc78;
    box-shadow: inset 0 1px 2px rgba(15, 38, 112, 0.1), 0 0 0 3px rgba(201, 154, 38, 0.3);
    transform: translateY(-2px);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .code-boxes span.pop {
    animation: code-pop 0.18s cubic-bezier(0.2, 0.9, 0.3, 1.3);
  }

  .focused .code-boxes span.active:empty::after {
    animation: code-caret 1s steps(1) infinite;
  }

  .code-entry.shake .code-boxes {
    animation: code-shake 0.3s ease-in-out;
  }

  .complete .code-boxes span {
    animation: code-glint 0.45s ease-out calc(var(--i, 0) * 0.06s) both;
  }
}

/* The "i": a 44px target round a small circled i */
.find-help {
  position: relative;
}

.find-help summary {
  display: grid;
  place-items: center;
  width: 2.75rem;
  min-height: 2.75rem;
  padding: 0;
  list-style: none;
}

.find-help summary::-webkit-details-marker {
  display: none;
}

.find-help summary span {
  display: grid;
  place-items: center;
  width: 1.375rem;
  height: 1.375rem;
  border: 1.5px solid var(--muted);
  border-radius: 50%;
  color: var(--muted);
  font: italic 600 0.875rem/1 Georgia, serif;
}

.find-help[open] summary span {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

/* The tip: a bubble floating above the "i", its pointer on the icon, growing
   out of it as it opens and shrinking back as it closes (public/tip.js
   closes it on a tap elsewhere, and lets it shrink before it goes) */
.tip .find-tip {
  --pointer: 1.875rem; /* from the bubble's right edge to the icon's centre */
  position: absolute;
  z-index: 3;
  right: -0.5rem;
  bottom: calc(100% + 0.25rem);
  width: min(15rem, 75vw);
  margin: 0;
  padding: 0.75rem 1rem;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  background: var(--surface);
  box-shadow: 0 0.5rem 1.5rem rgba(15, 38, 112, 0.18), 0 1px 3px rgba(15, 38, 112, 0.12);
  color: var(--text);
  font-size: 0.9375rem;
  line-height: 1.45;
  text-align: center;
  transform-origin: calc(100% - var(--pointer)) calc(100% + 0.5rem);
}

/* The pointer: a small square turned to a point, under the bubble */
.tip .find-tip p {
  margin: 0;
}

.tip .find-tip p + p {
  margin-top: 0.375rem;
}

.tip .find-tip::after {
  content: "";
  position: absolute;
  right: calc(var(--pointer) - 0.4375rem);
  bottom: -0.4375rem;
  width: 0.875rem;
  height: 0.875rem;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  transform: rotate(45deg);
}

@keyframes tip-in {
  from {
    opacity: 0;
    transform: scale(0.6);
  }
}

@keyframes tip-out {
  to {
    opacity: 0;
    transform: scale(0.6);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .tip[open] .find-tip {
    animation: tip-in 0.18s cubic-bezier(0.2, 0.9, 0.3, 1.2);
  }

  .tip.closing .find-tip {
    animation: tip-out 0.14s ease-in forwards;
  }
}

/* Why a code didn't open, under the boxes */
.find .find-error {
  /* in the middle of the card, where the flowers are low (the lilac and
     geum rise high at its sides): it wraps rather than reaching them.
     Taking no room, so the boxes stay put (Dash) */
  position: absolute;
  top: 100%;
  left: 18%;
  right: 18%;
  margin: 0.25rem 0 0;
  white-space: pre-line; /* a message's own line breaks show */
  text-wrap: balance; /* wrapped lines of even length, no word left alone */
  color: var(--plum);
  font-size: clamp(0.85rem, 3.9cqw, 1rem);
  font-weight: 500;
  line-height: 1.4;
  text-align: center;
}

.find-error[hidden] {
  display: none;
}

@keyframes error-in {
  from {
    opacity: 0;
    transform: translateY(-0.25rem);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .find-error:not([hidden]) {
    animation: error-in 0.2s ease-out;
  }
}

/* Without JavaScript, the one box in plum too */
.has-error input {
  border-color: var(--plum);
}

/* Icons: from Lucide (lucide.dev, ISC licence: public/icons/), each copied
   in as an SVG file and shown as a mask over the text's colour, so it
   takes the colour of the words beside it. One class per icon. */
.icon {
  display: inline-block;
  flex: none;
  width: 1.15em;
  height: 1.15em;
  background-color: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}

.icon-replay {
  --icon: url("/static/icons/rotate-ccw.svg");
}

.icon-arrow-right { --icon: url("/static/icons/arrow-right.svg"); }
.icon-calendar { --icon: url("/static/icons/calendar.svg"); }
.icon-clock { --icon: url("/static/icons/clock.svg"); }
.icon-gem { --icon: url("/static/icons/gem.svg"); }
.icon-heart-handshake { --icon: url("/static/icons/heart-handshake.svg"); }
.icon-mail { --icon: url("/static/icons/mail.svg"); }
.icon-map-pin { --icon: url("/static/icons/map-pin.svg"); }
.icon-moon { --icon: url("/static/icons/moon.svg"); }
.icon-music { --icon: url("/static/icons/music.svg"); }
.icon-party-popper { --icon: url("/static/icons/party-popper.svg"); }
.icon-soup { --icon: url("/static/icons/soup.svg"); }
.icon-sparkles { --icon: url("/static/icons/sparkles.svg"); }
.icon-users { --icon: url("/static/icons/users.svg"); }
.icon-utensils-crossed { --icon: url("/static/icons/utensils-crossed.svg"); }

/* The envelope (public/envelope.js): on the home page, once per visit, the
   card arrives in an envelope that rises onto the clean page, opens, and
   lets the card out. A classic brown kraft envelope, made as a real one is
   (an ordinary letter, closing on a long side, stood on its side so the
   flap's along its left): one sheet folded around
   the card, its side flaps folded in, the bottom flap up over them, and the
   pointed seal flap down over all, with a gum strip inside it. Each layer
   casts a soft shadow on the one beneath. Stacking: the inside back 1, the
   card 2 (the real .hero, moved and shrunk by the script), the pocket 3,
   the seal flap 4 (0 once it's open, behind the card); the card 5 once
   it's clear of the envelope, so it grows in front of it as it falls. */
:root {
  /* the envelope's height to width on the screen: the script sets it from
     the card's */
  --env-ratio: 1.35;
  /* It's drawn as a letter, landscape, its flap along the top, then turned
     a quarter, so its drawn width (--env-w) is its height on the screen
     and its drawn height (--env-h) its width there. Up to 84% of the
     screen's width: opened, its flap adds 62% to that, so on a phone it
     draws back as it opens until both fit (the script) */
  --env-w: min(calc(84vw * var(--env-ratio)), calc(26rem * var(--env-ratio)), 72svh);
  --env-h: calc(var(--env-w) / var(--env-ratio));
  /* where the flaps reach, as drawn (after a real letter Dash liked): the
     bottom flap's flat top, just under halfway down; the side flaps
     meeting just under it, in an X, so no seam shows; the seal flap
     reaching past it, onto the bottom flap, wider than the bottom flap's
     cut where it crosses it, so the cut's line is hidden */
  --env-b: calc(var(--env-h) * 0.47);
  --env-s: calc(var(--env-b) + var(--env-h) * 0.04);
  --env-flap-h: calc(var(--env-h) * 0.62);
  --env-seal-d: calc(var(--env-h) * 0.36); /* the wax seal, across */
  --env-radius: 0.3rem; /* the bottom corners, only just rounded */
  /* Kraft paper: short fine fibres, dark and light, fine dark flecks, and a
     gentle blotchiness */
  --kraft-fibres: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.07 .7' numOctaves='2' seed='7' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .3 0 0 0 0 .18 0 0 0 0 .07 0 0 0 -2.8 1.55'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' opacity='.08' filter='url(%23f)'/%3E%3C/svg%3E");
  --kraft-light-fibres: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.06 .6' numOctaves='2' seed='19' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .97 0 0 0 0 .88 0 0 0 0 .74 0 0 0 -3.2 1.65'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' opacity='.08' filter='url(%23f)'/%3E%3C/svg%3E");
  --kraft-specks: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.1' numOctaves='1' seed='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .2 0 0 0 0 .12 0 0 0 0 .05 0 0 0 -12 5.6'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' opacity='.28' filter='url(%23f)'/%3E%3C/svg%3E");
  --kraft-mottle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='400'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.012' numOctaves='3' seed='11' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .22 0 0 0 0 .1 0 0 0 1.4 -.55'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' opacity='.13' filter='url(%23f)'/%3E%3C/svg%3E");
  --kraft: #bd9062;
  --kraft-inside: #a27849;
  /* The flaps' shapes, as SVG masks (clip-path can't round corners)
     stretched to each flap: the seal flap a wide point, its tip a short
     straight edge with small rounded corners, square along the fold (and
     the same turned over, for its inside face); the bottom flap a triangle with its tip cut off, the
     cut a quarter of the width */
  --env-flap-shape: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'%3E%3Cpath d='M0 0H100L57.4 95Q56 100 53.5 100H46.5Q44 100 42.6 95Z'/%3E%3C/svg%3E") 0 0 / 100% 100% no-repeat;
  --env-flap-shape-in: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'%3E%3Cpath d='M0 100H100L57.4 5Q56 0 53.5 0H46.5Q44 0 42.6 5Z'/%3E%3C/svg%3E") 0 0 / 100% 100% no-repeat;
  --env-bottom-shape: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'%3E%3Cpath d='M0 100L37.3 3Q38 0 40 0H60Q62 0 62.7 3L100 100Z'/%3E%3C/svg%3E") 0 0 / 100% 100% no-repeat;
}

.envelope body {
  overflow: hidden;
  /* tapping the envelope never highlights the page's text */
  -webkit-user-select: none;
  user-select: none;
}

/* Hidden until the script has put it in the envelope, and shown anyway
   should anything go wrong: after 60 seconds, as on a slow connection the
   envelope can still be fetching its seal after 4 (Dash: the card showed
   first, spoiling the surprise) */
.envelope-pending .hero {
  visibility: hidden;
  animation: envelope-failsafe 0s linear 60s forwards;
}

@keyframes envelope-failsafe {
  to {
    visibility: visible;
  }
}

.envelope .hero {
  z-index: 2;
  box-shadow: 0 0.5rem 1.5rem rgba(60, 35, 10, 0.18), 0 1px 3px rgba(60, 35, 10, 0.16); /* lifted, as it comes out */
}

/* Clear of the envelope: in front of it as it grows */
.env-card-out .hero {
  z-index: 5;
}

.env-part {
  position: fixed;
  left: 50%;
  top: 50%;
  width: var(--env-w);
  height: var(--env-h);
  margin: calc(var(--env-h) / -2) 0 0 calc(var(--env-w) / -2); /* its middle in the middle */
  /* A letter stood on its side (the flap along its left), tilted a little
     with the light while it's closed (--env-tilt-x and -y, from the
     script). Its moves are its `translate`, across and down the screen. */
  transform: perspective(1400px) rotateX(var(--env-tilt-x, 0deg)) rotateY(var(--env-tilt-y, 0deg)) rotate(-90deg);
  pointer-events: none;
}

/* The inside of the envelope's back: kraft, a little darker, seen through
   the throat behind the card */
.env-back {
  z-index: 1;
  border-radius: 0 0 var(--env-radius) var(--env-radius); /* square along the top, like the fold */
  background: var(--kraft-fibres), var(--kraft-specks), var(--kraft-mottle), linear-gradient(#94693d, var(--kraft-inside) 40%, #9c7243);
  box-shadow: 0 1.5rem 3rem rgba(60, 35, 10, 0.22), 0 0.25rem 0.6rem rgba(60, 35, 10, 0.18);
}

/* The pocket: the side flaps, folded in from the edges, meeting just
   under the bottom flap, their top edges with shoulders (level for a
   little way from the corners, then curving down into the opening); the
   bottom flap, a triangle with its tip cut off, up over them.
   Each piece is its shape cut from the paper (::before), with a shadow
   along its edges onto what's beneath. */
.env-front {
  z-index: 3;
}

.env-side,
.env-bottom {
  position: absolute;
  inset: 0;
  /* moved a little with the light (--env-shadow-ox and -oy, from the
     script, in the envelope's own turned frame), half as much as the flap's */
  filter: drop-shadow(0 0 1.5px rgba(50, 28, 8, 0.35))
    drop-shadow(calc(var(--env-shadow-ox, 0px) * 0.5) calc(1px + var(--env-shadow-oy, 0px) * 0.5) 3px rgba(50, 28, 8, 0.18));
}

.env-side::before,
.env-bottom::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 0 0 var(--env-radius) var(--env-radius);
  background: var(--kraft-fibres), var(--kraft-light-fibres), var(--kraft-specks), var(--kraft-mottle), var(--env-tone), var(--kraft);
}

/* lighter along each fold, as the paper turns over the edge */
.env-side-left {
  --env-tone: linear-gradient(to right, rgba(255, 240, 215, 0.16), transparent 35%, rgba(60, 35, 10, 0.06));
}

.env-side-right {
  --env-tone: linear-gradient(to left, rgba(255, 240, 215, 0.16), transparent 35%, rgba(60, 35, 10, 0.06));
}

.env-bottom {
  --env-tone: linear-gradient(to top, rgba(255, 240, 215, 0.18), transparent 40%, rgba(60, 35, 10, 0.05));
}

/* the side flaps meet under the bottom flap and run on down beneath it,
   so nothing shows between them */
.env-side-left::before {
  clip-path: polygon(0 0, 8% calc(var(--env-h) * 0.008), 14% calc(var(--env-h) * 0.022), 18% calc(var(--env-h) * 0.045), 21% calc(var(--env-h) * 0.08), 50% var(--env-s), 50% 100%, 0 100%);
}

.env-side-right::before {
  clip-path: polygon(100% 0, 92% calc(var(--env-h) * 0.008), 86% calc(var(--env-h) * 0.022), 82% calc(var(--env-h) * 0.045), 79% calc(var(--env-h) * 0.08), 50% var(--env-s), 50% 100%, 100% 100%);
}

.env-bottom::before {
  top: var(--env-b);
  -webkit-mask: var(--env-bottom-shape);
  mask: var(--env-bottom-shape);
}

/* The seal flap: its outside kraft, a shade lighter towards the fold; its
   inside (the other face, seen as it opens) a lighter kraft, with a band
   of gum along its edges */
.env-flap-wrap {
  z-index: 4;
  perspective: 1400px;
  /* the flap stands off the pocket, its shadow growing as it lifts, so its
     movement shows */
  filter: drop-shadow(0 0 1.5px rgba(50, 28, 8, 0.4))
    drop-shadow(var(--env-shadow-ox, 0px) calc(4px + var(--env-shadow-oy, 0px)) 5px rgba(50, 28, 8, 0.32));
}

.env-flap-open .env-flap-wrap {
  z-index: 0;
}

.env-flap {
  position: absolute;
  inset: 0 0 auto;
  /* past the bottom flap's top, onto it, where it's stuck down */
  height: var(--env-flap-h);
  transform-origin: 50% 0;
  transform-style: preserve-3d;
}

.env-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
}

.env-face-out {
  -webkit-mask: var(--env-flap-shape);
  mask: var(--env-flap-shape);
  background: var(--kraft-fibres), var(--kraft-light-fibres), var(--kraft-specks), var(--kraft-mottle),
    linear-gradient(rgba(255, 240, 215, 0.14), transparent 30%, rgba(60, 35, 10, 0.08)), var(--kraft);
}

/* the inside: turned over, so its shape is the outside's, upside down */
.env-face-in {
  transform: rotateX(180deg);
  -webkit-mask: var(--env-flap-shape-in);
  mask: var(--env-flap-shape-in);
  background: linear-gradient(105deg, #b8905c, #cfa877 45%, #b98f5b); /* the gum: a slight sheen */
}

.env-face-in::before {
  content: "";
  position: absolute;
  inset: 10% 7% 0;
  -webkit-mask: var(--env-flap-shape-in);
  mask: var(--env-flap-shape-in);
  background: var(--kraft-fibres), var(--kraft-specks), linear-gradient(#c79d6d, #c39867);
}

/* Waiting: now and then the flap's tip lifts a little, to say "open me".
   Not when it's sealed: then the seal catches the light instead (the
   script) */
.env-idle:not(.env-sealed) .env-flap {
  animation: env-flap-hint 2.8s ease-in-out 0.4s infinite;
}

@keyframes env-flap-hint {
  0%,
  65%,
  100% {
    transform: rotateX(0deg);
  }
  78% {
    transform: rotateX(-22deg);
  }
  88% {
    transform: rotateX(-4deg);
  }
}

/* On a computer, the flap lifts a little while the pointer is over the
   envelope, and settles back when it leaves. With `rotate`, not
   `transform`, so it adds to the hint and the opening rather than
   replacing them. Only where there's a real hover (not after a tap). */
.env-flap {
  rotate: x 0deg;
  transition: rotate 0.4s cubic-bezier(0.3, 0.7, 0.3, 1);
}

@media (hover: hover) and (pointer: fine) {
  .env-idle:not(.env-sealed):has(.env-open:hover) .env-flap {
    rotate: x -16deg;
  }
}

/* The wax seal (drawn by the script, from public/art/seal.png) over the
   flap's tip, in two halves either side of where it cracks: one on the
   flap, swinging away with it, the other on the envelope, in front of it
   all until the card's out. Each is the whole seal, cut along the crack
   (clip-path, from the script), and turned upright on the screen. */
.env-seal {
  position: absolute;
  left: 50%;
  width: var(--env-seal-d);
  height: var(--env-seal-d);
  transform: translate(-50%, -50%) rotate(90deg);
  transition: translate 0.25s cubic-bezier(0.2, 0.8, 0.3, 1), rotate 0.25s cubic-bezier(0.2, 0.8, 0.3, 1);
}

/* whole until it cracks (two cut edges meeting would show a seam), the
   half on the envelope over it */
.env-sealed:not(.env-seal-broken) .env-seal-flap {
  clip-path: none !important;
}

.env-seal-flap {
  top: 100%;
  translate: 0 0 1px; /* just off the flap's face */
  backface-visibility: hidden;
}

.env-seal-wrap {
  z-index: 4;
}

.env-seal-body {
  top: var(--env-flap-h);
}

/* the drop of wax, resealing (until the pressed seal fades in over it),
   casting its own shadow */
.env-seal-drop {
  filter: drop-shadow(0 1px 1px rgba(40, 10, 5, 0.35)) drop-shadow(0 3px 4px rgba(40, 10, 5, 0.25));
}

/* The signet that reseals it (envelope.js), seen from above as it comes
   down: a brass head, a turned wooden handle on it (public/art/stamp.png,
   painted by art/stamp.py, lit as the seal is), a little smaller than the
   seal (its face is the impression's size) */
.env-stamp {
  position: absolute;
  left: 50%;
  top: var(--env-flap-h);
  width: calc(var(--env-seal-d) * 0.86);
  height: calc(var(--env-seal-d) * 0.86);
  border-radius: 50%;
  /* (the painting's disc is 94% of the picture: filling the circle) */
  background: url("/static/art/stamp.png") center / 106.4% 106.4% no-repeat;
  transform: translate(-50%, -50%) rotate(90deg);
  pointer-events: none;
}

/* cracked, the half left on the envelope jolts as it lets go, casting its
   own shadow (till then the whole seal's on the flap, in the flap's) */
.env-seal-broken .env-seal-body {
  translate: 0 2px;
  rotate: 3deg;
  /* (upright on the screen, so the light's offsets as they are) */
  filter: drop-shadow(0 1px 1px rgba(40, 10, 5, 0.35))
    drop-shadow(calc(var(--env-shadow-x, 0px) * 0.6) calc(3px + var(--env-shadow-y, 0px) * 0.6) 4px rgba(40, 10, 5, 0.25));
}

/* The whole envelope is the button that opens it */
.env-open {
  z-index: 6;
  min-height: 0;
  padding: 0;
  border-radius: 0 0 var(--env-radius) var(--env-radius);
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
}

.env-open:hover {
  background: transparent;
}

/* While trying the envelope out (ONCE_PER_VISIT off in envelope.js): a
   small "Replay envelope" in the bottom right */
.env-replay {
  position: fixed;
  right: 0.75rem;
  bottom: calc(0.5rem + env(safe-area-inset-bottom, 0px)); /* clear of an iPhone's home bar */
  z-index: 10;
  min-height: 0;
  padding: 0.25rem 0.5rem;
  background: none;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: none;
  opacity: 0.7;
  transition: opacity 0.6s ease, visibility 0.6s;
}

.env-replay span:last-child {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

/* only once the envelope has played right through (or been skipped): not
   while it's there, fading in after */
.envelope .env-replay {
  opacity: 0;
  visibility: hidden;
  transition: none;
}

/* Room for it under the card, which otherwise reaches almost to the bottom
   of a phone's screen */
.env-replay-shown main:has(> .hero) {
  padding-bottom: calc(3.25rem + env(safe-area-inset-bottom, 0px));
}

.env-replay-shown .hero {
  min-height: min(calc(100svh - 1rem - 3.25rem - env(safe-area-inset-bottom, 0px)), 62rem);
}

.env-replay:hover {
  background: none;
  color: var(--text);
  opacity: 1;
}

/* While the envelope waits: a thin gold line along the bottom of the
   screen, filling left to right until it opens by itself */
.env-countdown {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9;
  height: 2px;
  transform-origin: 0 50%;
  background-image: var(--leaf-grain), var(--leaf-patches), var(--foil);
  background-size: 160px, 180px, 250% 220%;
  background-position: 0 0, 0 0, var(--light-x) var(--light-y);
  background-blend-mode: soft-light, multiply, normal;
  opacity: 0.55;
  pointer-events: none;
}

/* Inside the venue: an invitation's own pages, and the whole site once
   someone's been inside this visit (public/inside.js). The background is
   the painting of the venue's interior (art/invitation.py), covering the
   screen, fixed behind everything; on it, each page's header and content
   on one cream panel. --interior is the picture for this screen, also used
   by the doors (public/doors.js), so the two are the same file. */
:root {
  --interior: url("/static/art/interior-2000.webp");
  --interior-shape: 1.4717; /* its width to its height: the opened card's (art/invitation.py prints it) */
}

@media (min-width: 1400px) {
  :root {
    --interior: url("/static/art/interior-3000.webp");
  }
}

.inside body::before,
.inside body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

/* (sized as the picture is, covering the screen, rather than cut to the
   screen's shape, so it can start as the whole open card: below) */
.inside body::before {
  inset: auto;
  left: 50%;
  top: 50%;
  width: max(100vw, 100vh * var(--interior-shape));
  height: max(100vh, 100vw / var(--interior-shape));
  translate: -50% -50%;
  background: var(--bg) var(--interior) 0 0 / 100% 100% no-repeat;
}

/* Come in through the doors: the background starts as the open card, just
   where it was on the home page (--doors-x, --doors-y from the screen's
   middle, --doors-size a share of its full size: public/inside.js), and
   grows to fill the screen as the page fades in over it */
@media (prefers-reduced-motion: no-preference) {
  .doors-arriving body::before {
    border-radius: var(--doors-radius, 0);
    animation: doors-grow 1.2s cubic-bezier(0.55, 0, 0.2, 1) both;
  }
}

/* held as the open card until the painting's ready (public/inside.js) */
.doors-holding body::before,
.doors-holding body::after,
.doors-holding main,
.doors-holding .site-header {
  animation-play-state: paused !important;
}

@keyframes doors-grow {
  from {
    transform: translate(var(--doors-x), var(--doors-y)) scale(var(--doors-size));
  }
  to {
    border-radius: 0;
  }
}

/* the paper's texture over the painting, as on the printed card */
.inside body::after {
  background: var(--paper-grain);
}

/* The panel: the header (the names, the gold rule) and the page below it,
   as one card over the interior. (Not the home page: its card is already
   a card.) */
.inside .site-header:not(.site-header-home),
.inside main:not(:has(> .hero)) {
  box-sizing: border-box;
  width: calc(100% - 1.5rem);
  max-width: 44rem;
  /* the paper, a little see-through, so the interior shows through it (Dash) */
  background: var(--panel) var(--paper-grain);
}

.inside .site-header:not(.site-header-home) {
  margin-top: clamp(0.75rem, 6vh, 3.5rem);
  padding: 1.5rem 1.5rem 1rem;
  border-radius: 1.25rem 1.25rem 0 0;
  box-shadow: 0 -0.5rem 1.5rem rgba(40, 25, 10, 0.12);
}

.inside .site-header:not(.site-header-home)::after {
  left: 1.5rem;
  right: 1.5rem;
}

.inside main:not(:has(> .hero)) {
  margin-bottom: clamp(1.5rem, 8vh, 4rem);
  padding: 1.5rem 1.5rem 2.5rem;
  border-radius: 0 0 1.25rem 1.25rem;
  box-shadow: 0 1rem 2.5rem rgba(40, 25, 10, 0.25), 0 2px 4px rgba(40, 25, 10, 0.12);
}

/* The RSVP's questions: no header, the panel alone in the middle of the
   screen, a little narrower, rounded all round (Dash) */
.inside body.bare {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100svh;
}

.inside .bare main:not(:has(> .hero)) {
  max-width: 32rem;
  margin: 1rem auto;
  padding: 1.25rem 1.5rem 1.75rem;
  border-radius: 1.25rem;
}

/* Come in through the doors: the page fades in and rises into place as
   the background grows behind it */
@media (prefers-reduced-motion: no-preference) {
  .doors-arriving .site-header:not(.site-header-home),
  .doors-arriving main:not(:has(> .hero)) {
    animation: inside-arrive 1s cubic-bezier(0.2, 0.7, 0.2, 1) 0.45s both;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .doors-arriving body::after {
    animation: inside-grain 0.8s ease 1.1s both;
  }
}

@keyframes inside-grain {
  from {
    opacity: 0;
  }
}

@keyframes inside-arrive {
  from {
    opacity: 0;
    translate: 0 2.5rem;
  }
}

/* The doors (public/doors.js): the invitation that comes out on a correct
   code, a gatefold card. Its two flaps (each half the doors, hinged on its
   outer edge, the inside's outer quarter on its back) close over a middle
   panel (the inside's middle half). Pictures are placed by the card's
   width (--w), so the halves and quarters meet exactly. */
.doors {
  position: fixed;
  inset: 0;
  z-index: 0; /* behind the first card, until the two swap */
  perspective: 1400px; /* (for its tilt with the light; its origin, the card's middle, from doors.js) */
  pointer-events: none;
}

.doors.doors-front {
  z-index: 20;
}

/* (folding back up from an invitation's page: behind the page, as its
   background is, until the page has faded) */
.doors.doors-behind {
  z-index: -1;
}

.doors-card {
  --card-radius: calc(var(--w) * 0.018); /* its corners, only just rounded (doors.js too) */
  position: fixed;
  perspective: 1800px;
}

.doors-middle,
.doors-flap,
.doors-face,
.doors-back {
  position: absolute;
  top: 0;
  bottom: 0;
}

.doors-middle {
  left: -1px; /* a pixel under each flap's edge, so no seam shows as it grows */
  width: calc(var(--w) + 2px);
  background: var(--bg) var(--interior) calc(var(--w) / -2 + 1px) 0 / calc(var(--w) * 2) 100% no-repeat;
}

.doors-flap {
  width: 50%;
  transform-style: preserve-3d;
}

.doors-flap-left {
  left: 0;
  transform-origin: 0 50%;
}

.doors-flap-right {
  right: 0;
  transform-origin: 100% 50%;
}

.doors-face,
.doors-back {
  inset: 0;
  backface-visibility: hidden;
}

/* Printed card: a little rounded at its outer corners, its edges softened
   (a faint light line, a shade inside it), the paper's texture over the
   painting, and a soft shadow under it */
.doors-face {
  background: var(--doors) 0 0 / var(--w) 100% no-repeat;
  /* (its shadow moving a little with the light, while it tilts: doors.js) */
  box-shadow: inset 0 0 0 1px rgba(255, 245, 225, 0.18), inset 0 0 1.25rem rgba(40, 20, 5, 0.35),
    var(--doors-shadow-x, 0px) calc(0.75rem + var(--doors-shadow-y, 0px)) 2rem rgba(40, 25, 10, 0.3),
    calc(var(--doors-shadow-x, 0px) / 2) calc(1px + var(--doors-shadow-y, 0px) / 2) 3px rgba(40, 25, 10, 0.25);
}

.doors-flap-left .doors-face {
  border-radius: var(--card-radius) 0 0 var(--card-radius);
}

.doors-flap-right .doors-face {
  border-radius: 0 var(--card-radius) var(--card-radius) 0;
}

/* (a back's own left is the open card's outer edge on the left, its own
   right on the right: it's turned over) */
.doors-flap-left .doors-back {
  border-radius: var(--card-radius) 0 0 var(--card-radius);
}

.doors-flap-right .doors-back {
  border-radius: 0 var(--card-radius) var(--card-radius) 0;
}

.doors-face::after,
.doors-back::after,
.doors-middle::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--paper-grain);
  transition: opacity 1.2s ease;
}

/* The open card's edge: over the whole spread, shown once it's open */
.doors-edge {
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(var(--w) / -2);
  width: calc(var(--w) * 2);
  border-radius: var(--card-radius);
  box-shadow: inset 0 0 0 1px rgba(255, 245, 225, 0.2), inset 0 0 1.5rem rgba(40, 20, 5, 0.3), 0 0.75rem 2rem rgba(40, 25, 10, 0.3);
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
}

.doors-opened .doors-edge {
  opacity: 1;
}

/* Growing to fill the screen, the texture and the edge's inner shading
   fade, so it meets the painting exactly */
.doors-growing :is(.doors-face, .doors-back, .doors-middle)::after {
  opacity: 0;
  transition: opacity 1s ease;
}

.doors-growing .doors-edge {
  box-shadow: inset 0 0 0 1px rgba(255, 245, 225, 0), inset 0 0 1.5rem rgba(40, 20, 5, 0), 0 0.75rem 2rem rgba(40, 25, 10, 0.3);
  transition: box-shadow 1s ease;
}

/* Rising into its place as the page's background (public/doors.js): its
   corners square and its shadow goes as it lands, so it meets the painting */
.doors-landing .doors-card {
  --card-radius: 0px;
}

.doors-landing .doors-edge {
  box-shadow: inset 0 0 0 1px rgba(255, 245, 225, 0), inset 0 0 1.5rem rgba(40, 20, 5, 0), 0 0 0 rgba(40, 25, 10, 0);
  transition: box-shadow 1.5s ease;
}

/* The paper under the open card (public/doors.js), its own layer so it can
   move with us: stepping back as the card opens, and back as it was as the
   card rises into place. Big enough to cover the screen when drawn back */
.doors-paper {
  position: fixed;
  inset: -100vmax;
  z-index: 19; /* (under the doors, over the home page's card and Replay) */
  background: var(--bg) var(--paper-grain);
  pointer-events: none;
}

.doors-flap-right .doors-face {
  background-position: calc(var(--w) / -2) 0;
}

.doors-back {
  transform: rotateY(180deg);
  background: var(--bg) var(--interior) 0 0 / calc(var(--w) * 2) 100% no-repeat;
}

.doors-flap-right .doors-back {
  background-position: calc(var(--w) * -1.5) 0;
}

/* The venue's sign on the right-hand door, as on the real one, between
   its hinges: their logo over "Main Entrance", in white ink on a wash of
   black, painted to sit in the doors' watercolour (public/art/doors-sign.webp,
   from art/invitation.py) */
.doors-sign {
  position: absolute;
  left: 24%; /* of the right-hand door */
  top: 46%;
  width: 44%;
  aspect-ratio: 600 / 373;
  background: url("/static/art/doors-sign.webp") center / 100% 100% no-repeat;
  filter: drop-shadow(0 1px 1px rgba(20, 10, 5, 0.35));
}

/* Waiting: now and then the doors ease apart a little, to say "open me" */
.doors-waiting .doors-flap-left {
  animation: doors-hint-left 3s ease-in-out 0.8s infinite;
}

.doors-waiting .doors-flap-right {
  animation: doors-hint-right 3s ease-in-out 0.8s infinite;
}

@keyframes doors-hint-left {
  0%, 60%, 100% { transform: rotateY(0deg); }
  78% { transform: rotateY(-14deg); }
}

@keyframes doors-hint-right {
  0%, 60%, 100% { transform: rotateY(0deg); }
  78% { transform: rotateY(14deg); }
}

/* The whole card is the button that opens it (no focus ring: Enter or
   Space anywhere opens it) */
.doors-open,
.doors-open:focus-visible,
.env-open:focus-visible {
  outline: none;
}

.doors-open {
  position: absolute;
  inset: 0;
  min-height: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
}

.doors-open:hover {
  background: transparent;
}

/* While anything's moving (the envelope, the doors, going back, the
   invitation's page growing in), nothing can be selected or called up by a
   long press: a tap mid-way does nothing but what the animation asks (the
   scripts also keep the page from being focused) */
.envelope body,
.doors-running body,
.doors-arriving body {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* Back from an invitation's doors to go back out: the card's hidden until
   the doors are over it (public/doors.js) */
.doors-returning .hero {
  visibility: hidden;
}

/* While the doors are out, Replay steps aside, but for while they wait
   (when it's back out, as for another code) */
.doors-running:not(.doors-waiting) .env-replay {
  opacity: 0;
  visibility: hidden;
}

/* An invitation's first page, until they've replied, and the day
   (src/first.ts; decisions, 27 November: Horizon, the sleeve). The painting
   at the top of the screen (.first-room: as wide as the screen or 74% of
   its height, whichever's more, where the doors' open card rises to:
   public/doors.js, the same sum), and over its lower part the paper, slid
   up like a sleeve, its gold edge along the top. The name is cut out of the
   paper (public/opening.js: .first-cut), the painting showing through it.
   The page's own paper, so the room isn't the fixed background here. */
.inside:has(main > .first) body::before,
.inside:has(main > .first) body::after,
.inside:has(main > .first) .edge-fade {
  display: none;
}

html.inside:has(main > .first),
.inside:has(main > .first) body {
  background: var(--bg) var(--paper-grain);
}

.inside .bare main:has(> .first) {
  max-width: none;
  width: 100%;
  margin: 0 !important; /* (not the panels' room for the edges' fade: none here) */
  padding: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
}

.inside body.bare:has(main > .first) {
  display: block;
}

.first {
  --room-shape: var(--interior-shape);
  --room-wide: max(100vw, 74svh * var(--room-shape));
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  min-height: 100svh;
  /* where the paper's edge is: as low as leaves the paper room for all it
     says on the screen, between 30% and 46% of the way down */
  padding-top: clamp(30svh, calc(100svh - 26rem), 46svh);
  overflow: hidden;
}

.first-room {
  position: absolute;
  z-index: -1;
  top: 0;
  left: 50%;
  width: var(--room-wide);
  height: calc(var(--room-wide) / var(--room-shape));
  translate: -50% 0;
  background: var(--interior) 0 0 / 100% 100% no-repeat;
}

/* the day: looking across the room, to its right-hand side */
.first-day .first-room {
  left: auto;
  right: 0;
  translate: 0 0;
}

/* The sleeve: every part of it paper but the name's holes, so the paper is
   each part's own, edge to edge with no gaps; its shadow up over the
   painting */
.first-sleeve {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  filter: drop-shadow(0 -6px 14px rgba(20, 12, 0, 0.28));
}

.first-sleeve > * {
  position: relative;
  margin: 0;
  padding-inline: max(1.3rem, calc((100% - 30rem) / 2));
  background: var(--bg) var(--paper-grain);
}

/* (each a pixel over the one before, so no hairline of the painting shows
   between them where a phone rounds their edges) */
.first-sleeve > * + * {
  margin-top: -1px;
}

.first-dear,
.first-title {
  padding-top: 1.3rem;
  border-top: 2px solid var(--gold);
}

.first-dear {
  padding-bottom: 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--gold);
}

/* their group's name: a name, so Amarante (decisions, 7 November); cut
   out, the paper drawn by the SVG with the letters as holes, a little
   shadow from the paper's edge falling into each */
.first-names {
  font-family: "Amarante", serif;
  font-weight: 400;
  font-size: clamp(3rem, 16.5vw, 4.4rem);
  line-height: 0.95;
  letter-spacing: 0;
  color: var(--accent);
  padding-block: 0.1rem 0.2rem;
  overflow-wrap: break-word;
}

.first-names-cut {
  color: transparent;
  background: none;
}

.first-names-cut::selection {
  color: var(--ink);
}

.first-cut {
  position: absolute;
  top: -1px; /* (a pixel over the paper above and below: opening.js) */
  left: 0;
  overflow: visible;
  pointer-events: none;
  filter: drop-shadow(0 2px 1.5px rgba(30, 18, 0, 0.6)) drop-shadow(0 0 0.5px rgba(30, 18, 0, 0.5));
}

.first-cut-paper {
  fill: var(--bg);
}

.first-amp {
  font-family: inherit;
}

/* the day's title, a size down from a name */
.first-title {
  padding-bottom: 1rem;
  font-family: "Amarante", serif;
  font-weight: 400;
  font-size: 2.6rem;
  line-height: 1;
  color: var(--accent);
}

/* the rest of the paper, to the bottom of the screen: Reply at its foot,
   clear of Replay */
.first-rest {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding-top: 0.5rem;
  padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
}

/* one sentence from "Dear": their name, then this, straight on from it */
.first-invited {
  margin: 0 0 1.6rem;
  font-size: 1.25rem;
  color: var(--ink);
}

.first-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 0 0 1.6rem;
}

.first-facts dt {
  margin-bottom: 0.25rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
}

.first-facts dd {
  margin: 0;
  font-weight: 500;
  line-height: 1.3;
  color: var(--ink);
}

/* Reply: the page's one way on, across the paper between two rules, at the
   foot of the paper; under it, one quiet row: the day, Not you?, Replay
   (public/doors.js puts it here), spread evenly */
.first-reply {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.9rem 0;
  border-block: 1px solid var(--line);
  border-top: 2px solid var(--ink);
  font-size: 1.45rem;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
}

.first-back {
  justify-content: flex-start;
  gap: 0.6rem;
  margin-top: 1.5rem;
  font-size: 1.2rem;
}

.first-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0;
  padding-top: 0.85rem;
  font-size: 0.9rem;
}

.first-foot a {
  color: var(--muted);
  text-decoration: none;
}

.first-foot .env-replay {
  position: static;
  padding: 0;
  font-size: 0.9rem;
  letter-spacing: 0;
  font-weight: 400;
}

.first-foot .env-replay span:last-child {
  text-decoration: none;
}

.first-foot .icon,
.first-reply .icon {
  width: 0.95em;
  height: 0.95em;
}

/* the day's timeline on the paper */
.first-day .line {
  font-size: 1.05rem;
}

/* Opening (public/inside.js, opening.js): the paper slides up from below
   the screen, from the first frame. Through the doors it began on the page
   before (public/doors.js: .doors-sleeve), and carries on from where it's
   got to (--rise-delay, negative: how long ago it started), blank, its words
   coming in on it. Without JavaScript, or with reduced motion, it's simply
   in place. Through the doors onto another page, the page waits for its
   fade, the room already there. */
@media (scripting: enabled) and (prefers-reduced-motion: no-preference) {
  .opening .first-page .first-sleeve {
    animation: first-rise 1s cubic-bezier(0.2, 0.7, 0.2, 1) var(--rise-delay, 300ms) both;
  }

  .opening.through-doors .first-page .first-sleeve::after {
    content: "";
    position: absolute;
    inset: 2px 0 0;
    z-index: 3;
    background: var(--bg) var(--paper-grain);
    animation: first-cover 0.6s ease 0.15s both;
  }

  .through-doors main:not(:has(> .first)),
  .through-doors .site-header {
    opacity: 0;
  }
}

@keyframes first-rise {
  from {
    transform: translateY(100svh);
  }
}

@keyframes first-cover {
  to {
    opacity: 0;
  }
}

/* The paper starting up on the page before, over the risen card (doors.js):
   just as the first page's will be, but blank */
.doors-sleeve {
  position: fixed;
  left: 0;
  right: 0;
  top: clamp(30svh, calc(100svh - 26rem), 46svh); /* (.first's padding-top) */
  bottom: 0;
  z-index: 25;
  border-top: 2px solid var(--gold);
  background: var(--bg) var(--paper-grain);
  filter: drop-shadow(0 -6px 14px rgba(20, 12, 0, 0.28));
  pointer-events: none;
}

/* A timeline: what time (or which step) | a line with a mark at each stop |
   what happens. Places are named on the line where they change, with a pin;
   evening guests arriving is a popper, the pin's size. */
.line {
  --line-times: 3rem;
  display: grid;
  /* the times' column as wide as the widest, so they line up on their right,
     and never narrower than "12:30", so both cards' lines line up (Dash) */
  grid-template-columns: minmax(var(--line-times), max-content) 1.5rem 1fr;
  column-gap: 0.55rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.95em;
}

.line li {
  position: relative;
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: 2.6rem 1.75rem 1fr; /* (where subgrid isn't) */
  grid-template-columns: subgrid;
  gap: 0 0.55rem;
  align-items: center; /* each row centred on its mark, whatever its size (Dash) */
}

/* the line, in the marks' own column, through their middles; half a row at
   either end */
.line li::before {
  content: "";
  grid-column: 2;
  grid-row: 1;
  justify-self: center;
  align-self: stretch;
  width: 2px;
  background: rgba(201, 154, 38, 0.45); /* (gold, faint: the cards' own line colour was lost between close marks, Dash) */
}

.line li:first-child::before {
  align-self: end;
  height: 50%;
}

.line li:last-child::before {
  align-self: start;
  height: 50%;
}

.line li > * {
  grid-row: 1;
}

.line-at {
  grid-column: 1;
}

.line-mark,
.line-pin {
  grid-column: 2;
}

.line-what,
.line-place > span:last-child {
  grid-column: 3;
}

.line-stop .line-what {
  padding-block: 0.42rem; /* (in the row, so the line runs through the gap between marks; room to breathe, Dash) */
}

.line-at {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  color: var(--gold);
}

.line-mark {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  border: 1.5px solid var(--accent);
  border-radius: 50%;
  background: var(--surface);
  color: var(--accent);
}

.line-mark .icon {
  width: 0.85rem;
  height: 0.85rem;
}

.line-what {
  line-height: 1.25;
}

/* a row's note, beside its words (Dash: room down) */
.line-note {
  font-size: 0.82em;
  color: var(--muted);
}

/* a pin (or the popper): small, gold, no circle, the line hidden behind it */
.line-pin {
  grid-column: 2;
  justify-self: center;
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  padding: 0.15rem;
  border-radius: 50%;
  background: var(--surface);
  color: var(--gold);
}

.line-pin .icon {
  width: 0.95rem;
  height: 0.95rem;
}

.line-place > span:last-child {
  padding-block: 0.3rem 0.15rem;
}

.line-place > span:last-child {
  align-self: center;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
}

.line-joins .line-what {
  padding-block: 0.25rem;
}

.line-joins .line-at,
.line-joins .line-what {
  font-size: 0.86em;
  color: var(--muted);
}

.line-joins .line-at {
  font-weight: 400;
}

/* the RSVP's steps: "STEP 1", a size up, its word in the place names' small
   capitals, filling the column as the times do (Dash) */
.line-steps .line-at {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 0.3em;
  font-size: 1.15em;
  font-weight: 500;
}

.line-steps .line-at small {
  font-size: 0.55em;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.inside .bare main:has(> .first) {
  margin-top: var(--fade-top);
  margin-bottom: var(--fade-bottom); /* clear of the fade, and Replay */
}

.icon-at-sign {
  --icon: url("/static/icons/at-sign.svg");
}

.icon-user {
  --icon: url("/static/icons/user.svg");
}

.icon-baby {
  --icon: url("/static/icons/baby.svg");
}

.icon-user-plus {
  --icon: url("/static/icons/user-plus.svg");
}

.icon-user-x {
  --icon: url("/static/icons/user-x.svg");
}

.icon-check {
  --icon: url("/static/icons/check.svg");
}

.icon-x {
  --icon: url("/static/icons/x.svg");
}

.icon-heart {
  --icon: url("/static/icons/heart.svg");
}

.icon-message-square-heart {
  --icon: url("/static/icons/message-square-heart.svg");
}

.icon-undo-2 {
  --icon: url("/static/icons/undo-2.svg");
}

.icon-church {
  --icon: url("/static/icons/church.svg");
}

.icon-arrow-left {
  --icon: url("/static/icons/arrow-left.svg");
}

/* Loading (public/loader.js): a thin gold line drawing in from the left,
   straight to the middle of the screen and there bending up into a circle;
   it's loaded when the circle closes, a wedding band, which then dissolves
   (Dash). Only when a wait goes on for a moment. The path is the script's. */
.wedding-band {
  --length: min(62vw, 15rem);
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 80; /* (over the dive's white, where a page may be loading) */
  width: var(--length);
  height: calc(var(--length) * 0.3 + 4px); /* the circle's size */
  translate: -50% -50%;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.5s ease,
    scale 0.55s ease,
    visibility 0s linear 0.5s;
}

.wedding-band.showing {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.5s ease;
}

/* dissolving: fading, and opening out a touch as it goes */
.wedding-band.showing.dissolving {
  opacity: 0;
  scale: 1.08;
  transition:
    opacity 0.55s ease,
    scale 0.55s ease;
}

.wedding-band svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.wedding-band path {
  fill: none;
  stroke: var(--gold);
  stroke-width: 2;
  stroke-linecap: round;
}

/* The screen's edges (src/layout.ts: .edge-fade, over the page and under
   Replay): anything scrolling off the top or bottom dissolves into the
   background (the paper, or inside, the painting itself, drawn again exactly
   where the background is) rather than running into Replay or the edge
   (Dash). Every page leaves room top and bottom so its first and last lines
   scroll clear of them, at full strength. Hidden while the background itself
   moves (coming in through the doors, folding back up). */
:root {
  --fade-top: 0.9rem;
  --fade-solid: calc(2.1rem + env(safe-area-inset-bottom, 0px)); /* where Replay is: the background alone, nothing over it (Dash) */
  --fade-bottom: calc(var(--fade-solid) + 1.4rem); /* and the fade above it */
}

.edge-fade {
  position: fixed;
  inset: 0;
  z-index: 9; /* over the page, under Replay (10) */
  pointer-events: none;
  background: var(--bg) var(--paper-grain);
  -webkit-mask: linear-gradient(#000, transparent var(--fade-top), transparent calc(100% - var(--fade-bottom)), #000 calc(100% - var(--fade-solid)), #000);
  mask: linear-gradient(#000, transparent var(--fade-top), transparent calc(100% - var(--fade-bottom)), #000 calc(100% - var(--fade-solid)), #000);
  transition: opacity 0.6s ease;
}

.inside .edge-fade {
  background:
    var(--paper-grain),
    var(--bg) var(--interior) center / max(100vw, 100vh * var(--interior-shape)) max(100vh, 100vw / var(--interior-shape)) no-repeat;
}

.doors-arriving .edge-fade,
.doors-running .edge-fade,
.doors-returning .edge-fade,
.envelope .edge-fade {
  opacity: 0;
  transition: none;
}

/* room under the last line, clear of the fade (and the first, above) */
.inside .bare main:not(:has(> .hero)) {
  margin-block: max(1rem, var(--fade-top)) var(--fade-bottom);
}

.inside main:not(:has(> .hero)) {
  margin-bottom: max(clamp(1.5rem, 8vh, 4rem), var(--fade-bottom));
}


/* The RSVP's panels on the fixed path (decisions 7 and 8 November): the
   strip has Back and "STEP 1 of 3" (no dots), and the section's icon and
   title sit over the question */
.ask-count {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.ask-count b {
  margin: 0 0.15em;
  font-size: 1.45em;
  letter-spacing: 0;
  color: var(--gold);
}

.ask-section {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.45rem;
  margin: 0.9rem 0 -0.4rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
}

.ask-badge {
  display: grid;
  place-items: center;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 50%;
  background: #f6ead0;
  font-size: 1.05rem;
}

.ask-hint {
  margin: -0.4rem 0 0.75rem;
  color: var(--muted);
  font-size: 0.95rem;
  text-shadow: 0 0 0.5rem var(--bg), 0 0 1rem var(--bg);
}

/* "Joining us": each person an icon in a ring, gold if ticked, a person
   crossed out in the seal's red if not (Dash); names in Amarante */
.reply-row {
  justify-content: flex-start;
  gap: 0.75rem;
}

.reply-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 2.1rem;
  height: 2.1rem;
  border: 1.5px solid rgba(201, 154, 38, 0.6);
  border-radius: 50%;
  background: #f6ead0;
  color: var(--gold);
  transition: color 0.2s, border-color 0.2s, background-color 0.2s;
}

.reply-icon .icon {
  width: 1.05rem;
  height: 1.05rem;
}

.reply-child .reply-icon .icon:first-child {
  width: 0.85rem;
  height: 0.85rem;
}

.reply-icon .icon-user-x,
.reply-row:not(:has(input:checked)) .reply-icon .icon:first-child {
  display: none;
}

.reply-row:not(:has(input:checked)) .reply-icon .icon-user-x {
  display: block;
}

.reply-row:not(:has(input:checked)) .reply-icon {
  border-color: rgba(139, 26, 31, 0.45);
  background: rgba(139, 26, 31, 0.06);
  color: #8b1a1f;
}

.reply-row .reply-name {
  flex: 1;
  display: grid;
  font: 400 1.4rem/1.15 var(--font-names);
  color: var(--accent);
  transition: color 0.2s;
}

.reply-row:not(:has(input:checked)) .reply-name {
  color: var(--muted);
}

.reply-row .reply-name small {
  font: 400 0.8rem/1.3 var(--font-text);
}

/* a name on one line (Dash: less to scroll): the first and last name, their
   labels inside the boxes ("First", "Last"); for a guest, an × at the end
   to take them away. For anyone invited without a name (on their row once
   ticked) and each guest brought */
.reply-named {
  padding: 0 0 0.75rem;
}

.reply-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: 0.5rem;
}

.reply-line-removable {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 1.5rem;
}

.reply-line input {
  min-width: 0;
  width: 100%;
  padding: 0.5rem 0.55rem;
  font-size: 1rem; /* (the labels inside the boxes fit; not under 16px, so a phone doesn't zoom in) */
}

.reply-line input::placeholder {
  color: var(--muted);
  opacity: 0.75;
}

.reply-line .input-bad {
  border-color: var(--plum);
  box-shadow: 0 0 0 1px var(--plum);
}



.reply-row:not(:has(input:checked)) + .reply-named {
  display: none;
}

.reply-named + .reply-row {
  border-top: 1px solid var(--line);
}

/* The way on, in the first page's style: words, and the arrow in a segment
   of its own; with nobody ticked, "Send our apologies", quieter */
.ask-answers .ask-go {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: stretch;
  width: 100%;
  max-width: 22rem;
  padding: 0;
  border: 1px solid var(--accent);
  border-radius: 0.6rem;
  color: var(--accent);
  font-weight: 600;
}

.ask-go-words {
  display: grid;
  align-content: center;
  padding: 0.45rem 0.6rem;
  line-height: 1.2;
}

.ask-go-words small {
  font-size: 0.75em;
  font-weight: 400;
  color: var(--muted);
}

.ask-go-arrow {
  display: grid;
  place-items: center;
  padding: 0 0.85rem;
  border-left: 1px solid rgba(3, 69, 158, 0.35);
}

.ask-answers .ask-go-sorry {
  border-color: var(--line);
  color: var(--muted);
}

.ask-go-sorry .ask-go-arrow {
  border-left-color: var(--line);
}

/* Nobody coming: their apologies, and a note if they'd like (src/rsvp.ts) */
.sorry {
  display: grid;
  justify-items: center;
  gap: 0.6rem;
  text-align: center;
}

.sorry-heart {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  margin-top: 1rem;
  border-radius: 50%;
  background: #f6ead0;
  color: var(--gold);
  font-size: 1.4rem;
}

.sorry-names {
  margin: 0;
  font: 400 1.8rem/1.15 var(--font-names);
  color: var(--accent);
}

.sorry-said {
  margin: 0;
}

.sorry .ask-form {
  width: 100%;
}

.sorry-note {
  width: 100%;
  text-align: left;
}

.sorry-note > span {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.sorry-note textarea {
  width: 100%;
  min-height: 5.5rem;
  border: 1px solid var(--muted);
  border-radius: 0.75rem;
}

.sorry-writer {
  text-align: left;
}

.sorry-again a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

/* Joining us's button: "Continue" while anyone's coming, else "Send our
   apologies", quieter (no JavaScript needed): on a list, with nobody
   ticked; on their own, with "Sorry, I can't make it" chosen */
.ask-go-either .ask-go-no,
.ask:has(.coming-no:checked) .ask-go-either .ask-go-yes,
.ask:has(.reply-people):not(:has(.coming-yes:checked)) .ask-go-either .ask-go-yes {
  display: none;
}

.ask:has(.coming-no:checked) .ask-go-either .ask-go-no,
.ask:has(.reply-people):not(:has(.coming-yes:checked)) .ask-go-either .ask-go-no {
  display: grid;
}

.ask-answers .ask-go-either,
.ask-go-either .ask-go-words {
  grid-column: 1;
  grid-row: 1;
}

.ask-go-either .ask-go-arrow {
  grid-column: 2;
  grid-row: 1;
}

.ask:has(.coming-no:checked) .ask-answers .ask-go-either,
.ask:has(.reply-people):not(:has(.coming-yes:checked)) .ask-answers .ask-go-either {
  border-color: var(--line);
  color: var(--muted);
}

.ask:has(.coming-no:checked) .ask-go-either .ask-go-arrow,
.ask:has(.reply-people):not(:has(.coming-yes:checked)) .ask-go-either .ask-go-arrow {
  border-left-color: var(--line);
}

.sorry > .ask-top {
  justify-self: stretch; /* (the strip across the panel, as on the questions) */
}

.ask-form > .ask-hint {
  text-align: center; /* (over the form's left-aligned fields) */
}

/* A code accepted (Dash: make it obvious before the page changes): the
   label and boxes give way to "Code accepted" in their place, keeping their
   room so nothing moves (public/doors.js). Words only for now (Dash: the
   tick didn't load in) */
.find-accepted {
  display: none;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  margin: 0;
  font-weight: 500;
  color: var(--accent);
}

.code-accepted .find-accepted {
  display: flex;
}

.code-accepted :is(.find-label, .find-row, .find-error) {
  visibility: hidden;
}

@media (prefers-reduced-motion: no-preference) {
  .code-accepted .find-accepted {
    animation: find-accepted 0.45s ease-out both;
  }
}

@keyframes find-accepted {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
}


/* Checking a code: the boxes breathe, and after a moment "Checking your
   code…" under them (Dash: on a slow connection it felt frozen), taking
   no room, so the boxes stay put */
.find-checking {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin: 0.375rem 0 0;
  text-align: center;
  font-size: 0.9rem;
  color: var(--muted);
}

.code-checking .find-checking {
  display: block;
  animation: find-checking-in 0.3s ease 0.4s both;
}

@keyframes find-checking-in {
  from {
    opacity: 0;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .code-checking .code-boxes {
    animation: find-checking-breathe 1.2s ease-in-out 0.4s infinite alternate;
  }
}

@keyframes find-checking-breathe {
  to {
    opacity: 0.45;
  }
}

.code-accepted .find-checking {
  display: none;
}

/* What needs fixing, said under the box it's about, the box outlined in
   plum (decisions, 9 November: not in a box at the top); about the panel
   as a whole, just above its answers */
.field-bad input,
.field-bad textarea {
  border-color: var(--plum);
  box-shadow: 0 0 0 1px var(--plum);
}

.field-error,
.ask-error p {
  margin: 0.3rem 0 0;
  color: var(--plum);
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1.35;
  text-align: left;
}

.ask-error {
  align-self: center;
  width: 100%;
  max-width: 22rem;
}

.ask-error p {
  margin: 0;
  text-align: center;
}

/* Someone invited on their own: "Can you join us?", two answers to choose
   between, each a card; chosen, outlined, its ring gold (yes) or red (no) */
.reply-alone {
  display: grid;
  gap: 0.5rem;
  width: 100%;
  max-width: 22rem;
  margin: 0 auto;
  padding: 0;
  border: 0;
}

.reply-answer {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 3.4rem;
  padding: 0.5rem 1rem;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(40, 25, 10, 0.08), 0 6px 18px rgba(40, 25, 10, 0.1);
  color: var(--accent);
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}

.reply-answer input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.reply-answer .reply-icon {
  border-color: var(--line);
  background: var(--surface);
  color: var(--muted);
}

.reply-answer:has(input:checked) {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 6px 18px rgba(40, 25, 10, 0.1);
}

.reply-yes:has(input:checked) .reply-icon {
  border-color: rgba(201, 154, 38, 0.6);
  background: #f6ead0;
  color: var(--gold);
}

.reply-no:has(input:checked) .reply-icon {
  border-color: rgba(139, 26, 31, 0.45);
  background: rgba(139, 26, 31, 0.06);
  color: #8b1a1f;
}

.reply-answer:has(input:focus-visible) {
  outline: 3px solid var(--text);
  outline-offset: 2px;
}

/* "Bring a guest" (Dash): its own card under the invitation's, its edge
   dashed until it's ticked; there while anyone on the invitation is coming
   (on their own, until they say they can't) */
.reply-guests {
  margin-top: 0.6rem;
  border: 1px dashed rgba(201, 154, 38, 0.7);
}

.reply-guests:has(.reply-bring input:checked) {
  border-style: solid;
  border-color: transparent;
}

.ask:has(.coming-no:checked) .reply-guests,
.ask:has(.reply-people):not(:has(.coming-yes:checked)) .reply-guests {
  display: none;
}

/* (not a name, so Jost, as the questions are: Dash) */
.reply-row.reply-bring .reply-name {
  font: 500 1.1rem/1.25 var(--font-text);
  color: var(--accent);
}

.reply-row.reply-bring .reply-name small {
  font-weight: 400;
}

/* not ticked: a plain ring, not the red of someone not coming */
.reply-bring:not(:has(input:checked)) .reply-icon {
  border-style: dashed;
  border-color: rgba(201, 154, 38, 0.7);
  background: var(--surface);
  color: var(--gold);
}

.reply-bring:not(:has(input:checked)) .reply-icon .icon:first-child {
  display: block;
}

.reply-guests:not(:has(.reply-bring input:checked)) .reply-slots {
  display: none;
}

.reply-slots {
  display: grid;
  gap: 0.5rem;
  padding: 0 0 0.85rem;
}

/* another guest: "Add another guest" until it's added; then their names,
   with "Remove"; the next one offered only once this one's added */
.reply-another,
.reply-remove {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.reply-remove {
  display: grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  color: var(--muted);
}

.reply-remove:hover {
  color: var(--plum);
  background: rgba(96, 40, 63, 0.08);
}

.reply-remove .icon {
  width: 1rem;
  height: 1rem;
}

.reply-another {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.9rem;
}

.reply-more:focus-visible + .reply-another {
  outline: 3px solid var(--text);
  outline-offset: 2px;
}

.reply-more:checked + .reply-another,
.reply-more:not(:checked) ~ .reply-guest-names,
.reply-slot-more:has(> .reply-more:not(:checked)) ~ .reply-slot {
  display: none;
}

.reply-slot-more {
  text-align: left;
}


