/*
 * 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: url('/assets/img/desk/walnut-surface.webp');
  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, .analytics-choice) {
  --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%),
    linear-gradient(rgb(var(--shade) / .2), rgb(var(--shade) / .36)),
    var(--grain);
  background-size: auto, auto, 384px 384px;
  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));
  }
}

.steps-more {
  margin: var(--s-7) 0 0;
  max-width: 60ch;
}

.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 three, 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(220px, 22vw, 310px);
  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 3;
}

.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;
}

/* Four or more cases on wider screens: the photos zigzag over two rows
   (home.mjs wallZigzag). A photo takes the width of 1.64 column steps,
   which is free because its neighbours hang in the other row. The step is
   100% / (n + 1); --n comes from wall--n-N and --i from wall__item--pI (the
   CSP allows no inline styles). home.mjs draws the string with the same
   numbers: rows at 3% and 51%, the card at 0.55 steps and 58%. */
.wall--n-4 { --n: 4; }
.wall--n-5 { --n: 5; }
.wall--n-6 { --n: 6; }
.wall--n-7 { --n: 7; }
.wall--n-8 { --n: 8; }
.wall--n-9 { --n: 9; }
.wall--n-10 { --n: 10; }
.wall--n-11 { --n: 11; }
.wall--n-12 { --n: 12; }
.wall__item--p0 { --i: 0; }
.wall__item--p1 { --i: 1; }
.wall__item--p2 { --i: 2; }
.wall__item--p3 { --i: 3; }
.wall__item--p4 { --i: 4; }
.wall__item--p5 { --i: 5; }
.wall__item--p6 { --i: 6; }
.wall__item--p7 { --i: 7; }
.wall__item--p8 { --i: 8; }
.wall__item--p9 { --i: 9; }
.wall__item--p10 { --i: 10; }
.wall__item--p11 { --i: 11; }

@media (min-width: 40.0625rem) {
  .wall--zigzag {
    container-type: inline-size;
  }

  /* Two rows of photos: a photo is 0.72 of its width tall (96% wide at
     4:3), plus about 75px of frame and caption per row. */
  .wall--zigzag .wall__board {
    display: block;
    height: calc(min(26cqw, calc(164cqw / (var(--n) + 1))) * 1.5 + 170px);
  }

  .wall--zigzag .wall__item {
    position: absolute;
    margin: 0;
    transform: translateX(-50%);
  }

  .wall--zigzag .wall__item--photo {
    left: calc((var(--i) + 1) * 100% / (var(--n) + 1));
    width: min(26%, calc(164% / (var(--n) + 1)));
  }

  .wall--zigzag .wall__item--high { top: 3%; }
  .wall--zigzag .wall__item--mid { top: 51%; }

  .wall--zigzag .wall__item--zz-card {
    top: 58%;
    left: calc(0.55 * 100% / (var(--n) + 1));
    width: calc(90% / (var(--n) + 1));
  }

  .wall--zigzag .wall__item--zz-note {
    left: min(calc((var(--n) + 0.5) * 100% / (var(--n) + 1)), calc(100% - 0.45 * 100% / (var(--n) + 1)));
    width: calc(85% / (var(--n) + 1));
  }

  .wall--zigzag .wall__item--zz-note-top { top: 6%; }
  .wall--zigzag .wall__item--zz-note-bottom { top: 58%; }

  /* The string runs behind the papers, as on a real board: it shows across
     the cork between the photos instead of over their faces. */
  .wall--zigzag .wall__strings { z-index: -1; }

  .wall--zigzag .wall__polaroid { width: 96%; }
  .wall--zigzag .wall__card { width: min(9rem, 100%); }
  .wall--zigzag .wall__note { width: min(9.5rem, 100%); }
}

/* ------------------------------------------------------------------ */
/* 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);
}

.notes-topics {
  margin-block-start: var(--s-6);
}

.notes-topics ul {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3) var(--s-5);
  margin-block-start: var(--s-3);
  padding: 0;
  list-style: none;
}

.notes-group + .notes-group {
  margin-block-start: var(--s-7);
}

.notes-group > h2 {
  margin-block-end: var(--s-5);
}

.note-contents {
  padding-block-end: var(--s-5);
  margin-block-end: var(--s-5);
  border-block-end: 1px solid currentColor;
}

.note-contents__title {
  font-family: var(--font-display);
  font-weight: 800;
}

.note-contents ol {
  margin-block-start: var(--s-3);
  padding-inline-start: 0;
  list-style: none;
}

.note-meta__by a {
  color: inherit;
}

@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/desk-lamp-emblem-dark.webp') 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;
}

/* Night Desk compact navigation: progressive enhancement keeps links available without JS. */
.site-menu-toggle { display: none; }
/* The menu key starts hidden and site.js shows it once its handler is
   attached. Until then (or if the script never loads) the ordinary links
   stay open, so navigation never depends on JavaScript. */
