/* ==========================================================================
   Thornton Wakefield
   One stylesheet for the whole site. No frameworks.

   The idea: an engraved certificate that is alive. A midnight ground, gold
   used the way an engraver uses it (as fine line and as one solid field),
   very tall display type, and a live piece of engine-turned line work round
   the crest (drawn by lathe.js). Everything here works without script: the
   scripts only add the moving parts.

   Contents
     1. Tokens              6. Home: the standard     11. Footer
     2. Base                7. Home: principles       12. Motion
     3. Helpers             8. Home: what we do         13. Special display modes
     4. Buttons and links   9. Writing to us
     5. Header and menu    10. Inner pages
   ========================================================================== */

/* ---------- 1. Tokens ---------------------------------------------------- */

:root {
  color-scheme: dark;

  --night: #050B19;
  --night-deep: #03070F;
  --night-up: #0A1429;
  --night-glow: #14294F;
  --ivory: #F1EADB;
  --ivory-soft: #BDB7A6;
  --gold: #D8B878;
  --gold-pale: #F3DFAE;
  --gold-deep: #9A7636;
  --ink: #0A1836;
  --rule: rgb(216 184 120 / 0.26);
  --rule-strong: rgb(216 184 120 / 0.5);
  --foil: linear-gradient(118deg, #8E6E38 0%, #D9B978 22%, #FBF0D2 38%, #D2AF6B 52%, #9A773C 70%, #E6CB91 88%, #B8975A 100%);

  --font-display: "Imbue", "Imbue Fallback", "Bodoni MT", Didot, "Times New Roman", serif;
  --font-text: "Ysabeau Office", "Ysabeau Fallback", "Gill Sans", "Gill Sans MT", "Trebuchet MS", sans-serif;
  --font-caps: "Castoro Titling", "Castoro Fallback", "Palatino Linotype", "Book Antiqua", Georgia, serif;

  --gutter: clamp(1.25rem, 4vw, 3.5rem);
  --container: 92rem;
  --header-h: 4.5rem;

  --ease: cubic-bezier(0.2, 0, 0, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

@media (min-width: 60em) {
  :root { --header-h: 5.5rem; }
}

/* Stand-ins that take up the same room as the web fonts while those load, so
   the page does not jump when they arrive. Width, height above the line and
   depth below it were each measured against the real font in a browser. */
@font-face {
  font-family: "Imbue Fallback";
  src: local("Times New Roman"), local("Times"), local("Liberation Serif"), local("Tinos");
  size-adjust: 64%;
  ascent-override: 148.4%;
  descent-override: 39.1%;
  line-gap-override: 0%;
}

@font-face {
  font-family: "Ysabeau Fallback";
  src: local("Arial"), local("Helvetica Neue"), local("Liberation Sans"), local("Arimo"), local("Roboto");
  size-adjust: 95%;
  ascent-override: 110.5%;
  descent-override: 30.5%;
  line-gap-override: 0%;
}

@font-face {
  font-family: "Castoro Fallback";
  src: local("Georgia"), local("Times New Roman"), local("Liberation Serif");
  size-adjust: 102.5%;
  ascent-override: 74.1%;
  descent-override: 24.4%;
  line-gap-override: 0%;
}

/* ---------- 2. Base ------------------------------------------------------ */

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

html {
  background: var(--night);
  scroll-padding-top: calc(var(--header-h) + 1.5rem);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

/* Glide to anchors only after the page has settled (the script adds the
   class), so a link from another page lands on its section at once. */
@media (prefers-reduced-motion: no-preference) {
  html.is-settled:not([data-motion="off"]) { scroll-behavior: smooth; }
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-text);
  font-size: 1.1875rem;
  line-height: 1.6;
  color: var(--ivory);
  background: var(--night);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-wrap: break-word;
}

/* A fine speckle over everything, so the dark gradients never band and the
   gold has some tooth to it. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 30;
  pointer-events: none;
  background: url("/assets/img/grain.e1f10aa4f2.png") 0 0 / 64px 64px;
  opacity: 0.4;
}

img,
svg,
canvas {
  display: block;
  max-width: 100%;
}

img { height: auto; }

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 300;
  line-height: 0.92;
  text-wrap: balance;
}

p,
ul,
ol,
dl,
figure,
table {
  margin: 0;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
}

button { font: inherit; }

::selection {
  color: var(--ink);
  background: var(--gold-pale);
}

:focus-visible {
  outline: 2px solid var(--gold-pale);
  outline-offset: 4px;
}

[hidden] { display: none !important; }

/* ---------- 3. Helpers --------------------------------------------------- */

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

@supports (padding: max(0px, env(safe-area-inset-left))) {
  .container {
    padding-right: max(var(--gutter), env(safe-area-inset-right));
    padding-left: max(var(--gutter), env(safe-area-inset-left));
  }
}

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

.skip-link {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 100;
  padding: 0.9rem 1.25rem;
  font-family: var(--font-caps);
  font-size: 0.8125rem;
  letter-spacing: 0.12em;
  text-decoration: none;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--gold-pale);
  transform: translateY(-200%);
}

.skip-link:focus { transform: none; }

.top-sentinel {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

/* A small line of engraved capitals. Used sparingly: to say which part of the
   site a page belongs to, and for the headings of small lists. */
.label {
  font-family: var(--font-caps);
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  line-height: 1.5;
  text-transform: uppercase;
  color: var(--gold);
}

.lede {
  font-size: clamp(1.25rem, 1.05rem + 0.6vw, 1.5rem);
  line-height: 1.5;
}

/* The crest in gold foil. The real image stays in the page for its text
   alternative and for display modes that strip backgrounds. Where the browser
   can cut a shape out of a gradient, the image is hidden and the same shape
   is shown in foil. */
.crest-gold {
  position: relative;
  aspect-ratio: 1;
}

.crest-gold img {
  width: 100%;
  height: 100%;
}

@supports ((-webkit-mask-image: none) or (mask-image: none)) {
  .crest-gold img { opacity: 0; }

  .crest-gold::after {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--foil);
    background-size: 260% 260%;
    background-position: 30% 30%;
    -webkit-mask: url("/assets/img/tw-crest-white.c6ef6f60ed.svg") center / contain no-repeat;
    mask: url("/assets/img/tw-crest-white.c6ef6f60ed.svg") center / contain no-repeat;
  }
}

/* The pause button for motion. It sits in the header of every page, so it
   never covers anything, and it only appears when the script is running. */
.motion-toggle {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  min-width: 2.75rem;
  min-height: 2.75rem;
  margin-left: auto;
  padding: 0 0.35rem;
  font-family: var(--font-caps);
  font-size: 0.6875rem;
  letter-spacing: 0.14em;
  line-height: 1;
  white-space: nowrap;
  text-transform: uppercase;
  color: var(--ivory);
  text-shadow: 0 0 0.5em var(--night), 0 0 0.2em var(--night);
  background: none;
  border: 0;
  border-radius: 0;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: color 0.2s var(--ease);
}

.motion-toggle:hover { color: var(--gold-pale); }

/* Drawn with borders, not backgrounds: high contrast modes remove
   backgrounds and the sign would vanish. */
.motion-icon {
  flex: none;
  width: 0.6rem;
  height: 0.75rem;
  border-right: 0.18rem solid currentColor;
  border-left: 0.18rem solid currentColor;
}

.motion-toggle[data-state="paused"] .motion-icon {
  width: 0;
  height: 0;
  border-color: transparent transparent transparent currentColor;
  border-style: solid;
  border-width: 0.4rem 0 0.4rem 0.62rem;
}

/* On a phone there is room for one word. The sign is left off there: two
   upright bars read as a numeral on a site that uses Roman numerals. */
@media (width < 40em) {
  .motion-icon { display: none; }

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

/* ---------- 4. Buttons and links ----------------------------------------- */

.button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3.25rem;
  padding: 0.5rem 1.9rem;
  font-family: var(--font-caps);
  font-size: 0.8125rem;
  letter-spacing: 0.14em;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  text-transform: uppercase;
  color: var(--ivory);
  background: none;
  border: 1px solid var(--rule-strong);
  border-radius: 0;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: color 0.25s var(--ease), background-color 0.25s var(--ease), border-color 0.25s var(--ease);
}

/* An inner hairline appears on hover, like the double ring of the crest. */
.button::after {
  content: "";
  position: absolute;
  inset: 3px;
  border: 1px solid transparent;
  pointer-events: none;
  transition: border-color 0.25s var(--ease);
}

.button:hover {
  color: var(--gold-pale);
  border-color: var(--gold);
}

.button:hover::after,
.button[aria-current="page"]::after {
  border-color: var(--rule-strong);
}

.button-primary {
  font-size: 0.9375rem;
  letter-spacing: 0.12em;
  color: var(--ink);
  background: var(--gold);
  border-color: var(--gold);
}

.button-primary:hover {
  color: var(--ink);
  background: var(--gold-pale);
  border-color: var(--gold-pale);
}

.button-primary:hover::after { border-color: rgb(10 24 54 / 0.45); }

.button-small {
  min-height: 2.75rem;
  padding-inline: 1.35rem;
  font-size: 0.75rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 2rem;
}

/* Links inside running text. */
.text-link,
.prose a {
  color: var(--gold-pale);
  text-decoration-color: var(--rule-strong);
  transition: text-decoration-color 0.2s var(--ease);
}

.text-link:hover,
.prose a:hover {
  text-decoration-color: currentColor;
}

/* A link that leads on to another page. */
.more {
  display: inline-block;
  padding-block: 0.6rem;
  font-family: var(--font-caps);
  font-size: 0.8125rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration-color: var(--gold);
  text-underline-offset: 0.5em;
  transition: color 0.2s var(--ease);
}

.more:hover { color: var(--gold-pale); }

/* ---------- 5. Header and menu ------------------------------------------- */

/* Three levels, each a step up from the last:
   a. Any browser: the header sits at the top of the page and the links are a
      plain row under or beside the logo.
   b. Wide screens: the header stays in view while scrolling.
   c. Browsers with popovers, on narrow screens: the links move into a menu
      that opens from a button, and the header stays in view. */

.site-header {
  position: relative;
  z-index: 40;
  border-bottom: 1px solid transparent;
  transition: background-color 0.35s var(--ease), border-color 0.35s var(--ease),
    transform 0.4s var(--ease);
}

/* Clear over the top of the page, a solid ground once the page has moved. */
.site-header[data-scrolled] {
  background: rgb(5 11 25 / 0.96);
  border-bottom-color: var(--rule);
}

/* The script slides the header away while reading down the page and brings it
   back on the way up, or the moment the keyboard moves into it. */
.site-header[data-away] {
  transform: translateY(-102%);
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem 1.5rem;
  min-height: var(--header-h);
  padding-top: 0.5rem;
}

.brand {
  display: inline-flex;
  flex: none;
}

.brand img { width: 11.25rem; }

.nav-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 1.75rem;
  margin: 0;
  padding: 0 0 0.75rem;
  list-style: none;
}

.nav-link {
  position: relative;
  display: inline-block;
  padding: 0.85rem 0;
  font-family: var(--font-caps);
  font-size: 0.8125rem;
  letter-spacing: 0.14em;
  line-height: 1.2;
  text-decoration: none;
  text-transform: uppercase;
  color: var(--ivory);
  /* keeps the links clear of the engraving where the header lies over it */
  text-shadow: 0 0 0.5em var(--night), 0 0 0.2em var(--night);
}

.nav-link::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0.5rem;
  left: 0;
  height: 0;
  border-top: 1px solid var(--gold);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.35s var(--ease);
}

