/* =========================================================================
   Afteroffice Studio — a working laboratory logbook.

   Every device here is load-bearing for one argument: a claim you can check.
   The printed grid, the stamps, the witness block, and the strike-through
   corrections are the logbook's own apparatus for making a record
   defensible — which is exactly what this site is trying to be.

   Light only. A notebook page is lit.
   ========================================================================= */

/* --- fonts ------------------------------------------------------------- */
/* Self-hosted so the page doesn't depend on a third party, and so the latin
   subset can't silently fall back to tofu the way a mis-picked Google Fonts
   unicode-range block does. */

@font-face {
  font-family: "Archivo";
  src: url("/fonts/archivo-variable.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}
@font-face {
  font-family: "Martian Mono";
  src: url("/fonts/martian-mono-variable.woff2") format("woff2-variations");
  font-weight: 100 800;
  font-stretch: 75% 112.5%;
  font-display: swap;
}

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

:root {
  /* Laboratory stock: cool-bright, never cream. */
  --paper: oklch(98.6% 0.004 235);
  --paper-sunk: oklch(96.2% 0.006 235);
  --paper-edge: oklch(93% 0.008 235);

  --ink: oklch(21% 0.032 255);
  --ink-soft: oklch(46% 0.022 255);
  /* 4.86:1 on paper. This token carries small mono labels (plate feet, folio,
     stack lines), so it has to clear AA at 10px, not just look quiet. */
  --ink-faint: oklch(54% 0.02 255);

  --grid: oklch(84% 0.055 205);
  --grid-strong: oklch(72% 0.08 205);

  --stamp: oklch(47% 0.185 300);
  --stamp-soft: oklch(94% 0.03 300);

  --witness: oklch(54% 0.205 27);
  --witness-soft: oklch(95% 0.028 27);

  --buckram: oklch(31% 0.098 25);
  --buckram-deep: oklch(24% 0.075 25);

  /* Duplicate-copy stock. Tinted enough to read as a different sheet, light
     enough to hold a whole dashboard without shouting. */
  --carbon-yellow: oklch(94.5% 0.062 96);
  --carbon-pink: oklch(93.5% 0.036 12);

  /* Index tabs — the one place several saturated hues coexist. */
  --tab-web: oklch(58% 0.16 250);
  --tab-tool: oklch(56% 0.15 160);
  --tab-bot: oklch(60% 0.17 60);
  --tab-app: oklch(55% 0.19 330);
  --tab-all: oklch(47% 0.185 300);

  --grid-size: 24px;
  --rule: 1px solid var(--grid);
  --rule-strong: 1.5px solid var(--ink);

  --measure: 68ch;
  --gutter: 1.25rem;
  --sheet-max: 74rem;

  --shadow-plate: 0 1px 2px oklch(21% 0.03 255 / 0.06),
    0 6px 18px oklch(21% 0.03 255 / 0.09);
  --shadow-lift: 0 2px 4px oklch(21% 0.03 255 / 0.07),
    0 12px 32px oklch(21% 0.03 255 / 0.11);

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

@media (min-width: 64rem) {
  :root {
    --grid-size: 32px;
    --gutter: 2.5rem;
  }
}

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

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

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

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  font-family: "Archivo", ui-sans-serif, system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  /* The printed grid. Under the content, never over the text. */
  background-image: linear-gradient(
      to right,
      color-mix(in oklab, var(--grid) 34%, transparent) 1px,
      transparent 1px
    ),
    linear-gradient(
      to bottom,
      color-mix(in oklab, var(--grid) 34%, transparent) 1px,
      transparent 1px
    );
  background-size: var(--grid-size) var(--grid-size);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

a {
  color: inherit;
}

:focus-visible {
  outline: 2.5px solid var(--stamp);
  outline-offset: 3px;
  border-radius: 1px;
}

::selection {
  background: var(--stamp-soft);
}

/* --- typography -------------------------------------------------------- */

h1,
h2,
h3,
h4 {
  font-weight: 650;
  line-height: 1.12;
  letter-spacing: -0.022em;
  text-wrap: balance;
  margin: 0;
}

h1 {
  font-size: clamp(2.1rem, 7.2vw, 4.2rem);
  font-stretch: 108%;
  letter-spacing: -0.032em;
}

h2 {
  font-size: clamp(1.5rem, 4vw, 2.15rem);
}

h3 {
  font-size: clamp(1.12rem, 2.4vw, 1.35rem);
  letter-spacing: -0.014em;
}

p {
  margin: 0;
  max-width: var(--measure);
  text-wrap: pretty;
}

/* Machine-emitted text is mono; human-written text is not. That split is a
   signal, so it is never crossed for decoration. */
.mono,
.field-label,
.stamp,
.folio,
.entry-no,
code,
kbd {
  font-family: "Martian Mono", ui-monospace, SFMono-Regular, monospace;
  font-variant-numeric: tabular-nums;
}

.field-label {
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-stretch: 88%;
}

.lede {
  font-size: clamp(1.05rem, 2.6vw, 1.3rem);
  line-height: 1.5;
  color: var(--ink-soft);
  max-width: 46ch;
}

.tabular {
  font-variant-numeric: tabular-nums;
}

/* --- sheet & margin rule ----------------------------------------------- */

.sheet {
  max-width: var(--sheet-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
  position: relative;
}

/* Prose pages are bound to a page width rather than a banner width, so the
   sheet reads as something lying on a desk instead of a wide hero. The
   catalogue keeps the full width, because a register genuinely is wide. */
.sheet--page {
  max-width: 62rem;
}

/* The classic ledger margin rule. Only on the content sheet — the masthead
   and colophon use a different width, and drawing it there would put two
   rules at two different positions. Desktop only: on a phone it would eat
   the reading width it is supposed to frame. */
@media (min-width: 64rem) {
  main > .sheet::before {
    content: "";
    position: absolute;
    inset-block: 0;
    left: calc(var(--gutter) - 1.15rem);
    width: 1.5px;
    background: color-mix(in oklab, var(--witness) 55%, transparent);
    pointer-events: none;
  }
}

.folio {
  font-size: 0.66rem;
  color: var(--ink-faint);
  letter-spacing: 0.08em;
}

/* --- entries ----------------------------------------------------------- */

.entry {
  padding-block: clamp(2.5rem, 5.5vw, 3.9rem);
  border-top: var(--rule);
  scroll-margin-top: 4.5rem;
}

.entry:first-of-type {
  border-top: 0;
}

.entry-head {
  display: flex;
  align-items: baseline;
  gap: 0.85rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.entry-no {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--stamp);
  white-space: nowrap;
}

.entry-rule {
  flex: 1;
  height: 0;
  border-top: var(--rule);
  min-width: 2rem;
  transform: translateY(-0.28em);
}

.entry-body {
  display: grid;
  gap: 1.15rem;
}

/* More space above a heading than below it, at every level of the page. */
.entry h2 {
  margin-bottom: 1.3rem;
}

.entry h3 {
  margin-bottom: 0.55rem;
}

/* --- stamp ------------------------------------------------------------- */

.stamp {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.34rem 0.7rem;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--stamp);
  border: 1.5px solid currentColor;
  box-shadow: inset 0 0 0 3.5px var(--paper), inset 0 0 0 5px currentColor;
  background: transparent;
  white-space: nowrap;
  /* Rotation is fixed per instance via --rot; never randomised at render, so
     the page looks the same on every visit. */
  transform: rotate(var(--rot, -1.6deg));
}

.stamp--down {
  color: var(--witness);
}

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

.stamp--solid {
  color: var(--paper);
  background: var(--stamp);
  border-color: var(--stamp);
  box-shadow: none;
}

@media (prefers-reduced-motion: no-preference) {
  .stamp--land {
    animation: stamp-land 0.18s var(--ease) both;
  }
  @keyframes stamp-land {
    from {
      transform: rotate(var(--rot, -1.6deg)) scale(1.06);
      opacity: 0.4;
    }
    to {
      transform: rotate(var(--rot, -1.6deg)) scale(1);
      opacity: 1;
    }
  }
}

/* --- witness block ----------------------------------------------------- */

.witness {
  border-top: 1.5px dashed var(--grid-strong);
  border-bottom: 1.5px dashed var(--grid-strong);
  padding-block: 1.15rem;
  margin-block: 1.75rem;
  display: grid;
  gap: 0.55rem;
  max-width: 42rem;
}

.witness-row {
  display: grid;
  grid-template-columns: minmax(6.5rem, auto) 1fr;
  gap: 0.5rem 1rem;
  align-items: baseline;
  font-size: 0.82rem;
}

.witness-row dt {
  font-family: "Martian Mono", ui-monospace, monospace;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.witness-row dd {
  margin: 0;
  color: var(--ink);
}

/* The signature sits against the block's own left edge, the way it is signed
   on a real sheet — not indented into the value column. */
.witness-row--sign {
  grid-template-columns: 1fr;
}

.signature {
  width: 8.5rem;
  color: var(--witness);
  margin-top: 0.35rem;
}

/* --- correction: the site's signature device --------------------------- */
/* A logbook never erases. Every honest downgrade of a claim on this site is
   shown being downgraded, because that is the whole argument. */

.correction {
  display: grid;
  gap: 0.5rem;
  max-width: var(--measure);
}

.correction-struck {
  position: relative;
  color: var(--ink-faint);
  font-size: clamp(1.35rem, 3.6vw, 1.9rem);
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.2;
  width: fit-content;
  max-width: 100%;
}

.correction-struck::after {
  content: "";
  position: absolute;
  left: -0.15em;
  right: -0.15em;
  top: 52%;
  height: 2.5px;
  background: var(--witness);
  transform: rotate(-0.8deg);
  border-radius: 2px;
}

.correction-real {
  font-size: clamp(1.35rem, 3.6vw, 1.9rem);
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.correction-mark {
  font-family: "Martian Mono", ui-monospace, monospace;
  font-size: 0.6rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--witness);
}

/* --- stat figures ------------------------------------------------------ */

.figures {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr));
  gap: 1.5rem 1.25rem;
  margin-block: 2rem;
  max-width: 40rem;
}

.figure-n {
  font-size: clamp(2.4rem, 8vw, 3.6rem);
  font-weight: 700;
  font-stretch: 112%;
  letter-spacing: -0.04em;
  line-height: 0.92;
  font-variant-numeric: tabular-nums;
  display: block;
}

.figure-n small {
  font-size: 0.44em;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink-soft);
}

.figure-label {
  display: block;
  margin-top: 0.55rem;
  font-family: "Martian Mono", ui-monospace, monospace;
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--ink-soft);
  line-height: 1.4;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.9rem;
  padding: 0.7rem 1.25rem;
  font-family: inherit;
  font-size: 0.94rem;
  font-weight: 600;
  letter-spacing: -0.008em;
  text-decoration: none;
  border: 1.5px solid var(--stamp);
  background: var(--stamp);
  color: var(--paper);
  cursor: pointer;
  transition: background 0.14s var(--ease), color 0.14s var(--ease);
}

