/* ═══════════════════════════════════════════════════════════════
   AnnoGram: An Annotative Grammar of Graphics Extension
   A sibling of the Annotation Survey, Design, and Strategies sites:
   paper on a quiet desk, Lora for reading, Inter for interface,
   hairline rules, one navy accent, one warm highlight. Code and
   grammar are set in a third, mono voice.
   ═══════════════════════════════════════════════════════════════ */

:root {
  --bg: #F5F4F0;
  --bg-2: #EFEDE7;
  --surface: #FBFAF7;
  --ink: #15171B;
  --ink-2: #3E4148;
  --ink-3: #5E6169;
  --line: #DCDAD2;
  --line-soft: #E8E6E0;
  --grid: rgba(21, 23, 27, 0.05);
  --accent: #24466F;
  --accent-ink: #FFFFFF;
  --accent-soft: rgba(36, 70, 111, 0.08);
  --accent-line: rgba(36, 70, 111, 0.28);
  --warm: #9E4E24;
  --warm-soft: rgba(158, 78, 36, 0.08);
  --highlight: rgba(214, 140, 72, 0.26);
  --scrim: rgba(21, 23, 27, 0.32);
  --glass: rgba(245, 244, 240, 0.88);
  --bar: #C9C6BD;

  /* the grammar's three families, used everywhere on the page */
  --c-tgt: #2A5B8C;
  --c-tgt-soft: rgba(42, 91, 140, 0.11);
  --c-typ: #A04F27;
  --c-typ-soft: rgba(160, 79, 39, 0.11);
  --c-plc: #3A7052;
  --c-plc-soft: rgba(58, 112, 82, 0.12);
  --mark: #8B97A6;

  /* figures stay on paper in both themes */
  --paper: #FFFFFF;
  --paper-shadow:
    0 1px 1px rgba(21, 23, 27, 0.05),
    0 3px 8px -2px rgba(21, 23, 27, 0.07),
    0 14px 28px -12px rgba(21, 23, 27, 0.16);
  --paper-shadow-up:
    0 1px 1px rgba(21, 23, 27, 0.05),
    0 12px 22px -6px rgba(21, 23, 27, 0.10),
    0 34px 56px -22px rgba(21, 23, 27, 0.28);
  --sheet-shadow: 0 30px 80px -20px rgba(21, 23, 27, 0.35);

  --serif: 'Lora', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', -apple-system, 'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --max-w: 1240px;
  --gutter: 32px;
  --radius: 10px;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0E1013;
  --bg-2: #121519;
  --surface: #15181D;
  --ink: #ECEDEF;
  --ink-2: #C3C7CE;
  --ink-3: #8F959E;
  --line: #2A2E35;
  --line-soft: #1D2026;
  --grid: rgba(236, 237, 239, 0.045);
  --accent: #9DBBE0;
  --accent-ink: #0E1013;
  --accent-soft: rgba(157, 187, 224, 0.10);
  --accent-line: rgba(157, 187, 224, 0.32);
  --warm: #F0B07C;
  --warm-soft: rgba(240, 176, 124, 0.09);
  --highlight: rgba(240, 176, 124, 0.22);
  --scrim: rgba(4, 5, 7, 0.66);
  --glass: rgba(14, 16, 19, 0.86);
  --bar: #3A3F47;
  --c-tgt: #93B9E3;
  --c-tgt-soft: rgba(147, 185, 227, 0.15);
  --c-typ: #EFAA7D;
  --c-typ-soft: rgba(239, 170, 125, 0.15);
  --c-plc: #8FCAA8;
  --c-plc-soft: rgba(143, 202, 168, 0.15);
  --mark: #5D6876;
  --paper: #F7F6F2;
  --paper-shadow:
    0 1px 1px rgba(0, 0, 0, 0.4),
    0 6px 14px -4px rgba(0, 0, 0, 0.45),
    0 20px 40px -14px rgba(0, 0, 0, 0.6);
  --paper-shadow-up:
    0 1px 1px rgba(0, 0, 0, 0.4),
    0 16px 28px -8px rgba(0, 0, 0, 0.5),
    0 44px 72px -24px rgba(0, 0, 0, 0.8);
  --sheet-shadow: 0 30px 90px -16px rgba(0, 0, 0, 0.8);
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 16px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "ss01", "cv11";
  text-rendering: optimizeLegibility;
  transition: background-color 0.3s ease, color 0.3s ease;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}

::selection {
  background: color-mix(in srgb, var(--accent) 24%, transparent);
}

a {
  color: inherit;
}

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

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

h1,
h2,
h3,
h4 {
  font-weight: 400;
  margin: 0;
}

code {
  font-family: var(--mono);
  font-size: 0.88em;
}

.wrap {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

[hidden] {
  display: none !important;
}

html.has-modal {
  overflow: hidden;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 100;
  padding: 8px 14px;
  background: var(--ink);
  color: var(--bg);
  border-radius: 6px;
  font-size: 14px;
  text-decoration: none;
}

.skip-link:focus {
  top: 12px;
}

.label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.sep {
  color: var(--ink-3);
  opacity: 0.6;
  margin: 0 0.5em;
}

/* Underlines that draw in on hover */
.u {
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor), linear-gradient(var(--line), var(--line));
  background-size: 0% 1px, 100% 1px;
  background-position: 0 100%, 0 100%;
  background-repeat: no-repeat;
  padding-bottom: 2px;
  transition: background-size 0.45s var(--ease-out), color 0.2s ease;
}

.u:hover {
  background-size: 100% 1px, 100% 1px;
}

.u.quiet {
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0% 1px;
}

.u.quiet:hover {
  background-size: 100% 1px;
}

.num {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 1.9em;
  height: 1.9em;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--ink-3);
  transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

/* ── Buttons ──────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45em;
  height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s var(--ease);
}

.btn:hover {
  border-color: var(--ink-3);
  background: var(--accent-soft);
}

.btn:active {
  transform: translateY(1px);
}

.btn--solid {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.btn--solid:hover {
  background: color-mix(in srgb, var(--accent) 88%, var(--ink));
  border-color: transparent;
}

html[data-theme="dark"] .btn--solid:hover {
  background: color-mix(in srgb, var(--accent) 86%, white);
}

.btn--ghost {
  border-color: transparent;
  color: var(--ink-2);
}

.btn--ghost:hover {
  border-color: var(--line);
}

.btn--small {
  height: 34px;
  padding: 0 13px;
  font-size: 13px;
}

.icon-btn svg,
.theme-toggle svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s;
}

.icon-btn:hover:not(:disabled) {
  border-color: var(--line);
  color: var(--ink);
}

/* ── Top bar ──────────────────────────────────────────────────── */
.bar {
  border-bottom: 1px solid var(--line-soft);
  position: relative;
  z-index: 2;
}

.bar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.mark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--serif);
  font-size: 17px;
  text-decoration: none;
  color: var(--ink);
}

.mark__glyph {
  width: 24px;
  height: 24px;
  color: var(--accent);
}

.mark__hl {
  fill: var(--highlight);
}

.bar__nav {
  display: flex;
  align-items: center;
  gap: 24px;
  font-size: 14px;
  color: var(--ink-2);
}

.theme-toggle {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  margin-left: -6px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  transition: border-color 0.2s, color 0.2s, transform 0.4s var(--ease-out);
}

.theme-toggle svg {
  width: 16px;
  height: 16px;
}

.theme-toggle:hover {
  color: var(--ink);
  border-color: var(--ink-3);
}

.theme-toggle:active {
  transform: rotate(-20deg);
}

.theme-toggle .i-moon,
html[data-theme="dark"] .theme-toggle .i-sun {
  display: none;
}

html[data-theme="dark"] .theme-toggle .i-moon {
  display: block;
}

/* ── Masthead ─────────────────────────────────────────────────── */
.hero {
  position: relative;
  padding: 64px 0 72px;
  overflow: hidden;
}

