/* ==========================================================================
   LEM — lem.css ("Faces", 2026-11)
   Own theme for the Layered Event Modelling line on barnes.ch/lem/.
   Visual grammar taken from the subject (Flächen statt Linien):
   - horizontal edges carry time (Δt); vertical crossings are dashed and carry none;
   - a filled face is a closed cell: published work (DOI);
   - a hatched face is a cell not yet closed: a working draft;
   - oxide red only for obstructions and wall breaches.
   Light first (STIX Two Text + JetBrains Mono), dark on request or by system.
   ========================================================================== */

:root {
  --ground: #ECEDE8;
  --ground-2: #E1E3DC;
  --ground-3: #D5D8CF;
  --ink: #151922;
  --ink-2: #434A59;
  --ink-3: #646B7B;
  --face: #2B3BB8;
  --face-ink: #F3F4FA;
  --face-ink-2: #C9CEF0;
  --face-tint: #D6DAF0;
  --oxide: #A83E25;
  --oxide-tint: #F1DCD3;
  --s1: #A87818;
  --s2: var(--face);
  --s3: #2A7A69;
  --s4: #737C8E;
  --s5: #7A2C45;
  --hatch: rgba(43, 59, 184, .26);

  --serif: 'STIX Two Text', 'STIX Two', Cambria, Georgia, serif;
  --mono: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;
  --gutter: 32px;
  --measure: 68ch;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #12141A; --ground-2: #1A1D26; --ground-3: #242835;
    --ink: #E7E9EF; --ink-2: #B4B9C6; --ink-3: #8A91A0;
    --face: #4A5BDF; --face-ink: #F5F6FD; --face-ink-2: #D3D8FA; --face-tint: #232A5C;
    --oxide: #E2714F; --oxide-tint: #3A1E17;
    --s1: #D3A24A; --s3: #4DB39B; --s4: #99A2B3; --s5: #C8668A;
    --hatch: rgba(120, 136, 255, .30);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ground: #12141A; --ground-2: #1A1D26; --ground-3: #242835;
  --ink: #E7E9EF; --ink-2: #B4B9C6; --ink-3: #8A91A0;
  --face: #4A5BDF; --face-ink: #F5F6FD; --face-ink-2: #D3D8FA; --face-tint: #232A5C;
  --oxide: #E2714F; --oxide-tint: #3A1E17;
  --s1: #D3A24A; --s3: #4DB39B; --s4: #99A2B3; --s5: #C8668A;
  --hatch: rgba(120, 136, 255, .30);
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--ground); color: var(--ink);
  font-family: var(--serif); font-size: 19px; line-height: 1.62;
  font-variant-numeric: oldstyle-nums proportional-nums;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration-color: var(--face); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--face); }
button { font: inherit; color: inherit; }
h1, h2, h3, h4, p, figure, dl, dd, ol, ul, blockquote { margin: 0; }
code, pre, kbd { font-family: var(--mono); font-variant-numeric: normal; }
code { font-size: .8em; padding: .08em .3em; background: var(--ground-2); border-radius: 3px; }
::selection { background: var(--face); color: var(--face-ink); }
:focus-visible { outline: 2px solid var(--face); outline-offset: 3px; }
.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 var(--gutter); }
.skip { position: absolute; left: -9999px; top: 8px; z-index: 100; background: var(--face); color: var(--face-ink); padding: 8px 14px; }
.skip:focus { left: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- top bar: a plane, not a rule ---------- */
.bar { position: sticky; top: 0; z-index: 40; background: var(--ground-2); }
.bar-inner { display: flex; align-items: center; gap: 26px; height: 60px; }
.mark { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; margin-right: auto; font-weight: 600; font-size: 20px; letter-spacing: .02em; }
.mark svg { width: 30px; height: 24px; }
.mark small { font-weight: 400; font-size: 15px; color: var(--ink-3); letter-spacing: 0; }
.bar nav { display: flex; gap: 22px; font-size: 16px; }
.bar nav a { text-decoration: none; color: var(--ink-2); }
.bar nav a:hover, .bar nav a[aria-current] { color: var(--face); }
.theme { background: none; border: 0; padding: 4px 0; font-size: 15px; color: var(--ink-3); cursor: pointer; text-decoration: underline; text-decoration-color: var(--ink-3); text-underline-offset: 3px; }
.theme:hover { color: var(--face); }

/* ---------- landing header & legend ---------- */
.atlas-head {
  padding-top: 44px;
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: 24px 40px;
  align-items: end;
}
.atlas-kicker {
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 8px;
}
.atlas-head h1 {
  font-weight: 500;
  font-size: clamp(36px, 4.8vw, 58px);
  line-height: 1.02;
  letter-spacing: -.02em;
}
.atlas-head h2 {
  font-weight: 500;
  font-size: clamp(30px, 3.8vw, 44px);
  line-height: 1.04;
  letter-spacing: -.015em;
}
.atlas-intro {
  margin-top: 12px;
  max-width: 58ch;
  font-size: 18px;
  line-height: 1.5;
  color: var(--ink-2);
}
.atlas-controls {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}
.jump-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 15px;
  background: var(--ground-2);
  border: 1px solid color-mix(in srgb, var(--ink-3) 35%, transparent);
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--ink);
  text-decoration: none;
  transition: background-color .16s ease, border-color .16s ease, color .16s ease;
}
.jump-link:hover {
  background: var(--face);
  border-color: var(--face);
  color: var(--face-ink);
}
.legend-note {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-3);
}
.legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}
.legend-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  background: var(--ground-2);
  border: 1px solid transparent;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-2);
  cursor: pointer;
  transition: background-color .16s ease, color .16s ease, border-color .16s ease;
}
.legend-btn:hover { color: var(--ink); border-color: var(--ink-3); }
.legend-btn[aria-pressed="true"] {
  background: var(--ink);
  color: var(--ground);
}
.legend-btn .count { opacity: .68; }
.key-swatch {
  width: 11px;
  height: 11px;
  flex: none;
  display: inline-block;
}
.key-swatch.is-core { background: var(--face); }
.key-swatch.is-published { background: var(--face-tint); box-shadow: inset 0 0 0 1px var(--face); }
.key-swatch.is-draft {
  background: repeating-linear-gradient(135deg, var(--face) 0 1.5px, transparent 1.5px 4px);
  box-shadow: inset 0 0 0 1px var(--face);
}
.key-swatch.is-empty {
  background: var(--ground);
  border: 1.5px dashed var(--ink-3);
}
.legend-btn[aria-pressed="true"] .key-swatch.is-empty {
  background: transparent;
  border-color: var(--ground);
}