.btn:hover {
  background: oklch(41% 0.185 300);
  border-color: oklch(41% 0.185 300);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn--ghost {
  background: transparent;
  color: var(--stamp);
}

.btn--ghost:hover {
  background: var(--stamp-soft);
  border-color: var(--stamp);
  color: var(--stamp);
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

/* --- links ------------------------------------------------------------- */

.link {
  color: var(--stamp);
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.22em;
  text-decoration-color: color-mix(in oklab, var(--stamp) 40%, transparent);
  font-weight: 550;
}

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

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

.masthead {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in oklab, var(--paper) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: var(--rule);
}

.masthead-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 3.4rem;
}

.wordmark {
  display: inline-flex;
  align-items: baseline;
  gap: 0.42rem;
  text-decoration: none;
  font-weight: 700;
  font-stretch: 106%;
  letter-spacing: -0.03em;
  font-size: 1.02rem;
  white-space: nowrap;
}

.wordmark-mark {
  color: var(--stamp);
}

.wordmark-sub {
  font-family: "Martian Mono", ui-monospace, monospace;
  font-size: 0.55rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.masthead nav {
  margin-left: auto;
  display: none;
  gap: 1.4rem;
}

@media (min-width: 56rem) {
  .masthead nav {
    display: flex;
  }
}

.masthead nav a {
  font-size: 0.85rem;
  font-weight: 550;
  text-decoration: none;
  color: var(--ink-soft);
  padding-block: 0.3rem;
  border-bottom: 2px solid transparent;
}

.masthead nav a:hover {
  color: var(--ink);
}

.masthead nav a[aria-current="page"] {
  color: var(--ink);
  border-bottom-color: var(--stamp);
}

.lang-toggle {
  margin-left: auto;
  font-family: "Martian Mono", ui-monospace, monospace;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  padding: 0.4rem 0.6rem;
  min-height: 2.1rem;
  border: 1.5px solid var(--grid-strong);
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

@media (min-width: 56rem) {
  .lang-toggle {
    margin-left: 1.4rem;
  }
}

.lang-toggle:hover {
  border-color: var(--stamp);
  color: var(--stamp);
}

/* Mobile drawer nav */
.nav-strip {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-block: 0.6rem;
  border-bottom: var(--rule);
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.nav-strip::-webkit-scrollbar {
  display: none;
}

@media (min-width: 56rem) {
  .nav-strip {
    display: none;
  }
}

.nav-strip a {
  flex: none;
  font-size: 0.78rem;
  font-weight: 550;
  text-decoration: none;
  color: var(--ink-soft);
  padding: 0.35rem 0.7rem;
  border: 1.5px solid var(--paper-edge);
  white-space: nowrap;
}

.nav-strip a[aria-current="page"] {
  color: var(--stamp);
  border-color: var(--stamp);
}

/* --- plates (case studies) --------------------------------------------- */

.plates {
  display: grid;
  gap: 1.5rem;
  margin-top: 2rem;
}

@media (min-width: 48rem) {
  .plates {
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem 1.75rem;
  }
}

.plate {
  position: relative;
  display: block;
  text-decoration: none;
  background: var(--paper);
  border: var(--rule-strong);
  padding: 1.4rem 1.35rem 1.2rem;
  box-shadow: var(--shadow-plate);
  transform: rotate(var(--rot, -0.35deg));
  transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease);
}

.plate:hover {
  transform: rotate(0deg) translateY(-2px);
  box-shadow: var(--shadow-lift);
}

/* Tape corner — drawn, not an image asset. */
.plate::before {
  content: "";
  position: absolute;
  top: -0.55rem;
  left: 1.5rem;
  width: 3.4rem;
  height: 1.1rem;
  background: color-mix(in oklab, var(--carbon-yellow) 70%, transparent);
  border: 1px solid color-mix(in oklab, var(--ink) 10%, transparent);
  transform: rotate(-2.5deg);
}

.plate-kicker {
  font-family: "Martian Mono", ui-monospace, monospace;
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--stamp);
  display: block;
  margin-bottom: 0.65rem;
}

.plate h3 {
  margin-bottom: 0.5rem;
}

.plate p {
  color: var(--ink-soft);
  font-size: 0.94rem;
}

.plate-foot {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 1.1rem;
  padding-top: 0.85rem;
  border-top: var(--rule);
  font-family: "Martian Mono", ui-monospace, monospace;
  font-size: 0.6rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-faint);
  flex-wrap: wrap;
}

/* --- catalogue --------------------------------------------------------- */

.tabs {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  padding-block: 0.75rem;
  margin-bottom: 0.5rem;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  flex: none;
  font-family: "Martian Mono", ui-monospace, monospace;
  font-size: 0.63rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  padding: 0.45rem 0.75rem;
  min-height: 2.2rem;
  border: 1.5px solid var(--paper-edge);
  border-bottom-width: 3px;
  border-bottom-color: var(--tab-c, var(--ink-faint));
  background: var(--paper-sunk);
  color: var(--ink-soft);
  cursor: pointer;
  white-space: nowrap;
}

.tab[aria-pressed="true"] {
  background: var(--paper);
  color: var(--ink);
  border-color: var(--ink);
  border-bottom-color: var(--tab-c, var(--stamp));
}

.catalogue {
  border-top: var(--rule-strong);
  margin-top: 0.5rem;
}

.cat-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.3rem 1rem;
  align-items: start;
  padding-block: 0.95rem;
  border-bottom: var(--rule);
}

