/*
 * Night Desk: static pages (home, case pages, how to play, leaderboard,
 * about, privacy, 404).
 *
 * The page is a detective's desk late at night: a dark header strip, a
 * lamp-lit wood desk for the main area, and the desk's front edge as the
 * footer. Content sits on physical props: manila folders, typed paper
 * sheets, index cards and sticky notes. Props get real shadows; chrome
 * (header, footer, breadcrumb) stays flat.
 *
 * Colours come only from the NIGHT DESK tokens in tokens.css. Shadows use
 * the shadow tokens (--prop-shadow, --pin-shadow, --paper-shadow) or the
 * one shadow colour, rgb(var(--shade) / alpha), which also draws the wood
 * grain lines. Everything here is scoped to
 * the generated pages (body.site); the case app never loads this file. The
 * last section styles the design-system reference page (/style-guide.html,
 * classes sg-*).
 */

/* ------------------------------------------------------------------ */
/* Page frame and colour contexts                                      */
/* ------------------------------------------------------------------ */
html:has(> body.site) {
  scroll-padding-top: var(--s-5);
  background: var(--bg);
}

@media (prefers-reduced-motion: no-preference) {
  html:has(> body.site) {
    scroll-behavior: smooth;
  }
}

body.site {
  /* The wood context: cream ink on dark wood. */
  --on-accent: var(--paper-ink);
  --rule-strong: var(--ink-muted);
  --desk-gutter: clamp(16px, 3.6vw, 56px);
  --desk-max: 1680px;
  /* Focus colour for props seen against the wood, kept when a paper
     context below remaps --focus for its own controls. */
  --desk-focus: var(--focus);
  --grain:
    repeating-linear-gradient(92deg, rgb(var(--shade) / 0.28) 0 1px, transparent 1px 38px),
    repeating-linear-gradient(88deg, color-mix(in srgb, var(--paper) 3%, transparent) 0 2px, transparent 2px 23px);
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
}

/* Paper context: typed sheets, index cards, sticky notes, labels.
   Base primitives (headings, links, .btn, .input, .muted) read these. */
:where(.sheet, .index-card, .note, body.site .card, .case-folder__sheet, .dossier__label, .dossier__facts, .step__card, .desk-label, body.site .label-tab) {
  --ink: var(--paper-ink);
  --ink-muted: var(--paper-ink-soft);
  --accent: var(--wax);
  --on-accent: var(--paper);
  --surface: var(--paper);
  --wash: var(--paper-2);
  --rule: color-mix(in srgb, var(--paper-ink) 18%, transparent);
  --rule-strong: var(--paper-ink-soft);
  --focus: var(--paper-ink);
  color: var(--ink);
}

/* Kraft context: manila folders. Muted ink would fall below 4.5:1 on kraft,
   so everything on the folder itself uses the full paper ink. */
:where(.case-folder, .dossier, .mini-folder) {
  --ink: var(--paper-ink);
  --ink-muted: var(--paper-ink);
  --accent: var(--paper-ink);
  --on-accent: var(--paper);
  --surface: var(--paper);
  --wash: var(--paper-2);
  --rule: color-mix(in srgb, var(--paper-ink) 30%, transparent);
  --rule-strong: var(--paper-ink);
  --focus: var(--paper-ink);
  color: var(--ink);
}

/* Paper inside a folder goes back to the paper context. */
:where(.case-folder, .dossier) :where(.case-folder__sheet, .dossier__label, .dossier__facts, .sheet) {
  --ink-muted: var(--paper-ink-soft);
  --accent: var(--wax);
  --rule: color-mix(in srgb, var(--paper-ink) 18%, transparent);
  --rule-strong: var(--paper-ink-soft);
}

/* ------------------------------------------------------------------ */
/* Header: the dark strip above the desk                               */
/* ------------------------------------------------------------------ */
.site-header {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-1) var(--s-5);
  padding: var(--s-2) var(--desk-gutter);
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: var(--s-3);
  width: fit-content;
  min-height: var(--tap);
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.0625rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: var(--track-caps);
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink);
}

.brand-mark__glyph {
  flex: none;
  width: 26px;
  height: 26px;
}

/* The favicon's folder: kraft back, brass front flap, wax seal. */
.brand-mark__back { fill: var(--kraft-dark); }
.brand-mark__front { fill: var(--accent); }
.brand-mark__seal { fill: var(--wax); }

a.brand-mark:hover .brand-mark__name {
  text-decoration: underline;
  text-decoration-color: var(--brass);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.3em;
}

.site-nav > ul {
  gap: 2px var(--s-1);
  margin-inline-end: calc(var(--s-2) * -1);
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 var(--s-3);
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink);
  border-radius: var(--r);
}

.site-nav a:hover {
  text-decoration: underline;
  text-decoration-color: var(--brass);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.35em;
}

/* The current page, or the section the page sits in, is a small brass plate. */
.site-nav a[aria-current] {
  color: var(--paper-ink);
  background: var(--brass);
  box-shadow: inset 0 0 0 1px rgb(var(--shade) / 0.3);
  text-decoration: none;
}

@media (max-width: 40rem) {
  .site-header {
    padding-block: var(--s-1) var(--s-2);
  }

  .site-header > .site-nav {
    width: 100%;
  }

  .site-nav > ul {
    gap: 2px;
    margin-block: 0 0;
    margin-inline: calc(var(--s-2) * -1) 0;
  }

  .site-nav a {
    padding: 0 var(--s-2);
    font-size: 0.8125rem;
    letter-spacing: 0.07em;
  }
}

/* The language menu (base.css) closes the navigation, behind a thin rule,
   so the brand stands alone on the left and everything else reads as one row. */
.site-header > .brand-mark {
  margin-inline-end: auto;
}

.site-header > .lang-switch {
  display: flex;
  align-items: center;
  padding-inline-start: var(--s-3);
  margin-inline-start: calc(var(--s-5) * -1 + var(--s-3));
  border-inline-start: 1px solid var(--rule);
}

/* One line in the reader's language on the English home page (site.js shows it). */
.lang-offer {
  margin: 0;
  padding: var(--s-2) var(--desk-gutter);
  font-size: 0.9375rem;
  color: var(--ink);
  background: rgb(var(--shade) / 0.35);
  border-bottom: 1px solid var(--rule);
}

.lang-offer a {
  color: var(--ink);
  text-decoration-color: var(--brass);
  text-underline-offset: 0.25em;
}

.lang-offer__dismiss {
  margin-inline-start: var(--s-2);
  padding: 0 var(--s-2);
  min-height: 32px;
  font: inherit;
  font-size: 0.875rem;
  color: var(--ink);
  background: none;
  border: 1px solid var(--rule);
  border-radius: var(--r);
  cursor: pointer;
}

/* "In English": a case not yet translated, on an Arabic or Turkish page. */
.badge--lang {
  margin-inline-start: var(--s-1);
}

.dossier__lang {
  max-width: 34rem;
}

/* Below desktop width the navigation does not fit beside the brand: the
   language menu rides on the brand's line and the navigation takes the line
   below, so the menu never drops onto a line of its own. */
@media (max-width: 63.99rem) {
  .site-header > .lang-switch {
    order: 1;
    margin-inline-start: 0;
    padding-inline-start: 0;
    border-inline-start: 0;
  }

  .site-header > .site-nav {
    order: 2;
    width: 100%;
  }

  .site-nav > ul {
    margin-inline: calc(var(--s-3) * -1) 0;
  }

  .site-header .lang-menu__key {
    padding-inline-end: 0;
  }
}

/* ------------------------------------------------------------------ */
/* Main: the lamp-lit desk                                             */
/* ------------------------------------------------------------------ */
.site-main {
  --lamp-x: 70%;
  --lamp-y: 120px;
  position: relative;
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  gap: clamp(var(--s-7), 6vw, 88px);
  padding: clamp(var(--s-6), 4vw, 56px) var(--desk-gutter) clamp(var(--s-7), 7vw, 104px);
  overflow-x: clip;
  background-color: var(--wood);
  background-image:
    radial-gradient(46% 560px at var(--lamp-x) var(--lamp-y), var(--lamp), transparent 70%),
    var(--grain),
    linear-gradient(var(--wood-2), var(--wood) 640px);
  border-top: 10px solid var(--wall);
}