/* ---------- the patchwork quilt around the LEM v1.0 core ---------- */
.patchwork-section {
  padding-top: 76px;
}
.patchwork-section .atlas-head {
  padding-top: 0;
  margin-bottom: 24px;
}
.patchwork-wrap {
  padding-top: 0;
}
.quilt {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-template-rows: auto auto auto auto;
  gap: 10px;
  padding: 10px;
  background: var(--ground-3);
  position: relative;
}

/* Base patch tile */
.patch {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 22px 24px 20px;
  background: var(--ground-2);
  color: var(--ink);
  transition: opacity .22s ease, background-color .18s ease, box-shadow .18s ease;
}
.patch-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 10px;
}
.patch-kind {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: .03em;
  color: var(--face);
}
.patch-seam {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  white-space: nowrap;
}
.patch h2, .patch h3 {
  font-weight: 500;
  font-size: clamp(21px, 2vw, 26px);
  line-height: 1.15;
  letter-spacing: -.012em;
}
.patch h3 a, .patch h2 a { text-decoration: none; }
.patch h3 a:hover, .patch h2 a:hover { color: var(--face); }
.patch .sub {
  display: block;
  margin-top: 4px;
  font-size: 15.5px;
  font-style: italic;
  font-weight: 400;
  line-height: 1.32;
  color: var(--ink-2);
}
.patch .body {
  margin-top: 10px;
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink-2);
}
.patch .meta-line {
  margin-top: auto;
  padding-top: 14px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-3);
}
.patch .links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid color-mix(in srgb, var(--ink) 10%, transparent);
  font-size: 15.5px;
}
.patch .links a {
  color: var(--ink);
  text-decoration-color: var(--face);
}
.patch .links a:hover { color: var(--face); }

/* Closed published paper patch */
.patch.is-published {
  background: var(--face-tint);
}
.patch.is-published:hover {
  box-shadow: inset 0 0 0 1.5px var(--face);
}

/* Formal code & quiet published patches */
.patch.is-code, .patch.is-essays {
  background: var(--ground-2);
}
.patch.is-code:hover, .patch.is-essays:hover, .patch.is-instantiation:hover {
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--face) 65%, transparent);
}
.patch.is-instantiation {
  background: var(--ground-2);
  box-shadow: inset 4px 0 0 var(--s1);
}
.patch.is-instantiation .patch-kind { color: var(--s1); }

/* Working draft: open cell with hatched cobalt rim */
.patch.is-draft, .callout.warning {
  border: 10px solid transparent;
  background:
    linear-gradient(var(--ground), var(--ground)) padding-box,
    repeating-linear-gradient(135deg, var(--face) 0 1.5px, transparent 1.5px 6px) border-box;
}
.patch.is-draft {
  padding: 16px 18px 14px;
}
.patch.is-draft .patch-kind { font-style: italic; }
.patch.is-draft:hover {
  box-shadow: 0 0 0 1px var(--face);
}