@media (max-width: 700px) and (scripting: enabled) {
  .site-header:has(.site-menu-toggle:not([hidden])[aria-expanded="false"]) > .site-nav { display: none; }
}
@media (max-width: 700px) and (scripting: none) {
  .site-header .site-menu-toggle:not([hidden]) { display: none; }
}
@media (max-width: 700px) {
  .site-header { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px; }
  .brand-mark { margin-inline-end: auto; }
  .site-header .brand-mark__name { font-size: 1rem; }
  .site-menu-toggle:not([hidden]) { display: block; min-height: 44px; padding: 8px; background: transparent; color: inherit; border: 1px solid currentColor; font: inherit; }
  .site-header .lang-switch { margin: 0; }
  .site-header .site-nav { flex-basis: 100%; order: 4; }
  .site-header .site-nav[hidden] { display: none; }
  .site-header .site-nav > ul { display: flex; flex-wrap: wrap; gap: 8px 16px; padding-block: 8px; }
  .page-home .desk-hero__intro { padding-block: 16px; }
  .page-home .desk-hero__intro h1 { font-size: clamp(1.8rem, 7vw, 2.5rem); }
  .page-home .desk-hero__intro .lede { font-size: 1rem; line-height: 1.5; }
  .page-home .desk-hero__more { display: none; }
  .page-home .site-main { padding-block-start: 16px; }
  .page-home .desk-hero { row-gap: 24px; }
  .page-home .desk-hero__intro { gap: 12px; }
  .page-home .desk-hero__intro .cta { margin-block-start: 0; }
}
.desk-hero__short { display: none; }
/* The consent panel is a paper card (paper context above), so it follows every theme. */
.analytics-choice { position: fixed; inset-inline: 16px; bottom: 16px; z-index: 100; max-width: 40rem; max-height: calc(100dvh - 32px); overflow: auto; padding: 16px; color: var(--ink); background: var(--paper); border: 2px solid var(--brass); box-shadow: 0 6px 24px rgb(var(--shade) / 0.55); }
.analytics-choice h2 { margin: 0 0 8px; font-size: 1.25rem; color: inherit; }
.analytics-choice p { margin: 0 0 12px; }
.analytics-choice a { color: inherit; text-decoration: underline; }
.analytics-choice__actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.analytics-choice .btn { min-height: 44px; color: inherit; border: 1px solid currentColor; }
.analytics-preferences { font: inherit; color: inherit; background: none; border: 0; padding: 0; text-decoration: underline; cursor: pointer; }
@media (max-width: 700px) {
  .desk-hero__long { display: none; }
  .desk-hero__short { display: block; }
  .page-home .case-folder--training .case-folder__tagline { display: none; }
}
@media (max-width: 360px) { .site-header .brand-mark__name { display: none; } }

/* Archive refresh: native vectors, CSS light and responsive editorial images. */
.brand-mark__paper { fill: var(--paper); }
.brand-mark__ink { fill: var(--paper-ink); }
.brand-mark__monogram { fill: var(--paper); }
.brand-mark__glyph { width: 36px; height: 36px; }
.brand-mark__name { letter-spacing: 0.16em; }
.site-header { padding-block: 12px; }
.site-nav a { text-underline-offset: 0.45em; }
.site-nav a[aria-current] { text-decoration-thickness: 2px; }
.page-home .desk-hero__intro { gap: 22px; }
.page-home .desk-hero__intro h1 { font-size: clamp(2.8rem, 3.8vw, 4.8rem); max-width: 11ch; }
.page-home .desk-hero__intro .lede { font-size: clamp(1.05rem, 1.2vw, 1.25rem); max-width: 44ch; line-height: 1.65; }
.desk-promise { max-width: 38ch; font-family: var(--font-mono); font-size: 0.72rem; line-height: 1.9; color: var(--brass); }
.page-home .desk-hero__jump { display: inline-flex; }
.page-home .case-folder { border-radius: 3px 8px 8px 5px; }
.archive-invitation { display: grid; grid-template-columns: 1fr minmax(180px, 0.4fr); align-items: center; gap: 48px; padding: clamp(24px, 5vw, 64px); border: 1px solid var(--rule); background: linear-gradient(115deg, rgb(var(--shade) / 0.28), transparent); }
.archive-invitation h2 { font-family: var(--font-display); font-size: clamp(2rem, 3.8vw, 3.7rem); line-height: 1.12; margin-block: 24px 16px; max-width: 22ch; }
.archive-invitation p:not(.label-tab) { max-width: 60ch; margin-block-end: 24px; }
.archive-invitation__files { display: grid; place-items: center; min-width: 0; }
.archive-invitation__files img { display: block; width: 260px; max-width: 100%; height: auto; }
.notes-index { grid-template-columns: minmax(0, 1fr); }
.notes-index > .hero { max-width: 820px; }
.notes-index > .hero h1 { max-width: none; font-size: clamp(3rem, 6vw, 5.5rem); }
.notes-index .note-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px; }
.notes-index .note-card { transform: none; }
.note-card__image { width: 100%; height: auto; aspect-ratio: 1200 / 630; object-fit: cover; border: 5px solid var(--paper); box-shadow: var(--paper-shadow); margin-block-end: 10px; }
.note-card__title { overflow-wrap: anywhere; }
.note-card__kind { color: var(--wax); }
.notes-topics a { display: inline-flex; min-height: 44px; align-items: center; padding-inline: 4px; }
.note-hero { position: sticky; top: 24px; align-self: start; }
.note-hero h1 { font-size: clamp(2rem, 3.1vw, 3rem); line-height: 1.15; }
.note-article { min-width: 0; }
.note-article h2 { scroll-margin-block-start: 28px; padding-block-start: 12px; }
.note-article h3 { line-height: 1.5; }
.note-article > ul:first-of-type { border-block: 1px solid var(--rule); padding-block: 18px; }
.note-figure img { aspect-ratio: 1200 / 630; height: auto; object-fit: cover; }
.note-figure figcaption { line-height: 1.6; }
.note-article a { overflow-wrap: anywhere; }
[dir="rtl"] .note-hero h1, [dir="rtl"] .archive-invitation h2 { line-height: 1.65; letter-spacing: 0; }
[dir="rtl"] .desk-promise { font-size: 0.78rem; line-height: 2; }
[dir="rtl"] .note-card__title { line-height: 1.7; }
@media (max-width: 1100px) { .notes-index .note-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 800px) {
 .note-hero { position: static; }
 .archive-invitation { gap: 24px; grid-template-columns: 1fr; }
 .archive-invitation__files { display: none; }
}
@media (max-width: 700px) {
 .notes-index .note-cards { grid-template-columns: minmax(0, 1fr); gap: 24px; }
 .page-home .desk-hero__intro h1 { font-size: clamp(2.4rem, 10vw, 3rem); max-width: 12ch; }
 .page-home .desk-hero__intro { gap: 14px; }
 .page-home .desk-hero__intro .lede { font-size: 1.05rem; }
 .note-hero h1 { max-width: none; }
 .notes-index > .hero h1 { font-size: 2.6rem; }
 .archive-invitation h2 { margin-block: 20px 12px; }
}
@media print { .note-hero { position: static; } .archive-invitation__files { display: none; } }
.notes-index > .hero { position: static; }
.notes-index > .hero { max-width: none; }
.notes-heading h1 { margin-block: 24px 0; }
.notes-intro { min-width: 0; }
.notes-intro .lede { margin-block-start: 12px; }
@media (min-width: 900px) {
 .notes-index > .hero { display: grid; grid-template-columns: 0.85fr 1.15fr; gap: 16px 56px; align-items: start; }
 .notes-index > .hero .notes-topics { grid-column: 1 / -1; margin-block-start: 8px; }
 .notes-intro .lede { font-size: 1.15rem; }
 .notes-intro > p { margin-block-start: 12px; }
 .page-note .note-contents ol { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 20px; }
}

