/* openclare website: "Plan d'atelier". The sharpness of a technical drawing
   for the brand, the numbers and the interface (JetBrains Mono), the calm of
   an article for the text (Source Serif 4). Square corners everywhere: the
   brand is made of quads.

   Colours mean something, as in the figures of the papers: teal is what
   closes, what is regular, the primary action; vermillion is what breaks the
   regularity (a spiral, a pole). Never a mere decoration. Light and dark
   follow the system setting; every text colour on its background passes
   4.5:1. */

:root {
  --bg: #E8F1F2;            /* mist */
  --surface: #FFFFFF;       /* paper */
  --ink: #101828;
  --slate: #4A5565;         /* secondary text */
  --rule: #CBD9DE;
  --rule-soft: #E3ECEE;     /* lines between the rows of a table */
  --teal: #0A8F8A;          /* graphics: closed, regular */
  --teal-text: #0B6E6A;     /* text, links */
  --hot: #D4572A;           /* graphics: spiral, pole */
  --hot-text: #B2441C;      /* text */
  --button-bg: #0B6E6A;
  --button-ink: #FFFFFF;
  --tint: #EEF6F5;          /* openclare's row, an entry reached by a link */
  --grid: rgba(16, 24, 40, 0.07);
  --figure-bg: #FFFFFF;
  --other: #8796A8;         /* AutoRemesher in the charts */
  --code-bg: rgba(203, 217, 222, 0.45);

  /* The night bands and the footer, in both themes. */
  --night: #0B1220;
  --night-surface: #121B2D;
  --frost: #EAF2F5;
  --fog: #9AA8B8;
  --night-rule: #22304A;
  --night-teal: #2DD4C4;
  --night-hot: #FF7A45;

  --logo-ink: var(--ink);
  --logo-accent: var(--teal);
  --logo-hot: var(--hot);

  --mono: "JetBrains Mono", ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, "Liberation Mono", monospace;
  --serif: "Source Serif 4", "Source Serif Pro", Charter, "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;

  --measure: 46rem;
  --wide: 75rem;
  --gutter: clamp(16px, 4vw, 40px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0B1220;
    --surface: #121B2D;
    --ink: #EAF2F5;
    --slate: #9AA8B8;
    --rule: #22304A;
    --rule-soft: #1A2539;
    --teal: #2DD4C4;
    --teal-text: #2DD4C4;
    --hot: #FF7A45;
    --hot-text: #FF7A45;
    --button-bg: #2DD4C4;
    --button-ink: #0B1220;
    --tint: #10283A;
    --grid: rgba(234, 242, 245, 0.05);
    --figure-bg: #F4F6F7;
    --code-bg: rgba(34, 48, 74, 0.8);
    --night: #060B15;
    --night-surface: #0F1828;
  }
}

/* A night band: the same components, on the night palette. */
.night,
.site-footer {
  --bg: var(--night);
  --surface: var(--night-surface);
  --ink: var(--frost);
  --slate: var(--fog);
  --rule: var(--night-rule);
  --rule-soft: var(--night-rule);
  --teal: var(--night-teal);
  --teal-text: var(--night-teal);
  --hot: var(--night-hot);
  --hot-text: var(--night-hot);
  --button-bg: var(--night-teal);
  --button-ink: var(--night);
  --code-bg: var(--night-surface);
  --logo-ink: var(--frost);
  --logo-accent: var(--night-teal);
  --logo-hot: var(--night-hot);
  background: var(--night);
  color: var(--frost);
}

*,
*::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: clamp(1.0625rem, 0.95rem + 0.4vw, 1.1875rem)/1.65 var(--serif);
  font-kerning: normal;
}

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

a { color: var(--teal-text); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--ink); text-decoration-thickness: 2px; }

:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

.symbols { position: absolute; width: 0; height: 0; overflow: hidden; }

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

.skip { position: absolute; left: -999px; top: 0; }
.skip:focus {
  left: 1rem; top: 1rem; z-index: 10;
  padding: 0.6rem 1rem;
  background: var(--surface);
  border: 1.5px solid var(--ink);
  font-family: var(--mono);
}