/* Empty / unvisited patches: honest open ground in the patchwork */
.patch.is-empty {
  background:
    radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--ink-3) 20%, transparent) 1px, transparent 0) 0 0 / 14px 14px,
    var(--ground);
  border: 1.5px dashed color-mix(in srgb, var(--ink-3) 55%, transparent);
  color: var(--ink-3);
  justify-content: space-between;
}
.patch.is-empty::before,
.patch.is-empty::after {
  content: "+";
  position: absolute;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1;
  color: color-mix(in srgb, var(--ink-3) 55%, transparent);
  pointer-events: none;
}
.patch.is-empty::before { top: 6px; left: 8px; }
.patch.is-empty::after { bottom: 6px; right: 8px; }
.patch.is-empty .patch-top { margin-top: 4px; }
.patch.is-empty .patch-kind { color: var(--ink-3); }
.patch.is-empty h3 {
  font-size: 19px;
  font-weight: 400;
  font-style: italic;
  color: var(--ink-2);
}
.patch.is-empty .body {
  font-size: 15px;
  color: var(--ink-3);
  margin-top: 8px;
}
.patch.is-empty:hover {
  border-color: var(--ink-2);
}
/* Completely unclaimed / blank patch */
.patch.is-blank {
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 168px;
  padding: 24px 20px;
}
.blank-mark {
  width: 54px;
  height: 36px;
  margin-bottom: 10px;
  opacity: .55;
}
.patch.is-blank .blank-label {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-3);
  letter-spacing: .04em;
}
.patch.is-blank .blank-note {
  margin-top: 6px;
  font-size: 14.5px;
  font-style: italic;
  color: var(--ink-3);
  max-width: 24ch;
  line-height: 1.4;
}

/* ★ THE CENTER CORE: LEM v1.0 ★ */
.patch.is-core {
  background: var(--face);
  color: var(--face-ink);
  padding: clamp(26px, 3vw, 38px);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--face-ink) 22%, transparent);
  justify-content: space-between;
}
/* Subtle 2-cell boundary ticks embedded on the core frame */
.core-axis {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--face-ink-2);
}
.core-axis > span:not(.core-axis-line) { white-space: nowrap; }
.core-axis-line {
  flex: 1;
  min-width: 24px;
  height: 1px;
  background: color-mix(in srgb, var(--face-ink) 38%, transparent);
  position: relative;
}
.core-axis-line::after {
  content: "";
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  border: 4px solid transparent;
  border-left: 6px solid color-mix(in srgb, var(--face-ink) 65%, transparent);
  border-right: 0;
}
.patch.is-core h2 {
  margin-top: 14px;
  font-weight: 500;
  font-size: clamp(38px, 4.2vw, 56px);
  line-height: 1;
  letter-spacing: -.022em;
  color: var(--face-ink);
}
.patch.is-core .sub {
  margin-top: 8px;
  font-size: 18px;
  color: var(--face-ink-2);
}
.patch.is-core .core-claim {
  margin-top: 18px;
  padding-left: 16px;
  border-left: 2px solid color-mix(in srgb, var(--face-ink) 50%, transparent);
  font-style: italic;
  font-size: clamp(18px, 1.7vw, 21px);
  line-height: 1.38;
  color: var(--face-ink);
}
.patch.is-core .body {
  margin-top: 16px;
  font-size: 16.5px;
  line-height: 1.54;
  color: var(--face-ink-2);
}
.core-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin-top: 18px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--face-ink-2);
}
.core-facts a {
  color: var(--face-ink);
  text-decoration-color: color-mix(in srgb, var(--face-ink) 50%, transparent);
}
.patch.is-core .links {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid color-mix(in srgb, var(--face-ink) 24%, transparent);
  gap: 8px 12px;
}
.patch.is-core .links a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 13px;
  background: rgba(255, 255, 255, .13);
  color: var(--face-ink);
  text-decoration: none;
  font-size: 15px;
  transition: background-color .15s ease;
}
.patch.is-core .links a:hover {
  background: rgba(255, 255, 255, .24);
  color: var(--face-ink);
}
.patch.is-core .links a.primary {
  background: var(--face-ink);
  color: var(--face);
  font-weight: 500;
}
.patch.is-core .links a.primary:hover {
  background: #ffffff;
}
.core-bottom-axis {
  margin-top: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--mono);
  font-size: 11px;
  color: color-mix(in srgb, var(--face-ink) 72%, transparent);
}

/* Essay lists inside South / South-West patches */
.essay-list {
  list-style: none;
  padding: 0;
  margin-top: 12px;
  display: grid;
  gap: 8px;
}
.essay-list.two-col {
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
}
.essay-item a {
  display: block;
  padding: 10px 12px;
  background: var(--ground);
  text-decoration: none;
  transition: background-color .15s ease;
}
.essay-item a:hover {
  background: var(--face-tint);
  color: var(--ink);
}
.essay-item strong {
  display: block;
  font-weight: 500;
  font-size: 16.5px;
  line-height: 1.24;
  color: var(--ink);
}
.essay-item .emeta {
  display: block;
  margin-top: 3px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
}
.essay-item .edesc {
  display: block;
  margin-top: 4px;
  font-size: 14.5px;
  line-height: 1.38;
  color: var(--ink-2);
}

/* Desktop 12-column interlocking patchwork placement around the dead-center Core */
.pos-nw     { grid-column: 1 / span 5;  grid-row: 1; }
.pos-n      { grid-column: 6 / span 4;  grid-row: 1; }
.pos-ne     { grid-column: 10 / span 3; grid-row: 1; }
.pos-w-top  { grid-column: 1 / span 3;  grid-row: 2; }
.pos-w-bot  { grid-column: 1 / span 3;  grid-row: 3; }
.pos-core   { grid-column: 4 / span 6;  grid-row: 2 / span 2; }
.pos-e-top  { grid-column: 10 / span 3; grid-row: 2; }
.pos-e-bot  { grid-column: 10 / span 3; grid-row: 3; }
.pos-sw     { grid-column: 1 / span 4;  grid-row: 4; }
.pos-s      { grid-column: 5 / span 5;  grid-row: 4; }
.pos-se     { grid-column: 10 / span 3; grid-row: 4; }

