/* Java Backend Roadmap: landing page and learning workspace.
   Tokens follow the approved "Technical Precision" design system (Google Stitch). Dark is the primary theme.
   The primary button uses #2563EB (white text 5.2:1) instead of #3B82F6 (3.7:1) to meet WCAG AA. */
:root {
  /* Light is the default theme. Dark is a neutral graphite (no navy cast) so the accent colours carry the brand. */
  --bg: #F5F7FF; --surface: #FFFFFF; --surface-overlay: #EEF2FB; --inset: #F5F7FF; --border: #E2E8F0; --border-strong: #CBD5E1;
  --text: #0F172A; --text-muted: #475569; --accent: #1854F4; --accent-hover: #1244CC; --accent-text: #1854F4;
  --accent-soft: rgba(24, 84, 244, .08); --accent-line: rgba(24, 84, 244, .35);
  --success: #047857; --success-text: #047857; --success-soft: rgba(4, 120, 87, .1);
  --code-bg: #0B0E13; --code-text: #E0E4EC; --tk-k: #7AA2FF; --tk-s: #5BDCB0; --tk-c: #7B8798; --tk-n: #FFB786; --tk-a: #E6C07B;
  --focus: #1D4ED8; --shadow: 0 8px 24px -4px rgba(15, 23, 42, .18);
  /* Same families as the home page (theme.css): IBM Plex Sans, plus IBM Plex Sans Arabic and Baloo Bhaijaan 2 headings in Arabic. */
  --font: 'IBM Plex Sans', 'IBM Plex Sans Arabic', system-ui, sans-serif;
  --display: 'IBM Plex Sans', 'IBM Plex Sans Arabic', system-ui, sans-serif;
  --mono: monospace; /* small labels, as on the home page */
  --code: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  --header-h: 56px; --sidebar-w: 288px; --toc-w: 208px; --reading: 780px;
  --radius: 4px; --radius-lg: 12px;
  color-scheme: light;
}
html[data-theme="dark"] {
  --bg: #0F1218; --surface: #171B23; --surface-overlay: #1E232D; --inset: #1E232D; --border: #272D3A; --border-strong: #38404F;
  --text: #F1F4F9; --text-muted: #A5AEBD; --accent: #2D68E8; --accent-hover: #4A82F5; --accent-text: #86AEFF;
  --accent-soft: rgba(96, 142, 255, .13); --accent-line: rgba(96, 142, 255, .36);
  --success: #1FAE86; --success-text: #5BDCB0; --success-soft: rgba(31, 174, 134, .14);
  --focus: #9DBEFF; --shadow: 0 12px 30px -10px rgba(0, 0, 0, .65);
  color-scheme: dark;
}
html[dir="rtl"] { --font: 'IBM Plex Sans Arabic', system-ui, sans-serif; --display: 'Baloo Bhaijaan 2', 'IBM Plex Sans Arabic', system-ui, sans-serif; --mono: 'IBM Plex Sans Arabic', monospace; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 16px); scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 15px/1.6 var(--font); letter-spacing: 0; overflow-wrap: break-word; }
body.scroll-lock { overflow: hidden; }
h1, h2, h3, h4 { font-family: var(--display); color: var(--text); margin: 0; }
p { margin: 0 0 1em; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--radius); }
.app-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.app-skip { position: absolute; inset-inline-start: 8px; top: -60px; z-index: 100; background: var(--accent); color: #fff; padding: 8px 14px; border-radius: var(--radius); }
.app-skip:focus { top: 8px; }
.lp-wrap { width: min(1200px, 100% - 32px); margin-inline: auto; }
.lp-wrap.narrow { width: min(820px, 100% - 32px); }
.dim { color: var(--text-muted); }
.kicker { font: 500 12px/1.4 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); margin: 0; }
html[dir="rtl"] .kicker { letter-spacing: 0; }
[hidden] { display: none !important; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 18px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font: 500 14px/1.3 var(--font); cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--surface-overlay); border-color: var(--accent-text); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: rgba(255, 255, 255, .15); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: rgba(255, 255, 255, .25); }
.btn-ghost { background: transparent; }
.btn[aria-pressed="true"] { background: var(--success-soft); border-color: var(--success); color: var(--success-text); }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: var(--radius); border: 1px solid var(--border); background: transparent; color: var(--text); cursor: pointer; }
.icon-btn:hover { background: var(--surface-overlay); border-color: var(--accent-text); }
.i-arrow { flex: none; }
html[dir="rtl"] .i-arrow { transform: scaleX(-1); }
[data-theme="dark"] .i-moon, :root:not([data-theme="dark"]) .i-sun { display: none; }

/* Header */
.app-header { position: sticky; top: 0; z-index: 50; height: var(--header-h); background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(14px); border-bottom: 1px solid var(--border); }
.app-header-inner { height: 100%; max-width: 1920px; margin-inline: auto; padding-inline: 16px; display: flex; align-items: center; gap: 12px; }
.app-brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; letter-spacing: -.02em; flex: none; }
.app-brand:hover { text-decoration: none; }
.app-brand-mark { flex: none; }
.course-chip { font: 500 12px/1 var(--mono); padding: 6px 10px; border-radius: var(--radius); background: var(--accent-soft); border: 1px solid var(--accent-line); color: var(--accent-text); white-space: nowrap; }
.course-chip:hover { text-decoration: none; }
.app-nav { display: flex; gap: 4px; margin-inline-start: 8px; }
.app-nav a { color: var(--text-muted); padding: 6px 10px; border-radius: var(--radius); font-size: 14px; }
.app-nav a:hover { color: var(--text); background: var(--surface); text-decoration: none; }
.app-actions { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; }
.search-btn { display: inline-flex; align-items: center; gap: 8px; min-width: 220px; height: 40px; padding: 0 10px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); color: var(--text-muted); font: 400 14px var(--font); cursor: pointer; }
.search-btn:hover { border-color: var(--accent-text); }
.search-label { flex: 1; text-align: start; }
kbd { font: 500 11px/1 var(--mono); padding: 3px 6px; border-radius: 4px; border: 1px solid var(--border-strong); color: var(--text-muted); }
.lang-link { display: inline-grid; place-items: center; min-width: 40px; height: 40px; padding-inline: 8px; border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); font-weight: 600; font-size: 13px; }
.lang-link:hover { background: var(--surface-overlay); text-decoration: none; }
.menu-btn { display: none; }

