/*
 * The help centre is a separate static site: it never loads the application's
 * colour authority, so it carries its own palette, and this is where its dark
 * half is derived.
 *
 * Two rules govern that. The dark half is not a mirror — an equal step in
 * lightness is worth less near black — so each role is solved for the reading
 * it owes rather than reflected. And the light half is left byte for byte as
 * it was, including the handful of colours written as literals rather than
 * through a token: those became `light-dark()` pairs keeping their own hex,
 * not references to a nearby token, because the nearest token is up to 0.09
 * away in OKLab and folding them in would have quietly restyled the site in
 * daylight.
 *
 * Every role is solved against the tighter of its two backdrops. In dark that
 * is the card surface, not the canvas, because the surface is the lighter of
 * the two and light text loses contrast on it — the opposite of daylight,
 * where a card is white and text gains. Measured with APCA on the surface:
 * body text 84.4, prose 75.0, muted 60.8, links 74.8 and 81.6, the strong rule
 * 22.1, the hairline 15.4. On the canvas every one of those reads higher.
 *
 * There are five grounds, not two: the canvas, the card, the soft fill, the
 * accent wash, and the recessed panel a LaTeX example is set into. The rules
 * are held to the separator band on all five, which is what caught the panel
 * pointing the wrong way — see .latex-example__paper in site.css.
 *
 * One role stays below its band: the link, at 74.8 where body text asks 75.
 * The light site reads 72.5, 74.3 and 69.3 on the same three backdrops, so the
 * dark half beats it on every ground. Raising it is a change to the site's link
 * colour, not to its dark half.
 *
 * The dark tones stay inside sRGB, which the first pass at the accents did not
 * — declared at chroma 0.11 and 0.09 they painted at 0.070 and 0.053 with the
 * hue turned 11 and 15 degrees, so the file did not describe what a reader saw
 * and the readings changed on a wide-gamut display. palette.test.ts checks it.
 *
 * Two things a reader of this file should not have to rediscover:
 *
 * APCA clips a signal below 0.1 to Lc 0, so it reports exactly 0.0 for the
 * canvas-to-surface and canvas-to-soft steps in both schemes. That is the
 * measure declining to answer, not two identical colours — in OKLab those
 * steps are 0.0096 and 0.0164 in light, 0.0795 and 0.0392 in dark. The
 * selection tint is matched on that distance instead (0.098 in both), and only
 * the text over it on APCA.
 *
 * The panel fills are deliberately *not* matched across the schemes, and the
 * numbers above are why. A drop shadow moves the light canvas 0.17 in OKLab
 * and the dark one 0.022: on a dark ground a shadow has almost nothing to
 * subtract, so all nine box-shadows in site.css are close to inert there. The
 * app answers this with --shadow-rim (see src/color-system.css); the help
 * centre has borders on every raised surface and lets the eightfold fill step
 * carry the elevation instead.
 */