/* Ivory wordmark for the dark header and footer. */
.brand-mark__wordmark { display: block; width: 132px; height: auto; max-width: 100%; }
.site-header .brand-mark { flex-shrink: 0; }
.brand-mark:hover { opacity: .86; }
@media (max-width: 700px) { .brand-mark__wordmark { width: 112px; } }

/* Archive photographs retain their full frame, including portrait and document formats. */
.note-figure--archive { margin-block: 2.5rem; }
.note-figure--archive img { width: auto; max-width: 100%; max-height: 620px; height: auto; aspect-ratio: auto; object-fit: contain; margin-inline: auto; padding: 8px; }
.note-figure__zoom { display: block; width: fit-content; max-width: 100%; margin-inline: auto; cursor: zoom-in; }
.note-figure__zoom:focus-visible { outline: 3px solid var(--wax); outline-offset: 5px; }
.note-figure--archive figcaption { font-family: var(--font-body); font-size: .78rem; line-height: 1.7; max-width: 65ch; margin: .8rem auto 0; }
.note-figure--archive figcaption a { text-underline-offset: .18em; overflow-wrap: anywhere; }
.note-article--casefile > h2 { margin-block-start: 2.4rem; padding-block-start: 1.25rem; border-block-start: 1px solid var(--rule); }
.note-article--casefile > h2 + ul { border-inline-start: 3px solid var(--wax); padding: .8rem 1.4rem; background: var(--wash); list-style: none; }
.note-article--casefile > h2 + ul li { padding-block: .3rem; }
.note-card__image { object-fit: contain; background: #ddd1ba; }
@media (max-width: 700px) {
 .note-figure--archive img { max-height: 510px; padding: 5px; }
 .note-figure--archive figcaption { font-size: .75rem; }
 .note-article--casefile > h2 + ul { padding-inline: .85rem; }
}
.note-article--casefile > .note-figure:first-child { margin-block-start: 0; margin-block-end: 2rem; }
.note-article--casefile > .note-figure:first-child img { max-height: 510px; }
@media (max-width: 700px) { .note-article--casefile > .note-figure:first-child img { max-height: 430px; } }
.site-footer__wordmark { width: fit-content; margin-block-end: 1rem; }
.site-footer__wordmark .brand-mark__wordmark { width: 160px; }
.note-article--casefile > .note-figure:first-child .note-figure__zoom { width: 100%; }
.note-article--casefile > .note-figure:first-child img { min-width: min(300px, 100%); }

/* UI refinement: quiet brass outlines, generous targets and clear hierarchy. */
.site-nav a { display: inline-flex; align-items: center; gap: 8px; border-radius: 3px; }
.site-nav a .ui-icon { opacity: .72; }
.site-nav a[aria-current] .ui-icon { opacity: 1; color: var(--accent); }
.site-menu-toggle:not([hidden]) { align-items: center; justify-content: center; gap: 8px; }
.btn { gap: 9px; border-radius: 3px; }
.btn .ui-icon { width: 18px; height: 18px; }
.btn:focus-visible, .site-nav a:focus-visible, .archive-clear:focus-visible,
.note-card:focus-within { outline: 3px solid var(--focus); outline-offset: 4px; }
.case-facts dt { display: flex; align-items: center; gap: 6px; }
.case-facts dt .ui-icon { opacity: .7; }
.case-folder { transition: box-shadow .16s ease; }
.case-folder:focus-within { outline: 2px solid var(--focus); outline-offset: 6px; }
.case-folder .cta { gap: 10px 16px; }
.case-folder .btn--quiet { font-size: .875rem; }
.note-card__time, .note-feed > a { display: inline-flex; align-items: center; gap: 7px; }
.note-card { border-radius: 4px; }
.note-card__image { border-radius: 2px; }
.note-card__title a { text-decoration-thickness: 1px; text-underline-offset: .15em; }
.note-card:hover .note-card__title a { text-decoration: underline; }
.notes-topics ul { gap: 8px; }
.notes-topics a { padding: 8px 14px; border: 1px solid var(--rule); border-radius: 30px; font-size: .9375rem; text-decoration: none; }
.notes-topics a:hover, .notes-topics a:focus-visible { color: var(--bg); background: var(--accent); border-color: var(--accent); }
.archive-tools { display: block; max-width: 560px; }
.archive-search { width: 100%; }
.archive-search label { display: block; margin-block-end: 9px; font-family: var(--font-display); font-weight: 700; font-size: 1rem; }
.archive-search__field { display: flex; align-items: center; gap: 12px; min-height: 52px; padding-inline: 16px 4px; border: 1px solid var(--brass); border-radius: 5px; background: var(--paper); color: var(--paper-ink); }
.archive-search__field:focus-within { outline: 3px solid var(--focus); outline-offset: 3px; }
.archive-search input { flex: 1; width: 100%; min-width: 0; padding-block: 13px; border: 0; background: transparent; color: inherit; font: inherit; font-size: 1rem; outline: none; }
.archive-search input::placeholder { color: var(--paper-ink); opacity: .65; }
.archive-search input::-webkit-search-cancel-button { display: none; }
.archive-clear { display: grid; place-items: center; width: 44px; height: 44px; flex: none; border: 0; border-radius: 3px; color: inherit; background: transparent; cursor: pointer; }
.archive-clear:hover { background: var(--kraft); }
.archive-results { margin: 8px 0 0; font-size: .9rem; color: var(--ink-muted); }
.archive-empty { padding: 32px; text-align: center; color: var(--paper-ink); }
.archive-empty > .ui-icon { color: var(--wax); margin-block-end: 12px; }
.archive-empty h2 { margin-block: 0 12px; }
.archive-empty .btn { margin-block-start: 12px; }
.note-contents summary { display: flex; align-items: center; gap: 10px; min-height: 48px; margin: 0; cursor: pointer; list-style: none; }
.note-contents summary::-webkit-details-marker { display: none; }
.note-contents summary::after { content: '+'; margin-inline-start: auto; font-size: 1.4rem; font-weight: 400; }
.note-contents[open] summary::after { content: '−'; }
.note-contents ol a { display: inline-block; padding-block: 6px; }
.note-contents:not([open]) { padding-block: 8px; }
.note-figure--archive figcaption { font-size: .875rem; line-height: 1.8; }
.reading-top { display: flex; justify-content: end; border-block-start: 1px solid var(--rule); padding-block-start: 20px; margin-block-start: 32px; }
.reading-top a { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-size: .95rem; }
@media (min-width: 701px) and (max-width: 1199px) { .site-nav a > .ui-icon { display: none; } }
@media (max-width: 700px) {
 .site-menu-toggle:not([hidden]) { display: inline-flex; }
 .site-header .site-nav > ul { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; padding: 12px 0 4px; margin: 0; }
 .site-nav a { display: flex; min-height: 48px; padding: 10px 12px; border: 1px solid var(--rule); background: var(--wash); font-size: .95rem; letter-spacing: .025em; }
 .site-nav a[aria-current] { border-color: var(--brass); }
 .site-nav a .ui-icon { width: 19px; height: 19px; }
 .case-folder .cta .btn--primary { flex: 1; justify-content: center; }
 .note-contents ol a { padding-block: 8px; }
}
@media (max-width: 700px) and (scripting: none) { .site-header .site-menu-toggle:not([hidden]) { display: none; } }
@media (scripting: none) { .archive-tools { display: none; } }
@media (prefers-reduced-motion: reduce) { .case-folder { transition: none; } }
@media print { .archive-tools, .reading-top { display: none; } }
@media (max-width: 420px) {
 .site-menu-toggle:not([hidden]) { width: 44px; min-width: 44px; padding: 8px; }
 .site-menu-toggle > span { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}
.site-nav a[aria-current] > .ui-icon { color: inherit; }
.note-card > .note-card__time { margin-block-start: auto; padding-block-start: 8px; }
/* The leading photo reserves its own shape before archival pixels arrive:
   reverting aspect-ratio restores the ratio from the img width/height
   attributes, so landscape maps get no empty band and tall portraits are
   capped and contained whole. */
.note-article--casefile > .note-figure:first-child .note-figure__zoom { display: block; width: 100%; }
.note-article--casefile > .note-figure:first-child img { display: block; width: 100%; height: auto; min-width: 0; max-height: 510px; aspect-ratio: revert-layer; object-fit: contain; }
@media (max-width: 700px) { .note-article--casefile > .note-figure:first-child img { max-height: min(430px, 112vw); } }

/* Illustrated desk objects: paper layers, twine, carved wood and impressed wax. */
.desk-prop { display: block; width: 210px; max-width: 80%; height: auto; align-self: center; margin-block: 0 4px; }
.desk-seal { width: 68px; height: 68px; border: 0; background: none; filter: none; }
@media (max-width: 700px) { .desk-prop { width: 184px; } .desk-seal { width: 62px; height: 62px; } }

/* Reading polish: measured headings, aligned cards and quiet paper edges. */
.page-home .desk-hero__intro h1 { font-size: clamp(2.8rem, 3.6vw, 4rem); max-width: 14ch; text-wrap: balance; }
.page-home .desk-hero__intro { gap: 18px; }
.page-home .folders { align-items: stretch; row-gap: 54px; }
.case-folder__sheet { flex: 1; }
.case-folder .cta { align-items: center; }
.site-main :is(.sheet, .index-card, .step__card) { border: 1px solid color-mix(in srgb, var(--paper-ink) 13%, var(--paper)); border-radius: 2px; }
.notes-heading h1 { margin-block-start: 16px; }
.notes-index > .hero { row-gap: 24px; }
.notes-index > .hero h1 { font-size: clamp(2.6rem, 5vw, 4.5rem); }
.notes-index .note-cards { gap: 28px; align-items: stretch; }
.index-card.note-card { gap: 14px; padding: 20px 20px 22px; }
.index-card.note-card > .note-card__title { font-size: clamp(1.35rem, 1.8vw, 1.65rem); line-height: 1.18; }
.note-card__meta { gap: 6px 16px; padding-block-end: 10px; }
.note-card > .note-card__time { border-block-start: 1px solid var(--rule); padding-block-start: 12px; }
.note-hero { gap: 20px; }
.note-meta { gap: 8px 16px; line-height: 1.7; }
.note-article .note-contents { padding-block-end: 20px; }
.note-article .note-contents ol a { text-decoration-thickness: 1px; text-underline-offset: .2em; }
.dossier__pages > .sheet { transform: none; }
.case-facts { column-gap: 18px; }
.site-main :is(h1, h2, h3) { overflow-wrap: break-word; }
body.site :is(h1, h2, h3):lang(ar) { line-height: 1.55; letter-spacing: 0; }
.site-main :is(.hero h1, .dossier__label h1, .case-folder h3, .mini-folder__title, .index-card.note-card > .note-card__title):lang(ar) { line-height: 1.55; letter-spacing: 0; text-transform: none; }
.hero:not(.note-hero) h1:lang(ar) { font-size: clamp(2rem, 3.3vw, 3.75rem); max-width: 20ch; }
.page-home .desk-hero__intro h1:lang(ar) { font-size: clamp(2.25rem, 2.9vw, 3rem); max-width: 16ch; line-height: 1.5; letter-spacing: 0; }
.case-folder h3:lang(ar) { font-size: clamp(1.65rem, 2.15vw, 2.05rem); }
.dossier__label h1:lang(ar) { font-size: clamp(2rem, 3vw, 3rem); }
.index-card.note-card > .note-card__title:lang(ar) { font-size: clamp(1.25rem, 1.6vw, 1.5rem); }
.note-hero h1:lang(ar) { font-size: clamp(1.8rem, 2.5vw, 2.5rem); max-width: 23ch; line-height: 1.6; }
.site-main :is(.prose h2, .prose h3, .step__card h3):lang(ar) { line-height: 1.6; letter-spacing: 0; }
.case-facts dd:lang(ar) { line-height: 1.8; }
body.site :is(.btn, .site-nav a):lang(ar) { line-height: 1.65; letter-spacing: 0; }
@media (max-width: 700px) {
 .page-home .desk-hero__intro h1 { font-size: clamp(2rem, 9vw, 2.65rem); max-width: 16ch; }
 .page-home .desk-hero__intro h1:lang(ar) { font-size: clamp(1.8rem, 8vw, 2.25rem); max-width: none; }
 .page-home .desk-hero__intro { gap: 12px; padding-block: 10px; }
 .page-home .desk-hero { row-gap: 28px; }
 .page-home .folders { row-gap: 42px; }
 .notes-index > .hero h1 { font-size: 2.35rem; }
 .notes-index > .hero h1:lang(ar) { font-size: 2rem; }
 .index-card.note-card { padding: 18px; }
 .index-card.note-card > .note-card__title { font-size: 1.4rem; }
 .index-card.note-card > .note-card__title:lang(ar) { font-size: 1.3rem; }
 .note-hero { gap: 16px; }
 .note-hero h1:lang(ar) { font-size: 1.8rem; }
 .dossier__cover { gap: 20px; }
 .dossier__cover > .cta { width: 100%; }
 .dossier__cover > .cta > .btn--primary { flex: 1; justify-content: center; }
 .dossier__label h1:lang(ar) { font-size: 2rem; }
}

/* Quiet natural materials; live labels, links and folder states stay semantic. */
.case-folder, .dossier, .mini-folder, .case-folder__tab, .dossier__tab {
 background-image: linear-gradient(135deg, rgb(255 255 255 / .16), transparent 60%), url('/assets/img/desk/paper-fibers.webp');
 background-size: auto, 256px 256px;
 background-blend-mode: normal, soft-light;
}
.case-folder { border: 1px solid color-mix(in srgb, var(--kraft-dark) 65%, var(--kraft)); border-radius: 2px 9px 7px 3px; box-shadow: inset 0 1px 0 rgb(255 255 255 / .22), -3px 4px 0 var(--kraft-dark), 0 12px 22px -9px rgb(var(--shade) / .5); }
.case-folder:hover, .case-folder:focus-within { box-shadow: inset 0 1px 0 rgb(255 255 255 / .22), -3px 5px 0 var(--kraft-dark), 0 15px 25px -9px rgb(var(--shade) / .55); }
.case-folder__sheet { border-top: 1px solid color-mix(in srgb, var(--paper) 70%, var(--kraft)); box-shadow: 1px 2px 0 var(--paper-2), 0 4px 9px rgb(var(--shade) / .17); }
.archive-invitation { grid-template-columns: minmax(0, .88fr) minmax(0, 1.12fr); gap: 36px; border-radius: 6px; background: linear-gradient(115deg, rgb(var(--shade) / .22), rgb(var(--shade) / .05)); box-shadow: inset 0 1px 0 rgb(255 255 255 / .04); }
.archive-invitation > div { min-width: 0; }
.archive-invitation__files { width: 100%; justify-self: center; }
.archive-invitation__files picture { display: block; width: 100%; max-width: 600px; }
.archive-invitation__files img { display: block; width: 100%; max-width: none; height: auto; }
.archive-invitation h2 { max-width: 18ch; }
@media (max-width: 800px) {
 .archive-invitation { grid-template-columns: minmax(0, 1fr); gap: 14px; padding: 24px; }
 .archive-invitation__files { display: grid; grid-row: 1; max-width: 480px; }
 .archive-invitation__files picture { max-width: 100%; }
 .archive-invitation h2 { margin-block: 18px 12px; }
}
@media print { .archive-invitation__files { display: none; } }

/* The display board keeps its live case links and pin coordinates. */
@media screen {
 .wall {
  border-radius: 4px;
  border-color: color-mix(in srgb, var(--frame) 78%, var(--brass));
  border-bottom-color: var(--frame);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / .15), inset 0 3px 18px rgb(var(--shade) / .24), 0 14px 24px rgb(var(--shade) / .4);
 }
 .wall__polaroid { position: relative; z-index: 1; width: min(20rem, 96%); border: 1px solid var(--paper-2); box-shadow: 1px 2px 0 var(--paper-2), 0 7px 12px rgb(var(--shade) / .28); }
 .wall__strings { z-index: 2; filter: drop-shadow(0 2px 1px rgb(var(--shade) / .35)); }
 .wall__string { stroke-width: 2; }
 .wall__note, .wall__card { position: relative; z-index: 1; box-shadow: 0 4px 7px rgb(var(--shade) / .23); }
 .wall__polaroid figcaption { padding: .35em .2em .45em; font-family: var(--font-display); font-weight: 700; font-size: clamp(.85rem, .62rem + .5vw, 1.08rem); line-height: 1.5; white-space: normal; overflow-wrap: anywhere; text-wrap: balance; }
 .wall__note { font-size: clamp(.8rem, .4rem + .8vw, 1.15rem); line-height: 1.5; }
 .wall__pin { --pin-color: var(--wax); background: radial-gradient(circle at 32% 27%, color-mix(in srgb, var(--pin-color) 30%, var(--paper)) 0 13%, var(--pin-color) 40%, color-mix(in srgb, var(--pin-color) 70%, var(--paper-ink)) 100%); box-shadow: inset 0 0 0 1px rgb(255 255 255 / .12), 1px 3px 3px rgb(var(--shade) / .35); }
 .wall__pin--brass { --pin-color: var(--brass); }
 .polaroid { position: relative; padding: 9px 9px 26px; border: 1px solid var(--paper-2); background-image: url('/assets/img/desk/paper-fibers.webp'); background-size: 256px 256px; background-blend-mode: soft-light; box-shadow: 1px 3px 0 var(--paper-2), 0 10px 16px rgb(var(--shade) / .28); }
 .polaroid::before { content: ''; position: absolute; z-index: 1; top: -6px; left: calc(50% - 6px); width: 12px; height: 12px; border-radius: 50%; background: radial-gradient(circle at 32% 27%, color-mix(in srgb, var(--wax) 30%, var(--paper)), var(--wax) 55%); box-shadow: 1px 3px 3px rgb(var(--shade) / .3); pointer-events: none; }
}
@media screen and (max-width: 40rem) {
 .wall--grid { --wall-h: 200px; }
 .wall__polaroid figcaption { font-size: .85rem; }
}

/* Separate editorial collections reuse the existing lightweight index cards. */
.notes-sections { display: flex; flex-wrap: wrap; gap: 8px; margin-block: 18px; }
.notes-sections a { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 16px; border: 1px solid var(--brass); color: var(--ink); font-family: var(--font-display); font-weight: 700; line-height: 1.6; text-decoration: none; }
.notes-sections a[aria-current] { background: var(--brass); color: var(--paper-ink); }
.notes-sections a:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.notes-help { margin-block: 20px; padding: 20px; background: var(--paper); color: var(--paper-ink); }
.notes-help a { color: var(--paper-ink); }
.notes-help ul { display: flex; flex-wrap: wrap; gap: 8px 24px; padding: 0; list-style: none; }
.notes-help li a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 700; }
@media (min-width: 701px) and (max-width: 1350px) {
 .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-header > .site-nav > ul { margin-inline: calc(var(--s-3) * -1) 0; }
}