.bar,
.wrap {
  max-width: var(--wide);
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

/* ------------------------------------------------------------ header */

.site-header {
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
  font-family: var(--mono);
}
@media (min-width: 900px) {
  .site-header { position: sticky; top: 0; z-index: 5; }
}

.site-header .bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 28px;
  padding-top: 12px;
  padding-bottom: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  margin: 0;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.06em;
  text-decoration: none;
}
.brand:hover { color: var(--ink); }
.logo { flex: none; display: block; }
.wordmark .cursor { color: var(--hot); font-weight: 500; }
a.brand:hover .cursor { animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { a.brand:hover .cursor { animation: none; } }

.site-nav { margin-left: auto; }
.site-nav ul { display: flex; flex-wrap: wrap; gap: 0 22px; margin: 0; padding: 0; list-style: none; }
.site-nav a {
  display: flex;
  align-items: center;
  min-height: 44px;
  border-top: 2px solid transparent;
  border-bottom: 2px solid transparent;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}
.site-nav a:hover { border-bottom-color: var(--rule); }
.site-nav a[aria-current="page"] { color: var(--teal-text); border-bottom-color: var(--teal); }
/* "Get it": a button beside the menu, not one more tab. */
.site-nav .nav-get { margin-left: 8px; }
.site-nav .nav-get a.button { min-height: 40px; padding: 0 16px; border-width: 1.5px; font-size: 14px; }
.site-nav .nav-get a.button[aria-current="page"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }

.language {
  display: flex;
  border: 1.5px solid var(--ink);
  font-size: 13px;
  font-weight: 700;
}
.language > * {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 41px;
  padding: 0 11px;
  color: var(--ink);
  text-decoration: none;
}
.language .current { background: var(--ink); color: var(--bg); }
.language a:hover { background: var(--tint); color: var(--ink); }

@media (max-width: 760px) {
  .site-header .bar { gap: 4px 16px; }
  .language { margin-left: auto; }
  .site-nav { order: 3; flex-basis: 100%; margin-left: 0; }
  .site-nav ul { gap: 0 18px; align-items: center; }
  .site-nav .nav-get { margin-left: auto; }
}

/* ------------------------------------------------------------ page intro */

/* The 24 px grid, like squared paper, behind the top of every page. */
.intro {
  border-bottom: 1px solid var(--rule);
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px;
  background-position: -1px -1px;
}
.intro .wrap {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding-top: clamp(40px, 7vw, 72px);
  padding-bottom: clamp(32px, 5vw, 48px);
}

.kicker,
.intro .breadcrumb {
  margin: 0;
  color: var(--slate);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.intro .breadcrumb { letter-spacing: 0.02em; text-transform: none; }

.intro h1 {
  margin: 0;
  max-width: 24em;
  font-family: var(--mono);
  font-size: clamp(32px, 5vw, 56px);
  font-weight: 700;
  letter-spacing: -0.05em;
  line-height: 1.04;
  text-wrap: balance;
  overflow-wrap: anywhere;
}
.intro .subtitle {
  margin: 0;
  max-width: var(--measure);
  color: var(--slate);
  font-size: clamp(1.0625rem, 0.95rem + 0.5vw, 1.25rem);
  line-height: 1.6;
  text-wrap: pretty;
}
.intro .switch,
.intro .chips { margin-top: 6px; }

/* The home page: two columns, the words and a pair of pictures. */
.hero {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(440px, 100%), 1fr));
  gap: 40px 56px;
  align-items: center;
}
.intro .wrap:has(> .hero) { padding-top: clamp(48px, 8vw, 104px); padding-bottom: clamp(48px, 8vw, 104px); }
.hero-text { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.hero-text > p { margin: 0; }
.hero h1 { font-size: clamp(34px, 5.4vw, 64px); letter-spacing: -0.055em; line-height: 1.02; }
.lede { color: var(--slate); font-size: clamp(1.15rem, 1rem + 0.6vw, 1.3125rem); line-height: 1.6; max-width: 34rem; text-wrap: pretty; }
.hero-text .more { color: var(--slate); font-size: 1rem; line-height: 1.6; max-width: 34rem; }

.pair { margin: 0; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.pair-images {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  background: var(--figure-bg);
  border: 1px solid var(--rule);
}
.pair-images img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; }
.pair-images img + img { border-left: 1px solid var(--rule); }
.pair figcaption {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin: 0;
  color: var(--slate);
  font-family: var(--mono);
  font-size: 13px;
}
.pair figcaption .to { color: var(--teal-text); font-weight: 700; }

/* ------------------------------------------------------------ layout */

.layout {
  max-width: var(--wide);
  margin: 0 auto;
  padding: clamp(40px, 6vw, 64px) var(--gutter) clamp(64px, 8vw, 96px);
}
.layout.full { max-width: none; padding: 0; }
.prose { min-width: 0; }

@media (min-width: 1000px) {
  .layout.with-toc { display: grid; gap: 72px; grid-template-columns: 15rem minmax(0, 1fr); align-items: start; }
  .layout.with-toc .toc-side { position: sticky; top: 92px; max-height: calc(100vh - 110px); overflow: auto; }
}

.toc { font-family: var(--mono); font-size: 14px; line-height: 1.4; }
.toc p,
.toc summary {
  margin: 0 0 12px;
  color: var(--slate);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--rule); }
.toc a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 14px;
  margin-left: -1px;
  border-left: 2px solid transparent;
  color: var(--ink);
  text-decoration: none;
}
.toc a:hover { color: var(--teal-text); border-left-color: var(--teal); }
.toc a { align-items: baseline; }
.toc .num { flex: none; min-width: 2em; margin: 0; font-size: 12px; vertical-align: baseline; }

.toc-side { display: none; }
.toc-inline {
  margin: 0 0 2.5rem;
  padding: 0 16px;
  background: var(--surface);
  border: 1px solid var(--rule);
}
.toc-inline summary { display: flex; align-items: center; min-height: 48px; margin: 0; cursor: pointer; }
.toc-inline[open] summary { margin-bottom: 4px; }
.toc-inline ol { margin-bottom: 14px; }
@media (min-width: 1000px) {
  .toc-side { display: block; }
  .toc-inline { display: none; }
}

