@font-face {
  font-family: Inter;
  src: url("../fonts/InterVariable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #ffffff;
  --fg: #111111;
  --muted: #5a5a5a;
  --max: 40rem;
  color-scheme: light;
}

html[data-theme="dark"] {
  --bg: #111111;
  --fg: #f3f3f3;
  --muted: #a8a8a8;
  color-scheme: dark;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-weight: 400;
  font-size: 1.0625rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

.theme-toggle {
  position: fixed;
  top: 0.85rem;
  right: 0.95rem;
  z-index: 20;
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--fg) 22%, transparent);
  border-radius: 999px;
  background: var(--bg);
  color: var(--fg);
  cursor: pointer;
}

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

.theme-toggle svg {
  display: block;
}

.theme-toggle .icon-sun {
  display: none;
}

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

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

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 2.5rem 1.35rem 5.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  font-weight: 560;
  font-size: 0.95rem;
  letter-spacing: -0.03em;
  margin: 0 0 2.4rem;
}

.brand:hover {
  text-decoration: none;
}

.brand img {
  width: 22px;
  height: 22px;
  display: block;
  /* White glyph on transparent → black on a light page */
  filter: invert(1);
}

html[data-theme="dark"] .brand img {
  filter: none;
}

h1 {
  font-size: clamp(1.85rem, 5vw, 2.35rem);
  font-weight: 620;
  letter-spacing: -0.05em;
  line-height: 1.12;
  margin: 0 0 0.85rem;
}

.lede {
  font-size: 1.125rem;
  font-weight: 400;
  color: var(--muted);
  margin: 0 0 2rem;
  line-height: 1.55;
}

.legal-meta {
  font-size: 0.84rem;
  color: var(--muted);
  margin: 0 0 2rem;
}

h2 {
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.035em;
  margin: 2.6rem 0 0.75rem;
}

h3 {
  font-size: 1rem;
  font-weight: 560;
  letter-spacing: -0.02em;
  margin: 1.6rem 0 0.4rem;
}

p {
  margin: 0 0 1.05rem;
}

.wrap p,
.wrap li {
  font-size: 1.02rem;
}

ul,
ol {
  margin: 0.35rem 0 1.15rem;
  padding-left: 1.2rem;
}

li {
  margin-bottom: 0.5rem;
}

strong {
  font-weight: 580;
}

.emph,
.feature-list strong {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  cursor: text;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.86em;
  font-weight: 450;
}

.muted,
.caption {
  color: var(--muted);
  font-size: 0.9rem;
}

.toc {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  font-weight: 450;
}

.toc-kicker {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.55rem;
}

.toc a {
  color: var(--fg);
  width: fit-content;
}

.note {
  color: var(--muted);
  margin: 1.1rem 0 1.4rem;
}

.diagram {
  margin: 1.4rem 0 1.7rem;
}

.diagram-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.4rem 0.55rem;
}

.diagram-row + .diagram-row {
  margin-top: 0.85rem;
}

.box {
  padding: 0.15rem 0;
  font-size: 0.82rem;
  font-weight: 560;
  letter-spacing: -0.02em;
  text-align: center;
}

.box.soft {
  font-weight: 400;
  color: var(--muted);
}

.arrow {
  color: var(--muted);
  font-weight: 400;
}

.diagram figcaption,
.caption {
  display: block;
  margin: 0.7rem 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.4rem 2rem;
  margin: 1.1rem 0 1.5rem;
}

.card h3 {
  margin-top: 0;
}

.card p:last-child,
.card ul:last-child {
  margin-bottom: 0;
}

.feature-list {
  list-style: none;
  padding: 0;
  margin: 0.6rem 0 1.4rem;
}

.feature-list li {
  padding: 0.55rem 0 0.85rem;
  margin: 0;
}

.feature-list strong {
  display: block;
  font-size: 1rem;
  margin-bottom: 0.12rem;
}

.feature-list span {
  color: var(--muted);
  font-size: 0.95rem;
}

.site-footer {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 1.35rem 3rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 1.15rem;
  font-size: 0.84rem;
  font-weight: 450;
  color: var(--muted);
}

