/* ============================================================
   Lolometric Notes — Design System
   Free bilingual SNLE learning platform · lolometric.com/notes
   Stack: pure CSS, no frameworks. Mobile-first. RTL-aware.
   Theming: html[data-theme="light|dark"]
   Language: html[data-lang="en|ar"] (+ dir switches in JS)
   ============================================================ */

/* ----------  1. Design tokens  ---------- */
:root {
  /* Brand — deep clinical navy + medical teal (echoes SCFHS palette) */
  --ink:        #16303F;
  --ink-soft:   #33505F;
  --muted:      #5C7484;
  --line:       #DDE6EA;
  --bg:         #F5F8F9;
  --surface:    #FFFFFF;
  --surface-2:  #EEF4F5;

  --accent:     #0E7C6B;   /* medical teal */
  --accent-strong: #0A5F52;
  --accent-soft:#E2F2EE;
  --navy:       #103A52;
  --navy-soft:  #E7EFF4;

  /* Clinical semantic colors */
  --hy:      #0E7C6B;  --hy-bg:      #E4F4F0;  --hy-line:     #9AD4C7; /* high-yield */
  --pearl:   #205FA6;  --pearl-bg:   #E8F0FA;  --pearl-line:  #A9C6EA; /* clinical pearl */
  --trap:    #A85D00;  --trap-bg:    #FCF1DF;  --trap-line:   #EBC894; /* exam trap */
  --danger:  #B3261E;  --danger-bg:  #FBEAE8;  --danger-line: #EAAFAB; /* warning / red flag */
  --think:   #6B4AA0;  --think-bg:   #F0EBF9;  --think-line:  #CDBDE8; /* clinical thinking */

  --shadow-1: 0 1px 2px rgba(16,42,58,.06), 0 2px 8px rgba(16,42,58,.06);
  --shadow-2: 0 4px 14px rgba(16,42,58,.10), 0 12px 32px rgba(16,42,58,.10);

  --radius:    14px;
  --radius-lg: 20px;
  --radius-sm: 9px;

  --font-latin:  "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-arabic: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, system-ui, sans-serif;
  --font-mono:   "IBM Plex Mono", ui-monospace, "SF Mono", Consolas, monospace;

  --content-w: 76rem;
  --lesson-w:  47rem;

  --header-h: 3.75rem;
}

html[data-theme="dark"] {
  --ink:        #E6F0F4;
  --ink-soft:   #C2D4DC;
  --muted:      #8FA7B3;
  --line:       #24404D;
  --bg:         #0C1B23;
  --surface:    #12242E;
  --surface-2:  #182F3B;

  --accent:     #2FC3A6;
  --accent-strong: #57D6BE;
  --accent-soft:#123B37;
  --navy:       #BFD8E6;
  --navy-soft:  #14303F;

  --hy:     #4ED0B4; --hy-bg:     #10352F; --hy-line:     #1D5C50;
  --pearl:  #7FB2EE; --pearl-bg:  #14293F; --pearl-line:  #28517E;
  --trap:   #F0B25E; --trap-bg:   #382A12; --trap-line:   #6E5322;
  --danger: #F2938B; --danger-bg: #3B1B18; --danger-line: #71332E;
  --think:  #C0A6EE; --think-bg:  #2A2140; --think-line:  #4E3D77;

  --shadow-1: 0 1px 2px rgba(0,0,0,.35), 0 2px 10px rgba(0,0,0,.35);
  --shadow-2: 0 6px 18px rgba(0,0,0,.45), 0 16px 40px rgba(0,0,0,.45);
}

/* ----------  2. Base  ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 1rem); }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

body {
  margin: 0;
  font-family: var(--font-latin);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
html[data-lang="ar"] body { font-family: var(--font-arabic); line-height: 1.95; }

img, svg { max-width: 100%; height: auto; display: block; }

a { color: var(--accent-strong); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent); }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

::selection { background: var(--accent); color: #fff; }

h1, h2, h3, h4 { line-height: 1.28; color: var(--ink); font-weight: 700; margin: 0 0 .6em; letter-spacing: -.012em; }
html[data-lang="ar"] :is(h1,h2,h3,h4) { letter-spacing: 0; line-height: 1.5; }
h1 { font-size: clamp(1.7rem, 4.5vw, 2.5rem); }
h2 { font-size: clamp(1.35rem, 3vw, 1.7rem); }
h3 { font-size: clamp(1.12rem, 2.4vw, 1.28rem); }
h4 { font-size: 1.02rem; }
p { margin: 0 0 1em; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px;
  clip-path: inset(50%); overflow: hidden; white-space: nowrap;
}

.skip-link {
  position: absolute; inset-inline-start: .75rem; top: -3.5rem;
  background: var(--navy); color: #fff; padding: .55rem 1rem;
  border-radius: 0 0 10px 10px; z-index: 200; transition: top .2s;
}
.skip-link:focus { top: 0; }

/* ----------  3. Language switching  ---------- */
/* Blocks tagged with lang are shown only in their language mode.
   Add .keep to keep an element visible in both modes. */
