:root {
  /* Light theme: a soft, cool "paper white" (not pure white, so it does not glare), deep navy text and one calm teal accent.
     Text on background is about 9.5 to 1, muted text about 5.4 to 1, links about 6.5 to 1. */
  --bg: #eff2f4; --surface: #f7f9fa; --surface-2: #e3e8ec;
  --ink: #132a3f; --text: #2f3e4e; --muted: #536373;
  --accent: #17807a; --accent-strong: #0f5f5b; --accent-soft: #dcecea; --on-accent: #ffffff;
  --brand: #132a3f; --on-brand: #eef2f4;
  --band: #dcecea; --on-band: #132a3f;   /* the "Pathkori means" panel: soft teal in light, navy in dark */
  --line: #d3d9df;
  --radius: 16px; --radius-sm: 10px;
  --gutter: clamp(16px, 2.2vw, 40px);
  --shadow: 0 1px 2px rgba(19,42,63,.04), 0 6px 20px rgba(19,42,63,.06);
  --shadow-lg: 0 2px 4px rgba(19,42,63,.05), 0 16px 40px rgba(19,42,63,.09);
  --serif: "Fraunces", "Noto Serif Bengali", Georgia, "Times New Roman", serif;
  --sans: "Inter", "Noto Sans Bengali", system-ui, -apple-system, "Segoe UI", sans-serif;
  /* Subject colours, repeated every four subjects (home panels and footer chips) */
  --glow-ink: 5%;
  --tint-2: #3db5a6; --tint-3: #7f8cf5; --tint-4: #e0788f;
  /* Header sizes live here so the sticky offsets below always match them */
  --header-h: 54px; --subnav-h: 40px; --stick: calc(var(--header-h) + var(--subnav-h) + 2px);
}
/* Theme: follows the device until the visitor picks one with the header button (saved as data-theme on <html>) */
:root { color-scheme: light; }
:root[data-theme="light"] { color-scheme: light; }
/* Dark theme: deep navy (not black) with soft off-white text and the same teal accent, lightened for dark backgrounds. Text on background about 11 to 1, muted about 6.4 to 1. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1b27; --surface: #15232f; --surface-2: #1b2c3b;
    --ink: #e8eef3; --text: #c3cfd9; --muted: #8d9fb0;
    --accent: #3bb0a6; --accent-strong: #6fd1c8; --accent-soft: #14332f; --on-accent: #06211f;
    --brand: #1b2c3b; --on-brand: #e8eef3;
    --band: #1b2c3b; --on-band: #e8eef3;
    --line: #263a4c;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
    --shadow-lg: 0 2px 4px rgba(0,0,0,.35), 0 18px 48px rgba(0,0,0,.4);
    --glow-ink: 14%;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
    --bg: #0f1b27; --surface: #15232f; --surface-2: #1b2c3b;
    --ink: #e8eef3; --text: #c3cfd9; --muted: #8d9fb0;
    --accent: #3bb0a6; --accent-strong: #6fd1c8; --accent-soft: #14332f; --on-accent: #06211f;
    --brand: #1b2c3b; --on-brand: #e8eef3;
    --band: #1b2c3b; --on-band: #e8eef3;
    --line: #263a4c;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
    --shadow-lg: 0 2px 4px rgba(0,0,0,.35), 0 18px 48px rgba(0,0,0,.4);
    --glow-ink: 14%;
    color-scheme: dark;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font: 17px/1.7 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--accent-strong); }
h1, h2, h3 { font-family: var(--serif); color: var(--ink); line-height: 1.15; font-weight: 600; letter-spacing: -.015em; }
::selection { background: var(--accent); color: var(--on-accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* Layout */
.header-inner, .footer-inner, .container { max-width: none; margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); }
.container { padding-top: 8px; padding-bottom: 72px; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(160%) blur(14px); -webkit-backdrop-filter: saturate(160%) blur(14px); border-bottom: 1px solid var(--line); }
.header-inner { display: flex; justify-content: space-between; align-items: center; height: var(--header-h); }
.brand { display: inline-flex; align-items: center; gap: 9px; font-family: var(--serif); font-weight: 700; font-size: 1.25rem; color: var(--ink); text-decoration: none; letter-spacing: -.02em; }
.brand-mark { display: block; width: 30px; height: 30px; }
.site-header nav { display: flex; align-items: center; gap: 18px; margin-left: auto; }
.site-header nav a { color: var(--text); text-decoration: none; font-weight: 500; font-size: .88rem; }
.site-header nav a:hover { color: var(--accent-strong); }
.site-header nav .nav-cta { padding: 6px 15px; border-radius: 999px; background: var(--brand); color: var(--on-brand); }
.site-header nav .nav-cta:hover { color: var(--on-brand); opacity: .9; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 14px 26px; border-radius: 999px; font-weight: 600; font-size: 1rem; text-decoration: none; border: 1px solid transparent; transition: transform .15s, box-shadow .15s, background .15s; }
.btn-primary { background: var(--accent); color: var(--on-accent); box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 35%, transparent); }
.btn-primary:hover { transform: translateY(-1px); background: var(--accent-strong); color: var(--on-accent); }
.btn-ghost { border-color: var(--line); color: var(--ink); background: var(--surface); }
.btn-ghost:hover { border-color: var(--accent); }

