/* plain.css: the neutral "document" look for documentation and papers.
   It does not load site.css or site.js. It uses system fonts, a gray palette and one link colour.
   Rules follow Google's developer documentation style guide, Material Design 3 (neutral tones,
   8 px spacing, 48 px targets) and web.dev accessibility guidance (4.5:1 text contrast, visible focus,
   no layout shift). See docs/WRITING.md.
   Two fixed themes, set on <html>:
     .theme-docs   dark gray, like a code host's documentation (project docs)
     .theme-paper  light, wiki-like reference page (papers)
   The themes do not follow the system colour scheme. */

:root,.theme-paper{
  color-scheme:light;
  --bg:#f8f9fa;        /* page */
  --surface:#ffffff;   /* reading column */
  --well:#f8f9fa;      /* code, notices, table heads */
  --rule:#a2a9b1;      /* borders */
  --rule-soft:#eaecf0; /* light dividers */
  --ink:#202122;       /* body text: 16:1 on surface */
  --muted:#54595d;     /* secondary text: 7:1 on surface */
  --link:#3366cc;      /* links: 5.3:1 on surface */
  --warn:#a66200;      /* caution edge */
  --stop:#bf3c2c;      /* warning edge */
  --radius:2px;
  --f-sans:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
  --f-serif:"Linux Libertine","Georgia","Times New Roman",Times,serif;
  --f-head:var(--f-serif);
  --f-mono:ui-monospace,SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace;
  --measure:46rem;    /* about 72 characters of body text */
}
.theme-docs{
  color-scheme:dark;
  --bg:#0d1117;--surface:#151b23;--well:#1f2630;--rule:#3d444d;--rule-soft:#2a313a;
  --ink:#e6edf3;       /* 15:1 on surface */
  --muted:#9198a1;     /* 6:1 on surface */
  --link:#4493f8;      /* 5.8:1 on surface */
  --warn:#d29922;--stop:#f85149;
  --radius:6px;
  --f-head:var(--f-sans);
}

*,*::before,*::after{box-sizing:border-box}
html{-webkit-text-size-adjust:100%;text-size-adjust:100%}
body{margin:0;background:var(--bg);color:var(--ink);font:16px/1.6 var(--f-sans)}
img,svg{max-width:100%;height:auto}

/* Skip link and focus */
.skip{position:absolute;left:-999px;top:8px;padding:8px 16px;background:var(--surface);border:1px solid var(--rule)}
.skip:focus{left:8px;z-index:10}
:focus-visible{outline:2px solid var(--link);outline-offset:2px}

/* Top bar: site name, section, breadcrumb */
.bar{background:var(--surface);border-bottom:1px solid var(--rule)}
.bar-in{max-width:1120px;margin:0 auto;padding:0 16px;display:flex;flex-wrap:wrap;align-items:center;gap:0 24px}
.bar a{color:var(--ink);text-decoration:none;display:inline-flex;align-items:center;min-height:48px}
.bar .site{font-weight:600}
.bar nav{display:flex;gap:0 16px;flex-wrap:wrap}
.bar nav a{color:var(--muted)}
.bar nav a[aria-current]{color:var(--ink);box-shadow:inset 0 -2px 0 var(--ink)}
.bar a:hover{color:var(--link)}

.crumbs{max-width:1120px;margin:0 auto;padding:16px 16px 0;font-size:14px;color:var(--muted)}
.crumbs ol{list-style:none;margin:0;padding:0;display:flex;flex-wrap:wrap;gap:4px}
.crumbs li+li::before{content:"/";margin-right:4px}
.crumbs a{color:var(--muted)}

/* Layout: content column plus an optional contents list */
.page{max-width:1120px;margin:0 auto;padding:16px;display:grid;grid-template-columns:minmax(0,1fr);gap:24px}
.page.has-toc{grid-template-columns:minmax(0,1fr) 220px}
.doc{background:var(--surface);border:1px solid var(--rule);border-radius:var(--radius);padding:32px 40px 40px;min-width:0}
.doc>*{max-width:var(--measure)}
.doc>pre,.doc>table,.doc>.table-wrap,.doc>figure{max-width:100%}

.toc{align-self:start;position:sticky;top:16px;font-size:14px}
.toc h2{font-size:12px;font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--muted);margin:8px 0}
.toc ol{list-style:none;margin:0;padding:0;border-left:1px solid var(--rule)}
.toc a{display:block;padding:6px 12px;color:var(--muted);text-decoration:none;margin-left:-1px;border-left:2px solid transparent}
.toc a:hover{color:var(--ink);border-left-color:var(--muted)}

/* Text: conventional Markdown rendering */
h1,h2,h3,h4{line-height:1.25;font-weight:600;margin:1.6em 0 .5em}
h1,h2{font-family:var(--f-head)}
h1{font-size:2rem;margin-top:0}
h2{font-size:1.5rem;padding-bottom:.3em;border-bottom:1px solid var(--rule-soft)}
h3{font-size:1.2rem}
h4{font-size:1rem}
p,ul,ol,dl,table,pre,blockquote,.notice{margin:0 0 1em}
ul,ol{padding-left:1.6em}
li+li{margin-top:.25em}
a{color:var(--link);text-underline-offset:2px}
hr{border:0;border-top:1px solid var(--rule);margin:2em 0}
strong{font-weight:600}
sup,sub{line-height:0;position:relative;vertical-align:baseline;font-size:.75em}
sup{top:-.5em}
sub{top:.25em}
.lede{font-size:1.125rem;color:var(--ink)}
.meta{font-size:14px;color:var(--muted)}
dl.facts{display:grid;grid-template-columns:max-content 1fr;gap:4px 16px;font-size:14px}
dl.facts dt{color:var(--muted)}
dl.facts dd{margin:0}

