/*
 * Parker & Matthias: everything the site shows on a screen.
 * In order: the fonts, the tokens, the document, the parts every page shares, the bar, then each
 * page as the menu lists them. Each part starts from the phone and adds to itself on wider screens.
 */

/* ---- Fonts: two families, kept beside the site with their licences ---- */

@font-face {
  font-family: 'Bodoni Moda';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url('../fonts/bodoni-moda.woff2') format('woff2');
}

@font-face {
  font-family: 'Bodoni Moda';
  font-style: italic;
  font-weight: 400 900;
  font-display: swap;
  src: url('../fonts/bodoni-moda-italic.woff2') format('woff2');
}

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

/*
 * Stands in for Jost where the menu is a row of the bar, until Jost has come: Arial, its capitals
 * no wider than Jost's. The links all but fill that row, so in a wider face they would take two,
 * and the page would jump when Jost came. Firefox takes it only where Jost fails to come: while
 * one face is on its way it loads no other.
 */
@font-face {
  font-family: 'Jost stand-in';
  src: local('Arial');
  size-adjust: 93%;
}

/*
 * ---- Tokens ----
 * Every colour, type size and space on the site is one of these, but for the dress page's own
 * measures, which grow with the screen and are declared once on .dress-code. The layout changes
 * at six widths and one height, which a media query cannot read from a custom property, so they
 * are named here. The queries give them in em, the px over 16 (760px is 47.5em): in a media
 * query an em is the text size the reader's browser is set to, 16px unless the reader changed
 * it, so a reader who sets a larger one gets the layout drawn for a narrower screen.
 *
 *    266px  the story's link to its article keeps to one line (.link--padded-on-touch)
 *    320px  the narrowest screen the page is drawn for; below it a button's words may wrap, and
 *           are centred (.button)
 *    350px  past the narrowest phones: the usual gutter and title sizes
 *    760px  two columns
 *   1024px  three columns of photographs; the menu stands in the bar, on a row of its own, on a
 *           screen 500px tall or more
 *   1240px  the menu stands beside the emblem, on a screen 500px tall or more
 *    500px  tall: below it (a phone on its side) the bar keeps one row and its Menu button
 */

