/* Diokle documentation site and landing page (generated by build-docs.mjs).
   "Technical Swiss": paper and ink, hairline rules, square corners, one blue accent.
   The colours match the workbench tokens in web/src/tokens.css. */
@font-face {
  font-family: "Inter Tight";
  src: url("fonts/inter-tight-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("fonts/plex-mono-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("fonts/plex-mono-500.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
:root {
  --font-ui: "Inter Tight", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --radius: 2px;
  --bg: #f5f3ee;
  --panel: #fbfaf7;
  --fg: #17191c;
  --muted: #5b5f66;
  --line: #8a8577;
  --rule: #d6d2c8;
  --code-bg: #efece5;
  --accent: #1e40af;
  --accent-soft: #e4e9f7;
  --on-accent: #ffffff;
  --new: #2b6b3f;
  --new-soft: #e3efe6;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141517;
    --panel: #1b1c20;
    --fg: #f2efe8;
    --muted: #a7a296;
    --line: #75705f;
    --rule: #3a3a3f;
    --code-bg: #22231a;
    --accent: #8fb0ff;
    --accent-soft: #1f2b4a;
    --on-accent: #0f1116;
    --new: #7fd39a;
    --new-soft: #1d3324;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { scroll-padding-top: 64px; }
body {
  margin: 0;
  font: 16px/1.6 var(--font-ui);
  background: var(--bg);
  color: var(--fg);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 10px;
  height: 56px; padding: 0 16px;
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 600; font-size: 17px; letter-spacing: -0.01em; color: var(--fg); white-space: nowrap; }
.brand:hover { text-decoration: none; }
.logo {
  display: inline-grid; place-items: center; width: 26px; height: 26px; margin-right: 4px;
  border-radius: var(--radius); background: var(--fg); color: var(--bg); font-size: 15px; font-weight: 600;
}
.dim { color: var(--muted); font-weight: 400; }
.grow { flex: 1; }
.btn {
  padding: 6px 14px; border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--fg); font-size: 14px; white-space: nowrap; background: var(--panel);
}
.btn:hover { text-decoration: none; border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--fg); border-color: var(--fg); color: var(--bg); font-weight: 600; }
.btn.primary:hover { color: var(--bg); border-color: var(--accent); }
.menu { display: none; background: none; border: 0; color: var(--fg); font-size: 20px; cursor: pointer; }

.shell {
  display: grid; grid-template-columns: 240px minmax(0, 1fr) 220px;
  max-width: 1440px; margin: 0 auto;
}
.side, .toc {
  position: sticky; top: 56px; align-self: start;
  max-height: calc(100vh - 56px); overflow-y: auto; padding: 28px 16px;
  font-size: 14px;
}
.nav-group { margin-bottom: 20px; }
.nav-title {
  font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); margin-bottom: 6px; padding-bottom: 4px; border-bottom: 1px solid var(--rule);
}
.side a, .toc a { display: block; padding: 3px 10px; border-radius: var(--radius); color: var(--fg); }
.side a:hover, .toc a:hover { background: var(--accent-soft); text-decoration: none; }
.side a.current { background: var(--accent-soft); color: var(--accent); font-weight: 600; box-shadow: inset 2px 0 0 var(--accent); }
.toc a { color: var(--muted); padding: 2px 8px; }
.toc a.d3 { padding-left: 20px; font-size: 13px; }

.content { padding: 36px 48px 64px; min-width: 0; }
article { max-width: 900px; }
article h1 { font-size: 46px; line-height: 1.05; letter-spacing: -0.03em; font-weight: 600; margin: 4px 0 20px; }
article h2 {
  font-size: 26px; font-weight: 600; letter-spacing: -0.015em; margin: 44px 0 14px; padding-top: 10px;
  border-top: 1px solid var(--fg);
}
article h3 { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; margin: 28px 0 8px; }
article h4 { font-size: 16px; font-weight: 600; margin: 20px 0 6px; }
.anchor { float: left; margin-left: -20px; width: 20px; color: var(--muted); opacity: 0; font-weight: 400; }
h2:hover .anchor, h3:hover .anchor, h4:hover .anchor { opacity: 1; text-decoration: none; }
article p, article li { max-width: 74ch; }
article li { margin: 4px 0; }
code { font: 0.86em var(--mono); background: var(--code-bg); padding: 1px 5px; border-radius: var(--radius); }
pre {
  background: var(--code-bg); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; overflow-x: auto; font-size: 14px; line-height: 1.5;
}
pre code { background: none; padding: 0; font-size: inherit; }
blockquote { margin: 18px 0; padding: 8px 16px; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0; }
blockquote p { margin: 6px 0; }
.table-wrap { overflow-x: auto; margin: 14px 0; }
table { border-collapse: collapse; font-size: 14.5px; }
th, td { border: 1px solid var(--rule); padding: 6px 10px; text-align: left; vertical-align: top; }
th { background: var(--code-bg); font-weight: 600; }
td[align="right"], th[align="right"] { text-align: right; }

figure { margin: 20px 0; }
figure img, video {
  display: block; max-width: 100%; height: auto;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel);
}
figcaption { font-size: 14px; color: var(--muted); margin-top: 8px; }
.zoom { cursor: zoom-in; }
video { width: 100%; }
.lightbox {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center;
  background: rgba(0, 0, 0, 0.85); cursor: zoom-out; padding: 20px;
}
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: var(--radius); }