/* Hero */
.hero { position: relative; display: grid; gap: 48px; grid-template-columns: 1.15fr .85fr; align-items: center; padding: 88px 0 72px; }
.hero::before { content: ""; position: absolute; inset: -80px calc(50% - 50vw) auto calc(50% - 50vw); height: 560px; z-index: -1; background: radial-gradient(60% 70% at 78% 30%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 70%), radial-gradient(50% 60% at 10% 10%, color-mix(in srgb, var(--ink) 8%, transparent), transparent 70%); }
.eyebrow { display: inline-flex; align-items: center; gap: 10px; margin: 0 0 20px; padding: 6px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); font-size: .88rem; }
.eyebrow b { color: var(--accent-strong); font-weight: 600; }
.hero h1 { font-size: clamp(2.5rem, 6.5vw, 4.4rem); margin: 0 0 22px; }
.hero h1 em { font-style: italic; color: var(--accent-strong); font-weight: 500; }
.lead { font-size: 1.2rem; color: var(--muted); max-width: 33em; margin: 0 0 32px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; }
.hero-note { margin: 22px 0 0; color: var(--muted); font-size: .92rem; }

/* Hero visual: learning path card */
.path-card { position: relative; padding: 28px; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow-lg); }

.path-title { margin: 0 0 18px; font-size: .78rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.path-list { list-style: none; margin: 0; padding: 0; position: relative; }
.path-list::before { content: ""; position: absolute; left: 15px; top: 14px; bottom: 14px; width: 2px; background: var(--line); }
.path-list li { position: relative; display: flex; gap: 16px; padding: 10px 0; }
.dot { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--surface-2); border: 2px solid var(--line); color: var(--muted); font-size: .8rem; font-weight: 700; position: relative; z-index: 1; }
.path-list li:first-child .dot { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.path-list strong { display: block; color: var(--ink); line-height: 1.3; }
.path-list span { color: var(--muted); font-size: .9rem; }

/* Sections */
.section { padding: 64px 0 8px; }
.section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 28px; }
.kicker { margin: 0 0 8px; color: var(--accent-strong); font-size: .8rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.section h2 { margin: 0; font-size: clamp(1.8rem, 4vw, 2.5rem); }
.section-head a { font-weight: 600; text-decoration: none; white-space: nowrap; }
.empty { padding: 32px; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); }
.empty p { margin: 0 0 14px; }
.chips { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.chips li { padding: 8px 18px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; font-size: .95rem; }

/* Subject cards */
.cards { list-style: none; padding: 0; margin: 0; display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.cards a { position: relative; display: flex; flex-direction: column; gap: 8px; height: 100%; padding: 28px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); text-decoration: none; color: inherit; transition: transform .2s, box-shadow .2s, border-color .2s; }
.cards a:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--accent); }
.badge { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 14px; margin-bottom: 8px; background: var(--brand); color: var(--accent); font-family: var(--serif); font-weight: 700; font-size: 1.5rem; }
.soon-badge { align-self: flex-start; padding: 2px 10px; border-radius: 999px; background: var(--line); color: var(--ink); font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.cards strong { font-family: var(--serif); font-size: 1.35rem; color: var(--ink); line-height: 1.2; }
.card-text { color: var(--muted); font-size: .96rem; }
.card-meta { margin-top: auto; padding-top: 14px; color: var(--accent-strong); font-size: .85rem; font-weight: 600; }
.card-meta::after { content: " \2192"; }

/* How it works */
.steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); counter-reset: s; }
.steps li { padding: 28px; background: var(--surface-2); border-radius: var(--radius); }
.steps h3 { margin: 14px 0 8px; font-size: 1.25rem; }
.steps p { margin: 0; color: var(--muted); font-size: .98rem; }
.step-no { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--brand); color: var(--accent); font-family: var(--serif); font-weight: 700; }

.tag { color: var(--accent-strong); font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; }