/* Workspace: sidebar | content | on this page */
.workspace { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--toc-w); align-items: start; max-width: 1920px; margin-inline: auto; }
.sidebar { position: sticky; top: var(--header-h); height: calc(100dvh - var(--header-h)); overflow-y: auto; overscroll-behavior: contain; border-inline-end: 1px solid var(--border); background: var(--bg); }
.sidebar-head { position: sticky; top: 0; z-index: 2; background: var(--bg); padding: 16px 16px 12px; border-bottom: 1px solid var(--border); }
.sidebar-top { display: flex; align-items: center; justify-content: space-between; min-height: 24px; }
.sidebar-title { display: block; margin: 6px 0 10px; font-weight: 600; font-size: 15px; color: var(--text); }
.sidebar-title:hover { text-decoration: none; color: var(--accent-text); }
.track-progress { display: grid; gap: 4px; margin-bottom: 10px; }
.bar { height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--success); }
.track-progress-text { font: 400 12px var(--mono); color: var(--text-muted); }
.filter { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text-muted); }
.filter:focus-within { border-color: var(--accent-text); }
.filter input { flex: 1; min-width: 0; background: transparent; border: 0; color: var(--text); font: 400 13px var(--font); outline: none; }
.sidebar-nav { padding: 8px 8px 32px; }
details.phase > summary, details.module > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; border-radius: var(--radius); }
details > summary::-webkit-details-marker { display: none; }
details.phase > summary { padding: 9px 8px; font-weight: 600; font-size: 13.5px; }
details.phase > summary::before, details.module > summary::before { content: ''; flex: none; width: 6px; height: 6px; border-inline-end: 1.5px solid var(--text-muted); border-block-end: 1.5px solid var(--text-muted); transform: rotate(-45deg); transition: transform .15s; }
html[dir="rtl"] details > summary::before { transform: rotate(135deg); }
details[open] > summary::before { transform: rotate(45deg) !important; }
details.phase > summary:hover, details.module > summary:hover { background: var(--surface); }
.phase-title { flex: 1; min-width: 0; }
.phase-count, .mod-count { font: 400 11px var(--mono); color: var(--text-muted); white-space: nowrap; }
.modules, .lessons { list-style: none; margin: 0; padding: 0; }
.modules { padding-inline-start: 10px; }
details.module > summary { padding: 7px 8px; font-size: 13px; color: var(--text); }
.mod-id { font: 500 11px var(--mono); color: var(--accent-text); flex: none; }
.mod-title { flex: 1; min-width: 0; }
.lessons { padding-inline-start: 18px; border-inline-start: 1px solid var(--border); margin-inline-start: 12px; margin-bottom: 4px; }
.lesson-link { display: grid; grid-template-columns: 16px 22px minmax(0, 1fr) auto; align-items: baseline; gap: 6px; padding: 6px 8px; border-radius: var(--radius); color: var(--text-muted); font-size: 13px; line-height: 1.4; }
.lesson-link:hover { background: var(--surface); color: var(--text); text-decoration: none; }
.lesson-link[aria-current="page"] { background: var(--accent-soft); color: var(--accent-text); box-shadow: inset 2px 0 0 var(--accent-text); font-weight: 500; }
html[dir="rtl"] .lesson-link[aria-current="page"] { box-shadow: inset -2px 0 0 var(--accent-text); }
.lesson-no, .lesson-min { font: 400 11px var(--mono); }
.lesson-state { display: inline-grid; place-items: center; width: 14px; height: 14px; border-radius: 50%; border: 1px solid var(--border-strong); align-self: center; }
.lesson-state svg { width: 10px; height: 10px; opacity: 0; }
.lesson-link[data-done] .lesson-state { background: var(--success); border-color: var(--success); color: #fff; }
.lesson-link[data-done] .lesson-state svg { opacity: 1; }
.module-link { grid-template-columns: 38px minmax(0, 1fr); font-style: italic; }
.filter-empty { padding: 12px; color: var(--text-muted); font-size: 13px; }
.drawer-backdrop { display: none; }

.content { min-width: 0; padding: 32px 40px 80px; outline: none; }
.doc { max-width: var(--reading); margin-inline: auto; }
.toc { position: sticky; top: var(--header-h); max-height: calc(100dvh - var(--header-h)); overflow-y: auto; padding: 32px 16px 24px 0; }
html[dir="rtl"] .toc { padding: 32px 0 24px 16px; }
.toc h2 { margin-bottom: 10px; }
.toc ul { list-style: none; margin: 0; padding: 0; }
.toc a { display: block; padding: 5px 10px; font-size: 13px; color: var(--text-muted); border-inline-start: 2px solid transparent; }
.toc a:hover { color: var(--text); text-decoration: none; }
.toc a[aria-current="true"] { color: var(--accent-text); border-inline-start-color: var(--accent-text); background: var(--accent-soft); }
.toc-progress { margin-top: 20px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); display: grid; gap: 4px; font: 400 12px var(--mono); }
.toc-progress strong { font-weight: 600; color: var(--text); }
.toc-mobile { display: none; margin: 0 0 24px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.toc-mobile summary { cursor: pointer; padding: 12px 14px; font-weight: 500; display: flex; justify-content: space-between; min-height: 44px; align-items: center; list-style: none; }
.toc-mobile summary::-webkit-details-marker { display: none; }
.toc-count { font: 400 12px var(--mono); color: var(--text-muted); }
.toc-mobile ul { list-style: none; margin: 0; padding: 0 8px 8px; }
.toc-mobile a { display: block; padding: 10px; color: var(--text); border-radius: var(--radius); }

/* Document typography */
.doc-head { margin-bottom: 28px; }
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; font-size: 13px; color: var(--text-muted); margin-bottom: 14px; }
.crumbs a { color: var(--text-muted); }
.crumbs a:hover { color: var(--accent-text); }
.doc-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.tag { font: 500 12px/1 var(--mono); padding: 6px 8px; border-radius: var(--radius); background: var(--accent-soft); border: 1px solid var(--accent-line); color: var(--accent-text); }
.tag.ok { background: var(--success-soft); border-color: var(--success); color: var(--success-text); }
.doc h1 { font: 700 clamp(1.75rem, 1.2rem + 2vw, 2.25rem)/1.2 var(--display); letter-spacing: -.02em; margin-bottom: 12px; }
.lead { font-size: 1.125rem; line-height: 1.7; color: var(--text-muted); }
.doc-meta { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 20px; margin: 16px 0 20px; padding: 0; font: 400 13px var(--mono); color: var(--text-muted); }
.doc-meta strong { color: var(--text); font-weight: 600; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.lang-note { margin: 0 0 8px; padding: 8px 12px; border: 1px dashed var(--border-strong); border-radius: var(--radius); color: var(--text-muted); font-size: 13px; }
.doc section { margin-top: 40px; }
.doc h2 { font: 600 1.5rem/1.3 var(--display); letter-spacing: -.015em; margin-bottom: 14px; }
.sec-no { font: 500 12px var(--mono); color: var(--accent-text); margin-inline-end: 10px; }
.doc h3 { font: 600 1.125rem/1.4 var(--display); margin: 22px 0 8px; }
.doc h4 { font: 600 1rem/1.4 var(--display); margin: 18px 0 6px; }
.doc section p, .doc section li { font-size: 1rem; line-height: 1.75; }
.doc ul, .doc ol { padding-inline-start: 1.4em; margin: 0 0 1em; }
.doc li { margin: .3em 0; }
.doc code { font: 400 .875em var(--code); background: var(--surface-overlay); border: 1px solid var(--border); border-radius: 4px; padding: .1em .35em; direction: ltr; unicode-bidi: isolate; }
.callout { background: var(--surface); border: 1px solid var(--border); border-inline-start: 3px solid var(--accent-text); border-radius: var(--radius-lg); padding: 14px 16px; color: var(--text); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 18px; }
.card h3 { margin-top: 0; }
.stack { display: grid; gap: 12px; }
.chip-list { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0 !important; margin: 0 0 12px; }
.chip-list li { margin: 0; }
.chip-list a, .chip-list.static li { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); font-size: 13px !important; line-height: 1.5 !important; }
.chip-list a:hover { border-color: var(--accent-text); text-decoration: none; }
.chip-list.static li { border-color: var(--accent-line); background: var(--accent-soft); }
.next-box { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding: 20px; border: 1px solid var(--accent-line); background: var(--accent-soft); border-radius: var(--radius-lg); }
.lesson-list { list-style: none; padding: 0 !important; display: grid; gap: 4px; }
.lesson-list .lesson-link { padding: 10px 12px; background: var(--surface); border: 1px solid var(--border); font-size: 14px; color: var(--text); }
.outcomes li::marker { color: var(--accent-text); font-weight: 600; }