/* Side-by-side images and feature cards, written as raw HTML in the Markdown. */
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 20px 0; }
.pair figure { margin: 0; }
.cards {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0; margin: 24px 0; border-top: 1px solid var(--fg); border-left: 1px solid var(--rule);
}
.card {
  display: flex; flex-direction: column; background: var(--panel);
  border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
  overflow: hidden; color: var(--fg);
}
.card:hover { background: var(--accent-soft); text-decoration: none; }
.card img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; object-position: center 40%; border-bottom: 1px solid var(--rule); }
.card b { display: block; padding: 14px 16px 4px; font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.card > span { display: block; padding: 0 16px 16px; font-size: 14.5px; color: var(--muted); }
.card b .new { margin-left: 6px; }
.new {
  display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--new); background: var(--new-soft); border-radius: var(--radius); padding: 1px 6px; vertical-align: 2px;
}
.hero { margin: 0 0 12px; font-size: 21px; line-height: 1.5; color: var(--fg); max-width: 60ch; }
.cta { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin: 22px 0 10px; }
.cta a { padding: 10px 18px; font-size: 15px; }

.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 52px; max-width: 900px; }
.pager a {
  flex: 1; max-width: 50%; padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--radius); color: var(--fg);
}
.pager a:hover { border-color: var(--accent); text-decoration: none; }
.pager a span { display: block; font-size: 13px; color: var(--muted); }
.pager .next { text-align: right; margin-left: auto; }
.edit { font-size: 14px; margin-top: 24px; }
.site-foot { font-size: 14px; margin-top: 36px; padding-top: 16px; border-top: 1px solid var(--rule); color: var(--muted); }
.site-foot a { color: inherit; }

@media (max-width: 1200px) {
  .shell { grid-template-columns: 230px minmax(0, 1fr); }
  .toc { display: none; }
}
@media (max-width: 800px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .menu { display: block; }
  .side {
    display: none; position: fixed; top: 56px; left: 0; bottom: 0; width: 280px; z-index: 20;
    max-height: none; background: var(--panel); border-right: 1px solid var(--line);
  }
  body.nav-open .side { display: block; }
  .content { padding: 24px 16px 52px; }
  .top .btn:not(.primary), .brand .dim { display: none; }
  .pair { grid-template-columns: 1fr; }
  article h1 { font-size: 34px; }
  .hero { font-size: 19px; }
  .cards { grid-template-columns: 1fr; }
}

/* Equations (KaTeX, rendered at build time) and inline diagrams. */
.math.display { margin: 14px 0; overflow-x: auto; overflow-y: hidden; padding: 2px 0; }
.math .katex { font-size: 1.08em; }
.diagram { margin: 18px 0; overflow-x: auto; }
.diagram svg { display: block; width: 100%; min-width: 560px; height: auto; }
.diagram .box { fill: var(--panel); stroke: var(--line); stroke-width: 1.2; }
.diagram .hot { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 1.4; }
.diagram .t { font: 600 14px var(--font-ui); fill: var(--fg); }
.diagram text.s { font: 11.5px var(--font-ui); fill: var(--muted); }
.diagram .cap { font: italic 12px var(--font-ui); fill: var(--muted); }
.diagram .arr { stroke: var(--muted); stroke-width: 1.5; fill: none; }
.diagram text { fill: var(--fg); }

/* Long identifiers in running text wrap instead of widening the page on phones. */
article code { overflow-wrap: anywhere; }
article a { overflow-wrap: anywhere; }