.site-main > * {
  width: 100%;
  max-width: var(--desk-max);
  margin-inline: auto;
}

/* Text set straight on the wood is always the full cream ink, so it keeps
   at least 6:1 even inside the lamp light. */
.site-main a:not(.btn) {
  text-decoration-thickness: 1px;
}

.page-about .site-main,
.page-privacy .site-main {
  --lamp-x: 68%;
  --lamp-y: 260px;
}

.page-case .site-main {
  --lamp-x: 62%;
  --lamp-y: 300px;
}

.page-404 .site-main {
  --lamp-x: 34%;
  --lamp-y: 240px;
}

@media (max-width: 64rem) {
  .site-main {
    --lamp-x: 50%;
    --lamp-y: 640px;
  }
}

/* Headings and copy set directly on the wood. */
.hero,
.desk-hero__intro {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--s-4);
}

.hero > *,
.desk-hero__intro > * {
  margin: 0;
}

/* One heading scale: inner pages use --t-6, and the home headline (below)
   is never smaller than that, so no page outranks the home hero. */
.hero h1,
.desk-hero__intro h1 {
  max-width: 15ch;
  font-size: var(--t-6);
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  color: var(--ink);
  text-shadow: 0 2px 0 rgb(var(--shade) / 0.45);
}

.hero > p:not(.label-tab),
.desk-hero__intro > p:not(.label-tab) {
  max-width: 38rem;
  color: var(--ink);
}

.hero .muted {
  color: var(--ink);
}

.hero .cta,
.desk-hero__intro .cta {
  margin-top: var(--s-2);
}

/* The home headline is short and capped, so the intro and its button fit
   above the fold beside the folders on a laptop screen. */
.desk-hero__intro h1 {
  max-width: 12em;
  font-size: clamp(2.5rem, 1.7rem + 2.6vw, 3.5rem);
  line-height: 0.98;
}

/* A paper label pinned to the wood, used for section titles. */
.desk-label {
  width: fit-content;
  max-width: 100%;
  margin: 0;
  padding: 0.45em 0.95em 0.4em;
  font-family: var(--font-display);
  font-size: clamp(1rem, 0.9rem + 0.45vw, 1.3rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: var(--paper);
  box-shadow: var(--pin-shadow);
  transform: rotate(-1.2deg);
}

.desk-section {
  display: flex;
  flex-direction: column;
  gap: var(--s-6);
}

.desk-section--end {
  align-items: flex-start;
}

/* Labels on the wood become small typed paper labels. */
body.site .label-tab {
  gap: 0.6em;
  padding: 0.42em 0.8em 0.36em;
  font-weight: 800;
  color: var(--paper-ink);
  background: var(--paper);
  border: 0;
  border-radius: 1px;
  box-shadow: var(--pin-shadow);
  transform: rotate(-1.5deg);
}

body.site .label-tab .num {
  color: var(--paper-ink);
  border-inline-start-color: var(--rule);
}

/* A label on paper is a kraft label instead. */
body.site :where(.sheet, .index-card, .step__card, .case-folder__sheet) .label-tab {
  background: var(--kraft);
  box-shadow: none;
}

/* Stamps: difficulty and status marks in wax-red ink. */
body.site .badge {
  padding: 0.35em 0.55em 0.3em;
  font-weight: 800;
  color: var(--accent);
  border: 2px solid currentColor;
  transform: rotate(-4deg);
}

/* ------------------------------------------------------------------ */
/* Buttons on the desk                                                 */
/* ------------------------------------------------------------------ */
body.site .btn {
  border-radius: var(--r);
}

body.site .btn--primary {
  box-shadow: 0 2px 0 rgb(var(--shade) / 0.35);
}

body.site .btn--primary:hover {
  background: color-mix(in srgb, var(--accent) 86%, var(--paper));
  border-color: color-mix(in srgb, var(--accent) 86%, var(--paper));
}

/* One primary style on paper and kraft alike: wax red with paper text.
   (On the bare wood the primary button is brass.) */
body.site :where(.case-folder, .dossier) .btn--primary {
  --accent: var(--wax);
  --on-accent: var(--paper);
}

body.site :where(.sheet, .index-card, .note, .case-folder, .dossier) .btn--primary:hover {
  background: color-mix(in srgb, var(--accent) 82%, var(--paper-ink));
  border-color: color-mix(in srgb, var(--accent) 82%, var(--paper-ink));
}

body.site .btn--quiet {
  text-decoration-color: var(--brass);
}

body.site :where(.sheet, .index-card, .note, .case-folder, .dossier) .btn--quiet {
  text-decoration-color: currentColor;
}

/* ------------------------------------------------------------------ */
/* Props: typed sheets, index cards, sticky notes                      */
/* ------------------------------------------------------------------ */
.sheet {
  position: relative;
  padding: clamp(22px, 3.4vw, 52px) clamp(18px, 4vw, 60px);
  background-color: var(--paper);
  background-image: linear-gradient(172deg, transparent 55%, color-mix(in srgb, var(--paper-2) 75%, transparent));
  border-radius: 1px;
  box-shadow: var(--prop-shadow);
}

/* A second sheet peeking out underneath. */
.sheet--under {
  box-shadow:
    6px 7px 0 -1px var(--paper-2),
    7px 9px 6px -1px rgb(var(--shade) / 0.35),
    var(--prop-shadow);
}

/* A brass paper clip over the top edge. */
.sheet--clip {
  padding-top: clamp(44px, 4vw, 56px);
}

.sheet--clip::before,
.sheet--clip::after {
  content: "";
  position: absolute;
  top: -16px;
  inset-inline-start: clamp(22px, 6%, 64px);
  width: 16px;
  height: 50px;
  border: 3px solid var(--brass);
  border-radius: 8px;
  filter: drop-shadow(0 2px 1px rgb(var(--shade) / 0.35));
  pointer-events: none;
}

.sheet--clip::after {
  top: -9px;
  width: 10px;
  height: 34px;
  margin-inline-start: 3px;
  border-width: 2px;
  filter: none;
}

.sheet > h2:first-child {
  margin-top: 0;
}

/* Index card: a red rule under the heading and ruled lines for each entry. */
.index-card {
  position: relative;
  padding: var(--s-4) clamp(18px, 2.4vw, 28px) var(--s-5);
  background: var(--paper);
  border-radius: 2px;
  box-shadow: var(--prop-shadow);
}

.index-card > h2 {
  margin: 0;
  padding-bottom: var(--s-2);
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border-bottom: 2px solid var(--string);
}

/* Sticky note in the handwriting face. */
.note {
  position: relative;
  width: fit-content;
  max-width: 19rem;
  margin: 0;
  padding: var(--s-4) var(--s-4) var(--s-5);
  font-family: var(--font-hand-a);
  font-size: 1.4rem;
  font-weight: 400;
  line-height: 1.12;
  background: var(--note-yellow);
  box-shadow: var(--pin-shadow);
  transform: rotate(2deg);
}

/* A strip of tape holding the note down. */
.note::before {
  content: "";
  position: absolute;
  top: -10px;
  left: 50%;
  width: 64px;
  height: 20px;
  margin-left: -32px;
  background: color-mix(in srgb, var(--paper) 55%, transparent);
  box-shadow: 0 1px 2px rgb(var(--shade) / 0.15);
  transform: rotate(-4deg);
}

.note--big {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  max-width: 22rem;
  padding: var(--s-5) var(--s-5) var(--s-6);
  transform: rotate(-1.5deg);
}

.note--big h2 {
  margin: 0;
  font-family: var(--font-hand-a);
  font-size: 2.4rem;
  font-weight: 400;
  line-height: 1;
}

.note--big p {
  margin: 0;
}

body.site .card {
  background: var(--paper);
  border: 0;
  box-shadow: var(--prop-shadow);
}

/* ------------------------------------------------------------------ */
/* Home: the desk hero with the case folders                           */
/* ------------------------------------------------------------------ */
.desk-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--s-7) clamp(var(--s-6), 4vw, 72px);
  align-items: start;
}

