/* Copyright (c) 2026 SymLean Team. All rights reserved.
   Released under Apache 2.0 license as described in the file LICENSE. */
/* The SymLean site. One palette, three typefaces (STIX Two Text, STIX Two Math, JuliaMono, all
   under the SIL Open Font License, in fonts/). */

@font-face { font-family: "STIX Two Text"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("fonts/STIXTwoText-Regular.woff2") format("woff2"); }
@font-face { font-family: "STIX Two Text"; font-style: italic; font-weight: 400; font-display: swap;
  src: url("fonts/STIXTwoText-Italic.woff2") format("woff2"); }
@font-face { font-family: "STIX Two Text"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("fonts/STIXTwoText-SemiBold.woff2") format("woff2"); }
@font-face { font-family: "STIX Two Text"; font-style: italic; font-weight: 600; font-display: swap;
  src: url("fonts/STIXTwoText-SemiBoldItalic.woff2") format("woff2"); }
@font-face { font-family: "STIX Two Math"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("fonts/STIXTwoMath-Regular.woff2") format("woff2"); }
@font-face { font-family: "JuliaMono"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("fonts/JuliaMono-Regular.woff2") format("woff2"); }

:root {
  --paper: #fbfaf7;
  --ink: #1d232a;
  --muted: #6a7078;
  --faint: #8d929a;
  --rule: #e4e1d9;
  --panel: #f3f1eb;
  --code-bg: #f4f2ec;
  --card: #ffffff;
  --accent: #1f6f78;
  --accent-soft: #e2eeee;
  --rust: #b3542e;
  --rust-soft: #f8ebe4;
  --green: #2e7d4f;
  --green-soft: #e6f2ea;
  --kw: #6f3f8f;
  --mode: #96561a;
  --str: #3f7a32;
  --serif: "STIX Two Text", "STIX Two", "Iowan Old Style", Georgia, serif;
  --math: "STIX Two Math", "STIX Two", math;
  --mono: "JuliaMono", "DejaVu Sans Mono", ui-monospace, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --content-width: 60rem;
  --page-gutter: clamp(1rem, 3vw, 2rem);
  --header-height: 3.1rem;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #14181c;
    --ink: #e3e1db;
    --muted: #9ca2a9;
    --faint: #7c838b;
    --rule: #2b3137;
    --panel: #1b2025;
    --code-bg: #1a1f24;
    --card: #181d22;
    --accent: #6db7bf;
    --accent-soft: #1d3134;
    --rust: #e3916c;
    --rust-soft: #33231c;
    --green: #74c597;
    --green-soft: #19291f;
    --kw: #c7a0dd;
    --mode: #e1b173;
    --str: #9fd18f;
  }
}

* { box-sizing: border-box; }
html { font-size: 17px; -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-height) + 1rem); }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  line-height: 1.6;
  font-kerning: normal;
  text-rendering: optimizeLegibility;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 0.15em; }
a.ext::after { content: "\2009\2197"; font-size: 0.8em; color: var(--faint); }
p { margin: 0 0 0.9em; }
strong { font-weight: 600; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 0.5rem; z-index: 10; background: var(--card); padding: 0.3rem 0.6rem; }

code, pre, var { font-family: var(--mono); }
code { font-size: 0.84em; font-variant-ligatures: none; overflow-wrap: anywhere; }
var { font-style: italic; color: inherit; }
pre {
  font-size: 0.8rem;
  line-height: 1.5;
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-variant-ligatures: none;
  tab-size: 2;
}
pre.shell {
  background: var(--code-bg);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 0.7rem 0.9rem;
  margin: 0.4rem 0 1rem;
}

/* Lean syntax, in code blocks and the usage box; inline code in prose keeps the color of the text */
pre.lean .k, .usage .k { color: var(--kw); }
pre.lean .t, .usage .t { color: var(--accent); }
pre.lean .m, .usage .m { color: var(--mode); }
pre.lean .s, .usage .s { color: var(--str); }
pre.lean .c { color: var(--faint); font-style: italic; }
pre.lean var, .usage var { color: var(--mode); }
.lean-hover { cursor: help; border-radius: 2px; }
.lean-hover:hover, .lean-hover:focus-visible { background: var(--accent-soft); outline: 1px solid var(--accent); }
.lean-tooltip {
  position: fixed; z-index: 100; width: max-content; max-width: min(36rem, calc(100vw - 16px));
  max-height: min(24rem, calc(100vh - 16px)); overflow: auto; padding: 0.85rem 1rem;
  border: 1px solid var(--rule); border-radius: 6px; background: var(--card); color: var(--ink);
  box-shadow: 0 5px 25px #0003;
}
.lean-tooltip[hidden] { display: none; }
.lean-tooltip pre { font-size: 0.76rem; white-space: pre-wrap; line-height: 1.5; }