/* the desk: a faint grid that fades out toward the edges */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 32px 32px;
  background-position: -1px -1px;
  -webkit-mask-image: radial-gradient(120% 90% at 70% 0%, #000 0%, transparent 72%);
  mask-image: radial-gradient(120% 90% at 70% 0%, #000 0%, transparent 72%);
  pointer-events: none;
}

.hero .wrap {
  position: relative;
}

.eyebrow {
  margin: 0 0 22px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.eyebrow .sep {
  margin: 0 0.6em;
}

.hero__title {
  max-width: 22ch;
  font-family: var(--serif);
  font-size: clamp(40px, 5.6vw, 70px);
  line-height: 1.06;
  letter-spacing: -0.022em;
  text-wrap: balance;
}

.hero__name {
  display: block;
  margin-bottom: 0.08em;
  font-weight: 500;
  letter-spacing: -0.03em;
}

.hero__name b {
  font-weight: inherit;
  color: var(--accent);
}

.hero__title em {
  font-style: italic;
  letter-spacing: -0.03em;
}

/* the title annotates itself */
.marked {
  position: relative;
  display: inline-block;
  white-space: nowrap;
}

.marked__word {
  position: relative;
}

.marked__band {
  position: absolute;
  left: -0.12em;
  right: -0.1em;
  top: 0.2em;
  bottom: 0.02em;
  border-radius: 0.08em 0.14em 0.1em 0.06em;
  background: var(--highlight);
  transform-origin: 0 50%;
}

.js .marked__band {
  transform: scaleX(0);
  animation: sweep 1.05s var(--ease-out) 0.8s forwards;
}

@keyframes sweep {
  to {
    transform: scaleX(1);
  }
}

.hero__authors {
  margin: 26px 0 0;
  font-size: 15px;
  color: var(--ink-2);
}

.hero__authors a {
  color: var(--ink-2);
}

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

.hero__authors a:first-child {
  color: var(--ink);
  font-weight: 500;
}

.hero__authors sup {
  margin-left: 1px;
  font-size: 0.7em;
  color: var(--ink-3);
}

.hero__equal {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--ink-3);
}

.hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 48px 88px;
  align-items: start;
  margin-top: 40px;
  padding-top: 32px;
  border-top: 1px solid var(--line);
}

.hero__lede p {
  max-width: 62ch;
  margin: 0;
  font-size: 17px;
  line-height: 1.68;
  color: var(--ink-2);
  text-wrap: pretty;
}

.hero__lede strong {
  font-weight: 600;
  color: var(--ink);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 26px;
}

/* study at a glance */
.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(128px, auto));
  gap: 0;
  margin: 0;
  min-width: 300px;
}

.stats div {
  padding: 14px 0 16px;
  border-bottom: 1px solid var(--line-soft);
}

.stats div:nth-child(odd) {
  padding-right: 28px;
}

.stats div:nth-child(even) {
  padding-left: 28px;
  border-left: 1px solid var(--line-soft);
}

.stats div:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.stats dt {
  font-size: 12.5px;
  color: var(--ink-3);
}

.stats dd {
  margin: 2px 0 0;
  font-family: var(--serif);
  font-size: 34px;
  line-height: 1.1;
  font-variant-numeric: lining-nums;
  color: var(--ink);
}

/* entry motion */
.js .reveal {
  opacity: 0;
  transform: translateY(10px);
  animation: rise 0.9s var(--ease-out) forwards;
  animation-delay: calc(var(--d, 0) * 80ms + 60ms);
}

@keyframes rise {
  to {
    opacity: 1;
    transform: none;
  }
}

.js .in-view {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out);
  transition-delay: calc(var(--d, 0) * 70ms);
}

.js .in-view.is-in {
  opacity: 1;
  transform: none;
}

/* ── Sections ─────────────────────────────────────────────────── */
.sec {
  padding: 24px 0 112px;
  border-top: 1px solid var(--line-soft);
  outline: none;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 48px;
  padding: 48px 0 40px;
}

.section-head h2,
.cite h2 {
  font-family: var(--serif);
  font-size: clamp(30px, 3.6vw, 42px);
  line-height: 1.1;
  letter-spacing: -0.015em;
}

.section-head h2 em,
.cite h2 em {
  font-style: italic;
}

.section-head__note {
  max-width: 50ch;
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink-3);
  text-wrap: pretty;
}

.section-head__note a {
  color: var(--ink-2);
}

.sub {
  margin: 0 0 18px;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.prose {
  max-width: 60ch;
  margin: 0;
  font-size: 16px;
  line-height: 1.72;
  color: var(--ink-2);
  text-wrap: pretty;
}

.prose + .prose {
  margin-top: 16px;
}

.prose strong {
  font-weight: 600;
  color: var(--ink);
}

.prose em {
  font-family: var(--serif);
  color: var(--ink);
}

/* paper sheet for figures */
.sheet {
  position: relative;
  background: var(--paper);
  border-radius: 3px;
  box-shadow: var(--paper-shadow);
  overflow: hidden;
}

.sheet img {
  width: 100%;
  height: auto;
}

.js .sheet img {
  opacity: 0;
  transition: opacity 0.6s ease;
}

.js .sheet img.is-loaded {
  opacity: 1;
}

.figcap {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin: 16px 0 0;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink-3);
  text-wrap: pretty;
}

.figcap__n {
  font-family: var(--serif);
  font-style: italic;
  font-size: 15px;
  color: var(--warm);
}

.zoomable {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  cursor: zoom-in;
}

.zoomable .sheet {
  transition: transform 0.45s var(--ease-out), box-shadow 0.45s var(--ease-out);
}

@media (hover: hover) {
  .zoomable:hover .sheet {
    transform: translateY(-3px);
    box-shadow: var(--paper-shadow-up);
  }
}

/* ── Specimen (Figure 1) ──────────────────────────────────────── */
.specimen {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 56px;
  align-items: start;
}

.spec {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.spec__head,
.panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--line-soft);
}

.spec__file {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-3);
}

.spec__body {
  padding: 10px 8px 12px;
}

.spec__block {
  display: block;
  width: 100%;
  margin: 0;
  padding: 10px 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.3s ease, opacity 0.3s ease;
}

.spec__block pre,
.spec__tail {
  margin: 0;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.62;
  color: var(--ink-2);
  white-space: pre;
}

.spec__tail {
  padding: 2px 12px 0;
  color: var(--ink-3);
}

.spec__block:hover,
.spec__block.is-on {
  background: var(--warm-soft);
}

.specimen.has-on .spec__block:not(.is-on) {
  opacity: 0.55;
}

.spec__pin {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin-right: 8px;
  border: 1px solid var(--warm);
  border-radius: 50%;
  font-family: var(--serif);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  vertical-align: 1px;
  color: var(--warm);
  transition: background-color 0.25s, color 0.25s;
}

.spec__block.is-on .spec__pin {
  background: var(--warm);
  color: var(--bg);
}

/* json voices */
.j-k {
  color: var(--ink-2);
}

.k-tgt {
  color: var(--c-tgt);
}

.k-typ {
  color: var(--c-typ);
}

.k-plc {
  color: var(--c-plc);
}

.j-s {
  color: var(--ink);
}

.j-c {
  font-style: italic;
  color: var(--ink-3);
}

.j-p {
  color: var(--ink-3);
}

/* the chart, with its two annotations marked */
.plate__art {
  position: relative;
  display: block;
  padding: 3.5%;
}

.plate__img {
  position: relative;
}

.hot {
  position: absolute;
  border: 1.5px solid #9E4E24;
  border-radius: 4px;
  background: rgba(214, 140, 72, 0.10);
  opacity: 0;
  transform: scale(0.98);
  transition: opacity 0.35s ease, transform 0.45s var(--ease-out);
  pointer-events: none;
}

.hot--ring {
  width: 4.4%;
  aspect-ratio: 1;
  margin: -2.2% 0 0 -2.2%;
  border-radius: 50%;
  background: transparent;
  box-shadow: 0 0 0 4px rgba(158, 78, 36, 0.14);
}

.hot.is-on {
  opacity: 1;
  transform: none;
}

.pin {
  position: absolute;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  margin: -12px 0 0 -12px;
  padding: 0;
  border: 1.5px solid #9E4E24;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  color: #9E4E24;
  font-family: var(--serif);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: lining-nums;
  box-shadow: 0 1px 3px rgba(21, 23, 27, 0.16);
  transition: background-color 0.25s ease, color 0.25s ease, transform 0.35s var(--ease-out), box-shadow 0.35s ease;
}

.pin::after {
  content: "";
  position: absolute;
  inset: -10px;
}

.pin.is-on {
  background: #9E4E24;
  color: #fff;
  transform: scale(1.15);
  box-shadow: 0 0 0 6px rgba(158, 78, 36, 0.16);
}

.js .specimen .pin {
  opacity: 0;
  transform: scale(0.6);
}

.js .specimen.is-in .pin {
  opacity: 1;
  transform: none;
  transition: opacity 0.5s ease calc(0.5s + var(--k) * 0.22s), transform 0.6s var(--ease-out) calc(0.5s + var(--k) * 0.22s),
    background-color 0.25s ease, color 0.25s ease, box-shadow 0.35s ease;
}

.js .specimen.is-in .pin.is-on {
  transform: scale(1.15);
  transition-delay: 0s;
}

.notes {
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
}