.nav-link:hover::after,
.nav-link[aria-current="page"]::after {
  transform: scaleX(1);
}

.menu-button,
.menu-extra {
  display: none;
}

/* b. Wide screens. The nav carries the popover attribute for the phone menu,
      so the browser's popover styles are undone here and it is shown in place. */
@media (min-width: 60em) {
  .site-header {
    position: sticky;
    top: 0;
  }

  .header-inner {
    flex-wrap: nowrap;
    padding-top: 0;
  }

  .brand img { width: 12.5rem; }

  .motion-toggle {
    order: 3;
    margin-left: 1.5rem;
  }

  .site-nav {
    position: static;
    inset: auto;
    order: 2;
    display: block;
    width: auto;
    height: auto;
    margin: 0 0 0 auto;
    padding: 0;
    overflow: visible;
    color: inherit;
    background: none;
    border: 0;
  }

  .nav-list {
    justify-content: flex-end;
    gap: 0 2.5rem;
    padding: 0;
  }
}

/* Between the phone menu and a full-width header there is less room: the
   links sit closer together and the pause button shows one word. */
@media (min-width: 60em) and (width < 72em) {
  .nav-list { gap: 0 1.5rem; }

  .motion-toggle { margin-left: 0.5rem; }

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

/* c. Narrow screens, in browsers with popovers. */
@supports selector(:popover-open) {
  /* If the menu was open when the window grew to desktop width and the script
     was not there to close it, the browser keeps it floating until the next
     click. This keeps it where the row of links belongs in the meantime. */
  @media (min-width: 60em) {
    .site-nav:popover-open {
      top: calc((var(--header-h) - 2.75rem) / 2);
      right: max(var(--gutter), calc((100vw - var(--container)) / 2 + var(--gutter)));
      left: auto;
    }
  }

  @media (width < 60em) {
    .site-header {
      position: sticky;
      top: 0;
    }

    .header-inner {
      flex-wrap: nowrap;
      padding-top: 0;
    }

    .menu-button {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 0.75rem;
      min-width: 2.75rem;
      min-height: 2.75rem;
      margin-right: -0.25rem;
      padding: 0.5rem 0.25rem;
      font-family: var(--font-caps);
      font-size: 0.8125rem;
      letter-spacing: 0.14em;
      text-transform: uppercase;
      color: var(--ivory);
      background: none;
      border: 0;
      border-radius: 0;
      cursor: pointer;
      -webkit-appearance: none;
      appearance: none;
    }

    .menu-icon {
      position: relative;
      display: block;
      flex: none;
      width: 1.5rem;
      height: 0.75rem;
    }

    /* Drawn with borders, not backgrounds: high contrast modes remove
       backgrounds and the icon would vanish. */
    .menu-icon::before,
    .menu-icon::after {
      content: "";
      position: absolute;
      left: 0;
      width: 100%;
      height: 0;
      border-top: 1.5px solid currentColor;
      transition: transform 0.3s var(--ease), top 0.3s var(--ease), bottom 0.3s var(--ease);
    }

    .menu-icon::before { top: 0; }
    .menu-icon::after { bottom: 0; }

    .site-header:has(.site-nav:popover-open) .menu-icon::before {
      top: calc(50% - 0.75px);
      transform: rotate(45deg);
    }

    .site-header:has(.site-nav:popover-open) .menu-icon::after {
      bottom: calc(50% - 0.75px);
      transform: rotate(-45deg);
    }

    /* While the menu is open the button shows only the X. The word stays in
       place for screen readers, which announce it as an expanded Menu button. */
    .site-header:has(.site-nav:popover-open) .menu-label {
      position: absolute;
      width: 1px;
      height: 1px;
      margin: -1px;
      overflow: hidden;
      clip: rect(0 0 0 0);
      clip-path: inset(50%);
      white-space: nowrap;
    }

    .site-nav {
      position: fixed;
      top: var(--header-h);
      right: 0;
      bottom: 0;
      left: 0;
      width: auto;
      max-width: none;
      height: auto;
      max-height: none;
      margin: 0;
      padding: 1rem var(--gutter) 2rem;
      overflow-y: auto;
      overscroll-behavior: contain;
      color: var(--ivory);
      background: var(--night);
      border: 0;
      opacity: 0;
      transition: opacity 0.3s var(--ease), display 0.3s allow-discrete,
        overlay 0.3s allow-discrete;
    }

    .site-nav:popover-open {
      display: flex;
      flex-direction: column;
      opacity: 1;
    }

    @starting-style {
      .site-nav:popover-open { opacity: 0; }
    }

    .site-nav::backdrop { background: transparent; }

    .nav-list {
      flex-direction: column;
      flex-wrap: nowrap;
      align-items: stretch;
      gap: 0;
      padding: 0;
    }

    /* In the menu the links are set large, in the display face. */
    .nav-link {
      display: block;
      padding: 1.05rem 0 1.15rem;
      font-family: var(--font-display);
      font-size: 3.25rem;
      font-weight: 300;
      letter-spacing: 0;
      line-height: 1;
      text-shadow: none;
      text-transform: none;
      border-bottom: 1px solid var(--rule);
    }

    .nav-link::after { display: none; }

    /* A heavier rule, not only a different color, marks the current page. */
    .nav-link[aria-current="page"] {
      border-bottom: 3px solid var(--gold);
    }

    .nav-item-cta { margin-top: 2rem; }

    .nav-item-cta .button {
      width: 100%;
      min-height: 3.5rem;
      color: var(--ink);
      background: var(--gold);
      border-color: var(--gold);
    }

    .nav-item-cta .button[aria-current="page"]::after {
      border-color: rgb(10 24 54 / 0.5);
    }

    .menu-extra {
      display: block;
      margin-top: auto;
      padding-top: 2.5rem;
      font-size: 1.0625rem;
      color: var(--ivory-soft);
    }

    .menu-extra .label { margin-bottom: 0.5rem; }

    .menu-extra a { color: var(--ivory); }

    /* While the menu is open: the page cannot scroll, the header stays put on
       a solid ground, and everything the menu covers is out of reach for
       keyboards and screen readers. None of this needs script. */
    html:has(.site-nav:popover-open) { overflow: hidden; }

    .site-header:has(.site-nav:popover-open) {
      background: var(--night);
      transform: none;
    }

    html:has(.site-nav:popover-open) main,
    html:has(.site-nav:popover-open) .site-footer,
    html:has(.site-nav:popover-open) .motion-toggle,
    html:has(.site-nav:popover-open) .skip-link {
      visibility: hidden;
    }
  }

  /* On phones the logo needs the room, so the word "Menu" is kept for screen
     readers and only the icon is shown. */
  @media (width < 22.5em) {
    .brand img { width: 10rem; }
  }

  @media (width < 26em) {
    .header-inner { column-gap: 0.5rem; }


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

  @supports (padding: max(0px, env(safe-area-inset-left))) {
    @media (width < 60em) {
      .site-nav {
        padding-right: max(var(--gutter), env(safe-area-inset-right));
        padding-bottom: max(2rem, env(safe-area-inset-bottom));
        padding-left: max(var(--gutter), env(safe-area-inset-left));
      }
    }
  }
}

/* ---------- 6. Home: the seal and the record ------------------------------ */

/* The first screen. The header lies over the top of it. The engraving is
   drawn on the canvas (lathe.js), centred on the seal, and is faded where it
   runs under the words. */
.hero {
  --seal-x: 50%;
  --seal-y: calc(var(--header-h) + 37vw);
  --seal: 138vw;

  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 100vh;
  min-height: 100svh;
  margin-top: calc(var(--header-h) * -1);
  padding-top: calc(var(--header-h) + 78vw);
  overflow: hidden;
  overflow: clip;
  background:
    radial-gradient(circle at var(--seal-x) var(--seal-y), var(--night-glow) 0, #0B1934 calc(var(--seal) * 0.2), rgb(5 11 25 / 0) calc(var(--seal) * 0.5)),
    linear-gradient(180deg, #060D1D 0%, var(--night) 55%);
}

.lathe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.6s var(--ease);
}

[data-lathe-ready] > .lathe { opacity: 1; }

.hero .lathe {
  z-index: -1;
  -webkit-mask-image: linear-gradient(180deg, rgb(0 0 0 / 0.35) 0, #000 calc(var(--header-h) + 1rem), #000 calc(var(--header-h) + 54vw), rgb(0 0 0 / 0.18) calc(var(--header-h) + 82vw), transparent 100%);
  mask-image: linear-gradient(180deg, rgb(0 0 0 / 0.35) 0, #000 calc(var(--header-h) + 1rem), #000 calc(var(--header-h) + 54vw), rgb(0 0 0 / 0.18) calc(var(--header-h) + 82vw), transparent 100%);
}

.hero-seal {
  position: absolute;
  top: var(--seal-y);
  left: var(--seal-x);
  z-index: -1;
  display: grid;
  place-items: center;
  width: var(--seal);
  height: var(--seal);
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.hero-seal .crest-gold {
  width: 26.5%;
  filter: drop-shadow(0 0 1.6rem rgb(216 184 120 / 0.3));
}

/* The still engraving: shown when there is no script, or when the live one
   cannot be drawn on this device. */
.hero-seal::before {
  content: "";
  position: absolute;
  inset: 3%;
  background: var(--gold);
  opacity: 0.55;
  -webkit-mask: url("/assets/img/rosette.01332e1569.svg") center / contain no-repeat;
  mask: url("/assets/img/rosette.01332e1569.svg") center / contain no-repeat;
}

html.js:not(.js-broken) .hero:not([data-lathe-failed]) .hero-seal::before { display: none; }

.hero-inner {
  padding-bottom: clamp(2.5rem, 7vh, 4.5rem);
}

.hero-title {
  font-size: clamp(5.75rem, 25.5vw, 8.5rem);
  line-height: 0.84;
  letter-spacing: -0.012em;
  white-space: nowrap;
}

.hero-line { display: block; }

/* A soft shadow in the colour of the ground keeps the paragraph clear of any
   line of the engraving that runs behind it. */
.hero-lede {
  max-width: 31rem;
  margin-top: 1.5rem;
  text-shadow: 0 0 0.35em var(--night), 0 0 0.12em var(--night);
  font-size: clamp(1.1875rem, 1rem + 0.55vw, 1.4375rem);
  line-height: 1.5;
}

.hero .actions { margin-top: 2rem; }

/* Wide screens, and phones and small tablets held sideways: the words and the
   seal sit side by side. */
@media (min-width: 60em), (min-width: 40em) and (min-aspect-ratio: 4/3) {
  .hero {
    --seal-x: 71%;
    --seal-y: 49%;
    --seal: min(122vh, 94vw);

    padding-top: calc(var(--header-h) + 2rem);
  }

  .hero .lathe {
    -webkit-mask-image: linear-gradient(90deg, rgb(0 0 0 / 0.1) 0%, rgb(0 0 0 / 0.16) 40%, #000 64%), linear-gradient(180deg, rgb(0 0 0 / 0.3) 0, #000 8rem, #000 calc(100% - min(14rem, 22vh)), transparent 100%);
    -webkit-mask-composite: source-in;
    mask-image: linear-gradient(90deg, rgb(0 0 0 / 0.1) 0%, rgb(0 0 0 / 0.16) 40%, #000 64%), linear-gradient(180deg, rgb(0 0 0 / 0.3) 0, #000 8rem, #000 calc(100% - min(14rem, 22vh)), transparent 100%);
    mask-composite: intersect;
  }

  .hero-title { font-size: clamp(5.75rem, min(16vw, 27vh), 14.375rem); }

  /* The paragraph stops short of the crest, however short the screen. */
  .hero-lede { max-width: min(31rem, 42vw); }
}

/* The record: one statement, set large. With script it inks itself in word by
   word as it is read (site.js sets --p from 0 to 1, and each word knows its
   place in the line). Words still to come stay near four to one against the
   ground, comfortably above what large text needs. Without script it is simply
   there. */
.record {
  padding-block: clamp(6rem, 18vh, 13rem);
}

.record-text {
  max-width: 21em;
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 1.2rem + 5.2vw, 6.25rem);
  font-weight: 300;
  line-height: 1.02;
  text-wrap: pretty;
}

.ink-word {
  opacity: clamp(0.45, calc((var(--p, 1) * (var(--n, 1) + 6) - var(--i, 0)) / 3), 1);
}

.record-more { margin-top: clamp(2rem, 5vh, 3.5rem); }

/* ---------- 7. Home: principles ------------------------------------------- */

.principles-section {
  padding-block: clamp(5rem, 12vh, 9rem) clamp(2rem, 6vh, 5rem);
}

.section-title {
  font-size: clamp(3.25rem, 1.4rem + 7.4vw, 8.125rem);
  line-height: 0.9;
}

.principles {
  position: relative;
  margin-top: clamp(2rem, 6vh, 4.5rem);
}

/* The emblem. With script it is drawn live and recut for each principle. On a
   narrow screen it rides in a band at the top of the screen while the
   principles pass beneath it. On a wide screen it sits beside them. Without
   script, or where it cannot be drawn, it is left out and each principle
   shows its own numeral. */
.emblem {
  display: none;
  pointer-events: none;
}

html.js .emblem {
  position: sticky;
  top: 0;
  z-index: 2;
  display: block;
  margin-inline: calc(var(--gutter) * -1);
  padding-block: calc(var(--header-h) + 0.5rem) 2.25rem;
  background: linear-gradient(180deg, var(--night) 0, var(--night) 78%, rgb(5 11 25 / 0) 100%);
}

html.js .emblem[data-lathe-failed] { display: none; }

.emblem .lathe { max-width: none; }

.emblem-anchor {
  position: relative;
  display: grid;
  place-items: center;
  width: min(46vw, 11.5rem);
  aspect-ratio: 1;
  margin-inline: auto;
}

.emblem-numeral {
  display: grid;
  font-family: var(--font-caps);
  font-size: clamp(1.5rem, 5vw, 4.75rem);
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--gold-pale);
}

.emblem-numeral span {
  grid-area: 1 / 1;
  text-align: center;
  opacity: 0;
  transition: opacity 0.5s var(--ease);
}

.principles:not([data-active]) .emblem-numeral span:first-child,
.principles[data-active="0"] .emblem-numeral span:nth-child(1),
.principles[data-active="1"] .emblem-numeral span:nth-child(2),
.principles[data-active="2"] .emblem-numeral span:nth-child(3),
.principles[data-active="3"] .emblem-numeral span:nth-child(4) {
  opacity: 1;
}

.articles {
  position: relative;
  z-index: 1;
  margin: 0;
  padding: 0;
  list-style: none;
}

.article {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-block: 2.5rem;
}

html.js .article { min-height: 56vh; min-height: 56svh; }

.numeral {
  font-family: var(--font-caps);
  font-size: 1.125rem;
  letter-spacing: 0.16em;
  color: var(--gold);
}

/* Once the emblem is showing it carries the numeral. The numeral beside the
   principle keeps its space, so nothing moves when that happens. */
.principles:has(.emblem[data-lathe-ready]) .numeral { visibility: hidden; }

.article h3 {
  margin-top: 0.75rem;
  font-size: clamp(3.5rem, 1.9rem + 6.6vw, 8.125rem);
  line-height: 0.9;
}

.article p {
  max-width: 27em;
  margin-top: 1.25rem;
  font-size: clamp(1.1875rem, 1rem + 0.6vw, 1.5rem);
  line-height: 1.5;
}

/* A short, narrow screen has no room for the band. */
@media (max-height: 34rem) and (width < 60em) {
  html.js .emblem { display: none; }
}

@media (min-width: 60em) {
  html.js .principles {
    display: grid;
    grid-template-columns: minmax(0, 0.92fr) minmax(0, 1fr);
    align-items: start;
    gap: clamp(3rem, 7vw, 8rem);
  }

  html.js .emblem {
    top: calc(50vh - min(21vw, 36vh));
    z-index: 0;
    width: min(42vw, 72vh);
    aspect-ratio: 1;
    margin: 0;
    padding: 0;
    justify-self: center;
    background: none;
  }

  .emblem .lathe {
    inset: -4%;
    width: 108%;
    height: 108%;
  }

  .emblem-anchor {
    position: absolute;
    inset: 0;
    width: auto;
    aspect-ratio: auto;
    margin: 0;
  }

  html.js .article { min-height: 52vh; }

  /* The principle in the middle of the screen is lit. The others wait. */
  html.js .principles[data-active] .article {
    opacity: 0.5;
    transition: opacity 0.5s var(--ease);
  }

  html.js .principles[data-active] .article[data-current] { opacity: 1; }
}

/* ---------- 8. Home: what we do -------------------------------------------- */

/* The one solid field of gold on the site, with the type in ink: the register
   of the company's lines of work. A strip of engine turning runs along its
   top and bottom edges. */
.works {
  position: relative;
  padding-block: clamp(7rem, 16vh, 12rem);
  color: var(--ink);
  background: linear-gradient(112deg, #C5A057 0%, #DCC188 28%, #EAD6A4 46%, #D5B676 64%, #BF9A50 100%);
}

.works::before,
.works::after {
  content: "";
  position: absolute;
  right: 0;
  left: 0;
  height: 2.5rem;
  background: var(--ink);
  opacity: 0.85;
  -webkit-mask: url("/assets/img/ribbon.54526ede89.svg") left center / auto 100% repeat-x;
  mask: url("/assets/img/ribbon.54526ede89.svg") left center / auto 100% repeat-x;
}

.works::before { top: 1.25rem; }
.works::after { bottom: 1.25rem; }

.works :focus-visible { outline-color: var(--ink); }

.works ::selection {
  color: var(--gold-pale);
  background: var(--ink);
}

.works-inner {
  display: grid;
  gap: clamp(2.5rem, 6vh, 4rem) clamp(3rem, 7vw, 8rem);
}

.works .lede {
  max-width: 24rem;
  margin-top: 1.5rem;
}

.register {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 2px solid var(--ink);
}

.entry {
  display: grid;
  grid-template-columns: 3rem minmax(0, 1fr);
  gap: 0 1rem;
  padding-block: 1.4rem 1.6rem;
  border-bottom: 1px solid rgb(10 24 54 / 0.4);
}

.entry-no {
  padding-top: 0.7rem;
  font-family: var(--font-caps);
  font-size: 1.125rem;
}

.entry h3 {
  font-size: clamp(2.25rem, 1.6rem + 2.6vw, 3.75rem);
  line-height: 1;
}

.entry p {
  max-width: 36rem;
  margin-top: 0.6rem;
  font-size: clamp(1.0625rem, 1rem + 0.3vw, 1.25rem);
  line-height: 1.5;
}

@media (min-width: 60em) {
  .works-inner {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    align-items: start;
  }

  /* The heading stays beside the register while it is read. */
  .works header {
    position: sticky;
    top: calc(var(--header-h) + 2.5rem);
  }
}

/* ---------- 9. Writing to us ---------------------------------------------- */

.invite {
  padding-block: clamp(6rem, 16vh, 12rem);
}

.invite h2 {
  font-size: clamp(2.5rem, 1.8rem + 2.8vw, 4.5rem);
}

.invite-note {
  max-width: 30rem;
  margin-top: 1.25rem;
  color: var(--ivory-soft);
}

.email-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.5rem 2rem;
}

.invite .email-line { margin-top: clamp(2rem, 6vh, 4rem); }

/* The address, set as large as the screen allows. It may break after the @
   sign and nowhere else. */
.email {
  font-family: var(--font-display);
  font-size: clamp(2.25rem, 0.6rem + 10vw, 8.75rem);
  font-weight: 300;
  line-height: 0.92;
  text-decoration: none;
  color: var(--ivory);
  background: linear-gradient(var(--gold), var(--gold)) left bottom / 0 1px no-repeat;
  transition: color 0.3s var(--ease), background-size 0.5s var(--ease);
}

.email:hover {
  color: var(--gold-pale);
  background-size: 100% 1px;
}

/* ---------- 10. Inner pages ----------------------------------------------- */

.page-hero {
  position: relative;
  margin-top: calc(var(--header-h) * -1);
  padding-block: calc(var(--header-h) + clamp(3.5rem, 11vh, 7.5rem)) clamp(5.5rem, 12vh, 8rem);
  overflow: hidden;
  overflow: clip;
  background: radial-gradient(70rem 34rem at 88% -10%, var(--night-glow) 0, rgb(5 11 25 / 0) 70%);
}

/* On wide screens the still engraving stands half off the right edge. */
@media (min-width: 60em) {
  .page-hero::before {
    content: "";
    position: absolute;
    top: 50%;
    right: max(-17rem, -19vw);
    width: min(34rem, 38vw);
    aspect-ratio: 1;
    background: var(--gold);
    opacity: 0.32;
    transform: translateY(-50%);
    -webkit-mask: url("/assets/img/rosette.01332e1569.svg") center / contain no-repeat;
    mask: url("/assets/img/rosette.01332e1569.svg") center / contain no-repeat;
  }
}

/* A strip of engine turning closes the top of every inner page. */
.page-hero::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 2.5rem;
  background: linear-gradient(90deg, var(--gold-deep) 0%, var(--gold-pale) 22%, var(--gold-deep) 48%, var(--gold) 74%, var(--gold-deep) 100%);
  opacity: 0.75;
  -webkit-mask: url("/assets/img/ribbon.54526ede89.svg") left center / auto 100% repeat-x;
  mask: url("/assets/img/ribbon.54526ede89.svg") left center / auto 100% repeat-x;
}

.page-hero h1 {
  position: relative;
  font-size: clamp(3.75rem, 1.9rem + 7.6vw, 9.25rem);
  line-height: 0.88;
}

.page-hero .lede {
  max-width: 36rem;
  margin-top: 1.75rem;
}

.page-body {
  padding-block: clamp(3.5rem, 9vh, 6.5rem) clamp(5rem, 12vh, 9rem);
}

.stack > * + * { margin-top: clamp(4rem, 10vh, 7.5rem); }

.split {
  display: grid;
  gap: 1.75rem clamp(3rem, 7vw, 8rem);
}

@media (min-width: 60em) {
  .split { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
}

.section-head h2 {
  font-size: clamp(2.5rem, 1.7rem + 3.2vw, 5rem);
  line-height: 0.94;
}

.prose {
  max-width: 42rem;
}

.prose > * + * { margin-top: 1.1em; }

.prose h2 {
  margin-top: 1.9em;
  font-size: clamp(2rem, 1.7rem + 1.2vw, 2.75rem);
  font-weight: 400;
  line-height: 1;
}

.prose h2 + * { margin-top: 0.7em; }

.prose ul {
  padding-left: 1.2em;
}

.prose li + li { margin-top: 0.5em; }

.prose li::marker { color: var(--gold); }

.updated {
  font-family: var(--font-caps);
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ivory-soft);
}

/* Company details as a ruled list. */
.details > div {
  display: grid;
  grid-template-columns: minmax(0, 11rem) minmax(0, 1fr);
  gap: 0.25rem 1.5rem;
  padding-block: 1.05rem;
  border-top: 1px solid var(--rule);
}

.details > div:last-child { border-bottom: 1px solid var(--rule); }

.details dt {
  padding-top: 0.3rem;
  font-family: var(--font-caps);
  font-size: 0.6875rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ivory-soft);
}

.details dd { margin: 0; }

@media (width < 30em) {
  .details > div { grid-template-columns: minmax(0, 1fr); }
}

/* The crest, shown large. */
.crest-figure .crest-gold {
  width: min(100%, 26rem);
}

.crest-figure figcaption {
  max-width: 26rem;
  margin-top: 1.75rem;
  color: var(--ivory-soft);
}

/* Contact page: the address and what helps. */
.contact-card {
  padding-bottom: clamp(3rem, 8vh, 5rem);
  border-bottom: 1px solid var(--rule);
}

.note {
  max-width: 34rem;
  margin-top: 1.75rem;
  font-size: 1.0625rem;
  color: var(--ivory-soft);
}

.columns {
  display: grid;
  gap: 3rem clamp(2.5rem, 5vw, 5rem);
  margin-top: clamp(3rem, 8vh, 5rem);
}

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

.columns h2 {
  font-size: clamp(2rem, 1.7rem + 1.2vw, 2.75rem);
  font-weight: 400;
  line-height: 1;
}

.columns h2 + * { margin-top: 1rem; }

.columns p + ul,
.columns ul + p { margin-top: 0.9rem; }

.columns ul { padding-left: 1.2em; }

.columns li + li { margin-top: 0.45em; }

.columns li::marker { color: var(--gold); }

/* 404 */
.lost {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 62vh;
  min-height: 62svh;
  padding-block: clamp(4rem, 12vh, 8rem);
}

.lost h1 {
  margin-top: 1rem;
  font-size: clamp(3.75rem, 1.9rem + 7.6vw, 9.25rem);
  line-height: 0.88;
}

.lost .lede {
  max-width: 34rem;
  margin-top: 1.75rem;
}

.lost .actions { margin-top: 2.5rem; }

/* ---------- 11. Footer ---------------------------------------------------- */

.site-footer {
  position: relative;
  overflow: hidden;
  overflow: clip;
  padding-block: clamp(3.5rem, 9vh, 6rem) 5.5rem;
  background: var(--night-deep);
  border-top: 1px solid var(--rule);
}

/* The name once more, across the full width, in foil. */
.footer-word {
  font-family: var(--font-caps);
  /* The box is as wide as the words, so the foil always covers every letter,
     and the size leaves room to spare at every width. */
  width: -moz-fit-content;
  width: fit-content;
  font-size: min(calc((100vw - 2 * var(--gutter)) / 14), 6.25rem);
  letter-spacing: 0.04em;
  line-height: 1;
  white-space: nowrap;
  text-transform: uppercase;
  color: var(--gold);
}

@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .footer-word {
    color: transparent;
    background: var(--foil);
    -webkit-background-clip: text;
    background-clip: text;
  }
}

.footer-grid {
  display: grid;
  gap: 3rem clamp(3rem, 7vw, 8rem);
  margin-top: clamp(2.5rem, 7vh, 4.5rem);
}

.colophon {
  max-width: 26rem;
  color: var(--ivory-soft);
}

.footer-cols {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, auto));
  justify-content: start;
  gap: 2.5rem 4rem;
}

.footer-contact { grid-column: 1 / -1; }

.footer-h {
  margin-bottom: 0.9rem;
  font-family: var(--font-caps);
  font-size: 0.6875rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
}

.site-footer ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-footer li + li { margin-top: 0.15rem; }

.site-footer li a,
.footer-legal a {
  display: inline-block;
  padding-block: 0.4rem;
  text-decoration: none;
}

.site-footer li a:hover,
.footer-legal a:hover {
  color: var(--gold-pale);
  text-decoration: underline;
}

/* An email address is never broken in the middle of a word. */
.footer-contact a { overflow-wrap: normal; }

.footer-legal {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  margin-top: clamp(3rem, 8vh, 5rem);
  padding-top: 1.5rem;
  font-size: 1rem;
  color: var(--ivory-soft);
  border-top: 1px solid var(--rule);
}

@media (min-width: 40em) {
  .footer-grid { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
}

@media (min-width: 75em) {
  .footer-cols {
    grid-template-columns: repeat(3, minmax(0, auto));
    justify-content: space-between;
  }

  .footer-contact { grid-column: auto; }
}

/* Whose trademarks are named on the site. */
.footer-marks {
  max-width: 44rem;
  margin-top: 1.25rem;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--ivory-soft);
}

/* ---------- 12. Motion ---------------------------------------------------- */

/* One opening sequence, on the home page: the words settle, the crest comes
   up, and the engraving is cut round it (that last part is lathe.js). The
   heading starts visible and only settles into place, so the page is readable
   from the first frame. Nothing else on the site animates on its own. */
@media (prefers-reduced-motion: no-preference) {
  html:not([data-motion="off"]) .hero-line {
    animation: settle 1.15s var(--ease-out) both;
  }

  html:not([data-motion="off"]) .hero-line + .hero-line { animation-delay: 0.09s; }

  html:not([data-motion="off"]) .hero-lede,
  html:not([data-motion="off"]) .hero .actions {
    animation: arrive 1.1s 0.35s var(--ease-out) both;
  }

  html:not([data-motion="off"]) .hero .actions { animation-delay: 0.45s; }

  html:not([data-motion="off"]) .hero-seal .crest-gold {
    animation: strike 1.8s var(--ease-out) both;
  }

  /* The foil catches the light now and then. This one keeps going, so it only
     runs where the pause button exists to stop it. */
  html.js:not([data-motion="off"]) .hero-seal .crest-gold::after {
    animation: sheen 11s 3.2s ease-in-out infinite;
  }

  @view-transition { navigation: auto; }

  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation-duration: 0.4s;
  }
}