/* Legend filter state: dim non-matching patches without shifting the spatial map */
.quilt[data-filter="core"] .patch:not([data-state="core"]),
.quilt[data-filter="published"] .patch:not([data-state="published"]),
.quilt[data-filter="draft"] .patch:not([data-state="draft"]),
.quilt[data-filter="empty"] .patch:not([data-state="empty"]) {
  opacity: .24;
}
.quilt[data-filter] .patch:hover {
  opacity: 1;
}

/* Subtle core-edge glow when hovering an adjacent patch */
.patch.is-core[data-edge="n"]  { box-shadow: inset 0 4px 0 var(--face-ink), inset 0 0 0 2px color-mix(in srgb, var(--face-ink) 22%, transparent); }
.patch.is-core[data-edge="s"]  { box-shadow: inset 0 -4px 0 var(--face-ink), inset 0 0 0 2px color-mix(in srgb, var(--face-ink) 22%, transparent); }
.patch.is-core[data-edge="w"]  { box-shadow: inset 4px 0 0 var(--face-ink), inset 0 0 0 2px color-mix(in srgb, var(--face-ink) 22%, transparent); }
.patch.is-core[data-edge="e"]  { box-shadow: inset -4px 0 0 var(--face-ink), inset 0 0 0 2px color-mix(in srgb, var(--face-ink) 22%, transparent); }

.atlas-caption {
  margin-top: 14px;
  max-width: 76ch;
  font-size: 15.5px;
  color: var(--ink-3);
}
.atlas-caption a { color: var(--ink-2); }

/* ---------- section heads ---------- */
.section { padding-top: 84px; }
.head { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 40px; align-items: end; margin-bottom: 30px; }
.head h2 { font-weight: 500; font-size: clamp(30px, 3.8vw, 44px); line-height: 1.05; letter-spacing: -.012em; }
.head p { color: var(--ink-2); max-width: 58ch; font-size: 18px; }
.cell-caption { margin-top: 14px; max-width: var(--measure); font-size: 15.5px; color: var(--ink-3); }
.cell-caption a { color: var(--ink-2); }

/* ---------- structures figure ---------- */
.structs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.struct { padding: 20px 18px 18px; background: var(--ground-2); }
.struct h3 { font-weight: 500; font-size: 18.5px; line-height: 1.2; display: flex; gap: 8px; align-items: baseline; }
.struct h3 .sid { font-family: var(--mono); font-size: 13px; color: var(--ink-3); }
.struct .swatch { height: 6px; margin: -20px -18px 16px; }
.struct ol { margin-top: 12px; font-size: 16px; color: var(--ink-2); display: grid; gap: 2px; list-style: none; padding: 0; }
.struct .note { margin-top: 12px; font-size: 14.5px; font-style: italic; color: var(--ink-3); }
.struct.focal { background: var(--face); color: var(--face-ink); }
.struct.focal h3 .sid, .struct.focal ol, .struct.focal .note { color: var(--face-ink-2); }
.edges { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 10px; }
.edge { padding: 18px 20px; background: var(--ground-2); }
.edge dt { font-weight: 600; font-size: 18px; display: flex; align-items: center; gap: 10px; }
.edge dd { margin-top: 4px; font-size: 16px; color: var(--ink-2); }
.edge .stroke { width: 34px; height: 2px; flex: none; }
.stroke.causal { background: var(--ink); }
.stroke.constitutive { background: repeating-linear-gradient(90deg, var(--ink) 0 2px, transparent 2px 5px); }
.stroke.classificatory { background: repeating-linear-gradient(90deg, var(--ink) 0 7px, transparent 7px 11px); }
.stroke.normative { background: repeating-linear-gradient(90deg, var(--s5) 0 7px, transparent 7px 10px, var(--s5) 10px 12px, transparent 12px 15px); }
.stroke.representational { background: repeating-linear-gradient(90deg, var(--s3) 0 12px, transparent 12px 16px); }
.stroke.evidential { background: repeating-linear-gradient(90deg, var(--s4) 0 1px, transparent 1px 4px); height: 3px; }
.edge.is-causal { background: var(--face-tint); }

