/* The Background and Practices pages. The menu bar is shared with the demo. */
:root {
  --page: #f6f6f3; --surface: #ffffff; --line: #deddd6; --ink: #1c1d20; --ink2: #55565a; --accent: #2a78d6; --accent-dark: #1b5cab;
  --orange: #eb6834; --teal: #118a5f; --red: #c93a3a; --code: #24272c; --code-ink: #eceded; --bar: #1b1d21; --bar-ink: #eceded;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 66px; }
body { margin: 0; background: var(--page); color: var(--ink); font: 16.5px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }

/* Menu */
.menu { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 4px; height: 50px; padding: 0 16px; background: var(--bar); color: var(--bar-ink); font-size: 14.5px; overflow-x: auto; white-space: nowrap; }
.menu .brand { font-weight: 650; margin-right: 18px; color: var(--bar-ink); text-decoration: none; }
.menu a.item { color: #c6c9ce; text-decoration: none; padding: 6px 12px; border-radius: 7px; }
.menu a.item:hover { background: #2f3339; color: #fff; }
.menu a.item[aria-current=page] { background: #3b82d6; color: #fff; font-weight: 600; }

/* Reading column */
main { max-width: 860px; margin: 0 auto; padding: 34px 20px 72px; }
h1 { font-size: 33px; line-height: 1.2; margin: 0 0 12px; letter-spacing: -.01em; }
h2 { font-size: 25px; line-height: 1.25; margin: 56px 0 12px; padding-top: 22px; border-top: 1px solid var(--line); }
h3 { font-size: 18.5px; margin: 28px 0 8px; }
p { margin: 0 0 13px; }
.lead { font-size: 19px; color: var(--ink2); }
a { color: var(--accent-dark); }
ul, ol { padding-left: 24px; margin: 0 0 14px; }
li { margin-bottom: 5px; }
.contents { display: flex; flex-wrap: wrap; gap: 7px; margin: 18px 0 8px; padding: 0; list-style: none; }
.contents li { margin: 0; }
.contents a { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 4px 13px; font-size: 14px; text-decoration: none; color: var(--ink); }
.contents a:hover { border-color: var(--accent); }
.step { color: var(--accent-dark); font-weight: 650; font-size: 14px; display: block; margin-bottom: 2px; }

/* Equations and code */
.eq { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 6px; padding: 12px 16px; margin: 12px 0 15px; font: 16px/1.75 "Cambria Math", Cambria, Georgia, serif; overflow-x: auto; white-space: nowrap; }
.eq small { font: 13.5px system-ui, sans-serif; color: var(--ink2); margin-left: 8px; }
pre { background: var(--code); color: var(--code-ink); border-radius: 8px; padding: 13px 15px; overflow-x: auto; font: 13.5px/1.5 Consolas, Menlo, monospace; margin: 10px 0 16px; }
code { font: .9em Consolas, Menlo, monospace; background: #ecebe6; padding: 1px 4px; border-radius: 4px; }
pre code { background: none; padding: 0; font: inherit; }

/* Pictures and tables */
figure { margin: 18px 0 20px; }
figure img, figure video { display: block; width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--line); background: #fff; }
figure.narrow { max-width: 560px; }
figcaption { font-size: 14px; color: var(--ink2); margin-top: 7px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.two figure { margin: 8px 0; }
.scroll { overflow-x: auto; margin: 10px 0 16px; }
table { border-collapse: collapse; width: 100%; font-size: 14.5px; background: var(--surface); }
th, td { border-bottom: 1px solid var(--line); padding: 7px 10px; text-align: left; vertical-align: top; }
th { color: var(--ink2); font-weight: 600; background: #f1f0eb; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.note { background: #fff8e8; border: 1px solid #ecd9a5; border-radius: 8px; padding: 11px 15px; margin: 14px 0 16px; font-size: 15px; }
.key { background: #eaf2fc; border: 1px solid #c4daf5; border-radius: 8px; padding: 11px 15px; margin: 14px 0 16px; font-size: 15px; }
.try { background: #e8f6ef; border: 1px solid #bce3cf; border-radius: 8px; padding: 11px 15px; margin: 14px 0 16px; font-size: 15px; }
.button { display: inline-block; background: var(--accent); color: #fff; font-weight: 600; padding: 9px 16px; border-radius: 8px; text-decoration: none; }
.button:hover { background: var(--accent-dark); }
.next { margin-top: 42px; padding-top: 20px; border-top: 1px solid var(--line); }

/* Interactive diagrams */
.widget { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin: 18px 0 20px; }
.widget h4 { margin: 0 0 3px; font-size: 15.5px; }
.widget .how { color: var(--ink2); font-size: 14px; margin-bottom: 9px; }
.widget svg { display: block; width: 100%; height: auto; touch-action: none; user-select: none; background: #fbfbf9; border: 1px solid var(--line); border-radius: 6px; }
.widget .chart svg { touch-action: pan-y; }
.controls { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin: 10px 0 2px; font-size: 14px; }
.controls label { display: flex; align-items: center; gap: 7px; }
.controls input[type=range] { width: 140px; accent-color: var(--accent); }
.controls button { font: inherit; padding: 5px 11px; border-radius: 6px; border: 1px solid #c7c6bf; background: #fff; color: var(--ink); cursor: pointer; }
.controls button:hover { border-color: var(--accent); }
.controls button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.readout { font: 13.5px/1.5 Consolas, Menlo, monospace; color: var(--ink2); margin-top: 8px; min-height: 2.9em; }
.readout b { color: var(--ink); }
.pair { display: grid; grid-template-columns: 3fr 2fr; gap: 10px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13.5px; color: var(--ink2); margin-top: 7px; }
.legend i { display: inline-block; width: 18px; height: 3px; margin-right: 5px; vertical-align: middle; border-radius: 2px; }
#filter-world text { font-size: 20px; }
.draggable { cursor: grab; }
.tip { position: absolute; pointer-events: none; background: #1c1d20; color: #fff; font-size: 13px; padding: 5px 8px; border-radius: 6px; white-space: nowrap; }
.chart { position: relative; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

@media (max-width: 660px) {
  body { font-size: 16px; }
  h1 { font-size: 27px; }
  h2 { font-size: 22px; }
  .two, .pair { grid-template-columns: 1fr; }
  .controls input[type=range] { width: 110px; }
}
