/*
 * Written by fonts.ts; edit that, not this. Every face is served from this
 * site (font-src 'self'). The CJK faces hold only: 中文日本語
 */

@font-face {
  font-family: "Archivo";
  font-style: italic;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
  src: url("/assets/fonts/archivo-italic-100-900-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Archivo";
  font-style: italic;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
  src: url("/assets/fonts/archivo-italic-100-900-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
  src: url("/assets/fonts/archivo-normal-100-900-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
  src: url("/assets/fonts/archivo-normal-100-900-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Noto Sans SC";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("/assets/fonts/noto-sans-sc-normal-800-text.woff2") format("woff2");
  unicode-range: U+4e2d, U+6587, U+65e5, U+672c, U+8a9e;
}

@font-face {
  font-family: "Noto Sans JP";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("/assets/fonts/noto-sans-jp-normal-800-text.woff2") format("woff2");
  unicode-range: U+4e2d, U+6587, U+65e5, U+672c, U+8a9e;
}

/*
 * The plate: gold on black (DESIGN.md §2). One gold in three lights, and a
 * dim gold made from them, on a black ground, whatever the reader's system
 * prefers.
 *
 * Every colour is a token below, and src/palette.ts says the same thing as
 * data: palette.test.ts holds the two to each other, holds every pair that is
 * laid one on the other to its contrast, and fails on a colour in any
 * stylesheet that is not one of these. A tint is color-mix() of a token,
 * never a new colour.
 *
 * Each has its job: ink, the gold, is the words, the display type, the
 * magnet, a button and every picture's dots; light is the gold catching the
 * light, which is anything that can be followed, anything under the pointer,
 * where you are, the focus ring and the highlighter; muted, the deep gold,
 * says less.
 */

:root {
  --ground: #000000;
  --ink: #cdb77b;
  --light: #ede0b5;
  --muted: #8c7849;
  --line: #463c25;

  --sans: Archivo, "Helvetica Neue", Arial, sans-serif;
  --sc: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", sans-serif;
  --jp: "Noto Sans JP", "Hiragino Sans", "Yu Gothic", sans-serif;

  /* The type scale. Step 0 is body text; the titles are the page's main image. */
  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.25rem;
  --step-2: clamp(1.5rem, 1.15rem + 1.5vw, 2.25rem);
  --step-3: clamp(2rem, 1.2rem + 3.4vw, 4rem);
  --step-4: clamp(2.4rem, 0.9rem + 6.4vw, 6.75rem);
  /* As large as an eight-letter word (PROJECTS) can be and still fit the page's width, from a phone up. */
  --step-5: clamp(2.9rem, 0.15rem + 11.2vw, 10.75rem);
  /* A cap on a title that may run long, so an eleven-letter word (ACCUMULATOR) still fits a phone's width; it bites below about 640px. */
  --word: 8.4vw;

  --gutter: clamp(16px, 4.4vw, 64px);
  --wide: 1520px;
  /* Between the parts of a page: a gallery's air, which the brief's density of 3 asks for. */
  --space: clamp(88px, 6rem + 6vw, 200px);

  --ease: cubic-bezier(0.16, 1, 0.3, 1);

  /* The browser's own parts, the scrollbars and the form controls, dark to match. */
  color-scheme: dark;
}

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

html {
  background: var(--ground);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* A column a screen tall at least, so a short page (the 404) still has its footer at the foot. */
body {
  display: flex;
  flex-direction: column;
  min-height: 100svh;
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--step-0);
  font-stretch: 100%;
  line-height: 1.55;
  font-kerning: normal;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
}

body > main {
  flex: 1 0 auto;
}

/* A heading sliding in from past the edge (.slides) must never widen the page. Clip, not hidden: nothing here becomes a scroller. */
body {
  overflow-x: clip;
}

/* No double-tap zoom waiting on a tap, and a tap's flash in the light gold of things that can be pressed. */
a,
button,
input,
label,
textarea {
  touch-action: manipulation;
}

html {
  -webkit-tap-highlight-color: color-mix(in srgb, var(--light) 22%, transparent);
}

/* In the column, a box centred by its margins would shrink to its contents; these keep the page's width. */
.masthead,
.page,
.footer,
.block {
  width: 100%;
}

/*
 * The grain over everything, as a print has: noise from an SVG filter, on a
 * layer fixed to the screen so nothing repaints it as the page scrolls. The
 * noise is a mask over a layer of the gold, so the specks are the palette's
 * own colour, warm on the black rather than a grey static over it. No blend
 * mode, which would repaint; just the specks, at a low alpha.
 */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  background: var(--ink);
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -2.2 1.35'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -2.2 1.35'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.08;
}

:lang(zh-Hans) {
  font-family: var(--sc);
}

:lang(ja) {
  font-family: var(--jp);
}

::selection {
  background: var(--light);
  color: var(--ground);
}

a {
  color: inherit;
  text-decoration: none;
}

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

cite {
  font-style: italic;
}

/* The highlighter: a block of the light gold behind the words, which are knocked out of it. */
mark {
  padding: 0.05em 0.3em;
  background: var(--light);
  color: var(--ground);
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

/* A picture's width and height attributes hold its frame's shape; its height then follows its width. */
img {
  display: block;
  max-width: 100%;
  height: auto;
}

p,
ul,
ol,
h1,
h2,
h3,
figure {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

h1,
h2,
h3 {
  font-weight: inherit;
}

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

.skip {
  position: absolute;
  z-index: 11;
  left: 16px;
  top: -100px;
  padding: 10px 14px;
  background: var(--ink);
  color: var(--ground);
  font-weight: 700;
}

.skip:focus {
  top: 16px;
}

/* --- Display type --------------------------------------------------------- */

/*
 * The one heading style, at three sizes: Archivo stretched to its widest and
 * heaviest, capitals, set solid. Tracking a hair tight, so the letters lock
 * into a block, and leading under one, which no descender in capitals needs.
 */
.title,
.heading,
.magnet,
.home {
  font-stretch: 125%;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: -0.012em;
  line-height: 0.88;
  overflow-wrap: break-word;
}

/* A heading that takes two lines takes two of a length, never a long line and a lone word. */
.title,
.heading,
.feature-title,
.entry-title,
.find-title,
.shelf-subject,
.practice-name,
.summary {
  text-wrap: balance;
}

/* A page's own name: the main image of the page. */
.title {
  font-size: var(--step-5);
}

/* A title that may run long, a project's or a piece's. */
.title.is-small {
  font-size: min(var(--step-4), var(--word));
  line-height: 0.92;
}

/* A part of a page: About's Reading, Listening, and the rest. */
.heading {
  font-size: var(--step-3);
}

/* The line under a heading that says what the part is for. */
.lede {
  max-width: 30em;
  margin-top: 26px;
  font-size: var(--step-1);
  line-height: 1.45;
}

/* --- Links and buttons ---------------------------------------------------- */

/*
 * A link: the light gold, underlined in the deep, as the plate's links were.
 * Under the pointer the line takes the light and thickens.
 */
.prose a,
.lede a,
.page-under a,
.fine a,
.book-note a,
.practice-note a,
.made-note a,
.find-note a,
.track-note a,
.facts a,
.summary a,
.specs a,
.bee-note-text a {
  color: var(--light);
  text-decoration: underline;
  text-decoration-color: var(--muted);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.18em;
}

.prose a:hover,
.lede a:hover,
.page-under a:hover,
.fine a:hover,
.book-note a:hover,
.practice-note a:hover,
.made-note a:hover,
.find-note a:hover,
.track-note a:hover,
.facts a:hover,
.summary a:hover,
.specs a:hover,
.bee-note-text a:hover {
  text-decoration-color: currentColor;
  text-decoration-thickness: 4px;
}

/*
 * A button is a block of the gold, the words knocked out of it. Under the
 * pointer it lifts off the page and a block of the deep gold shows beneath,
 * as a second pass printed a little out of register; pressed, it lands back.
 * Both golds are layers under the words, so all that moves is a transform.
 */
.button {
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 22px;
  border: 0;
  background: none;
  color: var(--ground);
  font: inherit;
  font-size: 1.1875rem;
  font-weight: 700;
  line-height: 1.1;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 180ms var(--ease);
}

.button::before,
.button::after {
  content: "";
  position: absolute;
  inset: 0;
  transition: transform 180ms var(--ease);
}

.button::before {
  z-index: -2;
  background: var(--muted);
}

.button::after {
  z-index: -1;
  background: var(--ink);
}

.button:hover,
.button[aria-current="page"] {
  transform: translate(-3px, -3px);
}

.button:hover::before,
.button[aria-current="page"]::before {
  transform: translate(5px, 5px);
}

.button:active,
.button:active::before {
  transform: none;
  transition-duration: 60ms;
}

.button:disabled {
  cursor: progress;
  opacity: 0.6;
}

.button:disabled,
.button:disabled::before {
  transform: none;
}

/* A link that goes on to more: words and an arrow, which leans the way it goes. */
.more {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  min-height: 48px;
  color: var(--light);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: var(--muted);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.22em;
}

.more svg,
.write-block .heading svg,
.find-link svg {
  flex: none;
  width: 1em;
  height: 1em;
  transition: transform 220ms var(--ease);
}

.more:hover {
  text-decoration-color: currentColor;
  text-decoration-thickness: 4px;
}

.more:hover svg,
.write-block .heading a:hover svg {
  transform: translateX(0.22em);
}

/* The rabbit hole's arrow points up and out, to another site, and leans that way. */
.find-link:hover svg {
  transform: translate(0.15em, -0.15em);
}

/* --- The masthead --------------------------------------------------------- */

/*
 * The same on every page. On a phone, two rows: the name and Contact me,
 * then the sections and the profiles. From 900 px, one row.
 */
.masthead {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "home write"
    "sections elsewhere";
  align-items: center;
  gap: 6px 16px;
  max-width: var(--wide);
  margin: 0 auto;
  padding: max(12px, env(safe-area-inset-top)) max(var(--gutter), env(safe-area-inset-right)) 12px max(var(--gutter), env(safe-area-inset-left));
}

/* The bee, then the name. The bee overhangs the link's box a little, so the row keeps the height it had without it. */
.home {
  grid-area: home;
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 0;
  font-size: 1rem;
  line-height: 1;
}

.home .bee {
  width: 30px;
  height: 30px;
  margin: -8px 0;
}

.home:hover {
  color: var(--light);
}

.sections {
  display: flex;
  flex-wrap: wrap;
  column-gap: 20px;
  font-stretch: 80%;
  font-weight: 600;
  font-size: 1.0625rem;
}

.masthead .sections {
  grid-area: sections;
}

.sections a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.sections a:hover {
  color: var(--light);
}

/* Where you are: the section's name lit, a bar of the light gold under it. */
.sections a[aria-current="page"] {
  color: var(--light);
  text-decoration: underline;
  text-decoration-thickness: 4px;
  text-underline-offset: 0.3em;
}

.elsewhere {
  grid-area: elsewhere;
  display: flex;
  gap: 2px;
}

.elsewhere a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
}

.elsewhere a:hover {
  color: var(--light);
}

.elsewhere svg {
  width: 20px;
  height: 20px;
}

/* On a phone it shares a column with the profiles, which are wider: it ends where they do, at the page's edge. */
.masthead-write {
  grid-area: write;
  justify-self: end;
}

.masthead .button {
  min-height: 44px;
  padding: 0 16px;
  font-size: 1.0625rem;
}

@media (min-width: 900px) {
  .masthead {
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    grid-template-areas: "home sections elsewhere write";
    column-gap: 36px;
    padding-top: max(18px, env(safe-area-inset-top));
  }

  .sections {
    column-gap: 28px;
  }

  .home {
    font-size: 1.0625rem;
  }
}

/* --- The bee --------------------------------------------------------------- */

/* src/bee.ts, beside the name in the masthead and on About's note. */
.bee {
  flex: none;
  overflow: visible;
}

.bee-abdomen {
  fill: var(--light);
}

/* The ground's colour, not a hole: each wing's edge is what keeps four crossing wings apart (src/bee.ts). */
.bee-stripes {
  fill: var(--ground);
}

.bee-wings {
  fill: var(--ink);
  stroke: var(--ground);
}

.bee-body {
  fill: var(--ink);
}

.bee-antennae {
  fill: none;
  stroke: var(--ink);
}

/*
 * The wings beat a few times as the pointer arrives, then rest while it
 * stays: a count, never infinite, and an even one, so each ends where it
 * is drawn. Each sweeps forward from there, towards the head, and back:
 * never back over the abdomen, which would hide the stripes. `.bee-flap`
 * sits at its wing's hinge, so a turn is about it.
 */
.bee-flap {
  --sweep: 26deg;
}

.bee-flap.is-right {
  --sweep: -26deg;
}

@media (prefers-reduced-motion: no-preference) and (hover: hover) {
  .home:hover .bee-flap {
    animation: flap 0.09s ease-in-out 6 alternate;
  }
}

@keyframes flap {
  to {
    rotate: var(--sweep);
  }
}

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

/* On a phone, as the masthead is: the name and Contact me, then the sections and the profiles. */
.footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "rule rule"
    "name name"
    "sections elsewhere"
    "write write";
  align-items: center;
  gap: 8px 16px;
  max-width: var(--wide);
  margin: var(--space) auto 0;
  padding: 0 max(var(--gutter), env(safe-area-inset-right)) max(28px, calc(env(safe-area-inset-bottom) + 16px))
    max(var(--gutter), env(safe-area-inset-left));
}

/* A rule of the gold the width of the page: the one line the site draws across. */
.footer::before {
  content: "";
  grid-area: rule;
  display: block;
  height: 4px;
  margin-bottom: 14px;
  background: var(--ink);
}

.footer-name {
  grid-area: name;
  margin-bottom: 6px;
}

.footer .sections {
  grid-area: sections;
}

.footer-write {
  grid-area: write;
}

.footer-name a {
  font-stretch: 125%;
  font-weight: 900;
  font-size: var(--step-2);
  text-transform: uppercase;
  line-height: 1;
}

.footer-name a:hover {
  color: var(--light);
}

.footer-elsewhere {
  grid-area: elsewhere;
  display: flex;
  gap: 2px;
}

.footer-elsewhere a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
}

.footer-elsewhere a:hover {
  color: var(--light);
}

.footer-elsewhere svg {
  width: 20px;
  height: 20px;
}

.footer-write a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--light);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: var(--muted);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.22em;
}