html[data-lang="en"] [lang="ar"]:not(.keep) { display: none !important; }
html[data-lang="ar"] [lang="en"]:not(.keep) { display: none !important; }
[lang="ar"] { font-family: var(--font-arabic); }
[lang="en"] { font-family: var(--font-latin); }

/* ----------  4. Layout  ---------- */
.container { width: min(100% - 2.25rem, var(--content-w)); margin-inline: auto; }

/* ----------  5. Header  ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex; align-items: center; gap: .6rem;
  min-height: var(--header-h);
}
.brand {
  display: inline-flex; align-items: center; gap: .55rem;
  font-weight: 700; font-size: 1.06rem; color: var(--ink);
  text-decoration: none; margin-inline-end: auto;
}
.brand .pulse { color: var(--accent); flex: 0 0 auto; }
.brand small {
  font-weight: 600; color: var(--accent-strong);
  border: 1px solid var(--line); border-radius: 999px;
  padding: .05rem .55rem; font-size: .72rem; letter-spacing: .04em;
  background: var(--surface-2);
}

.main-nav { display: none; }
.main-nav a {
  text-decoration: none; color: var(--ink-soft); font-weight: 600;
  font-size: .92rem; padding: .45rem .7rem; border-radius: 8px;
}
.main-nav a:hover, .main-nav a[aria-current="true"] { color: var(--accent-strong); background: var(--accent-soft); }

.icon-btn {
  appearance: none; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); width: 2.35rem; height: 2.35rem; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background .15s, transform .1s;
  font-family: inherit;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn:active { transform: scale(.95); }

.lang-btn { width: auto; padding-inline: .7rem; gap: .4rem; font-weight: 700; font-size: .88rem; }
.lang-btn .lang-alt { color: var(--accent-strong); }

.theme-btn .icon-moon, html[data-theme="dark"] .theme-btn .icon-sun { display: none; }
html[data-theme="dark"] .theme-btn .icon-moon { display: block; }

/* Mobile drawer */
.nav-drawer {
  position: fixed; inset: var(--header-h) 0 auto 0; z-index: 99;
  background: var(--surface); border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-2);
  display: grid; gap: .15rem; padding: .8rem 1.1rem 1.1rem;
  transform: translateY(-110%); transition: transform .25s ease;
}
.nav-drawer.open { transform: translateY(0); }
.nav-drawer a {
  text-decoration: none; color: var(--ink); font-weight: 600;
  padding: .7rem .8rem; border-radius: 10px;
}
.nav-drawer a:hover { background: var(--accent-soft); color: var(--accent-strong); }

@media (min-width: 56rem) {
  .main-nav { display: flex; gap: .15rem; }
  .menu-btn, .nav-drawer { display: none; }
}

/* ----------  6. ECG divider — platform signature  ---------- */
.ecg {
  height: 34px; margin: .25rem 0;
  background-repeat: repeat-x; background-position: center;
  background-size: 260px 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='34' viewBox='0 0 260 34' fill='none'%3E%3Cpath d='M0 17h78l8-6 8 6h22l10-14 10 24 10-10h36l8-5 8 5h62' stroke='%230E7C6B' stroke-opacity='.55' stroke-width='2' stroke-linejoin='round' stroke-linecap='round'/%3E%3C/svg%3E");
  opacity: .8;
}
html[data-theme="dark"] .ecg { filter: brightness(1.6); }

/* ----------  7. Breadcrumb  ---------- */
.breadcrumb { padding-block: .85rem .2rem; font-size: .87rem; }
.breadcrumb ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .2rem; align-items: center; }
.breadcrumb li { display: inline-flex; align-items: center; gap: .2rem; color: var(--muted); }
.breadcrumb li + li::before { content: "›"; margin-inline: .3rem; color: var(--muted); }
html[dir="rtl"] .breadcrumb li + li::before { content: "‹"; }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent-strong); text-decoration: underline; }
.breadcrumb [aria-current="page"] { color: var(--ink); font-weight: 600; }