/* ------------------------------------------------------------ text */

.prose :is(p, ul, ol, dl, blockquote, h2, h3, h4) { max-width: var(--measure); }
.prose p, .prose ul, .prose ol, .prose blockquote, .prose pre, .prose dl { margin: 0 0 1.15rem; }
.prose ul, .prose ol { padding-left: 1.4rem; }
.prose li + li { margin-top: 0.4rem; }
.prose li > ul, .prose li > ol { margin: 0.4rem 0 0; }
.prose strong { font-weight: 600; }
.prose p, .prose li { text-wrap: pretty; }

.prose h2, .prose h3, .prose h4 {
  font-family: var(--mono);
  line-height: 1.15;
  text-wrap: balance;
  scroll-margin-top: 96px;
}
.prose h2 { margin: 3.5rem 0 1.1rem; font-size: clamp(24px, 2.2vw + 14px, 30px); font-weight: 700; letter-spacing: -0.035em; }
.prose h3 { margin: 2.4rem 0 0.8rem; font-size: 20px; font-weight: 500; letter-spacing: -0.02em; line-height: 1.3; }
.prose h4 { margin: 1.8rem 0 0.5rem; font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.prose > :first-child { margin-top: 0; }

/* A section number: "01", in vermillion, before its title. */
.num {
  margin-right: 0.55em;
  color: var(--hot-text);
  font-family: var(--mono);
  font-size: 0.55em;
  font-weight: 700;
  letter-spacing: 0;
  vertical-align: 0.2em;
}

/* A term of the glossary, linked the first time a page uses it: a dotted
   teal line says there is more, the title holds its definition. */
.prose a.term {
  color: var(--teal-text);
  text-decoration: underline dotted;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 4px;
}
.prose a.term:hover { color: var(--ink); text-decoration-style: solid; }

.prose hr { border: 0; border-top: 1px solid var(--rule); margin: 3rem 0; }

.prose blockquote {
  margin-left: 0;
  padding: 0.2rem 0 0.2rem 1.25rem;
  border-left: 2px solid var(--teal);
  color: var(--slate);
}
.prose blockquote p:last-child { margin-bottom: 0; }

.subtitle { color: var(--slate); }
.note { color: var(--slate); font-size: 0.9rem; }
.prose p.note { max-width: var(--measure); }

code, pre, kbd { font-family: var(--mono); font-size: 0.84em; }
/* JetBrains Mono joins "->" or "-<" into arrows: code must read as typed. */
code, pre, kbd, table { font-variant-ligatures: none; }
:not(pre) > code { padding: 0.08em 0.35em; background: var(--code-bg); overflow-wrap: anywhere; }

/* Code blocks: a night band. */
pre {
  max-width: 100%;
  padding: 20px 24px;
  background: var(--night);
  color: var(--frost);
  border: 1px solid var(--night-rule);
  font-size: 14px;
  line-height: 1.75;
  overflow-x: auto;
}
pre code { font-size: inherit; }
pre .prompt { color: var(--night-teal); user-select: none; -webkit-user-select: none; }
pre .comment { color: var(--fog); }
.night pre { background: var(--night-surface); }

/* ------------------------------------------------------------ buttons */

.actions { display: flex; flex-wrap: wrap; gap: 12px; }
.button {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0 22px;
  border: 1.5px solid var(--ink);
  background: transparent;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
}
.button:hover { background: var(--ink); color: var(--bg); }
.button.primary { background: var(--button-bg); border-color: var(--button-bg); color: var(--button-ink); font-weight: 700; }
.button.primary:hover { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.button.plain { border-color: transparent; padding: 0 6px; color: var(--teal-text); text-decoration: underline; text-underline-offset: 0.2em; }
.button.plain:hover { background: transparent; color: var(--ink); }

/* ------------------------------------------------------------ articles */

/* The banner of an article (scripts/article_banners.py), drawn in the theme's colours. */
svg.banner { display: block; width: 100%; height: auto; aspect-ratio: 10 / 3; background: var(--surface); }
/* On an article's own page, a band across the page between the menu and the
   title: the drawing centred, on the squared paper of the page's top. */
.banner-band {
  border-bottom: 1px solid var(--rule);
  background-color: var(--surface);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px;
  background-position: -1px -1px;
}
.banner-band svg.banner { max-width: 60rem; margin: 0 auto; background: none; }
.banner-band svg.banner > g:first-child { display: none; }
.article-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr));
  gap: 16px;
  margin: 1rem 0 2.5rem;
}
/* Three tiles side by side on a desktop, whatever the width of the text. */
@media (min-width: 900px) { .article-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 64rem; } }
.article-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--rule);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
}
.article-card:hover { border-color: var(--teal); }
.article-card svg.banner { border-bottom: 1px solid var(--rule); }
.article-text { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px 16px; }
.article-text .kicker { margin: 0; font-size: 11px; }
.article-text strong { font-family: var(--mono); font-size: 15px; line-height: 1.3; }
.article-text span:last-child { color: var(--slate); font-size: 14px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* ------------------------------------------------------------ 3D viewer */

/* Light in both themes, like the pictures of the models. */
.viewer {
  --viewer-bg: var(--figure-bg);
  --viewer-mesh: #BBCBDC;   /* the colours of the pictures (scripts/render.py) */
  --viewer-edge: #28303F;
  --viewer-closed: #0A8F8A; /* teal and vermillion of the light theme, on its light ground */
  --viewer-hot: #D4572A;
  margin: 1.25rem 0 2rem;
}
.viewer-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 12px; }
.viewer-bar label { font-family: var(--mono); font-size: 15px; }
.viewer-bar select { min-height: 48px; padding: 0 10px; font: inherit; color: var(--ink); background: var(--surface); border: 1.5px solid var(--ink); }
.viewer-stage { position: relative; width: 100%; aspect-ratio: 4 / 3; max-height: 75vh; border: 1px solid var(--rule); background: var(--viewer-bg); touch-action: none; }
.viewer-stage canvas { display: block; width: 100%; height: 100%; }
.viewer-layers { display: flex; flex-wrap: wrap; gap: 4px 20px; margin-top: 8px; font-family: var(--mono); font-size: 14px; }
.viewer-layers label { display: inline-flex; align-items: center; gap: 8px; min-height: 32px; cursor: pointer; }
.viewer-layers label[hidden] { display: none; }
.viewer-layers input { width: 18px; height: 18px; margin: 0; accent-color: var(--ink); }
/* Each box is the legend of its layer: a stroke for a loop, the marks of the poles. */
.viewer-layers [data-layer="closed"] span::before,
.viewer-layers [data-layer="spiral"] span::before { content: ""; display: inline-block; width: 18px; height: 3px; margin: 0 8px 3px 0; vertical-align: middle; background: var(--viewer-closed); }
.viewer-layers [data-layer="spiral"] span::before { background: var(--viewer-hot); }
.viewer-pole { margin-left: 12px; white-space: nowrap; }
.viewer-pole::before { content: ""; display: inline-block; box-sizing: border-box; width: 10px; height: 10px; margin-right: 5px; vertical-align: -1px; background: var(--viewer-hot); }
.viewer-pole.disc::before { border-radius: 50%; }
.viewer-pole.ring::before { border-radius: 50%; background: none; border: 2.5px solid var(--viewer-hot); }
.viewer-info { margin: 8px 0 0; font-family: var(--mono); font-size: 14px; }
.viewer-help, .viewer-status { margin: 4px 0 0; color: var(--slate); font-size: 15px; }

