/* learn.mohebi.ai
   Identity shared with mohebi.ai: warm paper, sage accent, a book serif for headings.
   Layout: lesson pages are a three-column reading desk (lesson list · text · on this page);
   figures sit on a slightly raised "graph paper" panel and may run wider than the text. */

:root {
  color-scheme: light;
  --bg: #f8f7f4;
  --panel: #fcfcfa;
  --panel-2: #f1f0eb;
  --fg: #252824;
  --fg-2: #444841;
  --muted: #666b65;
  --rule: #dedfd7;
  --rule-2: #cfd1c7;
  --accent: #2e6256;
  --accent-2: #3f7d6f;
  --accent-soft: #e3eee8;
  --selection: #d8e7df;
  --code-bg: #f1f0eb;
  --shadow: 0 1px 2px rgba(30, 40, 30, 0.06), 0 8px 24px rgba(30, 40, 30, 0.06);

  /* figures: categorical slots (validated set), grid and ink */
  --c1: #2a78d6; /* blue   */
  --c2: #eb6834; /* orange */
  --c3: #1baf7a; /* aqua   */
  --c4: #6250d6; /* violet */
  --c5: #e87ba4; /* magenta */
  --c6: #eda100; /* yellow */
  --grid: #e7e7e0;
  --grid-major: #d5d6cd;
  --axis: #9a9d94;
  --ink: #252824;
  --ink-2: #5d625b;
  --fill-soft: rgba(42, 120, 214, 0.12);

  --callout-note: #2a78d6;
  --callout-tip: #1b8a63;
  --callout-warn: #c4581f;
  --callout-key: #2e6256;
  --callout-predict: #6250d6;

  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --radius: 10px;
  --header-h: 60px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #181c19;
  --panel: #1f2420;
  --panel-2: #252b26;
  --fg: #eeeee7;
  --fg-2: #cfd1c8;
  --muted: #acb2a9;
  --rule: #343d35;
  --rule-2: #435045;
  --accent: #a4c8b4;
  --accent-2: #8fbaa3;
  --accent-soft: #263a30;
  --selection: #344b3d;
  --code-bg: #222823;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
  --c1: #3987e5;
  --c2: #d95926;
  --c3: #199e70;
  --c4: #9085e9;
  --c5: #d55181;
  --c6: #c98500;
  --grid: #2a312b;
  --grid-major: #384239;
  --axis: #7b847b;
  --ink: #eeeee7;
  --ink-2: #b9beb5;
  --fill-soft: rgba(57, 135, 229, 0.18);
  --callout-note: #6aa6ee;
  --callout-tip: #4cc497;
  --callout-warn: #ec8a57;
  --callout-key: #a4c8b4;
  --callout-predict: #a69bf0;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #181c19;
    --panel: #1f2420;
    --panel-2: #252b26;
    --fg: #eeeee7;
    --fg-2: #cfd1c8;
    --muted: #acb2a9;
    --rule: #343d35;
    --rule-2: #435045;
    --accent: #a4c8b4;
    --accent-2: #8fbaa3;
    --accent-soft: #263a30;
    --selection: #344b3d;
    --code-bg: #222823;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
    --c1: #3987e5;
    --c2: #d95926;
    --c3: #199e70;
    --c4: #9085e9;
    --c5: #d55181;
    --c6: #c98500;
    --grid: #2a312b;
    --grid-major: #384239;
    --axis: #7b847b;
    --ink: #eeeee7;
    --ink-2: #b9beb5;
    --fill-soft: rgba(57, 135, 229, 0.18);
    --callout-note: #6aa6ee;
    --callout-tip: #4cc497;
    --callout-warn: #ec8a57;
    --callout-key: #a4c8b4;
    --callout-predict: #a69bf0;
  }
}

/* ------------------------------------------------------------------ base */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.68;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}
::selection { background: var(--selection); }
a { color: var(--accent); text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
img, svg, canvas { max-width: 100%; }
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 400; letter-spacing: -0.015em; line-height: 1.2; text-wrap: balance; color: var(--fg); }
code, kbd, pre { font-family: var(--mono); font-size: 0.88em; }
.skip-link { position: absolute; inset-inline-start: 16px; top: -80px; z-index: 50; padding: 10px 16px; background: var(--panel); border: 1px solid var(--rule); }
.skip-link:focus { top: 10px; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.eyebrow .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.muted { color: var(--muted); }

/* ------------------------------------------------------------------ header */
.site-header {
  position: sticky; top: 0; z-index: 30;
  height: var(--header-h);
  display: flex; align-items: center; gap: 24px;
  padding-inline: max(16px, env(safe-area-inset-left, 0px)) max(16px, env(safe-area-inset-right, 0px));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--rule);
}
.brand { display: flex; align-items: baseline; gap: 1px; color: var(--fg); text-decoration: none; font-family: var(--serif); font-size: 24px; letter-spacing: -0.03em; line-height: 1; white-space: nowrap; }
.brand .brand-dom { font-family: var(--sans); font-size: 12px; letter-spacing: 0.02em; color: var(--muted); margin-inline-start: 2px; }
.brand .brand-mark { color: var(--accent); }
.site-nav { display: flex; gap: 22px; margin-inline-start: auto; align-items: center; font-size: 14px; }
.site-nav a { color: var(--muted); text-decoration: none; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--fg); }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--rule); background: var(--panel); color: var(--fg-2); cursor: pointer; }
.icon-btn:hover { border-color: var(--rule-2); color: var(--fg); }
.icon-btn svg { width: 18px; height: 18px; }
.menu-btn { display: none; }
@media (max-width: 720px) {
  .site-nav { gap: 14px; font-size: 13.5px; }
  .site-nav a.nav-res { display: none; }
  .site-nav .nav-long { display: none; }
}
@media (min-width: 721px) { .site-nav .nav-shortl { display: none; } }

/* ------------------------------------------------------------------ shells */
.shell { width: min(100% - 32px, 1120px); margin-inline: auto; }
.narrow { width: min(100% - 32px, 760px); margin-inline: auto; }
.site-footer { border-top: 1px solid var(--rule); margin-top: 96px; padding: 32px 0 48px; color: var(--muted); font-size: 14px; }
.site-footer .shell { display: flex; flex-wrap: wrap; gap: 12px 28px; justify-content: space-between; }
.site-footer a { color: var(--muted); }