/* Math */
math { font-family: var(--math); font-size: 1.07em; }
.inline-math { display: inline-block; max-width: 100%; overflow-x: auto; overflow-y: hidden;
  vertical-align: middle; padding-block: 0.15em; }
.inline-math math { white-space: nowrap; }
math[display="block"] { display: block math; margin: 0.5em 0; overflow-x: auto; overflow-y: hidden; }
.display-math { margin: 0.9rem 0 1.1rem; overflow-x: auto; }
mtd { padding-right: 0.4em; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 5;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
}
.topbar-inner {
  max-width: 82rem; margin: 0 auto; padding: 0 var(--page-gutter);
  display: grid; grid-template-columns: max-content minmax(0, 1fr); align-items: center; height: 3.1rem;
}
.brand { display: block; line-height: 0; }
.brand-logo img { display: block; height: 1.7rem; width: auto; }
.top-nav { text-align: right; white-space: nowrap; font-family: var(--sans); font-size: 0.82rem; }
.top-nav a { color: var(--muted); margin-left: 1.3rem; }
.top-nav a[aria-current="page"] { color: var(--ink); }
.code-button, .button {
  display: inline-block; font-family: var(--sans); font-size: 0.82rem; font-weight: 500;
  border: 1px solid var(--rule); border-radius: 999px; padding: 0.28rem 0.9rem;
  color: var(--ink) !important; background: var(--card);
}
.code-button:hover, .button:hover { border-color: var(--accent); text-decoration: none; }
.button.primary { background: var(--ink); color: var(--paper) !important; border-color: var(--ink); }

/* Documentation layout */
.docs {
  max-width: 82rem; margin: 0 auto; padding: 0 var(--page-gutter);
  display: grid; grid-template-columns: 14.5rem minmax(0, 1fr); gap: 2.5rem;
}
.sidebar {
  position: sticky; top: var(--header-height); align-self: start;
  max-height: calc(100vh - var(--header-height)); overflow-y: auto;
  padding: 1.6rem 0.6rem 3rem 0;
  font-family: var(--sans); font-size: 0.8rem; line-height: 1.45;
  border-right: 1px solid var(--rule);
}
.sidebar a { color: var(--ink); }
.sidebar a[aria-current="page"] { color: var(--accent); font-weight: 600; }
.sidebar .nav-home { font-weight: 600; margin-bottom: 1rem; }
.sidebar .nav-heading {
  margin: 1.2rem 0 0.4rem; font-size: 0.68rem; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--faint);
}
.sidebar .nav-heading a { color: var(--faint); }
.sidebar details { margin: 0.05rem 0; }
.sidebar summary { cursor: pointer; padding: 0.16rem 0; list-style: none; }
.sidebar summary::-webkit-details-marker { display: none; }
.sidebar summary::before {
  content: "\25B8"; display: inline-block; width: 0.9rem; color: var(--faint);
  transition: transform 0.12s;
}
.sidebar details[open] > summary::before { transform: rotate(90deg); }
.sidebar ul { list-style: none; margin: 0.1rem 0 0.4rem; padding: 0 0 0 0.9rem; }
.sidebar li { padding: 0.08rem 0; }
.sidebar li code { font-size: 0.92em; }
.sidebar .nav-flat { padding-left: 0; }

main.doc { padding: 1.4rem 0 4rem; min-width: 0; width: 100%; max-width: var(--content-width); }
.crumbs { font-family: var(--sans); font-size: 0.76rem; color: var(--muted); margin: 0.4rem 0 1.6rem; }
.crumbs a { color: var(--muted); }
.crumbs .sep { color: var(--faint); margin: 0 0.25rem; }
.crumbs code { font-size: 0.95em; }