@media (min-width: 72rem) {
  .desk-hero {
    grid-template-columns: minmax(22rem, 0.95fr) minmax(0, 1.5fr);
  }

  /* The library is already beside the intro here, so a button that only
     scrolls to it would be a third primary in the first screen. */
  .desk-hero__jump {
    display: none;
  }

  /* The quiet link left alone lines its text up with the copy above. */
  .desk-hero__jump + .btn--quiet {
    margin-inline-start: calc((var(--s-4) + 1px) * -1);
  }

  .desk-hero__intro {
    position: sticky;
    top: var(--s-5);
    padding-top: var(--s-4);
  }
}

.library {
  display: flex;
  flex-direction: column;
  gap: var(--s-5);
  scroll-margin-top: var(--s-4);
}

.library__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-5);
}

.library__note {
  max-width: 21rem;
  font-size: 1.3rem;
  transform: rotate(1.6deg);
}

/* On phones the training folder's own "Start here" note says the same,
   and the folders come up into the first screen without this one. */
@media (max-width: 40rem) {
  .library__note {
    display: none;
  }
}

.folders {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 19.5rem), 1fr));
  align-items: start;
  gap: 64px clamp(var(--s-5), 3vw, 44px);
  margin: 0;
  padding: 34px 0 0;
  list-style: none;
}

.folder-slot {
  min-width: 0;
  margin: 0;
}

/* One manila folder. The title link stretches over the whole folder, so
   the folder opens like a single object; the two buttons sit above it. */
.case-folder {
  --tilt: -1deg;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  height: 100%;
  padding: 34px clamp(14px, 2vw, 22px) var(--s-5);
  background-color: var(--kraft);
  background-image: repeating-linear-gradient(0deg, rgb(var(--shade) / 0.03) 0 1px, transparent 1px 4px);
  border-radius: 0 5px 5px 5px;
  box-shadow: -6px 6px 0 0 var(--kraft-dark), var(--prop-shadow);
  transform: rotate(var(--tilt));
  transition: transform var(--dur-slow) var(--ease), box-shadow var(--dur-slow) var(--ease);
}

.folder-slot:nth-child(even) .case-folder {
  --tilt: 1.1deg;
}

.case-folder:hover,
.case-folder:focus-within {
  transform: translateY(-6px) rotate(var(--tilt));
  box-shadow: -6px 6px 0 0 var(--kraft-dark), var(--prop-shadow-lift);
}

.case-folder:has(.case-folder__link:focus-visible) {
  outline: 3px solid var(--desk-focus);
  outline-offset: 4px;
}

.case-folder__tab,
.dossier__tab {
  position: absolute;
  top: -31px;
  inset-inline-start: 0;
  margin: 0;
  padding: 7px 18px 0;
  height: 32px;
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 800;
  line-height: 1.4;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--paper-ink);
  background: var(--kraft);
  border-radius: 6px 6px 0 0;
}

/* The typed paper label clipped inside the folder. */
.case-folder__sheet {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  padding: var(--s-4) clamp(14px, 2vw, 22px) var(--s-4);
  background: var(--paper);
  box-shadow: var(--paper-shadow);
}

.case-folder__sheet > * {
  margin: 0;
}

.case-folder__kind {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2) var(--s-3);
  font-family: var(--font-display);
  font-size: 0.8125rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.case-folder h3 {
  font-size: var(--t-5);
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.case-folder__link {
  /* A 44 px tap box around the title without moving the text. */
  display: inline-block;
  padding-block: 0.3em;
  margin-block: -0.3em;
  color: var(--paper-ink);
  text-decoration: none;
}

.case-folder__link::after {
  content: "";
  position: absolute;
  inset: -31px 0 0;
  z-index: 0;
}

.case-folder__link:hover {
  text-decoration: underline;
  text-decoration-color: var(--wax);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.12em;
}

.case-folder__tagline {
  font-style: italic;
  font-size: var(--t-2);
  line-height: 1.45;
}

.case-folder .cta {
  position: relative;
  z-index: 1;
  margin-top: auto;
}

/* Main case: sealed with wax. Training case: a sticky note. */
.wax-seal {
  position: absolute;
  top: -24px;
  inset-inline-end: 18px;
  z-index: 1;
  width: 68px;
  height: 68px;
  filter: drop-shadow(0 3px 3px rgb(var(--shade) / 0.5));
  pointer-events: none;
}

.case-folder__note {
  position: absolute;
  top: -30px;
  inset-inline-end: 14px;
  z-index: 1;
  padding: var(--s-2) var(--s-4) var(--s-3);
  font-size: 1.45rem;
  transform: rotate(5deg);
  pointer-events: none;
}

.case-folder__note::before {
  width: 40px;
  margin-inline-start: -20px;
  height: 14px;
  top: -7px;
}

/* Cover photo on a case page: a large polaroid clipped inside the dossier. */
.polaroid {
  width: min(100%, 24rem);
  margin: 0;
  padding: 8px 8px 28px;
  background: var(--paper);
  box-shadow: var(--pin-shadow);
  transform: rotate(-2deg);
}

.polaroid img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

/* Public facts as a typed index list. */
.case-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 6.5rem), 1fr));
  gap: 0 var(--s-4);
  margin: 0;
  border-bottom: 1px solid var(--rule);
}

.case-facts > div {
  min-width: 0;
  padding-block: var(--s-2);
  border-top: 1px solid var(--rule);
}

.case-facts dt {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: var(--track-caps);
  text-transform: uppercase;
  color: var(--ink-muted);
}

.case-facts dd {
  margin: 0;
  font-size: var(--t-1);
  line-height: 1.4;
}

/* "Set 2004" over "Reopened 2026": one part per line. */
.case-facts__part {
  display: block;
}

/* How it works: three props on the desk, each above its step card. */
.steps {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--s-7) clamp(var(--s-5), 3vw, 48px);
  margin: 0;
  padding: 0;
  list-style: none;
}

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

.step {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--s-3);
  margin: 0;
  min-width: 0;
}

.prop {
  display: block;
  width: 150px;
  height: auto;
  margin-inline-start: var(--s-3);
  filter: drop-shadow(0 8px 8px rgb(var(--shade) / 0.5));
}

.step__card {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: var(--s-3);
  width: 100%;
  padding: var(--s-5) clamp(18px, 2.4vw, 28px);
  background: var(--paper);
  box-shadow: var(--prop-shadow);
  transform: rotate(-0.8deg);
}

.step:nth-child(2) .step__card {
  transform: rotate(0.7deg);
}

.step:nth-child(3) .step__card {
  transform: rotate(-0.4deg);
}

.step__card > * {
  margin: 0;
}