.notes li {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 12px;
  align-items: baseline;
  padding: 11px 0;
  border-top: 1px solid var(--line-soft);
  font-size: 14.5px;
  line-height: 1.62;
  color: var(--ink-2);
  text-wrap: pretty;
  cursor: default;
  transition: color 0.25s ease;
}

.notes strong {
  font-weight: 600;
  color: var(--ink);
}

.notes code {
  font-size: 0.86em;
  color: var(--ink);
}

.notes__n {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 1px solid var(--warm);
  border-radius: 50%;
  font-family: var(--serif);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1;
  color: var(--warm);
  transform: translateY(4px);
  transition: background-color 0.25s ease, color 0.25s ease;
}

.notes li.is-on {
  color: var(--ink);
}

.notes li.is-on .notes__n {
  background: var(--warm);
  color: var(--bg);
}

/* ── Grammar (Figure 2) ───────────────────────────────────────── */
.gram-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
  gap: 48px;
  align-items: start;
}

.gram {
  padding: 30px 32px 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.gram__group + .gram__group {
  margin-top: 26px;
}

.gram__title {
  display: inline-block;
  margin: 0 0 10px;
  padding-bottom: 3px;
  border-bottom: 1px solid var(--ink-3);
  font-family: var(--serif);
  font-style: italic;
  font-size: 16px;
  font-weight: 500;
  color: var(--ink);
}

/* the root block: a brace and its label, as in the figure */
.gram__root {
  display: grid;
  grid-template-columns: 22px 14px minmax(0, 1fr);
  align-items: stretch;
}

.gram__rootlabel {
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: none;
}

.gram__rootlabel span {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.gram__brace {
  width: 14px;
  height: 100%;
  overflow: visible;
  color: var(--ink-3);
}

.gram__brace path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.2;
  stroke-linecap: round;
}

.rules {
  margin: 0;
  padding: 0;
  list-style: none;
}

.rule {
  display: grid;
  grid-template-columns: var(--lhs, 128px) 34px minmax(0, 1fr);
  align-items: baseline;
  padding: 3px 8px;
  margin: 0 -8px;
  border-radius: 5px;
  font-size: 15px;
  line-height: 1.65;
  transition: opacity 0.3s ease, background-color 0.3s ease;
}

.gram__root .rule {
  --lhs: 96px;
}

.rule__lhs {
  min-width: 0;
}

.rule__op {
  position: relative;
  color: var(--ink-3);
  text-align: center;
  font-family: var(--mono);
  font-size: 14px;
}

.rule__op sup {
  position: absolute;
  left: 50%;
  top: -0.95em;
  transform: translateX(-50%);
  font-family: var(--sans);
  font-size: 9.5px;
  letter-spacing: 0.02em;
  color: var(--ink-3);
}

.rule__rhs {
  min-width: 0;
  color: var(--ink-3);
}

.rule__more {
  padding-left: 0;
  color: var(--ink-3);
}

/* the axis rule has two lines held by a brace */
.rule__pair {
  display: grid;
  gap: 2px;
  padding-left: 14px;
  border-left: 1px solid var(--ink-3);
  border-radius: 8px 0 0 8px;
}

/* three typographic voices, after the paper's own figure */
.nt {
  display: inline;
  padding: 0 2px;
  margin: 0 -2px;
  border: 0;
  border-radius: 3px;
  background: none;
  font-family: var(--sans);
  font-size: inherit;
  font-weight: 600;
  line-height: inherit;
  color: var(--ink);
  text-decoration: underline dotted;
  text-decoration-color: color-mix(in srgb, var(--ink-3) 55%, transparent);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 4px;
  transition: background-color 0.2s ease, color 0.2s ease, text-decoration-color 0.2s ease;
}

.nt:hover {
  text-decoration-color: var(--ink-3);
  background: var(--accent-soft);
}

.nt.is-on {
  background: var(--highlight);
  text-decoration-color: transparent;
}

.nt.is-def {
  background: var(--accent);
  color: var(--accent-ink);
  text-decoration-color: transparent;
}

.kw,
.fld {
  font-family: var(--mono);
  font-size: 0.9em;
  color: var(--ink-2);
}

.fld {
  color: var(--ink);
}

.prim {
  font-family: var(--serif);
  font-style: italic;
  color: var(--ink-2);
}

button.kw,
button.prim,
button.fld {
  padding: 0 2px;
  margin: 0 -2px;
  border: 0;
  border-radius: 3px;
  background: none;
  line-height: inherit;
  text-decoration: underline dotted;
  text-decoration-color: color-mix(in srgb, var(--ink-3) 55%, transparent);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 4px;
  transition: background-color 0.2s ease, text-decoration-color 0.2s ease;
}

button.kw {
  font-size: 0.9em;
  font-family: var(--mono);
}

button.prim {
  font-size: inherit;
  font-family: var(--serif);
}

button.fld {
  font-size: 0.9em;
}

button.kw:hover,
button.prim:hover,
button.fld:hover {
  text-decoration-color: var(--ink-3);
  background: var(--accent-soft);
}

button.kw.is-on,
button.prim.is-on,
button.fld.is-on {
  background: var(--highlight);
  text-decoration-color: transparent;
}

button.fld.is-def {
  background: var(--accent);
  color: var(--accent-ink);
  text-decoration-color: transparent;
}

.gram.has-on .rule:not(.is-rel) {
  opacity: 0.42;
}

.gram.has-on .rule.is-rel {
  background: var(--bg);
}

html[data-theme="dark"] .gram.has-on .rule.is-rel {
  background: var(--bg-2);
}

.gram__hint {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 24px 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--line-soft);
  font-size: 13px;
  color: var(--ink-3);
}

.gram__hint kbd {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 20px;
  padding: 0 5px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-family: var(--sans);
  font-size: 11px;
}