/* Tables, code, reveals, quiz */
.table-wrap { overflow-x: auto; margin: 0 0 1.2em; border: 1px solid var(--border); border-radius: var(--radius-lg); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: start; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: var(--surface); font-weight: 600; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
figure.code { margin: 0 0 1.2em; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--code-bg); overflow: hidden; direction: ltr; text-align: left; }
figure.code figcaption { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 8px 6px 14px; border-bottom: 1px solid var(--border); font: 500 12px var(--code); color: #9BA8B7; }
.code-copy { min-height: 28px; padding: 2px 10px; border-radius: 4px; border: 1px solid #2A3849; background: transparent; color: #C2C6D6; font: 500 12px var(--font); cursor: pointer; }
.code-copy:hover { border-color: #4F8CFF; color: #fff; }
figure.code pre { margin: 0; padding: 14px 16px; overflow-x: auto; font: 400 .875rem/1.6 var(--code); color: var(--code-text); tab-size: 4; max-width: 100%; }
figure.code pre code { font: inherit; background: none; border: 0; padding: 0; color: inherit; }
.tk-k { color: var(--tk-k); } .tk-s { color: var(--tk-s); } .tk-c { color: var(--tk-c); font-style: italic; } .tk-n { color: var(--tk-n); } .tk-a { color: var(--tk-a); }
.practice { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 18px; }
.practice > p:last-child { margin-bottom: 0; }
details.reveal { margin-top: 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); }
details.reveal > summary { cursor: pointer; padding: 10px 14px; font-weight: 500; color: var(--accent-text); min-height: 40px; display: flex; align-items: center; }
details.reveal[open] > summary { border-bottom: 1px solid var(--border); }
details.reveal > :not(summary) { margin: 12px 14px; }
.quiz { padding-inline-start: 1.6em !important; display: grid; gap: 10px; }
.quiz li { margin: 0; }
.quiz p { margin: 0 0 4px; }
.options { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 16px; padding: 0 !important; margin: 0 !important; }
.options li { font-size: .9375rem !important; margin: 0; }
.opt { display: inline-grid; place-items: center; width: 20px; height: 20px; margin-inline-end: 6px; border-radius: 4px; background: var(--surface-overlay); font: 600 11px var(--mono); }
.lesson-nav { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: stretch; margin-top: 48px; }
.pn { display: grid; gap: 2px; padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); color: var(--text); min-height: 64px; }
.pn:hover { border-color: var(--accent-text); text-decoration: none; }
.pn small { font: 500 12px var(--mono); color: var(--text-muted); }
.pn strong { font-weight: 600; font-size: 14px; line-height: 1.4; }
.pn span { font: 400 12px var(--mono); color: var(--text-muted); }
.pn-next { text-align: end; }
.pn.disabled { visibility: hidden; }
.lesson-nav .complete { align-self: center; }

/* Search dialog */
.search-dialog { width: min(640px, calc(100% - 24px)); max-height: min(560px, 80dvh); padding: 0; border: 1px solid var(--border-strong); border-radius: var(--radius-lg); background: var(--surface-overlay); color: var(--text); box-shadow: var(--shadow); margin-block-start: 10vh; overflow: hidden; }
.search-dialog[open] { display: flex; flex-direction: column; }
.search-dialog::backdrop { background: rgba(2, 6, 12, .6); }
.search-head { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 14px; border-bottom: 1px solid var(--border); }
html[dir="rtl"] .search-head { padding: 8px 14px 8px 8px; }
.search-head input { flex: 1; min-width: 0; height: 40px; background: transparent; border: 0; color: var(--text); font: 400 16px var(--font); outline: none; }
.search-status { margin: 0; padding: 8px 14px; font: 400 12px var(--mono); color: var(--text-muted); }
.search-results { list-style: none; margin: 0; padding: 0 8px 8px; overflow-y: auto; }
.search-results a { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; padding: 9px 10px; border-radius: var(--radius); color: var(--text); }
.search-results a small { grid-column: 2; color: var(--text-muted); font-size: 12px; }
.search-results a[aria-selected="true"], .search-results a:hover { background: var(--accent-soft); text-decoration: none; }
.search-type { font: 500 11px var(--mono); color: var(--accent-text); align-self: center; min-width: 4.5em; }

/* Landing page */
.landing { display: block; outline: none; }
.lp-hero { padding: clamp(48px, 8vw, 104px) 0 clamp(40px, 6vw, 72px); text-align: center; background: radial-gradient(900px 360px at 50% -80px, var(--accent-soft), transparent); }
.hero-badge { display: inline-block; margin: 0 0 22px; font: 500 12px/1 var(--mono); padding: 8px 12px; border-radius: var(--radius); background: var(--accent-soft); border: 1px solid var(--accent-line); color: var(--accent-text); }
.lp-hero h1 { font: 700 clamp(2.25rem, 1.4rem + 3.6vw, 3.5rem)/1.14 var(--display); letter-spacing: -.03em; max-width: 18ch; margin: 0 auto 16px; text-wrap: balance; }
.hero-sub { font: 600 clamp(1.125rem, 1rem + .6vw, 1.5rem)/1.4 var(--display); color: var(--accent-text); margin: 0 0 14px; }
.hero-text { max-width: 640px; margin: 0 auto 28px; font-size: 1.0625rem; line-height: 1.75; color: var(--text-muted); }
.lp-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-bottom: 40px; }
.lp-hero .btn { min-height: 44px; padding-inline: 20px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); max-width: 760px; margin-inline: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.stat { padding: 18px 8px; display: grid; gap: 2px; border-inline-end: 1px solid var(--border); }
.stat:last-child { border-inline-end: 0; }
.stat strong { font: 700 1.75rem/1.2 var(--display); letter-spacing: -.02em; }
.stat span { font: 500 11px var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }
html[dir="rtl"] .stat span { text-transform: none; letter-spacing: 0; font-family: var(--font); font-size: 13px; }
.band { padding: clamp(40px, 6vw, 72px) 0; border-top: 1px solid var(--border); }
.band.alt { background: var(--surface); }
.band h2 { font: 700 clamp(1.5rem, 1.1rem + 1.6vw, 2.25rem)/1.2 var(--display); letter-spacing: -.02em; margin: 6px 0 10px; }
.lp-lede { max-width: 640px; color: var(--text-muted); font-size: 1.0625rem; }
.track-grid { list-style: none; margin: 28px 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.track-grid > li { container-type: inline-size; }
.track-card { --lv: var(--accent); position: relative; display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); align-items: center; gap: 8px; height: 100%; padding: 20px; overflow: hidden;
  background: radial-gradient(120% 100% at var(--glow-x, 100%) 0, color-mix(in srgb, var(--lv) 14%, transparent), transparent 62%), var(--surface);
  border: 1px solid color-mix(in srgb, var(--lv) 22%, var(--border)); border-radius: var(--radius-lg); color: var(--text); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04); transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease; }