/* ---------- cite ---------- */
.cites { display: grid; gap: 10px; }
.cite { display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: start; padding: 20px 24px; background: var(--ground-2); }
.cite p { font-size: 17px; color: var(--ink-2); }
.cite em { color: var(--ink); }
.copy { background: var(--ground); border: 0; padding: 6px 14px; font-size: 14.5px; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.copy:hover, .copy[data-done] { background: var(--face); color: var(--face-ink); }

/* ---------- footer: a plane ---------- */
.foot { margin-top: 120px; padding: 40px 0 44px; background: var(--ground-2); font-size: 16px; color: var(--ink-2); }
.foot-row { display: flex; flex-wrap: wrap; gap: 14px 32px; justify-content: space-between; align-items: baseline; }
.foot nav { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.foot nav a { text-decoration: none; }
.foot small { display: block; margin-top: 18px; font-size: 14px; color: var(--ink-3); }

/* ==========================================================================
   Essay pages
   ========================================================================== */
.paper { max-width: 760px; margin: 0 auto; padding: 72px var(--gutter) 0; }
.paper-header { padding: 0; }
.badge-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 26px; }
.badge { font-size: 15px; padding: 3px 12px; background: var(--ground-2); color: var(--ink-2); }
.badge.draft { background: repeating-linear-gradient(135deg, var(--hatch) 0 1.5px, transparent 1.5px 7px), var(--ground); box-shadow: inset 0 0 0 1.5px var(--face); color: var(--face); font-style: italic; }
.badge.series { background: var(--face-tint); color: var(--ink); }
.paper h1 { font-weight: 500; font-size: clamp(42px, 7vw, 76px); line-height: 1; letter-spacing: -.02em; }
.paper .subtitle { margin-top: 16px; font-size: clamp(21px, 2.4vw, 26px); font-style: italic; line-height: 1.3; color: var(--ink-2); max-width: 32ch; }
.meta-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 32px; font-size: 16px; color: var(--ink-2); }
.meta-grid > div { padding: 12px 16px; background: var(--ground-2); }
.meta-grid strong { display: block; font-weight: 400; font-size: 14px; color: var(--ink-3); }
.abstract-box { margin-top: 44px; padding: 30px 32px; background: var(--face); color: var(--face-ink); }
.abstract-box .label { font-weight: 600; font-size: 17px; margin-bottom: 10px; }
.abstract-box p { font-size: 18px; line-height: 1.6; }
.abstract-box p + p { margin-top: 14px; }
.abstract-box code { background: rgba(255, 255, 255, .16); color: var(--face-ink); }
.abstract-box .keywords { margin-top: 18px; font-size: 15.5px; color: var(--face-ink-2); }
.abstract-box .keywords strong { font-weight: 600; color: var(--face-ink); }
.toc { margin-top: 10px; padding: 24px 32px; background: var(--ground-2); }
.toc-title { font-weight: 600; font-size: 17px; margin-bottom: 8px; }
.toc ol { padding-left: 1.4em; font-size: 17px; color: var(--ink-2); display: grid; gap: 2px; }
.toc a { text-decoration: none; }
.toc a:hover { text-decoration: underline; }

.paper section { margin-top: 64px; }
.paper h2 { font-weight: 500; font-size: clamp(27px, 3.2vw, 34px); line-height: 1.15; letter-spacing: -.01em; margin-bottom: 20px; display: flex; gap: 16px; align-items: baseline; }
.sec-num { flex: none; display: inline-grid; place-items: center; min-width: 42px; height: 42px; padding: 0 8px; background: var(--face); color: var(--face-ink); font-size: 22px; font-weight: 500; font-variant-numeric: lining-nums; transform: translateY(4px); }
.paper h3 { font-weight: 600; font-size: 22px; margin: 36px 0 12px; }
.paper p { margin-top: 16px; }
.paper section > p:first-of-type, .paper h2 + p { margin-top: 0; }
.paper ul, .paper ol { margin-top: 14px; padding-left: 1.3em; display: grid; gap: 8px; }
.paper li::marker { color: var(--face); }
.paper strong { font-weight: 600; }

ul.premises { list-style: none; padding: 0; gap: 10px; margin-top: 22px; }
ul.premises li { padding: 20px 24px; background: var(--ground-2); }
ul.premises .tag { display: inline-grid; place-items: center; min-width: 36px; height: 26px; margin-right: 10px; padding: 0 6px; background: var(--face); color: var(--face-ink); font-family: var(--mono); font-size: 13px; vertical-align: 2px; }

.callout { margin-top: 28px; padding: 26px 30px; background: var(--face-tint); }
.callout-title { display: block; font-weight: 600; font-size: 18px; margin-bottom: 6px; }
.callout p { margin-top: 8px; }
.callout.thesis { background: var(--face); color: var(--face-ink); }
.callout.thesis code { background: rgba(255, 255, 255, .16); color: var(--face-ink); }
.callout.definition { background: var(--face-tint); }
.callout.obstruction { background: var(--ground-2); box-shadow: inset 4px 0 0 var(--face); }
/* the limits are an open cell: hatched rim (see .patch.is-draft), wider on essay pages */
.callout.warning { border-width: 12px; padding: 22px 24px; }
/* wide material breaks out of the text column on large screens */
.paper figure.fig, .paper .table-wrap, .paper pre {
  width: min(1060px, calc(100vw - 2 * var(--gutter)));
  position: relative; left: 50%; transform: translateX(-50%);
}
.paper .table-caption { max-width: none; }