/* the reader: what the paper says about the selected name */
.reader {
  position: sticky;
  top: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.reader__body {
  max-height: calc(100vh - 48px - 46px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 24px 26px 28px;
}

.reader__body.is-swap {
  animation: fade 0.4s var(--ease-out);
}

@keyframes fade {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

.term__kind {
  margin: 0 0 6px;
}

.term__name {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.012em;
}

.term__name code {
  font-size: 0.82em;
}

.term__rule {
  margin: 16px 0 0;
  padding: 12px 14px;
  border-radius: 6px;
  background: var(--bg);
  font-size: 14px;
  line-height: 1.7;
  color: var(--ink-3);
  overflow-x: auto;
}

html[data-theme="dark"] .term__rule {
  background: var(--bg-2);
}

.term__rule .nt,
.term__rule button {
  pointer-events: none;
  text-decoration: none;
}

.term__text {
  margin: 18px 0 0;
  font-family: var(--serif);
  font-size: 16.5px;
  line-height: 1.7;
  color: var(--ink);
  text-wrap: pretty;
}

.term__text + .term__text {
  margin-top: 12px;
}

.term__text code {
  font-size: 0.82em;
  color: var(--accent);
}

.term__src {
  margin: 12px 0 0;
  font-size: 12.5px;
  color: var(--ink-3);
}

.term__ex {
  margin: 22px 0 0;
}

.term__ex pre {
  margin: 8px 0 0;
  padding: 12px 14px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--ink-2);
  overflow-x: auto;
}

.term__rel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 22px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
}

.term__rel .label {
  margin-right: 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.chip:hover {
  border-color: var(--ink-3);
  color: var(--ink);
}

.chip[aria-pressed="true"] {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--ink);
}

.voices {
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.voices li {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 14px;
  align-items: baseline;
  padding: 11px 0;
  border-top: 1px solid var(--line-soft);
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-2);
}

.voices li > span:first-child {
  font-size: 15px;
}

.reader__start {
  margin: 20px 0 0;
}

/* ── Three decisions ──────────────────────────────────────────── */
.decisions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.decision {
  padding: 28px 32px 8px 0;
}

.decision + .decision {
  padding-left: 32px;
  border-left: 1px solid var(--line-soft);
}

.decision__head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.decision__head .num {
  width: 30px;
  height: 30px;
  font-size: 12.5px;
  color: var(--accent);
}

.decision__q {
  font-family: var(--serif);
  font-style: italic;
  font-size: 15px;
  color: var(--ink-3);
}

.decision h3 {
  font-family: var(--serif);
  font-size: clamp(24px, 2.4vw, 30px);
  line-height: 1.15;
  letter-spacing: -0.014em;
}

.decision p {
  margin: 14px 0 0;
  font-size: 15px;
  line-height: 1.7;
  color: var(--ink-2);
  text-wrap: pretty;
}

.decision p code {
  color: var(--ink);
}

.kinds {
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.kinds li {
  padding: 10px 0;
  border-top: 1px solid var(--line-soft);
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--ink-2);
  text-wrap: pretty;
}

.kinds strong {
  font-weight: 600;
  color: var(--ink);
}

/* glyphs for the four implemented annotation types */
.types {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.type {
  padding: 14px 12px 14px 0;
  border-top: 1px solid var(--line-soft);
}

.type:nth-child(even) {
  padding-left: 14px;
  border-left: 1px solid var(--line-soft);
}

.type svg {
  display: block;
  width: 56px;
  height: 40px;
  margin-bottom: 10px;
  overflow: visible;
}

.type h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.type p {
  margin: 4px 0 0;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink-3);
}

.g-ink {
  fill: none;
  stroke: var(--ink-2);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.g-dot {
  fill: var(--ink-3);
}

.g-warm {
  fill: none;
  stroke: var(--warm);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.g-warmfill {
  fill: var(--warm);
}

.g-hl {
  fill: var(--highlight);
}

.g-bar {
  fill: var(--line);
}

.g-text {
  fill: var(--ink-2);
  font-family: var(--serif);
  font-size: 15px;
  font-style: italic;
}

.modes {
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.modes li {
  padding: 12px 0;
  border-top: 1px solid var(--line-soft);
  font-size: 14.5px;
  line-height: 1.62;
  color: var(--ink-2);
  text-wrap: pretty;
}

.modes strong {
  display: block;
  margin-bottom: 2px;
  font-weight: 600;
  color: var(--ink);
}

.modes code {
  color: var(--ink);
}

/* figure 3 and the relationships between annotations */
.targets {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: 56px;
  align-items: start;
  margin-top: 88px;
  padding-top: 48px;
  border-top: 1px solid var(--line-soft);
}

.targets .sheet {
  padding: 4.5%;
}

.rels {
  margin: 0;
  padding: 0;
  list-style: none;
}

.rels li {
  padding: 16px 0 18px;
  border-top: 1px solid var(--line-soft);
}

.rels li:last-child {
  border-bottom: 1px solid var(--line-soft);
}

.rels h4 {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 500;
}

.rels h4 code {
  font-size: 0.78em;
  color: var(--accent);
}

.rels p {
  margin: 6px 0 0;
  font-size: 15px;
  line-height: 1.68;
  color: var(--ink-2);
  text-wrap: pretty;
}

.rels__note {
  margin: 18px 0 0;
  font-size: 14px;
  line-height: 1.65;
  color: var(--ink-3);
  text-wrap: pretty;
}

/* ── Evaluation ───────────────────────────────────────────────── */
.loc {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: 64px;
  align-items: start;
}

.loc__card {
  padding: 26px 30px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.loc__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px 24px;
}

.loc__title {
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 500;
  line-height: 1.25;
}

.loc__sub {
  margin: 4px 0 0;
  font-size: 13.5px;
  color: var(--ink-3);
}

.seg {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
}

.seg button {
  height: 32px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-3);
  transition: background-color 0.25s ease, color 0.25s ease;
}

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

.seg button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--bg);
}

.bars {
  position: relative;
  margin: 24px 0 0;
  padding: 0;
  list-style: none;
}

.bars__row {
  position: absolute;
  left: 0;
  right: 0;
  display: grid;
  grid-template-columns: 136px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  height: 36px;
  transition: transform 0.7s var(--ease-out);
}

.bars__name {
  font-size: 13.5px;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bars__track {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 100%;
}

.bars__fill {
  height: 14px;
  border-radius: 0 4px 4px 0;
  background: var(--bar);
  transition: width 0.7s var(--ease-out), background-color 0.3s ease;
}

.bars__val {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-3);
  white-space: nowrap;
}

.bars__row.is-ours .bars__name {
  font-weight: 600;
  color: var(--ink);
}

.bars__row.is-ours .bars__fill {
  background: var(--accent);
}

.bars__row.is-ours .bars__val {
  font-weight: 600;
  color: var(--ink);
}

.bars__row:hover .bars__name,
.bars__row:hover .bars__val {
  color: var(--ink);
}

.bars__row:hover .bars__fill {
  background: color-mix(in srgb, var(--bar) 70%, var(--ink));
}

.bars__row.is-ours:hover .bars__fill {
  background: var(--accent);
}

.bars__axis {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 150px;
  right: 0;
  pointer-events: none;
}

.bars__tick {
  position: absolute;
  top: -4px;
  bottom: 0;
  width: 1px;
  background: var(--line-soft);
}

.bars__tick span {
  position: absolute;
  bottom: -22px;
  left: 0;
  transform: translateX(-50%);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-3);
}

.loc__read {
  margin: 40px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
  font-family: var(--serif);
  font-size: 16.5px;
  line-height: 1.6;
  color: var(--ink);
  text-wrap: pretty;
}

.loc__foot {
  margin: 8px 0 0;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--ink-3);
}

.dims {
  margin: 0;
  padding: 0;
  list-style: none;
}

.dims li {
  padding: 14px 0 15px;
  border-top: 1px solid var(--line-soft);
}

.dims li:last-child {
  border-bottom: 1px solid var(--line-soft);
}

.dims h4 {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
}

.dims p {
  margin: 4px 0 0;
  font-size: 14.5px;
  line-height: 1.62;
  color: var(--ink-2);
  text-wrap: pretty;
}

/* what the comparison shows */
.findings {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin: 56px 0 0;
  padding: 0;
  list-style: none;
}

.finding {
  padding: 4px 28px 0 0;
}

.finding + .finding {
  padding-left: 28px;
  border-left: 1px solid var(--line-soft);
}

.finding h4 {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 500;
  line-height: 1.3;
}

.finding p {
  margin: 8px 0 0;
  font-size: 15px;
  line-height: 1.68;
  color: var(--ink-2);
  text-wrap: pretty;
}

/* ── Cite ─────────────────────────────────────────────────────── */
.cite {
  padding: 88px 0;
  background: var(--bg-2);
  border-top: 1px solid var(--line-soft);
}

.cite__inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 48px 72px;
  align-items: start;
}

.cite__ref {
  max-width: 54ch;
  margin: 22px 0 0;
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.7;
  color: var(--ink-2);
}

.cite__more {
  max-width: 54ch;
  margin: 18px 0 0;
  font-size: 14px;
  line-height: 1.65;
  color: var(--ink-3);
}

.cite__more a {
  color: var(--ink-2);
}

.bib {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.bib__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 8px 8px 16px;
  border-bottom: 1px solid var(--line-soft);
}

.bib pre {
  margin: 0;
  padding: 16px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--ink-2);
}

/* ── Footer ───────────────────────────────────────────────────── */
.foot {
  border-top: 1px solid var(--line-soft);
  padding: 28px 0 calc(28px + env(safe-area-inset-bottom));
  font-size: 13px;
  color: var(--ink-3);
}

.foot__inner {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 32px;
}

.foot p {
  margin: 0;
}

.foot__inner a {
  white-space: nowrap;
}

/* ── Term sheet (phones) ──────────────────────────────────────── */
.tsheet {
  position: fixed;
  inset: auto 0 0 0;
  width: min(100vw, 720px);
  max-width: none;
  max-height: calc(100dvh - 72px - env(safe-area-inset-top));
  margin: 0 auto;
  padding: 0;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 18px 18px 0 0;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--sheet-shadow);
  overflow: hidden;
}

.tsheet[open] {
  display: flex;
  flex-direction: column;
  animation: rise-up 0.5s var(--ease-out);
}

.tsheet::backdrop {
  background: var(--scrim);
  animation: fade-in 0.35s ease;
}

@keyframes rise-up {
  from {
    transform: translateY(48px);
    opacity: 0;
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

.tsheet__bar {
  position: relative;
  display: flex;
  justify-content: flex-end;
  flex: none;
  padding: 16px 8px 0;
  touch-action: none;
}

.sheet-handle {
  position: absolute;
  top: 7px;
  left: 50%;
  width: 38px;
  height: 4px;
  margin-left: -19px;
  border-radius: 2px;
  background: var(--line);
}

.tsheet__body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 20px calc(32px + env(safe-area-inset-bottom));
}

/* ── Full-size figure ─────────────────────────────────────────── */
.zoom {
  width: 100vw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: hidden;
}

.zoom[open] {
  animation: fade-in 0.3s ease;
}

.zoom::backdrop {
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.zoom__stage {
  width: 100%;
  height: 100%;
  overflow: auto;
  overscroll-behavior: contain;
  display: grid;
  place-items: center;
  padding: 64px 24px calc(24px + env(safe-area-inset-bottom));
  cursor: zoom-out;
}

.zoom__stage img {
  max-width: 100%;
  max-height: 100%;
  padding: 2%;
  background: #fff;
  border-radius: 3px;
  box-shadow: var(--paper-shadow-up);
}

.zoom__close {
  position: fixed;
  top: calc(14px + env(safe-area-inset-top));
  right: 14px;
  z-index: 2;
  border-color: var(--line);
  background: var(--surface);
}

/* ── Toast ────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  z-index: 200;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.4);
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.35s var(--ease-out);
}

.toast.is-on {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ── Families ─────────────────────────────────────────────────── */
[data-f="target"],
.f-tgt {
  --f: var(--c-tgt);
  --fs: var(--c-tgt-soft);
}

[data-f="type"],
.f-typ {
  --f: var(--c-typ);
  --fs: var(--c-typ-soft);
}

[data-f="place"],
.f-plc {
  --f: var(--c-plc);
  --fs: var(--c-plc-soft);
}

[data-f="root"] {
  --f: var(--ink);
  --fs: var(--accent-soft);
}

.link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink-2);
  font-size: 13.5px;
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.2s, color 0.2s;
}