/* ------------------------------------------------------------ figures */

figure { margin: 2rem 0; }
.prose > figure:not(.wide) { max-width: 52rem; }
figure > img,
figure > a.picture > img {
  display: block;
  width: auto;
  margin: 0;
  padding: 12px;
  background: var(--figure-bg);
  border: 1px solid var(--rule);
}
/* Pictures drawn for each theme carry their own background. */
figure picture img { display: block; border: 1px solid var(--rule); }
figcaption {
  margin-top: 10px;
  max-width: 52rem;
  color: var(--slate);
  font-size: 0.95rem;
  line-height: 1.55;
}
.prose p > img { border: 1px solid var(--rule); }
a.picture { display: block; }
.withheld {
  display: inline-block;
  padding: 0.5rem 0.75rem;
  border: 1.5px dashed var(--rule);
  color: var(--slate);
  font-family: var(--mono);
  font-size: 13px;
}

/* ------------------------------------------------------------ tables */

.table-wrap {
  margin: 1.25rem 0 2rem;
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--rule);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
}
table:has(th:nth-child(5)) { min-width: 40rem; }
th, td { padding: 11px 10px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--rule-soft); }
th:first-child, td:first-child { padding-left: 16px; }
th:last-child, td:last-child { padding-right: 16px; }
thead th {
  border-bottom-color: var(--rule);
  color: var(--slate);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}
tbody tr:last-child td { border-bottom: 0; }
td img { display: block; width: 100%; background: var(--figure-bg); }

table.marks td, table.marks th { text-align: right; white-space: nowrap; vertical-align: middle; }
table.marks td:first-child, table.marks th:first-child { text-align: left; }
table.marks th.overall-head, table.marks td.overall { text-align: left; }
table.marks tr.ours td { background: var(--tint); }
table.marks tr.ours td:first-child { color: var(--teal-text); font-weight: 700; }
table.marks tr.variant td { color: var(--slate); }
table.marks tr.divider td {
  padding-top: 18px;
  color: var(--slate);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: transparent;
}
table.marks td.best { font-weight: 700; background: var(--tint); }
table.marks td.none { color: var(--slate); }
table.marks.models td:nth-child(2), table.marks.models th:nth-child(2) { text-align: left; color: var(--slate); }
table.marks.models td:nth-child(3), table.marks.models th:nth-child(3) { width: 30%; text-align: left; }