.page-head { margin-bottom: 1.8rem; }
.page-head .kind {
  font-family: var(--sans); font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--accent); margin: 0 0 0.3rem;
}
.page-head h1 { font-size: 2.2rem; line-height: 1.15; margin: 0 0 0.5rem; font-weight: 600; }
.page-head h1 code { font-size: 0.86em; font-weight: 400; }
.page-head .summary { font-size: 1.12rem; color: var(--muted); margin: 0; }

main.doc > p, main.doc > ul, main.doc > ol, main.doc section > p, main.doc details > p,
main.doc .ex-body > p, main.doc .ex-body > ul { max-width: none; }
h2, h3 { font-weight: 600; line-height: 1.25; position: relative; }
h2 { font-size: 1.42rem; margin: 2.4rem 0 0.9rem; }
h3 { font-size: 1.13rem; margin: 1.8rem 0 0.6rem; }
.anchor { margin-left: 0.4rem; color: var(--faint); font-weight: 400; opacity: 0; font-size: 0.8em; }
h2:hover .anchor, h3:hover .anchor { opacity: 1; }
h2:target, h3:target, figure:target { background: linear-gradient(var(--accent-soft), var(--accent-soft)) no-repeat; background-size: 100% 100%; }
ul, ol { padding-left: 1.3rem; margin: 0 0 1rem; }
li { margin: 0.25rem 0; }
li::marker { color: var(--faint); }
hr.sep { border: 0; border-top: 1px dashed var(--rule); margin: 1.6rem 0 1.4rem; }

/* Usage box */
.usage {
  background: var(--panel); border: 1px solid var(--rule); border-left: 3px solid var(--accent);
  border-radius: 4px; padding: 0.3rem 1.2rem; margin: 0 0 2rem;
}
.usage-row { padding: 0.75rem 0; border-top: 1px solid var(--rule); }
.usage-row:first-child { border-top: 0; }
.usage-form code { font-size: 0.9rem; font-weight: 400; }
.usage-meaning { margin: 0.2rem 0 0 1.6rem; color: var(--ink); }

/* Tables of options */
table.opts { border-collapse: collapse; table-layout: fixed; width: 100%; margin: 0.3rem 0 1.6rem; font-size: 0.93rem; }
table.opts th {
  text-align: left; font-family: var(--sans); font-size: 0.72rem; font-weight: 600; color: var(--faint);
  padding: 0.3rem 1rem 0.35rem 0; border-bottom: 1px solid var(--rule);
}
table.opts td { vertical-align: top; padding: 0.55rem 1rem 0.55rem 0; border-bottom: 1px solid var(--rule); }
table.opts th:first-child { width: 30%; }
table.opts th:nth-child(2):not(:last-child) { width: 18%; }
table.opts th, table.opts td { overflow-wrap: anywhere; white-space: normal; }
table.opts td:last-child { padding-right: 0; }

/* Details and Options, Examples */
details.section > summary, details.ex-section > summary {
  cursor: pointer; list-style: none; display: block;
}
details.section > summary::-webkit-details-marker, details.ex-section > summary::-webkit-details-marker { display: none; }
details.section > summary h2::before, details.ex-section > summary h3::before {
  content: "\25B8"; display: inline-block; width: 1.1rem; color: var(--faint); font-size: 0.8em;
  transition: transform 0.12s; transform-origin: 35% 50%;
}
details.section[open] > summary h2::before, details.ex-section[open] > summary h3::before { transform: rotate(90deg); }
details.section > summary h2, details.ex-section > summary h3 { display: block; }
.details-options ul { max-width: none; }
.examples > h2 .count, .ex-section .count { color: var(--faint); font-weight: 400; font-size: 0.85em; }
.ex-section { border-top: 1px solid var(--rule); }
.ex-section > summary h3 { margin: 1rem 0; }
.ex-body { padding: 0 0 1rem; }

/* Notebook cells */
.cells { margin: 0.6rem 0 1.2rem; }
.cell { display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; }
.cell .label {
  font-family: var(--sans); font-size: 0.66rem; color: var(--faint); text-align: left;
  padding: 0.35rem 0 0.2rem; white-space: nowrap; letter-spacing: 0.02em;
}
.cell.in .label { color: var(--accent); }
.cell.in .cell-body > pre.lean {
  background: var(--code-bg); border: 1px solid var(--rule); border-radius: 5px;
  padding: 0.65rem 0.9rem; font-size: 0.84rem; line-height: 1.65;
}
.cell.out { margin-top: 0.4rem; }
.cell.out .cell-body { padding: 0.35rem 0 0; }
.quote-note { font-family: var(--sans); font-size: 0.72rem; color: var(--muted); margin: 0.35rem 0 0; }
.quote-note code { font-size: 0.95em; }