.link:hover {
  color: var(--ink);
  text-decoration-color: currentColor;
}

/* ── Chart drawn by anno-chart.js ─────────────────────────────── */
.ac {
  display: block;
  overflow: visible;
  font-family: var(--sans);
}

.ac-axgroup {
  transition: opacity 0.45s ease;
}

.ac-grid {
  stroke: var(--line-soft);
  stroke-width: 1;
}

.ac-base {
  stroke: var(--line);
  stroke-width: 1;
}

.ac-tick {
  fill: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.ac-title {
  fill: var(--ink-3);
  font-size: 11px;
}

.ac-mark {
  fill: var(--mark);
  transition: fill 0.45s ease;
}

.ac-mark.is-target {
  fill: var(--c-tgt);
}

.ac-ann {
  opacity: 0;
  transition: opacity 0.55s ease;
}

.ac-ann.is-on {
  opacity: 1;
}

.ac-encl {
  fill: var(--c-typ-soft);
  stroke: var(--c-typ);
  stroke-width: 1.7;
}

.ac-conn {
  fill: none;
  stroke: var(--c-typ);
  stroke-width: 1.9;
  stroke-linecap: round;
}

.ac-dot {
  fill: var(--c-typ);
}

.ac-label-bg {
  fill: var(--surface);
  fill-opacity: 0.94;
  stroke: var(--c-typ);
  stroke-width: 1;
}

.ac-label text {
  fill: var(--ink);
  font-weight: 500;
}

.ac-ghost-conn {
  fill: none;
  stroke: var(--ink-3);
  stroke-width: 1.2;
  stroke-dasharray: 3 3;
}

.ac-ghost-dot {
  fill: var(--ink-3);
}

.ac-ghost-bg {
  fill: var(--surface);
  fill-opacity: 0.8;
  stroke: var(--ink-3);
  stroke-dasharray: 3 3;
}

.ac-ghost-text {
  fill: var(--ink-3);
  font-style: italic;
}

/* ── Grammar: color key, arcs, tips ───────────────────────────── */
.gram {
  position: relative;
}

.gram__legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0 0 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line-soft);
}

.gkey {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 30px;
  padding: 0 12px 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: none;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-2);
  transition: border-color 0.2s, background-color 0.2s, color 0.2s;
}

.gkey i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--f);
}

.gkey[data-fam="target"] {
  --f: var(--c-tgt);
  --fs: var(--c-tgt-soft);
}

.gkey[data-fam="type"] {
  --f: var(--c-typ);
  --fs: var(--c-typ-soft);
}

.gkey[data-fam="place"] {
  --f: var(--c-plc);
  --fs: var(--c-plc-soft);
}

.gkey:hover,
.gkey[aria-pressed="true"] {
  border-color: var(--f);
  background: var(--fs);
  color: var(--ink);
}

.gkey--static {
  padding: 0 6px;
  border-color: transparent;
}

.gkey--static .kw {
  font-size: 12px;
}

.gkey--static .prim {
  font-size: 14px;
}

.gram__title[data-f] {
  border-bottom-color: var(--f);
}

.gram__title[data-f]::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 9px;
  border-radius: 50%;
  background: var(--f);
  vertical-align: 1px;
}

/* names wear their family's color */
.nt[data-f],
.fld[data-f],
button.kw[data-f],
button.prim[data-f] {
  color: var(--f);
}

.nt[data-f].is-on,
button[data-f].is-on {
  background: var(--fs);
  text-decoration-color: transparent;
}

.nt[data-f].is-def,
button.fld[data-f].is-def {
  background: var(--f);
  color: var(--surface);
  text-decoration-color: transparent;
}

.gram__rootlabel.is-def span {
  color: var(--surface);
}

.gram__rootlabel.is-def {
  background: var(--ink);
  border-radius: 4px;
}

.rule {
  position: relative;
}

.rule.is-defrow::before {
  content: "";
  position: absolute;
  left: -2px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  border-radius: 2px;
  background: var(--rowf, var(--ink));
}

.gram__arcs {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.gram__arcs path {
  fill: none;
  stroke: var(--f);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: var(--len);
  stroke-dashoffset: var(--len);
  animation: drawarc 0.5s var(--ease-out) forwards;
}

.gram__arcs circle {
  fill: var(--f);
}

@keyframes drawarc {
  to {
    stroke-dashoffset: 0;
  }
}

.gtip {
  position: absolute;
  z-index: 6;
  max-width: 290px;
  padding: 10px 13px 11px;
  border-radius: 9px;
  background: var(--ink);
  color: var(--bg);
  font-size: 13px;
  line-height: 1.5;
  box-shadow: 0 14px 30px -12px rgba(0, 0, 0, 0.45);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.18s ease, transform 0.25s var(--ease-out);
  pointer-events: none;
}

.gtip.is-on {
  opacity: 1;
  transform: none;
}

.gtip b {
  display: block;
  margin-bottom: 3px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.7;
}

.gtip span {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  opacity: 0.7;
}

.term__uses {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px 12px;
  align-items: baseline;
  margin: 22px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
}

.term__uses .label {
  white-space: nowrap;
}

.term__uses div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip[data-f] {
  border-color: color-mix(in srgb, var(--f) 45%, var(--line));
  color: var(--f);
}

.chip[data-f]:hover {
  background: var(--fs);
  border-color: var(--f);
}

.term__kind {
  display: flex;
  align-items: center;
  gap: 8px;
}

.term__kind i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--f, var(--ink-3));
}

.term__name[data-f] {
  color: var(--f);
}

.decision.f-tgt .num,
.decision.f-typ .num,
.decision.f-plc .num {
  color: var(--f);
}

/* ── Portability playground ───────────────────────────────────── */
.pg {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.pg__stage {
  padding: 16px 20px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.pg__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.pg__acts {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.seg--sm {
  padding: 2px;
}

.seg--sm button {
  height: 28px;
  padding: 0 11px;
  font-size: 12.5px;
}

.pg__short {
  display: none;
}

.pg__canvas {
  max-width: 100%;
  margin: 16px auto 0;
  transition: max-width 0.7s var(--ease-out);
}

.pg__canvas.is-narrow {
  max-width: 60%;
}

.pg__canvas svg {
  display: block;
  width: 100%;
  touch-action: manipulation;
}

.pg__read {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 14px 0 0;
  border-top: 1px solid var(--line-soft);
}

.pg__read > div {
  min-width: 0;
  padding: 12px 14px 2px 0;
}

.pg__read > div + div {
  padding-left: 14px;
  border-left: 1px solid var(--line-soft);
}

.pg__read dt {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.pg__read dt::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--f, var(--ink-3));
}

.pg__read dd {
  margin: 5px 0 0;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.pg__read dd code {
  font-size: 0.88em;
  color: var(--ink-2);
}

.pg__read dd.is-flash {
  animation: ddflash 1.2s ease;
}

@keyframes ddflash {
  from {
    color: var(--f, var(--ink));
  }
}

.pg__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
}

.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  line-height: 1.4;
  color: var(--ink-2);
  cursor: pointer;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.switch__ui {
  position: relative;
  flex: none;
  width: 34px;
  height: 20px;
  border-radius: 999px;
  background: var(--line);
  transition: background-color 0.25s ease;
}

.switch__ui::after {
  content: "";
  position: absolute;
  left: 2px;
  top: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: transform 0.3s var(--ease-out);
}

.switch input:checked + .switch__ui {
  background: var(--ink-2);
}

.switch input:checked + .switch__ui::after {
  transform: translateX(14px);
}

.switch input:focus-visible + .switch__ui {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.pg__panel {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.pg__controls {
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.field + .field {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
}

.field__label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 9px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.field__label i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--f);
}

.select {
  position: relative;
}

.select::after {
  content: "";
  position: absolute;
  right: 14px;
  top: 50%;
  width: 7px;
  height: 7px;
  margin-top: -5px;
  border-right: 1.5px solid var(--ink-3);
  border-bottom: 1.5px solid var(--ink-3);
  transform: rotate(45deg);
  pointer-events: none;
}

.select select,
.input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
  font: 500 14px var(--sans);
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.select select {
  padding-right: 36px;
  text-overflow: ellipsis;
}

.select select:focus,
.input:focus {
  outline: none;
  border-color: var(--f);
  box-shadow: 0 0 0 3px var(--fs);
}

.pg__effects {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pg__effects .chip {
  height: 34px;
}

.pg__effects .chip::before {
  content: "";
  width: 12px;
  height: 12px;
  margin-left: -2px;
  border: 1.5px solid var(--line);
  border-radius: 3px;
  transition: background-color 0.2s, border-color 0.2s;
}

.pg__effects .chip[aria-pressed="true"] {
  border-color: var(--c-typ);
  background: var(--c-typ-soft);
  color: var(--ink);
}

.pg__effects .chip[aria-pressed="true"]::before {
  border-color: var(--c-typ);
  background: var(--c-typ)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2l2.3 2.3 4.7-5' fill='none' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
    center / 100% no-repeat;
}

.f-plc .seg button[aria-pressed="true"] {
  background: var(--c-plc);
  color: var(--surface);
}

.pg__spec {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  overflow: hidden;
}

.pg__spechead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px 10px 16px;
  border-bottom: 1px solid var(--line-soft);
}

.pg__status {
  display: flex;
  gap: 6px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-3);
  white-space: nowrap;
  transition: color 0.3s, border-color 0.3s, background-color 0.3s;
}

.pill.is-changed {
  border-color: var(--ink-3);
  color: var(--ink);
}

.pill.is-same {
  background: var(--bg-2);
  color: var(--ink);
}

html[data-theme="dark"] .pill.is-same {
  background: var(--line-soft);
}

.pill.is-edited {
  border-color: var(--c-typ);
  color: var(--c-typ);
}

#pg-spec {
  margin: 0;
  padding: 12px 0 14px;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.62;
  color: var(--ink-2);
  overflow-x: auto;
}

#pg-spec .ln {
  display: block;
  padding: 0 16px;
}

