/* ==========================================================================
   Branding, Elsewhere — Dispatch Design Studio
   Grotesk for the voice that names things, serif for the voice that explains.
   ========================================================================== */

/* --- tokens ------------------------------------------------------------- */

:root {
  --ink: #043198;
  --paper: #f5f0e4;
  --paper-raised: #fbf8f1;

  --ink-72: rgba(4, 49, 152, 0.72);
  --ink-55: rgba(4, 49, 152, 0.55);
  --ink-28: rgba(4, 49, 152, 0.28);
  --rule: rgba(4, 49, 152, 0.18);
  --rule-soft: rgba(4, 49, 152, 0.1);
  --recess: rgba(4, 49, 152, 0.04);

  --display: "Archivo", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Menlo, Consolas, monospace;

  --gutter: clamp(1.25rem, 3vw, 3rem);
  --split: clamp(1.75rem, 3.5vw, 3.25rem); /* main column to sidebar */
  --max: 96rem;
  --radius: 6px;
}

/* --- reset -------------------------------------------------------------- */

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(1rem, 0.97rem + 0.15vw, 1.08rem);
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* paper tooth — tactile, almost subliminal */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}

img { max-width: 100%; height: auto; display: block; }

h1, h2, h3, h4 { margin: 0; line-height: 1.1; text-wrap: balance; }

p { margin: 0 0 1.15em; }
p:last-child { margin-bottom: 0; }

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

button { font: inherit; color: inherit; }

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

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

.skip { position: absolute; left: -9999px; }
.skip:focus {
  left: var(--gutter);
  top: 0.75rem;
  z-index: 10000;
  background: var(--ink);
  color: var(--paper);
  padding: 0.6rem 1rem;
}

/* --- page frame --------------------------------------------------------- */

.shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* --- top bar ------------------------------------------------------------ */

.topbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding-block: 1.05rem;
  border-bottom: 1px solid var(--rule);
}

.topbar__mark {
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.98rem;
  letter-spacing: -0.02em;
}

.topbar__right {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.topbar__studio {
  font-size: 0.88rem;
  color: var(--ink-72);
}

.menu-toggle {
  display: grid;
  gap: 5px;
  width: 26px;
  padding: 4px 0;
  background: none;
  border: 0;
  cursor: pointer;
}

.menu-toggle span {
  display: block;
  height: 2px;
  background: var(--ink);
}

.menu {
  position: absolute;
  top: calc(100% + 0.6rem);
  right: 0;
  z-index: 50;
  min-width: 15rem;
  padding: 0.5rem;
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}

.menu[hidden] { display: none; }

.menu a {
  display: block;
  padding: 0.55rem 0.7rem;
  font-family: var(--display);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  border-radius: 4px;
}

.menu a:hover { background: var(--recess); }

.menu__label {
  padding: 0.6rem 0.7rem 0.3rem;
  font-family: var(--display);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-55);
}

.menu hr { border: 0; border-top: 1px solid var(--rule-soft); margin: 0.4rem 0.7rem; }

/* --- homepage: two-column canvas ---------------------------------------- */