/* About band */
.band { margin-top: 72px; padding: 56px 40px; border-radius: 24px; background: var(--band); color: var(--on-band); text-align: center; position: relative; overflow: hidden; }
.band::before { content: "পাঠ"; position: absolute; right: -10px; bottom: -60px; font-family: var(--serif); font-size: 14rem; line-height: 1; color: var(--on-band); opacity: .06; pointer-events: none; }
.band h2 { color: var(--on-band); margin: 0 0 14px; font-size: clamp(1.7rem, 4vw, 2.3rem); }
.band p { max-width: 36em; margin: 0 auto 26px; color: color-mix(in srgb, var(--on-band) 82%, transparent); }
.band .btn-primary { box-shadow: none; }

/* Footer */
.site-footer { position: relative; margin-top: 24px; overflow: hidden; color: var(--muted); font-size: .84rem; line-height: 1.6; }
.site-footer::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 1px; background: linear-gradient(90deg, transparent, var(--accent) 50%, transparent); opacity: .7; }
.site-footer::after { content: "পাঠ"; position: absolute; right: 2%; bottom: -34px; z-index: 0; font-family: var(--serif); font-size: 8.5rem; line-height: 1; color: var(--ink); opacity: .045; pointer-events: none; user-select: none; }
.footer-inner { position: relative; z-index: 1; padding-top: 22px; padding-bottom: 18px; }
.footer-top { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 18px; }
.footer-top .brand { font-size: 1.1rem; }
.footer-top .brand-mark { width: 28px; height: 28px; }
.footer-tag { margin: 0 auto 0 0; font-family: var(--serif); font-size: 1.02rem; color: var(--text); }
.footer-tag em { color: var(--accent-strong); font-weight: 500; }
.to-top { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 50%; color: var(--text); background: var(--surface); transition: transform .25s, background .25s, color .25s, border-color .25s; }
.to-top:hover { transform: translateY(-3px); background: var(--accent); border-color: var(--accent); color: var(--on-accent) !important; }
.footer-chips { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 16px 0 0; padding: 0; }
.footer-chips a { display: inline-flex; align-items: center; gap: 8px; padding: 5px 13px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--text); font-weight: 600; font-size: .82rem; transition: transform .2s, border-color .2s, color .2s; }
.footer-chips a:hover { transform: translateY(-2px); border-color: var(--tint, var(--accent)); color: var(--ink); }
.footer-chips i { width: 8px; height: 8px; border-radius: 50%; background: var(--tint, var(--accent)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--tint, var(--accent)) 22%, transparent); }
.footer-chips li:nth-child(4n+2) { --tint: var(--tint-2); }
.footer-chips li:nth-child(4n+3) { --tint: var(--tint-3); }
.footer-chips li:nth-child(4n+4) { --tint: var(--tint-4); }
.footer-chips .chip-plain a { border-color: transparent; background: none; font-weight: 500; color: var(--muted); padding-left: 8px; padding-right: 8px; }
.footer-chips .chip-plain a:hover { border-color: transparent; color: var(--accent-strong); }
.footer-bottom { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px 32px; margin-top: 16px; padding-top: 12px; border-top: 1px dashed var(--line); font-size: .78rem; }
.footer-note { flex: 1 1 380px; max-width: 100ch; margin: 0; }
.footer-copy { margin: 0; white-space: nowrap; }
.site-footer a { text-decoration: none; }
.site-footer .brand { color: var(--ink); }
.footer-bottom a:hover { color: var(--accent-strong); }

/* Inner pages */
.crumbs { margin: 28px 0 0; color: var(--muted); font-size: .92rem; }
.crumbs a { color: var(--muted); }
.container > h1 { font-size: clamp(2rem, 5vw, 3rem); margin: 16px 0 12px; }
.lesson-list { padding: 0; list-style: none; counter-reset: l; display: grid; gap: 10px; }
.lesson-list li { counter-increment: l; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; padding: 16px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.lesson-list li::before { content: counter(l, decimal-leading-zero); color: var(--accent-strong); font-weight: 700; font-size: .85rem; }
.lesson-list a { font-weight: 600; text-decoration: none; color: var(--ink); }
.lesson-list span { color: var(--muted); font-size: .94rem; }
.lesson-list li[hidden], .chapter[hidden] { display: none; }
.lesson-list .topic-tag { padding: 1px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2); font-size: .78rem; font-weight: 600; }
/* Topic filter of the practice courses (templates/courses/course_detail.html) */
.topic-filter { margin: 1.4rem 0 .6rem; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.topic-filter[hidden] { display: none; }
.topic-title { margin: 0 8px 0 0; font-weight: 600; font-size: .9rem; color: var(--muted); }
.topic-chip { padding: 5px 12px; font: inherit; font-size: .85rem; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; cursor: pointer; }
.topic-chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.topic-solved { flex-basis: 100%; font-size: .88rem; color: var(--muted); }
.topic-count { flex-basis: 100%; margin: 0; font-size: .85rem; color: var(--muted); }
.lesson { max-width: 720px; margin: 0 auto; }
.lesson h1 { font-size: clamp(2rem, 5vw, 3rem); margin: 20px 0 24px; }
.lesson h2 { margin-top: 2em; font-size: 1.7rem; }
.lesson pre { overflow-x: auto; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); font-size: .92rem; }
.lesson code { font-size: .92em; }
.lesson blockquote { margin: 1.4em 0; padding: 4px 20px; border-left: 3px solid var(--accent); color: var(--muted); }
.lesson table { border-collapse: collapse; width: 100%; }
.lesson th, .lesson td { border: 1px solid var(--line); padding: 8px 12px; text-align: left; }