/* ------------------------------------------------------------------ */
/* Admin: the owner's sign-in and unlisted cases (templates/admin.mjs) */
/* ------------------------------------------------------------------ */
.admin {
  display: grid;
  justify-items: center;
}

.admin__card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--s-4);
  width: min(100%, 30rem);
  padding: var(--s-6) clamp(18px, 3.4vw, 40px);
}

.admin__card--wide {
  width: min(100%, 44rem);
}

.admin__card > * {
  margin: 0;
}

.admin__card .label-tab {
  align-self: flex-start;
  transform: none;
}

.admin__card h1 {
  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);
}

/* Messages after a redirect: only the one named in the address is shown. */
.admin__note {
  display: none;
  padding: var(--s-2) var(--s-3);
  border-inline-start: 4px solid var(--accent);
}

.admin__note:target {
  display: block;
}

.admin__note--bad {
  border-inline-start-color: var(--stamp-red);
  font-weight: 700;
}

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

.admin__cases {
  display: grid;
  gap: var(--s-3);
  margin: 0;
  padding: 0;
  list-style: none;
}

.admin__case {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2) var(--s-4);
  padding-block: var(--s-3);
  border-bottom: 1px dashed var(--string);
}

.admin__case > p {
  margin: 0;
}

.admin__case-title {
  font-weight: 700;
}