.canvas {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.canvas__main {
  padding-block: clamp(1.75rem, 3vw, 2.75rem);
  display: flex;
  flex-direction: column;
  gap: clamp(1.5rem, 2.6vw, 2.25rem);
}

.canvas__aside[hidden] { display: none; }

/* signed in, the Workbench takes the right-hand column back */
body[data-auth="in"] .canvas {
  grid-template-columns: minmax(0, 1fr) clamp(19rem, 26vw, 26rem);
}

body[data-auth="in"] .canvas__main { padding-right: var(--split); }

.canvas__aside {
  padding-block: clamp(1.75rem, 3vw, 2.75rem);
  padding-left: var(--split);
  border-left: 1px solid var(--rule);
}

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

.masthead__title {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(2.6rem, 6.1vw, 5.6rem);
  line-height: 0.87;
  letter-spacing: -0.045em;
  max-width: 11ch;
}

.masthead__sub {
  font-size: clamp(1.4rem, 0.9rem + 1.6vw, 2.15rem);
  line-height: 1.18;
  margin: clamp(1rem, 1.8vw, 1.4rem) 0 0;
  max-width: 21ch;
}

.masthead__note {
  margin: 0.9rem 0 0;
  max-width: 34ch;
  font-size: 0.98rem;
  line-height: 1.55;
  color: var(--ink-72);
}

/* --- entry cards -------------------------------------------------------- */

.entries {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(1.75rem, 3.5vw, 3.25rem);
}

/* the Workbench costs a column */
body[data-auth="in"] .entries {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.entry-card {
  display: flex;
  flex-direction: column;
}

.entry-card__media {
  position: relative;
  aspect-ratio: 3 / 2;
  overflow: hidden;
}

.entry-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 600ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.entry-card:hover .entry-card__media img { transform: scale(1.015); }

.entry-card__num {
  position: absolute;
  top: 0.5rem;
  left: 0.7rem;
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  color: var(--paper);
}

.entry-card__body {
  padding: clamp(0.9rem, 1.6vw, 1.15rem) 0 0;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.entry-card__title {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(1.4rem, 1.1rem + 0.8vw, 1.85rem);
  letter-spacing: -0.035em;
}

.entry-card:hover .entry-card__title {
  text-decoration: underline;
  text-decoration-thickness: 0.05em;
  text-underline-offset: 0.14em;
}

.entry-card__concept {
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-72);
  margin: 0.5rem 0 0;
}

.entry-card__rule {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 0.85rem 0 0.8rem;
}

.entry-card__hook {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.5;
}

.entry-card__cue {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: auto;
  padding-top: 0.95rem;
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: -0.01em;
}

.entry-card__cue span:last-child { transition: transform 200ms ease; }
.entry-card:hover .entry-card__cue span:last-child { transform: translateX(3px); }

/* --- sidebar: working notes --------------------------------------------- */

.aside__eyebrow {
  font-family: var(--display);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin: 0 0 0.85rem;
}

.aside__title {
  font-weight: 600;
  font-size: clamp(1.4rem, 1.1rem + 0.9vw, 1.85rem);
  line-height: 1.14;
  letter-spacing: -0.01em;
}

.aside__note {
  margin: 0.9rem 0 clamp(1.5rem, 2.5vw, 2rem);
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--ink-72);
}

.note {
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper-raised);
  padding: clamp(0.9rem, 1.4vw, 1.15rem);
}

.note + .note { margin-top: 0.85rem; }

.note__head {
  display: grid;
  grid-template-columns: 3rem minmax(0, 1fr);
  gap: 0.9rem;
  align-items: start;
}

.note__icon {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  display: grid;
  place-items: center;
}

.note__icon svg { width: 1.35rem; height: 1.35rem; }

.note__icon--letter {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.3rem;
  line-height: 1;
}

.note__title {
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.note__desc {
  margin: 0.4rem 0 0;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--ink-72);
}

.note__actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  margin-top: 0.9rem;
  padding-left: 3.6rem;
}

.note__panel {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule-soft);
}

.note__panel[hidden] { display: none; }

/* --- buttons ------------------------------------------------------------ */

.copy {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--display);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: transparent;
  border: 1px solid var(--ink-28);
  border-radius: var(--radius);
  padding: 0.5rem 0.7rem;
  cursor: pointer;
  transition: background-color 140ms linear, color 140ms linear, border-color 140ms linear;
}

.copy svg { width: 0.85rem; height: 0.85rem; }

.copy:hover,
.copy[data-state="done"] {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.quiet {
  background: none;
  border: 0;
  padding: 0.5rem 0;
  font-family: var(--display);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ink-72);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 0.25em;
}

.quiet:hover { color: var(--ink); }