:root {
  /* Colour: black, gold and forest green. The lighter gold keeps small text clear over the film. */
  --color-ground: #0a0a0a;
  --color-text: #efe8d8;
  --color-hint: #d6cebd;
  --color-gold: #c9a96a;
  --color-gold-light: #e6cd93;
  --color-green: #123024;

  /* The ground, 82% opaque: laid over the film it keeps every text above its contrast floor. */
  --color-veil: rgb(10 10 10 / 82%);
  --color-hairline-faint: rgb(201 169 106 / 42%);

  /* The foil's golds in the order its sheet lays them, top to bottom, and the frame's two. */
  --color-foil-1: #fbefc6;
  --color-foil-2: #e6c986;
  --color-foil-3: #b8944e;
  --color-foil-4: #f0d9a2;
  --color-foil-5: #cfae6b;
  --color-foil-6: #9b7837;
  --color-gold-pale: #f1dcaa;
  --color-gold-deep: #b08c47;

  /* Gold foil: one sheet for a line of type, one for a rule, one for the hairline under a rule. */
  --foil-type: linear-gradient(
    180deg,
    var(--color-foil-1) 11%,
    var(--color-foil-2) 31%,
    var(--color-foil-3) 51%,
    var(--color-foil-4) 60%,
    var(--color-foil-5) 73%,
    var(--color-foil-3) 87%
  );
  --foil-rule: linear-gradient(
    90deg,
    rgb(176 140 71 / 0%),
    var(--color-gold-deep) 9%,
    var(--color-gold-pale) 50%,
    var(--color-gold-deep) 91%,
    rgb(176 140 71 / 0%)
  );
  --foil-hairline: linear-gradient(
    90deg,
    rgb(201 169 106 / 0%),
    rgb(201 169 106 / 46%) 14%,
    rgb(236 217 168 / 62%) 50%,
    rgb(201 169 106 / 46%) 86%,
    rgb(201 169 106 / 0%)
  );

  /*
   * Type: the serif for headings, always in capitals; the sans for everything that is read, but
   * on the dress page, which has a voice of its own (.dress-code, below). The families are quoted
   * in these stacks, where the style checker would read a bare name as a keyword; in @font-face,
   * where it asks for quotes only round a name that needs them, Jost stands bare.
   * Sizes and line heights are in rem, so that a reader who sets a larger text size gets it; at
   * the browser's own 16px the sizes are 12, 14, 18, 20, 28, 40 and 64px. The line heights are a
   * scale of their own (12, 24, 28, 32, 44 and 72px): each part takes the one it needs, so their
   * steps do not pair with the sizes' steps, as the optical sizes below do.
   */
  --font-serif: 'Bodoni Moda', 'Didot', 'Bodoni 72', 'Times New Roman', serif;
  --font-sans: 'Jost', 'Futura', 'Century Gothic', 'Helvetica Neue', sans-serif;
  --font-menu: 'Jost', 'Jost stand-in', sans-serif;
  --font-size-1: 0.75rem;
  --font-size-2: 0.875rem;
  --font-size-3: 1.125rem;
  --font-size-4: 1.25rem;
  --font-size-5: 1.75rem;
  --font-size-6: 2.5rem;
  --font-size-7: 4rem;
  --line-height-1: 0.75rem;
  --line-height-2: 1.5rem;
  --line-height-3: 1.75rem;
  --line-height-4: 2rem;
  --line-height-5: 2.75rem;
  --line-height-6: 4.5rem;
  --tracking-serif: 0.06em;
  --tracking-sans: 0.16em;

  /* The serif's optical size is set below the size it is drawn at: its hairlines stay sturdy. */
  --optical-size-3: 12;
  --optical-size-4: 14;
  --optical-size-5: 18;
  --optical-size-6: 28;

  /* Space: one scale. */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 16px;
  --space-4: 24px;
  --space-5: 32px;
  --space-6: 48px;
  --space-7: 64px;
  --space-8: 96px;

  /* Lines: one weight for every hairline and border, one for the ring round what has the focus. */
  --hairline: 1px;
  --focus-ring: 2px;

  /*
   * The grid: one page column with a gutter each side, and two equal columns inside it.
   * The page is laid under a phone's notch and rounded corners (viewport-fit=cover), so that the
   * film fills the screen; the gutter on each side is at least the screen's safe inset there.
   */
  --gutter: var(--space-3);
  --gutter-left: max(var(--gutter), env(safe-area-inset-left, 0px));
  --gutter-right: max(var(--gutter), env(safe-area-inset-right, 0px));
  --column-max: 1152px;
  --column-gap: var(--space-7);
  --label-column: var(--space-8);

  /*
   * The bar. Each of its controls is 8px wider on each side than its words, so that its focus
   * ring can be drawn inside the bar (above the bar there is no screen). The bar's side padding,
   * the control's margin and those 8px always add up to the gutter: the words stand on the column.
   * Only the menu's row under the emblem reaches past it, at its end, to hold its nine links.
   */
  --bar-side: var(--space-2);
  --bar-side-left: max(var(--bar-side), env(safe-area-inset-left, 0px));
  --bar-side-right: max(var(--bar-side), env(safe-area-inset-right, 0px));
  --brand-height: 50px;
  --bar-height: calc(var(--brand-height) + var(--hairline));
  --lockup-width: clamp(64px, 6.2vw, 72px);

  /* Measures that belong to one part each. */
  --control-height: 48px;
  --tap-height: 44px;
  --rule-height: 7px;
  --rule-foil-height: 2px;
  --portrait-size: var(--space-8);
  --photo-natural: 300px;
  --photo-widest: 800px;

  /*
   * Home's emblem takes the room the screen's height leaves it, so that on an upright phone the
   * names, the date and the two buttons stand on the first screen with it: never under 160px,
   * over 288px or over 64% of the screen's width.
   */
  --emblem-width: min(64vw, clamp(160px, 56vh - 160px, 288px));

  /* What lies over what. */
  --layer-backdrop: 0;
  --layer-page: 1;
  --layer-bar: 2;
}

@media (min-width: 21.875em) {
  :root {
    --gutter: var(--space-4);
    --bar-side: var(--space-3);
  }
}

@media (min-width: 47.5em) {
  :root {
    --gutter: var(--space-6);
    --bar-side: var(--space-5);
  }
}

@media (min-width: 77.5em) {
  :root {
    --gutter: var(--space-8);
    --bar-side: var(--space-7);
  }
}

/* ---- Document ---- */

* {
  box-sizing: border-box;
}

/*
 * The scrollbar is drawn on every page, so the bar and the column do not move between a page
 * that scrolls and one that fits the window. Sideways overflow is cut here, on the root: cut on
 * the body it would make the body a scroll box of its own, and the sticky bar would scroll away.
 * A control reached with the keyboard stops clear of the sticky bar (which has two rows where
 * the menu stands under the emblem) and of the foot of the screen. A phone turned on its side
 * keeps the type at its size.
 */
