:root {
  --bg: #f7f7f5;
  --card: #ffffff;
  --text: #1f2328;
  --muted: #646b78;
  --line: #e5e7eb;
  --accent: #4f46e5;
  /* Filled buttons and chips (white text): darker than --accent in dark mode, for contrast. */
  --accent-fill: #4f46e5;
  --accent-soft: #eef0ff;
  --danger: #b91c1c;
  --code-bg: #f1f2f4;
  --warn: #b45309;
  --warn-soft: #fff7ed;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111214;
    --card: #1a1b1e;
    --text: #e6e6e6;
    --muted: #9aa0a6;
    --line: #2c2e33;
    --accent: #8b85ff;
    --accent-fill: #635bf0;
    --accent-soft: #23223a;
    --danger: #f87171;
    --code-bg: #24262b;
    --warn: #fbbf24;
    --warn-soft: #2a2114;
  }
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: var(--accent); }
h1, h2, h3 { letter-spacing: -0.02em; line-height: 1.2; }

.site-header {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; gap: 16px;
  padding: 12px 24px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.logo { color: inherit; text-decoration: none; font-weight: 700; font-size: 19px; letter-spacing: -0.02em; }
.logo::before { content: "∞ "; color: var(--accent); }
.site-header .title { color: var(--muted); font-size: 15px; }
.site-header .spacer { flex: 1; }
/* User manual | Release notes */
.switch { display: inline-flex; padding: 3px; gap: 2px; background: var(--card); border: 1px solid var(--line); border-radius: 9px; }
.switch a { padding: 4px 12px; border-radius: 6px; color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 500; white-space: nowrap; }
.switch a:hover { color: var(--text); }
.switch a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.switch a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
/* Release notes */
.release { margin: 0 0 44px; }
.release h2 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin: 0 0 6px; }
.release h2 .anchor { color: inherit; text-decoration: none; }
.release h2 .anchor:hover { color: var(--accent); }
.release h2 .anchor:hover::after { content: " #"; color: var(--muted); font-weight: 400; }
.copy-link { margin-left: auto; align-self: center; font: inherit; font-size: 13px; font-weight: 500; letter-spacing: 0; color: var(--muted); background: none; border: 1px solid var(--line); border-radius: 6px; padding: 2px 10px; cursor: pointer; }
.copy-link:hover { color: var(--accent); border-color: var(--accent); }
.release:target h2 .anchor { color: var(--accent); }
.release .summary { margin: 0 0 12px; color: var(--muted); }
.release h3 { margin: 18px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.release ul { margin: 0; padding-left: 22px; }
.release li { margin: 4px 0; }
.button { display: inline-block; background: var(--accent-fill); color: #fff; text-decoration: none; font-weight: 600; font-size: 14px; border-radius: 8px; padding: 7px 14px; }

.layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 40px; max-width: 1160px; margin: 0 auto; padding: 32px 24px 80px; }
.toc { position: sticky; top: 76px; align-self: start; max-height: calc(100vh - 96px); overflow-y: auto; font-size: 14.5px; }
.toc p { margin: 0 0 8px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.toc ol { list-style: none; margin: 0; padding: 0; }
.toc li { margin: 0; }
.toc a { display: block; padding: 4px 10px; border-radius: 6px; color: var(--text); text-decoration: none; }
.toc a:hover { background: var(--accent-soft); color: var(--accent); }
.toc ol ol a { padding-left: 24px; font-size: 13.5px; color: var(--muted); }
/* Release notes: versions in blocks of five, each folding open. */
.toc summary { padding: 4px 10px; border-radius: 6px; color: var(--text); font-weight: 600; cursor: pointer; }
.toc summary:hover { background: var(--accent-soft); color: var(--accent); }
.toc details ol { margin-bottom: 4px; }

main { min-width: 0; }
.intro h1 { font-size: 34px; margin: 0 0 10px; }
.lede { font-size: 18px; color: var(--muted); margin: 0 0 28px; max-width: 46em; }
section.chapter { border-top: 1px solid var(--line); padding-top: 28px; margin-top: 36px; }
section.chapter > h2 { font-size: 26px; margin: 0 0 12px; }
h3 { font-size: 19px; margin: 28px 0 8px; }
p, ul, ol { max-width: 46em; }
li { margin: 4px 0; }

figure { margin: 18px 0 26px; }
figure img { display: block; max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 28px rgb(0 0 0 / 0.08); background: var(--card); }
figure.narrow img { max-width: min(560px, 100%); }
figure.phone img { max-width: 300px; }
figcaption { margin-top: 8px; font-size: 14px; color: var(--muted); max-width: 46em; }

kbd { display: inline-block; min-width: 1.6em; padding: 0 6px; font: 600 13px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; text-align: center; color: var(--text); background: var(--card); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; }
code { font: 14px ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--code-bg); border-radius: 5px; padding: 1px 5px; overflow-wrap: anywhere; }
.tip { max-width: 46em; padding: 12px 16px; border-radius: 10px; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); margin: 16px 0; }
.tip strong:first-child { color: var(--accent); }