/* A mark and its bar. */
.score { display: flex; align-items: center; gap: 10px; min-width: 9rem; }
.score b { flex: none; width: 2.2em; text-align: right; font-weight: 700; }
.track { flex: 1; display: flex; height: 6px; background: var(--rule-soft); }
.fill { display: block; background: var(--teal); }
.fill.low { background: var(--hot); }
tr.variant .fill, tr:not(.ours) td.overall .fill.plain { background: var(--slate); }

.legend { color: var(--slate); font-size: 0.95rem; }
.legend dt { color: var(--ink); font-family: var(--mono); font-size: 14px; font-weight: 700; }
.legend dd { margin: 0 0 0.75rem; }

details { margin: 1.25rem 0; }
details > summary { cursor: pointer; }
details.more > summary,
.toc-inline > summary { list-style: none; gap: 10px; }
details.more > summary::-webkit-details-marker,
.toc-inline > summary::-webkit-details-marker { display: none; }
details.more > summary::before,
.toc-inline > summary::before { content: "+"; width: 1ch; color: var(--teal-text); font-family: var(--mono); font-weight: 700; }
details.more[open] > summary::before,
.toc-inline[open] > summary::before { content: "−"; }
details.more {
  background: var(--surface);
  border: 1px solid var(--rule);
}
details.more > summary {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 0 16px;
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
}
details.more[open] > summary { border-bottom: 1px solid var(--rule); }
details.more > .inner { padding: 0 16px 8px; }
details.more .table-wrap { margin: 0.75rem 0 1.25rem; }

/* ------------------------------------------------------------ budget switch */

/* Three cells, 1,000 / 3,000 / 8,000 quads asked for, that show the panels
   of that budget. Plain radio buttons and CSS: where the browser cannot
   select on :has(), the switch is hidden and every panel is shown. */
.switch { display: none; margin: 0; padding: 0; border: 0; min-width: 0; }
.switch legend {
  margin-bottom: 8px;
  padding: 0;
  color: var(--slate);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.switch-cells { display: inline-flex; border: 1.5px solid var(--ink); }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.switch label {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}
.switch label:hover { background: var(--tint); }
.switch input:checked + label { background: var(--ink); color: var(--bg); }
.switch input:focus-visible + label { outline: 2px solid var(--teal); outline-offset: 2px; position: relative; z-index: 1; }

@supports selector(:has(a)) {
  .switch { display: block; }
  .budget-panel { display: none; }
  body:has(#budget-1000:checked) .budget-panel[data-budget="1000"],
  body:has(#budget-3000:checked) .budget-panel[data-budget="3000"],
  body:has(#budget-8000:checked) .budget-panel[data-budget="8000"] { display: block; }
}
.budget-panel > h3:first-child { margin-top: 1.5rem; }

/* ------------------------------------------------------------ results */

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin: 0 0 1rem;
  color: var(--slate);
  font-family: var(--mono);
  font-size: 13px;
}
.chart-legend span { display: inline-flex; align-items: center; gap: 8px; }
.swatch { display: inline-block; width: 14px; height: 14px; }

.groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
  gap: 16px;
  margin: 1rem 0 1.5rem;
}
.group {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--rule);
  font-family: var(--mono);
}
.group-name { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 0; }
.group-name b { font-size: 16px; }
.group-name span { color: var(--slate); font-size: 12px; white-space: nowrap; }
.bar-row {
  display: grid;
  grid-template-columns: 6.25rem minmax(0, 1fr) 2rem;
  gap: 8px;
  align-items: center;
  font-size: 13px;
}
.bar-row .track { height: 10px; }
.bar-row b { text-align: right; }
.bar-row.ours .tool { color: var(--teal-text); font-weight: 700; }
.tool-openclare { background: var(--teal); }
.tool-quadriflow { background: var(--ink); }
.tool-autoremesher { background: var(--other); }

/* ------------------------------------------------------------ model pages */

.shots {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
  gap: 16px;
  margin: 1.25rem 0 2rem;
}
.shot { margin: 0; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--rule); }
.shot.ours { border: 2px solid var(--teal); }
.shot img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--figure-bg); }
.shot figcaption {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin: 0;
  padding: 14px 16px;
  border-top: 1px solid var(--rule);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 13px;
}
.shot figcaption span { color: var(--slate); }
.shot.ours figcaption b { color: var(--teal-text); }

.loop-bars { display: flex; flex-direction: column; gap: 20px; margin: 1.5rem 0; max-width: 52rem; font-family: var(--mono); font-size: 13px; }
.loop-bar p { display: flex; justify-content: space-between; gap: 12px; margin: 0 0 8px; }
.loop-bar p span { color: var(--slate); }
.loop-bar.ours p b { color: var(--teal-text); }
.stack { display: flex; gap: 2px; height: 28px; }
.stack span { flex-basis: 0; min-width: 2px; }
.part-closed { background: var(--teal); }
.part-spiral { background: var(--hot); }
.part-stops { background: var(--rule); }
.part-border { background: var(--slate); }
.loop-legend { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 0; color: var(--slate); }
.loop-legend span { display: inline-flex; align-items: center; gap: 8px; }
.loop-legend i { display: inline-block; width: 12px; height: 12px; }