html {
  overflow: hidden scroll;
  background: var(--color-ground);
  scroll-padding: var(--space-7) 0;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

@media (min-width: 64em) and (min-height: 31.25em) {
  html {
    scroll-padding-top: calc(var(--space-8) + var(--space-3));
  }
}

@media (min-width: 77.5em) {
  html {
    scroll-padding-top: var(--space-7);
  }
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  background: var(--color-ground);
  color: var(--color-text);
  font: 400 var(--font-size-3) / var(--line-height-3) var(--font-sans);

  /* On a Mac, light type on a dark ground is drawn too heavy without these two. */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

main {
  position: relative;
  z-index: var(--layer-page);
  flex: 1 0 auto;
}

img,
svg {
  display: block;
}

a {
  color: inherit;
}

h1,
h2,
h3,
p,
ol,
ul,
dl,
dd,
figure,
fieldset,
legend {
  margin: 0;
  padding: 0;
}

/*
 * Each list draws its own markers, or none. Safari takes the list role away from a list whose
 * markers are styled away unless the role is written, so every list in the page says role="list".
 */
ol,
ul {
  list-style: none;
}

fieldset {
  min-width: 0;
  border: 0;
}

/* The ring round what has the focus; a choice's radio is out of sight, so its face carries it. */
:focus-visible,
.choice__input:focus-visible + .choice__face {
  outline: var(--focus-ring) solid var(--color-gold);
  outline-offset: var(--space-1);
}

/* ---- The backdrop: the Rookery behind every page ---- */

/*
 * A still of the film's first frame, fixed to the screen. The script lays the moving film over
 * it and the veil lies over both. The film shows once it plays: its first frame is the still,
 * so it needs no fade.
 */
.backdrop {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: var(--layer-backdrop);
  height: 100vh;
  height: 100lvh;
  overflow: hidden;
  background: var(--color-ground) url('../img/rookery-wide.jpg') 50% 50% / cover no-repeat;
  pointer-events: none;
}

@media (orientation: portrait) {
  .backdrop {
    background-image: url('../img/rookery-tall.jpg');
  }
}

.backdrop__film {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
}

.backdrop__film[data-playing] {
  opacity: 1;
}

.backdrop__veil {
  position: absolute;
  inset: 0;
  background: var(--color-veil) url('../img/grain.png');
}

/* ---- Parts every page shares ---- */

/* The block of drawings that the bar and Home place with <use>: it takes no room itself. */
.artwork {
  position: absolute;
}

/* The drawings' colours: the bar's lockup in the foil, Home's emblem in its golds on the ground. */
.artwork__foil-1 {
  stop-color: var(--color-foil-1);
}

.artwork__foil-2 {
  stop-color: var(--color-foil-2);
}

.artwork__foil-3 {
  stop-color: var(--color-foil-3);
}

.artwork__foil-4 {
  stop-color: var(--color-foil-4);
}

.artwork__foil-5 {
  stop-color: var(--color-foil-5);
}

.artwork__foil-6 {
  stop-color: var(--color-foil-6);
}

.artwork__gold-pale {
  stop-color: var(--color-gold-pale);
}

.artwork__gold {
  stop-color: var(--color-gold);
}

.artwork__gold-deep {
  stop-color: var(--color-gold-deep);
}

.artwork__ground {
  flood-color: var(--color-ground);
}

/* Out of sight, still read aloud. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/*
 * Gold foil on every heading: one sheet of foil to each line of type, cut to the letters.
 * Where a browser cannot cut it, the heading stays flat gold. Chrome before 120 cuts it only
 * when asked in its own prefixed form. The foil ends at the heading's edge, so a word longer
 * than its line (a long first name, or a large text size on a narrow screen) breaks inside
 * itself rather than running on past it, unseen.
 */
.foil {
  color: var(--color-gold);
  overflow-wrap: break-word;
}

@supports (background-clip: text) or (-webkit-background-clip: text) {
  .foil {
    background-image: var(--foil-type);
    background-repeat: repeat-y;
    background-size: 100% 100%;
    background-size: 100% 1lh;
    /* stylelint-disable-next-line property-no-vendor-prefix -- for Chrome before 120 */
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
  }
}

.section-title {
  font: 500 var(--font-size-3) / var(--line-height-2) var(--font-serif);
  font-variation-settings: 'opsz' var(--optical-size-3);
  letter-spacing: var(--tracking-serif);
  text-transform: uppercase;
  text-wrap: balance;
}

@media (min-width: 21.875em) {
  .section-title {
    font-size: var(--font-size-4);
    font-variation-settings: 'opsz' var(--optical-size-4);
  }
}

@media (min-width: 47.5em) {
  .section-title {
    font-size: var(--font-size-5);
    line-height: var(--line-height-4);
    font-variation-settings: 'opsz' var(--optical-size-5);
  }
}

.paragraph {
  text-wrap: pretty;
}

.paragraph + .paragraph {
  margin-top: var(--space-4);
}

.label {
  color: var(--color-gold-light);
  font: 500 var(--font-size-1) / var(--line-height-3) var(--font-sans);
  letter-spacing: var(--tracking-sans);
  text-transform: uppercase;
}

.note {
  margin-top: var(--space-2);
  font-size: var(--font-size-2);
  line-height: var(--line-height-2);
  text-wrap: balance;
}

.link {
  text-decoration: underline;
  text-decoration-color: var(--color-gold);
  text-decoration-thickness: var(--hairline);
  text-underline-offset: var(--space-1);
}

@media (hover: hover) {
  .link:hover {
    color: var(--color-gold-light);
  }
}

/* A link that stands alone gets padding, not bigger type, to be a full tap target. */
.link--padded {
  padding: var(--space-3) 0;
}

/*
 * A link inside a sentence: padded where a finger is the pointer or the screen is a phone's.
 * From 16.625em wide (266px at 16px, the narrowest screen whose column holds the story's link
 * to its article on one line) it keeps to one line, so that its padding and its focus ring stay
 * whole. On a narrower screen (a page zoomed in on a small phone, or a reader's large text size)
 * it wraps rather than running off the screen. With a mouse on a wider screen it stays plain,
 * so that its focus ring keeps to its own line.
 */
.link--padded-on-touch {
  padding: var(--space-3) 0;
}

@media (min-width: 16.625em) {
  .link--padded-on-touch {
    white-space: nowrap;
  }
}

@media (min-width: 47.5em) and (hover: hover) {
  .link--padded-on-touch {
    padding: 0;
  }
}

.link--telephone {
  display: inline-block;
  padding: var(--space-2) 0;
  white-space: nowrap;
}

/* A button that reads as a link: the quiet second choice beside a primary button. */
.text-button {
  min-height: var(--tap-height);
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

/* The rule under every heading: a foil rule over a hairline, both fading at the ends. */
.rule {
  height: var(--rule-height);
  margin: var(--space-4) 0 var(--space-5);
  background:
    var(--foil-rule) 0 0 / 100% var(--rule-foil-height) no-repeat,
    var(--foil-hairline) 0 100% / 100% var(--hairline) no-repeat;
}

@media (min-width: 47.5em) {
  .rule {
    margin: var(--space-5) 0 var(--space-6);
  }
}

/* Under a section title the rule sits close, and what follows sets its own distance. */
.rule--tight {
  margin: var(--space-3) 0 0;
}

.rule--emblem-width {
  width: var(--emblem-width);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-5);
}

.button-row--center {
  justify-content: center;
}

/*
 * The site's button. Its words keep to one line wherever its row has room for it; a button
 * wider than its row (a large text size on a narrow screen) wraps them, centred.
 */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--control-height);
  margin: 0;
  padding: 0 var(--space-4);
  border: var(--hairline) solid var(--color-gold);
  border-radius: 0;
  background: var(--color-ground);
  color: var(--color-text);
  font: 500 var(--font-size-1) / var(--line-height-1) var(--font-sans);
  letter-spacing: var(--tracking-sans);
  text-align: center;
  text-decoration: none;
  text-transform: uppercase;
  cursor: pointer;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
}