:root {
  color-scheme: light dark;
  --ink: light-dark(#172033, oklch(0.913 0.012 264));
  --ink-soft: light-dark(#33405a, oklch(0.865 0.018 264));
  --muted: light-dark(#5c667a, oklch(0.79 0.022 264));
  --line: light-dark(#dfe4ec, oklch(0.485 0.012 264));
  --line-strong: light-dark(#cbd3df, oklch(0.54 0.014 264));
  --canvas: light-dark(#fbfcfe, oklch(0.22 0.008 264));
  --surface: light-dark(#ffffff, oklch(0.3 0.011 264));
  --soft: light-dark(#f4f7fa, oklch(0.26 0.009 264));
  --accent: light-dark(#1769e0, oklch(0.865 0.065 264));
  --accent-strong: light-dark(#0759c7, oklch(0.9 0.047 264));
  --accent-soft: light-dark(#edf5ff, oklch(0.3 0.05 264));
  /* Physical darkness, not a semantic tone: a shadow that inverts with the
     scheme is a glow. Still a pair, because it has to sit below whatever it
     falls on and the dark canvas is darker than the light scheme's shadow —
     two darknesses, not an inversion. */
  --shadow: light-dark(#172033, oklch(0.12 0.015 264));
}

/* Native disclosure controls keep the full catalogue usable without JavaScript. */
.mobile-navigation,
.compact-toc {
  display: none;
}

.mobile-navigation {
  padding: 0.75rem var(--page-gutter);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.mobile-app {
  float: right;
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  margin-left: 1rem;
  font-size: 0.875rem;
  font-weight: 650;
}

.topic-browser summary,
.compact-toc summary {
  min-height: 2.75rem;
  padding: 0.6rem 0;
  color: var(--ink-soft);
  font-size: 0.875rem;
  font-weight: 650;
  cursor: pointer;
}

summary:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 0.2rem;
}

.topic-browser nav {
  clear: both;
  padding-top: 1rem;
}

.topic-browser section + section {
  margin-top: 1.5rem;
}

.topic-browser ul,
.compact-toc ol {
  padding: 0;
  margin: 0;
  list-style: none;
}

.topic-browser a,
.compact-toc a {
  display: block;
  min-height: 2.75rem;
  padding: 0.6rem 0.5rem;
  border-radius: 0.4rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.topic-browser a[aria-current="page"] {
  color: var(--accent-strong);
  background: var(--accent-soft);
  font-weight: 680;
}

.compact-toc {
  padding: 0 1rem;
  margin: 1.5rem 0;
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  background: var(--soft);
}

.compact-toc nav {
  padding-bottom: 0.75rem;
  font-size: 0.875rem;
}

.compact-toc .depth-3 {
  padding-left: 0.75rem;
}

/* The colours these rules name are declared, and their dark half derived, in
   palette.css. */
:root {
  --font-sans:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --header-height: 4rem;
  --page-width: 88rem;
  --sidebar-width: 15rem;
  --article-width: 44rem;
  --toc-width: 13rem;
  --page-gutter: clamp(1.25rem, 3.5vw, 3rem);
  --column-gap: clamp(2rem, 4vw, 4.5rem);
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

html:lang(ko) {
  --font-sans:
    "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
}

html:lang(ja) {
  --font-sans:
    "Hiragino Sans", "Yu Gothic UI", "Noto Sans JP", system-ui, sans-serif;
}

html:lang(zh) {
  --font-sans:
    "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-padding-top: calc(var(--header-height) + 1.5rem);
}

body {
  min-width: 20rem;
  margin: 0;
  background: var(--canvas);
  font-size: 1rem;
  line-height: 1.65;
}

html:lang(ko) body {
  line-height: 1.75;
  word-break: keep-all;
  overflow-wrap: break-word;
}

html:lang(ja) body,
html:lang(zh) body {
  line-height: 1.75;
  line-break: strict;
}

::selection {
  color: var(--ink);
  /* Darker than the sheet, not lighter. A light wash over a dark surface
     lifts it towards the ink and eats the very text being selected; this
     tone sits the same OKLab distance off the surface as the light one
     (0.098) and leaves the text at Lc 86.9 against the light half's 86.1. */
  background: light-dark(#cfe4ff, oklch(0.24 0.09 264));
}

a {
  color: var(--accent-strong);
  text-decoration-thickness: 0.075em;
  text-underline-offset: 0.2em;
  touch-action: manipulation;
  -webkit-tap-highlight-color: oklch(from var(--accent) l c h / 16%);
}

a:hover {
  color: var(--accent);
  text-decoration-thickness: 0.12em;
}

a:focus-visible {
  /* Opaque on the sheet, a wash on paper. The wash is what the light site has
     always used and it reads Lc 28.3 there, under the 45 a non-text mark is
     asked for; carried into dark by the token alone it fell further, to 16.9.
     The sheet takes the accent whole instead — Lc 74.8 at worst, and the same
     shape summary:focus-visible in navigation.css already uses. */
  outline: 3px solid
    light-dark(
      color-mix(in srgb, var(--accent) 35%, transparent),
      var(--accent)
    );
  outline-offset: 3px;
  border-radius: 0.2rem;
}

.skip {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 20;
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--line-strong);
  border-radius: 0.5rem;
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 0.5rem 1.5rem oklch(from var(--shadow) l c h / 12%);
  text-decoration: none;
  transform: translateY(calc(-100% - 1rem));
}

.skip:focus-visible {
  transform: translateY(0);
}

header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  height: var(--header-height);
  gap: 1rem;
  padding-inline: max(
    var(--page-gutter),
    calc((100vw - var(--page-width)) / 2 + var(--page-gutter))
  );
  border-bottom: 1px solid oklch(from var(--line-strong) l c h / 85%);
  background: oklch(from var(--canvas) l c h / 92%);
  backdrop-filter: blur(14px) saturate(140%);
}

.brand {
  flex: none;
  color: var(--ink);
  font-size: 1.0625rem;
  font-weight: 760;
  letter-spacing: -0.025em;
  text-decoration: none;
}

.brand:hover {
  color: var(--ink);
}

.brand span {
  color: var(--muted);
  font-weight: 520;
}

.languages {
  display: flex;
  align-items: center;
  gap: 0.125rem;
  margin-left: auto;
}

.languages a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  min-height: 2.25rem;
  border-radius: 0.45rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: 0.035em;
  text-decoration: none;
}

.languages a:hover {
  color: var(--ink);
  background: var(--soft);
}

.languages a[aria-current="page"] {
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.app {
  display: inline-flex;
  align-items: center;
  min-height: 2.375rem;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--line-strong);
  border-radius: 0.55rem;
  color: var(--ink);
  background: var(--surface);
  font-size: 0.875rem;
  font-weight: 620;
  text-decoration: none;
  box-shadow: 0 1px 2px oklch(from var(--shadow) l c h / 4%);
}

.app:hover {
  color: var(--ink);
  border-color: light-dark(#aeb9c9, oklch(0.62 0.02 264));
  background: var(--soft);
}

.layout {
  display: grid;
  grid-template-columns:
    minmax(12rem, var(--sidebar-width))
    minmax(0, var(--article-width))
    minmax(10rem, var(--toc-width));
  justify-content: center;
  align-items: start;
  width: 100%;
  max-width: var(--page-width);
  min-height: calc(100vh - var(--header-height));
  margin-inline: auto;
  padding: clamp(2.5rem, 5vw, 4.5rem) var(--page-gutter) 6rem;
  column-gap: var(--column-gap);
}

.layout > aside {
  position: sticky;
  top: calc(var(--header-height) + 1.75rem);
  max-height: calc(100dvh - var(--header-height) - 3.5rem);
  padding-right: 0.5rem;
  overflow-y: auto;
  color: var(--muted);
  font-size: 0.8125rem;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.layout > aside section + section {
  margin-top: 1.4rem;
}

.sidebar-heading {
  margin: 0 0 0.45rem;
  color: var(--ink-soft);
  font-size: 0.6875rem;
  font-weight: 760;
  letter-spacing: 0.085em;
  line-height: 1.35;
  text-transform: uppercase;
}

.layout > aside :where(ul),
.toc ol {
  padding: 0;
  margin: 0;
  list-style: none;
}

.sidebar-item + .sidebar-item {
  margin-top: 0.075rem;
}

.layout > aside a {
  display: block;
  padding: 0.28rem 0.55rem;
  margin-left: -0.55rem;
  border-radius: 0.4rem;
  color: var(--muted);
  line-height: 1.45;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.layout > aside a:hover {
  color: var(--ink);
  background: var(--soft);
}

.layout > aside a[aria-current="page"] {
  color: var(--accent-strong);
  background: var(--accent-soft);
  box-shadow: inset 2px 0 var(--accent);
  font-weight: 680;
}

main {
  min-width: 0;
  scroll-margin-top: calc(var(--header-height) + 1rem);
}

.layout--home main {
  grid-column: 2 / -1;
  width: 100%;
  max-width: 61rem;
}

.toc {
  position: sticky;
  top: calc(var(--header-height) + 1.75rem);
  align-self: start;
  padding-left: 1rem;
  border-left: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.75rem;
}

.toc strong {
  color: var(--ink-soft);
  font-size: 0.6875rem;
  font-weight: 760;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.toc ol {
  margin-top: 0.65rem;
}

.toc :where(li + li) {
  margin-top: 0.4rem;
}

.toc .depth-3 {
  padding-left: 0.75rem;
  font-size: 0.7125rem;
}

.toc a {
  display: block;
  color: var(--muted);
  line-height: 1.45;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.toc a:hover {
  color: var(--ink);
}

.crumb {
  margin: 0 0 1.75rem;
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 520;
}

.doc,
.hero {
  width: 100%;
  max-width: var(--article-width);
}

.doc h1,
.hero h1 {
  max-width: 17ch;
  margin: 0;
  color: var(--ink);
  font-size: clamp(2.35rem, 5vw, 3.5rem);
  font-weight: 780;
  letter-spacing: -0.045em;
  line-height: 1.04;
  text-wrap: balance;
}

.hero h1 {
  max-width: 14ch;
  font-size: clamp(2.6rem, 5vw, 3.8rem);
}

html:lang(ko) .doc h1,
html:lang(ko) .hero h1,
html:lang(ja) .doc h1,
html:lang(ja) .hero h1,
html:lang(zh) .doc h1,
html:lang(zh) .hero h1 {
  letter-spacing: -0.035em;
  line-height: 1.15;
}

.lead {
  max-width: 38rem;
  margin: 1rem 0 clamp(2.25rem, 5vw, 3.25rem);
  color: var(--muted);
  font-size: clamp(1.125rem, 2vw, 1.25rem);
  line-height: 1.55;
  text-wrap: pretty;
}

.doc > p:not(.lead),
.hero > p:not(.lead),
.doc > ul,
.doc > ol,
.doc > blockquote {
  font-size: 1.0625rem;
}

.doc p,
.hero p {
  margin: 1.1rem 0;
  text-wrap: pretty;
}

:is(.doc, .hero) h2,
:is(.doc, .hero) h3,
.cards > h2 {
  color: var(--ink);
  text-wrap: balance;
  scroll-margin-top: calc(var(--header-height) + 1.5rem);
}

:is(.doc, .hero) h2 {
  margin: 3.5rem 0 0.8rem;
  font-size: clamp(1.55rem, 3vw, 1.75rem);
  font-weight: 740;
  letter-spacing: -0.025em;
  line-height: 1.25;
}

:is(.doc, .hero) h3 {
  margin: 2.5rem 0 0.65rem;
  font-size: 1.25rem;
  font-weight: 710;
  letter-spacing: -0.015em;
  line-height: 1.35;
}

.heading-link {
  margin-left: 0.4rem;
  color: var(--line-strong);
  font-size: 0.7em;
  font-weight: 560;
  text-decoration: none;
  opacity: 0;
}

:is(.doc, .hero) h2:hover .heading-link,
:is(.doc, .hero) h3:hover .heading-link,
.heading-link:focus-visible {
  opacity: 1;
}

.doc strong {
  font-weight: 700;
}

.doc ul,
.doc ol {
  padding-left: 1.45rem;
}

.doc li {
  padding-left: 0.15rem;
}

.doc li + li {
  margin-top: 0.35rem;
}

.doc blockquote {
  padding: 0.25rem 0 0.25rem 1rem;
  margin: 1.75rem 0;
  border-left: 3px solid var(--accent);
  color: var(--ink-soft);
}

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

.doc img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: clamp(2rem, 5vw, 3rem) 0;
  border: 1px solid var(--line);
  border-radius: 0.875rem;
  background: var(--surface);
  box-shadow:
    0 1px 2px oklch(from var(--shadow) l c h / 5%),
    0 1.5rem 3.5rem -2rem oklch(from var(--shadow) l c h / 25%);
}

.doc figure {
  margin: clamp(2rem, 5vw, 3rem) 0;
}

.doc figure img {
  margin: 0;
}

.doc figcaption {
  max-width: 36rem;
  margin-top: 0.7rem;
  color: var(--muted);
  font-size: 0.8125rem;
  line-height: 1.5;
}

:is(.doc, .hero) code,
:is(.doc, .hero) pre {
  font-family: var(--font-mono);
}

:is(.doc, .hero) code {
  padding: 0.13rem 0.32rem;
  border: 1px solid var(--line);
  border-radius: 0.3rem;
  background: var(--soft);
  font-size: 0.875em;
  overflow-wrap: anywhere;
}

:is(.doc, .hero) pre {
  max-width: 100%;
  padding: 1rem 1.125rem;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  background: var(--soft);
  font-size: 0.875rem;
  line-height: 1.6;
  tab-size: 2;
}

:is(.doc, .hero) pre code {
  padding: 0;
  border: 0;
  background: transparent;
  font-size: inherit;
  overflow-wrap: normal;
}

.doc .latex-example {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(13rem, 0.85fr);
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 0.875rem;
  background: var(--surface);
  box-shadow: 0 1.25rem 3rem -2.25rem oklch(from var(--shadow) l c h / 22%);
}

.latex-example > div {
  min-width: 0;
}

.latex-example__source {
  background: var(--soft);
}

.latex-example__result {
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--line);
}

.doc .latex-example figcaption {
  max-width: none;
  padding: 0.6rem 0.8rem;
  margin: 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.doc .latex-example pre {
  min-height: 100%;
  padding: 1rem;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: 0.75rem;
}

.latex-example__paper {
  display: grid;
  flex: 1;
  min-height: 9rem;
  padding: 1rem;
  /* Recessed, like the light one. #eef1f5 sits *below* the white card it is
     set into; the first dark half matched that distance and inverted the
     direction, putting the panel above the card at L 0.35 — the only ground on
     the site lighter than a card, and the three hairlines around it fell to
     Lc0 11.9 against it. Below the surface by the same distance instead. */
  background: light-dark(#eef1f5, oklch(0.256 0.01 264));
  place-items: center;
}

.doc .latex-example__paper img {
  width: auto;
  max-height: 11rem;
  border: 0;
  border-radius: 0.15rem;
  box-shadow: 0 0.4rem 1.2rem oklch(from var(--shadow) l c h / 16%);
}

.latex-example__open {
  padding: 0.65rem 0.8rem;
  border-top: 1px solid var(--line);
  color: var(--accent-strong);
  font-size: 0.8125rem;
  font-weight: 700;
  text-decoration: none;
}

.latex-example__open:hover {
  background: var(--accent-soft);
  text-decoration: underline;
}

:is(.doc, .hero) table {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 1.75rem 0;
  overflow-x: auto;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  background: var(--surface);
  font-size: 0.9375rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.5;
  overscroll-behavior-inline: contain;
}

:is(.doc, .hero) th,
:is(.doc, .hero) td {
  min-width: 8rem;
  padding: 0.65rem 0.75rem;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

:is(.doc, .hero) th {
  background: var(--soft);
  color: var(--ink-soft);
  font-weight: 680;
}

:is(.doc, .hero) tr:last-child td {
  border-bottom: 0;
}

:is(.doc, .hero) th:last-child,
:is(.doc, .hero) td:last-child {
  border-right: 0;
}

.related {
  padding-top: 0.25rem;
  margin-top: 4.5rem;
  border-top: 1px solid var(--line);
}

.related h2 {
  margin-top: 2rem;
}

.related ul {
  padding-left: 1.25rem;
}

.cards {
  margin: 4rem 0 0;
}

.cards > h2 {
  margin: 0 0 1rem;
  font-size: 1.45rem;
  font-weight: 740;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.cards > div {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.875rem;
}

.cards article {
  min-width: 0;
  min-height: 8.25rem;
  padding: 1.15rem 1.2rem;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  background: var(--surface);
  box-shadow: 0 1px 2px oklch(from var(--shadow) l c h / 3%);
}

.cards article:hover,
.cards article:focus-within {
  border-color: light-dark(#b7c7dd, oklch(0.61 0.03 264));
  box-shadow: 0 0.75rem 2rem -1.5rem oklch(from var(--shadow) l c h / 24%);
}

.cards h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 690;
  line-height: 1.4;
  text-wrap: balance;
}

.cards h3 a {
  color: var(--ink);
  text-decoration-color: light-dark(#a9c8f5, oklch(0.61 0.07 264));
}

.cards h3 a:hover {
  color: var(--accent-strong);
}

.cards p {
  margin: 0.65rem 0 0;
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.55;
  text-wrap: pretty;
}

footer {
  padding: 1.75rem
    max(
      var(--page-gutter),
      calc((100vw - var(--page-width)) / 2 + var(--page-gutter))
    )
    2.5rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  background: var(--surface);
  font-size: 0.75rem;
}

.language-entry {
  display: grid;
  min-height: 100vh;
  padding: var(--page-gutter);
  place-items: center;
}

.language-entry__panel,
.error-page {
  width: min(100%, 34rem);
}

.language-entry__panel {
  padding: clamp(1.5rem, 5vw, 2.5rem);
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--surface);
  box-shadow: 0 1.5rem 4rem -2.5rem oklch(from var(--shadow) l c h / 28%);
}

.language-entry__panel h1,
.error-page h1 {
  margin: 0;
  font-size: clamp(2rem, 7vw, 3rem);
  letter-spacing: -0.04em;
  line-height: 1.1;
  text-wrap: balance;
}

.language-entry__panel p {
  margin: 0.75rem 0 1.5rem;
  color: var(--muted);
}

.language-entry__panel ul {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
  padding: 0;
  margin: 0;
  list-style: none;
}

.language-entry__panel a {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  border: 1px solid var(--line);
  border-radius: 0.55rem;
  background: var(--soft);
  font-size: 0.875rem;
  font-weight: 680;
  text-decoration: none;
}

.language-entry__panel a:hover {
  border-color: light-dark(#b7c7dd, oklch(0.61 0.03 264));
  background: var(--accent-soft);
}

.error-page {
  min-height: 100vh;
  padding: clamp(3rem, 10vw, 7rem) var(--page-gutter);
  margin-inline: auto;
}

.error-page p {
  color: var(--muted);
}

@media (max-width: 75rem) {
  .layout {
    grid-template-columns: minmax(12rem, 14rem) minmax(0, var(--article-width));
    max-width: 66rem;
    row-gap: 1.5rem;
  }

  .layout--article main {
    grid-column: 2;
    grid-row: 1;
  }

  .layout--home main {
    grid-column: 2;
    grid-row: 1;
    max-width: var(--article-width);
  }

  .cards > div {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .layout > aside {
    grid-column: 1;
    grid-row: 1 / span 2;
  }

  .toc {
    display: none;
  }

  .compact-toc {
    display: block;
  }
}

@media (max-width: 54rem) {
  .layout {
    grid-template-columns: minmax(0, var(--article-width));
    max-width: calc(
      var(--article-width) +
      var(--page-gutter) +
      var(--page-gutter)
    );
    padding-top: 2rem;
  }

  .layout > aside {
    display: none;
  }

  .layout--article main,
  .layout--home main {
    grid-column: 1;
  }

  .layout--home main {
    grid-row: 1;
  }

  .app {
    display: none;
  }

  .mobile-navigation {
    display: block;
  }

  .doc .latex-example {
    grid-template-columns: minmax(0, 1fr);
  }

  .latex-example__result {
    border-top: 1px solid var(--line);
    border-left: 0;
  }
}

@media (max-width: 38rem) {
  :root {
    --header-height: 3.75rem;
    --page-gutter: 1rem;
  }

  header {
    gap: 0.5rem;
  }

  .brand span {
    display: none;
  }

  .languages a {
    min-width: 2rem;
    min-height: 2rem;
    font-size: 0.6875rem;
  }

  .layout {
    row-gap: 1.75rem;
    padding-top: 1.5rem;
    padding-bottom: 4rem;
  }

  .crumb {
    margin-bottom: 1.4rem;
  }

  .doc h1,
  .hero h1 {
    max-width: 100%;
    font-size: clamp(2.2rem, 11vw, 2.85rem);
  }

  .lead {
    margin-bottom: 2.25rem;
    font-size: 1.0625rem;
  }

  .doc > p:not(.lead),
  .hero > p:not(.lead),
  .doc > ul,
  .doc > ol,
  .doc > blockquote {
    font-size: 1rem;
  }

  :is(.doc, .hero) h2 {
    margin-top: 3rem;
  }

  .cards {
    margin-top: 3rem;
  }

  .cards article {
    min-height: 0;
  }

  .cards > div {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .skip {
    transform: none;
  }

  .skip:not(:focus-visible) {
    visibility: hidden;
  }
}

.learning-nav {
  margin-top: 3.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

.learning-nav > p {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 650;
}

.learning-nav > div {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.learning-nav a {
  display: flex;
  flex-direction: column;
  min-height: 5rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 0.6rem;
  background: var(--surface);
  text-decoration: none;
}

.learning-nav a:hover {
  border-color: var(--line-strong);
  background: var(--soft);
}

.learning-nav__next {
  text-align: right;
}

.learning-nav a span {
  color: var(--muted);
  font-size: 0.75rem;
}

.learning-nav a strong {
  margin-top: 0.2rem;
  color: var(--ink);
  font-size: 0.875rem;
  line-height: 1.4;
}