figure.fig { margin: 34px 0 6px; }
figure.fig .fig-frame { background: var(--ground-2); padding: 18px; overflow-x: auto; }
figure.fig svg { min-width: 640px; width: 100%; height: auto; }
figure.fig figcaption { margin-top: 12px; font-size: 16px; color: var(--ink-2); }
figure.fig figcaption strong { color: var(--ink); }

.table-wrap { margin-top: 26px; overflow-x: auto; }
.table-wrap table { width: 100%; min-width: 760px; border-collapse: separate; border-spacing: 0 6px; font-size: 15.5px; line-height: 1.45; }
.table-wrap th { text-align: left; font-weight: 600; font-size: 14.5px; color: var(--ink-3); padding: 6px 14px; vertical-align: bottom; }
.table-wrap td { padding: 14px; vertical-align: top; background: var(--ground-2); }
.table-wrap td:first-child { background: var(--face-tint); }
.table-wrap td:last-child { background: var(--oxide-tint); }
.table-wrap code { background: transparent; padding: 0; }
.table-caption { margin-top: 8px; font-size: 15.5px; color: var(--ink-3); }

pre { margin: 26px 0 0; padding: 22px 24px; background: var(--ground-2); overflow-x: auto; font-size: 13.5px; line-height: 1.6; color: var(--ink); }
pre code { background: none; padding: 0; font-size: inherit; }
pre .cm { color: var(--ink-3); font-style: italic; }
pre .kw { color: var(--face); font-weight: 500; }
pre .ty { color: var(--s3); }

ul.refs { list-style: none; padding: 0; font-size: 16px; color: var(--ink-2); gap: 10px; }
ul.refs li { padding-left: 1.4em; text-indent: -1.4em; }
.paper-footer { margin-top: 56px; padding: 18px 22px; background: var(--ground-2); font-size: 15px; color: var(--ink-3); }

/* ---------- wide container for the patchwork atlas ---------- */
.container-wide { width: 100%; max-width: 1320px; margin: 0 auto; padding-inline: var(--gutter); }

/* ---------- subtle patchwork motion ---------- */
/* Traveling Δt bead along the Core's top causal axis */
.core-axis-line { overflow: visible; }
.core-axis-line::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--face-ink);
  transform: translate(0, -50%);
  animation: coreAxisPulse 4.6s cubic-bezier(.4, 0, .2, 1) infinite;
}
@keyframes coreAxisPulse {
  0%   { left: 0%; opacity: 0; }
  12%  { opacity: 1; }
  80%  { left: calc(100% - 10px); opacity: 1; }
  92%  { left: calc(100% - 6px); opacity: 0; }
  100% { left: calc(100% - 6px); opacity: 0; }
}

/* Radial staggered settle outward from the LEM v1.0 Core */
@keyframes patchSettle {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.quilt .patch { animation: patchSettle .48s cubic-bezier(.22, 1, .36, 1) backwards; }
.quilt .pos-core   { animation-delay: 0ms; }
.quilt .pos-n,
.quilt .pos-s,
.quilt .pos-w-top,
.quilt .pos-e-top  { animation-delay: 90ms; }
.quilt .pos-nw,
.quilt .pos-w-bot,
.quilt .pos-e-bot,
.quilt .pos-sw     { animation-delay: 170ms; }
.quilt .pos-ne,
.quilt .pos-se     { animation-delay: 240ms; }

/* Gentle dashed-frame drift on the unvisited blank patch */
@keyframes dashDrift {
  to { stroke-dashoffset: -28; }
}
.blank-mark rect { animation: dashDrift 7s linear infinite; }

/* ---------- interactive motion graphic explainer ("The idea in motion") ---------- */
.motion-section { padding-top: 22px; }
.motion-stage {
  display: grid;
  grid-template-columns: minmax(0, 7.5fr) minmax(0, 4.5fr);
  gap: 10px;
  padding: 10px;
  background: var(--ground-3);
}
.motion-canvas {
  background: var(--ground);
  padding: 20px 22px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
}
.motion-canvas-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-3);
}
.motion-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}
.motion-btn {
  padding: 4px 10px;
  background: var(--ground-2);
  border: 1px solid color-mix(in srgb, var(--ink-3) 35%, transparent);
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-2);
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.motion-btn:hover { color: var(--ink); border-color: var(--ink-2); }
.motion-btn[aria-pressed="true"] {
  background: var(--oxide);
  border-color: var(--oxide);
  color: var(--face-ink);
}
.motion-btn.is-hidden { display: none; }