.credit {
  padding: 14px 18px;
  background: var(--surface);
  border-left: 2px solid var(--rule);
  font-size: 0.95rem;
  line-height: 1.55;
}

/* ------------------------------------------------------------ home */

.band { border-bottom: 1px solid var(--rule); }
.band:last-child { border-bottom: 0; }
.band > .wrap { padding-top: clamp(56px, 8vw, 96px); padding-bottom: clamp(56px, 8vw, 96px); }
.band-head {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
  gap: 24px 64px;
  align-items: start;
  margin-bottom: 40px;
}
.band-head h2 { margin: 0; font-size: clamp(26px, 2.5vw + 14px, 34px); letter-spacing: -0.04em; line-height: 1.1; }
.band-head h2 .num { display: block; margin: 0 0 14px; font-size: 13px; vertical-align: baseline; }
.band-head > p { margin: 0; }
.band > .wrap > p { max-width: 52rem; }
.band figure { margin: 0 0 40px; }
.band figure:has(> img):not(.strip) {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr));
  gap: 16px 40px;
  align-items: center;
}
.band figure > img { width: 100%; }
.band figure:has(> img):not(.strip) figcaption { margin: 0; font-size: 1.05rem; }
.band figure:last-child { margin-bottom: 0; }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr));
  margin: 0 0 2rem;
  padding: 1px 0 0 1px;
}
/* Borders that collapse: each tile overlaps its neighbours by one pixel. */
.stat {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: -1px 0 0 -1px;
  padding: 28px;
  background: var(--bg);
  border: 1px solid var(--rule);
}
.stat .value { color: var(--teal-text); font-family: var(--mono); font-size: clamp(36px, 3vw + 18px, 46px); font-weight: 700; letter-spacing: -0.05em; line-height: 1.05; }
.stat .value small { color: var(--slate); font-size: 20px; font-weight: 500; letter-spacing: -0.02em; }
.stat .label { color: var(--slate); font-size: 1rem; line-height: 1.5; }
.night .band-head h2 .num { color: var(--night-hot); }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(210px, 100%), 1fr));
  gap: 16px;
  margin: 1rem 0;
}
.card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 150px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--rule);
  color: var(--ink);
  text-decoration: none;
}
.card:hover { color: var(--ink); border-color: var(--ink); }
.card strong { font-family: var(--mono); font-size: 17px; font-weight: 700; }
.card strong::after { content: "\00a0→"; color: var(--teal-text); }
.card span { color: var(--slate); font-size: 1rem; line-height: 1.5; }
/* Cards that are not links (what the add-on does for you): no arrow, no hover, three by three. */
div.card strong::after { content: none; }
div.card:hover { border-color: var(--rule); }
.cards.uses { grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); }
/* The picture of a use card (scripts/use_art.py), across the top of the card. */
.cards.uses .card { padding-top: 0; overflow: hidden; }
.cards.uses svg.use-art { display: block; width: calc(100% + 48px); max-width: none; height: auto; aspect-ratio: 2 / 1; margin: 0 -24px 12px; background: var(--surface); border-bottom: 1px solid var(--rule); }

/* ------------------------------------------------------------ theory */

/* Proved, measured, conjectured, refuted: what kind of statement it is. */
.badge {
  display: inline-block;
  padding: 1px 7px;
  font-family: var(--mono);
  font-size: 0.68em;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.6;
  text-transform: uppercase;
  white-space: nowrap;
  vertical-align: 0.12em;
}
.badge-proved { background: var(--teal-text); color: var(--button-ink); }
.badge-measured { background: var(--ink); color: var(--bg); }
.badge-conjectured,
.badge-refuted { padding: 0 6px; border: 1.5px solid var(--hot-text); color: var(--hot-text); }
/* The state of a feature, on the documentation pages. */
.badge-stable { background: var(--teal-text); color: var(--button-ink); }
.badge-experimental { padding: 0 6px; border: 1.5px solid var(--hot-text); color: var(--hot-text); }

/* The steps of the engine, numbered. */
.prose p.step {
  display: grid;
  grid-template-columns: 2.25rem minmax(0, 1fr);
  gap: 12px;
  margin: 0;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--rule);
  font-size: 0.95em;
  line-height: 1.55;
}
.prose p.step + p.step { border-top: 0; }
.prose :not(.step) + p.step { margin-top: 1.5rem; }
.prose p.step + :not(.step) { margin-top: 1.5rem; }
.step-number { color: var(--teal-text); font-family: var(--mono); font-weight: 700; }

/* Numbered lists of steps (get it). */
.page-get .prose > ol {
  counter-reset: step;
  list-style: none;
  margin: 1.5rem 0 2rem;
  padding: 0;
  max-width: 52rem;
  background: var(--rule);
  border: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.page-get .prose > ol > li {
  counter-increment: step;
  position: relative;
  margin: 0;
  padding: 20px 24px 20px 64px;
  background: var(--surface);
  line-height: 1.55;
}
.page-get .prose > ol > li::before {
  content: counter(step);
  position: absolute;
  left: 24px;
  top: 16px;
  color: var(--teal-text);
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 700;
}

/* ------------------------------------------------------------ glossary */

.chips { display: flex; flex-wrap: wrap; gap: 8px; font-family: var(--mono); font-size: 13px; }
.chips a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  background: var(--surface);
  border: 1px solid var(--rule);
  color: var(--ink);
  text-decoration: none;
}
.chips a:hover { border-color: var(--ink); }
.chips .num { font-size: 13px; vertical-align: baseline; margin-right: 0.4em; }