/*
 * From 20em no button is wider than its row, and its one line keeps the alignment the browser
 * gives it (a button element is centred by the browser, a link takes its row's): WebKit draws a
 * line a fraction of a pixel apart under another alignment.
 */
@media (min-width: 20em) {
  .button {
    text-align: revert;
  }
}

/* The gold fill, dark words on gold: the primary button, a chosen answer and selected text. */
.button--primary,
.choice__input:checked + .choice__face,
::selection {
  background: var(--color-gold);
  color: var(--color-ground);
}

/*
 * Forest green is the accent of a pointer resting on a button, never a panel: only where a
 * pointer can rest, and only from 760px wide, so that no green area is a large part of a screen.
 */
@media (min-width: 47.5em) and (hover: hover) {
  .button:hover {
    background: var(--color-green);
  }

  .button--primary:hover {
    color: var(--color-text);
  }
}

/*
 * A choice is a real radio button, out of sight, and a face drawn as the site's button. On a
 * phone the answers stand one under the other, each the column's width: a choice takes a whole
 * row of its question, and as a column of one its face stretches across it. From 760px they
 * stand side by side, each as wide as its words.
 */
.choice {
  position: relative;
  display: flex;
  flex: 1 1 100%;
  flex-direction: column;
}

@media (min-width: 47.5em) {
  .choice {
    flex: 0 1 auto;
    flex-direction: row;
  }
}

/* A field: a gold label over a line to write on. */
.field {
  display: block;
}

.field__label {
  display: block;
}

.field__input {
  display: block;
  width: 100%;
  margin: 0;
  padding: var(--space-2) 0;
  border: 0;
  border-bottom: var(--hairline) solid var(--color-gold);
  border-radius: 0;
  background: none;
  color: var(--color-text);
  font: inherit;
  appearance: none;
  resize: none;
}