.footer-write a:hover {
  text-decoration-color: currentColor;
  text-decoration-thickness: 4px;
}

@media (min-width: 900px) {
  .footer {
    grid-template-columns: minmax(0, 1fr) auto auto auto;
    grid-template-areas:
      "rule rule rule rule"
      "name sections elsewhere write";
    column-gap: 40px;
  }

  .footer-name {
    margin-bottom: 0;
  }
}

/* --- Moving between pages ----------------------------------------------------- */

/*
 * The browser's own view transition, which needs no script. The masthead's
 * parts are the same on every page, so between two inner pages they hold
 * still while the page under them changes: the old one fades, the new one
 * rises a little into place. To and from the landing page, which leaves
 * Contact me out of its masthead, the profiles glide between the page's edge and
 * their place beside it, and it fades in or out. A browser without view
 * transitions simply loads the next page.
 */
@view-transition {
  navigation: auto;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 240ms;
  animation-timing-function: var(--ease);
}

.masthead .home {
  view-transition-name: home;
}

.masthead .sections {
  view-transition-name: sections;
}

/*
 * The sections fill a track that is wider on the landing page than on the
 * rest. Drawn at their own size, rather than stretched to the group's as it
 * changes width, the links stay where they are.
 */
::view-transition-old(sections),
::view-transition-new(sections) {
  inline-size: auto;
}