.admin__case-number {
  display: block;
  font-family: var(--font-display);
  font-size: var(--t-1);
  letter-spacing: var(--track-label);
  text-transform: uppercase;
}

.admin__signout {
  margin: 0;
}

/* ------------------------------------------------------------------ */
/* The trailer on the home page (templates/home.mjs)                  */
/* A photograph-like poster mounted on paper; the wax-red key plays    */
/* it. site.js swaps the link for YouTube's player only on click.      */
/* ------------------------------------------------------------------ */
.trailer {
  display: grid;
  grid-template-columns: minmax(0, 0.78fr) minmax(0, 1.22fr);
  align-items: center;
  gap: clamp(24px, 4vw, 56px);
}
.trailer__text { min-width: 0; }
.trailer h2 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 3.4vw, 3.3rem);
  line-height: 1.08;
  margin-block: 24px 16px;
  max-width: 16ch;
}
.trailer__text > p:not(.label-tab) { max-width: 46ch; margin-block-end: 16px; }
.trailer__links { font-family: var(--font-display); font-weight: 700; letter-spacing: 0.04em; }
.trailer__links a { display: inline-flex; min-height: 44px; align-items: center; }
.trailer__screen { margin: 0; min-width: 0; }
.trailer__frame {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--wall);
  border: 6px solid var(--paper);
  border-radius: 2px;
  box-shadow: var(--prop-shadow);
}
.trailer__facade {
  position: absolute;
  inset: 0;
  display: block;
  color: var(--paper);
  text-decoration: none;
}
.site-main a.trailer__facade { text-decoration: none; }
.trailer__facade picture,
.trailer__poster,
.trailer__player {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}
.trailer__poster { object-fit: cover; }
/* The play key sits in the open space at the poster's centre, clear of its
   lettering; the poster is a picture, so it keeps its place in RTL too. */