code,kbd,samp{font:.875em/1.5 var(--f-mono);background:var(--well);border-radius:4px;padding:.1em .35em;overflow-wrap:anywhere}
kbd{border:1px solid var(--rule);border-bottom-width:2px}
pre{background:var(--well);border:1px solid var(--rule-soft);border-radius:var(--radius);padding:16px;overflow:auto;font:14px/1.5 var(--f-mono)}
pre code{background:none;padding:0;font-size:inherit;overflow-wrap:normal}

blockquote{margin-left:0;padding:0 1em;color:var(--muted);border-left:4px solid var(--rule)}

.table-wrap{overflow-x:auto}
table{border-collapse:collapse;font-size:15px;font-variant-numeric:tabular-nums}
th,td{border:1px solid var(--rule);padding:6px 12px;text-align:left;vertical-align:top}
thead th{background:var(--well);font-weight:600}
td.num,th.num{text-align:right}
caption{caption-side:top;text-align:left;font-size:14px;color:var(--muted);padding-bottom:8px}

/* STE notices: WARNING (risk to people or data), CAUTION (risk to equipment or files), NOTE (information) */
.notice{border:1px solid var(--rule-soft);border-left:4px solid var(--muted);border-radius:var(--radius);background:var(--well);padding:12px 16px}
.notice>:last-child{margin-bottom:0}
.notice .label{display:block;font-size:12px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;margin-bottom:4px}
.notice.warning{border-left-color:var(--stop)}
.notice.caution{border-left-color:var(--warn)}

/* Procedure steps */
ol.steps>li{padding-left:4px}
ol.steps>li+li{margin-top:.5em}

/* Index lists (docs hub and paper list) */
.list{list-style:none;padding:0;margin:0 0 1em;border-top:1px solid var(--rule)}
h2+.list{border-top:0}
.list>li{margin:0;padding:16px 0;border-bottom:1px solid var(--rule)}
.list h2,.list h3{border:0;margin:0 0 4px;padding:0;font-size:1.125rem}
.list p{margin:0 0 4px}

/* Paper page */
.paper-title{font-family:var(--f-serif);font-weight:600;font-size:1.875rem;line-height:1.3}
.authors{margin:0 0 4px;font-size:1.0625rem}
.abstract{font-family:var(--f-serif);font-size:1.0625rem;line-height:1.65}
.actions{display:flex;flex-wrap:wrap;gap:8px;margin:16px 0 24px;padding:0;list-style:none}
.actions li{margin:0}
.btn{display:inline-flex;align-items:center;min-height:40px;padding:0 16px;border:1px solid var(--rule);border-radius:20px;background:var(--surface);color:var(--link);font-weight:500;text-decoration:none}
.btn:hover{background:var(--well)}
.btn.primary{background:var(--link);border-color:var(--link);color:var(--surface)}
.btn.primary:hover{filter:brightness(.92)}
.btn[aria-disabled=true]{color:var(--muted);background:var(--well);pointer-events:none}
.cite{position:relative}
.cite pre{white-space:pre-wrap;overflow-wrap:anywhere}
.todo{outline:2px dashed var(--warn);outline-offset:2px}

/* Wiki-like details for the paper theme */
.theme-paper h1,.theme-paper h2,.theme-paper .paper-title{font-weight:400}
.theme-paper h2{border-bottom-color:var(--rule)}
.theme-paper .doc{border-color:var(--rule-soft)}
.theme-paper thead th,.theme-paper tbody th{background:#eaecf0}
.theme-paper td{background:var(--well)}
.theme-paper .btn{border-radius:var(--radius)}
.theme-paper .bar{border-bottom-color:var(--rule)}
.theme-paper .notice{border-left-width:3px}

/* Footer */
.foot{max-width:1120px;margin:0 auto;padding:24px 16px 48px;font-size:14px;color:var(--muted);display:flex;flex-wrap:wrap;gap:8px 24px;justify-content:space-between}
.foot a{color:var(--muted)}

@media (max-width:860px){
  .page.has-toc{grid-template-columns:minmax(0,1fr)}
  .toc{position:static;order:-1}
  .doc{padding:24px 16px 32px;border-radius:0;border-left:0;border-right:0}
  .page{padding:16px 0}
  .toc{padding:0 16px}
  h1,.paper-title{font-size:1.6rem}
}
@media print{
  :root,.theme-docs,.theme-paper{color-scheme:light;--bg:#fff;--surface:#fff;--well:#f4f4f4;--rule:#999;--rule-soft:#ccc;--ink:#000;--muted:#444;--link:#000}
  .bar,.toc,.crumbs,.foot,.actions,.skip{display:none}
  .doc{border:0;padding:0}
  a[href^="http"]::after{content:" (" attr(href) ")";font-size:.85em;color:var(--muted)}
}