/* ------------------------------------------------------------------ buttons */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 8px; font: 500 15px/1.2 var(--sans); text-decoration: none; border: 1px solid var(--rule-2); color: var(--fg); background: var(--panel); cursor: pointer; }
.btn:hover { border-color: var(--accent); color: var(--fg); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.btn-primary:hover { background: var(--accent-2); border-color: var(--accent-2); color: var(--bg); }
.btn svg { width: 17px; height: 17px; flex: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }

/* ------------------------------------------------------------------ home */
.home-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 480px); gap: 56px; align-items: center; padding-block: 64px 48px; }
.home-hero h1 { font-size: clamp(38px, 5vw, 60px); margin: 18px 0 18px; letter-spacing: -0.03em; }
.home-hero h1 em { font-style: italic; color: var(--accent); }
.home-hero p.lede { font-size: 19px; color: var(--fg-2); max-width: 36em; margin: 0 0 26px; }
.home-hero .widget { margin: 0; }
@media (max-width: 900px) { .home-hero { grid-template-columns: 1fr; gap: 28px; padding-top: 40px; } }
.how { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); margin: 24px 0 64px; }
.how > div { padding-block: 22px; padding-inline: 0 22px; }
.how > div + div { padding-inline-start: 22px; border-inline-start: 1px solid var(--rule); }
.how b { display: block; font-family: var(--serif); font-weight: 400; font-size: 21px; margin-bottom: 4px; }
.how span { color: var(--muted); font-size: 15px; line-height: 1.5; display: block; }
@media (max-width: 820px) { .how { grid-template-columns: 1fr 1fr; } .how > div:nth-child(3) { border-inline-start: 0; padding-inline-start: 0; } .how > div:nth-child(n+3) { border-top: 1px solid var(--rule); } }
@media (max-width: 480px) { .how { grid-template-columns: 1fr; } .how > div + div { border-inline-start: 0; padding-inline-start: 0; border-top: 1px solid var(--rule); } }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin: 0 0 18px; }
.section-head h2 { font-size: 30px; margin: 0; }
.tracks { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.track-card { display: flex; flex-direction: column; gap: 8px; padding: 22px 22px 20px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--panel); color: var(--fg); text-decoration: none; min-height: 180px; }
a.track-card:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.track-card h3 { font-size: 23px; margin: 0; }
.track-card p { margin: 0; color: var(--fg-2); font-size: 15px; line-height: 1.5; flex: 1; }
.track-card .meta { font-size: 13px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; }
.track-card.soon { background: transparent; border-style: dashed; }
.track-card.soon h3 { color: var(--fg-2); }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; letter-spacing: 0.04em; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--rule-2); color: var(--muted); }
.pill.live { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); background: var(--accent-soft); }

/* ------------------------------------------------------------------ track page */
.track-hero { padding-block: 56px 28px; display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 48px; align-items: end; }
.track-hero h1 { font-size: clamp(40px, 5vw, 58px); margin: 14px 0 14px; letter-spacing: -0.03em; }
.track-hero p { margin: 0 0 10px; color: var(--fg-2); font-size: 18px; max-width: 40em; }
@media (max-width: 860px) { .track-hero { grid-template-columns: 1fr; gap: 20px; } }
.progress-card { border: 1px solid var(--rule); border-radius: var(--radius); padding: 18px 20px; background: var(--panel); }
.progress-card .num { font-family: var(--serif); font-size: 34px; line-height: 1; }
.progress-card .lab { font-size: 13px; color: var(--muted); }
.bar { height: 6px; border-radius: 3px; background: var(--panel-2); overflow: hidden; margin: 12px 0 8px; }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 3px; transition: width 0.4s ease; }
.part { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 32px; padding-block: 28px; border-top: 1px solid var(--rule); }
.part-head .eyebrow { margin-bottom: 8px; }
.part-head h2 { font-size: 25px; margin: 0 0 8px; }
.part-head p { color: var(--muted); font-size: 15px; line-height: 1.5; margin: 0; }
@media (max-width: 760px) { .part { grid-template-columns: 1fr; gap: 12px; } }
.lesson-list { list-style: none; margin: 0; padding: 0; }
.lesson-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 14px; align-items: start; padding: 14px 12px; margin-inline: -12px; border-radius: 8px; text-decoration: none; color: var(--fg); }
.lesson-row:hover { background: var(--panel); }
.lesson-row .n { font-family: var(--serif); font-size: 22px; color: var(--muted); line-height: 1.3; font-variant-numeric: tabular-nums; }
.lesson-row .t { font-size: 17px; font-weight: 600; line-height: 1.35; display: block; }
.lesson-row .s { font-size: 15px; color: var(--muted); line-height: 1.45; display: block; margin-top: 3px; }
.lesson-row .m { font-size: 13px; color: var(--muted); white-space: nowrap; text-align: end; line-height: 1.6; }
.lesson-row.done .n { color: var(--accent); }
.lesson-row.done .n::after { content: " ✓"; font-family: var(--sans); font-size: 14px; }
.track-links { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; margin: 8px 0 24px; }

/* ------------------------------------------------------------------ lesson layout */
.desk { display: grid; grid-template-columns: 248px minmax(0, 1fr) 210px; gap: 44px; width: min(100% - 32px, 1380px); margin-inline: auto; }
.sidebar, .toc { position: sticky; top: calc(var(--header-h) + 20px); align-self: start; max-height: calc(100vh - var(--header-h) - 40px); overflow: auto; padding-block: 28px 40px; font-size: 14px; scrollbar-width: thin; }
.sidebar h2, .toc h2 { font-family: var(--sans); font-size: 12px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; }
.sidebar .part-title { font-size: 12px; color: var(--muted); margin: 18px 0 6px; font-weight: 600; }
.sidebar ol { list-style: none; margin: 0; padding: 0; }
.sidebar a { display: grid; grid-template-columns: 24px 1fr; gap: 4px; padding: 5px 8px; margin-inline: -8px; border-radius: 6px; color: var(--fg-2); text-decoration: none; line-height: 1.35; }
.sidebar a:hover { background: var(--panel); color: var(--fg); }
.sidebar a[aria-current="page"] { background: var(--accent-soft); color: var(--fg); font-weight: 600; }
.sidebar a .k { color: var(--muted); font-variant-numeric: tabular-nums; }
.sidebar a.done .k { color: var(--accent); }
.toc ol { list-style: none; margin: 0; padding: 0; padding-inline-start: 10px; border-inline-start: 1px solid var(--rule); }
.toc a { display: block; padding-block: 4px; padding-inline: 10px 0; margin-inline-start: -11px; border-inline-start: 2px solid transparent; color: var(--muted); text-decoration: none; line-height: 1.35; }
.toc a:hover { color: var(--fg); }
.toc a.active { color: var(--fg); border-inline-start-color: var(--accent); }
.toc li.l3 a { padding-inline-start: 22px; font-size: 13px; }
@media (max-width: 1240px) { .desk { grid-template-columns: 240px minmax(0, 1fr); } .toc { display: none; } }
@media (max-width: 920px) {
  .desk { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; z-index: 40; top: var(--header-h); inset-inline-start: 0; bottom: 0; width: min(320px, 86vw); max-height: none; background: var(--bg); border-inline-end: 1px solid var(--rule); padding: 20px 20px 40px; transform: translateX(-102%); transition: transform 0.25s ease; box-shadow: var(--shadow); }
  body.nav-open .sidebar { transform: none; }
  .menu-btn { display: inline-grid; }
}