.lem-svg { width: 100%; height: auto; display: block; }
.lem-svg .m-scene {
  opacity: 0;
  pointer-events: none;
  transition: opacity .42s ease;
}
.lem-svg[data-active="1"] .m-scene[data-scene="1"],
.lem-svg[data-active="2"] .m-scene[data-scene="2"],
.lem-svg[data-active="3"] .m-scene[data-scene="3"] {
  opacity: 1;
  pointer-events: auto;
}
/* SVG token classes */
/* stroke-only shapes are unfilled; a sg-* class below wins by source order */
.lem-svg :is(.st-ink, .st-ink3, .st-face, .st-ox, .st-s3, .st-s5) { fill: none; }
.lem-svg .sg-ground  { fill: var(--ground); }
.lem-svg .sg-ground2 { fill: var(--ground-2); }
.lem-svg .sg-face    { fill: var(--face); }
.lem-svg .sg-facet   { fill: var(--face-tint); }
.lem-svg .sg-oxt     { fill: var(--oxide-tint); }
.lem-svg .sg-ink     { fill: var(--ink); }
.lem-svg .sg-ox      { fill: var(--oxide); }
.lem-svg .sg-s1      { fill: var(--s1); }
.lem-svg .sg-s3      { fill: var(--s3); }
.lem-svg .sg-s5      { fill: var(--s5); }
.lem-svg .st-ink     { stroke: var(--ink); }
.lem-svg .st-ink3    { stroke: var(--ink-3); }
.lem-svg .st-face    { stroke: var(--face); }
.lem-svg .st-ox      { stroke: var(--oxide); }
.lem-svg .st-s3      { stroke: var(--s3); }
.lem-svg .st-s5      { stroke: var(--s5); }
.lem-svg text        { font-family: var(--serif); fill: var(--ink-2); font-size: 13px; }
.lem-svg .tx-h       { fill: var(--ink); font-size: 14px; font-weight: 600; }
.lem-svg .tx-m       { font-family: var(--mono); font-size: 11px; fill: var(--ink-2); }
.lem-svg .tx-m3      { font-family: var(--mono); font-size: 10.5px; fill: var(--ink-3); }
.lem-svg .tx-ox      { font-family: var(--mono); font-size: 11px; fill: var(--oxide); font-weight: 500; }
.lem-svg .tx-fh      { fill: var(--face-ink); font-size: 15.5px; font-weight: 600; }
.lem-svg .tx-fs      { fill: var(--face-ink-2); font-size: 12px; }
.lem-svg .tx-node    { font-family: var(--mono); font-size: 12px; fill: var(--ink); font-weight: 500; }
.lem-svg .tx-band    { font-family: var(--mono); font-size: 10.5px; letter-spacing: .04em; text-transform: uppercase; }

/* Scene 1: ambiguous pulse crossing flat arrows */
@keyframes flatPulse {
  0%   { transform: translateX(0px); opacity: 0; }
  8%   { opacity: 1; }
  90%  { transform: translateX(486px); opacity: 1; }
  100% { transform: translateX(486px); opacity: 0; }
}
@keyframes qBlink {
  0%, 34%  { opacity: .35; transform: translateY(0); }
  48%, 68% { opacity: 1; transform: translateY(-3px); }
  82%, 100%{ opacity: .35; transform: translateY(0); }
}
.lem-svg[data-active="1"] .s1-pulse { animation: flatPulse 3.6s linear infinite; }
.lem-svg[data-active="1"] .s1-q1    { animation: qBlink 3.6s ease-in-out infinite; animation-delay: .5s; }
.lem-svg[data-active="1"] .s1-q2    { animation: qBlink 3.6s ease-in-out infinite; animation-delay: 1.5s; }
.lem-svg .s-nodes-front { transform: translateZ(0); }

/* Scene 2: causal Δt pulse + non-causal edges (no Δt) */
@keyframes causalBead {
  0%   { transform: translateX(0px); opacity: 0; }
  8%   { opacity: 1; }
  84%  { transform: translateX(354px); opacity: 1; }
  94%  { transform: translateX(354px); opacity: 0; }
  100% { transform: translateX(354px); opacity: 0; }
}
@keyframes dtBarGrow {
  0%   { transform: scaleX(0); }
  84%  { transform: scaleX(1); }
  100% { transform: scaleX(1); }
}
@keyframes crossFlashLeft {
  0%, 10%  { opacity: .35; }
  14%, 26% { opacity: 1; stroke-width: 2.8; }
  36%, 100%{ opacity: .35; }
}
@keyframes crossFlashRight {
  0%, 72%  { opacity: .35; }
  78%, 92% { opacity: 1; stroke-width: 2.8; }
  98%, 100%{ opacity: .35; }
}
.lem-svg[data-active="2"] .s2-bead  { animation: causalBead 4.2s cubic-bezier(.35, 0, .25, 1) infinite; }
.lem-svg[data-active="2"] .s2-dtbar { transform-box: fill-box; transform-origin: left center; animation: dtBarGrow 4.2s cubic-bezier(.35, 0, .25, 1) infinite; }
.lem-svg[data-active="2"] .s2-cross-l { animation: crossFlashLeft 4.2s ease-out infinite; }
.lem-svg[data-active="2"] .s2-cross-r { animation: crossFlashRight 4.2s ease-out infinite; }