.trailer__play {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  width: clamp(56px, 13%, 88px);
  aspect-ratio: 1;
  color: var(--on-mark);
  background: var(--wax);
  border: 3px solid var(--paper);
  border-radius: 50%;
  box-shadow: var(--prop-shadow);
  transform: translate(-50%, -50%);
}
/* The triangle points right in every language: it is a play sign, not an arrow. */
.trailer__play-icon { width: 46%; height: auto; margin-left: 6%; }
.trailer__time {
  position: absolute;
  right: 10px;
  bottom: 10px;
  padding: 3px 7px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.3;
  color: var(--paper);
  background: rgb(var(--shade) / 0.72);
  border-radius: 2px;
}
.trailer__facade:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
@media (prefers-reduced-motion: no-preference) {
  .trailer__play { transition: transform 160ms ease, box-shadow 160ms ease; }
  .trailer__facade:is(:hover, :focus-visible) .trailer__play { transform: translate(-50%, -50%) scale(1.07); box-shadow: var(--prop-shadow-lift); }
}
.trailer__notice {
  margin-block-start: 14px;
  max-width: 62ch;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--ink-muted);
}
.trailer__notice a { color: inherit; }
[dir="rtl"] .trailer h2 { max-width: 22ch; line-height: 1.6; letter-spacing: 0; }
@media (max-width: 800px) {
  .trailer { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .trailer h2 { margin-block: 20px 12px; }
}
@media (max-width: 480px) {
  .trailer__frame { border-width: 4px; }
  .trailer__time { right: 6px; bottom: 6px; font-size: 0.72rem; }
}
@media print { .trailer__screen { display: none; } }
/* Admin: the players' feedback (templates/admin.mjs renderFeedback, assets/js/admin-feedback.js) */
.admin__card--report {
  width: min(100%, 64rem);
}

.admin-fb {
  display: grid;
  gap: var(--s-5);
}

.admin-fb > * {
  margin: 0;
}

.admin-fb__totals,
.admin-fb__basis,
.admin-fb__empty,
.admin-fb__status {
  color: var(--ink-muted);
}

.admin-fb__error {
  margin: 0;
  padding: var(--s-2) var(--s-3);
  border-inline-start: 4px solid var(--stamp-red);
  font-weight: 700;
}

.admin-fb__case {
  display: grid;
  gap: var(--s-4);
  padding-block-start: var(--s-4);
  border-top: 2px solid var(--string);
}

.admin-fb__case > * {
  margin: 0;
}

.admin-fb__case-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--s-1) var(--s-3);
  font-size: var(--t-4);
  font-weight: 800;
  line-height: var(--lh-snug);
}