.masthead .elsewhere {
  view-transition-name: elsewhere;
}

.masthead-write {
  view-transition-name: write;
}

.page {
  view-transition-name: page;
}

::view-transition-new(page) {
  animation: page-in 360ms var(--ease) both;
}

::view-transition-old(page) {
  animation: page-out 160ms ease-in both;
}

@keyframes page-in {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
}

@keyframes page-out {
  to {
    opacity: 0;
  }
}

/*
 * Big headings slide the last few percent into place as their part of the
 * page scrolls in, so each change of subject is announced by its name
 * arriving. Driven by the scroll itself, not a listener; where the browser
 * cannot, they are simply in place. The slide ends as the heading comes
 * wholly onto the screen, which every heading does, even the last on a page
 * that cannot scroll it far: none is ever left part-way.
 */
@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    .slides {
      animation: slide-in var(--ease) both;
      animation-timeline: view();
      animation-range: entry 0% entry 100%;
    }

    .slides.from-right {
      animation-name: slide-in-right;
    }
  }
}

@keyframes slide-in {
  from {
    translate: -7% 0;
  }
}

@keyframes slide-in-right {
  from {
    translate: 7% 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  @view-transition {
    navigation: none;
  }

  .button,
  .button::before,
  .more svg,
  .write-block .heading svg,
  .find-link svg {
    transition: none;
  }
}

/*
 * The landing page (DESIGN.md §5): the field, then Projects, About and
 * Contact me, each a step from its page.
 *
 * The hero has two compositions. The phone's: a column, the magnet two lines
 * deep, the facts beside a small portrait. The stage's, from 900 px wide and
 * 560 tall: the magnet across the page, the facts and the calls to action
 * low on the left, the portrait low on the right. --composition tells
 * src/client/landing.ts which is showing, so the field is laid for the same
 * one: JavaScript never repeats the breakpoint. The portrait's `sizes` in
 * src/pages/landing.ts does, so move the two together.
 */

/* The masthead lies over the field, which runs under it to the top of the screen. */
.landing .masthead {
  position: absolute;
  inset: 0 0 auto;
}

/* Contact me is a step below, in the hero, the same button: one on a screen is enough. */
.landing .masthead-write {
  display: none;
}

/*
 * Without it, the row ends at the profiles. Each is a glyph centred in a box
 * larger than itself, so the last box hangs that much into the gutter and
 * its glyph meets the page's edge, as every page's last item does. Only here,
 * where the gutter has room for its focus ring.
 */
@media (min-width: 900px) {
  .landing .masthead {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "home sections elsewhere";
  }

  .landing .elsewhere {
    margin-right: calc((20px - 44px) / 2);
  }
}

/* A faint warmth round the magnet, under the filings, as the plate's field had. */
.hero {
  --composition: column;
  position: relative;
  min-height: 100svh;
  overflow: hidden;
  container-type: inline-size;
  background: radial-gradient(ellipse at 50% 45%, color-mix(in srgb, var(--muted) 9%, transparent), transparent 70%);
}

.field {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  /*
   * A finger on the field is a pole, but the page scrolls: a drag up or down
   * still scrolls it, and the browser cancels that touch's pole, which
   * landing.ts then forgets rather than leaving where the drag began.
   */
  touch-action: pan-y;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  /* The sheet thins out towards its foot rather than stopping at a line where the page goes on. */
  -webkit-mask-image: linear-gradient(to bottom, #000000 76%, transparent);
  mask-image: linear-gradient(to bottom, #000000 76%, transparent);
}

/*
 * Touches on the empty stage fall through to the canvas beneath; touches on
 * words do not. The safe-area insets keep the words clear of a notch.
 */
.hero-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100svh;
  padding: 132px max(var(--gutter), env(safe-area-inset-right)) max(32px, env(safe-area-inset-bottom)) max(var(--gutter), env(safe-area-inset-left));
  pointer-events: none;
}

.hero-stage > * {
  pointer-events: auto;
}

/* The magnet and the hint under it. In the column they are the stage's own items, as if it were not there. */
.nameplate {
  display: contents;
}

/*
 * The magnet: a bar of the gold, the name knocked out of it in the colour of
 * the page, S at the south end and N at the north. It is the bar the field is
 * drawn around, so its edges are where the filings stop.
 *
 * On a phone the name takes two lines across both halves, lettered over the
 * join; each half's pole letter stands at its end.
 */
.magnet {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  align-items: center;
  width: 100%;
  max-width: 440px;
  margin: auto 0 0;
  padding: 0.26em 0 0.2em;
  background: var(--ink);
  color: var(--ground);
  font-size: clamp(2.6rem, 13.4cqi, 3.6rem);
  touch-action: pan-y;
  -webkit-user-select: none;
  user-select: none;
}

.magnet .half {
  display: contents;
}

.magnet .pole {
  grid-row: 1 / span 2;
  padding: 0 0.42em;
  font-stretch: 100%;
  font-weight: 800;
  font-size: 0.3em;
  line-height: 1;
}

.magnet .is-north .pole {
  grid-column: 3;
}

.magnet .word {
  grid-column: 2;
  justify-self: center;
}

.hint {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: baseline;
  column-gap: 0.9em;
  max-width: 440px;
  width: 100%;
  margin-top: 12px;
  font-stretch: 80%;
  font-weight: 500;
  font-size: var(--step--1);
  line-height: 1.35;
  text-align: right;
  color: var(--muted);
}

/*
 * The field moves on its own for as long as it is on screen, so it can be
 * stopped from the page, not only by the reader's system setting. Shown by
 * landing.ts, since without it nothing moves to stop. Its hit area reaches
 * past its line, so a thumb finds it.
 */
.hold {
  margin: -12px 0;
  padding: 12px 0;
  border: 0;
  background: none;
  color: var(--light);
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--muted);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
  cursor: pointer;
}

.hold:hover {
  text-decoration-color: currentColor;
  text-decoration-thickness: 4px;
}

/*
 * One hint, for the visitor's own pointer. The stylesheet guesses from the
 * primary pointer; the first real one, which landing.ts writes to
 * data-input, overrides the guess.
 */
.hint .by-pointer {
  display: none;
}

@media (hover: hover) and (pointer: fine) {
  .hint .by-pointer {
    display: inline;
  }

  .hint .by-touch {
    display: none;
  }
}

:root[data-input="mouse"] .hint .by-pointer,
:root[data-input="touch"] .hint .by-touch {
  display: inline;
}

:root[data-input="mouse"] .hint .by-touch,
:root[data-input="touch"] .hint .by-pointer {
  display: none;
}

/* The field holds still under reduced motion, so there is nothing to invite. */
@media (prefers-reduced-motion: reduce) {
  .hint {
    display: none;
  }
}

.intro {
  width: 100%;
  max-width: 440px;
  margin-top: auto;
  padding-right: 136px;
}

.facts {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.9375rem;
  line-height: 1.3;
}

.facts li {
  display: flex;
  align-items: flex-start;
  gap: 0.55em;
}

.facts li > :last-child,
.feature-text {
  min-width: 0;
}

.fact-icon {
  flex: none;
  display: flex;
  color: var(--muted);
}

.fact-icon svg {
  width: 1.15em;
  height: 1.15em;
  margin-top: 0.05em;
}

.cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 22px;
  margin-top: 18px;
}