.report .result { margin: 0 0 0.6rem; }
.report .qual { font-family: var(--sans); font-size: 0.72rem; color: var(--faint); margin: 0 0 0.15rem; }
.report .tf { font-size: 1.22rem; overflow-x: auto; overflow-y: hidden; }
.report .tf math { margin: 0.1em 0 0.2em; }
.report code.plain, .report pre.plain { display: block; color: var(--muted); font-size: 0.76rem; overflow-wrap: anywhere; }
.report code.plain.only { color: var(--ink); font-size: 0.92rem; }
.fields {
  display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 0.1rem 1rem;
  font-size: 0.85rem; margin: 0.3rem 0 0.8rem;
}
.fields dt { font-family: var(--sans); font-size: 0.72rem; color: var(--faint); padding-top: 0.15rem; }
.fields dd { margin: 0; min-width: 0; overflow-x: auto; padding-block: 0.1rem; }
.fields .conds math { font-size: 1.12em; }
.fields .qual-inline { text-transform: none; }

.theorem {
  border: 1px solid var(--rule); border-left: 3px solid var(--green); border-radius: 4px;
  background: var(--card); padding: 0.55rem 0.9rem 0.6rem; margin: 0.5rem 0 0.6rem;
}
.theorem pre.lean { font-size: 0.82rem; line-height: 1.65; }
.badge { font-family: var(--sans); font-size: 0.7rem; margin: 0 0 0.35rem; color: var(--green); }
.badge.elab { color: var(--accent); }
.badge.other { color: var(--muted); }
.tick { font-weight: 700; }
.by { font-family: var(--sans); font-size: 0.7rem; color: var(--faint); margin: 0.35rem 0 0; }
.by code { font-size: 0.95em; }

details.cert, details.comp, details.more { margin: 0.25rem 0; font-size: 0.85rem; }
details.cert > summary, details.comp > summary, details.more > summary {
  cursor: pointer; font-family: var(--sans); font-size: 0.74rem; color: var(--muted); padding: 0.15rem 0;
  list-style: none;
}
details.cert > summary::-webkit-details-marker, details.comp > summary::-webkit-details-marker,
details.more > summary::-webkit-details-marker { display: none; }
details.cert > summary::before, details.comp > summary::before, details.more > summary::before {
  content: "\25B8"; display: inline-block; width: 0.85rem; color: var(--faint); transition: transform 0.12s;
}
details.cert[open] > summary::before, details.comp[open] > summary::before,
details.more[open] > summary::before { transform: rotate(90deg); }
details.cert > summary:hover, details.comp > summary:hover, details.more > summary:hover { color: var(--accent); }
ol.steps { padding-left: 1.4rem; margin: 0.4rem 0 0.6rem; }
ol.steps li { margin: 0 0 0.8rem; }
.step-title { font-family: var(--sans); font-size: 0.76rem; margin: 0 0 0.2rem; }
.step-meta { font-family: var(--sans); font-size: 0.68rem; color: var(--faint); margin: 0.2rem 0 0; }
.step-meta .badge { font-size: 1em; }
.step-meta code { font-size: 0.95em; }
ul.tree { list-style: none; padding-left: 1rem; border-left: 1px solid var(--rule); margin: 0.3rem 0; }
ul.tree li { margin: 0.25rem 0; }
.node-title { font-family: var(--sans); font-size: 0.76rem; margin: 0; }
pre.node-body { font-size: 0.72rem; color: var(--muted); }

.msg { margin: 0.2rem 0 0.4rem; }
.msg pre { font-size: 0.78rem; }
.msg.error, .msg.warning {
  border-left: 3px solid var(--rust); background: var(--rust-soft); border-radius: 3px;
  padding: 0.45rem 0.8rem;
}
.msg.warning { border-left-color: var(--mode); }
.msg .sev {
  font-family: var(--sans); font-size: 0.66rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--rust); margin: 0 0 0.2rem;
}
.msg.ok p, .msg.axioms p { font-family: var(--sans); font-size: 0.78rem; color: var(--green); margin: 0.3rem 0; }
.msg.axioms p { color: var(--muted); }
.msg.axioms code, .msg.ok code { font-size: 0.95em; color: var(--ink); }
.msg.try { border-left: 3px solid var(--accent); padding: 0.3rem 0.8rem; background: var(--accent-soft); border-radius: 3px; }
.try-label { font-family: var(--sans); font-size: 0.68rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); margin: 0 0 0.2rem; }
pre.msg.info { color: var(--ink); }
pre.msg-rest { color: var(--muted); font-size: 0.74rem; }