.prose p.entry {
  margin-top: 1.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  scroll-margin-top: 96px;
}
.prose h2 + p.entry { border-top: 0; padding-top: 0; }
.prose p.entry > strong:first-child { font-family: var(--mono); font-size: 0.95em; font-weight: 700; letter-spacing: -0.02em; }
.prose p.entry:target { background: var(--tint); box-shadow: 0 0 0 12px var(--tint); }

/* ------------------------------------------------------------ research */

/* The method: a card per step, the practice of software engineering it comes from at the bottom. */
.method-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
  gap: 16px;
  margin: 1.5rem 0 2.5rem;
}
.rule {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 18px 18px;
  border: 1px solid var(--rule);
  border-top: 4px solid var(--teal);
  background: var(--surface);
}
.prose .rule > * { max-width: none; margin: 0; }
.rule .rule-step { font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--teal-text); }
.prose .rule h3 { font-size: 17px; }
.rule p { font-size: 15px; line-height: 1.5; }
.rule p b { margin-right: 4px; font-family: var(--mono); font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--slate); }
.prose .rule .origin { margin-top: auto; padding-top: 8px; border-top: 1px dashed var(--rule); color: var(--slate); font-size: 14px; }

/* A paper: its title, its progress, then its summary beside its figure. */
.paper { margin: 0 0 32px; background: var(--surface); border: 1px solid var(--rule); }
.paper-head { display: flex; flex-direction: column; gap: 12px; padding: clamp(24px, 4vw, 44px) clamp(24px, 4vw, 44px) 8px; }
.prose .paper-head > * { max-width: none; margin: 0; }
.prose .paper h3 { margin: 0; font-size: clamp(22px, 1.5vw + 14px, 28px); letter-spacing: -0.035em; }
.paper-body { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(440px, 100%), 1fr)); border-top: 1px solid var(--rule); }
.paper-text { display: flex; flex-direction: column; gap: 18px; padding: clamp(24px, 4vw, 44px); min-width: 0; }
.paper-text > * { margin: 0 !important; }
.paper figure {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  margin: 0;
  padding: 16px;
  background: var(--bg);
  border-left: 1px solid var(--rule);
}
.paper figure img { display: block; width: 100%; background: var(--figure-bg); }
@media (max-width: 959px) {
  .paper figure { border-left: 0; border-top: 1px solid var(--rule); }
}
.paper figcaption { margin: 0; font-family: var(--mono); font-size: 12px; }