/*
 * The portrait, small beside the facts on a phone. Its print is 4:5; the
 * stage shows all of it.
 */
.portrait {
  position: absolute;
  right: max(var(--gutter), env(safe-area-inset-right));
  bottom: calc(max(32px, env(safe-area-inset-bottom)) + 66px);
  width: 120px;
}

.portrait img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
}

/*
 * The photo in its own colours lies over the gold print, and the pointer
 * brings it up. Where nothing can hover it is not drawn, so, being lazy, it
 * is not fetched either.
 */
.portrait-prints {
  display: grid;
}

.portrait-prints > img {
  grid-area: 1 / 1;
}

.portrait-prints > img + img {
  display: none;
  opacity: 0;
}

@media (any-hover: hover) {
  .portrait-prints > img + img {
    display: block;
  }

  .portrait-prints:hover > img + img {
    opacity: 1;
  }
}

@media (any-hover: hover) and (prefers-reduced-motion: no-preference) {
  .portrait-prints > img + img {
    transition: opacity 300ms var(--ease);
  }
}

/*
 * Small and quiet, as every caption is (DESIGN.md §4.1). On a phone it hangs
 * below the portrait, which keeps its place beside Contact me: in flow it
 * would lift the picture into the hold button on Safari's short screen. Out
 * of the figure's box, it carries its own data-fade.
 */
.portrait figcaption {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 8px;
  font-stretch: 85%;
  font-size: var(--step--1);
  line-height: 1.3;
  color: var(--muted);
}

/* --- The stage ------------------------------------------------------------- */

@media (min-width: 900px) and (min-height: 560px) {
  .hero {
    --composition: stage;
  }

  .hero-stage {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: minmax(0, 1fr) auto minmax(0, 1fr) auto;
    grid-template-areas:
      ". ."
      "magnet magnet"
      ". ."
      "intro portrait";
    align-items: end;
    row-gap: 0;
    max-width: var(--wide);
    margin: 0 auto;
    padding-top: 104px;
    padding-bottom: max(48px, env(safe-area-inset-bottom));
  }

  /*
   * As wide as the bar, so the hint under it ends where the bar does. The
   * space beside the hint is the field's: touches fall through it, as they
   * do through the empty stage.
   */
  .nameplate {
    grid-area: magnet;
    justify-self: center;
    display: grid;
    justify-items: end;
    pointer-events: none;
  }

  .nameplate > * {
    pointer-events: auto;
  }

  /*
   * One line now, across the page, the shape of a bar magnet: long and low.
   * Each word on its own half, the first name on the south and the surname
   * on the north, so the join falls between the two. Each half is as wide as
   * its own word, so the name sits in the middle of the bar, S and N an equal
   * step from either end of it.
   */
  .magnet {
    grid-template-columns: auto auto;
    grid-template-rows: auto;
    width: auto;
    max-width: none;
    margin: 0;
    padding: 0;
    /* Short of the page's width, so the field's loops round each end stay on the screen. */
    font-size: clamp(3.5rem, 6.4cqi, 8rem);
  }

  .magnet .half {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.4em;
    padding: 0.27em 0.17em 0.21em;
    white-space: nowrap;
  }

  .magnet .is-south {
    padding-left: 0.42em;
  }

  .magnet .is-north {
    padding-right: 0.42em;
  }

  .magnet .pole {
    padding: 0;
  }

  .hint {
    width: auto;
    max-width: none;
    margin: 14px 0 0;
  }

  .intro {
    grid-area: intro;
    align-self: end;
    max-width: 30rem;
    margin: 0;
    padding: 0;
  }

  .facts {
    font-size: var(--step-0);
    gap: 6px;
  }

  .cta {
    margin-top: 26px;
  }

  .portrait {
    grid-area: portrait;
    position: static;
    width: clamp(180px, 19cqi, 300px);
    margin-left: 40px;
  }

  .portrait figcaption {
    position: static;
  }
}

/* --- The parts below the field -------------------------------------------------- */

.block {
  max-width: var(--wide);
  margin: 0 auto;
  padding: var(--space) max(var(--gutter), env(safe-area-inset-right)) 0 max(var(--gutter), env(safe-area-inset-left));
}

/* The landing page's headings are as big as a page's title: each part has its own main image. */
.block > .heading {
  font-size: var(--step-5);
}

.block > .heading a:hover {
  color: var(--light);
}

/* --- Projects ----------------------------------------------------------------- */

/*
 * The heading prints over the top of the first project's picture: the gold
 * over the picture's gold dots, as two passes of a press overlap. Screened,
 * as light adds on black, where the two meet they come out the light gold.
 */
.projects-block > .heading {
  position: relative;
  z-index: 1;
  mix-blend-mode: screen;
}

.projects-block:has(.is-first .feature-picture) > .heading {
  margin-bottom: -0.34em;
}

.features {
  display: grid;
  gap: var(--space);
}

.feature {
  display: grid;
  gap: 24px;
}

.feature-picture {
  display: block;
  overflow: hidden;
}

.feature-picture img {
  width: 100%;
  aspect-ratio: 5 / 4;
  object-fit: cover;
  object-position: 50% 30%;
}

/* Under the pointer the picture swells a little, and not at all where motion is reduced. */
@media (prefers-reduced-motion: no-preference) {
  .feature-picture img {
    transition: scale 500ms var(--ease);
  }

  .feature-picture:hover img,
  .feature:has(.feature-title a:hover) .feature-picture img {
    scale: 1.03;
  }
}

.feature-title {
  font-stretch: 125%;
  font-weight: 900;
  font-size: min(var(--step-3), var(--word));
  line-height: 0.92;
  text-transform: uppercase;
}

.feature-title a:hover {
  color: var(--light);
}

.feature-summary {
  max-width: 34em;
  margin-top: 16px;
  font-size: var(--step-1);
  line-height: 1.45;
}

.feature-year {
  margin-top: 10px;
  color: var(--muted);
}

/* --- About --------------------------------------------------------------------- */

.about-block > .heading {
  text-align: right;
}

.about-body {
  display: grid;
  gap: 40px;
  margin-top: 40px;
}

.summary {
  display: flex;
  flex-direction: column;
  gap: 18px;
  font-stretch: 112%;
  font-weight: 700;
  font-size: var(--step-2);
  line-height: 1.12;
}

/* The books in hand, by their covers, leaning on one another as a stack does on a desk. */
.in-hand {
  display: flex;
  align-items: flex-end;
}