.field__input::placeholder {
  color: var(--color-hint);
  opacity: 1;
}

/* Two columns from 760px, and one hairline between them where both hold a list. */
.columns {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  row-gap: var(--space-5);
  align-items: start;
}

.columns__divider {
  border-top: var(--hairline) solid var(--color-gold);
}

@media (min-width: 47.5em) {
  .columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: var(--column-gap);
  }

  .columns__divider {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    border-top: 0;
    border-left: var(--hairline) solid var(--color-gold);
  }
}

.columns--sides {
  row-gap: var(--space-6);
  margin-top: var(--space-6);
}

.columns__divider--wide-only {
  display: none;
}

@media (min-width: 47.5em) {
  .columns__divider--wide-only {
    display: block;
  }
}

/* Label and value rows: every value starts one label column in. */
.facts {
  display: grid;
  row-gap: var(--space-2);
  margin-top: var(--space-4);
}

.facts__row {
  display: grid;
  grid-template-columns: var(--label-column) minmax(0, 1fr);
  column-gap: var(--space-3);
  align-items: baseline;
}

/* ---- The bar and its menu ---- */

.site-header {
  position: sticky;
  top: 0;
  z-index: var(--layer-bar);
  border-bottom: var(--hairline) solid var(--color-gold);
  background: var(--color-ground);
}

.site-header__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  column-gap: var(--space-2);
  max-width: calc(var(--column-max) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 0 var(--bar-side-right) 0 var(--bar-side-left);
}

/* The emblem in the top left of every page, the way back to Home. */
.site-header__brand {
  display: flex;
  align-items: center;
  height: var(--brand-height);
  padding: 0 var(--space-2);
}

/* The rings of the bar's own controls are drawn inside them: above the bar there is no screen. */
.site-header__brand:focus-visible {
  outline-offset: calc(-1 * var(--space-1));
}

.site-header__lockup {
  flex: none;
  width: var(--lockup-width);
  height: auto;
}

/* The Menu button is the site's button; it is shown only where scripts run to open the menu. */
.site-header__menu-button {
  display: none;
  margin-right: var(--space-2);
  padding: 0 var(--space-3);
}

.site-header__menu-button[aria-expanded='true'] {
  background: var(--color-green);
}

.site-header__menu-button:focus-visible {
  outline-offset: calc(-1 * var(--space-2));
}

[data-scripted] .site-header__menu-button {
  display: inline-flex;
}

@media (hover: hover) {
  .site-header__menu-button:hover {
    background: var(--color-green);
  }
}

.site-nav__list {
  padding: var(--space-2) var(--gutter-right) var(--space-3) var(--gutter-left);
}

.site-nav__link {
  display: block;
  padding: var(--space-3) 0;
  font: 500 var(--font-size-1) / var(--line-height-1) var(--font-sans);
  letter-spacing: var(--tracking-sans);
  text-decoration: none;
  text-transform: uppercase;
  white-space: nowrap;
}

.site-nav__link[aria-current='page'] {
  color: var(--color-gold);
  text-decoration: underline;
  text-decoration-thickness: var(--hairline);
  text-underline-offset: var(--space-2);
}

@media (hover: hover) {
  .site-nav__link:hover {
    color: var(--color-gold);
  }
}

/* On a phone the menu is a panel under the bar, opened by the Menu button. */
[data-scripted] .site-nav {
  position: absolute;
  top: 100%;
  right: 0;
  left: 0;
  display: none;
  max-height: calc(100vh - var(--bar-height));
  max-height: calc(100dvh - var(--bar-height));
  overflow-y: auto;
  border-bottom: var(--hairline) solid var(--color-gold);
  background: var(--color-ground);
}

/* The panel is the element right after the Menu button in the bar: the button's state opens it. */
[data-scripted] .site-header__menu-button[aria-expanded='true'] + .site-nav {
  display: block;
}

@media (min-width: 47.5em) {
  .site-header__title {
    margin-left: var(--space-2);
  }

  .site-header__menu-button {
    margin-right: var(--space-3);
  }
}

/*
 * From 1024px the menu stands in the bar: first on a row of its own, under the emblem, which its
 * nine links fill from that width. It keeps the ground colour the phone's panel gives it: Chrome
 * sharpens type only where it finds an opaque ground directly under the letters. Only where the
 * screen is also 500px tall: on a shorter one (a phone on its side) a second row would take a
 * quarter of it, so the Menu button and its panel stay.
 *
 * Between one link and the next stands a part that takes what the row has over, up to 8px: where
 * the row only just holds the nine, their own padding keeps the words apart. A gap cannot give
 * way: the row would break first. The items' boxes are set aside (contents), so that the links
 * and those parts stand in the row itself. Under the emblem the row ends 24px past the column, so
 * that it holds the nine beside a scrollbar too. 8px of those are the last link's padding; a part
 * at the row's end takes the other 16px before any other takes its share, and so the last word
 * stays on the column, but at the narrowest widths beside a scrollbar.
 */