/* The progress of a paper (evidence.py): the share of its tasks done, and each step. */
.progress { padding: 16px clamp(24px, 4vw, 44px) 24px; }
.progress header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-bottom: 12px; }
.prose .progress h4 { margin: 0; font-family: var(--mono); font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--slate); }
.prose .progress .grade { display: flex; flex-direction: column; align-items: flex-end; margin: 0; font-family: var(--mono); font-size: 13px; color: var(--slate); }
.progress .pct { font-size: clamp(40px, 4vw + 16px, 56px); font-weight: 700; line-height: 1; letter-spacing: -0.03em; color: var(--ink); }
.prose ol.pipeline { display: flex; flex-wrap: wrap; max-width: none; margin: 0; padding: 0; list-style: none; }
.pipeline li {
  display: flex;
  flex: 1 1 120px;
  flex-direction: column;
  gap: 6px;
  min-width: 110px;
  margin: 0 -1px -1px 0;
  padding: 10px 12px;
  border: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 13px;
}
.pipeline .n { font-size: 20px; font-weight: 700; }
.pipeline .meter { height: 6px; background: linear-gradient(to right, var(--teal) var(--p), var(--rule) 0); }
.pipeline li.full .meter { background: var(--ink); }
.pipeline li.end { flex: 0 0 auto; justify-content: center; align-items: center; min-width: 100px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.pipeline li.draft { background: var(--hot); border-color: var(--hot); color: #fff; }
.pipeline li.preprint { border-style: dashed; color: var(--slate); }
.pipeline li.preprint.ready { background: var(--teal); border-style: solid; color: var(--ink); }
.prose .progress .stamp { max-width: none; margin: 10px 0 0; font-family: var(--mono); font-size: 12px; color: var(--slate); }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  padding: 4px 9px;
  border: 1.5px solid currentColor;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.tag-ink { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.tag-teal { color: var(--teal-text); }
.tag-hot { color: var(--hot-text); }
.paper .note { font-size: 0.9rem; }

/* A section on a night band inside a page (the proofs). */
.night-block {
  margin: 2.5rem 0;
  padding: clamp(24px, 4vw, 44px);
  border: 1px solid var(--night-rule);
}
.night-block > h2:first-child { margin-top: 0; }
.night-block .lead-number { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px 16px; margin: 0 0 1.25rem; font-family: var(--mono); }
.night-block .lead-number b { color: var(--teal); font-size: clamp(48px, 4vw + 24px, 64px); font-weight: 700; letter-spacing: -0.05em; line-height: 1; }
.night-block .lead-number span { color: var(--slate); font-size: 15px; }

/* ------------------------------------------------------------ footer */

.site-footer { font-family: var(--mono); font-size: 13px; color: var(--fog); }
.site-footer .bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 32px;
  padding-top: 32px;
  padding-bottom: 32px;
}
.site-footer .brand { font-size: 16px; letter-spacing: -0.05em; color: var(--frost); }
.footer-text { flex: 1 1 28rem; min-width: 0; }
.footer-text p { margin: 0 0 4px; line-height: 1.6; }
.footer-text strong { color: var(--frost); }
.site-footer a { color: var(--night-teal); }
.site-footer a:hover { color: var(--frost); }
.site-footer .bar + .bar { padding-top: 0; }
.site-footer .studio { display: block; flex: none; line-height: 0; }
.site-footer .studio img { width: 72px; height: auto; }
.sitemap { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px 32px; width: 100%; border-top: 1px solid var(--night-rule); padding-top: 24px; }
.sitemap p { margin: 0 0 6px; color: var(--frost); text-transform: uppercase; letter-spacing: 0.08em; font-size: 12px; }
.sitemap ul { list-style: none; margin: 0; padding: 0; }
.sitemap a { display: flex; align-items: center; min-height: 32px; text-decoration: none; }
@media (max-width: 720px) { .sitemap { grid-template-columns: repeat(2, minmax(0, 1fr)); } .sitemap a { min-height: 44px; } }

@media print {
  .site-header, .site-footer, .toc, .switch { display: none; }
  body { background: #fff; color: #000; }
  .budget-panel { display: block !important; }
}

/* ------------------------------------------------------------ retopology */

/* The tag switches of the retopology page reuse the budget switch; the
   rules that hide the rows are written into the page by site/build.py. */
.tag-filters { display: none; }
@supports selector(:has(a)) {
  .tag-filters { display: flex; flex-wrap: wrap; gap: 16px 24px; margin-top: 8px; }
  .tag-filters .switch { display: block; }
}
.tag-switch .switch-cells { flex-wrap: wrap; }
.tag-switch label { min-height: 36px; padding: 0 10px; font-size: 13px; }
.more-filters { margin: 12px 0 0; }
.tag-form { margin: 0; }
.tag-help { margin: 0 0 8px; font-family: var(--mono); font-size: 13px; color: var(--slate); }
.tag-old .button { margin-left: 12px; min-height: 32px; padding: 0 12px; font-size: 13px; }
.more-filters > summary { font-family: var(--mono); font-size: 13px; color: var(--slate); }
.tag-old { flex-basis: 100%; margin: 0; font-family: var(--mono); font-size: 13px; }
table.tools td:first-child { min-width: 9rem; }
table.tools a.note, table.platforms a.note { text-decoration: none; color: var(--slate); }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 12px 0; }
dl.facts dt { color: var(--slate); font-family: var(--mono); font-size: 13px; }
dl.facts dd { margin: 0; overflow-wrap: anywhere; }
dl.facts ul { margin: 0; padding-left: 1.1em; }
@media (max-width: 640px) { dl.facts { grid-template-columns: 1fr; } dl.facts dd { margin-bottom: 8px; } }

/* The tools of the retopology page: one band per tool, its facts on the
   left and its tags on the right, so that a tool with many tags grows in
   height only, and the list keeps its order. On a band a tag is the label of
   its filter box. */
.tiles { display: flex; flex-direction: column; margin: 1.25rem 0 2rem; border-top: 1px solid var(--rule); }
.tile { display: grid; grid-template-columns: minmax(14rem, 22rem) 1fr; gap: 4px 24px; padding: 14px 0; border-bottom: 1px solid var(--rule); }
.tile-facts { display: flex; flex-direction: column; gap: 4px; }
.tile > ul.tags { align-content: start; margin: 0; }
.tile h3 { margin: 0; font-size: 1.05rem; }
.tile h3 a { text-decoration: none; }
.tile-old { opacity: 0.75; }
.tile p { margin: 0; }
.tile-by, .tile-price { color: var(--slate); font-family: var(--mono); font-size: 12px; }
.tile-what { font-size: 0.95rem; line-height: 1.45; }
@media (max-width: 720px) {
  .tile { grid-template-columns: 1fr; }
  .tile > ul.tags { margin-top: 6px; }
}
ul.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; padding: 0; list-style: none; }
ul.tags li { margin: 0; }
.tag { display: inline-block; padding: 2px 6px; text-transform: none; letter-spacing: 0; border: 1px solid var(--rule); background: var(--bg); color: var(--ink);
  font-family: var(--mono); font-size: 12px; line-height: 1.5; }
.tag .facet { color: var(--slate); }
label.tag { cursor: pointer; }
label.tag:hover { border-color: var(--ink); }
.market-nav { margin: 0 0 16px; }
.market-nav a[aria-current="page"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