.step__card h3 {
  font-size: var(--t-4);
  font-weight: 800;
  line-height: 1.05;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

/* Inline-SVG prop fills and strokes. */
.f-kraft { fill: var(--kraft); }
.f-kraft-dark { fill: var(--kraft-dark); }
.f-paper { fill: var(--paper); }
.f-paper2 { fill: var(--paper-2); }
.f-wax { fill: var(--wax); }
.f-ink { fill: var(--paper-ink); }
.f-handle { fill: var(--kraft); }
.f-brass { fill: var(--brass); }

.s-ink,
.s-string,
.s-wax,
.s-wax-thick {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.s-ink { stroke: var(--paper-ink-soft); stroke-width: 2; }
.s-string { stroke: var(--string); stroke-width: 2.5; }
.s-wax { stroke: color-mix(in srgb, var(--wax) 62%, var(--paper)); stroke-width: 2; }
.s-wax-thick { stroke: var(--wax); stroke-width: 3; }
/* The wax seal's M monogram, pressed into the wax inside a beaded rim. */
.f-wax-mono { fill: color-mix(in srgb, var(--wax) 55%, var(--paper)); }
.f-wax-shade { fill: rgb(var(--shade) / 0.35); }
.s-wax-rim { fill: none; stroke: color-mix(in srgb, var(--wax) 70%, var(--paper)); stroke-width: 1.4; stroke-dasharray: 0.1 3.2; stroke-linecap: round; }

/* ------------------------------------------------------------------ */
/* Home: the murder board (decorative, aria-hidden)                    */
/* ------------------------------------------------------------------ */
/* Cork in a wooden frame. The board is one grid row of equal columns:
   a photo takes two, a note or card one. home.mjs draws the red string
   with the same column maths and the same --wall-h fractions below, so
   the string meets the pins at every width. */
.wall {
  --wall-h: clamp(150px, 20vw + 60px, 340px);
  position: relative;
  padding: clamp(8px, 1.6vw, 22px) clamp(8px, 1.6vw, 24px);
  /* Cork: fine and coarse grain (fractal noise, black at low alpha) and a
     few light and dark granules on tiles of prime sizes, so no regular
     dot grid shows. */
  background-color: var(--cork);
  background-image:
    var(--cork-grain),
    radial-gradient(circle at 23% 31%, var(--cork-dark) 0 1.2px, transparent 1.8px),
    radial-gradient(ellipse 2.4px 1.5px at 46% 12%, var(--cork-dark), transparent),
    radial-gradient(circle at 71% 64%, color-mix(in srgb, var(--cork) 60%, var(--paper)) 0 1px, transparent 1.6px),
    radial-gradient(circle at 12% 83%, color-mix(in srgb, var(--cork) 72%, var(--paper)) 0 0.8px, transparent 1.4px);
  background-size: 240px 240px, 37px 41px, 53px 47px, 43px 59px, 61px 67px;
  border: clamp(8px, 1.1vw, 14px) solid var(--frame);
  border-bottom-width: clamp(10px, 1.4vw, 18px);
  box-shadow:
    inset 0 0 40px rgb(var(--shade) / 0.35),
    var(--prop-shadow-lift);
}

.wall__board {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  grid-template-rows: var(--wall-h);
  height: var(--wall-h);
}

.wall__item {
  position: relative;
  min-width: 0;
  align-self: start;
}

.wall__item--photo {
  grid-column: span 2;
}

.wall__item--high { margin-top: calc(var(--wall-h) * 0.08); }
.wall__item--mid { margin-top: calc(var(--wall-h) * 0.15); }
.wall__item--card { margin-top: calc(var(--wall-h) * 0.2); }
.wall__item--low { margin-top: calc(var(--wall-h) * 0.42); }
.wall__item--lower { margin-top: calc(var(--wall-h) * 0.5); }

/* A push pin at the top centre of every item. Pins sit above the string,
   the string above the paper (the board is its own stacking context). */
.wall__pin {
  position: absolute;
  top: 0;
  left: 50%;
  z-index: 3;
  width: 14px;
  height: 14px;
  margin-block: -7px 0;
  margin-left: -7px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, color-mix(in srgb, var(--mark) 45%, var(--paper)) 0 2px, var(--mark) 3.5px);
  box-shadow: 1px 3px 2px rgb(var(--shade) / 0.45);
}

.wall__pin--brass {
  background: radial-gradient(circle at 35% 35%, color-mix(in srgb, var(--brass) 45%, var(--paper)) 0 2px, var(--brass) 3.5px);
}

.wall__strings {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  filter: drop-shadow(0 2px 1px rgb(var(--shade) / 0.35));
}

.wall__string {
  fill: none;
  stroke: var(--string);
  stroke-width: 2;
  stroke-linecap: round;
}

.wall__strings--narrow {
  display: none;
}

/* Items hang from their pin, so they turn about the top centre. */
.wall__polaroid,
.wall__note,
.wall__card {
  margin: 0 auto;
  transform-origin: 50% 0;
}

.wall__polaroid {
  width: min(18.5rem, 88%);
  padding: clamp(5px, 0.6vw, 9px) clamp(5px, 0.6vw, 9px) 0;
  background: var(--paper);
  box-shadow: var(--pin-shadow);
  transform: rotate(-3deg);
}

.wall__item--mid .wall__polaroid {
  transform: rotate(2.4deg);
}

/* A photo on the board also opens its case for mouse users (the board is
   aria-hidden and out of the tab order; the folders are the real links). */
.wall__link {
  display: block;
  color: inherit;
  text-decoration: none;
}

.wall__link .wall__polaroid {
  transition: transform var(--dur-slow) var(--ease), box-shadow var(--dur-slow) var(--ease);
}

.wall__link:hover .wall__polaroid {
  transform: translateY(-4px) rotate(-3deg);
  box-shadow: var(--prop-shadow-lift);
}

.wall__item--mid .wall__link:hover .wall__polaroid {
  transform: translateY(-4px) rotate(2.4deg);
}

.wall__polaroid img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.wall__polaroid figcaption {
  overflow: hidden;
  padding: 0.2em 0.2em 0.3em;
  font-family: var(--font-hand-a);
  font-size: clamp(0.95rem, 0.55rem + 1.05vw, 1.55rem);
  line-height: 1.15;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--paper-ink);
}

.wall__note {
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(9.5rem, 88%);
  aspect-ratio: 1;
  padding: 0.5em;
  font-family: var(--font-hand-a);
  font-size: clamp(0.8rem, 0.4rem + 1vw, 1.4rem);
  line-height: 1.05;
  text-align: center;
  color: var(--paper-ink);
  background: var(--note-yellow);
  box-shadow: var(--pin-shadow);
  transform: rotate(3deg);
}

.wall__note--pink {
  background: var(--note-pink);
  transform: rotate(-2.5deg);
}

/* A blank index card: a red rule along the top, faint ruled lines. */
.wall__card {
  display: block;
  width: min(9rem, 86%);
  aspect-ratio: 5 / 3;
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--string), var(--string)),
    repeating-linear-gradient(to bottom, transparent 0 13px, color-mix(in srgb, var(--paper-ink) 14%, transparent) 13px 14px);
  background-position: 0 24%, 0 0;
  background-size: 100% 2px, 100% 100%;
  background-repeat: no-repeat, repeat;
  box-shadow: var(--pin-shadow);
  transform: rotate(-4deg);
}

/* Phones: the edge card and note come down, the photos and the note
   between them stay, and the shorter string is drawn instead. */
@media (max-width: 40rem) {
  .wall__item--edge,
  .wall__strings--wide {
    display: none;
  }

  .wall__strings--narrow {
    display: block;
  }

  /* Three or more cases: the photos alone, two to a row. */
  .wall--grid {
    --wall-h: 190px;
  }

  .wall--grid .wall__board {
    grid-auto-flow: row;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: none;
    grid-auto-rows: var(--wall-h);
  }

  .wall--rows-2 .wall__board { height: calc(var(--wall-h) * 2); }
  .wall--rows-3 .wall__board { height: calc(var(--wall-h) * 3); }
  .wall--rows-4 .wall__board { height: calc(var(--wall-h) * 4); }

  .wall--grid .wall__item--photo {
    grid-column: span 1;
  }

  .wall--grid .wall__item--note {
    display: none;
  }

  .wall--grid .wall__strings--phone {
    display: block;
  }
}

.wall__strings--phone {
  display: none;
}

/* ------------------------------------------------------------------ */
/* Case page: an open dossier                                          */
/* ------------------------------------------------------------------ */
.breadcrumb ol {
  gap: var(--s-2);
  font-family: var(--font-display);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: var(--track-caps);
  text-transform: uppercase;
  color: var(--ink);
}

.breadcrumb a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  min-width: var(--tap);
  color: var(--ink);
  text-decoration-color: var(--brass);
}

.breadcrumb li + li::before {
  content: "/";
  content: "/" / "";
  margin-inline-end: var(--s-2);
  color: var(--brass);
}

.site-main > .breadcrumb {
  margin-bottom: calc(clamp(var(--s-7), 6vw, 88px) * -1 + var(--s-6));
}

.dossier {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  margin-top: 30px;
  padding: clamp(16px, 3vw, 40px);
  background-color: var(--kraft);
  background-image: repeating-linear-gradient(0deg, rgb(var(--shade) / 0.03) 0 1px, transparent 1px 4px);
  border-radius: 0 6px 6px 6px;
  box-shadow: var(--prop-shadow-lift);
}

.dossier__cover {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--s-5);
  min-width: 0;
  padding-bottom: var(--s-6);
}

.dossier__label {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  width: 100%;
  padding: var(--s-5) clamp(16px, 2.4vw, 28px);
  background: var(--paper);
  box-shadow: var(--paper-shadow);
  transform: rotate(-0.6deg);
}