/* Responsive */
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; padding: 56px 0 48px; gap: 40px; }
  .path-wrap::after { inset: 10px -8px -10px 8px; }
  .band { padding: 44px 24px; }
}
@media (max-width: 700px) {
  /* Same idea as the subject bar: one row, the menu scrolls sideways instead of breaking. */
  .header-inner { gap: 14px; }
  .brand { flex: none; }
  .site-header nav { flex: 1; min-width: 0; justify-content: flex-start; gap: 18px; overflow-x: auto; scrollbar-width: none; }
  .site-header nav::-webkit-scrollbar { display: none; }
  .site-header nav > * { flex: none; white-space: nowrap; }
  .site-header nav .nav-cta { margin-left: auto; }
}
@media (max-width: 520px) {
  .section { padding-top: 48px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}

/* Sticky footer; wide header/footer on course pages */
body { display: flex; flex-direction: column; min-height: 100vh; overflow-x: clip; }
body > main { flex: 1; width: 100%; }

/* Learning pages: outline | main | sidebar (flat, separated by thin lines) */
.course-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr) 270px; grid-template-areas: "nav main aside"; align-items: start; }
.course-nav { grid-area: nav; position: sticky; top: var(--stick); max-height: calc(100vh - var(--stick)); overflow-y: auto; padding: 36px 24px 40px 0; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.course-main { grid-area: main; align-self: stretch; min-width: 0; padding: 36px 44px 72px; border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
.course-aside { grid-area: aside; position: sticky; top: var(--stick); display: grid; gap: 30px; padding: 36px 0 40px 28px; }
.subject-layout { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 56px; align-items: start; padding-top: 36px; }
.subject-layout .course-aside { padding: 0; }
.subject-layout > * { grid-area: auto; }  /* the lesson layout's named areas do not exist on this page */

/* No right sidebar content: use two columns instead of leaving an empty strip */
.course-layout.no-aside { grid-template-columns: 250px minmax(0, 1fr); grid-template-areas: "nav main"; }
.course-layout.no-aside .course-main { border-right: 0; }
.subject-layout.no-aside { grid-template-columns: minmax(0, 1fr); }

/* Left outline */
.course-nav-box > summary { display: none; }
.course-nav-title { display: block; margin: 0 0 6px; font-family: var(--serif); font-size: 1.2rem; font-weight: 600; line-height: 1.25; color: var(--ink); text-decoration: none; }
.course-nav-title:hover { color: var(--accent-strong); }
.nav-progress { margin: 0 0 20px; color: var(--muted); font-size: .82rem; }
.nav-chapter { margin-top: 22px; }
.nav-chapter h2 { margin: 0 0 6px; font-family: var(--sans); font-size: .72rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); line-height: 1.4; }
.nav-chapter > summary { display: flex; align-items: center; gap: 8px; cursor: pointer; list-style: none; }
.nav-chapter > summary::-webkit-details-marker { display: none; }
.nav-chapter > summary::after { content: "+"; margin-left: auto; color: var(--muted); font-weight: 700; }
.nav-chapter[open] > summary::after { content: "-"; }
.nav-chapter > summary h2 { margin: 0; }
.nav-chapter ul { list-style: none; margin: 6px 0 0; padding: 0; }
.nav-lesson { display: flex; align-items: baseline; gap: 10px; margin-left: -2px; padding: 7px 0 7px 12px; border-left: 2px solid transparent; color: var(--text); font-size: .95rem; line-height: 1.4; text-decoration: none; }
.nav-lesson:hover { color: var(--ink); border-left-color: var(--line); }
.nav-lesson.is-current { border-left-color: var(--accent); color: var(--ink); font-weight: 600; }
.nav-type { flex: none; width: 7px; height: 7px; border-radius: 50%; border: 1.5px solid var(--muted); opacity: .6; transform: translateY(-1px); }
.nav-lesson.is-done .nav-type, .nav-lesson.is-current .nav-type { border-color: var(--accent); opacity: 1; }
.nav-lesson.is-done .nav-type { background: var(--accent); }
.nav-type-video { border: 0; border-radius: 0; width: 0; height: 0; opacity: 1; border-left: 9px solid var(--muted); border-top: 5px solid transparent; border-bottom: 5px solid transparent; }
.nav-lesson.is-current .nav-type-video, .nav-lesson.is-done .nav-type-video { border-left-color: var(--accent); background: none; }

/* Course page: title block and lesson rows */
.course-hero { padding: 0 0 28px; margin-bottom: 8px; border-bottom: 1px solid var(--line); }
.course-hero .tag { color: var(--accent-strong); }
.course-hero h1 { margin: 6px 0 10px; font-size: clamp(2.1rem, 4vw, 3rem); }
.course-hero p { margin: 0 0 16px; max-width: 38em; font-size: 1.12rem; color: var(--muted); }
.course-hero .stats { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-bottom: 22px; color: var(--muted); font-size: .92rem; font-weight: 600; }
.chapter { margin-top: 36px; }
.chapter h2 { margin: 0 0 4px; font-size: 1.3rem; }
.chapter .lesson-list { gap: 0; margin: 0; }
.chapter .lesson-list li { padding: 14px 2px; background: none; border: 0; border-top: 1px solid var(--line); border-radius: 0; }
.chapter .lesson-list li:first-child { border-top: 0; }
.chapter .lesson-list .tag { margin-left: auto; font-size: .75rem; }

/* Lesson page */
.lesson-card { max-width: none; width: auto; margin: 0; }
.lesson-card > h1 { margin: 6px 0 22px; font-size: clamp(2rem, 4vw, 2.7rem); }
.lesson-meta { margin: 0; color: var(--muted); font-size: .86rem; font-weight: 600; letter-spacing: .02em; }
.progress { height: 4px; margin: 12px 0 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 99px; background: var(--accent); }
.lesson-card > p, .lesson-card > ul, .lesson-card > ol { max-width: 62rem; font-size: 1.1rem; line-height: 1.85; }
.lesson-card ul, .lesson-card ol { padding-left: 1.4em; }
.lesson-card li { margin: .35em 0; }
.lesson-card h2 { margin: 1.9em 0 .6em; padding-bottom: .3em; border-bottom: 1px solid var(--line); font-size: 1.6rem; }
.lesson-card h3 { margin: 1.6em 0 .5em; font-size: 1.25rem; }
.lesson-card blockquote { padding: 14px 20px; background: var(--accent-soft); border-left: 4px solid var(--accent); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: var(--ink); }
.lesson-card blockquote p { margin: 0; }
.video-frame { position: relative; aspect-ratio: 16 / 9; margin: 0 0 24px; border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-2); }
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* Previous / next */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 32px; }
.pager a { display: flex; flex-direction: column; gap: 2px; padding: 14px 18px; border: 1px solid var(--line); border-radius: var(--radius-sm); text-decoration: none; color: var(--ink); transition: border-color .15s; }
.pager a:hover { border-color: var(--accent); }
.pager small { color: var(--muted); font-size: .76rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.pager span { font-weight: 600; line-height: 1.35; }
.pager .pager-next { grid-column: 2; text-align: right; }

@media (max-width: 1199px) {
  .course-layout { grid-template-columns: 250px minmax(0, 1fr); grid-template-areas: "nav main" "nav aside"; }
  .course-main { border-right: 0; padding-right: 0; }
  .course-aside { position: static; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); padding: 0 0 48px 52px; }
  .subject-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 899px) {
  .course-layout { grid-template-columns: 1fr; grid-template-areas: "nav" "main" "aside"; }
  .course-nav { position: static; max-height: none; overflow: visible; padding: 20px 0 0; }
  .course-nav-box { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
  .course-nav-box > summary { display: block; padding: 13px 16px; cursor: pointer; font-weight: 600; color: var(--ink); }
  .course-nav-box[open] > summary { border-bottom: 1px solid var(--line); }
  .course-nav-box > :not(summary) { margin-left: 16px; margin-right: 16px; }
  .course-nav-box .course-nav-title { margin-top: 14px; }
  .course-nav-box .nav-chapter:last-child { margin-bottom: 14px; }
  .course-main { border: 0; padding: 28px 0 40px; }
  .course-aside { padding: 0 0 40px; }
}
@media (max-width: 520px) {
  .pager { grid-template-columns: 1fr; }
  .pager .pager-next { grid-column: 1; }
}

/* Light / dark button: shows the icon of the theme you would switch to */
.theme-toggle { flex: none; display: grid; place-items: center; width: 34px; height: 34px; margin-left: 14px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--ink); cursor: pointer; transition: transform .25s, background .25s, color .25s, border-color .25s; }
.theme-toggle:hover { border-color: var(--accent); color: var(--accent-strong); transform: rotate(14deg); }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
}