html[dir="rtl"] .track-card { --glow-x: 0%; }
.track-card:hover { border-color: color-mix(in srgb, var(--lv) 65%, var(--border)); box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .06); transform: translateY(-2px); text-decoration: none; }
.track-body { display: flex; flex-direction: column; gap: 10px; align-self: stretch; min-width: 0; }
.track-tag { align-self: flex-start; padding: 2px 10px; border: 1px solid color-mix(in srgb, var(--lv) 40%, transparent); border-radius: 999px; background: color-mix(in srgb, var(--lv) 16%, transparent);
  font: 600 12px var(--mono); color: color-mix(in srgb, var(--lv) 55%, var(--text)); }
.track-card h3 { font: 600 1.25rem/1.3 var(--display); letter-spacing: -.01em; }
.track-card p { margin: 0; color: var(--text-muted); flex: 1; }
.capstone { display: grid; gap: 2px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--inset); }
.capstone small { font: 500 11px var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }
html[dir="rtl"] .capstone small { text-transform: none; letter-spacing: 0; font-family: var(--font); font-size: 12px; }
.capstone strong { font-size: 14px; }
.track-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; font: 400 12px var(--mono); color: var(--text-muted); }
.track-cta { margin-inline-start: auto; display: inline-flex; gap: 6px; align-items: center; color: var(--accent-text); font: 500 13px var(--font); }
.track-card:hover .lv-stage { transform: translateY(-3px); }
@media (prefers-reduced-motion: no-preference) {
  .track-card:hover .chip, .track-card:focus-visible .chip { animation: lv-float 3.2s ease-in-out infinite; }
  .track-card:hover .chip:nth-of-type(2n) { animation-delay: -1.1s; }
  @keyframes lv-float { 50% { transform: translateY(-4px); } }
}
@media (prefers-reduced-motion: reduce) { .track-card, .lv-stage { transition: none; } .track-card:hover, .track-card:hover .lv-stage { transform: none; } }
@container (max-width: 419px) {
  .track-card { grid-template-columns: 1fr; }
  .lv-art { order: -1; justify-self: center; width: 168px; }
}
.note { margin-top: 20px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text-muted); font-size: 14px; }
.feature-grid, .step-grid { list-style: none; margin: 28px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.feature, .step { padding: 20px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.band:not(.alt) .step { background: var(--surface); }
.feature h3, .step h3 { font: 600 1.125rem/1.4 var(--display); margin-bottom: 8px; }
.feature p, .step p { margin: 0; color: var(--text-muted); }
.step-no { display: inline-block; font: 500 12px var(--mono); color: var(--accent-text); margin-bottom: 8px; }
.narrow p { color: var(--text-muted); font-size: 1.0625rem; }
.faq { display: grid; gap: 10px; margin: 20px 0 0; }
.faq div { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px 16px; }
.faq dt { font-weight: 600; }
.faq dd { margin: 4px 0 0; color: var(--text-muted); }
.cta { padding: clamp(32px, 5vw, 56px) 0; }
.cta-box { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px; padding: clamp(20px, 4vw, 36px); border: 1px solid var(--accent-line); border-radius: var(--radius-lg); background: var(--accent-soft); }
.cta-box h2 { font: 700 clamp(1.4rem, 1.1rem + 1.2vw, 2rem)/1.25 var(--display); margin: 6px 0 8px; }
.cta-box p:last-child { margin: 0; color: var(--text-muted); }
.app-footer { border-top: 1px solid var(--border); padding: 36px 0 28px; color: var(--text-muted); font-size: 14px; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 24px; }
.footer-inner p { margin: 10px 0 0; max-width: 420px; }
.footer-inner nav { display: flex; flex-wrap: wrap; gap: 8px 20px; align-content: start; }
.footer-inner nav a { color: var(--text-muted); }
.footer-inner nav a:hover { color: var(--accent-text); }
.copyright { margin: 24px auto 0; font-size: 13px; }

/* Responsive */
@media (max-width: 1279px) {
  .workspace { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .toc { display: none; }
  .toc-mobile { display: block; }
  .content { padding-inline: 32px; }
}
@media (max-width: 1100px) { .course-chip { display: none; } }
@media (max-width: 900px) { .app-nav { display: none; } .search-btn { min-width: 0; } .search-label, .search-btn kbd { display: none; } .search-btn { width: 40px; justify-content: center; padding: 0; } }
@media (max-width: 1023px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .menu-btn { display: inline-grid; }
  .content { padding: 24px 16px 64px; }
  .sidebar { position: fixed; top: 0; inset-inline-start: 0; z-index: 70; width: min(92vw, 360px); height: 100dvh; max-height: 100dvh; border-inline-end: 1px solid var(--border-strong);
    background: var(--surface-overlay); box-shadow: var(--shadow); transform: translateX(-102%); visibility: hidden; transition: transform .22s ease, visibility 0s linear .22s;
    padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
  html[dir="rtl"] .sidebar:not([data-open]) { transform: translateX(102%); }
  .sidebar[data-open] { transform: none; visibility: visible; transition: transform .22s ease; }
  .sidebar-head { background: var(--surface-overlay); }
  .drawer-backdrop { display: block; position: fixed; inset: 0; z-index: 60; background: rgba(2, 6, 12, .6); }
  .drawer-backdrop[hidden] { display: none !important; }
  .drawer-close { display: inline-grid; }
  .lesson-link { padding: 10px 8px; }
  details.phase > summary, details.module > summary { min-height: 44px; }
  .track-grid, .feature-grid, .step-grid { grid-template-columns: 1fr; }
  .doc section { margin-top: 32px; }
}
@media (min-width: 1024px) { .drawer-close { display: none !important; } }
@media (max-width: 640px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(2) { border-inline-end: 0; }
  .stat:nth-child(-n+2) { border-bottom: 1px solid var(--border); }
  .lesson-nav { grid-template-columns: 1fr 1fr; }
  .lesson-nav .complete { grid-column: 1 / -1; grid-row: 1; width: 100%; min-height: 44px; }
  .doc-head .actions .btn { min-height: 44px; }
  .lp-actions .btn { width: 100%; }
  .footer-inner { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .sidebar, .sidebar[data-open], details > summary::before { transition: none; }
}
@media print {
  .app-header, .sidebar, .toc, .toc-mobile, .lesson-nav, .actions, .search-dialog, .app-footer, .code-copy { display: none !important; }
  .workspace { display: block; }
  body { background: #fff; color: #000; }
  .doc, .doc * { color: #000 !important; background: transparent !important; }
  details.reveal > :not(summary) { display: block !important; }
}

/* Header start button (landing and level pages); hidden on small screens where the hero already offers it. */
.app-cta { min-height: 34px; padding: 4px 14px; font-size: 13px; }
@media (max-width: 760px) { .app-cta { display: none; } }

/* Level overview: hero with the level art, stepper, tabs, info cards, collapsible phases. */
.level-page { --lv: var(--accent); }
.level-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .5fr); gap: 24px; align-items: center; }
.level-hero .lv-art { width: 100%; }
.stepper-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 4px 0 10px; }
.stepper-label { color: var(--text-muted); font-size: 13px; font-weight: 600; }
.level-stepper { list-style: none; display: flex; gap: 6px; margin: 0; padding: 0; }
.level-stepper a { display: grid; place-items: center; width: 26px; height: 26px; border: 1px solid var(--border-strong); border-radius: 50%; color: var(--text-muted); font-size: 12px; font-weight: 700; text-decoration: none; }
.level-stepper a:hover { border-color: var(--lv); color: var(--text); text-decoration: none; }
.level-stepper a[aria-current="step"] { background: var(--lv); border-color: var(--lv); color: #fff; }
.level-tabs { position: sticky; top: var(--header-h); z-index: 5; display: flex; gap: 4px; overflow-x: auto; margin: 4px 0 24px; padding: 6px 0; background: var(--bg); border-bottom: 1px solid var(--border); scrollbar-width: none; }
.level-tabs a { flex: none; padding: 8px 14px; border-radius: 999px; color: var(--text-muted); font-size: 14px; font-weight: 600; text-decoration: none; }
.level-tabs a:hover { background: var(--surface-overlay); color: var(--text); text-decoration: none; }
.level-tabs a:focus-visible { outline-offset: -2px; }
.overview-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 0; }
.info-card { padding: 20px; background: var(--surface); border: 1px solid var(--border); border-top: 3px solid var(--lv); border-radius: var(--radius-lg); }
.info-card h2 { margin: 0 0 8px; font: 700 1rem/1.4 var(--display); }
.info-card h3 { margin: 0 0 6px; font: 600 1rem/1.4 var(--display); }
.info-card p { margin: 0; color: var(--text-muted); font-size: 14px; }
.phase-groups { display: grid; gap: 10px; margin-top: 12px; }
.phase-group { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.phase-group > summary { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 16px; padding: 14px 16px; cursor: pointer; list-style: none; }
.phase-group > summary::-webkit-details-marker { display: none; }
.phase-group[open] > summary { border-bottom: 1px solid var(--border); }
.pg-title { font-weight: 600; }
.pg-meta { color: var(--text-muted); font-size: 13px; }
.pg-modules { list-style: none; margin: 0; padding: 6px 8px 10px; display: grid; }
.pg-modules a { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: baseline; padding: 9px 8px; border-radius: var(--radius); color: var(--text); text-decoration: none; }
.pg-modules a:hover { background: var(--surface-overlay); text-decoration: none; }
.mod-count { color: var(--text-muted); font-size: 12px; }
@media (max-width: 900px) { .level-hero { grid-template-columns: minmax(0, 1fr); } .level-hero .lv-art { max-width: 260px; order: -1; } .overview-grid { grid-template-columns: minmax(0, 1fr); } }

/* Lesson publishing: status tag and notice, video frame, authored lesson body, collapsed draft outline. */
.status-tag { font-weight: 600; }
.status-tag.status-published { background: var(--success-soft); border-color: var(--success); color: var(--success-text); }
.status-tag.status-planned, .status-tag.status-content_ready { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-text); }
.status-note { margin: 0 0 20px; padding: 12px 14px; border: 1px solid var(--accent-line); border-inline-start: 4px solid var(--accent); border-radius: var(--radius-lg); background: var(--accent-soft); color: var(--text); font-size: 14px; }
.lesson-body > section { margin-top: 28px; }
.video-frame { position: relative; aspect-ratio: 16 / 9; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--code-bg); }
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.outline-more { margin-top: 24px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.outline-more > summary { padding: 12px 16px; cursor: pointer; font-weight: 600; }
.outline-more[open] > summary { border-bottom: 1px solid var(--border); }
.outline-more > :not(summary) { margin-inline: 16px; }
.outline-more > :last-child { margin-bottom: 16px; }

/* Header controls to match the portfolio pages: icon-only search, soft theme pill. */
.icon-btn { border-radius: 10px; }
.search-btn { width: 38px; height: 38px; min-width: 0; padding: 0; justify-content: center; border-color: transparent; background: transparent; }
.search-btn:hover { background: var(--accent-soft); border-color: transparent; }
.icon-btn[data-theme-toggle] { background: var(--accent-soft); border-color: transparent; color: var(--accent-text); width: 38px; height: 38px; }
.app-actions { gap: 8px; align-items: center; }

.btn { border-radius: 8px; }

/* ===== Roadmap landing (design reference): split hero, icon strip, timeline of compact level cards ===== */
.lp-hero-split { text-align: start; padding: 24px 0 8px; background: var(--hero-grad); }
.crumb-trail { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 22px; color: var(--text-muted); font-size: 13px; }
.crumb-trail a { color: var(--text-muted); }
.crumb-trail [aria-current] { color: var(--accent-text); font-weight: 600; }
.crumb-sep { opacity: .6; }
html[dir="rtl"] .crumb-sep { display: inline-block; transform: scaleX(-1); }
.lp-hero-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 24px; align-items: center; }
.lp-hero-split h1 { margin: 0 0 14px; font: 800 clamp(30px, 3.8vw, 48px)/1.15 var(--display); letter-spacing: -.02em; text-align: start; }
html[dir="rtl"] .lp-hero-split h1 { line-height: 1.4; letter-spacing: 0; }
.lp-hero-split .hero-text { max-width: 600px; margin: 0 0 24px; color: var(--text-muted); font-size: 1.0625rem; text-align: start; }
.lp-hero-split .lp-actions { justify-content: flex-start; }
.chev-down { margin-inline-start: 6px; transform: rotate(90deg); }
.hero-art { max-width: 460px; justify-self: end; width: 100%; }
.lp-strip { list-style: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 32px 0 0; padding: 14px 8px; background: var(--card-grad); border: 1px solid var(--border); border-radius: 14px; }
.lp-strip li { display: flex; align-items: center; gap: 14px; padding: 6px 18px; }
.lp-strip li + li { border-inline-start: 1px solid var(--border); }
.strip-icon { display: grid; place-items: center; flex: none; width: 44px; height: 44px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); }
.strip-text { display: grid; gap: 1px; }
.strip-text strong { font-size: 15px; }
.strip-text span { color: var(--text-muted); font-size: 13px; }
#journey h2 { margin: 0 0 22px; font: 800 1.5rem/1.2 var(--display); }
.journey-line { list-style: none; margin: 0; padding: 26px 0 0; display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 12px; position: relative; }
.journey-line::before { content: ''; position: absolute; inset-inline: 3%; top: 5px; height: 3px; border-radius: 3px; background: linear-gradient(90deg, var(--accent-line), var(--accent)); }
html[dir="rtl"] .journey-line::before { background: linear-gradient(270deg, var(--accent-line), var(--accent)); }
.journey-line li { position: relative; }
.journey-line li::before { content: ''; position: absolute; top: -26px; inset-inline-start: 50%; margin-inline-start: -6px; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--bg); }
.jc { display: grid; justify-items: center; align-content: start; gap: 6px; height: 100%; padding: 16px 10px; text-align: center; color: var(--text); text-decoration: none; background: var(--card-grad); border: 1px solid var(--border); border-radius: 12px; transition: transform .2s ease, border-color .2s ease; }
.jc:hover { transform: translateY(-3px); border-color: var(--lv); text-decoration: none; }
.jc-icon { color: var(--lv); }
.jc strong { font-size: 15px; }
.jc-text { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; color: var(--text-muted); font-size: 12.5px; line-height: 1.5; }
.jc-pill { margin-top: auto; padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-text); font: 600 12px var(--font); }
@media (max-width: 1100px) {
  .journey-line { grid-template-columns: repeat(4, minmax(0, 1fr)); row-gap: 14px; padding-top: 0; }
  .journey-line::before, .journey-line li::before { display: none; }
  .lp-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 10px; }
  .lp-strip li:nth-child(odd) { border-inline-start: 0; }
}
@media (max-width: 760px) {
  .lp-hero-grid { grid-template-columns: minmax(0, 1fr); }
  .hero-art { order: -1; max-width: 300px; justify-self: center; }
  .journey-line { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lp-strip { grid-template-columns: minmax(0, 1fr); }
  .lp-strip li + li { border-inline-start: 0; border-top: 1px solid var(--border); }
}

/* ===== Level overview (design reference): identity block, icon stats, underlined tabs, check-mark cards ===== */
.level-wrap { padding-block: 24px 48px; }
.level-top { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 32px; align-items: center; margin-bottom: 8px; }
.level-art-wrap { position: relative; padding: 12px; }
.level-art-wrap::before { content: ''; position: absolute; inset: 0; z-index: 0; border-radius: 42% 58% 55% 45% / 48% 42% 58% 52%; background: linear-gradient(135deg, color-mix(in srgb, var(--lv) 16%, var(--surface)), color-mix(in srgb, var(--lv) 6%, var(--surface))); }
.level-art-wrap .lv-art { position: relative; z-index: 1; }
.level-pill { display: inline-block; margin-bottom: 12px; padding: 5px 14px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-text); font-size: 13px; font-weight: 700; }
.level-id h1 { margin: 0 0 10px; font: 800 clamp(30px, 3.6vw, 44px)/1.15 var(--display); letter-spacing: -.02em; }
html[dir="rtl"] .level-id h1 { line-height: 1.4; letter-spacing: 0; }
.level-id .lead { margin: 0 0 20px; color: var(--text-muted); font-size: 1.0625rem; }
.level-stats { list-style: none; display: flex; flex-wrap: wrap; margin: 0 0 22px; padding: 0; }
.level-stats li { display: flex; align-items: center; gap: 10px; padding: 4px 18px; }
.level-stats li:first-child { padding-inline-start: 0; }
.level-stats li + li { border-inline-start: 1px solid var(--border); }
.ls-icon { color: var(--accent-text); flex: none; }
.ls-text { display: grid; line-height: 1.35; }
.ls-text strong { font-size: 14px; }
.ls-text small { color: var(--text-muted); font-size: 12.5px; }
.level-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.level-actions .btn { min-height: 46px; padding-inline: 22px; }
.level-actions .btn svg { flex: none; }
.tabs-underline { position: static; gap: 0; margin: 28px 0 24px; padding: 0; border-bottom: 1px solid var(--border); background: transparent; overflow-x: auto; }
.tabs-underline a { position: relative; padding: 14px 22px; border-radius: 0; color: var(--text-muted); font-size: 15px; font-weight: 600; white-space: nowrap; }
.tabs-underline a:hover { background: transparent; color: var(--text); }
.tabs-underline a[aria-current] { color: var(--accent-text); }
.tabs-underline a[aria-current]::after { content: ''; position: absolute; inset-inline: 0; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--accent); }
.level-landing section + section { margin-top: 36px; }
.level-landing h2 { font-family: var(--display); }
.info-card { background: var(--card-grad); border-top: 1px solid var(--border); border-radius: 14px; padding: 22px; }
.info-card h2 { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; font: 700 1.1rem/1.3 var(--display); }
.info-card h2 svg { color: var(--accent-text); flex: none; }
.info-card h3 { display: flex; align-items: center; gap: 10px; margin: 0 0 8px; font: 700 1.05rem/1.3 var(--display); }
.info-card h3 svg { color: #E0A21B; flex: none; }
.info-card p { margin: 0 0 12px; color: var(--text-muted); font-size: 14.5px; }
.check-list { list-style: none; display: grid; gap: 10px; margin: 12px 0 0; padding: 0; }
.check-list li { display: flex; align-items: flex-start; gap: 10px; color: var(--text); font-size: 14.5px; line-height: 1.5; }
.check-list svg { flex: none; margin-top: 2px; color: #1FA06A; }
html[dir="rtl"] .check-list svg { margin-top: 3px; }
@media (max-width: 900px) {
  .level-top { grid-template-columns: minmax(0, 1fr); }
  .level-art-wrap { max-width: 360px; justify-self: center; }
  .level-stats li { padding: 6px 12px; }
  .level-stats li:nth-child(odd) { padding-inline-start: 0; }
}

/* ===== Lesson page (design reference): top navigation, meta icons, section icons, boxed objectives ===== */
.sidebar-course { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; color: var(--text); }
.sidebar-course .ameen-mark { height: 22px; }
.lesson-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }
.lesson-pn { display: flex; gap: 10px; margin-inline-start: auto; }
.pn-top { min-height: 38px; padding: 6px 14px; font-size: 14px; }
.pn-top svg { flex: none; }
.pn-top-prev svg { transform: scaleX(-1); }
html[dir="rtl"] .pn-top-prev svg { transform: none; }
html[dir="rtl"] .pn-top-next svg { transform: scaleX(-1); }
.lesson-meta { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 6px 0 0; padding: 14px 0 18px; border-bottom: 1px solid var(--border); list-style: none; color: var(--text-muted); font-size: 14px; }
.lesson-meta li { display: inline-flex; align-items: center; gap: 8px; }
.lesson-meta svg { color: var(--accent-text); flex: none; }
.lesson-body h2 { display: flex; align-items: center; gap: 12px; font: 700 1.5rem/1.3 var(--display); }
.sec-ico { flex: none; color: var(--accent-text); }
.sec-objectives { padding: 18px 22px; background: var(--card-grad); border: 1px solid var(--border); border-radius: 14px; }
.sec-objectives h2 { font-size: 1.25rem; margin-top: 0; }
.sec-objectives ul { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; }
.sec-objectives li { position: relative; padding-inline-start: 28px; }
.sec-objectives li::before { content: ''; position: absolute; inset-inline-start: 0; top: .35em; width: 16px; height: 9px; border-inline-start: 2.5px solid #1FA06A; border-bottom: 2.5px solid #1FA06A; transform: rotate(-45deg); }
html[dir="rtl"] .sec-objectives li::before { transform: rotate(45deg) scaleX(-1); }
.toc .kicker { font-size: 15px; letter-spacing: 0; text-transform: none; color: var(--text); font-weight: 700; }
.toc li a[aria-current], .toc li a.active { background: var(--accent-soft); border-inline-start: 3px solid var(--accent); border-radius: 6px; color: var(--accent-text); }

/* ===== Roadmap landing: shared path, fork, two branches ===== */
.journey { display: grid; grid-template-columns: minmax(0, 1fr) 72px minmax(0, 300px); align-items: center; }
.journey .journey-line { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.journey-fork { align-self: stretch; position: relative; }
.fork-h { display: block; width: 100%; height: 100%; fill: none; stroke: var(--accent); stroke-width: 3; stroke-linecap: round; opacity: .85; }
.fork-h path { vector-effect: non-scaling-stroke; }
.fork-h circle { fill: var(--accent); stroke: none; }
html[dir="rtl"] .fork-h { transform: scaleX(-1); }
.journey-fork .fork-v { display: none; }
.journey-branches { display: grid; grid-template-rows: repeat(2, 1fr); gap: 16px; align-self: stretch; }
.journey-branches > .branch-heading { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
@media (max-width: 1100px) {
  .journey { grid-template-columns: minmax(0, 1fr); }
  .journey .journey-line { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .fork-h { display: none; }
  .journey-fork { align-self: auto; }
  .journey-fork .fork-v { display: block; }
  .journey-branches { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: auto; }
  .journey-branches > .branch-heading { position: static; width: auto; height: auto; overflow: visible; clip: auto; grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .journey .journey-line { grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 0 0 0 30px; }
  html[dir="rtl"] .journey .journey-line { padding: 0 30px 0 0; }
  .journey .journey-line::before { display: block; inset: 8px auto 8px 9px; width: 3px; height: auto; background: var(--accent-line); }
  html[dir="rtl"] .journey .journey-line::before { inset: 8px 9px 8px auto; }
  .journey .journey-line li::before { display: block; top: 24px; inset-inline-start: -28px; margin: 0; }
  .journey-branches { grid-template-columns: minmax(0, 1fr); }
  .journey-fork .fork-v::after { display: none; }
}

/* Landing fork on tablet: the trunk drops from Senior A (last column) and splits to the two specializations. */
@media (max-width: 1100px) {
  .journey-fork .fork-v { background: linear-gradient(var(--accent-line), var(--accent-line)) 25% 100% / 3px 50% no-repeat, linear-gradient(var(--accent-line), var(--accent-line)) 75% 100% / 3px 50% no-repeat; }
  .journey-fork .fork-v::before { inset-inline-start: 83.333%; }
  .journey-fork .fork-v::after { inset-inline: 25% 16.667%; top: 50%; bottom: auto; height: 0; border: 0; border-top: 3px solid var(--accent-line); border-radius: 0; }
}
@media (max-width: 760px) {
  .journey-fork .fork-v { background: none; height: 24px; }
  .journey-fork .fork-v::before { inset-inline-start: 10px; height: 100%; }
  .journey-fork .fork-v::after { display: none; }
}

/* One-click completion from any lesson list: a checkbox button laid over the status circle (a sibling of the link, not inside it). */
.lesson-row { position: relative; }
.lesson-check { position: absolute; inset-inline-start: 2px; top: 50%; z-index: 1; width: 30px; height: 30px; margin-top: -15px; padding: 0; border: 0; border-radius: 50%; background: transparent; cursor: pointer; }
.lesson-check:hover + .lesson-link .lesson-state { border-color: var(--success); background: var(--success-soft); }
.lesson-check[aria-checked="true"]:hover + .lesson-link .lesson-state { opacity: .75; }
.lesson-check:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }

/* Narrow phones: lesson prev/next never widen the page (long unbroken titles), compact header actions */
@media (max-width: 760px) {
  .lesson-nav { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .pn { min-width: 0; }
  .pn strong, .pn small, .pn span { overflow-wrap: anywhere; }
}
@media (max-width: 360px) {
  .app-actions { gap: 4px; }
  .app-actions .icon-btn, .app-actions .icon-btn[data-theme-toggle] { width: 34px; height: 34px; }
}

/* ===== Self-check quizzes and knowledge checks (quiz.py renders them, quiz.js shows the feedback) ===== */
:root { --quiz-wrong: #B45309; --quiz-wrong-soft: rgba(180, 83, 9, .1); }
html[data-theme="dark"] { --quiz-wrong: #F2B05E; --quiz-wrong-soft: rgba(242, 176, 94, .12); }
.quiz-set, .knowledge-check { margin: 18px 0 26px; }
.quiz-note { margin: 0 0 14px; color: var(--text-muted); font-size: .9em; }
.quiz-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.quiz-q { margin: 0; }
.quiz-q fieldset { margin: 0; padding: 16px 18px 18px; min-inline-size: 0; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.quiz-q[data-state="correct"] fieldset { border-color: var(--success); }
.quiz-q[data-state="wrong"] fieldset { border-color: var(--quiz-wrong); }
.quiz-q legend { float: left; width: 100%; display: flex; gap: 10px; align-items: baseline; padding: 0; margin: 0 0 12px; font-weight: 600; line-height: 1.5; }
.quiz-q legend + .quiz-options { clear: both; margin-top: 0; }
.quiz-no { flex: none; display: inline-grid; place-items: center; min-width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); font: 600 13px var(--mono); }
.quiz-tag { flex: none; padding: 1px 8px; border: 1px solid var(--border); border-radius: 999px; color: var(--text-muted); font: 500 11px var(--mono); }
.quiz-options { display: grid; gap: 8px; margin-top: 12px; }
.quiz-opt { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); cursor: pointer; }
.quiz-opt:hover { border-color: var(--accent-text); }
.quiz-opt:focus-within { outline: 2px solid var(--focus, var(--accent-text)); outline-offset: 2px; }
.quiz-opt:has(input:checked) { border-color: var(--accent-text); background: var(--accent-soft); }
.quiz-opt input { margin-top: 5px; accent-color: var(--accent); }
.opt-letter { flex: none; display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 4px; background: var(--surface-overlay); font: 600 12px var(--mono); }
.opt-text { min-width: 0; overflow-wrap: anywhere; }
.quiz-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.quiz-actions[hidden], .quiz-fb[hidden], .quiz-summary[hidden], .quiz-actions .btn[hidden] { display: none !important; }
.quiz-feedback:empty { display: none; }
.quiz-fb { margin-top: 12px; padding: 10px 14px; border-inline-start: 4px solid var(--accent-text); border-radius: var(--radius); background: var(--accent-soft); }
.quiz-fb p { margin: 0 0 6px; }
.quiz-fb p:last-child { margin-bottom: 0; }
.fb-correct { border-color: var(--success); background: var(--success-soft); }
.fb-wrong, .fb-choose { border-color: var(--quiz-wrong); background: var(--quiz-wrong-soft); }
.quiz-summary { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 16px; padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface-overlay); font-weight: 600; }
.knowledge-check { padding: 18px 18px 6px; border: 1px solid var(--border); border-inline-start: 4px solid var(--accent-text); border-radius: var(--radius-lg); background: var(--surface-overlay); }
.knowledge-check > h3 { margin: 0 0 4px; }
.knowledge-check .quiz-q fieldset { background: var(--surface); }
.quiz-key { margin: 8px 0 0; padding-inline-start: 1.2em; }
@media (max-width: 560px) { .quiz-q fieldset { padding: 14px 12px 16px; } .quiz-actions .btn { flex: 1 1 100%; } }
@media (prefers-reduced-motion: no-preference) { .quiz-opt, .quiz-q fieldset { transition: border-color .15s ease, background-color .15s ease; } }

/* ===== Educational diagrams (diagrams.py, content/diagrams) ===== */
.diagram { margin: 22px 0; }
.diagram-art { padding: 12px; overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.diagram-art:focus-visible { outline: 2px solid var(--focus, var(--accent-text)); outline-offset: 2px; }
.dg { display: block; width: 100%; min-width: 520px; max-width: 760px; height: auto; margin-inline: auto; direction: ltr; }
.dg-box { fill: var(--surface-overlay); stroke: var(--border-strong); stroke-width: 1.5; }
.dg-box-accent { fill: var(--accent-soft); stroke: var(--accent-text); stroke-width: 2; }
.dg-one { stroke-width: 3; }
.dg-zero { opacity: .8; }
.dg-group { fill: none; stroke: var(--border-strong); stroke-width: 1.5; stroke-dasharray: 6 5; }
.dg-text { fill: var(--text); font: 600 17px var(--font); }
.dg-sub { fill: var(--text-muted); font: 400 14px var(--font); }
.dg-note { fill: var(--text-muted); font: 500 13px var(--font); }
.dg-digit { fill: var(--text-muted); font: 500 26px var(--mono); }
.dg-digit-one { fill: var(--accent-text); font-weight: 700; }
.dg-big { fill: var(--text); font: 700 24px var(--mono); }
.dg-line { fill: none; stroke: var(--text-muted); stroke-width: 2.2; stroke-linecap: round; }
.dg-arrow { fill: var(--text-muted); }
.diagram figcaption { margin-top: 10px; color: var(--text-muted); font-size: .92em; }
.diagram-text { margin-top: 8px; }
.diagram-text summary { cursor: pointer; color: var(--accent-text); }

/* ===== End of lesson: one clear next action ===== */
.lesson-end { margin-top: 44px; padding: 18px 20px; border: 1px solid var(--border); border-inline-start: 4px solid var(--accent-text); border-radius: var(--radius-lg); background: var(--surface-overlay); }
.lesson-end-note { margin: 0 0 12px; color: var(--text-muted); font-size: .92em; }
.lesson-end-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.lesson-continue::after { content: "\2192"; margin-inline-start: 8px; }
html[dir="rtl"] .lesson-continue::after { content: "\2190"; }
.lesson-end + .lesson-nav { margin-top: 16px; }
@media (max-width: 560px) { .lesson-end-actions .btn { flex: 1 1 100%; text-align: center; } }

/* ===== Reading comfort in lessons ===== */
.lesson-body p, .lesson-body li, .lesson-body blockquote { max-width: 72ch; }
.lesson-body .sec-examples h3 { margin-top: 30px; padding: 8px 14px; border-inline-start: 3px solid var(--accent-text); border-radius: var(--radius); background: var(--surface-overlay); }
.lesson-body .sec-exercises details.reveal.solution { margin: 6px 0 20px; }
.lesson-body .sec-exercises details.reveal.solution > summary { font-size: .95em; }

/* ===== Narrow phones: the lesson header keeps its buttons (the brand shows its logo only below 361px) ===== */
@media (max-width: 360px) {
  .app-header-inner { gap: 8px; padding-inline: 12px; }
  .app-header .menu-btn { flex: none; width: 34px; height: 34px; }
  .app-brand .brand-name { display: none; }
}
