/* The concepts page (learn.html). Fonts and colours from the design system (ds/ds.css); the dark theme's tokens are
   written by js/theme.js, as on the main page. */
:root {
  --page: var(--ds-page); --surface: var(--ds-surface); --ink: var(--ds-ink); --ink2: var(--ds-ink2); --muted: var(--ds-muted);
  --line: var(--ds-line); --border: var(--ds-border); --accent: var(--ds-accent); --warn: var(--ds-signal-warn);
}
* { box-sizing: border-box; }
html { scroll-padding-top: 16px; }
body { margin: 0; background: var(--page); color: var(--ink); font: var(--ds-size-body)/1.55 var(--ds-font); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, .button { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 5px 10px; cursor: pointer; display: inline-block; }
.button.primary { background: var(--accent); color: #fff; border-color: transparent; }
:root[data-theme="dark"] .button.primary { color: #000; }
.button:hover { text-decoration: none; }

.lh { display: flex; justify-content: space-between; align-items: center; gap: 12px 16px; flex-wrap: wrap; padding: 16px 20px; max-width: 1240px; margin: 0 auto; }
.lh h1 { margin: 0; font-size: 20px; }
.lh h1 a { color: var(--ink); }
.lh h1 span { color: var(--muted); font-weight: 400; }
.lh p { margin: 2px 0 0; color: var(--ink2); }
.actions { display: flex; gap: 8px; }

.layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 24px; max-width: 1240px; margin: 0 auto; padding: 0 20px 40px; }
#side { position: sticky; top: 12px; align-self: start; max-height: calc(100vh - 24px); overflow: auto; padding-right: 4px; }
#find { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 6px 10px; width: 100%; }
#found { min-height: 1.4em; margin: 4px 0 6px; }
#tocList details { border-top: 1px solid var(--line); }
#tocList summary { cursor: pointer; padding: 6px 0; font-weight: 500; list-style-position: inside; }
#tocList summary small { color: var(--muted); font-weight: 400; }
#tocList ul { list-style: none; margin: 0 0 8px; padding: 0 0 0 14px; }
#tocList li a { display: block; padding: 1px 0; color: var(--ink2); font-size: 13px; }
#tocList li a.on, #tocList summary.on { color: var(--accent); }

#wiki { min-width: 0; max-width: 820px; }
.intro { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; margin-bottom: 20px; }
.intro p { margin: 0 0 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chips a { border: 1px solid var(--border); border-radius: 999px; padding: 2px 10px; font-size: 13px; color: var(--ink); background: var(--page); }
.note { color: var(--ink2); font-size: 13px; }
.foot { margin-top: 32px; }

.group { margin: 0 0 28px; }
.group > h2 { font-size: 18px; margin: 28px 0 4px; padding-top: 8px; border-top: 2px solid var(--ink); }
.group > .lede { color: var(--ink2); margin: 0 0 12px; }
.term { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; margin: 0 0 10px; }
.term:target { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 25%, transparent); }
.term h3 { margin: 0 0 6px; font-size: 15px; }
.term h3 .alt { color: var(--muted); font-weight: 400; font-size: 13px; margin-left: 6px; }
.term h3 a.self { color: var(--muted); font-weight: 400; margin-left: 6px; opacity: 0; }
.term:hover h3 a.self, .term h3 a.self:focus { opacity: 1; }
.term p { margin: 0 0 8px; }
.term p:last-child { margin-bottom: 0; }
.term ul, .term ol { margin: 0 0 8px; padding-left: 20px; }
.term li { margin: 0 0 2px; }
.term b { font-weight: 600; }
.eq { font-family: "Cambria Math", "STIX Two Math", Georgia, serif; font-size: 15px; background: var(--page); border-left: 3px solid var(--line); padding: 6px 12px; margin: 0 0 8px; overflow-x: auto; }
.eq var { font-style: italic; }
.eq small { font-family: var(--ds-font); font-size: 12px; color: var(--ink2); display: block; margin-top: 2px; }
.why b, .app b, .warn b, .see b, .src b { color: var(--ink); }
.app { border-left: 3px solid var(--accent); padding-left: 10px; }
.warn { border-left: 3px solid var(--warn); padding-left: 10px; }
.see, .src { font-size: 13px; color: var(--ink2); }
.term table { border-collapse: collapse; font-size: 13px; margin: 0 0 8px; font-variant-numeric: tabular-nums; }
.term th, .term td { border-bottom: 1px solid var(--line); padding: 3px 10px 3px 0; text-align: left; vertical-align: top; }
.term th { color: var(--muted); font-weight: 500; }
.tablewrap { overflow-x: auto; }
figure.fig { margin: 4px 0 10px; }
figure.fig svg { display: block; width: 100%; max-width: 520px; height: auto; color: var(--ink); }
figure.fig figcaption { font-size: 12px; color: var(--ink2); margin-top: 4px; }
.fig .ac { stroke: var(--accent); }
.fig .acf { fill: var(--accent); }
.fig .mu { stroke: var(--muted); }
.fig .muf { fill: var(--muted); }
.fig text { fill: currentColor; font: 11px var(--ds-font); }
.hidden { display: none !important; }
mark { background: color-mix(in srgb, var(--warn) 40%, transparent); color: inherit; border-radius: 2px; }

@media (max-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr); padding: 0 16px 40px; }
  .lh { padding: 16px; }
  #side { position: static; max-height: none; overflow: visible; }
  #tocList { display: none; }
  #side.searching #tocList { display: block; }
}
@media print {
  #side, .actions, .intro .chips { display: none; }
  .layout { display: block; }
  .term { break-inside: avoid; }
}

/* Further reading (g-reading): numbered by rank in the whole list, so the numbers skip within a topic. */
.term ol.reading { padding-left: 34px; }
.term ol.reading li { margin: 0 0 8px; }
.term ol.reading li::marker { color: var(--muted); font-variant-numeric: tabular-nums; }
.term ol.reading li:target { background: color-mix(in srgb, var(--accent) 12%, transparent); border-radius: 4px; }
.term ol.reading small { color: var(--ink2); }
.rl { white-space: nowrap; }