@media (min-width: 48rem) {
  .cat-row {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) auto;
    align-items: center;
    gap: 1.5rem;
  }
}

.cat-name {
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: -0.012em;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.cat-name .link {
  font-weight: 600;
}

.cat-stack {
  font-family: "Martian Mono", ui-monospace, monospace;
  font-size: 0.63rem;
  color: var(--ink-faint);
  letter-spacing: 0.02em;
  line-height: 1.5;
  grid-column: 1 / -1;
}

@media (min-width: 48rem) {
  .cat-stack {
    grid-column: auto;
  }
}

.cat-status {
  justify-self: start;
  grid-row: 1;
  grid-column: 2;
}

@media (min-width: 48rem) {
  .cat-status {
    grid-column: 3;
    justify-self: end;
  }
}

.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: "Martian Mono", ui-monospace, monospace;
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
}

.status-dot::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}

.is-up {
  color: oklch(48% 0.14 155);
}

.is-down {
  color: var(--witness);
}

.is-bot {
  color: var(--ink-faint);
}

/* --- tables ------------------------------------------------------------ */

.spec-table {
  width: 100%;
  border-collapse: collapse;
  margin-block: 1.35rem;
  font-size: 0.92rem;
  max-width: 48rem;
}

.spec-table tr {
  border-bottom: var(--rule);
}