#pg-spec .ln.is-flash-chart {
  animation: flashchart 1.6s ease;
}

#pg-spec .ln.is-flash-ann {
  animation: flashann 1.6s ease;
}

@keyframes flashchart {
  from {
    background: var(--highlight);
  }
}

@keyframes flashann {
  from {
    background: var(--c-typ-soft);
  }
}

.pg__tally {
  margin: 0 4px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink-3);
}

.pg__tally strong {
  font-weight: 600;
  color: var(--ink);
}

.pg__fine {
  max-width: 80ch;
  margin: 16px 0 0;
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-3);
}

.port--paper {
  margin-top: 72px;
  padding-top: 40px;
  border-top: 1px solid var(--line-soft);
}

@media (max-width: 1100px) {
  .pg {
    grid-template-columns: minmax(0, 1fr);
  }

  .pg__panel {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: start;
  }

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

@media (max-width: 1000px) {
  .bp__stage {
    grid-template-columns: minmax(0, 1fr);
    gap: 34px;
  }

  .bp__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .bp__chips li {
    padding: 7px 12px;
  }

  .bp__blue,
  .bp__out {
    max-width: 560px;
  }
}

@media (max-width: 760px) {
  .pg__panel {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 700px) {
  .bp {
    margin: 0 calc(-1 * var(--gutter) + 6px);
    padding: 20px 16px 16px;
  }

  .bp__stage {
    gap: 28px;
  }

  .bp__steps button:not(.is-on) .bp__lbl {
    display: none;
  }

  .bp__steps button:not(.is-on) {
    padding: 0 6px;
  }

  .bp__cap {
    font-size: 16px;
    min-height: 4.65em;
  }

  .pg__stage {
    margin: 0 calc(-1 * var(--gutter) + 6px);
    padding: 14px 12px 12px;
  }

  .pg__bar,
  .pg__acts {
    width: 100%;
  }

  #pg-mode {
    width: 100%;
  }

  #pg-mode button {
    flex: 1;
    padding: 0 6px;
  }

  .pg__long,
  .pg__width {
    display: none;
  }

  .pg__short {
    display: inline;
  }

  .pg__acts .btn {
    flex: 1;
  }

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

  .pg__read > div,
  .pg__read > div + div {
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr);
    gap: 10px;
    padding: 9px 0;
    border-left: 0;
  }

  .pg__read > div + div {
    border-top: 1px solid var(--line-soft);
  }

  .pg__read dd {
    margin: 0;
  }

  .pg__foot {
    align-items: flex-start;
  }

  .pg__controls {
    padding: 16px;
  }

  #pg-spec {
    font-size: 11.5px;
  }

  #pg-spec .ln {
    padding: 0 12px;
  }

  .port--paper {
    margin-top: 56px;
  }
}


/* ── Title ────────────────────────────────────────────────────── */
.intro {
  padding: 56px 0 44px;
}

.intro__title {
  font-family: var(--serif);
  letter-spacing: -0.02em;
}

.intro__name {
  display: block;
  font-size: clamp(46px, 6.4vw, 78px);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.035em;
}

.intro__name b {
  font-weight: inherit;
  color: var(--accent);
}

.intro__sub {
  display: block;
  margin-top: 14px;
  font-size: clamp(20px, 2.4vw, 28px);
  font-style: italic;
  line-height: 1.25;
  color: var(--ink-2);
}

.intro__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px 32px;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.intro .hero__authors {
  margin: 0;
}

.intro__equal {
  margin-left: 10px;
  font-size: 12.5px;
  color: var(--ink-3);
  white-space: nowrap;
}

.intro__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ── Figure chrome shared by the animated figures ─────────────── */
.fig__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 22px;
}

.fig__play {
  flex: none;
  border-color: var(--line);
}

.fig__play .i-play,
.is-paused .fig__play .i-pause {
  display: none;
}

.is-paused .fig__play .i-play {
  display: block;
}

.fig__cap {
  min-height: 3.1em;
  margin: 22px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink);
  text-wrap: pretty;
}

.fig__note {
  max-width: 82ch;
  margin: 16px 0 0;
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-3);
  text-wrap: pretty;
}

.beats {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.beats button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 12px 0 6px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: none;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-3);
  transition: color 0.3s, border-color 0.3s;
}

.beats .num {
  width: 22px;
  height: 22px;
  font-size: 10.5px;
}

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

.beats button.is-on {
  border-color: var(--line);
  color: var(--ink);
}

.beats button.is-on .num {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}

.beats button.is-done .num {
  color: var(--ink-2);
}

@keyframes travel {
  from {
    offset-distance: 0%;
  }

  to {
    offset-distance: 100%;
  }
}

/* ── One blueprint, many libraries ────────────────────────────── */
.tree,
.duo {
  margin: 0;
  padding: 22px 28px 22px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

/* scroll scenes: the figure holds still while scrolling drives it */
.scene {
  position: relative;
}

.scene + .scene {
  margin-top: 28px;
}

.scene.is-pinned .scene__pin {
  position: sticky;
}

.scene__hint {
  display: none;
}

.scene.is-pinned .scene__hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 12px 0 0;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--ink-3);
  transition: opacity 0.4s ease;
}

.scene.is-pinned .scene__hint::after {
  content: "";
  width: 7px;
  height: 7px;
  margin-top: -4px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  animation: nudge 1.8s ease-in-out infinite;
}

.scene.is-done .scene__hint {
  opacity: 0;
}

@keyframes nudge {
  0%,
  100% {
    transform: translateY(0) rotate(45deg);
  }

  50% {
    transform: translateY(4px) rotate(45deg);
  }
}

.is-scrub .fig__play {
  display: none;
}

/* how far the scroll has carried the figure */
.fig__rail {
  display: none;
  height: 2px;
  margin: -10px 0 20px;
  border-radius: 2px;
  background: var(--line-soft);
  overflow: hidden;
}

.is-scrub .fig__rail {
  display: block;
}

.fig__rail span {
  display: block;
  height: 100%;
  background: var(--c-typ);
  transform-origin: 0 50%;
  transform: scaleX(0);
}

.tree__stage {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 64px;
  padding: 4px 0 6px;
}