/* Notes, figures */
aside.note {
  border-left: 3px solid var(--accent); background: var(--accent-soft);
  padding: 0.6rem 1rem; margin: 1rem 0 1.3rem; border-radius: 3px;
}
aside.note p:last-child { margin-bottom: 0; }
figure { margin: 1.8rem 0 2.2rem; }
.figure-body { border: 1px solid var(--rule); border-radius: 6px; background: var(--card); padding: 1rem 1.2rem; }
figcaption { font-size: 0.92rem; color: var(--muted); margin: 0.6rem 0 0; }
.fig-number { font-weight: 600; color: var(--ink); }
.svg svg { display: block; width: 100%; height: auto; }
.figure-body.svg { overflow-x: auto; }
.figure-body.svg svg { min-width: 48rem; }
.svg .f-box { fill: var(--card); stroke: var(--rule); }
.svg .f-kernel, .svg .f-brace-kernel { stroke: var(--green); }
.svg .f-code { fill: var(--code-bg); }
.svg .f-base { fill: var(--panel); }
.svg .f-title, .svg .f-mono { fill: var(--ink); }
.svg .f-text { fill: var(--muted); }
.svg .f-tag { fill: var(--faint); }
.svg .f-tag-kernel { fill: var(--green); }
.svg .f-dot { fill: var(--accent); }
.svg .f-dot-kernel { fill: var(--green); }
.svg .f-num { fill: var(--paper); }
.svg .f-arrow, .svg .f-brace { stroke: var(--faint); }
.svg .f-arrowhead { fill: var(--faint); }
.svg .f-accent { fill: var(--accent); }
.svg .f-accent-stroke { stroke: var(--accent); }

/* Guides, A-Z, documentation center */
.cmd-group h3 { font-size: 1rem; margin: 1.6rem 0 0.4rem; color: var(--muted); font-weight: 600; }
.cmd-list { list-style: none; padding: 0; margin: 0 0 1rem; }
.cmd-list li {
  display: grid; grid-template-columns: minmax(9rem, 13rem) minmax(0, 1fr); gap: 1rem;
  padding: 0.38rem 0; border-bottom: 1px solid var(--rule); margin: 0;
}
.cmd-list li:first-child { border-top: 1px solid var(--rule); }
.cmd-list code { font-size: 0.86rem; }
.cmd-summary { color: var(--ink); }
.guide-grid {
  list-style: none; padding: 0; margin: 1rem 0 2rem;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr)); gap: 0.9rem;
}
.guide-card {
  border: 1px solid var(--rule); border-radius: 6px; padding: 0.8rem 1rem 0.7rem; margin: 0;
  background: var(--card);
}
.guide-card h3 { margin: 0 0 0.3rem; font-size: 1.05rem; }
.guide-card p { font-size: 0.9rem; margin: 0 0 0.45rem; }
.guide-cmds { font-size: 0.8rem !important; line-height: 1.8; }
.guide-cmds a { margin-right: 0.45rem; }
.guide-cmds code { font-size: 0.92em; }
.more { font-family: var(--sans); font-size: 0.72rem; }
.tutorial-list { list-style: none; padding: 0; }
.tutorial-list li { display: grid; grid-template-columns: minmax(10rem, 15rem) 1fr; gap: 1rem; padding: 0.3rem 0; }
.az-letters { font-family: var(--sans); font-size: 0.9rem; letter-spacing: 0.05em; }
.az-letters a { margin-right: 0.55rem; }
.az-group h2 { font-size: 1.2rem; margin: 1.6rem 0 0.5rem; color: var(--muted); }
.see-also h2, .related h2 { font-size: 1.1rem; margin: 2.4rem 0 0.5rem; padding-top: 1rem; border-top: 1px solid var(--rule); }
.sym-row { line-height: 1.9; }
.sym code { font-size: 0.88rem; }
.dot { color: var(--faint); margin: 0 0.25rem; }
.related ul { list-style: none; padding: 0; }

