/* llmlearn.ir — one stylesheet, no framework.
   Palette from Persian tilework: lapis (primary path), turquoise (success, scores), saffron (upcoming, warnings). */

@font-face {
  font-family: "Vazirmatn";
  src: url("/static/fonts/vazirmatn-var.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
/* Persian glyphs inside code use Vazirmatn (monospace fonts render Arabic script detached); Latin stays monospace. */
@font-face {
  font-family: "Vazirmatn Code Fa";
  src: url("/static/fonts/vazirmatn-var.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0600-06FF, U+200C-200F, U+FB50-FDFF, U+FE70-FEFF;
}

:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #eef1f8;
  --ink: #16213d;
  --ink-2: #4b5878;
  --line: #dbe1ee;
  --line-strong: #b9c3da;
  --lapis: #1f3a93;
  --lapis-hover: #183077;
  --lapis-soft: #e5eafa;
  --link: #1f3a93;
  --turq: #0d8a81;
  --turq-soft: #daf2ef;
  --saffron: #9a6412;
  --saffron-fill: #e3a21a;
  --saffron-soft: #fbefd6;
  --danger: #b42318;
  --danger-soft: #fce8e6;
  --code-bg: #121a33;
  --code-ink: #e3e8f5;
  --focus: #e3a21a;
  --radius: 12px;
  --radius-sm: 8px;
  --wrap: 1180px;
  --mono: "Vazirmatn Code Fa", ui-monospace, "Cascadia Code", "JetBrains Mono", "Fira Code", Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1426; --surface: #141d36; --surface-2: #19233f; --ink: #e5e9f4; --ink-2: #a2adca;
    --line: #26314f; --line-strong: #3a4770; --lapis: #4f6fe0; --lapis-hover: #6683ec; --lapis-soft: #1d2a52;
    --link: #9db1ff; --turq: #4fd1c5; --turq-soft: #12363a; --saffron: #f2b93b; --saffron-fill: #f2b93b;
    --saffron-soft: #3a2f16; --danger: #ff8a7a; --danger-soft: #3d1c1c; --code-bg: #0a1022; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1426; --surface: #141d36; --surface-2: #19233f; --ink: #e5e9f4; --ink-2: #a2adca;
  --line: #26314f; --line-strong: #3a4770; --lapis: #4f6fe0; --lapis-hover: #6683ec; --lapis-soft: #1d2a52;
  --link: #9db1ff; --turq: #4fd1c5; --turq-soft: #12363a; --saffron: #f2b93b; --saffron-fill: #f2b93b;
  --saffron-soft: #3a2f16; --danger: #ff8a7a; --danger-soft: #3d1c1c; --code-bg: #0a1022; color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 17px/1.9 "Vazirmatn", Tahoma, sans-serif;
  text-rendering: optimizeLegibility;
  display: flex; flex-direction: column; min-height: 100vh;
}
main { flex: 1; }
h1, h2, h3, h4 { line-height: 1.45; margin: 0 0 .6em; font-weight: 750; letter-spacing: -.005em; }
h1 { font-size: clamp(1.75rem, 3.4vw, 2.4rem); }
h2 { font-size: clamp(1.3rem, 2.2vw, 1.6rem); }
h3 { font-size: 1.18rem; }
p { margin: 0 0 1em; }
a { color: var(--link); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
img { max-width: 100%; height: auto; }
code, pre, kbd { font-family: var(--mono); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--lapis-soft); }

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: 20px; }
.narrow { max-width: 62ch; }
.muted { color: var(--ink-2); }
.small { font-size: .875rem; }
.lead { font-size: 1.12rem; color: var(--ink-2); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; inset-inline-start: 12px; top: -48px; background: var(--lapis); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { top: 12px; }
.empty { padding: 1.5rem; border: 1px dashed var(--line-strong); border-radius: var(--radius); color: var(--ink-2); }
.hp { position: absolute; inset-inline-start: -9999px; }

/* ---------- buttons, badges, alerts ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .62rem 1.15rem; border-radius: 10px; border: 1.5px solid transparent;
  font: inherit; font-weight: 650; font-size: .97rem; line-height: 1.5;
  text-decoration: none; cursor: pointer; transition: background-color .15s, border-color .15s;
}
.btn-primary { background: var(--lapis); color: #fff; }
.btn-primary:hover { background: var(--lapis-hover); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn-ghost:hover { border-color: var(--lapis); color: var(--link); }
.btn-sm { padding: .35rem .8rem; font-size: .9rem; }
.btn-block { width: 100%; }
.cta-row { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; margin: 1.25rem 0; }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; border: 0; background: transparent; color: var(--ink-2); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }

.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .1rem .6rem; border-radius: 999px; font-size: .8rem; font-weight: 600; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.badge-ok { background: var(--turq-soft); color: var(--turq); }
.badge-soon { background: var(--saffron-soft); color: var(--saffron); }
.badge-lock { background: var(--lapis-soft); color: var(--link); }

.alert { padding: .8rem 1rem; border-radius: var(--radius-sm); background: var(--saffron-soft); color: var(--ink); border-inline-start: 4px solid var(--saffron-fill); }
.alert-error { background: var(--danger-soft); border-color: var(--danger); }
.alert-ok { background: var(--turq-soft); border-color: var(--turq); }

/* ---------- header ---------- */
.site-header { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.header-row { display: flex; align-items: center; gap: 1.5rem; height: 64px; }
.brand { display: flex; align-items: center; gap: .55rem; color: var(--ink); text-decoration: none; }
.brand-mark { color: var(--line-strong); }
.brand-mark .n1 { fill: var(--lapis); } .brand-mark .n2 { fill: var(--turq); } .brand-mark .n3 { fill: var(--saffron-fill); }
.brand-name { font-weight: 800; font-size: 1.2rem; letter-spacing: -.02em; font-family: "Vazirmatn", sans-serif; }
.main-nav { display: flex; gap: .25rem; }
.main-nav a { padding: .35rem .75rem; border-radius: 8px; color: var(--ink-2); text-decoration: none; font-weight: 550; }
.main-nav a:hover, .main-nav a[aria-current] { color: var(--ink); background: var(--surface-2); }
.header-tools { margin-inline-start: auto; display: flex; align-items: center; gap: .4rem; }
.site-header .search-mini input { width: 170px; padding: .38rem .75rem; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--ink); font: inherit; font-size: .9rem; }
.nav-toggle { display: none; }

/* ---------- footer ---------- */
.site-footer { margin-top: 5rem; border-top: 1px solid var(--line); padding: 2.5rem 0; background: var(--surface); }
.footer-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 1rem 3rem; }
.footer-grid nav { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; align-content: start; }
.footer-grid nav a { color: var(--ink-2); text-decoration: none; }
.footer-grid nav a:hover { color: var(--link); }
.footer-grid .small { grid-column: 1 / -1; margin: 0; }
.footer-brand { font-weight: 800; margin: 0; }

/* ---------- hero + learning path (the one bold element) ---------- */
.hero { padding: clamp(3rem, 8vw, 6rem) 0 3.5rem; }
.hero-title { font-size: clamp(2.1rem, 5.6vw, 3.9rem); line-height: 1.3; font-weight: 850; max-width: 17ch; margin-bottom: .4em; letter-spacing: -.02em; }
.hero .lead { font-size: clamp(1.05rem, 1.6vw, 1.25rem); max-width: 56ch; }

.path { list-style: none; margin: 3.5rem 0 0; padding: 0; display: flex; }
.path-node { flex: 1; position: relative; text-align: center; min-width: 0; }
.path-node:not(:last-child)::after {
  content: ""; position: absolute; top: 25px; inset-inline-start: calc(50% + 30px); width: calc(100% - 60px); height: 3px; border-radius: 2px;
  background: repeating-linear-gradient(to left, var(--line-strong) 0 7px, transparent 7px 13px);
}
.path-node.is-ready:not(:last-child)::after { background: linear-gradient(to left, var(--lapis), var(--line-strong)); }
.path-node a { display: flex; flex-direction: column; align-items: center; gap: .35rem; text-decoration: none; color: var(--ink); padding: 0 .25rem; }
.node-dot { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; border: 2.5px dashed var(--line-strong); background: var(--bg); color: #fff; transition: transform .2s; }
.is-ready .node-dot { border: 0; background: var(--lapis); box-shadow: 0 0 0 7px var(--lapis-soft); }
.path-node a:hover .node-dot { transform: scale(1.07); }
.node-name { font-weight: 750; font-size: 1.02rem; margin-top: .5rem; }
.node-state { font-size: .84rem; color: var(--ink-2); }
.is-soon .node-state { color: var(--saffron); }
.is-soon .node-name { color: var(--ink-2); }

@media (prefers-reduced-motion: no-preference) {
  .page-home .path-node { animation: node-in .5s both cubic-bezier(.2, .7, .3, 1); }
  .page-home .path-node:nth-child(2) { animation-delay: .07s; } .page-home .path-node:nth-child(3) { animation-delay: .14s; }
  .page-home .path-node:nth-child(4) { animation-delay: .21s; } .page-home .path-node:nth-child(5) { animation-delay: .28s; }
  .page-home .path-node:nth-child(6) { animation-delay: .35s; } .page-home .path-node:nth-child(7) { animation-delay: .42s; }
  @keyframes node-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
}

/* ---------- home sections ---------- */
.band { background: var(--surface); border-block: 1px solid var(--line); padding: 3.5rem 0; }
.band-quiet { background: transparent; border: 0; }
.kicker { color: var(--turq); font-weight: 700; font-size: .95rem; margin-bottom: .3rem; }
.featured { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 3rem; align-items: start; }
.featured h2 a { color: inherit; text-decoration: none; }
.featured h2 a:hover { color: var(--link); }
.stats { display: flex; flex-wrap: wrap; gap: 1.6rem; margin: 1.5rem 0; }
.stats div { display: flex; flex-direction: column-reverse; }
.stats dt { font-size: .85rem; color: var(--ink-2); }
.stats dd { margin: 0; font-size: 1.45rem; font-weight: 800; line-height: 1.4; }
.stats-inline { margin: 1rem 0 0; gap: 2rem; }
.stats-inline dd { font-size: 1.1rem; }
.featured-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.featured-list li + li { border-top: 1px solid var(--line); }
.featured-list a { display: grid; grid-template-columns: 2.2rem 1fr; gap: 0 .5rem; padding: .85rem 1.1rem; color: var(--ink); text-decoration: none; }
.featured-list a:hover { background: var(--surface-2); }
.fl-num { grid-row: span 2; font-weight: 800; color: var(--lapis); font-size: 1.15rem; }
.fl-title { font-weight: 650; }
.fl-type { font-size: .85rem; color: var(--ink-2); display: flex; align-items: center; gap: .3rem; }
.ti { flex: none; vertical-align: -3px; }

.how { padding-block: 4rem 1rem; }
.steps { list-style: none; counter-reset: s; padding: 0; margin: 2rem 0 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 2rem; }
.steps li { counter-increment: s; position: relative; padding-top: 3.3rem; }
.steps li::before { content: counter(s, persian); position: absolute; top: 0; inset-inline-start: 0; font-size: 2.6rem; font-weight: 850; line-height: 1; color: var(--turq); }
.steps li:not(:last-child)::after { content: ""; position: absolute; top: 1.3rem; inset-inline-start: 2.6rem; inset-inline-end: -1rem; border-top: 2px dotted var(--line-strong); }
.steps h3 { margin-bottom: .3rem; }
.steps p { color: var(--ink-2); margin: 0; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1.2rem; }
.section-head h2 { margin: 0; }
.recent { padding-top: 3rem; }
.recent-list { list-style: none; padding: 0; margin: 0; columns: 2; column-gap: 3rem; }
.recent-list li { break-inside: avoid; padding: .55rem 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; }
.recent-list a { font-weight: 600; text-decoration: none; color: var(--ink); }
.recent-list a:hover { color: var(--link); }

.author { padding-top: 3.5rem; }
.author-card { display: flex; gap: 1.5rem; align-items: flex-start; padding: 1.8rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); max-width: 760px; }
.author-card img, .avatar { width: 88px; height: 88px; border-radius: 50%; flex: none; object-fit: cover; }
.avatar { display: grid; place-items: center; background: var(--lapis); color: #fff; font-size: 2rem; font-weight: 800; }
.author-card h2 { font-size: 1.25rem; margin-bottom: .3rem; }
.author-card p { color: var(--ink-2); }

/* books */
.book-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1.5rem; }
.book-tile { max-width: 200px; display: flex; flex-direction: column; gap: .3rem; color: var(--ink); text-decoration: none; }
.book-tile img { border-radius: 4px 8px 8px 4px; box-shadow: 0 6px 18px -8px rgb(22 33 61 / .45); }
.book-tile-title { font-weight: 650; line-height: 1.6; margin-top: .4rem; }
.book-tile-orig { font-size: .8rem; color: var(--ink-2); text-align: right; }
.book-spine { aspect-ratio: 1 / 1.41; display: flex; align-items: flex-end; padding: 1rem; border-radius: 4px 10px 10px 4px; color: #fff; font-weight: 750; line-height: 1.6;
  background: linear-gradient(160deg, var(--lapis) 0%, #14275f 70%); border-inline-end: 6px solid var(--saffron-fill); }
.book-spine-lg { font-size: 1.3rem; width: 100%; max-width: 260px; }

/* ---------- page heads, crumbs ---------- */
.page-head { padding-top: 2.2rem; padding-bottom: 1rem; }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: .2rem; padding: 0; margin: 0 0 .8rem; font-size: .88rem; color: var(--ink-2); }
.crumbs li:not(:last-child)::after { content: "‹"; margin-inline: .45rem; color: var(--line-strong); }
.crumbs a { color: var(--ink-2); text-decoration: none; }
.crumbs a:hover { color: var(--link); text-decoration: underline; }

/* ---------- course list ---------- */
.course-list { list-style: none; padding: 0; margin: 1rem 0 0; position: relative; }
.course-item { display: grid; grid-template-columns: 34px 1fr; gap: 1.2rem; position: relative; padding-bottom: 2.2rem; }
.course-item:not(:last-child)::before { content: ""; position: absolute; top: 34px; bottom: 0; inset-inline-start: 16px; border-inline-start: 2.5px dashed var(--line-strong); }
.course-item.is-ready:not(:last-child)::before { border-inline-start-style: solid; border-color: var(--lapis); }
.ci-node { width: 34px; height: 34px; border-radius: 50%; border: 2.5px dashed var(--line-strong); background: var(--bg); margin-top: .35rem; }
.is-ready .ci-node { border: 0; background: var(--lapis); box-shadow: 0 0 0 5px var(--lapis-soft); }
.ci-body h2 { margin-bottom: .2rem; }
.ci-body h2 a { color: inherit; text-decoration: none; }
.ci-body h2 a:hover { color: var(--link); }
.is-soon .ci-body h2 { color: var(--ink-2); }
.ci-body p { max-width: 70ch; color: var(--ink-2); margin-bottom: .4rem; }
.ci-meta { display: flex; flex-wrap: wrap; gap: .3rem 1.1rem; font-size: .9rem; }

/* ---------- course page ---------- */
.course-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 3rem; align-items: start; margin-top: 1.5rem; }
.course-syllabus { position: sticky; top: 84px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem 1rem; max-height: calc(100vh - 100px); overflow: auto; }
.course-syllabus h2 { font-size: 1.1rem; padding-inline: .5rem; }

/* syllabus (shared) */
.syllabus, .syl-lessons { list-style: none; margin: 0; padding: 0; }
.syl-section + .syl-section { margin-top: 1rem; }
.syl-title { font-size: .82rem; font-weight: 700; color: var(--ink-2); margin: 0 0 .25rem; padding-inline: .5rem; }
.syl-lessons a { display: grid; grid-template-columns: 1.6rem 1fr auto; align-items: center; gap: .4rem; padding: .42rem .5rem; border-radius: 8px; color: var(--ink); text-decoration: none; font-size: .93rem; line-height: 1.6; }
.syl-lessons a:hover { background: var(--surface-2); }
.syl-lessons .is-current a { background: var(--lapis-soft); color: var(--link); font-weight: 650; }
.syl-num { color: var(--ink-2); font-size: .85rem; font-weight: 700; }
.syl-meta { display: flex; align-items: center; gap: .3rem; color: var(--ink-2); }
.nb-chip { font-size: .72rem; font-weight: 700; padding: 0 .45rem; border-radius: 6px; background: var(--saffron-soft); color: var(--saffron); }
.nb-chip.is-done { background: var(--turq-soft); color: var(--turq); }

/* ---------- lesson page ---------- */
.lesson-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 3rem; padding-top: 2rem; align-items: start; }
.lesson-side { position: sticky; top: 84px; max-height: calc(100vh - 100px); overflow: auto; padding-inline-end: .25rem; }
.side-details summary { list-style: none; font-weight: 750; padding: .3rem .5rem .8rem; cursor: default; }
.side-details summary::-webkit-details-marker { display: none; }
.side-details summary a { color: var(--ink); text-decoration: none; }
.lesson-main { max-width: 780px; min-width: 0; }
.lesson-head { margin-bottom: 1.6rem; }
.lesson-head h1 { margin-bottom: .4rem; }
.lesson-num { color: var(--turq); font-weight: 650; font-size: .92rem; margin-bottom: .3rem; }
.lesson-num a { color: inherit; }
.lesson-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem 1.2rem; color: var(--ink-2); font-size: .9rem; margin: 0; }
.lesson-meta > span { display: inline-flex; align-items: center; gap: .3rem; }
.reading { max-width: 820px; padding-top: 2rem; }