.tree__wires {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.tree__wire {
  fill: none;
  stroke: var(--ink-3);
  stroke-opacity: 0.75;
  stroke-width: 1.5;
  stroke-dasharray: var(--len, 300);
  stroke-dashoffset: var(--len, 300);
  transition: stroke-dashoffset 0.9s var(--ease-out) calc(var(--i, 0) * 110ms);
}

.tree__wire.is-proto {
  stroke: var(--c-typ);
  stroke-opacity: 1;
  stroke-width: 2.2;
}

.is-scrub .tree__wire {
  transition: none;
}

.is-b2 .tree__wire {
  stroke-dashoffset: 0;
}

.tree__pulse {
  fill: var(--ink-3);
  offset-rotate: 0deg;
  opacity: 0;
  transition: opacity 0.4s ease;
  animation: travel 2.4s linear infinite;
}

.tree__pulse.is-proto {
  fill: var(--c-typ);
}

.is-flowing .tree__pulse {
  opacity: 1;
}

.is-paused .tree__pulse {
  animation-play-state: paused;
}

.tree__gog {
  position: relative;
  z-index: 1;
  width: min(100%, 720px);
  padding: 18px 22px 20px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: var(--bg);
  text-align: center;
}

.tree__k {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.tree__title {
  margin: 4px 0 16px;
  font-family: var(--serif);
  font-size: 23px;
  line-height: 1.2;
}

.tree__parts {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tree__parts li.is-hidden {
  opacity: 0;
  transform: translateY(8px) scale(0.96);
}

.tree__parts li {
  transition: opacity 0.45s ease, transform 0.55s var(--ease-out);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}

.tree__parts .tree__new {
  max-width: 0;
  margin-left: -8px;
  padding: 0;
  border-width: 0;
  overflow: hidden;
  opacity: 0;
  background: var(--c-typ-soft);
  color: var(--c-typ);
  font-weight: 600;
  transition: max-width 0.8s var(--ease-out), padding 0.8s var(--ease-out), margin 0.8s var(--ease-out), opacity 0.5s ease 0.15s, box-shadow 0.8s ease;
}

.is-b1 .tree__parts .tree__new {
  max-width: 200px;
  margin-left: 0;
  padding: 0 15px;
  border: 1px solid var(--c-typ);
  opacity: 1;
  box-shadow: 0 0 0 5px var(--c-typ-soft);
}

.tree__libs {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tree__libs li {
  padding: 14px 10px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  text-align: center;
  opacity: 0.45;
  transition: opacity 0.5s ease, border-color 0.5s ease, background-color 0.5s ease;
}

.tree__libs li.is-lit {
  opacity: 1;
}

.tree:not(.is-scrub) .tree__libs li.is-lit {
  transition-delay: calc(var(--i) * 110ms + 0.55s);
}

.tree__libs b {
  display: block;
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 500;
}

.tree__libs span {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--ink-3);
}

.tree__libs em {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  font-size: 11.5px;
  font-style: normal;
  line-height: 1.3;
  color: var(--ink-3);
  opacity: 0;
  transition: opacity 0.5s ease;
}

.tree__libs em::before {
  content: "";
  flex: none;
  width: 7px;
  height: 7px;
  border: 1.5px solid var(--c-typ);
  border-radius: 50%;
}

.tree__libs .is-lit em {
  opacity: 1;
}

.tree:not(.is-scrub) .tree__libs .is-lit em {
  transition-delay: calc(var(--i) * 110ms + 0.8s);
}

.tree__libs .is-proto.is-lit {
  border-color: var(--c-typ);
  background: var(--c-typ-soft);
}

.tree__libs .is-proto em {
  font-weight: 600;
  color: var(--c-typ);
}

.tree__libs .is-proto em::before {
  background: var(--c-typ);
}

/* ── Drawn on top vs. declared in the grammar ─────────────────── */
.duo__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.duo__pane {
  min-width: 0;
  padding: 14px 16px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: var(--bg);
}

.duo__k {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin: 0 0 12px;
  font-size: 14.5px;
  font-weight: 600;
}

.duo__tag {
  padding: 2px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.duo__pane--good .duo__tag {
  border-color: var(--c-typ);
  background: var(--c-typ-soft);
  color: var(--c-typ);
}

.duo__chart svg {
  display: block;
  width: 100%;
}

.duo__status {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 1.6em;
  margin: 10px 0 0;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--ink);
  transition: color 0.4s ease;
}

.duo__icon {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 19px;
  height: 19px;
  border: 1px solid var(--ink-3);
  border-radius: 50%;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1;
}

.duo__icon.is-good {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--bg);
}

.duo__icon.is-bad {
  color: var(--ink-3);
}

.is-lost .duo__status {
  color: var(--ink-3);
}

.ac--overlay .ac-ghost {
  transition: opacity 0.45s ease;
}

.ac--overlay .ac-ghost-encl {
  fill: var(--c-typ-soft);
  stroke: var(--c-typ);
  stroke-width: 1.4;
}

.ac--overlay .ac-ghost-conn {
  stroke: var(--c-typ);
  stroke-width: 1.9;
  stroke-dasharray: none;
}

.ac--overlay .ac-ghost-dot {
  fill: var(--c-typ);
}

.ac--overlay .ac-ghost-bg {
  fill: var(--surface);
  fill-opacity: 0.94;
  stroke: var(--c-typ);
  stroke-dasharray: none;
}

.ac--overlay .ac-ghost-text {
  fill: var(--ink);
  font-style: normal;
  font-weight: 500;
}

.ac--overlay .ac-ghost.is-broken {
  opacity: 0.6;
}

.ac--overlay .ac-ghost.is-broken > * {
  stroke-dasharray: 3 3;
}

.ac--overlay .ac-ghost.is-broken .ac-ghost-text,
.ac--overlay .ac-ghost.is-broken .ac-ghost-dot {
  stroke-dasharray: none;
}

/* ── Annotations working together ─────────────────────────────── */
.together {
  margin-top: 64px;
  padding-top: 40px;
  border-top: 1px solid var(--line-soft);
}

.together .rels {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 40px;
}

.together .rels li:last-child {
  border-bottom: 0;
}

/* ── How it works ─────────────────────────────────────────────── */
.flow {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin: 0;
  padding: 0;
  list-style: none;
}

.flow::before {
  content: "";
  position: absolute;
  left: 17px;
  right: 17px;
  top: 17px;
  height: 1px;
  background: var(--line);
}

.flow::after {
  content: "";
  position: absolute;
  left: 17px;
  top: 16.5px;
  width: calc(100% - 34px);
  height: 2px;
  border-radius: 2px;
  background: var(--c-typ);
  transform-origin: 0 50%;
  transform: scaleX(var(--fill, 0));
  transition: transform 0.6s var(--ease-out);
}

.flow__step {
  position: relative;
  padding-right: 24px;
}

.flow__n {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--ink-3);
  border-radius: 50%;
  background: var(--bg);
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: lining-nums;
}

.flow__n {
  transition: border-color 0.4s ease, color 0.4s ease, background-color 0.4s ease, box-shadow 0.5s ease;
}

.flow__step p,
.flow__step h3 {
  transition: opacity 0.5s ease;
}

.flow__step:not(.is-lit) h3,
.flow__step:not(.is-lit) p {
  opacity: 0.45;
}

.flow__step.is-lit .flow__n {
  border-color: var(--c-typ);
  background: var(--c-typ);
  color: var(--surface);
  box-shadow: 0 0 0 5px var(--c-typ-soft);
}

.flow__step h3 {
  margin: 18px 0 0;
  font-family: var(--serif);
  font-size: 20px;
  line-height: 1.25;
}

.flow__step p {
  margin: 8px 0 0;
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--ink-2);
  text-wrap: pretty;
}

.flow__loop {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 30px 0 0;
  font-size: 14px;
  color: var(--ink-3);
}

.flow__loop svg {
  flex: none;
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (max-width: 1000px) {
  .flow {
    grid-template-columns: minmax(0, 1fr);
    max-width: 620px;
  }

  .flow::before {
    left: 17px;
    right: auto;
    top: 18px;
    bottom: 40px;
    width: 1px;
    height: auto;
  }

  .flow::after {
    left: 16.5px;
    top: 18px;
    width: 2px;
    height: calc(100% - 58px);
    transform-origin: 50% 0;
    transform: scaleY(var(--fill, 0));
  }

  .flow__step {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    column-gap: 18px;
    padding: 0 0 24px;
  }

  .flow__n {
    grid-row: span 2;
  }

  .flow__step h3 {
    margin: 4px 0 0;
  }

  .together .rels {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 760px) {
  .tree__libs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .tree__stage {
    gap: 44px;
  }

  .duo__grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }
}

@media (max-width: 700px) {
  .intro {
    padding: 40px 0 34px;
  }

  .intro__actions {
    width: 100%;
  }

  .intro__actions .btn {
    flex: 1;
  }

  .tree,
  .duo {
    margin-left: calc(-1 * var(--gutter) + 6px);
    margin-right: calc(-1 * var(--gutter) + 6px);
    padding: 16px 14px;
  }

  .beats button:not(.is-on) .beats__l {
    display: none;
  }

  .beats button:not(.is-on) {
    padding: 0 6px;
  }

  .tree__gog {
    padding: 16px 12px 16px;
  }

  .tree__parts {
    gap: 6px;
  }

  .tree__parts li {
    height: 32px;
    padding: 0 11px;
    font-size: 13px;
  }

  .is-b1 .tree__parts .tree__new {
    padding: 0 11px;
  }

  .tree__libs li {
    padding: 11px 6px 10px;
  }

  .tree__libs b {
    font-size: 12.5px;
  }

  .tree__libs em {
    font-size: 10.5px;
  }

  .fig__cap {
    font-size: 16px;
    min-height: 4.65em;
  }

  #duo-mode {
    flex: 1;
  }

  #duo-mode button {
    flex: 1;
    padding: 0 6px;
  }
}