.admin-fb__case-title .admin__case-number {
  flex-basis: 100%;
}

.admin-fb__tag {
  font-size: var(--t-0);
}

.admin-fb__label {
  margin: 0 0 var(--s-2);
  font-family: var(--font-display);
  font-size: var(--t-1);
  font-weight: 800;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
}

.admin-fb__headline {
  margin: 0 0 var(--s-3);
}

.admin-fb__big {
  font-family: var(--font-display);
  font-size: var(--t-6);
  font-weight: 700;
  line-height: 1;
  color: var(--accent);
}

.admin-fb__of {
  font-weight: 700;
}

.admin-fb__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: var(--s-4) var(--s-6);
}

.admin-fb__bar-list {
  display: grid;
  gap: var(--s-1);
  margin: 0;
  padding: 0;
  list-style: none;
}

.admin-fb__bar {
  display: grid;
  grid-template-columns: minmax(7rem, 11rem) 1fr 2.5rem;
  align-items: center;
  gap: var(--s-2);
  font-size: var(--t-1);
}

.admin-fb__bar-track {
  display: block;
  block-size: 10px;
  background: var(--wash);
  border: 1px solid var(--rule);
}

.admin-fb__bar-fill {
  display: block;
  block-size: 100%;
  background: var(--accent);
}