/* ------------------------------------------------------------------ article */
.article { min-width: 0; padding-block: 36px 40px; }
.article > * { max-width: 720px; }
.article > .widget, .article > .wide, .article > .table-wrap { max-width: 860px; }
.lesson-hero { margin-bottom: 30px; padding-bottom: 26px; border-bottom: 1px solid var(--rule); }
.lesson-hero h1 { font-size: clamp(32px, 4vw, 44px); margin: 14px 0 14px; letter-spacing: -0.025em; }
.lesson-hero .meta { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--muted); font-size: 14px; margin-bottom: 18px; }
.lesson-hero .meta span { display: inline-flex; align-items: center; gap: 6px; }
.lesson-hero .meta svg { width: 15px; height: 15px; }
.prose h2 { font-size: 30px; margin: 56px 0 14px; }
.prose h3 { font-size: 22px; margin: 34px 0 10px; }
.prose h4 { font-size: 18px; margin: 24px 0 8px; font-family: var(--sans); font-weight: 600; letter-spacing: 0; }
.prose p, .prose ul, .prose ol, .prose table, .prose pre, .prose blockquote, .prose details { margin: 0 0 18px; }
.prose ul, .prose ol { padding-inline-start: 1.4em; }
.prose li { margin: 0 0 6px; }
.prose li > ul, .prose li > ol { margin: 6px 0 0; }
.prose strong { font-weight: 650; color: var(--fg); }
.prose hr { border: 0; border-top: 1px solid var(--rule); margin: 36px 0; }
.prose blockquote { border-inline-start: 3px solid var(--rule-2); padding-block: 2px; padding-inline: 18px 0; color: var(--fg-2); }
.header-anchor { opacity: 0; margin-inline-start: 8px; font-family: var(--sans); font-size: 0.7em; color: var(--muted); text-decoration: none; }
h2:hover .header-anchor, h3:hover .header-anchor { opacity: 1; }
.prose :not(pre) > code { background: var(--code-bg); padding: 0.1em 0.35em; border-radius: 4px; font-size: 0.86em; }
.prose table { border-collapse: collapse; width: 100%; font-size: 15px; display: block; overflow-x: auto; }
.prose th, .prose td { text-align: start; padding: 9px 12px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.prose th { font-weight: 600; color: var(--fg-2); border-bottom-color: var(--rule-2); white-space: nowrap; }
.math-display { overflow-x: auto; overflow-y: hidden; margin: 0 0 18px; padding: 4px 0; }
.math-display .katex-display { margin: 0.4em 0; }
.katex { font-size: 1.07em; }

/* code */
pre.code { position: relative; background: var(--code-bg); border: 1px solid var(--rule); border-radius: 8px; padding: 14px 16px; overflow-x: auto; line-height: 1.55; font-size: 14px; }
pre.code .copy { position: absolute; top: 8px; right: 8px; font: 500 12px var(--sans); padding: 3px 9px; border-radius: 6px; border: 1px solid var(--rule-2); background: var(--panel); color: var(--muted); cursor: pointer; opacity: 0; transition: opacity 0.15s; }
pre.code:hover .copy, pre.code .copy:focus-visible { opacity: 1; }
.code .tok-c, .code .tok-c1, .code .tok-cm, .code .tok-ch, .code .tok-sd { color: #7a8077; font-style: italic; }
.code .tok-k, .code .tok-kn, .code .tok-kd, .code .tok-kc, .code .tok-ow, .code .tok-kr { color: #9b3d8c; }
.code .tok-s, .code .tok-s1, .code .tok-s2, .code .tok-sa, .code .tok-se, .code .tok-si { color: #2d7d3b; }
.code .tok-mi, .code .tok-mf, .code .tok-m, .code .tok-il { color: #b5521e; }
.code .tok-nf, .code .tok-fm { color: #2861b5; }
.code .tok-nb, .code .tok-bp { color: #157a7a; }
.code .tok-nn, .code .tok-nc { color: #2861b5; }
:root[data-theme="dark"] .code .tok-k, :root[data-theme="dark"] .code .tok-kn, :root[data-theme="dark"] .code .tok-kc, :root[data-theme="dark"] .code .tok-ow { color: #d897cc; }
:root[data-theme="dark"] .code .tok-s, :root[data-theme="dark"] .code .tok-s1, :root[data-theme="dark"] .code .tok-s2 { color: #8ccf8f; }
:root[data-theme="dark"] .code .tok-mi, :root[data-theme="dark"] .code .tok-mf { color: #f0a473; }
:root[data-theme="dark"] .code .tok-nf, :root[data-theme="dark"] .code .tok-nn, :root[data-theme="dark"] .code .tok-nc { color: #86b4f0; }
:root[data-theme="dark"] .code .tok-nb, :root[data-theme="dark"] .code .tok-bp { color: #6fd0cf; }
:root[data-theme="dark"] .code .tok-c, :root[data-theme="dark"] .code .tok-c1 { color: #8d968b; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .code .tok-k, :root:not([data-theme="light"]) .code .tok-kn, :root:not([data-theme="light"]) .code .tok-kc, :root:not([data-theme="light"]) .code .tok-ow { color: #d897cc; }
  :root:not([data-theme="light"]) .code .tok-s, :root:not([data-theme="light"]) .code .tok-s1, :root:not([data-theme="light"]) .code .tok-s2 { color: #8ccf8f; }
  :root:not([data-theme="light"]) .code .tok-mi, :root:not([data-theme="light"]) .code .tok-mf { color: #f0a473; }
  :root:not([data-theme="light"]) .code .tok-nf, :root:not([data-theme="light"]) .code .tok-nn, :root:not([data-theme="light"]) .code .tok-nc { color: #86b4f0; }
  :root:not([data-theme="light"]) .code .tok-nb, :root:not([data-theme="light"]) .code .tok-bp { color: #6fd0cf; }
  :root:not([data-theme="light"]) .code .tok-c, :root:not([data-theme="light"]) .code .tok-c1 { color: #8d968b; }
}

/* callouts */
.callout { --k: var(--callout-note); border: 1px solid color-mix(in srgb, var(--k) 30%, var(--rule)); border-inline-start: 3px solid var(--k); background: color-mix(in srgb, var(--k) 6%, var(--bg)); border-radius: 8px; padding: 14px 18px 4px; margin: 0 0 22px; }
.callout-title { font-size: 13px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--k); margin-bottom: 6px; }
.callout p, .callout ul, .callout ol { margin-bottom: 12px; }
.callout-tip { --k: var(--callout-tip); }
.callout-warn { --k: var(--callout-warn); }
.callout-key { --k: var(--callout-key); }
.callout-predict { --k: var(--callout-predict); }

/* reveal answers and proofs */
.prose details { border: 1px solid var(--rule); border-radius: 8px; background: var(--panel); padding: 0 16px; }
.prose details > summary { cursor: pointer; padding: 10px 0; font-weight: 600; font-size: 15px; color: var(--accent); list-style: none; display: flex; align-items: center; gap: 8px; }
.prose details > summary::-webkit-details-marker { display: none; }
.prose details > summary::before { content: ""; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform 0.15s; margin-inline-start: 2px; }
.prose details[open] > summary::before { transform: rotate(45deg); }
.prose details[open] { padding-bottom: 6px; }
.prose li details { margin: 8px 0 4px; }
details.proof > summary { color: var(--fg-2); }

/* ------------------------------------------------------------------ figures */
.widget { margin: 30px 0 34px; }
.widget-mount { border: 1px solid var(--rule); border-radius: var(--radius); background: var(--panel); padding: 18px; min-height: 120px; position: relative; }
.widget-loading { color: var(--muted); font-size: 14px; }
.widget figcaption, .video figcaption { font-size: 14.5px; line-height: 1.55; color: var(--muted); margin-top: 10px; }
.widget figcaption p { margin: 0 0 6px; }
.widget-error { color: var(--callout-warn); font-size: 14px; }

/* shared widget UI (see static/js/lib/ui.js) */
.w { display: flex; flex-direction: column; gap: 14px; font-size: 15px; }
.w-cols { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.w-cols > * { min-width: 0; }
@media (max-width: 640px) { .w-cols { grid-template-columns: 1fr; } }
.w-stage { position: relative; width: 100%; }
.w-stage svg { display: block; width: 100%; height: auto; touch-action: none; user-select: none; -webkit-user-select: none; }
.w-controls { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; }
.w-controls.col { flex-direction: column; align-items: stretch; flex-wrap: nowrap; min-width: 0; }
.w-label { font-size: 13px; color: var(--muted); }
.w-hint { font-size: 13px; color: var(--muted); }
.w-readout { font-size: 15px; line-height: 1.6; color: var(--fg-2); }
.w-readout .katex { font-size: 1.04em; }
.w-big { font-family: var(--serif); font-size: 26px; color: var(--fg); line-height: 1.1; }
.w-kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; align-items: baseline; font-size: 14px; }
.w-kv dt { color: var(--muted); }
.w-kv dd { margin: 0; font-variant-numeric: tabular-nums; color: var(--fg); }
.w-btn { font: 500 13px/1.2 var(--sans); padding: 7px 12px; border-radius: 7px; border: 1px solid var(--rule-2); background: var(--bg); color: var(--fg); cursor: pointer; }
.w-btn:hover { border-color: var(--accent); }
.w-btn[aria-pressed="true"], .w-seg button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.w-seg { display: inline-flex; border: 1px solid var(--rule-2); border-radius: 8px; overflow: hidden; flex-wrap: wrap; }
.w-seg button { font: 500 13px/1.2 var(--sans); padding: 7px 11px; border: 0; background: var(--bg); color: var(--fg-2); cursor: pointer; }
.w-seg button + button { border-left: 1px solid var(--rule-2); }
.w-seg button:hover { color: var(--fg); }
.w-slider { display: grid; grid-template-columns: auto minmax(90px, 1fr) 3.6em; align-items: center; gap: 10px; font-size: 14px; min-width: 200px; flex: 1; }
.w-slider input[type="range"] { width: 100%; accent-color: var(--accent); }
.w-slider output { font-variant-numeric: tabular-nums; color: var(--fg); text-align: right; font-family: var(--mono); font-size: 13px; }
.w-matrix { display: inline-grid; gap: 4px; padding: 6px 10px; position: relative; vertical-align: middle; align-self: flex-start; width: max-content; max-width: 100%; }
.w-matrix::before, .w-matrix::after { content: ""; position: absolute; top: 0; bottom: 0; width: 7px; border: 1.5px solid var(--ink-2); }
.w-matrix::before { left: 0; border-right: 0; border-radius: 3px 0 0 3px; }
.w-matrix::after { right: 0; border-left: 0; border-radius: 0 3px 3px 0; }
.w-matrix input, .w-matrix span { width: 4.4em; font: 14px/1.3 var(--mono); text-align: center; padding: 4px 2px; border-radius: 5px; border: 1px solid transparent; background: transparent; color: var(--fg); font-variant-numeric: tabular-nums; }
.w-matrix input { border-color: var(--rule); background: var(--bg); }
.w-matrix input:focus { outline: none; border-color: var(--accent); }
.w-matrix .c1 { color: var(--c1); } .w-matrix .c2 { color: var(--c2); } .w-matrix .c3 { color: var(--c3); }
.w-matrix .c4 { color: var(--c4); } .w-matrix .c5 { color: var(--c5); } .w-matrix .c6 { color: var(--c6); }
.w-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--fg-2); }
.w-legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 6px; background: currentColor; }
.w-badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--panel-2); color: var(--fg-2); }
.w-badge.good { background: color-mix(in srgb, var(--c3) 18%, transparent); color: var(--callout-tip); }
.w-badge.bad { background: color-mix(in srgb, var(--c2) 18%, transparent); color: var(--callout-warn); }

/* colour words in TeX and text to match figures: \htmlClass{c2}{a_1} or <span class="c2"> */
.prose .c1, .w .c1, figcaption .c1 { color: var(--c1); } .prose .c2, .w .c2, figcaption .c2 { color: var(--c2); }
.prose .c3, .w .c3, figcaption .c3 { color: var(--c3); } .prose .c4, .w .c4, figcaption .c4 { color: var(--c4); }
.prose .c5, .w .c5, figcaption .c5 { color: var(--c5); } .prose .c6, .w .c6, figcaption .c6 { color: var(--c6); }

/* SVG figure classes (static/js/lib/plane.js and friends) */
.fig text { font-family: var(--sans); font-size: 13px; fill: var(--ink-2); }
.fig .grid { stroke: var(--grid); stroke-width: 1; }
.fig .grid-major { stroke: var(--grid-major); stroke-width: 1; }
.fig .axis { stroke: var(--axis); stroke-width: 1.4; }
.fig .tick { font-size: 11px; fill: var(--muted); }
.fig .c1 { color: var(--c1); } .fig .c2 { color: var(--c2); } .fig .c3 { color: var(--c3); }
.fig .c4 { color: var(--c4); } .fig .c5 { color: var(--c5); } .fig .c6 { color: var(--c6); }
.fig .ink { color: var(--ink); } .fig .ink2 { color: var(--ink-2); } .fig .accent { color: var(--accent); } .fig .mutedc { color: var(--axis); }
.fig .stroke { stroke: currentColor; fill: none; }
.fig .fill { fill: currentColor; stroke: none; }
.fig .soft { fill: currentColor; fill-opacity: 0.14; stroke: currentColor; stroke-opacity: 0.55; }
.fig .label { fill: currentColor; font-weight: 600; font-size: 14px; paint-order: stroke; stroke: var(--panel); stroke-width: 4px; stroke-linejoin: round; }
.fig .handle { fill: currentColor; stroke: var(--panel); stroke-width: 2.5; cursor: grab; }
.fig .handle-hit { fill: transparent; cursor: grab; }
.fig .handle-hit:hover + .handle, .fig .dragging .handle { r: 9; }
.fig .dashed { stroke-dasharray: 5 5; }
.fig .thin { stroke-width: 1.2; }
.fig .thick { stroke-width: 2.6; }
.fig .faint { opacity: 0.45; }

/* ------------------------------------------------------------------ video, colab, nav */
.video { margin: 22px 0 26px; }
.video-play { all: unset; box-sizing: border-box; cursor: pointer; display: flex; align-items: center; gap: 16px; width: 100%; padding: 14px 16px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--panel); }
.video-play:hover { border-color: var(--accent); }
.video-play:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.video-icon { flex: none; width: 54px; height: 38px; border-radius: 9px; background: var(--accent); position: relative; }
.video-icon::after { content: ""; position: absolute; left: 22px; top: 11px; border-left: 15px solid var(--bg); border-top: 8px solid transparent; border-bottom: 8px solid transparent; }
.video-text { display: flex; flex-direction: column; min-width: 0; }
.video-title { font-weight: 600; color: var(--fg); line-height: 1.35; }
.video-by { font-size: 14px; color: var(--muted); }
.video iframe { width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: var(--radius); display: block; background: #000; }
.colab-card { display: grid; grid-template-columns: auto 1fr; gap: 6px 18px; align-items: center; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--panel); padding: 18px 20px; margin: 0 0 22px; }
.colab-card .ci { grid-row: span 2; width: 44px; height: 44px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; }
.colab-card .ci svg { width: 24px; height: 24px; }
.colab-card b { font-size: 17px; }
.colab-card .btn-row { grid-column: 2; margin-top: 6px; }
.colab-card p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.5; }
.lesson-end { margin-top: 56px; padding-top: 26px; border-top: 1px solid var(--rule); display: flex; flex-direction: column; gap: 22px; }
.done-toggle[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--fg); }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.pager a { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border: 1px solid var(--rule); border-radius: var(--radius); text-decoration: none; color: var(--fg); background: var(--panel); }
.pager a:hover { border-color: var(--accent); }
.pager a.next { text-align: end; grid-column: 2; }
.pager small { color: var(--muted); font-size: 13px; }
.pager span { font-weight: 600; line-height: 1.35; }
@media (max-width: 560px) { .pager { grid-template-columns: 1fr; } .pager a.next { grid-column: 1; } }

/* gallery */
.gallery { display: grid; grid-template-columns: minmax(0, 1fr); gap: 36px; max-width: 860px; margin-inline: auto; }
.gallery > div { min-width: 0; }
.gallery-group { font-family: var(--serif); font-size: 26px; margin: 28px 0 -12px; padding-top: 18px; border-top: 1px solid var(--rule); }
.gallery-jump { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 14px; max-width: 860px; margin: 0 auto 8px; }
.gallery-jump a { color: var(--muted); }
.gallery .widget { margin: 0; }
.gallery .from { font-size: 13px; color: var(--muted); margin-top: 6px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* ------------------------------------------------------------------ figure helpers (added after review) */
.w .mutedc, .w-legend .mutedc, figcaption .mutedc { color: var(--muted); }
.w-matrix { overflow-x: auto; }
/* figures are drawn in viewBox units and shrink on phones; raise the text size there */
@media (max-width: 640px) {
  .fig text { font-size: 17px; }
  .fig .tick { font-size: 14px; }
  .fig .label { font-size: 18px; }
  .widget-mount { padding: 12px; }
}
.w svg.fig { display: block; width: 100%; height: auto; }
.w-btn:disabled, .w-seg button:disabled { opacity: 0.45; cursor: not-allowed; }

/* sideways-scrolling tables and equations get soft edge shadows while there is more to see */
.prose table, .math-display {
  background:
    linear-gradient(to right, var(--bg) 40%, transparent) left center / 28px 100% no-repeat local,
    linear-gradient(to left, var(--bg) 40%, transparent) right center / 28px 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%, color-mix(in srgb, var(--fg) 22%, transparent), transparent) left center / 12px 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, color-mix(in srgb, var(--fg) 22%, transparent), transparent) right center / 12px 100% no-repeat scroll;
}
.callout .math-display, .callout table, details .math-display, details table { background: none; }

.track-card .pill { align-self: flex-start; }
.nowrap { white-space: nowrap; }
@media (max-width: 560px) { .prose table { font-size: 14px; } .prose th, .prose td { padding: 7px 8px; } }

/* ================================================================== v2: new components */
@font-face { font-family: "Vazirmatn"; src: url(/fonts/vazirmatn.woff2) format("woff2"); font-weight: 300 700; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EFD-10EFF, U+1EE00-1EEFF; }
:root { --c-plain: #1b8a63; --c-summary: #2e6256; --c-example: #6250d6; }
:root[data-theme="dark"] { --c-plain: #4cc497; --c-summary: #a4c8b4; --c-example: #a69bf0; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --c-plain: #4cc497; --c-summary: #a4c8b4; --c-example: #a69bf0; } }
.callout-plain { --k: var(--c-plain); }
.callout-summary { --k: var(--c-summary); }
.callout-example { --k: var(--c-example); }
.callout-summary ul { margin-bottom: 10px; }

/* folds: proofs and deeper material, closed by default */
.prose details.fold { border-style: dashed; }
.prose details.fold-deeper > summary { color: var(--fg-2); }
.fold-body { padding-top: 4px; }

/* level badges */
.lvl { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--rule-2); color: var(--muted); }
.lvl-beginner { color: var(--callout-tip); border-color: color-mix(in srgb, var(--callout-tip) 45%, transparent); }
.lvl-intermediate { color: var(--callout-note); border-color: color-mix(in srgb, var(--callout-note) 45%, transparent); }
.lvl-advanced { color: var(--callout-warn); border-color: color-mix(in srgb, var(--callout-warn) 45%, transparent); }

/* quiz */
.quiz { border: 1px solid var(--rule); border-radius: var(--radius); background: var(--panel); padding: 16px 18px; margin: 0 0 22px; }
.quiz-head { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); margin-bottom: 6px; }
.quiz-q p { margin-bottom: 10px; }
.quiz-opts { list-style: none; padding: 0 !important; margin: 0 0 6px; display: grid; gap: 8px; }
.quiz-opt { all: unset; box-sizing: border-box; display: flex; gap: 10px; align-items: flex-start; width: 100%; padding: 9px 12px; border: 1px solid var(--rule-2); border-radius: 8px; background: var(--bg); cursor: pointer; line-height: 1.5; }
.quiz-opt:hover { border-color: var(--accent); }
.quiz-opt:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.quiz-mark { flex: none; width: 18px; height: 18px; margin-top: 3px; border-radius: 50%; border: 2px solid var(--rule-2); }
.quiz-opt.chosen .quiz-mark { border-color: var(--fg-2); background: var(--fg-2); }
.quiz.is-right .quiz-opt.chosen { border-color: var(--callout-tip); background: color-mix(in srgb, var(--callout-tip) 10%, var(--bg)); }
.quiz.is-right .quiz-opt.chosen .quiz-mark { border-color: var(--callout-tip); background: var(--callout-tip); }
.quiz.is-wrong .quiz-opt.chosen { border-color: var(--callout-warn); background: color-mix(in srgb, var(--callout-warn) 10%, var(--bg)); }
.quiz.is-wrong .quiz-opt.chosen .quiz-mark { border-color: var(--callout-warn); background: var(--callout-warn); }
.quiz-opt.tried:not(.chosen) { opacity: 0.7; }
.quiz-verdict { font-weight: 700; margin: 8px 0 4px !important; }
.quiz.is-right .quiz-verdict { color: var(--callout-tip); }
.quiz.is-wrong .quiz-verdict { color: var(--callout-warn); }
.quiz-why { font-size: 15.5px; color: var(--fg-2); }
.quiz-why p { margin-bottom: 8px; }

/* recall cards */
.cards { border: 1px solid var(--rule); border-radius: var(--radius); padding: 16px 18px; margin: 0 0 24px; background: color-mix(in srgb, var(--accent) 4%, var(--bg)); }
.cards-head { display: flex; flex-direction: column; gap: 2px; margin-bottom: 10px; }
.cards-head b { font-size: 13px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.cards-head span { font-size: 14px; color: var(--muted); }
.card-list { list-style: none; padding: 0 !important; margin: 0; display: grid; gap: 10px; counter-reset: card; }
.card { background: var(--panel); border: 1px solid var(--rule); border-radius: 8px; padding: 10px 14px; counter-increment: card; }
.card-q { font-weight: 600; }
.card-q p, .card-a p { margin-bottom: 6px; }
.card-reveal { all: unset; cursor: pointer; font-size: 13.5px; color: var(--accent); }
.card-reveal:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
.card-reveal.open { opacity: 0.6; }
.card-a { margin-top: 6px; padding-top: 8px; border-top: 1px dashed var(--rule-2); color: var(--fg-2); }
.cards-foot { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; margin-top: 12px; font-size: 14px; }
.btn:disabled { opacity: 0.6; cursor: default; }
.btn-quiet { border-color: transparent; color: var(--muted); background: transparent; }

/* review page */
.due-badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; margin-inline-start: 5px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: var(--bg); font-size: 11px; font-weight: 700; vertical-align: 1px; }
.review-stats { color: var(--muted); font-size: 15px; margin: 6px 0 0; }
.review-stage { margin: 22px 0 40px; }
.review-card { border: 1px solid var(--rule-2); border-radius: var(--radius); background: var(--panel); padding: 22px 24px; display: flex; flex-direction: column; gap: 14px; box-shadow: var(--shadow); }
.review-card .card-q { font-size: 19px; }
.review-card .card-a { font-size: 17px; }
.review-from { font-size: 13px; color: var(--muted); }
.review-rate { display: flex; flex-wrap: wrap; gap: 8px; }
.review-msg { font-size: 18px; color: var(--fg-2); }
.review-add h2 { font-size: 22px; margin: 0 0 12px; }
.review-add .btn-row { margin-bottom: 14px; }

/* recap and glossary */
.recap-list { max-width: 820px; margin-inline: auto; }
.recap-item { border-top: 1px solid var(--rule); padding: 20px 0 6px; }
.recap-item h2 { font-size: 23px; margin: 0 0 10px; }
.recap-item h2 a { color: var(--fg); text-decoration: none; }
.recap-item h2 .n { color: var(--muted); font-variant-numeric: tabular-nums; margin-inline-end: 6px; }
.recap-item .callout { margin-bottom: 12px; }
.glossary { max-width: 860px; margin: 0 auto; }
.g-entry { padding: 12px 0; border-top: 1px solid var(--rule); scroll-margin-top: calc(var(--header-h) + 16px); }
.g-entry:target { background: var(--accent-soft); margin-inline: -12px; padding-inline: 12px; border-radius: 8px; }
.g-entry dt { font-weight: 700; font-size: 18px; }
.g-other { font-weight: 400; color: var(--muted); font-size: 16px; margin-inline-start: 8px; }
.g-entry dd { margin: 4px 0 0; color: var(--fg-2); }
.g-lesson { font-size: 13.5px; margin-inline-start: 6px; white-space: nowrap; }
.page-lede { color: var(--fg-2); font-size: 18px; margin: 0; }
.track-card.mini { min-height: 0; }
.track-card.mini h3 { font-size: 20px; }
.pending-note { margin-top: 24px; }
.video-note { font-size: 14px; color: var(--fg-2); margin-top: 6px; }
.track-group { margin-bottom: 48px; }

/* header additions */
.lang-btn { width: auto; min-width: 36px; padding: 0 8px; font: 600 13px/1 var(--sans); text-decoration: none; }
.lang-btn:hover { color: var(--fg); }
@media (max-width: 860px) { .site-nav .nav-hide-s { display: none; } }

/* search */
dialog.search { width: min(680px, 94vw); max-height: 80vh; padding: 0; border: 1px solid var(--rule-2); border-radius: 12px; background: var(--bg); color: var(--fg); box-shadow: var(--shadow); margin-top: 10vh; }
dialog.search::backdrop { background: rgba(10, 14, 11, 0.35); backdrop-filter: blur(2px); }
.search-box { display: flex; gap: 8px; padding: 12px; border-bottom: 1px solid var(--rule); }
.search-box input { flex: 1; font: 17px var(--sans); padding: 10px 12px; border-radius: 8px; border: 1px solid var(--rule-2); background: var(--panel); color: var(--fg); }
.search-box input:focus { outline: 2px solid var(--accent); }
.search-results { list-style: none; margin: 0; padding: 6px; overflow: auto; max-height: 56vh; }
.search-results a { display: flex; flex-direction: column; gap: 2px; padding: 9px 12px; border-radius: 8px; text-decoration: none; color: var(--fg); }
.search-results a:hover, .search-results a:focus { background: var(--panel); outline: none; }
.search-results b { font-weight: 600; }
.search-results span { font-size: 14px; color: var(--fg-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.search-results small { font-size: 12px; color: var(--muted); }
.search-none { padding: 14px; color: var(--muted); }
.search-hint { font-size: 12.5px; color: var(--muted); margin: 0; padding: 8px 14px 12px; border-top: 1px solid var(--rule); }

/* ================================================================== right-to-left (Persian) */
:root[lang="fa"] { --sans: "Vazirmatn", -apple-system, BlinkMacSystemFont, "Segoe UI", Tahoma, sans-serif; --serif: "Vazirmatn", "Iowan Old Style", Georgia, serif; }
:root[lang="fa"] body { font-size: 17px; line-height: 1.9; }
:root[lang="fa"] h1, :root[lang="fa"] h2, :root[lang="fa"] h3 { letter-spacing: 0; font-weight: 600; line-height: 1.45; }
:root[lang="fa"] .eyebrow, :root[lang="fa"] .callout-title, :root[lang="fa"] .quiz-head, :root[lang="fa"] .cards-head b, :root[lang="fa"] .sidebar h2, :root[lang="fa"] .toc h2 { letter-spacing: 0; text-transform: none; }
/* math, code, figures and numbers stay left-to-right */
[dir="rtl"] .katex, [dir="rtl"] .math-inline { direction: ltr; unicode-bidi: isolate; }
[dir="rtl"] .math-display, [dir="rtl"] pre.code, [dir="rtl"] code { direction: ltr; text-align: left; }
[dir="rtl"] .math-display .katex-display { text-align: center; }
[dir="rtl"] .widget-mount { direction: ltr; }
[dir="rtl"] .widget-mount .w-readout, [dir="rtl"] .widget-mount .w-hint, [dir="rtl"] .widget-mount .w-label, [dir="rtl"] .widget-mount p { unicode-bidi: plaintext; text-align: start; }
[dir="rtl"] .widget figcaption { direction: rtl; }
[dir="rtl"] .brand { direction: ltr; }
[dir="rtl"] .sidebar { transform: translateX(102%); }
[dir="rtl"] body.nav-open .sidebar { transform: none; }
@media (min-width: 921px) { [dir="rtl"] .sidebar { transform: none; } }
[dir="rtl"] .prose details > summary::before { transform: rotate(135deg); }
[dir="rtl"] .prose details[open] > summary::before { transform: rotate(45deg); }
[dir="rtl"] pre.code .copy { right: auto; left: 8px; }
[dir="rtl"] .video-icon::after { left: 22px; }
[dir="rtl"] .search-box input { direction: rtl; }
[dir="rtl"] .lesson-row .n, [dir="rtl"] .sidebar a .k { font-variant-numeric: normal; }
:root[lang="fa"] .prose ol, :root[lang="fa"] ol.quiz-opts { list-style-type: persian; }
[hidden] { display: none !important; }
.lang-btn { font-family: "Vazirmatn", var(--sans); }
:root[lang="fa"] em, :root[lang="fa"] i { font-style: normal; }
:root[lang="fa"] .home-hero h1 em { font-weight: 700; }
/* pilot fixes (2026-11-11) */
[dir="rtl"] code { unicode-bidi: isolate; }
.gloss { unicode-bidi: isolate; white-space: nowrap; font-size: 0.92em; color: var(--fg-2); }
.sidebar h2 a { display: inline; color: inherit; text-decoration: none; padding: 0; margin: 0; }
:lang(fa) { font-family: "Vazirmatn", var(--sans); }
:root[lang="fa"] .prose em { font-weight: 600; }
.lesson-row.pending { opacity: 0.6; cursor: default; }
.lesson-row.pending:hover { background: none; }
[dir="rtl"] .widget-mount .w-seg { direction: rtl; }
.sitepage .prose { max-width: 1040px; }
.sitepage .widget { max-width: 1040px; }

/* ================================================================== concept map, dashboard, backup, offline (platform) */
@media (max-width: 560px) { .site-nav .nav-map { display: none; } }

/* concept map */
.map-head { padding-top: 32px; }
.map-head h1 { font-size: clamp(32px, 4vw, 44px); margin: 12px 0 8px; }
.map-head .page-lede { font-size: 16.5px; max-width: 48em; }
.map-tools { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: flex-start; margin-block: 18px 12px; }
.map-find { display: flex; align-items: center; gap: 10px; flex: 0 1 300px; min-width: 200px; }
.map-search { width: 100%; min-width: 0; font: 15px var(--sans); padding: 7px 12px; border-radius: 8px; border: 1px solid var(--rule-2); background: var(--panel); color: var(--fg); }
.map-search:focus { outline: 2px solid var(--accent); outline-offset: 0; }
.map-found { font-size: 13px; white-space: nowrap; }
.map-chips { display: flex; flex-wrap: wrap; gap: 6px; flex: 1 1 420px; min-width: 0; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 6px; font: 500 13px/1.2 var(--sans); padding: 6px 11px; border-radius: 999px; border: 1px solid var(--rule-2); background: var(--panel); color: var(--fg-2); cursor: pointer; white-space: nowrap; }
.chip:hover { border-color: var(--accent); }
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--fg); }
.chip i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.chip i.g-math { background: var(--c1); } .chip i.g-ml { background: var(--c4); } .chip i.g-applied { background: var(--c3); }
@media (max-width: 720px) {
  .map-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; padding-bottom: 6px; flex-basis: 100%; }
  .map-find { flex-basis: 100%; }
}
.map-frame { position: relative; height: clamp(420px, calc(100svh - var(--header-h) - 96px), 980px); border-block: 1px solid var(--rule); background-color: var(--panel-2); background-image: radial-gradient(var(--grid-major) 1px, transparent 1.2px); background-size: 24px 24px; overflow: hidden; }
.map-svg { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.map-svg.dragging, .map-svg.dragging a { cursor: grabbing; }
.map-svg a { cursor: pointer; text-decoration: none; }
.map-svg a:focus { outline: none; }
.map-svg text { font-family: var(--sans); }
.mn-box { fill: var(--panel); stroke: var(--rule-2); stroke-width: 1; transition: stroke 0.12s; }
.mn:hover .mn-box { stroke: var(--accent); stroke-width: 1.6; }
.mn:focus-visible .mn-box { stroke: var(--accent); stroke-width: 3; }
.mn-n { font-size: 12px; font-weight: 600; fill: var(--muted); font-variant-numeric: tabular-nums; }
.mn-t { font-size: 13px; font-weight: 500; fill: var(--fg); }
.mn.is-done .mn-box { fill: var(--accent-soft); stroke: color-mix(in srgb, var(--accent) 55%, transparent); }
.mn.is-done .mn-n { fill: var(--accent); font-size: 14px; }
.mn.is-x .mn-box { fill: color-mix(in srgb, var(--panel) 55%, transparent); stroke-dasharray: 4 3; }
.mn.is-x .mn-t { fill: var(--fg-2); }
.mn-due circle { fill: var(--c2); stroke: var(--panel-2); stroke-width: 2; }
.mn-due text { font-size: 10.5px; font-weight: 700; fill: #fff; }
.mh-t { font-size: 15px; font-weight: 600; fill: var(--fg); }
.mh-n { font-size: 12px; fill: var(--muted); }
.mh:hover .mh-t { fill: var(--accent); }
.mh-bar { fill: var(--muted); }
.mh.g-math .mh-bar { fill: var(--c1); } .mh.g-ml .mh-bar { fill: var(--c4); } .mh.g-applied .mh-bar { fill: var(--c3); }
.me { fill: none; stroke: var(--axis); stroke-width: 1.2; opacity: 0.5; }
.me.arrow { marker-end: url(#mk); opacity: 0.38; }
.mk { fill: var(--axis); }
.mk-pre { fill: var(--c1); }
.mk-next { fill: var(--c4); }
.map-svg .mn, .map-svg .me { transition: opacity 0.15s; }
.map-svg.focus .mn:not(.is-cur):not(.is-pre):not(.is-next) { opacity: 0.25; }
.map-svg.focus .me:not(.is-pre):not(.is-next) { opacity: 0.07; }
.me.is-pre, .me.is-next { stroke-width: 2.2; opacity: 1; }
.me.is-pre { stroke: var(--c1); }
.me.is-next { stroke: var(--c4); }
.me.arrow.is-pre { marker-end: url(#mk-pre); }
.me.arrow.is-next { marker-end: url(#mk-next); }
.mn.is-cur .mn-box { stroke: var(--fg); stroke-width: 2.2; }
.mn.is-pre .mn-box { stroke: var(--c1); stroke-width: 2.2; }
.mn.is-next .mn-box { stroke: var(--c4); stroke-width: 2.2; }
.map-svg.searching .mn:not(.is-hit) { opacity: 0.22; }
.map-svg.searching .me { opacity: 0.08; }
.mn.is-hit .mn-box { stroke: var(--c6); stroke-width: 2.6; }
.map-zoom { position: absolute; top: 12px; inset-inline-end: 12px; display: flex; flex-direction: column; gap: 6px; z-index: 2; }
.map-zoom .icon-btn { font: 600 19px/1 var(--sans); box-shadow: var(--shadow); }
.map-info { position: absolute; inset-inline-start: 12px; bottom: 12px; z-index: 3; width: min(350px, calc(100% - 24px)); max-height: calc(100% - 24px); overflow: auto; background: var(--bg); border: 1px solid var(--rule-2); border-radius: 10px; box-shadow: var(--shadow); padding: 14px 16px; font-size: 14.5px; line-height: 1.45; }
.map-info.at-end { inset-inline-start: auto; inset-inline-end: 64px; }
@media (max-width: 640px) { .map-info { max-height: 55%; padding: 12px 14px; } .mi-t { font-size: 17px; } }
.mi-k { font-size: 12px; color: var(--muted); padding-inline-end: 26px; }
.mi-t { display: block; font-family: var(--serif); font-size: 19px; line-height: 1.25; color: var(--fg); text-decoration: none; margin: 4px 0 6px; }
.mi-t:hover { color: var(--accent); }
.mi-s { font-size: 13px; color: var(--fg-2); }
.mi-h { font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-top: 10px; }
.map-info ul { margin: 3px 0 0; padding-inline-start: 18px; }
.map-info ul:nth-of-type(1) li::marker { color: var(--c1); }
.map-info ul:nth-of-type(2) li::marker { color: var(--c4); }
.map-info li small { color: var(--muted); }
.mi-open { margin-top: 12px; padding: 7px 14px; font-size: 14px; }
.mi-close { position: absolute; top: 8px; inset-inline-end: 8px; width: 26px; height: 26px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; font-size: 14px; }
.mi-close:hover { background: var(--panel-2); color: var(--fg); }
.map-noscript { padding: 24px; }
.map-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; font-size: 13px; color: var(--muted); margin-top: 10px; }
.lg { display: inline-block; width: 16px; height: 11px; border-radius: 3px; margin-inline-end: 6px; vertical-align: -1px; }
.lg-done { background: var(--accent-soft); border: 1px solid var(--accent); }
.lg-due { width: 11px; border-radius: 50%; background: var(--c2); }
.lg-pre { height: 3px; vertical-align: 3px; background: var(--c1); }
.lg-next { height: 3px; vertical-align: 3px; background: var(--c4); }
.lg-x { border: 1px dashed var(--muted); }
.map-hint { margin-inline-start: auto; }
@media (max-width: 720px) { .map-hint { margin-inline-start: 0; flex-basis: 100%; } }
.map-list { margin-top: 28px; }
.map-list > summary { cursor: pointer; color: var(--accent); font-size: 15px; }
.map-list h2 { font-size: 22px; margin: 22px 0 6px; }
.map-list h2 a { color: var(--fg); text-decoration: none; }
.map-list ol { font-size: 15px; line-height: 1.55; padding-inline-start: 1.6em; }
:root[lang="fa"] .mi-h { letter-spacing: 0; text-transform: none; }
:root[lang="fa"] .map-list ol { list-style-type: persian; }

/* review dashboard */
.dash { margin: 0 0 40px; padding-top: 24px; border-top: 1px solid var(--rule); }
.dash h2 { font-size: 26px; margin: 0 0 14px; }
.dash h3 { font-family: var(--sans); font-size: 14px; font-weight: 600; letter-spacing: 0; color: var(--fg-2); margin: 26px 0 10px; }
.dash-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 620px) { .dash-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.dash-tile { border: 1px solid var(--rule); border-radius: var(--radius); background: var(--panel); padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dash-tile b { font-family: var(--serif); font-weight: 400; font-size: 32px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.dash-tile span { font-size: 13.5px; color: var(--fg-2); line-height: 1.3; }
.dash-tile small { font-size: 12px; color: var(--muted); line-height: 1.3; }
.dash-bars { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 4px; height: 120px; align-items: end; border-bottom: 1px solid var(--rule-2); }
.dash-col { height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 2px; min-width: 0; }
.dash-col i { display: block; width: min(100%, 26px); background: var(--accent); border-radius: 4px 4px 0 0; }
.dash-col .v { font-size: 11.5px; line-height: 1.2; color: var(--fg-2); font-variant-numeric: tabular-nums; }
.dash-col.is-today .v { font-weight: 700; color: var(--fg); }
.dash-col:hover i { background: var(--accent-2); }
.dash-axis { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 4px; font-size: 12px; color: var(--muted); margin-top: 4px; }
.dash-axis span { white-space: nowrap; }
.dash-axis span:first-child { justify-self: start; }
.dash-axis span:nth-child(2) { justify-self: center; }
.dash-axis span:last-child { justify-self: end; }
.dash-track { display: grid; grid-template-columns: minmax(0, 230px) minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 5px 0; color: var(--fg); text-decoration: none; font-size: 15px; }
.dash-track:hover .dash-track-t { color: var(--accent); }
.dash-track .bar { margin: 0; height: 8px; }
.dash-track-n { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 4.5em; text-align: end; }
@media (max-width: 520px) { .dash-track { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; } .dash-track .bar { grid-column: 1 / -1; grid-row: 2; } }
.dash-none { font-size: 15px; margin: 0; }

/* backup and offline */
.backup { margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--rule); }
.backup h2 { font-size: 22px; margin: 0 0 8px; }
.backup > p { margin: 0 0 12px; }
.backup-msg { min-height: 1.5em; color: var(--accent); font-size: 15px; margin: 10px 0 !important; }
.backup-note { font-size: 13.5px; line-height: 1.5; }
label.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.offline-save { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 0 0 28px; padding: 14px 16px; border: 1px dashed var(--rule-2); border-radius: var(--radius); }
.offline-save p { flex-basis: 100%; margin: 0; font-size: 14px; }
.offline-status { font-size: 14px; color: var(--accent); }
.offline-save.is-saved { border-style: solid; border-color: color-mix(in srgb, var(--accent) 40%, var(--rule)); }

/* "Run in browser" (JupyterLite) note in the notebook card */
.colab-card .lite-note { grid-column: 2; font-size: 13.5px; }