.spec-table tr:first-child {
  border-top: var(--rule-strong);
}

.spec-table th {
  text-align: left;
  vertical-align: top;
  padding: 0.7rem 1rem 0.7rem 0;
  font-family: "Martian Mono", ui-monospace, monospace;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  width: 40%;
  line-height: 1.5;
}

.spec-table td {
  padding: 0.7rem 0;
  vertical-align: top;
  color: var(--ink);
}

/* --- notes & callouts -------------------------------------------------- */

.note {
  border-left: 2.5px solid var(--grid-strong);
  padding-left: 1rem;
  color: var(--ink-soft);
  font-size: 0.92rem;
  max-width: var(--measure);
}

.note--witness {
  border-left-color: var(--witness);
}

.list {
  display: grid;
  gap: 0.75rem;
  padding-left: 1.15rem;
  margin: 0;
  max-width: var(--measure);
}

.list li {
  padding-left: 0.25rem;
}

.list li::marker {
  color: var(--stamp);
  font-family: "Martian Mono", ui-monospace, monospace;
  font-size: 0.8em;
}

.pairs {
  display: grid;
  gap: 1.6rem;
  margin-top: 1.75rem;
}

@media (min-width: 40rem) {
  .pairs {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.9rem 2.5rem;
  }
}

.pair h3 {
  margin-bottom: 0.4rem;
}