.dossier__label > * {
  margin: 0;
}

.dossier__label h1 {
  font-size: var(--t-6);
  font-weight: 800;
  line-height: 0.98;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.dossier__label .lede {
  font-style: italic;
}

.dossier__facts {
  width: 100%;
  padding: var(--s-2) clamp(16px, 2.4vw, 28px) var(--s-3);
  background: var(--paper-2);
  box-shadow: var(--paper-shadow);
  transform: rotate(0.5deg);
}

.dossier__facts .case-facts {
  border-bottom: 0;
}

.dossier__facts .case-facts > div:first-child,
.dossier__facts .case-facts > div {
  border-top-color: var(--rule);
}

.dossier__pages {
  display: flex;
  flex-direction: column;
  gap: var(--s-6);
  min-width: 0;
}

@media (min-width: 64rem) {
  .dossier {
    grid-template-columns: minmax(20rem, 0.82fr) minmax(0, 1.5fr);
  }

  /* The fold of the open folder. */
  .dossier__cover {
    position: sticky;
    top: var(--s-5);
    align-self: start;
    padding-block: 0 0;
    padding-inline: 0 clamp(24px, 3vw, 44px);
  }

  /* The fold of the open folder: a soft shadow down the spine. */

  .dossier__pages {
    padding-inline-start: clamp(24px, 3vw, 44px);
    box-shadow: inset 16px 0 16px -16px rgb(var(--shade) / 0.45);
  }
}


/* More cases: the small folders share the row with a sticky note pointing
   back to the library. The folders grow to fill the row, so one folder
   never sits alone on a wide desk. */
.more-cases {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-7) clamp(var(--s-6), 4vw, 64px);
}

.mini-folders {
  display: flex;
  flex: 1 1 34rem;
  flex-wrap: wrap;
  min-width: 0;
  max-width: 100%;
  gap: 56px var(--s-6);
  margin: 0;
  padding: 30px 0 0;
  list-style: none;
}

.mini-folders > li {
  container: mini / inline-size;
  flex: 1 1 26rem;
  min-width: 0;
  max-width: 100%;
  margin: 0;
}

/* One other case: its folder grows to 52rem and the note sits beside it. */
.more-cases--one .mini-folders {
  flex: 0 1 52rem;
}

.more-cases__note {
  flex: 1 1 14rem;
  max-width: 19rem;
  font-size: 1.35rem;
  transform: rotate(-2deg);
}

/* Tap height from padding, so the note's lines stay evenly spaced. */
.more-cases__note a {
  padding-block: 10px;
  color: var(--paper-ink);
  text-decoration-color: var(--wax);
  text-decoration-thickness: 2px;
}

.mini-folder {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
  padding: var(--s-5) var(--s-5) var(--s-4);
  color: var(--paper-ink);
  text-decoration: none;
  background: var(--kraft);
  border-radius: 0 5px 5px 5px;
  box-shadow: -5px 5px 0 0 var(--kraft-dark), var(--prop-shadow);
  transform: rotate(-0.8deg);
  transition: transform var(--dur-slow) var(--ease), box-shadow var(--dur-slow) var(--ease);
}

.mini-folder:hover,
.mini-folder:focus-visible {
  transform: translateY(-5px) rotate(-0.8deg);
  box-shadow: -5px 5px 0 0 var(--kraft-dark), var(--prop-shadow-lift);
}

.mini-folder:focus-visible {
  outline: 3px solid var(--desk-focus);
  outline-offset: 4px;
}

.mini-folder__tab {
  position: absolute;
  top: -26px;
  inset-inline-start: 0;
  height: 27px;
  padding: 5px 14px 0;
  font-family: var(--font-display);
  font-size: 0.8125rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: var(--kraft);
  border-radius: 6px 6px 0 0;
}

.mini-folder__title {
  font-family: var(--font-display);
  font-size: var(--t-4);
  font-weight: 800;
  line-height: 1.05;
  text-transform: uppercase;
}

.mini-folder:hover .mini-folder__title {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.12em;
}

.mini-folder__meta {
  font-family: var(--font-display);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: var(--track-caps);
  text-transform: uppercase;
}

/* With a cover: the photo pinned at the left, the label beside it. */
.mini-folder--photo {
  display: grid;
  grid-template-columns: minmax(6.5rem, min(36%, 18rem)) minmax(0, 1fr);
  align-items: center;
  gap: var(--s-4) clamp(var(--s-4), 2.4vw, var(--s-6));
  padding: var(--s-5) clamp(var(--s-4), 2.4vw, var(--s-6)) var(--s-5);
}

.mini-folder__photo {
  display: block;
  padding: 6px 6px 20px;
  background: var(--paper);
  box-shadow: var(--pin-shadow);
  transform: rotate(-3deg);
}

.mini-folder__photo img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.mini-folder__body {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  min-width: 0;
}

.mini-folder__tagline {
  font-size: var(--t-1);
  font-style: italic;
  line-height: 1.45;
}

/* A folder alone on a wide row gets the larger type of a library folder. */
@container mini (min-width: 40rem) {
  .mini-folder__title {
    font-size: var(--t-5);
  }

  .mini-folder__tagline {
    font-size: var(--t-2);
  }
}

/* ------------------------------------------------------------------ */
/* Calls to action                                                     */
/* ------------------------------------------------------------------ */
.cta {
  margin: 0;
}

.cta.stack > .btn {
  width: 100%;
}

/* ------------------------------------------------------------------ */
/* Long-form text on sheets                                            */
/* ------------------------------------------------------------------ */
.prose > * {
  max-width: var(--measure);
  margin-block: 0;
}

.prose > * + * {
  margin-top: var(--s-4);
}

.prose > h2 {
  margin-top: var(--s-7);
  font-size: var(--t-4);
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.prose > h3 {
  margin-top: var(--s-6);
  font-size: var(--t-3);
}

.prose > h2:first-child,
.prose > h3:first-child,
.sheet--clip > h2:first-child {
  margin-top: 0;
}

.prose > :is(h2, h3) + * {
  margin-top: var(--s-3);
}

.prose h2[id],
.prose h3[id] {
  scroll-margin-top: var(--s-5);
}

.prose ul,
.prose ol {
  padding-inline-start: 1.4em;
}

.prose li + li {
  margin-top: var(--s-2);
}

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

.prose ol > li::marker {
  font-family: var(--font-mono);
  font-size: 0.85em;
}

.prose dt {
  margin-top: var(--s-4);
  font-family: var(--font-display);
  font-size: var(--t-2);
  font-weight: 800;
  letter-spacing: 0.01em;
}

.prose dt:first-child {
  margin-top: 0;
}

.prose dd {
  margin: var(--s-1) 0 0;
  padding-inline-start: var(--s-4);
  border-inline-start: 2px solid var(--rule);
}

.prose .cta {
  margin-top: var(--s-6);
}

/* A short sheet that runs in two columns on wide desks. */
@media (min-width: 64rem) {
  .sheet--cols {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--s-4) clamp(var(--s-6), 4vw, 64px);
  }

  .sheet--cols > h2 {
    grid-column: 1 / -1;
  }

  /* Out-ranks .prose > :is(h2, h3) + *, so the first column does not keep
     a top margin the second lacks: both columns start on one line. */
  .sheet--cols.prose > * + * {
    margin-top: 0;
  }
}

/* About and privacy: the title on the desk beside one long sheet. */
.spread {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--s-7) clamp(var(--s-6), 5vw, 88px);
  align-items: start;
}

/* A sheet is as wide as its text plus margins, never a wide strip of
   blank paper; the desk beside it takes the rest. */
.spread,
.manual {
  --sheet-max: calc(var(--measure) + 2 * clamp(18px, 4vw, 60px));
}

@media (min-width: 64rem) {
  .spread {
    grid-template-columns: minmax(18rem, 1fr) minmax(0, var(--sheet-max));
  }

  .spread > .hero {
    position: sticky;
    top: var(--s-5);
    padding-top: var(--s-5);
  }

  .spread > .hero h1 {
    font-size: var(--t-6);
  }
}