table { border-collapse: collapse; width: 100%; max-width: 46em; margin: 12px 0 20px; font-size: 15px; }
th, td { text-align: left; vertical-align: top; padding: 7px 10px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
th { font-size: 13px; color: var(--muted); font-weight: 600; }
@media (min-width: 760px) { td:first-child { white-space: nowrap; } }
.pill { display: inline-block; font-size: 12.5px; border: 1px solid var(--line); border-radius: 999px; padding: 0 8px; background: var(--bg); }
.pill.today { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); font-weight: 600; }
.pill.overdue { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); font-weight: 600; }

/* Downloads: beta apps, said plainly. */
.muted { color: var(--muted); }
.small { font-size: 14px; }
.beta-tag { display: inline-block; vertical-align: middle; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--warn); border: 1px solid color-mix(in srgb, var(--warn) 55%, transparent); background: var(--warn-soft); border-radius: 999px; padding: 1px 8px; line-height: 1.5; }
h2 .beta-tag, h3 .beta-tag { margin-left: 6px; }
.beta-banner { max-width: 46em; margin: 0 0 8px; padding: 16px 20px; border-radius: 12px; background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent); border-left-width: 5px; }
.beta-banner p { margin: 6px 0; }
.beta-title { font-size: 18px; font-weight: 700; color: var(--warn); margin-top: 0 !important; }
.beta-title::before { content: "⚠ "; }
.os-hint { font-weight: 600; margin: 18px 0 8px; }
.downloads { display: grid; gap: 14px; max-width: 46em; margin: 12px 0 16px; }
.download { min-width: 0; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; scroll-margin-top: 80px; }
.download.yours { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.download h3 { margin: 0 0 2px; }
.download p { margin: 8px 0; }
.command { display: flex; align-items: center; gap: 8px; background: var(--code-bg); border-radius: 8px; padding: 6px 6px 6px 12px; }
.command code { flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; background: none; padding: 6px 0; font-size: 13.5px; }
.command .copy { flex: none; font: inherit; font-size: 13px; font-weight: 600; color: var(--accent); background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 4px 12px; cursor: pointer; }
.command .copy:hover { border-color: var(--accent); }
.site-footer { border-top: 1px solid var(--line); padding: 24px; text-align: center; color: var(--muted); font-size: 14px; }

@media (max-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 0; padding-top: 20px; }
  .toc { position: static; max-height: none; margin-bottom: 8px; padding: 14px 16px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
  .site-header .title { display: none; }
  .intro h1 { font-size: 28px; }
}

/* Phones: the switch takes the button's place (the footer still has it). */
@media (max-width: 560px) {
  .site-header { gap: 10px; padding: 10px 16px; }
  .site-header .button { display: none; }
  .switch a { padding: 4px 9px; font-size: 13.5px; }
  /* Three tabs don't fit beside the logo: their own row, full width. */
  .site-header { flex-wrap: wrap; }
  .switch { order: 3; flex: 1 1 100%; }
  .switch a { flex: 1; text-align: center; }
}

/* Code blocks and wide tables (the API page). */
pre { max-width: 46em; overflow-x: auto; background: var(--code-bg); border-radius: 10px; padding: 12px 14px; margin: 12px 0 18px; }
pre code { background: none; padding: 0; font-size: 13.5px; line-height: 1.55; }
.table-scroll { max-width: 100%; overflow-x: auto; }