.pair p {
  color: var(--ink-soft);
  font-size: 0.94rem;
}

/* --- architecture diagram ---------------------------------------------- */

.arch {
  margin-block: 1.6rem;
  padding: 1.4rem 1.2rem;
  background: var(--paper-sunk);
  border: var(--rule);
  overflow-x: auto;
}

.arch-flow {
  display: flex;
  align-items: stretch;
  gap: 0;
  min-width: min-content;
}

.arch-node {
  flex: none;
  min-width: 8.5rem;
  max-width: 11rem;
  padding: 0.8rem 0.85rem;
  background: var(--paper);
  border: 1.5px solid var(--ink);
}

.arch-node + .arch-node {
  margin-left: 1.9rem;
  position: relative;
}

.arch-node + .arch-node::before {
  content: "";
  position: absolute;
  left: -1.9rem;
  top: 50%;
  width: 1.9rem;
  height: 1.5px;
  background: var(--ink);
}

.arch-node + .arch-node::after {
  content: "";
  position: absolute;
  left: -0.6rem;
  top: 50%;
  width: 0.42rem;
  height: 0.42rem;
  border-top: 1.5px solid var(--ink);
  border-right: 1.5px solid var(--ink);
  transform: translateY(-50%) rotate(45deg);
}

.arch-node[data-kind="data"],
.arch-node[data-kind="ops"] {
  background: var(--stamp-soft);
}