/* Second header: subject bar */
.subnav { position: sticky; top: calc(var(--header-h) + 1px); z-index: 19; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.subnav-inner { max-width: none; display: flex; gap: 4px; margin: 0 auto; padding: 0 calc(var(--gutter) - 12px); overflow-x: auto; scrollbar-width: none; }
.subnav-inner::-webkit-scrollbar { display: none; }
.subnav-link { flex: none; position: relative; display: flex; align-items: center; height: var(--subnav-h); padding: 0 14px; color: var(--text); font-size: .86rem; font-weight: 600; text-decoration: none; white-space: nowrap; }
.subnav-link:hover { color: var(--ink); background: var(--surface-2); }
.subnav-link.is-active { color: var(--ink); }
.subnav-link.is-active::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--accent); }

/* Right sidebar: plain sections, only the promo is tinted */
.aside-box { display: block; color: var(--text); text-decoration: none; }
.aside-box strong { display: block; margin: 3px 0 6px; font-family: var(--serif); font-size: 1.1rem; font-weight: 600; line-height: 1.3; color: var(--ink); }
.aside-box p { margin: 0 0 10px; font-size: .92rem; line-height: 1.55; color: var(--muted); }
.aside-label { display: block; font-size: .75rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.aside-link { font-size: .9rem; font-weight: 600; color: var(--accent-strong); text-decoration: none; }
a.aside-box:hover strong { color: var(--accent-strong); }
.aside-next .aside-label { color: var(--accent-strong); }
.aside-promo { padding: 16px 18px; border-radius: var(--radius-sm); background: var(--accent-soft); }
.aside-list { list-style: none; margin: 8px 0 0; padding: 0; }
.aside-list a { display: block; padding: 5px 0; color: var(--ink); font-weight: 500; text-decoration: none; }
.aside-list a:hover { color: var(--accent-strong); }

/* Accounts and progress */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.nav-user { color: var(--muted); font-size: .84rem; font-weight: 600; }
.nav-logout { display: inline; margin: 0; }
.nav-logout button { padding: 0; border: 0; background: none; color: var(--text); font: inherit; font-size: .88rem; font-weight: 500; cursor: pointer; }
.nav-logout button:hover { color: var(--accent-strong); }
.auth-card { max-width: 440px; margin: 56px auto 0; padding: 36px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.auth-card h1 { margin: 0 0 8px; font-size: 2rem; }
.auth-sub { margin: 0 0 24px; color: var(--muted); }
.auth-form .field { margin-bottom: 18px; }
.auth-form label { display: block; margin-bottom: 6px; font-weight: 600; font-size: .92rem; color: var(--ink); }
.auth-form input { width: 100%; padding: 11px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); color: var(--text); font: inherit; }
.auth-form small { display: block; margin-top: 6px; color: var(--muted); font-size: .82rem; line-height: 1.5; }
.auth-form small ul { margin: 0; padding-left: 1.2em; }
.auth-form .errorlist { margin: 6px 0 0; padding: 0; list-style: none; color: #c0392b; font-size: .88rem; }
.auth-form .btn { width: 100%; justify-content: center; margin-top: 6px; cursor: pointer; }
.auth-alt { margin: 22px 0 0; text-align: center; color: var(--muted); font-size: .94rem; }
.complete-box { margin-top: 36px; padding: 18px 20px; background: var(--surface-2); border-radius: var(--radius-sm); }
.complete-box form { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; }
.complete-box p { margin: 0; color: var(--muted); }
.complete-done { font-weight: 700; color: var(--accent-strong); }
.complete-box .btn { cursor: pointer; padding: 11px 22px; }
.progress-hero { margin: 0 0 8px; max-width: 360px; }
.progress-text { margin: 0 0 18px; font-size: .9rem; }
.done-mark { color: var(--accent-strong); font-weight: 700; }

/* Hide the page scrollbar (scrolling still works with wheel, touch and keyboard) */
html { scrollbar-width: none; }
html::-webkit-scrollbar { display: none; }

/* Lecture boxes: objectives, takeaways, practice answers, worked examples, notes */
.lesson-card .objectives, .lesson-card .takeaways, .lesson-card .example, .lesson-card .note { margin: 1.6em 0; padding: 16px 22px; border-radius: var(--radius-sm); }
.lesson-card .objectives { background: var(--surface-2); border-left: 4px solid var(--muted); }
.lesson-card .takeaways { background: var(--accent-soft); border-left: 4px solid var(--accent); }
.lesson-card .example { background: var(--surface); border: 1px solid var(--line); }
.lesson-card .note { background: var(--surface-2); border: 1px dashed var(--line); font-size: .96rem; }
.lesson-card .objectives > p:first-child, .lesson-card .takeaways > p:first-child, .lesson-card .example > p:first-child, .lesson-card .note > p:first-child { margin: 0 0 .4em; font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-strong); }
.lesson-card .objectives ul, .lesson-card .takeaways ul, .lesson-card .example ul, .lesson-card .note ul { margin: .3em 0 0; }
.lesson-card .example p, .lesson-card .note p { margin: .5em 0; }
.lesson-card details { margin: 1em 0 1.6em; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.lesson-card summary { padding: 12px 18px; cursor: pointer; font-weight: 600; color: var(--ink); }
.lesson-card details[open] summary { border-bottom: 1px solid var(--line); }
.lesson-card details > :not(summary) { margin-left: 18px; margin-right: 18px; }
.lesson-card details > :last-child { margin-bottom: 14px; }
.lesson-card table { margin: 1.2em 0; }
.lesson-card th { background: var(--surface-2); color: var(--ink); }
@media (max-width: 760px) {
  /* Wide tables scroll sideways inside the lesson instead of pushing the whole page wider than the screen */
  .lesson-card table { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
}
.lesson-card .formula { margin: 1.2em 0; padding: 12px 20px; border-left: 4px solid var(--accent); background: var(--accent-soft); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; font-weight: 600; color: var(--ink); }

/* Currency chooser shown on lessons that contain {money ...} amounts */
.money-bar { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; justify-content: flex-end; margin: 0 0 16px; padding: 0; border: 0; font-size: .8rem; color: var(--muted); }
.money-bar[hidden] { display: none; }
.money-bar label { display: inline-flex; gap: 8px; align-items: center; font-weight: 500; }
.money-bar select { font: inherit; padding: 3px 8px; border-radius: 8px; max-width: 100%; background: var(--surface); color: var(--text); border: 1px solid var(--line); }
.money-bar span { opacity: .75; }

/* Touch comfort: larger tap areas on touch screens and phones. Padding only, so nothing looks different. */
@media (pointer: coarse), (max-width: 700px) {
  .site-header nav a, .nav-logout button, .nav-user { padding-block: 11px; }
  .brand { padding-block: 8px; }
  .course-nav-title, .section-head a { display: inline-block; padding-block: 8px; }
  .aside-link { display: inline-block; padding-block: 12px; }
  .money-bar select { min-height: 40px; }
  .footer-chips a { display: inline-block; padding-block: 6px; }
  .theme-toggle, .to-top { width: 40px; height: 40px; }
}

/* The whole row in a lesson list is the link target, so it is easy to tap and to click. */
.lesson-list li { position: relative; }
.lesson-list a::after { content: ''; position: absolute; inset: 0; border-radius: inherit; }
.lesson-list a:focus-visible { outline: none; }
.lesson-list li:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Subject page */
.subject-hero { padding: 0 0 28px; margin-bottom: 28px; border-bottom: 1px solid var(--line); }
.subject-hero h1 { margin: 4px 0 10px; font-size: clamp(2.2rem, 4.5vw, 3.2rem); }
.subject-lead { margin: 0 0 20px; max-width: 38em; font-size: 1.15rem; color: var(--muted); }
.subject-stats { display: flex; flex-wrap: wrap; gap: 10px; list-style: none; margin: 0; padding: 0; }
.subject-stats li { padding: 6px 14px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-strong); font-size: .9rem; font-weight: 600; }
.subject-stats strong { font-family: var(--serif); font-size: 1.05rem; }
.course-cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }
.course-card { position: relative; display: flex; flex-direction: column; gap: 10px; height: 100%; padding: 28px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); text-decoration: none; color: inherit; transition: transform .2s, box-shadow .2s, border-color .2s; }
a.course-card:hover, a.course-card:focus-visible { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--accent); }
.course-card strong { font-family: var(--serif); font-size: 1.45rem; color: var(--ink); line-height: 1.2; }
.course-card-meta { color: var(--accent-strong); font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.course-card .card-text { display: -webkit-box; -webkit-line-clamp: 5; line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; color: var(--muted); font-size: .98rem; }
.course-card .progress { display: block; margin: auto 0 0; }
.course-card-go { margin-top: auto; padding-top: 6px; color: var(--accent-strong); font-size: .92rem; font-weight: 600; }
.course-card .progress + .course-card-go { margin-top: 0; }
.course-card.is-soon { background: transparent; border: 1px dashed var(--line); box-shadow: none; color: var(--muted); }
.soon-badge { align-self: flex-start; padding: 2px 10px; border-radius: 999px; background: var(--line); color: var(--ink); font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }

/* Subjects announced as "coming soon": seen in the menu, never linked */
.subnav-link.is-soon { color: var(--muted); cursor: default; }
.subnav-link.is-soon:hover { color: var(--muted); background: none; }
.subnav-link.is-soon small { margin-left: 6px; padding: 1px 7px; border-radius: 999px; background: var(--line); color: var(--ink); font-size: .65rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.subject-soon { padding-top: 36px; }
.cards .is-soon { list-style: none; }

/* Course map: one picture card per chapter, shown above the chapter list on a course page */
.course-map { margin: 8px 0 36px; }
.course-map h2 { margin: 0 0 4px; font-size: 1.5rem; }
.map-intro { margin: 0 0 20px; color: var(--muted); }
.map-grid { list-style: none; padding: 0; margin: 0; display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); counter-reset: none; }
.map-grid li { --t: var(--accent); animation: map-in .5s both; animation-delay: calc(var(--i) * 60ms); }
.map-grid li:nth-child(4n+2) { --t: var(--tint-2); }
.map-grid li:nth-child(4n+3) { --t: var(--tint-3); }
.map-grid li:nth-child(4n+4) { --t: var(--tint-4); }
.map-tile { position: relative; display: flex; flex-direction: column; height: 100%; overflow: hidden; text-decoration: none; color: inherit; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease; }
.map-tile:hover, .map-tile:focus-visible { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--t); }
.map-art { position: relative; display: grid; place-items: center; min-height: 128px; padding: 18px 16px; overflow: hidden; background: linear-gradient(135deg, color-mix(in srgb, var(--t) 34%, var(--surface)), color-mix(in srgb, var(--t) 8%, var(--surface))); }
.map-art::before, .map-art::after { content: ""; position: absolute; border-radius: 50%; background: color-mix(in srgb, var(--t) 22%, transparent); transition: transform .5s ease; }
.map-art::before { width: 120px; height: 120px; right: -34px; bottom: -48px; }
.map-art::after { width: 58px; height: 58px; left: -16px; top: -18px; }
.map-tile:hover .map-art::before { transform: scale(1.18); }
.map-num { position: absolute; top: 8px; right: 14px; font: 700 2.6rem/1 var(--serif); color: color-mix(in srgb, var(--t) 55%, transparent); }
.map-sample { position: relative; z-index: 1; max-width: 90%; text-align: center; font: 600 1.3rem/1.25 var(--serif); color: var(--ink); }
.map-body { display: flex; flex-direction: column; flex: 1; gap: 4px; padding: 16px 18px 18px; }
.map-kicker { font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--t); }
.map-title { font: 600 1.15rem/1.25 var(--serif); color: var(--ink); }
.map-summary { color: var(--muted); font-size: .92rem; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.map-foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 12px; color: var(--muted); font-size: .88rem; font-weight: 600; }
.map-soon { border-style: dashed; box-shadow: none; opacity: .72; }
.map-soon .map-art { background: color-mix(in srgb, var(--t) 8%, var(--surface)); }
.map-soon:hover { transform: none; box-shadow: none; border-color: var(--line); }
.map-soon .map-foot { color: var(--muted); font-size: .85rem; }
.map-go { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; color: var(--ink); background: color-mix(in srgb, var(--t) 18%, transparent); transition: transform .25s ease, background .25s ease; }
.map-tile:hover .map-go { transform: translateX(4px); background: color-mix(in srgb, var(--t) 40%, transparent); }
@keyframes map-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .map-grid li { animation: none; }
  .map-tile, .map-art::before, .map-go { transition: none; }
  .map-tile:hover, .map-tile:focus-visible { transform: none; }
}

/* Pointer from a lesson course to its practice course (templates/courses/_practice_box.html) */
.practice-box { margin: 1.6rem 0; padding: 18px 20px; background: var(--surface-2); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: var(--radius-sm); }
.practice-box h2 { margin: 0 0 .4rem; font-size: 1.15rem; }
.practice-box p { margin: 0 0 .8rem; }

/* Practice link at the end of the course menu (templates/courses/_sidebar.html) */
.nav-practice { display: block; margin: 14px 0 4px; padding: 10px 12px; text-decoration: none; color: var(--ink); background: var(--surface-2); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: var(--radius-sm); }
.nav-practice strong { display: block; font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; color: var(--accent-strong); }
.nav-practice span { font-size: .92rem; font-weight: 600; }
.nav-practice:hover span { text-decoration: underline; }