.in-hand li {
  width: clamp(110px, 12vw, 172px);
}

.in-hand li + li {
  margin-left: -18px;
  transform: translateY(14px);
}

.in-hand img {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  outline: 2px solid var(--ink);
  outline-offset: -2px;
}

.about-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 28px;
}

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

/* --- Contact me ---------------------------------------------------------------- */

/* The whole heading is the link, lit as a link is, its arrow after the last word wherever the line breaks. */
.write-block > .heading a {
  color: var(--light);
}

.write-block > .heading a:hover {
  text-decoration: underline;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.1em;
}

.write-block > .heading svg {
  display: inline-block;
  width: 0.72em;
  height: 0.72em;
  margin-left: 0.12em;
  vertical-align: -0.02em;
}

@media (min-width: 900px) {
  .feature.is-first {
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    align-items: end;
    column-gap: 56px;
  }

  .about-body {
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    grid-template-areas:
      "summary books"
      "foot books";
    align-items: start;
    column-gap: 56px;
    margin-top: 56px;
  }

  .summary {
    grid-area: summary;
  }

  .in-hand {
    grid-area: books;
    justify-self: end;
  }

  .about-foot {
    grid-area: foot;
    align-self: end;
  }
}

/*
 * Every page but the landing: the masthead, the page's name set as its main
 * image, what the page holds, the footer (DESIGN.md §4).
 */

.page {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 0 max(var(--gutter), env(safe-area-inset-right)) 0 max(var(--gutter), env(safe-area-inset-left));
}

.page-head {
  padding: clamp(36px, 8vh, 112px) 0 0;
}

.page-under {
  max-width: 34em;
  margin-top: clamp(18px, 2.4vw, 32px);
  font-size: var(--step-1);
  line-height: 1.45;
  color: var(--muted);
}

/* A part of a page, with air above it: About's Reading, Listening, and the rest. */
.part {
  padding-top: var(--space);
}

.part > .heading {
  margin-bottom: clamp(28px, 4vw, 56px);
}

.fine {
  max-width: 34em;
  margin-top: 40px;
  font-size: var(--step--1);
  color: var(--muted);
}

.empty {
  margin-top: 40px;
  color: var(--muted);
}

/* --- Running text ------------------------------------------------------------------ */

.prose {
  display: flex;
  flex-direction: column;
  gap: 1.15em;
  max-width: 36em;
  font-size: 1.1875rem;
  line-height: 1.6;
}

.prose h2 {
  margin-top: 0.8em;
  font-stretch: 112%;
  font-weight: 800;
  font-size: var(--step-2);
  line-height: 1.1;
}

.prose h3 {
  font-weight: 800;
  font-size: var(--step-1);
}

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

.prose ul {
  list-style: square;
}

.prose ol {
  list-style: decimal;
}

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

.prose blockquote {
  margin: 0;
  padding-left: 1em;
  border-left: 4px solid var(--muted);
}

.prose strong {
  font-weight: 800;
}

/*
 * A photo's gold print over its own colours, which the pointer brings up, as
 * the landing portrait's does (DESIGN.md §6.1). Without a pointer that hovers
 * the colours are never drawn, and, being lazy, never fetched.
 */
.prints {
  display: grid;
}

.prints > img {
  grid-area: 1 / 1;
  width: 100%;
}

.prints > img + img {
  display: none;
  opacity: 0;
}

@media (any-hover: hover) {
  .prints > img + img {
    display: block;
  }

  .prints:hover > img + img {
    opacity: 1;
  }
}

@media (any-hover: hover) and (prefers-reduced-motion: no-preference) {
  .prints > img + img {
    transition: opacity 300ms var(--ease);
  }
}