/* How to play: an index card of contents beside the field manual. */
.manual {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--s-7) clamp(var(--s-6), 4vw, 72px);
  align-items: start;
}

.manual__toc {
  max-width: 24rem;
  transform: rotate(-1deg);
}

.manual__toc ol {
  margin: var(--s-2) 0 0;
  padding-inline-start: 1.9em;
}

.manual__toc li {
  border-bottom: 1px solid var(--rule);
}

.manual__toc li::marker {
  font-family: var(--font-mono);
  font-size: 0.8em;
  color: var(--ink-muted);
}

.manual__toc a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding-block: 0.2em;
}

@media (min-width: 64rem) {
  .manual {
    grid-template-columns: minmax(15rem, 22rem) minmax(0, var(--sheet-max));
  }

  .manual__toc {
    position: sticky;
    top: var(--s-5);
    max-height: calc(100vh - 2 * var(--s-5));
    overflow-y: auto;
  }
}

/* ------------------------------------------------------------------ */
/* Leaderboard: typed ledger pages                                     */
/* ------------------------------------------------------------------ */
.lb-chooser {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-4) var(--s-6);
}

.lb-form {
  flex: 0 1 30rem;
  align-items: flex-end;
  gap: var(--s-3);
  transform: rotate(-0.8deg);
}

.lb-form .field {
  flex: 1 1 14rem;
}

.lb-form .field > label {
  font-weight: 800;
  letter-spacing: var(--track-caps);
  text-transform: uppercase;
}

.lb-links {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
}

.lb-links a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  color: var(--ink);
  text-decoration-color: var(--brass);
}

.lb-boards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 30rem), 1fr));
  gap: var(--s-7) clamp(var(--s-6), 4vw, 64px);
  align-items: start;
}

.ledger {
  --gap: var(--s-3);
  padding-inline: clamp(14px, 3vw, 40px);
}

.ledger:nth-child(2) {
  transform: rotate(0.4deg);
}

.ledger > h2 {
  font-size: var(--t-4);
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Blank ruled rows under the entries, as on an unused ledger page. */
.ledger::after {
  content: "";
  display: block;
  height: 6rem;
  background: repeating-linear-gradient(to bottom, transparent 0 calc(2rem - 1px), var(--rule) calc(2rem - 1px) 2rem);
}

.lb-scroll {
  max-width: 100%;
  overflow-x: auto;
}

.lb-table {
  width: 100%;
  font-size: var(--t-1);
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
}

.lb-table th {
  padding: var(--s-2) var(--s-3);
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: var(--track-caps);
  text-transform: uppercase;
  white-space: nowrap;
  vertical-align: bottom;
  color: var(--ink-muted);
  border-bottom: 3px double var(--paper-ink);
}

.lb-table td {
  padding: var(--s-2) var(--s-3);
  vertical-align: baseline;
  border-bottom: 1px solid var(--rule);
}

.lb-table td.num,
.lb-table th.num {
  text-align: end;
  white-space: nowrap;
}

.lb-table td.num {
  font-family: var(--font-mono);
  font-size: 0.875rem;
}

/* The red margin rule of a ledger, after the rank column. */
.lb-table th:first-child,
.lb-table td:first-child {
  width: 3.5rem;
  border-inline-end: 1px solid var(--string);
}

.lb-table tbody tr:nth-child(-n + 3) td:first-child {
  font-weight: 700;
  color: var(--wax);
}

.lb-table tbody tr:hover {
  background: var(--paper-2);
}

.lb-table tr[aria-current="true"],
.lb-table tr.is-you {
  background: var(--paper-2);
  box-shadow: inset 3px 0 0 var(--wax);
}

/* The nickname column truncates rather than stretching the table. */
.lb-table .lb-name {
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lb-table .lb-room {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  letter-spacing: 0.08em;
}

.lb-empty {
  padding: var(--s-6) var(--s-4);
  text-align: center;
  color: var(--ink-muted);
}

[data-lb-status] {
  margin: 0;
  font-style: italic;
}

@media (max-width: 40rem) {
  .lb-table th,
  .lb-table td {
    padding-inline: var(--s-2);
  }

  .lb-table .lb-optional {
    display: none;
  }
}

/* "How the order is decided": the rules run in two columns on a wide
   desk, so the sheet is not a full-width strip with its text on the left. */
@media (min-width: 64rem) {
  .lb-rules > ul {
    max-width: none;
    columns: 2;
    column-gap: clamp(var(--s-6), 4vw, 64px);
  }

  .lb-rules > ul > li {
    break-inside: avoid;
  }

  .prose.lb-rules li + li {
    margin-top: 0;
  }

  .lb-rules > ul > li {
    padding-bottom: var(--s-2);
  }
}

/* Older class kept for any markup that still uses it. */
.lb-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--s-4);
}

/* ------------------------------------------------------------------ */
/* 404: a misfiled card                                                */
/* ------------------------------------------------------------------ */
.misfiled {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--s-7) clamp(var(--s-6), 5vw, 88px);
  align-items: start;
}

@media (min-width: 60rem) {
  .misfiled {
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    padding-top: var(--s-5);
  }
}

.misfiled__card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--s-4);
  padding: var(--s-6) clamp(18px, 3.4vw, 48px) var(--s-6);
  transform: rotate(-1.4deg);
}

.misfiled__card > * {
  margin: 0;
}

/* The open cases on the 404 sheet are links in their own right: 44 px tall. */
.misfiled__list a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
}

.prose .misfiled__list li + li {
  margin-top: 0;
}

.misfiled__card .label-tab {
  transform: none;
}

.misfiled__card h1 {
  max-width: 16ch;
  padding-bottom: var(--s-3);
  font-size: var(--t-6);
  font-weight: 800;
  line-height: 0.98;
  text-transform: uppercase;
  border-bottom: 2px solid var(--string);
}

.misfiled__stamp {
  position: absolute;
  top: var(--s-5);
  inset-inline-end: clamp(12px, 3vw, 36px);
  padding: 0.25em 0.6em 0.2em;
  font-family: var(--font-display);
  font-size: clamp(0.9rem, 0.8rem + 0.5vw, 1.25rem);
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--wax);
  border: 3px double var(--wax);
  transform: rotate(9deg);
}

@media (max-width: 30rem) {
  .misfiled__stamp {
    position: static;
    align-self: flex-end;
    margin-top: calc(var(--s-3) * -1) !important;
  }
}

/* ------------------------------------------------------------------ */
/* Desk Notes: index cards on the desk, and one typed article          */
/* ------------------------------------------------------------------ */
.page-notes .site-main,
.page-note .site-main {
  --lamp-x: 64%;
  --lamp-y: 280px;
}

/* The list: one index card per note. The title link stretches over the
   whole card; the cards sit slightly askew, as papers do on a desk. */
.note-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 21rem), 1fr));
  gap: var(--s-6) clamp(var(--s-5), 2.6vw, 40px);
  margin: 0;
  padding: 0;
  list-style: none;
}

.notes-index .note-cards {
  grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 90rem) {
  .notes-index .note-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.note-card {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  padding-bottom: var(--s-5);
}

.note-cards > .note-card:nth-child(3n + 1) { transform: rotate(-0.5deg); }
.note-cards > .note-card:nth-child(3n + 2) { transform: rotate(0.4deg); }
.note-cards > .note-card:nth-child(3n) { transform: rotate(-0.2deg); }

.note-card > * {
  margin: 0;
}

.note-card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--s-1) var(--s-4);
  padding-bottom: var(--s-2);
  font-family: var(--font-display);
  font-size: var(--t-0);
  font-weight: 800;
  letter-spacing: var(--track-caps);
  text-transform: uppercase;
  border-bottom: 2px solid var(--string);
}

.note-card__meta time,
.note-card__time {
  font-family: var(--font-mono);
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}

/* The card's red rule is under its kind and date, so the title drops the
   index card's own heading rule and capitals. */
.index-card.note-card > .note-card__title {
  padding-bottom: 0;
  font-family: var(--font-display);
  font-size: var(--t-4);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: 0.005em;
  text-transform: none;
  text-wrap: balance;
  border-bottom: 0;
}

.note-card__link {
  color: var(--ink);
  text-decoration: none;
}