.arch-node[data-kind="external"] {
  background: var(--carbon-yellow);
}

.arch-name {
  font-weight: 650;
  font-size: 0.88rem;
  letter-spacing: -0.012em;
  display: block;
}

.arch-detail {
  display: block;
  margin-top: 0.25rem;
  font-family: "Martian Mono", ui-monospace, monospace;
  font-size: 0.58rem;
  line-height: 1.45;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
}

/* --- lab --------------------------------------------------------------- */

.tool {
  margin-block: 1.5rem;
}

.tool-form {
  display: grid;
  gap: 0.85rem;
  margin-top: 1.15rem;
  max-width: 44rem;
}

.tool-input {
  width: 100%;
  min-height: 7.5rem;
  padding: 0.9rem 1rem;
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  border: 1.5px solid var(--grid-strong);
  resize: vertical;
}

.tool-input::placeholder {
  color: var(--ink-faint);
}

.tool-input:focus-visible {
  border-color: var(--stamp);
}

.tool-hint {
  font-size: 0.8rem;
  color: var(--ink-soft);
}

.tool-actions {
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
  align-items: center;
}

/* The output arrives as a carbon duplicate — the copy you keep. */
.carbon {
  --sheet-bg: var(--carbon-yellow);
  margin-top: 1.5rem;
  background: var(--sheet-bg);
  border: 1.5px solid color-mix(in oklab, var(--ink) 22%, transparent);
  padding: 1.25rem 1.15rem;
  position: relative;
  max-width: 48rem;
}

.carbon--alt {
  --sheet-bg: var(--carbon-pink);
}

/* Perforation edge */
.carbon::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background-image: radial-gradient(
    circle at 4px 2px,
    color-mix(in oklab, var(--ink) 28%, transparent) 1.1px,
    transparent 1.2px
  );
  background-size: 9px 4px;
}

.carbon-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.9rem;
  flex-wrap: wrap;
}

.carbon-body {
  font-size: 0.95rem;
  line-height: 1.62;
  white-space: pre-wrap;
  color: oklch(24% 0.035 80);
}

.carbon-body h4 {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 1.15rem 0 0.35rem;
  letter-spacing: -0.008em;
}

.carbon-body h4:first-child {
  margin-top: 0;
}

.carbon-body ul {
  margin: 0.3rem 0;
  padding-left: 1.2rem;
}

.carbon-body strong {
  font-weight: 700;
}

.btn-mini {
  font-family: "Martian Mono", ui-monospace, monospace;
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.35rem 0.6rem;
  min-height: 2rem;
  border: 1.5px solid color-mix(in oklab, var(--ink) 30%, transparent);
  background: transparent;
  color: oklch(30% 0.04 80);
  cursor: pointer;
}