/* --- copyable fields ---------------------------------------------------- */

.field-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
  font-family: var(--display);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-72);
}

.field {
  font-family: var(--mono);
  font-size: 0.76rem;
  line-height: 1.7;
  color: var(--ink);
  background: var(--recess);
  border: 1px solid var(--rule-soft);
  border-radius: 4px;
  padding: 0.85rem;
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

textarea.field {
  display: block;
  width: 100%;
  min-height: 6.5rem;
  resize: vertical;
  caret-color: var(--ink);
}

textarea.field::placeholder { color: var(--ink-28); }
textarea.field:focus { outline: 2px solid var(--ink); outline-offset: 2px; }

.field + .field-label { margin-top: 1.25rem; }
.note__panel .copy { margin-top: 0.75rem; }

/* the chapter template reads as a document, not a form */
.structure { border-top: 1px solid var(--rule-soft); }

.structure__row {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr);
  gap: 0 0.85rem;
  padding-block: 0.85rem;
  border-bottom: 1px solid var(--rule-soft);
}

.structure__num {
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  color: var(--ink-28);
  padding-top: 0.3rem;
  font-variant-numeric: tabular-nums;
}

.structure__term {
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.92rem;
  letter-spacing: -0.015em;
  margin: 0 0 0.25rem;
}

.structure__def {
  margin: 0;
  color: var(--ink-72);
  font-size: 0.88rem;
  line-height: 1.45;
}

.structure__def + .structure__def { margin-top: 0.3rem; }

.structure ul {
  margin: 0.4rem 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.86rem;
  color: var(--ink-72);
}

.structure li::before { content: "— "; color: var(--ink-28); }

/* --- pull quote --------------------------------------------------------- */

.pull {
  margin-top: clamp(1.5rem, 2.5vw, 2rem);
  padding-left: 1rem;
  border-left: 3px solid var(--ink);
  font-size: 1.05rem;
  line-height: 1.45;
}

.pull p { margin: 0; }

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

.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem 2rem;
  padding-block: 1.1rem 1.4rem;
  border-top: 1px solid var(--rule);
  font-size: 0.85rem;
  color: var(--ink-72);
}

.site-footer__links {
  display: flex;
  gap: clamp(1.25rem, 3vw, 2.75rem);
}

.site-footer a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 0.3em; }

/* --- entry page --------------------------------------------------------- */

.reader {
  flex: 1;
  width: 100%;
  max-width: 74rem;
  margin-inline: auto;
  padding-block: clamp(1.75rem, 3.5vw, 3rem);
}

.entry-hero {
  margin: 0 0 clamp(1.75rem, 3vw, 2.5rem);
  aspect-ratio: 3 / 2;
  overflow: hidden;
}

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

.entry-head {
  padding-bottom: clamp(2rem, 4vw, 3rem);
  border-bottom: 1px solid var(--rule);
}

.entry-head__number {
  display: block;
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.74rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-55);
  margin-bottom: 0.9rem;
}

.entry-head__title {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(2.75rem, 8vw, 6rem);
  line-height: 0.86;
  letter-spacing: -0.045em;
}

.entry-head__concept {
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.74rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-72);
  margin: 1rem 0 0;
}

.entry-head__hook {
  font-size: clamp(1.35rem, 1rem + 1.6vw, 2.1rem);
  line-height: 1.25;
  margin: clamp(1.75rem, 3vw, 2.5rem) 0 0;
  max-width: 24ch;
}

.entry-body { padding-block: clamp(2.5rem, 5vw, 4rem); }

.section {
  padding-block: clamp(2rem, 4vw, 3rem);
}

.section + .section { border-top: 1px solid var(--rule-soft); }

.section__label {
  position: sticky;
  top: 1.75rem;
  align-self: start;
  margin: 0;
  font-family: var(--display);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-72);
}