.site-footer a {
  text-decoration: underline;
}

.term {
  display: inline;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  text-decoration: underline dotted;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  cursor: help;
}

.term[aria-expanded="true"] {
  text-decoration-style: solid;
}

.term-pop {
  position: fixed;
  z-index: 40;
  width: min(22rem, calc(100vw - 2rem));
  padding: 0.9rem 1rem 1rem;
  border: 0;
  border-radius: 14px;
  background: color-mix(in srgb, var(--bg) 48%, transparent);
  color: var(--fg);
  -webkit-backdrop-filter: blur(18px) saturate(1.6);
  backdrop-filter: blur(18px) saturate(1.6);
  font-size: 0.88rem;
  font-weight: 400;
  line-height: 1.5;
  pointer-events: auto;
}

.term-pop[hidden] {
  display: none;
}

.term-pop strong {
  display: block;
  font-weight: 600;
  margin: 0 0 0.35rem;
  text-decoration: none;
}

.table-wrap {
  overflow-x: auto;
  margin: 1.2rem 0 1.65rem;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
  line-height: 1.45;
}

th,
td {
  text-align: left;
  vertical-align: top;
  padding: 0.55rem 0.85rem 0.55rem 0;
}

th {
  font-weight: 600;
  letter-spacing: -0.02em;
}

tbody tr {
  border-top: 1px solid color-mix(in srgb, var(--fg) 16%, transparent);
}

.graph {
  margin: 1.45rem 0 1.8rem;
  font-size: 0.78rem;
}

.graph-col,
.graph-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.35rem 0.5rem;
}

.graph-col {
  flex-direction: column;
}

.node {
  display: inline-block;
  border: 1.5px solid var(--fg);
  border-radius: 6px;
  padding: 0.48rem 0.75rem;
  font-weight: 560;
  letter-spacing: -0.02em;
  text-align: center;
  background: var(--bg);
  min-width: 6.2rem;
}

.node.soft {
  font-weight: 400;
  color: var(--muted);
  border-style: dashed;
}

.edge,
.edge-v {
  color: var(--muted);
  font-weight: 400;
  font-size: 0.9rem;
  line-height: 1;
}

.edge-label {
  display: block;
  font-size: 0.68rem;
  color: var(--muted);
  font-weight: 400;
  text-align: center;
  max-width: 8.5rem;
}

.graph-cluster {
  border: 1px solid color-mix(in srgb, var(--fg) 28%, transparent);
  border-radius: 8px;
  padding: 0.7rem 0.7rem 0.8rem;
  min-width: min(100%, 14rem);
}

.graph-cluster + .graph-row,
.graph-cluster + .graph-col {
  margin-top: 0.75rem;
}

.cluster-title {
  display: block;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
  margin: 0 0 0.65rem;
}

.graph-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  align-items: stretch;
}

.graph figcaption {
  display: block;
  margin: 0.75rem 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.78rem;
}

.seq {
  margin: 1.3rem 0 1.7rem;
  display: grid;
  gap: 0.65rem;
}

.seq-row {
  display: grid;
  grid-template-columns: 1.6rem 1fr;
  gap: 0.65rem;
  align-items: start;
}

.seq-n {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 500;
  padding-top: 0.12rem;
}

.seq-row p {
  margin: 0;
  font-size: 0.92rem;
}

@media (max-width: 640px) {
  .graph-split {
    grid-template-columns: 1fr;
  }
}

.reveal {
  opacity: 0;
  filter: blur(12px);
  transform: translateY(12px);
  transition:
    opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
    filter 0.85s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.75s cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal.is-visible {
  opacity: 1;
  filter: blur(0);
  transform: translateY(0);
}

@media (max-width: 640px) {
  .wrap {
    padding: 1.75rem 1.15rem 4.5rem;
  }

  .theme-toggle {
    top: 0.75rem;
    right: 0.75rem;
  }

  .two-col {
    grid-template-columns: 1fr;
    gap: 0.4rem;
  }

  h1 {
    font-size: 1.75rem;
  }
}

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

  .reveal {
    opacity: 1;
    filter: none;
    transform: none;
    transition: none;
  }
}