html.js[data-motion="on"] .hero-seal .crest-gold::after {
  animation: sheen 11s 3.2s ease-in-out infinite;
}

@keyframes settle {
  from { opacity: 0.2; transform: translateY(0.26em); }
  to { opacity: 1; transform: none; }
}

@keyframes arrive {
  from { opacity: 0; transform: translateY(0.9rem); }
  to { opacity: 1; transform: none; }
}

@keyframes strike {
  from { opacity: 0.15; transform: scale(0.94); }
  to { opacity: 1; transform: none; }
}

@keyframes sheen {
  0%, 70%, 100% { background-position: 30% 30%; }
  85% { background-position: 80% 80%; }
}

/* ---------- 13. Special display modes ------------------------------------- */

@media (prefers-contrast: more) {
  :root {
    --ivory-soft: #F1EADB;
    --rule: rgb(216 184 120 / 0.6);
    --rule-strong: rgb(216 184 120 / 0.9);
  }

  .ink-word,
  html.js .principles[data-active] .article {
    opacity: 1;
  }
}

/* Windows High Contrast and similar. Backgrounds are stripped there, so the
   art that is cut out of a background is left out and the plain crest image
   takes its place. */
@media (forced-colors: active) {
  body::after,
  .lathe,
  .hero-seal::before,
  .crest-gold::after,
  .works::before,
  .works::after,
  .page-hero::before,
  .page-hero::after {
    display: none;
  }

  .crest-gold img { opacity: 1; }

  /* The logo and the crest are white artwork, so they keep a dark ground. */
  .brand,
  .crest-gold {
    forced-color-adjust: none;
    background: #050B19;
  }

  .brand { padding: 0.2rem 0.5rem; }

  .crest-gold { border-radius: 50%; }

  .hero-seal .crest-gold { filter: none; }

  /* These modes paint a plate behind every line of text. Lines set tighter
     than their own height would cut into the line above. */
  .hero-title,
  .section-title,
  .record-text,
  .page-hero h1,
  .section-head h2,
  .article h3,
  .invite h2,
  .prose h2,
  .columns h2,
  .lost h1,
  .entry h3,
  .email {
    line-height: 1.1;
  }

  .footer-word {
    color: CanvasText;
    background: none;
  }

  .ink-word,
  html.js .principles[data-active] .article {
    opacity: 1;
  }

  .button,
  .motion-toggle { border-color: ButtonText; }

}