@media (min-width: 64em) and (min-height: 31.25em) {
  .site-header__inner {
    column-gap: var(--space-3);
  }

  [data-scripted] .site-header__menu-button {
    display: none;
  }

  .site-nav {
    flex-basis: 100%;
    margin-right: calc(-1 * var(--space-2));
    margin-left: var(--space-2);
  }

  [data-scripted] .site-nav {
    position: static;
    display: block;
    max-height: none;
    overflow-y: visible;
    border-bottom: 0;
  }

  .site-nav__list {
    display: flex;
    flex-wrap: wrap;
    padding: 0;
  }

  .site-nav__list > li {
    display: contents;
  }

  .site-nav__list > li + li::before {
    flex: 1 1 0;
    max-width: var(--space-2);
    content: '';
  }

  .site-nav__list::after {
    flex: 1000 1 0;
    max-width: var(--space-3);
    content: '';
  }

  .site-nav__link {
    padding: var(--space-3) var(--space-2);
    font-family: var(--font-menu);
  }

  .site-nav__link:focus-visible {
    outline-offset: calc(-1 * var(--space-1));
  }
}

@media (min-width: 77.5em) {
  .site-header__title {
    margin-left: var(--space-4);
  }
}

/* Beside the emblem the menu takes the rest of the row, and its links stand at the row's end. */
@media (min-width: 77.5em) and (min-height: 31.25em) {
  .site-nav {
    flex: 1 1 auto;
    margin-right: var(--space-4);
    margin-left: 0;
  }

  .site-nav__list {
    justify-content: flex-end;
  }

  .site-nav__list::after {
    content: none;
  }
}

/* ---- Pages ---- */

.page {
  padding: var(--space-5) var(--gutter-right) var(--space-7) var(--gutter-left);
}

@media (min-width: 47.5em) {
  .page {
    padding-top: var(--space-6);
    padding-bottom: var(--space-8);
  }
}

/*
 * One page shows at a time: the one the root's data-showing names. With no script that attribute
 * is never written, and every page shows, one under the other.
 */
[data-showing] .page {
  display: none;
}

[data-showing='home'] [data-page='home'],
[data-showing='events'] [data-page='events'],
[data-showing='rsvp'] [data-page='rsvp'],
[data-showing='story'] [data-page='story'],
[data-showing='photos'] [data-page='photos'],
[data-showing='party'] [data-page='party'],
[data-showing='dress'] [data-page='dress'],
[data-showing='stay'] [data-page='stay'],
[data-showing='things'] [data-page='things'],
[data-showing='registry'] [data-page='registry'] {
  display: block;
}

.page__column {
  max-width: var(--column-max);
  margin: 0 auto;
}

.page__title {
  font: 500 var(--font-size-4) / var(--line-height-2) var(--font-serif);
  font-variation-settings: 'opsz' var(--optical-size-4);
  letter-spacing: var(--tracking-serif);
  text-transform: uppercase;
  text-wrap: balance;
}

/* The script moves focus to a page's title when the page opens: a title shows no ring. */
.page__title:focus {
  outline: 0;
}

@media (min-width: 21.875em) {
  .page__title {
    font-size: var(--font-size-5);
    line-height: var(--line-height-4);
    font-variation-settings: 'opsz' var(--optical-size-5);
  }
}

@media (min-width: 47.5em) {
  .page__title {
    font-size: var(--font-size-6);
    line-height: var(--line-height-5);
    font-variation-settings: 'opsz' var(--optical-size-6);
  }
}

.page__lede {
  margin-top: var(--space-3);
}

/* The first of the page's two columns, for a page that holds one. */
@media (min-width: 47.5em) {
  .page__half {
    max-width: calc(50% - var(--column-gap) / 2);
  }
}

/* ---- Home: the one centred page ---- */