/* ----------  8. Hero  ---------- */
.hero {
  background:
    radial-gradient(60rem 24rem at 85% -30%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 60%),
    var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: clamp(1.4rem, 4vw, 2.4rem);
  margin-block: 1rem 1.6rem;
  box-shadow: var(--shadow-1);
}
.hero .kicker {
  display: inline-flex; align-items: center; gap: .45rem;
  color: var(--accent-strong); font-weight: 700; letter-spacing: .10em;
  text-transform: uppercase; font-size: .74rem; margin-bottom: .7rem;
}
html[data-lang="ar"] .hero .kicker { letter-spacing: 0; }
.hero h1 { margin-bottom: .25rem; }
.hero .subtitle { color: var(--muted); font-size: 1.06rem; max-width: 52ch; }

.vitals {
  display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.2rem;
  padding-top: 1.1rem; border-top: 1px dashed var(--line);
}
.chip {
  display: inline-flex; align-items: center; gap: .45rem;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 999px; padding: .34rem .8rem;
  font-size: .84rem; font-weight: 600; color: var(--ink-soft);
}
.chip svg { color: var(--accent-strong); }
.chip.freq-high { border-color: var(--hy-line); background: var(--hy-bg); color: var(--hy); }
.chip.diff { border-color: var(--pearl-line); background: var(--pearl-bg); color: var(--pearl); }

/* ----------  9. Cards & grids  ---------- */
.grid { display: grid; gap: 1rem; }
@media (min-width: 40rem)  { .grid.cols-2 { grid-template-columns: 1fr 1fr; } }
@media (min-width: 62rem)  { .grid.cols-4 { grid-template-columns: repeat(4, 1fr); } .grid.cols-3 { grid-template-columns: repeat(3,1fr);} }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.25rem;
  box-shadow: var(--shadow-1);
  display: flex; flex-direction: column; gap: .4rem;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