.note-card__link::after {
  content: "";
  position: absolute;
  inset: 0;
}

.note-card:hover .note-card__link,
.note-card__link:focus-visible {
  text-decoration: underline;
  text-decoration-color: var(--string);
  text-decoration-thickness: 2px;
}

.note-card:has(.note-card__link:focus-visible) {
  outline: 3px solid var(--desk-focus);
  outline-offset: 4px;
}

.note-card__link:focus-visible {
  outline: none;
}

.note-card__desc {
  max-width: 60ch;
}

.note-card__time {
  margin-top: auto;
  padding-top: var(--s-2);
  font-size: var(--t-0);
  color: var(--ink-muted);
}

@media (prefers-reduced-motion: no-preference) {
  .note-card {
    transition: box-shadow 160ms ease, translate 160ms ease;
  }

  .note-card:hover {
    translate: 0 -3px;
    box-shadow: var(--prop-shadow-lift);
  }
}

/* A draft in a preview build: a wax-red stamp. */
.note-draft {
  margin-inline-start: auto;
  font-family: var(--font-display);
  font-size: var(--t-0);
  letter-spacing: var(--track-caps);
  text-transform: uppercase;
}

.note-hero .note-draft {
  align-self: flex-start;
  margin-inline-start: 0;
  color: var(--note-pink);
}

/* The feed link: a short typed line on the wood under the lede. */
.note-feed {
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
  font-size: var(--t-1);
}

.note-feed a {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: var(--tap);
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: var(--track-caps);
  text-transform: uppercase;
  color: var(--ink);
  text-decoration-color: var(--brass);
}

.note-empty {
  margin: 0;
}

/* One note: the title and its facts on the desk beside the typed sheet. */
.note-hero h1 {
  max-width: 18ch;
  font-size: var(--t-5);
  line-height: 1;
  text-wrap: balance;
}

@media (min-width: 64rem) {
  .spread > .note-hero h1 {
    font-size: var(--t-5);
  }
}

.note-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-1) var(--s-4);
  font-family: var(--font-mono);
  font-size: var(--t-0);
  color: var(--ink);
}

.note-article > figure,
.note-article > blockquote,
.note-article > .note-play {
  max-width: var(--measure);
}

.note-article blockquote {
  margin-inline: 0;
  padding-inline-start: var(--s-5);
  font-style: italic;
  border-inline-start: 3px solid var(--string);
}

.note-article blockquote > * {
  margin: 0;
}

.note-article blockquote > * + * {
  margin-top: var(--s-3);
}

.note-article code {
  padding: 0.05em 0.3em;
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--wash);
  border-radius: 2px;
}

/* A photograph clipped to the sheet, its caption typed underneath. */
.note-figure {
  margin-inline: 0;
}

.note-figure img {
  display: block;
  max-width: 100%;
  height: auto;
  padding: 10px 10px 12px;
  background: var(--paper-2);
  box-shadow: var(--pin-shadow);
}

.note-figure figcaption {
  margin-top: var(--s-2);
  font-size: var(--t-0);
  color: var(--ink-muted);
}

/* A place the owner still has to write: only drafts show it. */
.owner-note {
  padding: 0.1em 0.4em;
  font-family: var(--font-hand-a);
  font-size: 1.2em;
  color: var(--paper-ink);
  background: var(--note-yellow);
  outline: 2px dashed var(--wax);
}

/* The closing slip: which case to open next. */
.note-article > .note-play {
  margin-top: var(--s-7);
  padding-top: var(--s-5);
  border-top: 2px dashed var(--rule);
}

.note-play > * {
  margin: 0;
}

.note-play > * + * {
  margin-top: var(--s-3);
}

.prose .note-play__title {
  margin-top: 0;
  font-family: var(--font-display);
  font-size: var(--t-2);
  font-weight: 800;
  letter-spacing: var(--track-caps);
  text-transform: uppercase;
}

.note-play__list {
  display: flex;
  flex-direction: column;
  gap: var(--s-5);
  padding: 0;
  list-style: none;
}

.prose .note-play__list li + li {
  margin-top: 0;
}

.note-play__case {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--s-1) var(--s-3);
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--t-3);
  font-weight: 800;
}

.note-play__number,
.note-play__facts {
  font-family: var(--font-mono);
  font-size: var(--t-0);
  font-weight: 400;
  color: var(--ink-muted);
}

.note-play__actions {
  margin: var(--s-3) 0 0;
}

.note-more .note-cards {
  max-width: 100%;
}

.note-more__all {
  margin: 0;
}

.note-more__all a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: var(--track-caps);
  text-transform: uppercase;
  color: var(--ink);
  text-decoration-color: var(--brass);
}

/* ------------------------------------------------------------------ */
/* Footer: the front edge of the desk                                  */
/* ------------------------------------------------------------------ */
.site-footer {
  display: flex;
  flex-direction: column;
  gap: var(--s-5);
  padding: var(--s-6) var(--desk-gutter) var(--s-6);
  font-size: var(--t-1);
  color: var(--ink-muted);
  background-color: var(--frame);
  background-image: var(--grain);
  border-top: 4px solid var(--wood-2);
  box-shadow:
    inset 0 2px 0 color-mix(in srgb, var(--paper) 10%, transparent),
    inset 0 18px 22px -14px rgb(var(--shade) / 0.7);
}

.site-footer > * {
  width: 100%;
  max-width: var(--desk-max);
  margin: 0 auto;
}

.site-footer__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4) var(--s-7);
}

.site-footer__plate {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--s-3);
}

.site-footer__plate > p {
  margin: 0;
}

/* Brass name plate with two screws. */
.brand-plate {
  position: relative;
  padding: 0.55em 2em 0.5em;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--paper-ink);
  background: var(--brass);
  border-radius: 2px;
  box-shadow: inset 0 0 0 1px rgb(var(--shade) / 0.3), 0 2px 3px rgb(var(--shade) / 0.5);
}

.brand-plate::before,
.brand-plate::after {
  content: "";
  position: absolute;
  top: 50%;
  inset-inline-start: 9px;
  width: 7px;
  height: 7px;
  margin-top: -3.5px;
  border-radius: 50%;
  background: var(--kraft-dark);
  box-shadow: inset 0 1px 1px rgb(var(--shade) / 0.55);
}

.brand-plate::after {
  inset-inline-start: auto;
  inset-inline-end: 9px;
}

.site-footer nav ul {
  gap: 0 var(--s-5);
}

.site-footer a {
  color: var(--ink);
  text-decoration-color: var(--brass);
}

.site-footer nav a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
}

.site-footer__small {
  font-size: var(--t-0);
  overflow-wrap: anywhere;
}

@media (max-width: 699px) {
  .site-nav a {
    min-height: var(--tap);
  }
}

/* The contact address is a real tap target (about 44 px tall): vertical
   padding on an inline link grows the hit area without making its line
   taller, so the small print keeps even spacing. */
.site-footer__small a {
  padding-block: 12px;
}

/* ------------------------------------------------------------------ */
/* Motion preferences                                                  */
/* ------------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  .case-folder,
  .mini-folder {
    transition: none;
  }

  .case-folder:hover,
  .case-folder:focus-within {
    transform: rotate(var(--tilt));
  }

  .mini-folder:hover,
  .mini-folder:focus-visible {
    transform: rotate(-0.8deg);
  }
}

/* ------------------------------------------------------------------ */
/* Print                                                               */
/* ------------------------------------------------------------------ */
@media print {
  body.site {
    display: block;
  }

  .site-header,
  .site-main,
  .site-footer {
    padding-inline: 0;
    background: none;
    box-shadow: none;
    border: 0;
  }

  .site-nav,
  .site-footer nav,
  .polaroid,
  .wall,
  .wax-seal,
  .prop,
  .note,
  .cta {
    display: none !important;
  }

  .site-main {
    gap: var(--s-5);
    padding-block: var(--s-4);
  }

  .sheet,
  .index-card,
  .case-folder,
  .dossier,
  .step__card,
  .mini-folder,
  .desk-label,
  .dossier__label,
  .dossier__facts,
  .case-folder__sheet,
  body.site .label-tab {
    background: none;
    box-shadow: none;
    transform: none;
  }

  .case-folder,
  .case-facts {
    break-inside: avoid;
  }

  .manual__toc,
  .dossier__cover,
  .spread > .hero,
  .desk-hero__intro {
    position: static;
  }

  .prose a[href^="http"]::after,
  .prose a[href^="mailto:"]::after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
  }
}