.masthead {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.masthead__emblem {
  width: var(--emblem-width);
  height: auto;
}

/*
 * Tracked capitals carry their tracking after the last letter too: the same amount before the
 * first letter puts the letters, not their spacing, on the page's axis.
 */
.masthead__names {
  margin-top: var(--space-5);
  text-indent: var(--tracking-serif);
}

@media (min-width: 77.5em) {
  .masthead__names {
    font-size: var(--font-size-7);
    line-height: var(--line-height-6);
  }
}

.masthead__date {
  margin-top: var(--space-3);
  font-weight: 500;
  font-size: var(--font-size-2);
  line-height: var(--line-height-2);
  letter-spacing: var(--tracking-sans);
  text-indent: var(--tracking-sans);
  text-transform: uppercase;
}

@media (min-width: 47.5em) {
  .masthead__date {
    font-size: var(--font-size-3);
    line-height: var(--line-height-3);
  }
}

.masthead__place {
  margin-top: var(--space-1);
}

.masthead__note {
  margin-top: var(--space-5);
}

/* ---- Event details ---- */

.event__welcome {
  margin-top: var(--space-4);
}

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

.reply-form__question + .reply-form__question {
  margin-top: var(--space-5);
}

.reply-form__choices {
  margin-top: var(--space-2);
}

/* The line keeps its height when it is empty, so the button below never jumps. */
.reply-form__error {
  min-height: var(--line-height-2);
  margin-top: var(--space-4);
  color: var(--color-gold-light);
  font-size: var(--font-size-2);
  line-height: var(--line-height-2);
}

.reply-form__send {
  margin-top: var(--space-2);
}

.reply-thanks__text {
  margin-top: var(--space-4);
}

.keep-date {
  margin-top: var(--space-6);
}

.keep-date__buttons {
  margin-top: var(--space-3);
}

/* ---- Our story ---- */

/* A photograph is never drawn larger than its own pixels. */
.photo {
  max-width: var(--photo-natural);
}

.photo__image {
  width: 100%;
  height: auto;
}

/*
 * A row of equal heights. Three square photographs and one of 3:4 share the column, so their
 * widths add up to 3.75 heights: height = (column - 3 gaps) / 3.75. Where the browser can
 * measure the row itself (cqw) every photograph is given that height; elsewhere the widths
 * are set and the heights follow.
 */
.photo-row {
  --photo-row-heights-wide: 3.75;
  --photo-row-gaps: 3;
  --photo-tall-ratio: 0.75;

  display: grid;
  row-gap: var(--space-5);
  margin-top: var(--space-5);
}

@media (min-width: 47.5em) {
  .photo-row {
    display: flex;
    column-gap: var(--space-5);
    align-items: flex-start;
    margin-top: var(--space-7);
  }

  .photo-row__photo {
    flex: none;
    width: calc((100% - var(--photo-row-gaps) * var(--space-5)) / var(--photo-row-heights-wide));
    max-width: none;
  }

  .photo-row__photo--tall {
    width: calc(
      (100% - var(--photo-row-gaps) * var(--space-5)) / var(--photo-row-heights-wide) *
        var(--photo-tall-ratio)
    );
  }

  @supports (width: 1cqw) {
    .photo-row {
      container-type: inline-size;
    }

    .photo-row__photo {
      width: min-content;
    }

    .photo-row__image {
      width: auto;
      height: calc(
        (100cqw - var(--photo-row-gaps) * var(--space-5)) / var(--photo-row-heights-wide)
      );
    }
  }
}

/* ---- Photos ---- */

/*
 * The photographs in a list, each a link to its larger file: one under the other on a phone, two
 * to a row from 760px and three from 1024px, each in the middle of its row. In the rows a tall one
 * takes three quarters of its place, and so stands about as high as a wide one is wide. The sizes
 * attributes in the page follow these widths. On paper the photographs stay one under the other,
 * as wide as the story's (.photo).
 */
.photo-grid {
  display: grid;
  gap: var(--space-5);
}

/* One box round the photograph, and so one ring round it when it has the focus. */
.photo-grid__link {
  display: block;
}

/*
 * On a screen each is as wide as its place, but no wider than 800px, so that none is drawn larger
 * than its own pixels: the narrowest of their larger files has 984. Only a reader who sets a text
 * size so large that one column is wider than that meets the limit.
 */
@media screen {
  .photo-grid__photo {
    max-width: var(--photo-widest);
  }
}

@media screen and (min-width: 47.5em) {
  .photo-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: center;
  }

  .photo-grid__photo--tall {
    width: 75%;
    margin: 0 auto;
  }
}