.btn-mini:hover {
  border-color: var(--ink);
}

/* Live region for tool status */
.tool-status {
  font-family: "Martian Mono", ui-monospace, monospace;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  min-height: 1.2rem;
}

.tool-status[data-tone="error"] {
  color: var(--witness);
}

/* --- generated dashboard ----------------------------------------------- */

.dash {
  display: grid;
  gap: 1rem;
  margin-top: 1.25rem;
}

@media (min-width: 44rem) {
  .dash {
    grid-template-columns: repeat(2, 1fr);
  }
}

.dash-card {
  border: 1.5px solid var(--ink);
  background: var(--paper);
  padding: 1rem;
}

.dash-card--wide {
  grid-column: 1 / -1;
}

.dash-title {
  font-family: "Martian Mono", ui-monospace, monospace;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 0.75rem;
}

.dash-stat {
  font-size: 2rem;
  font-weight: 700;
  font-stretch: 108%;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

/* Inside a carbon sheet the figures are printed ON the paper, not pasted on
   top of it — so the cards drop their own ground and keep only a rule. */
.carbon .dash-card {
  background: transparent;
  border-color: color-mix(in oklab, var(--ink) 32%, transparent);
}

.carbon .dash-title,
.carbon .tool-hint {
  color: oklch(38% 0.04 80);
}

.carbon .dash-stat,
.carbon .bar-value {
  color: oklch(24% 0.035 80);
}

.carbon .note {
  border-left-color: color-mix(in oklab, var(--ink) 30%, transparent);
  color: oklch(30% 0.04 80);
}

/* --- bar rows: HTML, so labels stay real text at any width -------------- */

.bars {
  display: grid;
  gap: 0.55rem;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(3.5rem, 5.5rem) 1fr auto;
  align-items: center;
  gap: 0.6rem;
}

.bar-label,
.bar-value {
  font-family: "Martian Mono", ui-monospace, monospace;
  font-size: 0.66rem;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-value {
  color: var(--ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.bar-track {
  min-width: 0;
  height: 0.85rem;
  display: block;
}

.bar-fill {
  display: block;
  height: 100%;
  border-radius: 0 3px 3px 0;
}

/* --- line plot: geometry in SVG, every label in HTML -------------------- */

/* The y-labels sit in a gutter outside the plot, so a line reaching the
   right edge never runs underneath its own axis label. */
.plot {
  position: relative;
  height: 9.5rem;
  margin-top: 0.4rem;
  margin-right: 3.6rem;
}

.plot-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.plot-grid {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1px solid var(--grid);
  pointer-events: none;
}

.plot-ylabel {
  position: absolute;
  right: -3.6rem;
  width: 3.3rem;
  top: -0.55rem;
  font-family: "Martian Mono", ui-monospace, monospace;
  font-size: 0.58rem;
  color: var(--ink-soft);
  text-align: right;
}

.plot-dot {
  position: absolute;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  /* The ring matches whatever sheet the plot is printed on. */
  box-shadow: 0 0 0 2px var(--sheet-bg, var(--paper));
  z-index: 2;
}

.plot-xlabels {
  display: flex;
  justify-content: space-between;
  margin-top: 0.5rem;
  margin-right: 3.6rem;
  gap: 0.25rem;
}

.plot-xlabel {
  font-family: "Martian Mono", ui-monospace, monospace;
  font-size: 0.58rem;
  color: var(--ink-soft);
  white-space: nowrap;
  min-width: 0;
}

/* --- form -------------------------------------------------------------- */

.form {
  display: grid;
  gap: 1.1rem;
  max-width: 34rem;
  margin-top: 1.75rem;
}

.field {
  display: grid;
  gap: 0.4rem;
}

.field input,
.field textarea {
  width: 100%;
  padding: 0.75rem 0.9rem;
  font-family: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: var(--paper);
  border: 1.5px solid var(--grid-strong);
  min-height: 2.9rem;
}

.field textarea {
  min-height: 6.5rem;
  resize: vertical;
  line-height: 1.55;
}

.field input:focus-visible,
.field textarea:focus-visible {
  border-color: var(--stamp);
}

.field-error {
  font-size: 0.78rem;
  color: var(--witness);
  min-height: 1.1rem;
}

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

.colophon {
  margin-top: 3rem;
  background: var(--buckram);
  color: oklch(93% 0.012 25);
  /* The binding cloth: a woven texture, drawn rather than photographed. */
  background-image: repeating-linear-gradient(
      90deg,
      oklch(100% 0 0 / 0.028) 0 1px,
      transparent 1px 3px
    ),
    repeating-linear-gradient(
      0deg,
      oklch(0% 0 0 / 0.05) 0 1px,
      transparent 1px 3px
    );
}

.colophon a {
  color: oklch(93% 0.012 25);
}

.colophon-inner {
  padding-block: 2.75rem 2rem;
  display: grid;
  gap: 1.9rem;
}

@media (min-width: 48rem) {
  .colophon-inner {
    grid-template-columns: 1.3fr 1fr;
    gap: 2.5rem;
  }
}

.colophon h2 {
  font-size: 1.28rem;
  margin-bottom: 0.55rem;
}

.colophon p {
  color: oklch(84% 0.018 25);
  font-size: 0.93rem;
}

.colophon nav {
  display: grid;
  gap: 0.55rem;
  align-content: start;
}

.colophon nav a {
  font-size: 0.9rem;
  text-decoration: none;
  color: oklch(88% 0.016 25);
  width: fit-content;
  border-bottom: 1.5px solid transparent;
}

.colophon nav a:hover {
  border-bottom-color: currentColor;
}

.colophon-rule {
  border-top: 1px solid oklch(100% 0 0 / 0.16);
  margin-top: 0.4rem;
  padding-top: 1.15rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.5rem;
  align-items: baseline;
  font-family: "Martian Mono", ui-monospace, monospace;
  font-size: 0.6rem;
  letter-spacing: 0.09em;
  color: oklch(78% 0.02 25);
  grid-column: 1 / -1;
}

.colophon .btn {
  border-color: oklch(93% 0.012 25);
  background: oklch(93% 0.012 25);
  color: var(--buckram-deep);
}

.colophon .btn:hover {
  background: var(--paper);
  border-color: var(--paper);
}

.colophon .btn--ghost {
  background: transparent;
  color: oklch(93% 0.012 25);
}

.colophon .btn--ghost:hover {
  background: oklch(100% 0 0 / 0.1);
  color: oklch(96% 0.01 25);
}

/* --- utilities --------------------------------------------------------- */

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

.skip-link {
  position: absolute;
  left: 0.5rem;
  top: -4rem;
  z-index: 100;
  background: var(--stamp);
  color: var(--paper);
  padding: 0.6rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  transition: top 0.14s var(--ease);
}

.skip-link:focus {
  top: 0.5rem;
}

.placeholder-mark {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: "Martian Mono", ui-monospace, monospace;
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--witness);
  border: 1.5px dashed currentColor;
  padding: 0.3rem 0.55rem;
}

.stack-line {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-block: 1rem;
}

.chip {
  font-family: "Martian Mono", ui-monospace, monospace;
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.07em;
  padding: 0.3rem 0.55rem;
  border: 1px solid var(--paper-edge);
  background: var(--paper-sunk);
  color: var(--ink-soft);
}

main {
  display: block;
}

/* --- case-page section rhythm ------------------------------------------ */
/* Spacing carries meaning: a major break gets room, a continuation of the
   same thought stays close to what it follows. */

.case-h--major {
  margin-top: 3.1rem;
}

.case-h--tight {
  margin-top: 1.75rem;
}