/* ------------------------------------------------------------------ */
/* Style guide page (/style-guide.html only)                           */
/* ------------------------------------------------------------------ */
.sg-intro {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}

.sg-toc ol {
  columns: 14rem;
  column-gap: var(--s-6);
  margin: var(--s-3) 0 0;
  padding-inline-start: 1.6em;
}

.sg-toc li {
  break-inside: avoid;
  margin-bottom: var(--s-1);
}

.sg-section {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  scroll-margin-top: var(--s-5);
}

.sg-section > p {
  max-width: var(--measure);
}

/* Each specimen is shown twice: light panel, dark panel. */
.sg-pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--s-4);
}

@media (min-width: 72rem) {
  .sg-pair {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.sg-theme {
  min-width: 0;
  padding: var(--s-5);
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: var(--r);
}

.sg-theme > .label-tab {
  margin-bottom: var(--s-4);
}

.sg-theme--flush {
  padding: 0;
  overflow: hidden;
}

.sg-theme--flush > .label-tab {
  margin: var(--s-4) var(--s-4) 0;
}

.sg-caption {
  font-family: var(--font-display);
  font-size: var(--t-0);
  font-weight: 700;
  letter-spacing: var(--track-caps);
  text-transform: uppercase;
  color: var(--ink-muted);
}

.sg-note {
  font-size: var(--t-1);
  color: var(--ink-muted);
}

.sg-swatches {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 9.5rem), 1fr));
  gap: var(--s-3);
  margin: 0;
  padding: 0;
  list-style: none;
}

.sg-swatch {
  display: flex;
  flex-direction: column;
  min-width: 0;
  font-size: var(--t-0);
  line-height: 1.35;
  background: var(--surface);
  border: 1px solid var(--rule);
}

.sg-swatch > span {
  padding: var(--s-1) var(--s-2);
}

.sg-swatch > span:first-child {
  height: 3.25rem;
  padding: 0;
  border-bottom: 1px solid var(--rule);
}

.sg-swatch code {
  padding: 0;
  font-size: 0.95em;
  background: none;
  border: 0;
}

.sg-c-bg { background: var(--bg); }
.sg-c-surface { background: var(--surface); }
.sg-c-ink { background: var(--ink); }
.sg-c-ink-muted { background: var(--ink-muted); }
.sg-c-rule { background: var(--rule); }
.sg-c-rule-strong { background: var(--rule-strong); }
.sg-c-accent { background: var(--accent); }
.sg-c-on-accent { background: var(--on-accent); }
.sg-c-mark { background: var(--mark); }
.sg-c-on-mark { background: var(--on-mark); }
.sg-c-wash { background: var(--wash); }
.sg-c-mark-wash { background: var(--mark-wash); }
.sg-c-warn { background: var(--warn); }
.sg-c-warn-wash { background: var(--warn-wash); }
.sg-c-paper { background: var(--paper); }
.sg-c-paper-ink { background: var(--paper-ink); }
.sg-c-paper-rule { background: var(--paper-rule); }
.sg-c-pen { background: var(--pen); }
.sg-c-stamp-red { background: var(--stamp-red); }
.sg-c-stamp-blue { background: var(--stamp-blue); }
.sg-c-redact { background: var(--redact); }
.sg-c-newsprint { background: var(--newsprint); }
.sg-c-thermal { background: var(--thermal); }
.sg-c-carbon { background: var(--carbon); }

.sg-type {
  display: grid;
  gap: var(--s-3);
  margin: 0;
}

.sg-type > div {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr);
  align-items: baseline;
  gap: var(--s-3);
  padding-top: var(--s-3);
  border-top: 1px solid var(--rule);
}

.sg-type dt {
  font-family: var(--font-mono);
  font-size: var(--t-0);
  font-weight: 400;
  color: var(--ink-muted);
}

.sg-type dd {
  margin: 0;
  min-width: 0;
  line-height: 1.15;
}

.sg-t-0 { font-size: var(--t-0); }
.sg-t-1 { font-size: var(--t-1); }
.sg-t-2 { font-size: var(--t-2); }
.sg-t-3 { font-size: var(--t-3); }
.sg-t-4 { font-size: var(--t-4); }
.sg-t-5 { font-size: var(--t-5); }
.sg-t-6 { font-size: var(--t-6); }
.sg-t-7 { font-size: var(--t-7); }

.sg-f-display { font-family: var(--font-display); font-weight: 800; }
.sg-f-body { font-family: var(--font-body); }
.sg-f-mono { font-family: var(--font-mono); }
.sg-f-hand-officer { font-family: var(--font-hand-officer); color: var(--pen); }
.sg-f-hand-a { font-family: var(--font-hand-a); color: var(--pen); }
.sg-f-hand-b { font-family: var(--font-hand-b); color: var(--pen); }
.sg-f-hand-c { font-family: var(--font-hand-c); color: var(--pen); }
.sg-f-hand-d { font-family: var(--font-hand-d); color: var(--pen); }
.sg-f-hand-e { font-family: var(--font-hand-e); color: var(--pen); }

.sg-hands {
  display: grid;
  gap: var(--s-3);
  padding: var(--s-4);
  color: var(--paper-ink);
  background: var(--paper);
  border: 1px solid var(--rule);
}

.sg-hands p {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.4;
}

.sg-hands .sg-caption {
  display: block;
  color: var(--paper-muted);
}

.sg-space {
  display: grid;
  gap: var(--s-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.sg-space li {
  display: grid;
  grid-template-columns: 4.5rem auto;
  align-items: center;
  justify-content: start;
  gap: var(--s-3);
  font-family: var(--font-mono);
  font-size: var(--t-0);
  color: var(--ink-muted);
}

.sg-space li > span:last-child {
  height: 12px;
  background: var(--accent);
}

.sg-w-1 { width: var(--s-1); }
.sg-w-2 { width: var(--s-2); }
.sg-w-3 { width: var(--s-3); }
.sg-w-4 { width: var(--s-4); }
.sg-w-5 { width: var(--s-5); }
.sg-w-6 { width: var(--s-6); }
.sg-w-7 { width: var(--s-7); }
.sg-w-8 { width: var(--s-8); }

/* Static rendering of overlays that normally float. */
.sg-dialog {
  position: static;
  display: block;
  width: 100%;
  margin: 0;
  animation: none;
}

.sg-dialog .cluster {
  justify-content: flex-end;
}

.sg-toast {
  animation: none;
}

.sg-skip {
  position: static;
  display: inline-block;
  transform: none;
}

.sg-demo-box {
  padding: var(--s-2) var(--s-3);
  font-family: var(--font-mono);
  font-size: var(--t-0);
  color: var(--ink-muted);
  background: var(--surface);
  border: 1px dashed var(--rule-strong);
}

.sg-brand-file {
  width: 56px;
  height: 56px;
  background: url('/assets/img/brand-mark.svg') center / contain no-repeat;
}

.sg-favicon {
  width: 32px;
  height: 32px;
}

/* Shrink the specimen page frame so it sits inside a panel. */
.sg-frame {
  overflow: hidden;
  background: var(--bg);
  border: 1px solid var(--rule);
}

.sg-frame .site-header,
.sg-frame .site-main,
.sg-frame .site-footer {
  padding-inline: var(--s-4);
}

.sg-frame .site-main {
  gap: var(--s-6);
  padding-block: var(--s-5);
}

.sg-frame .site-header {
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "brand toggle"
    "nav nav";
}

.sg-frame .site-header .site-nav > ul {
  justify-content: flex-start;
  margin-inline-start: calc(var(--s-2) * -1);
}

.sg-frame .hero {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: none;
}

.sg-frame .hero h1 {
  font-size: var(--t-6);
}

.sg-frame .hero:has(> .hero__visual) > .hero__visual {
  grid-column: 1;
  grid-row: auto;
}