/* ── Scroll-linked reveals, where the browser supports them ──── */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .section-head h2 {
      animation: head-in linear both;
      animation-timeline: view();
      animation-range: entry 0% cover 28%;
    }

    .section-head__note {
      animation: head-in linear both;
      animation-timeline: view();
      animation-range: entry 10% cover 32%;
    }

    .intro .wrap {
      animation: intro-out linear both;
      animation-timeline: view();
      animation-range: exit 10% exit 100%;
    }
  }
}

@keyframes head-in {
  from {
    opacity: 0;
    transform: translateY(28px);
  }
}

@keyframes intro-out {
  to {
    opacity: 0.15;
    transform: translateY(-24px) scale(0.98);
  }
}

/* ═══ Responsive ═══════════════════════════════════════════════ */

@media (max-width: 1100px) {
  .gram-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .gram-layout .reader {
    display: none;
  }

  .gram {
    max-width: 820px;
  }
}

@media (max-width: 1000px) {
  .hero__grid,
  .specimen,
  .targets,
  .pipe,
  .port,
  .loc,
  .discuss__inner,
  .cite__inner {
    grid-template-columns: minmax(0, 1fr);
  }

  .stats {
    max-width: 520px;
  }

  .specimen {
    gap: 40px;
  }

  .specimen__chart {
    order: -1;
  }

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

  .decision,
  .decision + .decision {
    padding: 30px 0 34px;
    border-left: 0;
  }

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

  .decision > *:not(.decision__head):not(h3) {
    max-width: 640px;
  }

  .targets {
    gap: 40px;
    margin-top: 56px;
  }

  .pipe {
    gap: 0;
  }

  .pipe__figure {
    display: none;
  }

  .port {
    gap: 40px;
  }

  .loc {
    gap: 48px;
  }

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

  .finding,
  .finding + .finding {
    padding: 20px 0;
    border-left: 0;
    border-top: 1px solid var(--line-soft);
  }
}

@media (min-width: 1001px) {
  .stage__fig {
    display: none;
  }

  .stage {
    cursor: pointer;
  }

  .stages.has-on .stage:not(.is-on) {
    opacity: 0.62;
  }

  .stages.has-on .stage:not(.is-on):hover {
    opacity: 0.85;
  }
}

@media (max-width: 700px) {
  :root {
    --gutter: 18px;
  }

  .bar__inner {
    height: 56px;
  }

  .bar__nav {
    gap: 16px;
  }

  .bar__nav a:not(.bar__ext) {
    display: none;
  }

  .hero {
    padding: 44px 0 52px;
  }

  .hero__title {
    font-size: clamp(32px, 9.4vw, 46px);
    line-height: 1.08;
  }

  .hero__grid {
    margin-top: 30px;
    padding-top: 26px;
  }

  .hero__lede p {
    font-size: 16px;
  }

  .hero__actions .btn {
    flex: 1 1 auto;
  }

  .hero__actions .btn--ghost {
    flex-basis: 100%;
    border-color: var(--line);
  }

  .stats {
    min-width: 0;
  }

  .stats dd {
    font-size: 30px;
  }

  .stats div:nth-child(odd) {
    padding-right: 16px;
  }

  .stats div:nth-child(even) {
    padding-left: 16px;
  }

  .sec {
    padding-bottom: 80px;
  }

  .section-head {
    padding: 40px 0 28px;
  }

  .spec__block pre,
  .spec__tail {
    font-size: 12px;
  }

  .spec__body {
    padding: 8px 4px 10px;
  }

  .spec__block {
    padding: 8px 10px;
  }

  .specimen__chart .sheet {
    margin: 0 calc(-1 * var(--gutter) + 6px);
  }

  .pin {
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    font-size: 11px;
  }

  .gram {
    margin: 0 calc(-1 * var(--gutter) + 6px);
    padding: 22px 16px 24px;
  }

  .gram__root {
    grid-template-columns: 18px 10px minmax(0, 1fr);
  }

  .gram__brace {
    width: 10px;
  }

  .rule,
  .gram__root .rule {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    font-size: 14.5px;
  }

  .rule__op {
    flex: none;
    width: 30px;
  }

  .rule__rhs {
    flex: 1 1 0;
  }

  .rule.is-wide .rule__rhs {
    flex-basis: 100%;
    padding-left: 18px;
  }

  .rule.is-wide .rule__pair {
    margin-left: 18px;
    padding-left: 12px;
  }

  .gram__hint {
    display: none;
  }

  .decision h3 {
    font-size: 25px;
  }

  .targets .sheet,
  .port .sheet,
  .stage__fig .sheet {
    margin: 0 calc(-1 * var(--gutter) + 6px);
  }

  .stage {
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 12px;
  }

  .stage__n {
    font-size: 28px;
  }

  .port__steps li {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }

  .loc__card {
    margin: 0 calc(-1 * var(--gutter) + 6px);
    padding: 20px 16px 18px;
  }

  .seg {
    width: 100%;
  }

  .seg button {
    flex: 1;
    padding: 0 8px;
  }

  .bars__row {
    grid-template-columns: 112px minmax(0, 1fr);
    gap: 10px;
  }

  .bars__axis {
    left: 122px;
  }

  .bars__name {
    font-size: 12.5px;
  }

  .t1 {
    margin-top: 64px;
    padding-top: 40px;
  }

  .discuss {
    padding: 72px 0;
  }

  .cite {
    padding: 64px 0;
  }

  .cite__ref {
    font-size: 16px;
  }

  .bib pre {
    font-size: 11.5px;
  }

  .foot__inner {
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .js .marked__band {
    transform: none;
  }

  .js .in-view {
    opacity: 1;
    transform: none;
  }
}

@media print {
  .bar,
  .hero__actions,
  .foot,
  .seg {
    display: none !important;
  }

  .reveal,
  .in-view {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* ── Family: the way home and the sibling sites ───────────────────
   Shared by every annotation site on dilshadur.com. Keep identical. */
.bar__start {
  display: flex;
  align-items: center;
  min-width: 0;
}

.home {
  display: grid;
  place-items: center;
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  outline-offset: 3px;
  transition: transform 0.4s var(--ease-out), box-shadow 0.2s;
}

.home img {
  display: block;
  width: 26px;
  height: 26px;
  border-radius: 999px;
}

.home:hover {
  transform: translateX(-2px);
  box-shadow: 0 0 0 1px var(--line);
}

.bar__div {
  flex: none;
  width: 1px;
  height: 18px;
  margin: 0 14px;
  background: var(--line);
}

.bar__start .mark {
  min-width: 0;
}

.bar__start .mark span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.family + .foot__inner {
  justify-content: flex-end;
}

.family {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: baseline;
  gap: 14px 40px;
  padding-bottom: 22px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--line-soft);
}

.family__home {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--serif);
  font-size: 16px;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}

.family__home img {
  width: 22px;
  height: 22px;
  border-radius: 999px;
}

.family__home span {
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0% 1px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: background-size 0.35s var(--ease-out);
}

.family__home:hover span {
  background-size: 100% 1px;
}

.family__set {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: flex-end;
  gap: 6px 22px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.family__label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.family__set a,
.family__set [aria-current] {
  font-size: 13.5px;
  white-space: nowrap;
}

.family__set [aria-current] {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ink);
}

.family__set [aria-current]::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: var(--warm);
}

@media (max-width: 760px) {
  .family {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .family__set {
    display: grid;
    grid-template-columns: 1fr 1fr;
    justify-content: start;
    gap: 10px 16px;
  }

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

.bar__start + .bar__nav {
  flex: none;
}

.bar__inner:has(.bar__start) {
  gap: 16px;
}

@media (max-width: 600px) {
  .bar__start + .bar__nav .bar__ext {
    display: none;
  }
}

@media (max-width: 520px) {
  .bar__div {
    margin: 0 10px;
  }
}