/* Scene 3: 2-cell face sealing vs. oxide-red breach */
@keyframes cellChainBead {
  0%   { transform: translateX(0px); opacity: 0; }
  8%   { opacity: 1; }
  86%  { transform: translateX(390px); opacity: 1; }
  95%  { transform: translateX(390px); opacity: 0; }
  100% { transform: translateX(390px); opacity: 0; }
}
@keyframes faceSeal {
  0%, 10%  { opacity: .86; }
  48%, 84% { opacity: 1; }
  100%     { opacity: .86; }
}
@keyframes breachArrow {
  0%, 18%  { stroke-dashoffset: 72; opacity: 0; }
  38%, 84% { stroke-dashoffset: 0; opacity: 1; }
  100%     { stroke-dashoffset: 0; opacity: .35; }
}
.lem-svg[data-active="3"] .s3-bead-low { animation: cellChainBead 4.4s linear infinite; }
.lem-svg[data-active="3"] .s3-bead-top { animation: cellChainBead 4.4s linear infinite; }
.lem-svg[data-active="3"] .s3-face-sealed { animation: faceSeal 4.4s ease-in-out infinite; }
.lem-svg .s3-breach-layer { opacity: 0; transition: opacity .3s ease; }
.lem-svg .s3-sealed-layer { opacity: 1; transition: opacity .3s ease; }
.lem-svg.is-breach .s3-breach-layer { opacity: 1; }
.lem-svg.is-breach .s3-sealed-layer { opacity: 0; }
.lem-svg.is-breach .s3-breach-path {
  stroke-dasharray: 72;
  animation: breachArrow 2.6s cubic-bezier(.22, 1, .36, 1) infinite;
}

/* Pause all SVG animations when paused */
.motion-stage.is-paused .lem-svg * { animation-play-state: paused !important; }

/* Right rail: 3 clickable story steps */
.motion-rail {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.motion-step {
  position: relative;
  text-align: left;
  width: 100%;
  padding: 16px 18px 18px;
  background: var(--ground-2);
  border: 0;
  border-left: 3px solid transparent;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 5px;
  transition: background-color .16s ease, border-color .16s ease;
}
.motion-step:hover { background: var(--ground); }
.motion-step[aria-selected="true"] {
  background: var(--ground);
  border-left-color: var(--face);
}
.motion-step .step-num {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--face);
}
.motion-step strong {
  font-weight: 500;
  font-size: 19px;
  line-height: 1.2;
  color: var(--ink);
}
.motion-step p {
  font-size: 15px;
  line-height: 1.46;
  color: var(--ink-2);
}
.step-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: color-mix(in srgb, var(--ink) 8%, transparent);
  overflow: hidden;
}
.step-progress::after {
  content: "";
  display: block;
  height: 100%;
  width: 100%;
  background: var(--face);
  transform-origin: left center;
  transform: scaleX(0);
}
.motion-step[aria-selected="true"] .step-progress::after {
  animation: stepFill 6.5s linear forwards;
}
.motion-stage.is-paused .motion-step[aria-selected="true"] .step-progress::after {
  animation-play-state: paused;
}
@keyframes stepFill {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

/* ---------- responsive ---------- */
@media (max-width: 1120px) {
  .atlas-head { grid-template-columns: 1fr; gap: 18px; }
  .atlas-controls { align-items: flex-start; }
  .legend { justify-content: flex-start; }
  .quilt { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: auto; }
  .pos-nw, .pos-n, .pos-ne,
  .pos-w-top, .pos-w-bot,
  .pos-core,
  .pos-e-top, .pos-e-bot,
  .pos-sw, .pos-s, .pos-se {
    grid-column: auto;
    grid-row: auto;
  }
  .pos-core { grid-column: 1 / -1; order: -10; }
  .pos-nw   { order: -8; }
  .pos-n    { order: -7; }
  .pos-w-top { order: -6; }
  .pos-e-top { order: -5; }
  .pos-s    { grid-column: 1 / -1; order: -4; }
  .pos-sw   { grid-column: 1 / -1; order: -3; }
  .pos-ne   { order: 1; }
  .pos-w-bot { order: 2; }
  .pos-se   { order: 3; }
  .pos-e-bot { order: 4; }
  .motion-stage { grid-template-columns: 1fr; }
}
@media (max-width: 1000px) {
  .head { grid-template-columns: 1fr; gap: 20px; }
  .structs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .struct.focal { grid-column: 1 / -1; }
  .edges { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 700px) {
  :root { --gutter: 16px; }
  body { font-size: 18px; }
  .bar nav { display: none; }
  .atlas-head { padding-top: 28px; }
  .quilt { grid-template-columns: 1fr; padding: 8px; gap: 8px; }
  .patch { padding: 20px 18px; }
  .patch.is-draft { padding: 14px 14px; }
  .essay-list.two-col { grid-template-columns: 1fr; }
  .edges, .structs { grid-template-columns: 1fr; }
  .motion-canvas { padding: 14px 12px; }
  .motion-canvas-bar { flex-wrap: wrap; }
  .cite { grid-template-columns: 1fr; }
  .cite .copy { justify-self: start; }
  .meta-grid { grid-template-columns: 1fr; }
  .abstract-box, .callout, .toc { padding: 22px 20px; }
  .paper { padding-top: 48px; }
  .paper h2 { gap: 12px; }
  .sec-num { min-width: 36px; height: 36px; font-size: 19px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .patch, .legend-btn, .essay-item a, .lem-svg .m-scene { transition: none; }
  .quilt .patch, .core-axis-line::before, .blank-mark rect, .lem-svg *, .step-progress::after {
    animation: none !important;
  }
}