@media screen and (min-width: 64em) {
  .photo-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* ---- Wedding party ---- */

.people {
  display: grid;
  row-gap: var(--space-4);
  margin-top: var(--space-4);
}

.person {
  display: grid;
  grid-template-columns: var(--portrait-size) minmax(0, 1fr);
  column-gap: var(--space-4);
  align-items: center;
}

/* A square: a photograph, or the initials of someone who has none. */
.person__portrait {
  width: var(--portrait-size);
  height: var(--portrait-size);
}

.person__portrait--initials {
  display: flex;
  align-items: flex-end;
  padding: var(--space-3);
  border: var(--hairline) solid var(--color-gold);
  color: var(--color-gold-light);
  font: 500 var(--font-size-1) / var(--line-height-1) var(--font-sans);
  letter-spacing: var(--tracking-sans);
  text-transform: uppercase;
}

.person__name {
  display: block;
  font-weight: 500;
}

.person__role {
  display: block;
  font-size: var(--font-size-2);
  line-height: var(--line-height-2);
}

/* ---- Dress code ---- */

/*
 * This page has a voice of its own: an italic overview over labelled columns of serif text.
 * Its sizes grow with the screen, so they and its line heights are its own and not steps of
 * the scales. Its type sizes are written in sixteenths of a rem: each number is the size in
 * pixels at the browser's own 16px.
 */
.dress-code {
  --overview-size: clamp(calc(23rem / 16), 2.6vw, calc(34rem / 16));
  --overview-leading: 1.3;
  --overview-measure: 28em;
  --overview-optical-size: 16;
  --detail-size: clamp(calc(17rem / 16), 1.5vw, calc(19.5rem / 16));
  --detail-leading: 1.65;
  --detail-measure: 36em;
  --detail-optical-size: 12;
  --term-size: calc(12.5rem / 16);
  --term-leading: 1.2;
  --term-tracking: 0.24em;
  --term-gap: 12px;
  --list-top: clamp(30px, 5vh, 48px);
  --list-row-gap: clamp(24px, 4vh, 40px);
  --list-column-gap: clamp(26px, 5vw, 72px);
}

.dress-code__overview {
  max-width: var(--overview-measure);
  color: var(--color-gold-light);
  font: italic 400 var(--overview-size) / var(--overview-leading) var(--font-serif);
  font-variation-settings: 'opsz' var(--overview-optical-size);
  text-wrap: balance;
}

.dress-code__list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--list-row-gap) var(--list-column-gap);
  margin-top: var(--list-top);
}

@media (min-width: 47.5em) {
  .dress-code__list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.dress-code__term {
  padding-bottom: var(--term-gap);
  border-bottom: var(--hairline) solid var(--color-hairline-faint);
  color: var(--color-gold-light);
  font: 500 var(--term-size) / var(--term-leading) var(--font-sans);
  letter-spacing: var(--term-tracking);
  text-transform: uppercase;
}

.dress-code__detail {
  max-width: var(--detail-measure);
  margin-top: var(--term-gap);
  font: 400 var(--detail-size) / var(--detail-leading) var(--font-serif);
  font-variation-settings: 'opsz' var(--detail-optical-size);
}

/* ---- Where to stay ---- */

.hotel-address {
  margin-top: var(--space-3);
}

/* ---- Things to do ---- */

/*
 * The four places stand two to a row from 760px. Each is laid out as the hotel is: its name over
 * a rule, its address and telephone, then their words and the place's own website.
 */
.columns--places {
  row-gap: var(--space-6);
}

@media (min-width: 47.5em) {
  .columns--places {
    row-gap: var(--space-7);
  }
}

.place__address,
.place__activity,
.place__text {
  margin-top: var(--space-3);
}

/* What the cruise is called stands close over their words about it. */
.place__activity + .place__text {
  margin-top: var(--space-1);
}

/* ---- Registry ---- */

.causes {
  display: grid;
  row-gap: var(--space-5);
  margin: var(--space-5) 0;
}

.causes__item {
  display: grid;
  grid-template-columns: var(--space-5) minmax(0, 1fr);
  text-wrap: balance;
}

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

.site-footer {
  position: relative;
  z-index: var(--layer-page);
  padding: var(--space-5) var(--gutter-right) var(--space-6) var(--gutter-left);
  border-top: var(--hairline) solid var(--color-gold);
}

.site-footer__line {
  max-width: var(--column-max);
  margin: 0 auto;
  font: 500 var(--font-size-1) / var(--line-height-2) var(--font-sans);
  letter-spacing: var(--tracking-sans);
  text-transform: uppercase;
}

/* Two lines on a phone; one line, with the dot between, from 760px. */
.site-footer__part {
  display: block;
}

.site-footer__separator {
  display: none;
}

@media (min-width: 47.5em) {
  .site-footer__part,
  .site-footer__separator {
    display: inline;
  }
}

/* ---- Where the reader has asked for their own colours, the foil gives way ---- */

@media (forced-colors: active) {
  .foil {
    background: none;
    color: CanvasText;
    -webkit-text-fill-color: CanvasText;
  }

  /*
   * The chosen answer is drawn as the system draws a selection; the gold fill would be lost.
   * These are the system's own colours, so the browser is told to leave them be: adjusting
   * them, Chrome would lay a plate of the page's ground colour under the words, which in the
   * usual themes is the words' own colour. Its focus ring keeps the colour of every other ring.
   */
  .choice__input:checked + .choice__face {
    border-color: Highlight;
    background: Highlight;
    color: HighlightText;
    outline-color: CanvasText;
    forced-color-adjust: none;
  }
}

/* ---- Last, so it wins over any display above of no more weight: what is hidden is hidden ---- */

[hidden] {
  display: none;
}