a.card { text-decoration: none; color: inherit; }
a.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); border-color: var(--accent); }
.card .card-top { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.card .weight {
  font-family: var(--font-mono); font-weight: 700; font-size: .8rem;
  color: var(--accent-strong); background: var(--accent-soft);
  border-radius: 8px; padding: .18rem .5rem;
}
.card h3 { margin: 0; }
.card .card-sub { color: var(--muted); font-size: .92rem; margin: 0; }
.card .card-count { margin-top: auto; padding-top: .6rem; font-size: .85rem; font-weight: 700; color: var(--accent-strong); }

/* Lesson list rows (category pages) */
.lesson-list { list-style: none; margin: .4rem 0 0; padding: 0; display: grid; gap: .55rem; }
.lesson-row {
  display: flex; align-items: center; gap: .85rem;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: .8rem 1rem;
  text-decoration: none; color: inherit;
  transition: border-color .15s, transform .12s, box-shadow .15s;
}
a.lesson-row:hover { border-color: var(--accent); transform: translateX(3px); box-shadow: var(--shadow-1); }
html[dir="rtl"] a.lesson-row:hover { transform: translateX(-3px); }
.lesson-row .num {
  flex: 0 0 auto; width: 2.1rem; height: 2.1rem; border-radius: 10px;
  display: grid; place-items: center; font-family: var(--font-mono);
  font-weight: 700; font-size: .82rem;
  background: var(--navy-soft); color: var(--navy);
}
.lesson-row .t { font-weight: 700; }
.lesson-row .s { color: var(--muted); font-size: .86rem; }
.lesson-row .badges { margin-inline-start: auto; display: flex; gap: .35rem; flex: 0 0 auto; }
.badge {
  font-size: .72rem; font-weight: 700; border-radius: 999px; padding: .16rem .6rem;
  border: 1px solid var(--line); color: var(--muted); background: var(--surface-2);
  white-space: nowrap;
}
.badge.live { color: var(--hy); background: var(--hy-bg); border-color: var(--hy-line); }
.badge.soon { color: var(--trap); background: var(--trap-bg); border-color: var(--trap-line); }
.lesson-row.soon { opacity: .72; }

/* ----------  10. Lesson layout: sidebar TOC + article  ---------- */
.lesson-shell { display: grid; gap: 1.6rem; align-items: start; margin-bottom: 2rem; }
@media (min-width: 64rem) {
  .lesson-shell { grid-template-columns: 15.5rem minmax(0, 1fr); }
}
.toc-wrap { display: none; }
@media (min-width: 64rem) {
  .toc-wrap { display: block; position: sticky; top: calc(var(--header-h) + 1rem); }
}
.toc {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1rem 1.05rem;
  font-size: .88rem; max-height: calc(100vh - var(--header-h) - 2rem); overflow: auto;
}
.toc strong { display: block; margin-bottom: .5rem; font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
html[data-lang="ar"] .toc strong { letter-spacing: 0; }
.toc ol { list-style: none; margin: 0; padding: 0; display: grid; gap: .1rem; }
.toc a {
  display: block; text-decoration: none; color: var(--ink-soft);
  padding: .32rem .55rem; border-radius: 8px;
  border-inline-start: 2px solid transparent;
}
.toc a:hover { background: var(--surface-2); }
.toc a.active { color: var(--accent-strong); background: var(--accent-soft); border-inline-start-color: var(--accent); font-weight: 700; }

/* Mobile TOC (collapsible) */
.toc-mobile { margin-bottom: 1.2rem; }
@media (min-width: 64rem) { .toc-mobile { display: none; } }
details.toc-mobile > summary {
  cursor: pointer; font-weight: 700; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: .8rem 1rem; list-style: none; display: flex; align-items: center; gap: .5rem;
}
details.toc-mobile > summary::-webkit-details-marker { display: none; }
details.toc-mobile[open] > summary { border-radius: var(--radius) var(--radius) 0 0; }
details.toc-mobile .toc { border-top: 0; border-radius: 0 0 var(--radius) var(--radius); max-height: none; }

.lesson-article { min-width: 0; max-width: var(--lesson-w); }
.lesson-article > section { margin-bottom: 2.2rem; scroll-margin-top: calc(var(--header-h) + 1rem); }
.lesson-article section > h2 {
  display: flex; align-items: center; gap: .55rem;
  padding-bottom: .45rem; border-bottom: 2px solid var(--line);
}
.lesson-article section > h2::before {
  content: ""; width: .55rem; height: 1.35rem; border-radius: 4px;
  background: linear-gradient(180deg, var(--accent), var(--navy));
  flex: 0 0 auto;
}
.lesson-article ul, .lesson-article ol { padding-inline-start: 1.3rem; margin: 0 0 1em; }
.lesson-article li { margin-bottom: .35rem; }
.lesson-article li::marker { color: var(--accent-strong); font-weight: 700; }

/* ----------  11. Clinical boxes  ---------- */
.box {
  border: 1px solid; border-radius: var(--radius);
  padding: 1rem 1.1rem .8rem; margin: 1.1rem 0;
  background: var(--surface);
  border-inline-start-width: 5px;
}
.box .box-title {
  display: flex; align-items: center; gap: .5rem;
  font-weight: 800; margin-bottom: .45rem; font-size: .95rem;
}
.box p:last-child, .box ul:last-child, .box ol:last-child { margin-bottom: .2rem; }
.box-hy     { background: var(--hy-bg);     border-color: var(--hy-line);     }
.box-hy .box-title     { color: var(--hy); }
.box-pearl  { background: var(--pearl-bg);  border-color: var(--pearl-line);  }
.box-pearl .box-title  { color: var(--pearl); }
.box-trap   { background: var(--trap-bg);   border-color: var(--trap-line);   }
.box-trap .box-title   { color: var(--trap); }
.box-danger { background: var(--danger-bg); border-color: var(--danger-line); }
.box-danger .box-title { color: var(--danger); }
.box-think  { background: var(--think-bg);  border-color: var(--think-line);  }
.box-think .box-title  { color: var(--think); }
.box-mnemonic { background: var(--navy-soft); border-color: var(--line); }
.box-mnemonic .box-title { color: var(--navy); }
.box .mnemo-word { font-family: var(--font-mono); font-weight: 700; color: var(--accent-strong); }

/* ----------  12. Tables  ---------- */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 1.1rem 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table.data { border-collapse: collapse; width: 100%; min-width: 34rem; font-size: .93rem; }
table.data caption {
  text-align: start; font-weight: 800; padding: .85rem 1rem .3rem; color: var(--ink);
}
table.data th, table.data td { padding: .65rem .9rem; text-align: start; vertical-align: top; border-bottom: 1px solid var(--line); }
table.data thead th {
  background: var(--navy); color: #fff; font-size: .84rem;
  letter-spacing: .03em; position: sticky; top: 0;
}
html[data-theme="dark"] table.data thead th { background: var(--surface-2); color: var(--ink); }
table.data tbody tr:nth-child(even) { background: var(--surface-2); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data td strong { color: var(--accent-strong); }
.num-cell { font-family: var(--font-mono); white-space: nowrap; }

/* ----------  13. Flowchart (pure CSS)  ---------- */
.flow { display: grid; gap: 0; justify-items: center; margin: 1.2rem 0; }
.flow-node {
  background: var(--surface); border: 1.5px solid var(--accent);
  border-radius: 12px; padding: .65rem 1rem; text-align: center;
  font-weight: 600; font-size: .92rem; max-width: 30rem; width: 100%;
  box-shadow: var(--shadow-1);
}
.flow-node.start { background: var(--accent); color: #fff; border-color: var(--accent); }
.flow-node.decision { border-color: var(--trap); background: var(--trap-bg); color: var(--trap); font-weight: 700; }
.flow-node.alert { border-color: var(--danger); background: var(--danger-bg); color: var(--danger); }
.flow-arrow {
  width: 2px; height: 1.3rem; background: var(--muted); position: relative; margin-block: .1rem;
}
.flow-arrow::after {
  content: ""; position: absolute; bottom: -1px; left: 50%; translate: -50% 0;
  border: 5px solid transparent; border-top-color: var(--muted);
}
.flow-arrow[data-label]::before {
  content: attr(data-label); position: absolute; top: 50%; translate: 0 -50%;
  inset-inline-start: .6rem; white-space: nowrap;
  font-size: .74rem; font-weight: 700; color: var(--muted);
}
.flow-branches { display: grid; gap: .8rem; width: 100%; }
@media (min-width: 40rem) { .flow-branches { grid-template-columns: 1fr 1fr; align-items: start; } }
.flow-branch { display: grid; gap: 0; justify-items: center; }

/* ----------  14. Scenario / case blocks  ---------- */
.case {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); margin: 1.1rem 0; overflow: hidden;
}
.case-head {
  background: var(--navy); color: #fff; padding: .7rem 1.1rem;
  font-weight: 700; display: flex; gap: .5rem; align-items: center; font-size: .95rem;
}
html[data-theme="dark"] .case-head { background: var(--surface-2); color: var(--ink); }
.case-body { padding: 1rem 1.1rem .2rem; }
.case-body .q { font-weight: 700; }
.case details {
  margin: .6rem 0 1rem; border: 1px dashed var(--accent); border-radius: 10px;
  background: var(--accent-soft);
}
.case summary {
  cursor: pointer; font-weight: 700; color: var(--accent-strong);
  padding: .6rem .9rem; list-style: none;
}
.case summary::-webkit-details-marker { display: none; }
.case summary::before { content: "▸ "; }
.case details[open] summary::before { content: "▾ "; }
.case details > div { padding: 0 .9rem .8rem; }

/* ----------  15. Quick-review flip items  ---------- */
.qr-list { display: grid; gap: .55rem; margin: .8rem 0; }
.qr-item { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.qr-item summary {
  cursor: pointer; padding: .7rem .95rem; font-weight: 600; list-style: none;
  display: flex; gap: .55rem; align-items: baseline;
}
.qr-item summary::-webkit-details-marker { display: none; }
.qr-item summary::before { content: "Q"; font-family: var(--font-mono); font-weight: 700; color: var(--accent-strong); flex: 0 0 auto; }
.qr-item .a {
  padding: .1rem .95rem .8rem; color: var(--ink-soft);
  border-top: 1px dashed var(--line); margin-top: .1rem; padding-top: .6rem;
}
.qr-item[open] { border-color: var(--accent); }

/* ----------  16. CTA card  ---------- */
.cta {
  margin: 2.4rem 0 1rem;
  border-radius: var(--radius-lg);
  padding: clamp(1.5rem, 4vw, 2.5rem);
  color: #fff; text-align: center;
  background:
    radial-gradient(40rem 18rem at 15% -40%, rgba(47,195,166,.35), transparent 60%),
    linear-gradient(140deg, #103A52, #0A5F52);
  box-shadow: var(--shadow-2);
}
.cta h2 { color: #fff; }
.cta p { color: #DBEDEA; max-width: 46ch; margin-inline: auto; }
.cta ul {
  list-style: none; padding: 0; margin: 1.2rem auto; max-width: 30rem;
  display: grid; gap: .45rem; text-align: start; font-weight: 600;
}
@media (min-width: 40rem) { .cta ul { grid-template-columns: 1fr 1fr; max-width: 38rem; } }
.cta li { display: flex; gap: .5rem; align-items: baseline; }
.cta li::before { content: "✔"; color: #4ED0B4; font-weight: 900; }
.btn-primary {
  display: inline-flex; align-items: center; gap: .55rem;
  background: #fff; color: #0A5F52; font-weight: 800; font-size: 1.05rem;
  text-decoration: none; border-radius: 999px; padding: .85rem 1.8rem;
  margin-top: .6rem; box-shadow: 0 6px 18px rgba(0,0,0,.25);
  transition: transform .15s;
}
.btn-primary:hover { transform: translateY(-2px) scale(1.02); color: #0A5F52; }

/* ----------  17. Lesson prev/next nav  ---------- */
.lesson-nav { display: grid; gap: .7rem; margin: 1.8rem 0; }
@media (min-width: 40rem) { .lesson-nav { grid-template-columns: 1fr 1fr; } }
.lesson-nav a {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); padding: .85rem 1rem; text-decoration: none;
  display: grid; gap: .1rem;
}
.lesson-nav a:hover { border-color: var(--accent); box-shadow: var(--shadow-1); }
.lesson-nav .dir { font-size: .76rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
html[data-lang="ar"] .lesson-nav .dir { letter-spacing: 0; }
.lesson-nav .title { font-weight: 700; color: var(--ink); }
.lesson-nav .next { text-align: end; }
.backlinks { display: flex; flex-wrap: wrap; gap: .5rem 1.2rem; font-size: .9rem; margin-bottom: 2rem; }

/* ----------  18. Reading progress + floating mobile nav  ---------- */
.progress {
  position: fixed; top: 0; inset-inline-start: 0; height: 3px; width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--navy));
  z-index: 120;
}
.float-nav {
  position: fixed; bottom: 1rem; inset-inline: 0; z-index: 90;
  display: flex; justify-content: center; pointer-events: none;
}
.float-nav .inner {
  pointer-events: auto; display: flex; gap: .3rem;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line); border-radius: 999px;
  box-shadow: var(--shadow-2); padding: .35rem;
}
.float-nav a, .float-nav button {
  appearance: none; border: 0; background: transparent; cursor: pointer;
  color: var(--ink); font: inherit; font-weight: 700; font-size: .84rem;
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .5rem .85rem; border-radius: 999px; text-decoration: none;
}
.float-nav a:hover, .float-nav button:hover { background: var(--accent-soft); color: var(--accent-strong); }
@media (min-width: 64rem) { .float-nav { display: none; } }

/* ----------  19. Objectives list  ---------- */
.objectives { list-style: none; padding: 0; display: grid; gap: .5rem; }
.objectives li {
  display: flex; gap: .6rem; align-items: baseline;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: .6rem .85rem;
}
.objectives li::before { content: "◆"; color: var(--accent); font-size: .8rem; flex: 0 0 auto; }

/* ----------  20. Footer  ---------- */
.site-footer {
  border-top: 1px solid var(--line); margin-top: 2rem;
  padding: 1.6rem 0 5.5rem; color: var(--muted); font-size: .88rem;
  background: var(--surface);
}
.site-footer .container { display: grid; gap: .4rem; }
.site-footer a { color: var(--accent-strong); }

/* ----------  21. Section index hero band (home) ---------- */
.stat-band { display: grid; gap: .8rem; margin: 1.4rem 0; }
@media (min-width: 40rem) { .stat-band { grid-template-columns: repeat(4, 1fr); } }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: .9rem 1rem; text-align: center;
}
.stat .v { font-family: var(--font-mono); font-weight: 700; font-size: 1.5rem; color: var(--accent-strong); }
.stat .l { font-size: .82rem; color: var(--muted); font-weight: 600; }

/* Print */
@media print {
  .site-header, .float-nav, .cta, .toc-wrap, .toc-mobile, .lesson-nav, .progress, .nav-drawer { display: none !important; }
  body { background: #fff; color: #000; }
  .box, .card, .table-scroll { box-shadow: none; }
}