.admin-fb__bar-n {
  text-align: end;
}

.admin-fb__fold {
  border: 1px dashed var(--rule-strong);
  padding: var(--s-3) var(--s-4);
}

.admin-fb__summary {
  cursor: pointer;
  font-weight: 700;
  min-block-size: var(--tap);
  display: flex;
  align-items: center;
}

.admin-fb__summary:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.admin-fb__comments {
  display: grid;
  gap: var(--s-3);
  margin: var(--s-3) 0 0;
  padding: 0;
  list-style: none;
}

.admin-fb__comment {
  padding: var(--s-3) var(--s-4);
  background: var(--paper);
  color: var(--paper-ink);
  box-shadow: var(--paper-shadow);
}

.admin-fb__meta {
  margin: 0 0 var(--s-2);
  font-size: var(--t-0);
  color: var(--paper-ink-soft);
}

.admin-fb__text {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

@media (max-width: 560px) {
  .admin-fb__bar {
    grid-template-columns: minmax(6rem, 9rem) 1fr 2rem;
  }
}

/* Replies under a comment (admin-feedback.js). */
.admin-fb__replies {
  display: grid;
  gap: var(--s-2);
  margin: var(--s-3) 0 0;
  padding: 0;
  list-style: none;
}

.admin-fb__reply {
  padding: var(--s-2) var(--s-3);
  border-inline-start: 3px solid var(--kraft-dark);
  background: color-mix(in srgb, var(--kraft) 20%, var(--paper));
}

.admin-fb__reply-form {
  display: grid;
  gap: var(--s-2);
  margin-block-start: var(--s-3);
}

.admin-fb__reply-form .input {
  inline-size: 100%;
  background: var(--paper);
  color: var(--paper-ink);
}

.admin-fb__reply-status,
.admin-fb__noreply {
  margin: 0;
  font-size: var(--t-0);
  color: var(--paper-ink-soft);
}

.admin-fb__noreply {
  margin-block-start: var(--s-2);
  font-style: italic;
}

/* "Write an update" (admin-news.js). */
.admin-news__form .input {
  inline-size: 100%;
}

.admin-news__body {
  min-block-size: 14rem;
  font-family: var(--font-mono);
  font-size: var(--t-1);
}

.admin-news__status {
  margin: 0;
  min-block-size: 1.5em;
}

.admin-news__history {
  display: grid;
  gap: var(--s-2);
  margin: var(--s-3) 0 0;
  padding: 0;
  list-style: none;
  font-size: var(--t-1);
}

.admin-news__send {
  padding: var(--s-2) var(--s-3);
  background: var(--paper);
  color: var(--paper-ink);
  box-shadow: var(--paper-shadow);
}