/* Main page */
main.home { max-width: calc(var(--content-width) + 2 * var(--page-gutter)); margin: 0 auto; padding: 0 var(--page-gutter) 4rem; }
main.home > p, main.home > ul, main.home > ol, main.home > h2 {
  max-width: none; margin-inline: 0;
}
main.home > .cells { max-width: none; margin-inline: 0; }
main.home figcaption { max-width: none; margin-inline: 0; }
.hero { text-align: center; padding: 3.6rem 0 1.4rem; }
.hero-title { display: flex; align-items: center; justify-content: center; gap: 1.1rem; flex-wrap: wrap; margin: 0 0 1.3rem; }
.hero h1 { font-size: 3.1rem; font-weight: 600; margin: 0; line-height: 0; letter-spacing: 0.01em; }
.hero-logo img { display: block; margin: 0; width: auto; height: 4.4rem; max-width: 86vw; }
.hero .tagline { font-size: 1.45rem; color: var(--muted); margin: 0; line-height: 1.3; text-align: left; }
.hero .authors { font-size: 1.05rem; margin: 0; }
.hero .affiliation { font-size: 0.95rem; color: var(--muted); margin: 0 0 1.2rem; }
.hero .buttons { display: flex; gap: 0.6rem; justify-content: center; flex-wrap: wrap; }
.teaser .figure-body { padding: 1.2rem 1.4rem 0.8rem; }
main.home h2 { font-size: 1.5rem; margin-top: 3rem; }
.abstract { max-width: none; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.9rem; }
.grid-card {
  border: 1px solid var(--rule); border-radius: 6px; padding: 0.6rem 0.8rem 0.4rem; background: var(--paper);
  min-width: 0;
}
.grid-card h3 { font-size: 0.72rem; font-family: var(--sans); font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--accent); margin: 0 0 0.45rem; }
.grid-card h3 a { color: var(--accent); }
.grid-card h3 code { text-transform: none; letter-spacing: 0; font-size: 1em; }
.grid-card h3 .anchor { display: none; }
.cells.compact { margin: 0; }
.cells.compact .cell { grid-template-columns: minmax(0, 1fr); }
.cells.compact .cell .label { padding: 0.35rem 0 0.2rem; font-size: 0.65rem; }
.cells.compact .cell.in pre.lean { font-size: 0.8rem; padding: 0.5rem 0.7rem; }
.cells.compact .report .tf { font-size: 1.05rem; }
.cells.compact .theorem { padding: 0.35rem 0.55rem 0.4rem; }
.cells.compact .theorem pre.lean { font-size: 0.76rem; }
.cells.compact .badge { font-size: 0.7rem; }

@media (max-width: 900px) {
  .docs { display: block; }
  .sidebar {
    position: static; max-height: none; border-right: 0; border-bottom: 1px solid var(--rule);
    padding: 1rem 0;
  }
  .top-nav a { margin-left: 0.8rem; }
  .grid { grid-template-columns: minmax(0, 1fr); }
  .cell { grid-template-columns: minmax(0, 1fr); }
  .cell .label { text-align: left; padding: 0 0 0.15rem; }
  .cmd-list li { grid-template-columns: minmax(0, 1fr); gap: 0.1rem; }
  .hero-logo img { height: 3.4rem; }
  .hero .tagline { font-size: 1.2rem; text-align: center; }
}

@media (max-width: 560px) {
  .topbar-inner { grid-template-columns: minmax(0, 1fr); height: auto; gap: 0.25rem; padding: 0.5rem 1rem; }
  .top-nav { display: flex; flex-wrap: wrap; gap: 0.25rem 0.75rem; text-align: left; white-space: normal; }
  .top-nav a { margin-left: 0; }
  .cells.compact .cell, .fields, .tutorial-list li { grid-template-columns: minmax(0, 1fr); }
  .fields dt { margin-top: 0.4rem; }
  .fields dd { min-width: 0; margin-bottom: 0.3rem; }
  .guide-grid { grid-template-columns: minmax(0, 1fr); }
  /* A default such as 100000 stays on one line in the narrow column. */
  table.opts th:nth-child(2):not(:last-child) { width: 24%; }
  table.opts td { padding-right: 0.6rem; }
  table.opts td:nth-child(2):not(:last-child) code { overflow-wrap: normal; white-space: nowrap; }
}