@media print {
  :root { color-scheme: light; }

  /* The soft shadows that keep words clear of the engraving would print as a
     dark halo on white paper. */
  *,
  *::before,
  *::after {
    text-shadow: none !important;
  }

  html,
  body {
    color: #000;
    background: #fff;
  }

  body { font-size: 11pt; }

  body::after,
  .skip-link,
  .motion-toggle,
  .menu-button,
  .site-nav,
  .lathe,
  .hero-seal,
  .emblem,
  .footer-word,
  .footer-cols,
  .works::before,
  .works::after,
  .page-hero::after,
  [data-copy] {
    display: none !important;
  }

  .site-header,
  .hero,
  .page-hero,
  .works,
  .site-footer {
    position: static;
    min-height: 0;
    margin-top: 0;
    padding-block: 1rem;
    color: #000;
    background: none;
    border: 0;
  }

  .brand img { filter: invert(1); }

  /* Printers leave backgrounds out, so the foil crest would print blank. */
  .crest-gold::after,
  .page-hero::before {
    display: none !important;
  }

  .crest-gold img {
    opacity: 1;
    filter: invert(1);
  }

  .record,
  .principles-section,
  .invite,
  .page-body {
    padding-block: 1rem;
  }

  .article { min-height: 0 !important; opacity: 1 !important; }

  .ink-word { opacity: 1; }

  .label,
  .numeral,
  .lede,
  .colophon,
  .invite-note,
  .note,
  .updated,
  .details dt,
  .footer-legal,
  .email,
  .text-link,
  .prose a {
    color: #000;
  }

  .hero-title,
  .section-title,
  .page-hero h1,
  .article h3,
  .record-text,
  .email {
    font-size: 26pt;
    line-height: 1.05;
  }

  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 9pt;
  }
}