.toc { border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem 1rem; margin-bottom: 1.8rem; background: var(--surface); }
.toc summary { cursor: pointer; font-weight: 650; }
.toc ol { margin: .5rem 0 0; padding-inline-start: 1.3rem; }

.gate { position: relative; padding: 1.6rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin-top: 1rem; }
.gate-fade { position: absolute; inset-inline: 0; top: -90px; height: 90px; background: linear-gradient(to bottom, transparent, var(--bg)); pointer-events: none; }

.nb-card { margin-top: 2.5rem; padding: 1.4rem 1.5rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); border-inline-start: 5px solid var(--turq); }
.nb-card-head { display: flex; gap: 1rem; align-items: flex-start; flex-wrap: wrap; }
.nb-card-head svg { color: var(--turq); flex: none; margin-top: .3rem; }
.nb-card-head div { flex: 1; min-width: 200px; }
.nb-card h2 { font-size: 1.15rem; margin-bottom: .1rem; }
.nb-card p { margin: 0; }
.nb-card .cta-row { margin-bottom: 0; }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 3rem; }
.pager a { display: flex; flex-direction: column; padding: 1rem 1.2rem; border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink); font-weight: 650; background: var(--surface); }
.pager a:hover { border-color: var(--lapis); }
.pager-next { text-align: left; grid-column: 2; }