/* A picture in running text, with its caption under it. */
.figure {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.figure figcaption,
.project-figure figcaption {
  font-stretch: 85%;
  font-size: var(--step--1);
  color: var(--muted);
}

/* A caption's link, lit as a link is, at the caption's size. */
.figure figcaption a,
.project-figure figcaption a {
  color: var(--light);
  text-decoration: underline;
  text-decoration-color: var(--muted);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

.figure figcaption a:hover,
.project-figure figcaption a:hover {
  text-decoration-color: currentColor;
  text-decoration-thickness: 2px;
}

/* --- Projects and Writing: the list -------------------------------------------- */

.entries {
  display: flex;
  flex-direction: column;
  gap: clamp(56px, 8vw, 120px);
  margin-top: clamp(48px, 8vw, 112px);
}

.entry {
  display: grid;
  gap: 22px;
}

.entry-text,
.project-body > .prose {
  min-width: 0;
}

.entry-picture {
  display: block;
  overflow: hidden;
}

.entry-picture img {
  width: 100%;
  aspect-ratio: 5 / 4;
  object-fit: cover;
  object-position: 50% 30%;
}

/* Under the pointer the picture swells a little, and not at all where motion is reduced. */
@media (prefers-reduced-motion: no-preference) {
  .entry-picture img {
    transition: scale 500ms var(--ease);
  }

  .entry-picture:hover img,
  .entry:has(.entry-title a:hover) .entry-picture img {
    scale: 1.03;
  }
}

.entry-title {
  font-stretch: 125%;
  font-weight: 900;
  font-size: min(var(--step-3), var(--word));
  line-height: 0.92;
  text-transform: uppercase;
}

.entry-title a:hover {
  color: var(--light);
}

.entry-summary {
  max-width: 34em;
  margin-top: 16px;
  font-size: var(--step-1);
  line-height: 1.45;
}

.entry-meta {
  margin-top: 10px;
  color: var(--muted);
}

@media (min-width: 900px) {
  .entry.has-picture {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    align-items: end;
    column-gap: 56px;
  }
}

/* --- A project ------------------------------------------------------------------- */

.project-body {
  display: grid;
  gap: 40px;
  margin-top: clamp(40px, 6vw, 88px);
}

.project-side {
  display: flex;
  flex-direction: column;
  gap: 40px;
  min-width: 0;
}

.project-figure {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.project-figure img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
}

.project-figure.is-landscape img {
  aspect-ratio: 5 / 4;
}

/* A spec sheet's rows: the label says less, the hairline between them is the plate's own (DESIGN.md §5.2). */
.specs {
  margin: 0;
  border-top: 2px solid var(--ink);
}

.specs > div {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  column-gap: 20px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.specs dt {
  font-stretch: 85%;
  color: var(--muted);
}

.specs dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
}

@media (min-width: 900px) {
  .project-body.has-side {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    align-items: start;
    column-gap: 72px;
  }

  .project-body > .prose {
    font-size: 1.3125rem;
  }
}

/* --- A piece of writing ------------------------------------------------------------- */

.piece-body .prose {
  margin-top: 48px;
}

/* --- The tools' listing pages, drawn by scripts/tools.ts --------------------------- */

/*
 * The listing's own markup, poured into the site's page: a trail of groups,
 * the group's name as the title, and a row per tool.
 */
.listing {
  padding-top: clamp(36px, 8vh, 112px);
}

.listing .crumbs {
  margin-bottom: 18px;
  font-stretch: 85%;
  font-weight: 600;
  color: var(--muted);
}

.listing .crumbs a {
  color: var(--light);
  text-decoration: underline;
  text-decoration-color: var(--muted);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
}

.listing .crumbs a:hover {
  text-decoration-color: currentColor;
  text-decoration-thickness: 4px;
}

.listing .display {
  font-stretch: 125%;
  font-weight: 900;
  font-size: var(--step-5);
  line-height: 0.88;
  letter-spacing: -0.012em;
  text-transform: uppercase;
  overflow-wrap: break-word;
}

.listing .tools {
  max-width: 48rem;
  margin-top: clamp(40px, 6vw, 80px);
  border-bottom: 2px solid var(--ink);
}

.tools li {
  padding: 20px 0;
  border-top: 2px solid var(--ink);
}

.tools a {
  font-stretch: 112%;
  font-weight: 800;
  font-size: var(--step-2);
  line-height: 1.1;
}

.tools a:hover {
  color: var(--light);
}

.tools .path {
  margin-left: 10px;
  font-stretch: 85%;
  font-size: var(--step--1);
  color: var(--muted);
}

.tools p {
  max-width: 36em;
  margin-top: 6px;
}

.lock {
  margin-left: 8px;
  padding: 2px 8px;
  background: var(--light);
  color: var(--ground);
  vertical-align: 0.3em;
  font-stretch: 85%;
  font-weight: 700;
  font-size: var(--step--1);
}

.signout {
  margin-top: 40px;
}

.signout a {
  color: var(--light);
  text-decoration: underline;
  text-decoration-color: var(--muted);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
}

.signout a:hover {
  text-decoration-color: currentColor;
  text-decoration-thickness: 4px;
}

/* A redirect page for a moved tool, which is bare: no masthead to sit under. */
body:not([class]) > main {
  max-width: 44rem;
  margin: 0 auto;
  padding: 40px 20px 64px;
}

/*
 * What About and Contact me add to the page (DESIGN.md §5).
 */

/* --- About: the head ---------------------------------------------------------- */

/*
 * The name, then a few lines on who I am, in the gold rather than the deep
 * gold a page's line under its name takes: they are what the head says. On a
 * wide screen they sit beside the name, level with its foot, in the space it
 * leaves to its right.
 */
.about-bio {
  color: var(--ink);
}

.about-updated {
  margin-top: 14px;
  font-stretch: 85%;
  font-weight: 600;
  font-size: var(--step--1);
  color: var(--muted);
}

/*
 * Under them, what I'm practicing and the bee. On a wide screen practicing
 * fills the room under the name, beside the bee: a second row, its two cells
 * starting level.
 */
@media (min-width: 1200px) {
  .about-head {
    display: grid;
    grid-template-columns: auto minmax(0, 30em);
    justify-content: space-between;
    align-items: end;
    column-gap: clamp(40px, 5vw, 96px);
  }

  .about-head .page-under {
    margin-top: 0;
  }

  .about-head .practicing,
  .about-head .bee-note {
    grid-row: 2;
    align-self: start;
    margin-top: 44px;
  }
}

/* The first part follows the head closer than one part follows another, so the books start on the first screen. */
.about-head + .part {
  padding-top: clamp(64px, 2rem + 5vw, 120px);
}

/* --- About: practicing ---------------------------------------------------------- */

/*
 * Each mark over its name, four across where they fit and two a row where
 * not, under a heading set as a shelf's subject is. It sizes itself to the
 * room it is given, never the other way round (container-type), so under the
 * name it takes the name's width rather than widening the name's column.
 * Layered over what follows, for its notes.
 */
.practicing {
  position: relative;
  z-index: 3;
  margin-top: 48px;
  container-type: inline-size;
}

.practice {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px 20px;
  margin-top: 18px;
}

@container (min-width: 520px) {
  .practice {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* What its note is placed against. */
.practice li {
  position: relative;
}

.practice-label {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

summary.practice-label {
  list-style: none;
  cursor: pointer;
}

summary.practice-label::-webkit-details-marker {
  display: none;
}

.practice-mark {
  font-weight: 800;
  font-size: 1.75rem;
  line-height: 1;
  white-space: nowrap;
}

.practice-mark.is-icon {
  display: flex;
}

.practice-mark svg {
  width: 1em;
  height: 1em;
}

.practice-name {
  font-weight: 700;
  line-height: 1.3;
}

/* A name with a note is underlined in dots, as an abbreviation is: there is more to it. Lit while its note shows. */
summary .practice-name {
  text-decoration: underline dotted var(--muted);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.25em;
}

summary.practice-label:hover,
.practice-item[open] summary.practice-label {
  color: var(--light);
}

summary.practice-label:hover .practice-name,
.practice-item[open] .practice-name {
  text-decoration-color: currentColor;
}

/*
 * The note: a card of the black framed in the gold, printed a little out of
 * register as a lifted button is, laid over what is below so the page never
 * moves. It shows under the pointer, with the keyboard, or opened by a tap,
 * and Escape puts it away (src/client/about.ts). It is drawn while shut
 * (::details-content), only hidden, so the pointer can show it; a browser
 * without that part shows it on a tap or a click alone. Against the item's
 * left edge, or its right in the last column, so it never leaves the page.
 */
.practice-item::details-content {
  content-visibility: visible;
}

/* Over the items too: a card from the first row lies across the second's. */
.practice-note {
  position: absolute;
  z-index: 1;
  top: 100%;
  left: 0;
  width: max-content;
  max-width: min(19em, 100cqi);
  margin-top: 12px;
  padding: 10px 14px;
  border: 2px solid var(--ink);
  background: var(--ground);
  box-shadow: 5px 5px 0 var(--muted);
  font-size: 0.9375rem;
  line-height: 1.45;
  visibility: hidden;
  /* A moment's grace as the pointer crosses from the name to the card. */
  transition: visibility 0s linear 150ms;
}

/* The gap above the card is the card's too, so the pointer crossing it keeps it. */
.practice-note::before {
  content: "";
  position: absolute;
  left: -2px;
  right: -2px;
  bottom: 100%;
  height: 14px;
}

.practice li:nth-child(2n) .practice-note {
  left: auto;
  right: 0;
}

@container (min-width: 520px) {
  .practice li:nth-child(2n) .practice-note {
    left: 0;
    right: auto;
  }

  .practice li:nth-child(4n + 3) .practice-note,
  .practice li:nth-child(4n) .practice-note {
    left: auto;
    right: 0;
  }
}

.practice-item[open] .practice-note,
.practice-item:has(:focus-visible) .practice-note {
  visibility: visible;
  transition-delay: 0s;
}

@media (hover: hover) {
  .practice-item:hover .practice-note {
    visibility: visible;
    transition-delay: 0s;
  }

  /* One card at a time: one opened by a click gives way to the one under the pointer. */
  .practice:has(.practice-item:hover) .practice-item:not(:hover) .practice-note {
    visibility: hidden;
    transition-delay: 0s;
  }
}

.practice-item.is-dismissed .practice-note {
  visibility: hidden;
  transition-delay: 0s;
}

/* --- About: the bee ----------------------------------------------------------- */

/*
 * Under the bio, in its column on a wide screen. The line it opens keeps its
 * room whether the note is open or not, so opening it moves nothing below:
 * the browser's own part holding a disclosure's content is drawn while shut
 * (::details-content), and the line is only hidden. A browser without that
 * part makes the room as it opens, as a disclosure does.
 */
.bee-note {
  margin-top: 32px;
}

@media (min-width: 1200px) {
  .bee-note {
    grid-column: 2;
  }
}

.bee-note::details-content {
  content-visibility: visible;
}

.bee-note:not([open]) .bee-note-text {
  visibility: hidden;
}

.bee-note summary {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  list-style: none;
  cursor: pointer;
  font-stretch: 85%;
  font-weight: 600;
  font-size: var(--step--1);
  color: var(--ink);
}

.bee-note summary::-webkit-details-marker {
  display: none;
}

.bee-note summary:hover,
.bee-note[open] summary {
  color: var(--light);
}

.bee-note .bee {
  width: 56px;
  height: 56px;
}

.bee-note-text {
  max-width: 30em;
  margin-top: 14px;
  line-height: 1.5;
  color: var(--ink);
}

/*
 * Typing (src/client/about.ts): what is still to come is laid out but drawn
 * in no colour, so the words never move as they arrive, and the next letter's
 * place is a block of the light gold, the highlighter's colour, for the
 * cursor. A link's underline waits for its word.
 */
::highlight(bee-untyped) {
  color: transparent;
}

::highlight(bee-cursor) {
  color: transparent;
  background-color: var(--light);
}

.bee-note-text a.is-untyped {
  text-decoration-color: transparent;
}

/*
 * Two beats as the pointer arrives, open or shut, as the masthead's bee
 * gives (base.css); on a touch screen, which has no pointer to arrive, as the
 * note opens.
 */
@media (prefers-reduced-motion: no-preference) {
  @media (hover: hover) {
    .bee-note summary:hover .bee-flap {
      animation: flap 0.09s ease-in-out 4 alternate;
    }
  }

  @media (hover: none) {
    .bee-note[open] .bee-flap {
      animation: flap 0.09s ease-in-out 4 alternate;
    }
  }
}

/* --- About: reading chains --------------------------------------------------- */

/*
 * One shelf a row on a phone, two from 680 px and all four across from
 * 1200 px, never three, which would leave one alone. On a phone the books
 * are what make the page long, so the beads are smaller and closer there,
 * and again four across, where the text beside them needs the room.
 *
 * Each shelf's subject and chain sit in rows of the grid's own (subgrid), so
 * the rules under the subjects line up across a row however one wraps.
 */
.shelves {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 56px clamp(40px, 6vw, 96px);
}

@media (min-width: 680px) {
  .shelves {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1200px) {
  .shelves {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    column-gap: clamp(28px, 2.6vw, 48px);
  }
}

.shelf {
  display: grid;
  grid-row: span 2;
  grid-template-rows: subgrid;
  row-gap: 0;
}

.shelf-subject,
.practicing-heading {
  align-self: end;
  padding-bottom: 12px;
  border-bottom: 4px solid var(--ink);
  font-stretch: 112%;
  font-weight: 800;
  font-size: var(--step-1);
  line-height: 1.15;
}

.chain {
  --chain-gap: 16px;
  display: flex;
  flex-direction: column;
  gap: var(--chain-gap);
  margin-top: 20px;
}

.book {
  --bead-width: 54px;
  --bead-height: 81px;
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

/*
 * A bead: the cover, or a tile set in type where there is none. What is
 * read and what is in hand are printed solid; what is next is only an
 * outline, its cover faint behind it.
 */
.bead {
  flex: 0 0 var(--bead-width);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: var(--bead-width);
  height: var(--bead-height);
  padding: 7px 6px;
  overflow: hidden;
  background: var(--line);
}

.bead.has-cover {
  padding: 0;
  background: none;
}

.bead img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.is-next .bead img {
  opacity: 0.35;
}

.is-next .bead,
.is-placeholder .bead {
  background: none;
  outline: 2px dashed var(--muted);
  outline-offset: -2px;
}

/* The book in hand: a frame of the light gold round its cover, as the highlighter is behind its words. */
.is-now .bead {
  outline: 4px solid var(--light);
  outline-offset: 3px;
}

/*
 * A cover is a button that opens the book larger. Under the pointer it lifts
 * off a block of the deep gold, as a button does (DESIGN.md §4.4), and a book
 * still to come is shown at full strength, a look ahead; pressed, it lands.
 */
button.bead {
  border: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.bead.has-cover {
  position: relative;
  isolation: isolate;
  overflow: visible;
}

.bead.has-cover::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--muted);
  opacity: 0;
}

.bead.has-cover:hover {
  transform: translate(-3px, -3px);
}

.bead.has-cover:hover::before {
  opacity: 1;
  transform: translate(5px, 5px);
}

.bead.has-cover:active,
.bead.has-cover:active::before {
  transform: none;
}

.is-next .bead:hover img {
  opacity: 1;
}

/*
 * On a cover the dashes of a book to come are a layer above it, not its
 * outline: while the cover brightens the browser draws it on a layer of its
 * own, over the outline, which would vanish until the change is done.
 */
.is-next .bead.has-cover {
  outline: none;
}

.is-next .bead.has-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 2px dashed var(--muted);
  pointer-events: none;
}

/* Above the dashed outline of a book to come, which would otherwise hide where the keyboard is. */
.book .bead:focus-visible {
  outline: 3px solid var(--light);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: no-preference) {
  .bead.has-cover,
  .bead.has-cover::before,
  .bead img {
    transition:
      transform 180ms var(--ease),
      opacity 180ms var(--ease);
  }
}

/* A bead with no cover: on its tile, the title lit and the author's name in the gold. */
.bead-title {
  font-weight: 700;
  font-size: 9.5px;
  line-height: 1.15;
  color: var(--light);
}

.bead-spine {
  font-stretch: 80%;
  font-weight: 600;
  font-size: 7px;
  text-transform: uppercase;
  color: var(--ink);
}

/* The line down to the next bead: solid where the reading has been, dotted where it is going. */
.book::after {
  content: "";
  position: absolute;
  left: calc(var(--bead-width) / 2 - 1.5px);
  top: var(--bead-height);
  bottom: calc(-1 * var(--chain-gap));
}

.is-now::after {
  top: calc(var(--bead-height) + 7px);
}

.link-walked::after {
  border-left: 3px solid var(--ink);
}

.link-ahead::after {
  border-left: 3px dotted var(--muted);
}

.link-end::after {
  bottom: auto;
  height: 16px;
  border-left: 3px dotted var(--line);
}

.book-text {
  min-width: 0;
}

.book-title {
  font-weight: 700;
  font-size: 1.0625rem;
  line-height: 1.25;
}

.is-next .book-title {
  color: var(--muted);
}

.book-author,
.book-note {
  margin-top: 3px;
  font-size: 0.9375rem;
  line-height: 1.35;
  color: var(--muted);
}

.book-note {
  color: var(--ink);
}

.book-status {
  margin-top: 6px;
  font-stretch: 85%;
  font-weight: 600;
  font-size: var(--step--1);
  color: var(--muted);
}

/* --- About: a book opened ------------------------------------------------------ */

/*
 * The cover large beside what the row says of the book, on the black with
 * the page hidden while it is open, the words from the cover's top edge and
 * Close right after them. No frame, which would leave an empty box under the
 * words, shorter than the cover; and the page is hidden, not dimmed, so its
 * words never show through these. The browser places it mid-screen and shuts
 * it on Escape or a click outside; src/client/about.ts moves the cover up into
 * it, and the page holds still meanwhile rather than rising as it does between
 * pages.
 */
.book-open {
  width: min(760px, calc(100vw - 2 * var(--gutter)));
  max-height: calc(100svh - 2 * var(--gutter));
  margin: auto;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  overflow: auto;
}

.book-open:popover-open {
  display: grid;
  gap: 24px;
}

.book-open::backdrop {
  background: var(--ground);
}

.book-open img {
  width: auto;
  height: min(480px, 46svh);
  aspect-ratio: 2 / 3;
  object-fit: cover;
}

.book-open-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

.book-open-title {
  font-stretch: 112%;
  font-weight: 800;
  font-size: var(--step-2);
  line-height: 1.1;
}

.book-open .book-author,
.book-open .book-note,
.book-open .book-status {
  margin-top: 0;
}

.book-open .book-author,
.book-open .book-note {
  font-size: var(--step-0);
}

.book-close {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-top: 6px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--light);
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: var(--muted);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.22em;
  cursor: pointer;
}

.book-close:hover {
  text-decoration-color: currentColor;
  text-decoration-thickness: 4px;
}

@media (min-width: 640px) {
  .book-open {
    width: fit-content;
    max-width: min(760px, calc(100vw - 2 * var(--gutter)));
  }

  .book-open:popover-open {
    grid-template-columns: auto minmax(0, 18em);
    column-gap: clamp(24px, 4vw, 48px);
  }

  .book-open img {
    height: min(480px, 58svh);
  }
}

.turning .page {
  view-transition-name: none;
}

::view-transition-group(book) {
  animation-duration: 380ms;
  animation-timing-function: var(--ease);
}

/* The gold gives way to the cover's own colours evenly over the move, rather than all at once as it sets off. */
::view-transition-old(book),
::view-transition-new(book) {
  animation-timing-function: linear;
}

/* --- About: listening ---------------------------------------------------------- */

/*
 * Spotify's own players, dark, in its compact 80 px size: the cover small
 * beside the title and a play button. Side by side where three fit.
 */
.tracks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
  gap: 12px 20px;
}

.player {
  display: block;
  width: 100%;
  height: 80px;
  border: 0;
  border-radius: 12px;
  /* What shows until the player has loaded: a tint of the gold, not a white flash. */
  background: color-mix(in srgb, var(--ink) 10%, transparent);
  color-scheme: normal;
}

.track-note {
  margin-top: 8px;
}

/* --- About: the rabbit hole ---------------------------------------------------- */

.finds {
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.find {
  display: grid;
  gap: 22px;
}

.find-text {
  min-width: 0;
}

.find-still {
  position: relative;
  display: block;
  overflow: hidden;
}

.find-still img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

/* Either link lifts the picture: the title is the same destination. Not at all where motion is reduced. */
@media (prefers-reduced-motion: no-preference) {
  .find-still img {
    transition: scale 500ms var(--ease);
  }

  .find:has(a:hover) .find-still img {
    scale: 1.03;
  }
}

/* The play mark on a block of the gold, as a button is: it does something. */
.find-play {
  position: absolute;
  left: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: clamp(52px, 6vw, 76px);
  aspect-ratio: 1;
  background: var(--ink);
  color: var(--ground);
}

.find-play svg {
  width: 42%;
  height: 42%;
}

.find-title {
  font-stretch: 112%;
  font-weight: 800;
  font-size: var(--step-2);
  line-height: 1.1;
}

.find-title cite {
  font-style: normal;
}

.find-link {
  display: inline;
}

.find-link svg {
  display: inline-block;
  margin-left: 0.2em;
  width: 0.7em;
  height: 0.7em;
  vertical-align: 0.02em;
}

.find-link:hover {
  color: var(--light);
}

.find-by {
  margin-top: 8px;
  color: var(--muted);
}

.find-note {
  max-width: 34em;
  margin-top: 16px;
  font-size: var(--step-1);
  line-height: 1.45;
}

@media (min-width: 900px) {
  .find.has-still {
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    align-items: end;
    column-gap: 56px;
  }
}

/* --- About: listening and the rabbit hole, side by side ------------------------ */

/*
 * Where both headings fit at their size, the two parts share a row: the
 * players stacked in the narrower column, the still over its text in the
 * wider. Neither heading then stands over a thin strip of what it heads.
 */
@media (min-width: 1200px) {
  .pair {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    align-items: start;
    column-gap: clamp(48px, 5vw, 96px);
  }

  .pair .tracks,
  .pair .find.has-still {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* --- About: off the printer ---------------------------------------------------- */

.made {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 480px;
}

.made img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
}

.made figcaption {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
}

.made-title {
  font-weight: 800;
}

.made-month {
  color: var(--muted);
}

.made-note {
  flex-basis: 100%;
}

@media (min-width: 760px) {
  .chain {
    --chain-gap: 22px;
  }

  .book {
    --bead-width: 64px;
    --bead-height: 96px;
    gap: 20px;
  }

  .link-end::after {
    height: 22px;
  }
}

@media (min-width: 1200px) {
  .shelves .chain {
    --chain-gap: 18px;
  }

  .shelves .book {
    --bead-width: 54px;
    --bead-height: 81px;
    gap: 14px;
  }

  .shelves .link-end::after {
    height: 18px;
  }
}

/* --- Contact me ------------------------------------------------------------------- */

/*
 * A form on the page, not in a box: each field is a frame of the gold, its
 * label above it. 19 px type, above the 16 under which a phone zooms into a
 * field. Its classes are its own (letter-field, not the lists' entry), since
 * one stylesheet serves every page and a shared name lets one restyle the
 * other.
 */
.letter {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 30px;
  max-width: 760px;
  margin-top: clamp(40px, 6vw, 72px);
}

.letter-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.letter-field label {
  font-weight: 700;
}

.optional {
  font-weight: 400;
  color: var(--muted);
}

.letter-field input,
.letter-field textarea {
  width: 100%;
  padding: 12px 14px;
  background: var(--ground);
  border: 2px solid var(--ink);
  border-radius: 0;
  font: inherit;
  font-size: 1.1875rem;
  line-height: 1.5;
  color: var(--ink);
}

.letter-field textarea {
  resize: vertical;
}

/* Focused, a field's frame is lit: where the keyboard is, as on every control here. */
.letter-field input:focus-visible,
.letter-field textarea:focus-visible {
  outline: 3px solid var(--light);
  outline-offset: 0;
  border-color: var(--light);
}

/*
 * A field the browser has filled in keeps the page's colours. The browser's
 * own fill is forced (a slate-blue well with white words in Chrome, a pale
 * yellow in Safari) and no stylesheet can set it, so a shadow of the ground
 * is painted over it and the words are set in the gold.
 */
.letter-field input:-webkit-autofill {
  -webkit-text-fill-color: var(--ink);
  caret-color: var(--ink);
  box-shadow: inset 0 0 0 100px var(--ground);
}

.letter-hint {
  font-size: var(--step--1);
  color: var(--muted);
}

.letter-pair {
  display: grid;
  gap: 30px;
}

@media (min-width: 760px) {
  .letter-pair {
    grid-template-columns: 1fr 1fr;
    column-gap: 24px;
  }
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
}

/* Drawn rather than left to the browser, whose box would be the one thing on the page in its colours. */
.check input {
  flex: none;
  width: 22px;
  height: 22px;
  margin: 1px 0 0;
  appearance: none;
  border: 2px solid var(--ink);
  border-radius: 0;
  background: var(--ground);
  cursor: pointer;
}

.check input:checked {
  border-color: var(--light);
  background: var(--light);
  box-shadow: inset 0 0 0 4px var(--ground);
}

.honey {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.send {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 24px;
}

.send .button {
  min-width: 140px;
}

.status {
  font-weight: 600;
}