/* the story reads a size up — it is the experience, not the explanation */
.section--story .section__body {
  font-size: clamp(1.08rem, 1rem + 0.4vw, 1.22rem);
  line-height: 1.62;
}

.section__body ul {
  margin: 0 0 1.15em;
  padding-left: 1.1rem;
  list-style: none;
}

.section__body li { margin-bottom: 0.3rem; position: relative; }
.section__body li::before {
  content: "—";
  position: absolute;
  left: -1.1rem;
  color: var(--ink-28);
}

/* the distilled line gets the loudest voice on the page */
.principle {
  padding-block: clamp(2.5rem, 5vw, 4rem);
  border-top: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  margin-block: clamp(1.25rem, 2.5vw, 2rem);
}

.principle .section__label { position: static; display: block; margin-bottom: 1.25rem; }

.principle p {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(1.6rem, 1.1rem + 2.6vw, 3rem);
  line-height: 1.08;
  letter-spacing: -0.04em;
  margin: 0;
  max-width: 22ch;
}

.reflection {
  padding-block: clamp(2.5rem, 5vw, 3.5rem);
  border-top: 1px solid var(--rule);
}

.reflection .section__label { position: static; display: block; }

.reflection p {
  font-size: clamp(1.4rem, 1rem + 1.6vw, 2.1rem);
  line-height: 1.22;
  margin: 1.25rem 0 0;
  max-width: 22ch;
}

/* --- next entry --------------------------------------------------------- */

.next {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  padding-block: clamp(1.5rem, 3vw, 2.5rem);
  border-top: 1px solid var(--rule);
}

.next__eyebrow {
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-55);
}

.next__title {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(1.6rem, 1.2rem + 1.8vw, 2.6rem);
  letter-spacing: -0.035em;
  line-height: 1;
}

.next a:hover .next__title {
  text-decoration: underline;
  text-decoration-thickness: 0.05em;
  text-underline-offset: 0.12em;
}

/* --- responsive --------------------------------------------------------- */

@media (max-width: 64rem) {
  .canvas { grid-template-columns: 1fr; }

  .canvas__main { padding-right: 0; }

  .canvas__aside {
    border-left: 0;
    border-top: 1px solid var(--rule);
    padding-left: 0;
    max-width: 40rem;
  }
}