/* ---------- prose (rendered markdown) ---------- */
.prose { font-size: 1.04rem; }
.prose > * { max-width: 72ch; }
.prose h2 { margin-top: 2.2em; padding-top: .2em; }
.prose h3 { margin-top: 1.8em; }
.prose .headerlink { margin-inline-start: .4rem; color: var(--line-strong); text-decoration: none; opacity: 0; transition: opacity .15s; font-weight: 400; }
.prose h2:hover .headerlink, .prose h3:hover .headerlink, .prose .headerlink:focus { opacity: 1; }
.prose ul, .prose ol { padding-inline-start: 1.4rem; }
.prose li { margin: .25rem 0; }
.prose li::marker { color: var(--ink-2); }
.prose blockquote { margin: 1.4rem 0; padding: .3rem 1.1rem; border-inline-start: 4px solid var(--line-strong); color: var(--ink-2); }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2.5rem 0; }
.prose img { border-radius: var(--radius-sm); }
.prose :not(pre) > code { font-size: .86em; padding: .12em .4em; border-radius: 5px; background: var(--lapis-soft); color: var(--ink); unicode-bidi: isolate; white-space: nowrap; }
.prose .table-wrap, .prose .hl, .prose .video { max-width: none; }
.table-wrap { overflow-x: auto; margin: 1.4rem 0; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.prose table, .table { border-collapse: collapse; width: 100%; font-size: .95rem; }
.prose th, .prose td, .table th, .table td { padding: .55rem .8rem; border-bottom: 1px solid var(--line); text-align: start; vertical-align: top; }
.prose thead th, .table thead th { background: var(--surface-2); font-weight: 700; }
.prose tr:last-child td { border-bottom: 0; }

/* code blocks: always LTR, dark in both themes */
.hl { position: relative; margin: 1.4rem 0; direction: ltr; text-align: left; border-radius: var(--radius); background: var(--code-bg); }
.hl pre { margin: 0; padding: 1.05rem 1.2rem; overflow-x: auto; font-size: .87rem; line-height: 1.7; color: var(--code-ink); tab-size: 4; }
.hl pre code { font-family: var(--mono); background: none; padding: 0; }
.copy-btn { position: absolute; top: .5rem; right: .5rem; padding: .15rem .6rem; font: 600 .75rem "Vazirmatn", sans-serif; color: #c4cce4; background: rgb(255 255 255 / .08); border: 1px solid rgb(255 255 255 / .14); border-radius: 6px; cursor: pointer; opacity: 0; transition: opacity .15s; }
.hl:hover .copy-btn, .copy-btn:focus { opacity: 1; }
@media (hover: none) { .copy-btn { opacity: 1; } }

/* markdown/yaml samples with Persian: each line takes its own direction and alignment */
.hl-bidi pre code { unicode-bidi: plaintext; text-align: start; }

/* diagrams and formulas written in Persian (```  with no language): right-to-left, light, not code */
.prose .flow { max-width: none; }
.flow { margin: 1.4rem 0; padding: 1rem 1.2rem; border-radius: var(--radius); background: var(--surface-2);
  border-inline-start: 3px solid var(--line-strong); overflow-x: auto; }
.flow pre { margin: 0; font-family: var(--mono); font-size: .9rem; line-height: 1.95; color: var(--ink);
  white-space: pre-wrap; direction: rtl; text-align: right; }
.flow bdi { font-family: var(--mono); }

/* admonitions: !!! note | tip | warning | danger | info */
.admonition { margin: 1.5rem 0; padding: .9rem 1.1rem; border-radius: var(--radius-sm); background: var(--lapis-soft); border-inline-start: 4px solid var(--lapis); }
.admonition > :last-child { margin-bottom: 0; }
.admonition-title { font-weight: 750; margin-bottom: .3rem; }
.admonition.tip, .admonition.success { background: var(--turq-soft); border-color: var(--turq); }
.admonition.warning, .admonition.caution { background: var(--saffron-soft); border-color: var(--saffron-fill); }
.admonition.danger, .admonition.error { background: var(--danger-soft); border-color: var(--danger); }

/* video facade */
.video { position: relative; margin: 0 0 2rem; aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; background: #101935 center / cover no-repeat;
  background-image: radial-gradient(circle at 20% 30%, rgb(79 111 224 / .35), transparent 55%), radial-gradient(circle at 85% 80%, rgb(13 138 129 / .35), transparent 50%); }
.video-play { position: absolute; inset: 0; width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .4rem; border: 0; background: linear-gradient(to top, rgb(8 12 28 / .65), rgb(8 12 28 / .15)); color: #fff; font: inherit; cursor: pointer; padding: 1rem; }
.video-play svg { transition: transform .2s; }
.video-play:hover svg { transform: scale(1.08); }
.video-title { font-weight: 700; font-size: 1.1rem; text-align: center; }
.video-meta { font-size: .85rem; opacity: .8; }
.video iframe, .video video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; }

/* ---------- books ---------- */
.book-grid { list-style: none; padding: 0; margin: 1rem 0 0; display: grid; gap: 2.2rem; }
.book-card { display: grid; grid-template-columns: 150px 1fr; gap: 1.6rem; align-items: start; }
.book-card h2 { margin-bottom: .1rem; }
.book-card h2 a { color: inherit; text-decoration: none; }
.orig { color: var(--ink-2); font-size: .9rem; text-align: right; }
.book-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 3rem; align-items: start; }
.book-big-cover { border-radius: 4px 10px 10px 4px; box-shadow: 0 14px 30px -14px rgb(22 33 61 / .55); }
.buy { display: flex; flex-direction: column; gap: .6rem; margin-top: 1.2rem; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .8rem 1.5rem; margin: 1.5rem 0 2rem; padding: 1.1rem 1.3rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.facts dt { font-size: .82rem; color: var(--ink-2); }
.facts dd { margin: 0; font-weight: 650; }
.chapter-list li { margin: .4rem 0; display: flex; flex-direction: column; }

.article-list, .nb-list, .search-results, .history, .dash-nbs { list-style: none; padding: 0; margin: 0; }
.article-list li { padding: 1.3rem 0; border-bottom: 1px solid var(--line); }
.article-list h2 { font-size: 1.25rem; margin-bottom: .2rem; }
.article-list h2 a { color: inherit; text-decoration: none; }
.article-list p { margin: 0 0 .3rem; color: var(--ink-2); }
.nb-list li, .search-results li, .history li { padding: .8rem 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; }
.search-results li { display: block; }
.search-results p { margin: .2rem 0 0; }
.search-big { display: flex; gap: .6rem; margin: 1rem 0 1.5rem; }
.search-big input { flex: 1; }

/* ---------- forms ---------- */
input[type="text"], input[type="email"], input[type="password"], input[type="search"], input:not([type]) {
  width: 100%; padding: .65rem .85rem; border: 1.5px solid var(--line-strong); border-radius: 10px;
  background: var(--surface); color: var(--ink); font: inherit; font-size: 1rem;
}
input:focus { outline: none; border-color: var(--lapis); box-shadow: 0 0 0 3px var(--lapis-soft); }
label { display: block; font-weight: 600; font-size: .93rem; margin: .9rem 0 .3rem; }
.auth-wrap { display: grid; place-items: center; padding-top: 3.5rem; }
.auth-card { width: 100%; max-width: 440px; padding: 2rem; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.auth-card h1 { font-size: 1.6rem; }
.auth-card .btn-block { margin-top: 1.4rem; }
.auth-card .small { margin: 1rem 0 0; }
.big-num { font-size: 4rem; font-weight: 850; color: var(--lapis); line-height: 1; margin: 0 0 .5rem; }

/* ---------- notebook + results ---------- */
.ex-list { list-style: none; padding: 0; margin: 0 0 .5rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.ex-list li { display: grid; grid-template-columns: 3.4rem 1fr auto; gap: .8rem; padding: .65rem 1rem; align-items: center; }
.ex-list li + li { border-top: 1px solid var(--line); }
.ex-id { font-family: var(--mono); font-size: .8rem; font-weight: 600; color: var(--ink-2); background: var(--surface-2); border-radius: 6px; padding: .05rem .4rem; text-align: center; }
.two-step { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin: 2rem 0; }
.two-step section { padding: 1.3rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.two-step h2 { font-size: 1.1rem; }
.drop { position: relative; display: grid; place-items: center; min-height: 120px; margin: 0 0 1rem; padding: 1rem; border: 2px dashed var(--line-strong); border-radius: var(--radius); text-align: center; font-weight: 500; color: var(--ink-2); cursor: pointer; transition: border-color .15s, background .15s; }
.drop:hover, .drop.is-over { border-color: var(--turq); background: var(--turq-soft); }
.drop.has-file { border-style: solid; border-color: var(--turq); color: var(--ink); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.result-head { display: flex; gap: 1.8rem; align-items: center; margin-bottom: 2rem; flex-wrap: wrap; }
.result-head > div:not(.ring) { flex: 1; min-width: 260px; }
.result-head h1 { margin-bottom: .2rem; }
.ring { --c: var(--saffron-fill); width: 132px; height: 132px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: radial-gradient(closest-side, var(--bg) 78%, transparent 79%), conic-gradient(var(--c) calc(var(--p) * 1%), var(--line) 0); }
.ring.is-pass { --c: var(--turq); }
.ring span { font-size: 2rem; font-weight: 850; }
.ring small { font-size: 1rem; }
.ex-results { list-style: none; padding: 0; margin: 0; display: grid; gap: 1rem; }
.ex-result { padding: 1rem 1.2rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); border-inline-start: 5px solid var(--line-strong); }
.ex-result.is-passed { border-inline-start-color: var(--turq); }
.ex-result.is-partial { border-inline-start-color: var(--saffron-fill); }
.ex-result.is-failed, .ex-result.is-missing { border-inline-start-color: var(--danger); }
.ex-result-head { display: flex; align-items: center; gap: .8rem; }
.ex-result-head h2 { font-size: 1.05rem; margin: 0; flex: 1; }
.ex-score { font-weight: 800; }
.checks { list-style: none; padding: 0; margin: .6rem 0 0; }
.check { display: grid; grid-template-columns: 1.4rem 1fr; gap: .4rem; padding: .25rem 0; font-size: .95rem; }
.check-icon { font-weight: 800; }
.check.ok .check-icon { color: var(--turq); }
.check.fail .check-icon { color: var(--danger); }
.check.pending .check-icon { color: var(--saffron); }
.check-msg { display: block; color: var(--ink-2); font-size: .88rem; }

/* dashboard */
.dash { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 3rem; align-items: start; }
.dash-course { padding: 1.3rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin-bottom: 1rem; }
.dash-course-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
.dash-course h3 { margin: 0; }
.bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin: .8rem 0 1rem; }
.bar span { display: block; height: 100%; background: var(--turq); border-radius: inherit; }
.dash-nbs li { display: flex; justify-content: space-between; gap: 1rem; padding: .45rem 0; border-top: 1px solid var(--line); align-items: center; }
.account { margin: 1.5rem 0 1rem; }
.account summary { cursor: pointer; font-weight: 650; }
.account form .btn { margin-top: .8rem; }

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .course-layout, .dash { grid-template-columns: 1fr; }
  .course-syllabus { position: static; max-height: none; }
  .lesson-layout { grid-template-columns: 1fr; gap: 1rem; }
  .lesson-side { position: static; max-height: none; order: 2; border-top: 1px solid var(--line); padding-top: 1.5rem; }
  .side-details summary { cursor: pointer; }
  .featured { grid-template-columns: 1fr; gap: 2rem; }
}
@media (max-width: 760px) {
  body { font-size: 16px; }
  .header-row { gap: .5rem; }
  .nav-toggle { display: inline-grid; }
  .search-mini { display: none; }
  .main-nav { display: none; position: absolute; top: 64px; inset-inline: 0; flex-direction: column; padding: .6rem 16px 1rem; background: var(--surface); border-bottom: 1px solid var(--line); }
  .main-nav.is-open { display: flex; }
  .main-nav a { padding: .6rem .75rem; }
  .wrap { padding-inline: 16px; }
  .path { flex-direction: column; gap: 0; margin-top: 2.5rem; }
  .path-node { text-align: start; }
  .path-node a { flex-direction: row; gap: .9rem; padding: 0 0 1.4rem; }
  .path-node:not(:last-child)::after { top: 52px; inset-inline-start: 24px; width: 3px; height: calc(100% - 52px);
    background: repeating-linear-gradient(to bottom, var(--line-strong) 0 6px, transparent 6px 11px); }
  .path-node.is-ready:not(:last-child)::after { background: var(--lapis); }
  .node-dot { width: 50px; height: 50px; flex: none; }
  .node-name { margin-top: 0; }
  .node-state { margin-inline-start: auto; }
  .steps { grid-template-columns: 1fr; gap: 1.6rem; }
  .steps li:not(:last-child)::after { display: none; }
  .recent-list { columns: 1; }
  .footer-grid, .two-step, .book-layout { grid-template-columns: 1fr; }
  .book-card { grid-template-columns: 96px 1fr; gap: 1rem; }
  .pager { grid-template-columns: 1fr; }
  .pager-next { grid-column: auto; }
  .author-card { flex-direction: column; }
  .search-big { flex-direction: column; }
}

@media print {
  .site-header, .site-footer, .lesson-side, .pager, .nb-card, .copy-btn { display: none; }
  body { background: #fff; }
}

/* syntax highlighting (Pygments github-dark), generated */
.hl .c { color: #8B949E; font-style: italic } /* Comment */
.hl .err { color: #F85149 } /* Error */
.hl .esc { color: #E6EDF3 } /* Escape */
.hl .g { color: #E6EDF3 } /* Generic */
.hl .k { color: #FF7B72 } /* Keyword */
.hl .l { color: #A5D6FF } /* Literal */
.hl .n { color: #E6EDF3 } /* Name */
.hl .o { color: #FF7B72; font-weight: bold } /* Operator */
.hl .x { color: #E6EDF3 } /* Other */
.hl .p { color: #E6EDF3 } /* Punctuation */
.hl .ch { color: #8B949E; font-style: italic } /* Comment.Hashbang */
.hl .cm { color: #8B949E; font-style: italic } /* Comment.Multiline */
.hl .cp { color: #8B949E; font-weight: bold; font-style: italic } /* Comment.Preproc */
.hl .cpf { color: #8B949E; font-style: italic } /* Comment.PreprocFile */
.hl .c1 { color: #8B949E; font-style: italic } /* Comment.Single */
.hl .cs { color: #8B949E; font-weight: bold; font-style: italic } /* Comment.Special */
.hl .gd { color: #FFA198; background-color: #490202 } /* Generic.Deleted */
.hl .ge { color: #E6EDF3; font-style: italic } /* Generic.Emph */
.hl .ges { color: #E6EDF3; font-weight: bold; font-style: italic } /* Generic.EmphStrong */
.hl .gr { color: #FFA198 } /* Generic.Error */
.hl .gh { color: #79C0FF; font-weight: bold } /* Generic.Heading */
.hl .gi { color: #56D364; background-color: #0F5323 } /* Generic.Inserted */
.hl .go { color: #8B949E } /* Generic.Output */
.hl .gp { color: #8B949E } /* Generic.Prompt */
.hl .gs { color: #E6EDF3; font-weight: bold } /* Generic.Strong */
.hl .gu { color: #79C0FF } /* Generic.Subheading */
.hl .gt { color: #FF7B72 } /* Generic.Traceback */
.hl .g-Underline { color: #E6EDF3; text-decoration: underline } /* Generic.Underline */
.hl .kc { color: #79C0FF } /* Keyword.Constant */
.hl .kd { color: #FF7B72 } /* Keyword.Declaration */
.hl .kn { color: #FF7B72 } /* Keyword.Namespace */
.hl .kp { color: #79C0FF } /* Keyword.Pseudo */
.hl .kr { color: #FF7B72 } /* Keyword.Reserved */
.hl .kt { color: #FF7B72 } /* Keyword.Type */
.hl .ld { color: #79C0FF } /* Literal.Date */
.hl .m { color: #A5D6FF } /* Literal.Number */
.hl .s { color: #A5D6FF } /* Literal.String */
.hl .na { color: #E6EDF3 } /* Name.Attribute */
.hl .nb { color: #E6EDF3 } /* Name.Builtin */
.hl .nc { color: #F0883E; font-weight: bold } /* Name.Class */
.hl .no { color: #79C0FF; font-weight: bold } /* Name.Constant */
.hl .nd { color: #D2A8FF; font-weight: bold } /* Name.Decorator */
.hl .ni { color: #FFA657 } /* Name.Entity */
.hl .ne { color: #F0883E; font-weight: bold } /* Name.Exception */
.hl .nf { color: #D2A8FF; font-weight: bold } /* Name.Function */
.hl .nl { color: #79C0FF; font-weight: bold } /* Name.Label */
.hl .nn { color: #FF7B72 } /* Name.Namespace */
.hl .nx { color: #E6EDF3 } /* Name.Other */
.hl .py { color: #79C0FF } /* Name.Property */
.hl .nt { color: #7EE787 } /* Name.Tag */
.hl .nv { color: #79C0FF } /* Name.Variable */
.hl .ow { color: #FF7B72; font-weight: bold } /* Operator.Word */
.hl .pm { color: #E6EDF3 } /* Punctuation.Marker */
.hl .w { color: #6E7681 } /* Text.Whitespace */
.hl .mb { color: #A5D6FF } /* Literal.Number.Bin */
.hl .mf { color: #A5D6FF } /* Literal.Number.Float */
.hl .mh { color: #A5D6FF } /* Literal.Number.Hex */
.hl .mi { color: #A5D6FF } /* Literal.Number.Integer */
.hl .mo { color: #A5D6FF } /* Literal.Number.Oct */
.hl .sa { color: #79C0FF } /* Literal.String.Affix */
.hl .sb { color: #A5D6FF } /* Literal.String.Backtick */
.hl .sc { color: #A5D6FF } /* Literal.String.Char */
.hl .dl { color: #79C0FF } /* Literal.String.Delimiter */
.hl .sd { color: #A5D6FF } /* Literal.String.Doc */
.hl .s2 { color: #A5D6FF } /* Literal.String.Double */
.hl .se { color: #79C0FF } /* Literal.String.Escape */
.hl .sh { color: #79C0FF } /* Literal.String.Heredoc */
.hl .si { color: #A5D6FF } /* Literal.String.Interpol */
.hl .sx { color: #A5D6FF } /* Literal.String.Other */
.hl .sr { color: #79C0FF } /* Literal.String.Regex */
.hl .s1 { color: #A5D6FF } /* Literal.String.Single */
.hl .ss { color: #A5D6FF } /* Literal.String.Symbol */
.hl .bp { color: #E6EDF3 } /* Name.Builtin.Pseudo */
.hl .fm { color: #D2A8FF; font-weight: bold } /* Name.Function.Magic */
.hl .vc { color: #79C0FF } /* Name.Variable.Class */
.hl .vg { color: #79C0FF } /* Name.Variable.Global */
.hl .vi { color: #79C0FF } /* Name.Variable.Instance */
.hl .vm { color: #79C0FF } /* Name.Variable.Magic */
.hl .il { color: #A5D6FF } /* Literal.Number.Integer.Long */

/* resources list */
.resource-list { list-style: none; padding: 0; margin: 1rem 0 0; display: grid; gap: 1.2rem; }
.resource-list li { padding: 1.3rem 1.4rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); border-inline-start: 4px solid var(--turq); }
.resource-list h2 { font-size: 1.25rem; margin-bottom: .3rem; }
.resource-list h2 a { color: inherit; text-decoration: none; }
.resource-list h2 a:hover { color: var(--link); }
.resource-list p { max-width: 75ch; color: var(--ink-2); margin-bottom: .4rem; }

/* mermaid diagrams (rendered client-side) */
pre.mermaid { margin: 1.4rem 0; padding: 1rem; border-radius: var(--radius); background: var(--surface-2);
  text-align: center; overflow-x: auto; direction: ltr; font-family: var(--mono); font-size: .85rem; white-space: pre; }
pre.mermaid[data-processed] { white-space: normal; }
pre.mermaid svg { max-width: 100%; height: auto; }