@media (max-width: 72rem) {
  .entries,
  body[data-auth="in"] .entries { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 42rem) {
  .entries,
  body[data-auth="in"] .entries { grid-template-columns: 1fr; }
  .note__actions { padding-left: 0; }
  .topbar__studio { display: none; }
  .topbar__right { flex: 1; justify-content: space-between; }
  .site-footer { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* --- print -------------------------------------------------------------- */

@media print {
  body::before, .copy, .quiet, .topbar, .next { display: none; }
  body { background: #fff; }
}

/* ==========================================================================
   ENTRY EDITORIAL GRID
   Twelve real columns across the reading page. Prose holds five of them; the
   rest exist so that images, captions and silence have somewhere to go.

       1    2    3  |  4    5    6    7    8  |  9   10   11   12
       label        |          prose          |        plates

   Nothing is reserved. A section with no plate in it simply reads as prose.
   ========================================================================== */

.reader {
  --gap: clamp(0.75rem, 1.2vw, 1.25rem);

  /* site.js replaces --col and --slack with measured pixels; this is the
     fallback the page uses before that runs */
  --grid-w: min(calc(min(100vw, var(--max)) - 2 * var(--gutter) - 17px), 74rem);
  --col: calc((var(--grid-w) - 11 * var(--gap)) / 12);
  --slack: max(0px, calc((min(100vw, var(--max)) - 2 * var(--gutter) - var(--grid-w)) / 2));

  --u: calc(var(--col) + var(--gap));  /* one column plus one gutter */
  --bleed: min(var(--slack), 6.5rem);  /* how far a breakout may leave the grid */
  --baseline: 1.5rem;
}

.entry-body,
.section {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--gap);
}

.entry-body > * { grid-column: 1 / -1; }

.section__label { grid-column: 1 / span 2; }
.section__body { grid-column: 4 / span 5; }

/* plates hang outside the prose column, so the column must own their height */
.section__body::after { content: ""; display: block; clear: both; }

/* ==========================================================================
   PLATES — supplementary 1:1 illustrations

   Drop a <figure class="plate plate--right"> anywhere inside a .section__body,
   at the point in the prose where it should appear. Change only the modifier
   class to move it. Everything below is measured in columns, so a plate always
   lands on the grid.
   ========================================================================== */

.plate {
  margin: 0.3rem 0 1.85rem;
}

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

/* --- beside the text ---------------------------------------------------- */

.plate--right,
.plate--breakout-right { float: right; }

.plate--left,
.plate--breakout-left { float: left; }

/* columns 10–12 */
.plate--right {
  width: calc(3 * var(--u) - var(--gap));
  margin-right: calc(-4 * var(--u));
}

/* columns 1–3 */
.plate--left {
  width: calc(3 * var(--u) - var(--gap));
  margin-left: calc(-3 * var(--u));
}

/* --- leaving the grid --------------------------------------------------- */

/* columns 9–12, then out into the page margin */
.plate--breakout-right {
  width: calc(4 * var(--u) - var(--gap) + var(--bleed));
  margin-right: calc(-4 * var(--u) - var(--bleed));
}

/* columns 1–3, then out into the page margin */
.plate--breakout-left {
  width: calc(3 * var(--u) - var(--gap) + var(--bleed));
  margin-left: calc(-3 * var(--u) - var(--bleed));
}

/* --- interruptions ------------------------------------------------------ */

/* six columns, centred on the grid (4–9) */
.plate--center {
  float: none;
  clear: both;
  width: calc(6 * var(--u) - var(--gap));
  margin-block: clamp(2rem, 4vw, 3.25rem);
}

/* eight columns, centred on the grid (3–10) */
.plate--large {
  float: none;
  clear: both;
  width: calc(8 * var(--u) - var(--gap));
  margin-left: calc(-1 * var(--u));
  margin-block: clamp(2.5rem, 5vw, 4rem);
}

/* --- two related squares ------------------------------------------------ */

/* columns 4–12: two four-column squares with a column of air between them */
.plate-pair {
  clear: both;
  width: calc(9 * var(--u) - var(--gap));
  display: grid;
  grid-template-columns: repeat(2, calc(4 * var(--u) - var(--gap)));
  justify-content: space-between;
  margin-block: clamp(2rem, 4vw, 3.25rem);
}

.plate-pair .plate {
  float: none;
  width: 100%;
  margin: 0;
}

/* add plate-pair--stagger when the second square should sit a step lower */
.plate-pair--stagger .plate:last-child { margin-top: clamp(1.5rem, 3vw, 2.75rem); }

/* --- captions ----------------------------------------------------------- */

.plate__caption {
  display: block;
  margin-top: 0.6rem;
  max-width: 36ch;
}

.plate__number,
.plate__label {
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.6rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.plate__number { color: var(--ink-28); }
.plate__label { color: var(--ink-55); }
.plate__number + .plate__label::before {
  content: "·";
  margin: 0 0.4rem;
  color: var(--ink-28);
}

.plate__text {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--ink-72);
}

/* ==========================================================================
   GRID OVERLAY — a design tool, not part of the publication
   ========================================================================== */

.grid-toggle {
  position: fixed;
  left: 0.7rem;
  bottom: 0.7rem;
  z-index: 10000;
  font-family: var(--display);
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  padding: 0.3rem 0.45rem 0.28rem;
  color: var(--ink-55);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 3px;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 140ms linear;
}

.grid-toggle:hover { opacity: 1; }

.grid-toggle[aria-pressed="true"] {
  opacity: 1;
  color: var(--paper);
  background: var(--ink);
  border-color: var(--ink);
}

.grid-overlay {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 60;
  pointer-events: none;
}

.grid-overlay > * { position: absolute; }

.grid-overlay__col { background: rgba(4, 49, 152, 0.055); }
.grid-overlay__gutter { background: rgba(4, 49, 152, 0.115); }
.grid-overlay__margin { background: rgba(4, 49, 152, 0.03); }
.grid-overlay__edge { background: rgba(4, 49, 152, 0.32); }

.grid-overlay__baseline {
  background-image: repeating-linear-gradient(
    to bottom,
    rgba(4, 49, 152, 0.08) 0 1px,
    transparent 1px var(--baseline, 1.5rem)
  );
}

/* which rule an image is using — only while the grid is on */
body.grid-on .plate { position: relative; }

body.grid-on .plate[data-plate]::after {
  content: attr(data-plate);
  position: absolute;
  top: 0.35rem;
  left: 0.35rem;
  font-family: var(--display);
  font-size: 0.5rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--paper);
  background: var(--ink);
  padding: 0.2rem 0.35rem 0.18rem;
}

/* ==========================================================================
   READING FIRST ON NARROW SCREENS
   Six columns instead of twelve, and every plate goes full width in flow.
   ========================================================================== */

@media (max-width: 62rem) {
  .entry-body,
  .section {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .section__label {
    grid-column: 1 / -1;
    position: static;
    margin-bottom: 0.4rem;
  }

  .section__body { grid-column: 1 / -1; }

  .plate,
  .plate-pair {
    float: none;
    clear: both;
    width: 100%;
    margin-inline: 0;
    margin-block: clamp(1.5rem, 5vw, 2.5rem);
  }

  .plate-pair {
    grid-template-columns: 1fr;
    gap: clamp(1.25rem, 4vw, 2rem);
  }

  .plate-pair--stagger .plate:last-child { margin-top: 0; }
}

@media print {
  .grid-toggle,
  .grid-overlay { display: none; }
}

/* ==========================================================================
   SIGNING IN
   ========================================================================== */

.signin {
  flex: 1;
  width: 100%;
  max-width: 26rem;
  margin-inline: auto;
  padding-block: clamp(3rem, 10vw, 7rem);
}

.signin__title {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(2.5rem, 6vw, 3.5rem);
  letter-spacing: -0.045em;
  line-height: 0.9;
  margin-top: 0.75rem;
}

.signin__note {
  margin: 1rem 0 2.25rem;
  color: var(--ink-72);
}

.signin__form { display: flex; flex-direction: column; }

.signin__label {
  font-family: var(--display);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-72);
  margin-bottom: 0.4rem;
}

.signin__input {
  font-family: var(--serif);
  font-size: 1rem;
  color: var(--ink);
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 0.7rem 0.8rem;
  margin-bottom: 1.25rem;
}

.signin__input:focus { outline: 2px solid var(--ink); outline-offset: 1px; }

.signin__button {
  justify-content: center;
  padding-block: 0.7rem;
  font-size: 0.75rem;
}

.signin__error {
  margin: 1rem 0 0;
  font-size: 0.88rem;
  color: var(--ink);
  border-left: 3px solid var(--ink);
  padding-left: 0.8rem;
}

.signin__back {
  margin-top: 2.5rem;
  font-size: 0.85rem;
  color: var(--ink-72);
}

.signin__back a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 0.3em; }

/* --- editing a Workbench document --------------------------------------- */

.note__edit {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.85rem;
}

.note__stamp {
  font-size: 0.7rem;
  color: var(--ink-28);
}

.note__display [data-editor] {
  min-height: 12rem;
  line-height: 1.6;
}

.workbench__foot {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.25rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--rule);
  font-size: 0.78rem;
  color: var(--ink-55);
}

.site-footer__workbench { color: var(--ink-28); }
.site-footer__workbench:hover { color: var(--ink); }
