/* ==========================================================================
   Genome Hub — stylesheet
   Dark mode is the default; light mode uses [data-theme="light"].
   Logical properties (inline-start / inline-end) keep RTL and LTR in sync.
   ========================================================================== */

/* ---------- 1. Tokens ---------- */
:root {
  --bg: #0E0B18;
  --bg-2: #141020;
  --card: #181425;
  --card-2: #1E1930;
  --primary: #8B5CF6;
  --primary-strong: #7C3AED;
  --primary-hover: #6D28D9;
  --accent: #A78BFA;
  --primary-soft: rgba(139, 92, 246, .13);
  --text: #FAF7FF;
  --muted: #B8ACCC;
  --subtle: #8C80A3;
  --border: #30263F;
  --border-strong: #463A5C;
  --success: #45E0A8;
  --success-soft: rgba(69, 224, 168, .12);
  --error: #FF7B9B;
  --error-soft: rgba(255, 123, 155, .12);
  --warning: #F5C66B;
  --warning-soft: rgba(245, 198, 107, .12);
  --header-bg: rgba(14, 11, 24, .88);
  --helix-a: #8B5CF6;
  --helix-b: #A78BFA;

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px; --s9: 88px;
  --radius-sm: 6px;
  --radius: 12px;
  --radius-lg: 12px;
  --container: 1200px;
  --header-h: 60px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --font-ar: "IBM Plex Sans Arabic", "Inter", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  --font-en: "Inter", "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #F8F7FC;
  --bg-2: #F1EEF8;
  --card: #FFFFFF;
  --card-2: #FBFAFD;
  --primary: #7C3AED;
  --primary-strong: #7C3AED;
  --primary-hover: #6D28D9;
  --accent: #6D28D9;
  --primary-soft: #EFEAFD;
  --text: #21143E;
  --muted: #615970;
  --subtle: #716A7E;
  --border: #E5DEF1;
  --border-strong: #D3C8E6;
  --success: #0E8A60;
  --success-soft: #E4F6EE;
  --error: #C92A57;
  --error-soft: #FDEBF0;
  --warning: #8F5D00;
  --warning-soft: #FFF3D9;
  --header-bg: rgba(248, 247, 252, .9);
  --helix-a: #7C3AED;
  --helix-b: #A78BFA;
  color-scheme: light;
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font-ar); font-size: 16px; line-height: 1.75;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  transition: background-color .2s var(--ease), color .2s var(--ease);
}
html[lang="en"] body { font-family: var(--font-en); line-height: 1.65; }
img, svg, iframe { max-width: 100%; display: block; }
img { height: auto; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3, h4 { margin: 0 0 .5em; font-weight: 700; line-height: 1.3; letter-spacing: -.015em; }
html[lang="ar"] :is(h1, h2, h3, h4) { letter-spacing: 0; line-height: 1.5; }
h1 { font-size: clamp(2rem, 4.4vw, 3.3rem); }
h2 { font-size: clamp(1.4rem, 2.4vw, 1.85rem); }
h3 { font-size: 1.06rem; }
p { margin: 0 0 1em; }
ul, ol { margin: 0; padding: 0; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--primary); color: #fff; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; inset-inline-start: 12px; top: -60px; z-index: 200; background: var(--primary-strong); color: #fff; padding: 8px 14px; border-radius: var(--radius-sm); }
.skip-link:focus { top: 10px; }
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: 20px; }
.icon { width: 1.2em; height: 1.2em; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
[dir="rtl"] .icon-dir { transform: scaleX(-1); }
.ltr { direction: ltr; unicode-bidi: isolate; }
.muted { color: var(--muted); }
.mono { font-family: var(--font-mono); }
code { font-family: var(--font-mono); font-size: .88em; background: var(--bg-2); border: 1px solid var(--border); padding: 0 5px; border-radius: 4px; direction: ltr; unicode-bidi: isolate; }

/* ---------- 3. Buttons, chips, badges, inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: 42px; padding: 9px 18px; border-radius: var(--radius-sm);
  border: 1px solid transparent; font-weight: 600; font-size: .93rem; line-height: 1.2;
  cursor: pointer; text-decoration: none !important; white-space: nowrap;
  transition: background-color .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease);
}
.btn-primary { background: var(--primary-strong); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-outline { border-color: var(--border-strong); color: var(--text); background: transparent; }
.btn-outline:hover { border-color: var(--primary); background: var(--primary-soft); }
.btn-ghost { color: var(--accent); background: transparent; padding-inline: 10px; }
.btn-ghost:hover { background: var(--primary-soft); }
.btn-sm { min-height: 36px; padding: 6px 13px; font-size: .86rem; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn-soon { background: var(--bg-2); color: var(--subtle); border-color: var(--border); }

.icon-btn {
  display: inline-grid; place-items: center; min-width: 44px; height: 44px; padding: 0 8px; border-radius: var(--radius-sm);
  border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer; font-weight: 600; font-size: .85rem;
  transition: background-color .15s, color .15s, border-color .15s;
}
.icon-btn:hover { color: var(--text); background: var(--primary-soft); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: .4em; min-height: 34px; padding: 4px 13px;
  border-radius: 999px; border: 1px solid var(--border); background: transparent; color: var(--muted);
  font-size: .87rem; font-weight: 500; cursor: pointer; transition: all .15s var(--ease);
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip[aria-pressed="true"], .chip[aria-checked="true"] { background: var(--text); border-color: var(--text); color: var(--bg); }
.chip[disabled] { opacity: .4; cursor: not-allowed; }
.chip small { font-weight: 400; opacity: .75; }

.badge { display: inline-flex; align-items: center; gap: .35em; padding: 1px 9px; border-radius: 999px; font-size: .75rem; font-weight: 600; line-height: 1.8; white-space: nowrap; background: var(--primary-soft); color: var(--accent); }
.badge-muted { background: transparent; box-shadow: inset 0 0 0 1px var(--border); color: var(--muted); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-soon { background: var(--bg-2); color: var(--subtle); box-shadow: inset 0 0 0 1px var(--border); }

.search {
  display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 0 14px; border-radius: var(--radius);
  border: 1px solid var(--border-strong); background: var(--card); color: var(--muted);
}
.search:focus-within { border-color: var(--primary); }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; color: var(--text); font-size: .98rem; padding: 10px 0; }
.search input::placeholder { color: var(--subtle); }

/* ---------- 4. Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100; height: var(--header-h);
  background: var(--header-bg); backdrop-filter: saturate(160%) blur(12px); -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner { height: 100%; display: flex; align-items: center; gap: 28px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none !important; flex-shrink: 0; }
.brand img { width: 32px; height: 32px; border-radius: 8px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: .98rem; font-weight: 700; }
.nav-list { display: flex; gap: 2px; list-style: none; }
.nav-link {
  position: relative; display: block; padding: 0 11px; line-height: var(--header-h); color: var(--muted);
  font-weight: 500; font-size: .92rem; text-decoration: none !important; transition: color .15s;
}
.nav-link:hover { color: var(--text); }
.nav-link[aria-current="page"] { color: var(--text); }
.nav-link[aria-current="page"]::after { content: ""; position: absolute; inset-inline: 11px; bottom: -1px; height: 2px; background: var(--primary); border-radius: 2px; }
.header-actions { margin-inline-start: auto; display: flex; align-items: center; gap: 2px; }
.menu-btn { display: none; }
@media (max-width: 940px) {
  .menu-btn { display: inline-grid; }
  .main-nav {
    position: fixed; inset: var(--header-h) 0 auto 0; background: var(--bg); border-bottom: 1px solid var(--border);
    max-height: calc(100dvh - var(--header-h)); overflow-y: auto;
    opacity: 0; visibility: hidden; transform: translateY(-6px);
    transition: opacity .18s var(--ease), transform .18s var(--ease), visibility .18s;
  }
  .main-nav.is-open { opacity: 1; visibility: visible; transform: none; }
  .nav-list { flex-direction: column; padding: 10px 20px 18px; gap: 0; }
  .nav-link { line-height: 1.5; padding: 13px 4px; font-size: 1.02rem; border-bottom: 1px solid var(--border); }
  .nav-list li:last-child .nav-link { border-bottom: 0; }
  .nav-link[aria-current="page"] { color: var(--accent); }
  .nav-link[aria-current="page"]::after { display: none; }
  body.nav-open { overflow: hidden; }
}

/* file:// notice */
.local-notice { background: var(--warning-soft); color: var(--text); border-bottom: 1px solid var(--border); font-size: .9rem; }
.local-notice .container { display: flex; gap: 10px; align-items: flex-start; padding-block: 12px; }
.local-notice .icon { color: var(--warning); margin-top: .25em; }
.local-notice p { margin: 0; }

/* ---------- 5. Sections ---------- */
.section { padding-block: clamp(48px, 7vw, 84px); }
.section { border-top: 1px solid var(--border); }
.hero + .section, .section.no-rule { border-top: 0; }
.section-tint { background: var(--bg-2); }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 32px; flex-wrap: wrap; margin-bottom: 28px; }
.section-head > div { max-width: 640px; }
.section-head h2 { margin-bottom: 6px; }
.section-head p { margin: 0; color: var(--muted); }
.kicker { display: inline-block; font-size: .8rem; font-weight: 600; color: var(--accent); margin-bottom: 8px; letter-spacing: .02em; }
html[lang="en"] .kicker { text-transform: uppercase; letter-spacing: .08em; font-size: .74rem; }
.link-more { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: .92rem; color: var(--accent); white-space: nowrap; }

.page-header { padding-block: clamp(32px, 5vw, 52px) clamp(24px, 4vw, 36px); position: relative; overflow: hidden; }
.page-header h1 { font-size: clamp(1.7rem, 3.4vw, 2.4rem); margin-bottom: 8px; }
.page-header p { color: var(--muted); max-width: 640px; margin: 0; font-size: 1.04rem; }
.page-header .meta-line { margin-top: 14px; }
.page-header .helix-bg { position: absolute; inset-inline-end: -30px; top: 50%; transform: translateY(-50%); width: 300px; opacity: .28; pointer-events: none; }
.page-header.compact { padding-block: 26px 22px; }
.page-header.compact h1 { font-size: clamp(1.45rem, 2.6vw, 1.85rem); margin-bottom: 4px; }
.page-header.compact p { font-size: .98rem; }
@media (max-width: 760px) { .page-header .helix-bg { display: none; } }
.meta-line { display: flex; align-items: center; gap: 8px; font-size: .86rem; color: var(--subtle); flex-wrap: wrap; }
.meta-line .icon { width: 16px; height: 16px; }

.subnav { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 28px; overflow-x: auto; }
.subnav a { padding: 10px 14px; color: var(--muted); font-weight: 600; font-size: .93rem; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; text-decoration: none; }
.subnav a:hover { color: var(--text); }
.subnav a[aria-current="true"] { color: var(--text); border-color: var(--primary); }

/* ---------- 6. Hero ---------- */
.hero { padding-block: clamp(36px, 6vw, 72px) clamp(28px, 4vw, 48px); position: relative; overflow: hidden; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr); gap: 48px; align-items: center; }
.hero h1 { margin-bottom: 18px; max-width: 14ch; }
html[lang="en"] .hero h1 { max-width: 16ch; }
.hero .lead { font-size: clamp(1.04rem, 1.5vw, 1.16rem); color: var(--muted); max-width: 540px; margin-bottom: 30px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.hero-art { display: grid; place-items: center; }
.hero-art svg { width: 100%; max-width: 280px; opacity: .9; }
.seq-line { margin-top: 44px; font-family: var(--font-mono); font-size: .78rem; letter-spacing: .32em; color: var(--subtle); opacity: .55; white-space: nowrap; overflow: hidden; direction: ltr; text-overflow: clip; user-select: none; }
@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; gap: 28px; }
  .hero-art { display: none; }
  .hero h1 { max-width: none; }
}

.helix .strand-a { stroke: var(--helix-a); }
.helix .strand-b { stroke: var(--helix-b); }
.helix .rung { stroke: var(--border-strong); }
.helix .node-a { fill: var(--helix-a); }
.helix .node-b { fill: var(--bg); stroke: var(--helix-b); stroke-width: 1.5; }
@media (prefers-reduced-motion: no-preference) {
  .helix .helix-group { animation: helix-float 10s ease-in-out infinite; }
}
@keyframes helix-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

/* ---------- 7. Stats band ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.stat { padding: 26px 24px; border-inline-start: 1px solid var(--border); }
.stat:first-child { border-inline-start: 0; padding-inline-start: 0; }
.stat-value { font-family: var(--font-en); font-size: clamp(2rem, 3.6vw, 2.7rem); font-weight: 700; line-height: 1.05; letter-spacing: -.02em; direction: ltr; unicode-bidi: isolate; display: inline-block; }
.stat-label { margin-top: 8px; font-weight: 600; font-size: .95rem; }
.stat-note { display: block; margin-top: 4px; font-size: .78rem; color: var(--subtle); }
@media (max-width: 620px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .stat { padding: 20px 16px; border-inline-start: 0; border-top: 1px solid var(--border); }
  .stat:nth-child(-n+2) { border-top: 0; }
  .stat:nth-child(even) { border-inline-start: 1px solid var(--border); }
  .stat:first-child { padding-inline-start: 16px; }
}

/* ---------- 8. Grids, tiles, cards ---------- */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 980px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 22px; position: relative; transition: border-color .15s var(--ease); }
.card h3 { margin-bottom: 6px; }
.card p { color: var(--muted); font-size: .93rem; margin: 0; }
.card-link { color: inherit; text-decoration: none !important; display: block; }
a.card:hover, .card-link:hover { border-color: var(--border-strong); }
.icon-box { width: 38px; height: 38px; border-radius: 9px; display: grid; place-items: center; background: var(--primary-soft); color: var(--accent); flex-shrink: 0; }
.icon-box .icon { width: 19px; height: 19px; }
.card-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.card-foot { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 18px; }

.tile { display: flex; gap: 14px; align-items: flex-start; padding: 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); color: inherit; text-decoration: none !important; transition: border-color .15s, background-color .15s; }
.tile:hover { border-color: var(--border-strong); background: var(--card-2); }
.tile h3 { font-size: .98rem; margin: 0 0 2px; }
.tile p { margin: 0; font-size: .85rem; color: var(--muted); line-height: 1.55; }

/* Series card (Learn) */
.series-card { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.cover { position: relative; aspect-ratio: 16 / 9; background: var(--bg-2); border-bottom: 1px solid var(--border); overflow: hidden; }
.cover img { width: 100%; height: 100%; object-fit: cover; }
.cover-art { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; padding: 16px 18px; }
.cover-art .icon-box { width: 44px; height: 44px; }
.cover-art .icon-box .icon { width: 22px; height: 22px; }
.cover-art .cover-subject { font-family: var(--font-mono); font-size: .76rem; letter-spacing: .14em; text-transform: uppercase; color: var(--subtle); direction: ltr; text-align: end; }
.cover-art svg.cover-helix { position: absolute; inset-inline-end: -20px; bottom: -30px; width: 55%; opacity: .35; }
.cover .badge { position: absolute; top: 12px; inset-inline-end: 12px; }
.series-body { padding: 18px 20px 20px; display: flex; flex-direction: column; flex: 1; }
.series-body h3 { font-size: 1.04rem; }
.series-body p { color: var(--muted); font-size: .9rem; margin: 0; }
.series-body .card-foot { margin-top: auto; padding-top: 16px; }

/* Program card */
.program-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.program-media { aspect-ratio: 16 / 8; background: var(--bg-2); display: grid; place-items: center; color: var(--accent); border-bottom: 1px solid var(--border); overflow: hidden; }
.program-media img { width: 100%; height: 100%; object-fit: cover; }
.program-media .icon { width: 34px; height: 34px; opacity: .6; }
.program-body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.program-body h3 { margin: 0; }
.program-body p { margin: 0; color: var(--muted); font-size: .92rem; }
.program-body .card-foot { margin-top: auto; padding-top: 8px; }
/* Program without a real photo: no empty picture area; the type icon sits beside the badges. */
.program-card.no-media .card-meta { align-items: center; gap: 8px; }
.program-card.no-media .card-meta .icon-box { width: 34px; height: 34px; margin-inline-end: 2px; }
.grid.single .program-card.no-media .program-body { padding: 24px 28px; }
.meta-list { list-style: none; display: grid; gap: 4px; font-size: .86rem; color: var(--muted); }
.meta-list li { display: flex; gap: 8px; align-items: center; }
.meta-list .icon { width: 15px; height: 15px; color: var(--subtle); }

/* Rows (executed programs, reports) */
.rows { list-style: none; border-top: 1px solid var(--border); }
.row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 24px; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--border); }
.row h3 { margin: 0; font-size: 1rem; }
.row p { margin: 2px 0 0; color: var(--muted); font-size: .88rem; }
.row .row-meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; justify-content: flex-end; color: var(--subtle); font-size: .85rem; }
@media (max-width: 620px) { .row { grid-template-columns: 1fr; } .row .row-meta { justify-content: flex-start; } }

/* ---------- 9. Timeline ---------- */
.timeline { list-style: none; position: relative; padding-inline-start: 26px; }
.timeline::before { content: ""; position: absolute; inset-inline-start: 6px; top: 8px; bottom: 8px; width: 1px; background: var(--border-strong); }
.timeline li { position: relative; padding-bottom: 24px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before { content: ""; position: absolute; inset-inline-start: -25px; top: 8px; width: 11px; height: 11px; border-radius: 50%; background: var(--bg); border: 2px solid var(--primary); }
.timeline time { font-size: .82rem; color: var(--accent); font-weight: 600; font-family: var(--font-en); }
.timeline h3 { margin: 2px 0 2px; font-size: 1rem; }
.timeline p { color: var(--muted); margin: 0; font-size: .92rem; }

/* ---------- 10. People, partners, stories ---------- */
.founder { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 28px; align-items: center; }
.founder .avatar { width: 140px; height: 140px; font-size: 2.2rem; margin: 0; }
.founder h3 { font-size: 1.3rem; margin-bottom: 2px; }
.founder .role { color: var(--accent); font-weight: 600; margin-bottom: 10px; }
.founder p { color: var(--muted); margin: 0 0 12px; }
@media (max-width: 620px) { .founder { grid-template-columns: 1fr; } .founder .avatar { width: 96px; height: 96px; font-size: 1.6rem; } }
.avatar { width: 72px; height: 72px; border-radius: 50%; margin: 0 auto 12px; background: var(--primary-soft); color: var(--accent); display: grid; place-items: center; font-weight: 700; font-size: 1.25rem; overflow: hidden; border: 1px solid var(--border); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.person { text-align: center; padding: 20px 16px; }
.person h3 { margin-bottom: 2px; font-size: .98rem; }
.person .role { color: var(--muted); font-size: .86rem; margin-bottom: 8px; }
.person-links { display: flex; justify-content: center; gap: 4px; }
.person-links a { color: var(--muted); display: grid; place-items: center; width: 32px; height: 32px; border-radius: var(--radius-sm); }
.person-links a:hover { color: var(--text); background: var(--primary-soft); }

.partner { display: flex; align-items: center; gap: 14px; }
.partner-logo { width: 56px; height: 56px; border-radius: 10px; background: var(--bg-2); display: grid; place-items: center; overflow: hidden; flex-shrink: 0; border: 1px solid var(--border); color: var(--accent); }
.partner-logo img { width: 100%; height: 100%; object-fit: contain; padding: 6px; background: #fff; }
.partner h3 { margin: 0; font-size: 1rem; }
.partner p { margin: 2px 0 0; font-size: .86rem; color: var(--muted); }

.story { display: flex; flex-direction: column; gap: 12px; }
.story blockquote { margin: 0; font-size: 1rem; line-height: 1.8; color: var(--text); }
.story .outcome { font-size: .86rem; color: var(--success); font-weight: 600; display: flex; gap: 6px; align-items: center; }
.story footer { display: flex; align-items: center; gap: 10px; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); }
.story footer strong { display: block; font-size: .92rem; }
.story footer span { color: var(--muted); font-size: .84rem; }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.gallery figure { margin: 0; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); background: var(--card); }
.gallery img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.gallery figcaption { padding: 8px 12px; font-size: .84rem; color: var(--muted); }

/* ---------- 11. Split blocks, values, CTA ---------- */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: start; }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; gap: 28px; } }
.prose-lg p { font-size: 1.05rem; color: var(--muted); }
.prose-lg p:first-child { color: var(--text); font-size: 1.12rem; }
.statement { border-inline-start: 2px solid var(--primary); padding-inline-start: 18px; margin-bottom: 22px; }
.statement h3 { font-size: .82rem; font-weight: 700; color: var(--accent); margin-bottom: 4px; }
html[lang="en"] .statement h3 { text-transform: uppercase; letter-spacing: .08em; font-size: .74rem; }
.statement p { margin: 0; font-size: 1.04rem; }
.values { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border-top: 1px solid var(--border); }
.value { padding: 22px 18px 0; border-inline-start: 1px solid var(--border); }
.value:first-child { border-inline-start: 0; padding-inline-start: 0; }
.value .icon { color: var(--accent); width: 22px; height: 22px; margin-bottom: 12px; }
.value h3 { margin-bottom: 4px; font-size: 1rem; }
.value p { font-size: .88rem; color: var(--muted); margin: 0; }
@media (max-width: 980px) {
  .values { grid-template-columns: 1fr 1fr; gap: 0; }
  .value, .value:first-child { border-inline-start: 0; padding: 18px 0; border-bottom: 1px solid var(--border); }
  .value:nth-child(odd) { padding-inline-end: 16px; }
}
@media (max-width: 560px) { .values { grid-template-columns: 1fr; } }
.facts { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 18px; font-size: .9rem; color: var(--muted); }
.facts li { display: flex; align-items: center; gap: 8px; }
.facts .icon { width: 16px; height: 16px; color: var(--accent); }

.cta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 18px; padding: clamp(22px, 4vw, 32px); border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--card); }
.cta h2, .cta h3 { margin-bottom: 4px; font-size: 1.25rem; }
.cta p { margin: 0; color: var(--muted); }

/* Social band */
.social-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.social-item { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); color: var(--text); text-decoration: none !important; transition: border-color .15s; }
.social-item:hover { border-color: var(--primary); }
.social-item .icon-box { width: 42px; height: 42px; }
.social-item strong { display: block; font-size: .98rem; }
.social-item span { font-size: .84rem; color: var(--muted); }
.social-item .icon-dir { margin-inline-start: auto; color: var(--subtle); }

.contact-list { list-style: none; display: grid; gap: 10px; }
.contact-list a { display: inline-flex; align-items: center; gap: 10px; color: var(--text); }
.contact-list a:hover { color: var(--accent); }

/* ---------- 12. Glossary ---------- */
.glossary-tools, .filters { display: grid; gap: 12px; margin-bottom: 22px; }
.letter-group { margin-bottom: 8px; }
.letter { font-family: var(--font-en); font-weight: 700; color: var(--accent); font-size: .95rem; padding: 10px 0 6px; border-bottom: 1px solid var(--border); position: sticky; top: var(--header-h); background: var(--bg); z-index: 1; }
html[lang="ar"] .letter { font-family: var(--font-ar); }
.term { display: grid; grid-template-columns: minmax(0, 260px) minmax(0, 1fr); gap: 6px 28px; padding: 16px 0; border-bottom: 1px solid var(--border); }
.term-names strong { display: block; font-size: 1rem; }
.term-names .alt { display: block; color: var(--muted); font-size: .92rem; }
.term-names .badge { margin-top: 8px; }
.term-def { color: var(--muted); font-size: .95rem; margin: 0; }
@media (max-width: 680px) { .term { grid-template-columns: 1fr; } }
.result-count { color: var(--subtle); font-size: .86rem; }

/* ---------- 13. States & notices ---------- */
.state { text-align: center; padding: 40px 20px; border: 1px dashed var(--border-strong); border-radius: var(--radius); color: var(--muted); grid-column: 1 / -1; }
.state .icon { width: 28px; height: 28px; margin: 0 auto 10px; color: var(--accent); }
.state h3 { color: var(--text); font-size: 1.02rem; margin-bottom: 4px; }
.state p { margin: 0 auto; max-width: 460px; font-size: .93rem; }
.state-error .icon { color: var(--error); }
.skeleton { border-radius: var(--radius); background: var(--card); border: 1px solid var(--border); min-height: 150px; position: relative; overflow: hidden; }
.skeleton::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(167, 139, 250, .07), transparent); animation: shimmer 1.4s infinite; }
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.note { display: flex; gap: 10px; align-items: flex-start; font-size: .86rem; color: var(--muted); }
.note .icon { width: 16px; height: 16px; margin-top: .3em; color: var(--subtle); }
.note p { margin: 0; }

/* ---------- 14. Practice ---------- */
.subject-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.subject-card { display: flex; flex-direction: column; gap: 12px; padding: 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); }
.subject-card.is-soon { background: transparent; }
.subject-card.is-soon .icon-box { background: var(--bg-2); color: var(--subtle); }
.subject-card header { display: flex; align-items: center; gap: 12px; }
.subject-card h3 { margin: 0; font-size: 1rem; }
.subject-card .count { font-size: .84rem; color: var(--muted); }
.subject-card .levels { display: flex; gap: 6px; flex-wrap: wrap; min-height: 24px; }
.subject-card .btn { margin-top: auto; }

.quiz-shell { max-width: 780px; margin-inline: auto; }
.setup { padding: clamp(20px, 4vw, 28px); }
.setup-head { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.setup-head h2 { margin: 0; font-size: 1.25rem; }
.setup .field { margin-bottom: 20px; display: grid; gap: 8px; }
.field-label { font-size: .82rem; font-weight: 600; color: var(--muted); }
.setup-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: center; margin-top: 6px; }
.quiz-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; font-size: .88rem; color: var(--muted); flex-wrap: wrap; }
.progress { height: 6px; background: var(--bg-2); border-radius: 999px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--primary); border-radius: 999px; transition: width .3s var(--ease); }
.question-card { margin-top: 18px; padding: clamp(20px, 4vw, 30px); }
.question-text { font-size: clamp(1.08rem, 2vw, 1.25rem); font-weight: 600; margin-bottom: 18px; line-height: 1.65; }
.choices { display: grid; gap: 8px; list-style: none; }
.choice { width: 100%; display: flex; align-items: center; gap: 12px; padding: 13px 15px; text-align: start; border-radius: var(--radius); border: 1px solid var(--border); background: transparent; cursor: pointer; font-size: .98rem; line-height: 1.5; transition: border-color .12s, background-color .12s; }
.choice:hover:not([disabled]) { border-color: var(--primary); background: var(--primary-soft); }
.choice-key { flex-shrink: 0; width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; background: var(--bg-2); font-weight: 600; font-size: .82rem; }
.choice .state-icon { margin-inline-start: auto; }
.choice[disabled] { cursor: default; }
.choice.is-correct { border-color: var(--success); background: var(--success-soft); }
.choice.is-correct .choice-key { background: var(--success); color: #062A1D; }
.choice.is-wrong { border-color: var(--error); background: var(--error-soft); }
.choice.is-wrong .choice-key { background: var(--error); color: #3A0716; }
.choice.is-dim { opacity: .55; }
.feedback { margin-top: 16px; padding: 14px 16px; border-radius: var(--radius); background: var(--bg-2); border: 1px solid var(--border); }
.feedback-title { display: flex; align-items: center; gap: 8px; font-weight: 700; margin-bottom: 4px; }
.feedback.ok .feedback-title { color: var(--success); }
.feedback.bad .feedback-title { color: var(--error); }
.explanation { margin: 0; color: var(--muted); }
.quiz-actions { display: flex; justify-content: space-between; gap: 12px; margin-top: 20px; flex-wrap: wrap; }
.result-card { text-align: center; padding: clamp(26px, 5vw, 40px); }
.score-ring { width: 132px; height: 132px; margin: 0 auto 16px; position: relative; }
.score-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.score-ring circle { fill: none; stroke-width: 9; }
.score-ring .track { stroke: var(--bg-2); }
.score-ring .value { stroke: var(--primary); stroke-linecap: round; transition: stroke-dashoffset .8s var(--ease); }
.score-ring strong { position: absolute; inset: 0; display: grid; place-items: center; font-size: 1.8rem; font-family: var(--font-en); }
.result-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.review-list { list-style: none; display: grid; gap: 12px; margin-top: 16px; text-align: start; }
.review-item { padding: 16px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--card-2); }
.review-item h3 { font-size: .98rem; font-weight: 600; margin-bottom: 8px; }
.review-item .ans { display: flex; gap: 8px; font-size: .9rem; margin-bottom: 4px; align-items: flex-start; }
.review-item .ans .icon { margin-top: .25em; }
.review-item .ans.wrong { color: var(--error); }
.review-item .ans.right { color: var(--success); }
.review-item .explanation { margin-top: 6px; font-size: .88rem; }
.progress-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.progress-table th, .progress-table td { padding: 9px 8px; text-align: start; border-bottom: 1px solid var(--border); }
.progress-table th { color: var(--subtle); font-weight: 600; font-size: .8rem; }
.progress-table td.num { font-family: var(--font-en); }

/* ---------- 15. Modal player ---------- */
.player-backdrop { position: fixed; inset: 0; z-index: 300; background: rgba(6, 3, 14, .8); display: grid; place-items: center; padding: 16px; }
.player { width: min(960px, 100%); background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.player-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.player-head h2 { font-size: 1rem; margin: 0; flex: 1; }
.player-frame { position: relative; aspect-ratio: 16 / 9; background: #000; }
.player-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.player-foot { display: flex; flex-wrap: wrap; gap: 10px; padding: 12px 16px; align-items: center; }
.player-foot .muted { margin-inline-end: auto; font-size: .84rem; }

/* ---------- 16. Prose ---------- */
.prose { max-width: 740px; }
.prose h2 { font-size: 1.2rem; margin-top: 2em; }
.prose p { color: var(--muted); }

/* ---------- 17. Footer ---------- */
.site-footer { border-top: 1px solid var(--border); background: var(--bg-2); padding-block: 36px 20px; }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: 32px; align-items: start; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr 1fr; gap: 24px; } .footer-about { grid-column: 1 / -1; } }
@media (max-width: 520px) { .footer-grid { grid-template-columns: 1fr; gap: 22px; } }
.footer-about p { color: var(--muted); font-size: .9rem; max-width: 360px; margin: 10px 0 0; }
.slogan { font-weight: 700; color: var(--text); margin-top: 10px !important; letter-spacing: .01em; }
.footer-title { font-size: .8rem; font-weight: 700; color: var(--subtle); margin-bottom: 12px; }
html[lang="en"] .footer-title { text-transform: uppercase; letter-spacing: .08em; font-size: .72rem; }
.footer-links { list-style: none; display: grid; gap: 7px; }
.footer-quick { grid-template-columns: repeat(2, max-content); column-gap: 32px; row-gap: 8px; }
.footer-links a { color: var(--muted); font-size: .9rem; }
.footer-links a:hover { color: var(--text); }
.footer-social { display: flex; gap: 6px; margin-top: 14px; }
.footer-title + .footer-social { margin-top: 0; }
.footer-social a { display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--muted); }
.footer-social a:hover { color: var(--text); border-color: var(--primary); }
.footer-bottom { margin-top: 26px; padding-top: 16px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; font-size: .82rem; color: var(--subtle); }
.footer-bottom a { color: var(--subtle); }

/* ---------- 18. Motion ---------- */
.reveal { opacity: 0; transform: translateY(8px); transition: opacity .45s var(--ease), transform .45s var(--ease); }
.reveal.is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
}
@media print {
  .site-header, .site-footer, .hero-art, .btn, .local-notice { display: none !important; }
  body { background: #fff; color: #000; }
}

/* ---------- 19. Refinements ---------- */
.subject-card .levels:empty { display: none; }
.subject-card.is-soon { gap: 10px; padding: 14px 16px; }

/* A lone program is shown as one wide card instead of a narrow card beside empty space. */
@media (min-width: 761px) {
  .grid.single { grid-template-columns: 1fr; }
  .grid.single .program-card { flex-direction: row; }
  .grid.single .program-media { flex: 0 0 38%; aspect-ratio: auto; min-height: 230px; border-bottom: 0; border-inline-end: 1px solid var(--border); }
  .grid.single .program-body { padding: 26px 28px; justify-content: center; }
}

/* ---------- 20. Learning paths, projects, latest videos ---------- */
.path-card { display: flex; flex-direction: column; gap: 12px; padding: 20px; }
.path-card header { display: flex; align-items: center; gap: 12px; }
.path-card h3 { margin: 0; font-size: 1.05rem; }
.path-desc { font-size: .88rem; }
.steps { list-style: none; display: grid; gap: 0; border-top: 1px solid var(--border); margin-top: 2px; }
.step { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--border); position: relative; }
.step:last-child { border-bottom: 0; padding-bottom: 0; }
.step-num { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: .8rem; font-weight: 700; font-family: var(--font-en); background: var(--bg-2); color: var(--accent); border: 1px solid var(--border-strong); }
.step-body strong { display: block; font-size: .93rem; font-weight: 600; line-height: 1.4; }
.step-body .muted { font-size: .8rem; }
.step .btn-sm { min-height: 32px; padding: 4px 10px; }
.latest { display: flex; align-items: center; gap: 16px; padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--card); margin-bottom: 24px; flex-wrap: wrap; }
.latest h3 { margin: 0; font-size: 1rem; }
.latest p { margin: 0; color: var(--muted); font-size: .88rem; }
.latest > div:nth-child(2) { flex: 1; min-width: 200px; }
.latest-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.prereq { display: flex; gap: 6px; align-items: flex-start; font-size: .82rem !important; color: var(--subtle) !important; margin-top: 10px !important; }
.prereq .icon { width: 14px; height: 14px; margin-top: .3em; }
.project-card h4, .more h4 { font-size: .82rem; margin: 14px 0 6px; color: var(--muted); }
.bullets { padding-inline-start: 1.1em; display: grid; gap: 4px; font-size: .88rem; color: var(--muted); }
.tools { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.mini-stats { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 4px 0 0; }
.mini-stats div { display: flex; gap: 6px; align-items: baseline; font-size: .84rem; }
.mini-stats dt { color: var(--muted); }
.mini-stats dd { margin: 0; font-weight: 700; color: var(--text); }
details.more { border-top: 1px solid var(--border); padding-top: 8px; margin-top: 4px; }
details.more summary { cursor: pointer; font-size: .86rem; font-weight: 600; color: var(--accent); list-style: none; display: flex; align-items: center; gap: 6px; }
details.more summary::-webkit-details-marker { display: none; }
details.more summary::before { content: "+"; font-family: var(--font-en); width: 16px; text-align: center; }
details.more[open] summary::before { content: "–"; }
.thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 10px; }
.thumbs img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; }
.program-group { margin-top: 26px; }
.program-group h2 { font-size: 1.12rem; margin-bottom: 14px; }
.program-group h2 .muted { font-weight: 500; }
.sub-h { font-size: 1.02rem; margin: 26px 0 12px; }
.sub-h:first-child { margin-top: 0; }
.assess h3 { margin-bottom: 8px; }
.bar-row { display: grid; grid-template-columns: 52px minmax(0, 1fr) 44px; gap: 10px; align-items: center; font-size: .84rem; color: var(--muted); margin-bottom: 4px; max-width: 520px; }
.bar { height: 8px; background: var(--bg-2); border-radius: 999px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--border-strong); border-radius: 999px; }
.bar.post i { background: var(--primary); }
.term { grid-template-columns: minmax(0, 260px) minmax(0, 1fr) auto; }
.term-def p { margin: 0; color: var(--muted); font-size: .95rem; }
.copy-btn { color: var(--subtle); }
.copy-btn.is-done { color: var(--success); }
@media (max-width: 680px) { .term { grid-template-columns: minmax(0, 1fr) auto; } .term-def { grid-column: 1 / -1; grid-row: 2; } }
.goals { list-style: none; counter-reset: g; display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 0; border-top: 1px solid var(--border); }
.goals li { counter-increment: g; padding: 18px 18px 18px 0; border-bottom: 1px solid var(--border); font-size: .95rem; display: flex; gap: 12px; }
[dir="rtl"] .goals li { padding: 18px 0 18px 18px; }
.goals li::before { content: counter(g, decimal-leading-zero); font-family: var(--font-mono); color: var(--accent); font-size: .82rem; padding-top: .2em; }
.hero-slogan { font-weight: 700; color: var(--accent); margin: -12px 0 26px; letter-spacing: .01em; }

/* Consent banner */
.consent { position: fixed; inset-inline: 16px; bottom: 16px; z-index: 250; max-width: 560px; margin-inline: auto; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; padding: 14px 16px; background: var(--card); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); box-shadow: 0 8px 30px rgba(0, 0, 0, .25); font-size: .88rem; }
.consent p { margin: 0; flex: 1 1 280px; color: var(--muted); }
.consent-actions { display: flex; gap: 8px; }
.subnav-wrap { position: sticky; top: var(--header-h); z-index: 20; background: var(--bg); padding-top: 6px; }
.subnav-wrap .subnav { margin-bottom: 0; }
.subnav a[hidden] { display: none; }

/* Reserve space for content that loads from JSON, to keep the layout stable (CLS). */
main { min-height: calc(100vh - var(--header-h)); }
#home-stats:empty, #impact-stats:empty { min-height: 130px; }
#paths-app:empty { min-height: 320px; }
#learn-app:empty { min-height: 520px; }
#programs-app:empty { min-height: 420px; }
#quiz-app:empty { min-height: 380px; }
#impact-stats:empty { min-height: 260px; }
.section.no-rule { padding-top: clamp(26px, 4vw, 40px); }
@media (max-width: 620px) {
  /* Compact generated covers on phones so the series list stays short. */
  .cover:has(.cover-art) { aspect-ratio: auto; height: 64px; }
  .cover-art { flex-direction: row; align-items: center; padding: 10px 14px; }
  .cover-art .icon-box { width: 38px; height: 38px; }
  .cover-art svg.cover-helix { display: none; }
  .cover .badge { top: 50%; transform: translateY(-50%); inset-inline-end: auto; inset-inline-start: 64px; }
  .cover-art .cover-subject { margin-inline-start: auto; }
  .series-body { padding: 14px 16px 16px; }
  .section { padding-block: 40px; }
}

/* ================= UX refinements (student-first) ================= */
.btn-lg { min-height: 48px; padding: 12px 22px; font-size: 1rem; }
.nav-link.nav-key { color: var(--text); font-weight: 600; }
.subject-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.subject-card { display: flex; flex-direction: column; gap: 10px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); }
.subject-card header { display: flex; align-items: flex-start; gap: 12px; }
.subject-card header > div { min-width: 0; }
.subject-card h3 { margin: 0; font-size: 1rem; }
.one-line { margin: 2px 0 0; font-size: .85rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status { display: flex; align-items: center; gap: 7px; margin: 0; font-size: .82rem; color: var(--muted); }
.status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--subtle); flex-shrink: 0; }
.status-both .dot, .status-lessons .dot, .status-questions .dot { background: var(--success); }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; }
.card-actions .btn { flex: 1 1 auto; }
.soon-msg { margin: 0; font-size: .84rem; color: var(--muted); line-height: 1.6; }
.subject-card.is-soon { background: transparent; }
.subject-card.is-soon .icon-box { background: var(--bg-2); color: var(--subtle); }
.continue-list { list-style: none; display: grid; gap: 10px; }
.continue-item, .resume-banner { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); flex-wrap: wrap; }
.continue-item > div:nth-child(2), .resume-banner > div:nth-child(2) { flex: 1; min-width: 180px; }
.continue-item strong, .resume-banner strong { display: block; font-size: .95rem; }
.continue-item span, .resume-banner span { font-size: .86rem; color: var(--muted); }
.resume-banner { margin-bottom: 18px; border-color: var(--primary); }
.continue-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.series-card.is-target { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.share-btn { margin-inline-start: auto; color: var(--muted); }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 400; background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-size: .9rem; font-weight: 600; transition: opacity .3s; }
.toast.out { opacity: 0; }

/* Quiz: distraction-free, code-friendly */
.quiz-focus .question-card { padding: clamp(18px, 4vw, 28px); }
.q-count { margin: 0 0 6px; font-size: .82rem; font-weight: 600; color: var(--accent); }
.question-text { font-size: clamp(1.05rem, 2vw, 1.22rem); font-weight: 600; line-height: 1.7; margin-bottom: 18px; outline: none; }
.choice { min-height: 52px; padding: 12px 14px; font-size: 1rem; }
.choice-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.choice-tag { font-size: .78rem; font-weight: 700; }
.choice.is-correct .choice-tag { color: var(--success); }
.choice.is-wrong .choice-tag { color: var(--error); }
.choice[aria-disabled="true"] { cursor: default; }
.kbd-hint { font-size: .8rem; color: var(--subtle); align-self: center; }
pre.code { margin: 10px 0; padding: 12px 14px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 8px; overflow-x: auto; max-width: 100%;
  font-family: var(--font-mono); font-size: .88rem; line-height: 1.6; white-space: pre; tab-size: 4; text-align: left; direction: ltr; font-weight: 400; }
pre.code code { background: none; border: 0; padding: 0; font-size: inherit; }
.choice pre.code { margin: 4px 0 0; font-size: .84rem; }
.tk-k { color: #C4A7FF; font-weight: 600; }
.tk-s { color: #7EE0B8; }
.tk-n { color: #F5C66B; }
.tk-c { color: var(--subtle); font-style: italic; }
[data-theme="light"] .tk-k { color: #6D28D9; }
[data-theme="light"] .tk-s { color: #0E7A52; }
[data-theme="light"] .tk-n { color: #9A5B00; }
.result-counts { display: flex; justify-content: center; gap: 12px; margin: 6px 0 12px; }
.result-counts div { display: flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--border); }
.result-counts dt { display: flex; align-items: center; gap: 6px; font-size: .88rem; color: var(--muted); }
.result-counts dd { margin: 0; font-weight: 700; font-family: var(--font-en); }
.result-counts .ok .icon { color: var(--success); }
.result-counts .bad .icon { color: var(--error); }
.weak { margin-top: 18px; text-align: start; }
.review-q { font-weight: 600; margin-bottom: 8px; }

/* Touch targets (44px) on touch screens and small viewports */
@media (pointer: coarse), (max-width: 620px) {
  .btn, .btn-sm { min-height: 44px; }
  .chip { min-height: 44px; padding-inline: 15px; }
  .nav-link { min-height: 44px; }
  .step .btn-sm { min-height: 44px; }
}
@media (max-width: 620px) {
  .hero h1 { font-size: 1.9rem; }
  .hero .lead { margin-bottom: 22px; }
  .hero-actions .btn { flex: 1 1 100%; }
  .page-header.compact { padding-block: 18px 14px; }
  /* Next-question button stays within thumb reach without covering the explanation. */
  .quiz-focus .quiz-actions { position: sticky; bottom: 0; background: var(--card); margin: 16px -18px -18px; padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); border-radius: 0 0 var(--radius) var(--radius); }
  .quiz-focus .btn-next { flex: 1; }
  .kbd-hint { display: none; }
  .subject-cards { grid-template-columns: 1fr; }
  .subject-card header { flex-direction: row; }
}
@media (max-width: 360px) {
  .container { padding-inline: 14px; }
}
.empty-banner { border-color: var(--border-strong); }
.empty-banner strong { font-weight: 600; }
.subject-card { min-width: 0; }
@media (max-width: 620px) { .subject-cards { grid-template-columns: minmax(0, 1fr); } }
.feedback { scroll-margin-bottom: 96px; scroll-margin-top: 80px; }
.latest-placeholder { min-height: 78px; margin-bottom: 24px; }
#learning-areas:empty { min-height: 330px; }
@media (max-width: 620px) { #learning-areas:empty { min-height: 1000px; } .latest-placeholder { min-height: 150px; } }
#learn-app:empty { min-height: 900px; }

/* ================= Header & homepage redesign (portal layout) ================= */
:root { --header-h: 78px; --container: 1320px; --hero-bg: #181127; }
[data-theme="light"] { --hero-bg: #F3EFFC; }
.container { padding-inline: clamp(16px, 3vw, 48px); }

/* Header: logo at the start, links spread evenly in the middle, theme toggle at the end */
.header-inner { display: grid; grid-template-columns: auto 1fr auto; gap: 24px; align-items: center; }
.brand img { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; display: block; }
.site-footer .brand img { width: 52px; height: 52px; border-radius: 12px; }
@media (max-width: 480px) { .site-header .brand img { width: 38px; height: 38px; border-radius: 9px; } }
.brand-text strong { font-size: 1.12rem; }
.main-nav { justify-self: stretch; }
.nav-list { justify-content: center; gap: clamp(14px, 2vw, 30px); }
.nav-link { font-size: 17px; font-weight: 600; padding: 0 2px; color: var(--muted); }
.nav-link:hover, .nav-link[aria-current="page"] { color: var(--text); }
.nav-link[aria-current="page"]::after { inset-inline: 0; height: 3px; bottom: 0; border-radius: 3px 3px 0 0; }
.header-actions { margin-inline-start: 0; justify-self: end; }
@media (max-width: 1040px) {
  .header-inner { grid-template-columns: auto 1fr auto; }
  .main-nav { justify-self: auto; }
  .menu-btn { display: inline-grid; }
  .main-nav {
    position: fixed; inset: var(--header-h) 0 auto 0; background: var(--bg); border-bottom: 1px solid var(--border);
    max-height: calc(100dvh - var(--header-h)); overflow-y: auto;
    opacity: 0; visibility: hidden; transform: translateY(-6px);
    transition: opacity .18s var(--ease), transform .18s var(--ease), visibility .18s;
  }
  .main-nav.is-open { opacity: 1; visibility: visible; transform: none; }
  .nav-list { flex-direction: column; justify-content: flex-start; padding: 8px clamp(16px, 3vw, 48px) 18px; gap: 0; }
  .nav-link { line-height: 1.5; padding: 14px 4px; font-size: 1.05rem; border-bottom: 1px solid var(--border); }
  .nav-list li:last-child .nav-link { border-bottom: 0; }
  .nav-link[aria-current="page"] { color: var(--accent); }
  .nav-link[aria-current="page"]::after { display: none; }
  .header-actions { grid-column: 3; }
  body.nav-open { overflow: hidden; }
}
@media (min-width: 1041px) { .menu-btn { display: none !important; } }

/* Compact, boxed hero */
.hero-wrap { padding-top: clamp(16px, 2.2vw, 30px); }
.hero-box { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 40px; align-items: center; min-height: 340px; max-height: 420px;
  padding: clamp(24px, 3.4vw, 48px); background: var(--hero-bg); border: 1px solid var(--border); border-radius: 20px; position: relative; overflow: hidden; }
.hero-box .kicker { margin-bottom: 10px; }
.hero-box h1 { font-size: clamp(1.75rem, 1rem + 2.3vw, 3rem); line-height: 1.35; margin-bottom: 12px; max-width: none; }
.hero-box .lead { font-size: clamp(1rem, .9rem + .3vw, 1.125rem); color: var(--muted); margin: 0 0 22px; max-width: 560px; }
.hero-box .hero-actions .btn { font-size: 16px; min-height: 48px; padding-inline: 22px; }
.hero-box .hero-slogan { margin: 18px 0 0; font-size: .95rem; font-weight: 700; color: var(--accent); letter-spacing: .02em; }
.hero-art-box { width: 100%; max-width: 280px; justify-self: center; }
.hero-art-box svg { width: 100%; height: auto; display: block; }
.hero-art-box .lattice { stroke: var(--border-strong); }
.hero-art-box .base { font-family: var(--font-mono); font-size: 11px; fill: var(--subtle); }
@media (max-width: 860px) {
  .hero-box { grid-template-columns: 1fr; max-height: none; min-height: 0; }
  .hero-art-box { display: none; }
}
@media (max-width: 560px) {
  .hero-box { border-radius: 16px; padding: 22px 18px; }
  .hero-box h1 { font-size: 1.6rem; }
  .hero-box .hero-actions .btn { flex: 1 1 100%; }
}

/* Subjects: "What do you want to learn today?" */
#sec-areas { padding-top: clamp(28px, 3.5vw, 44px); }
#sec-areas .section-head { margin-bottom: 18px; }
.subject-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 1100px) { .subject-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .subject-grid { grid-template-columns: minmax(0, 1fr); } }
.subject-grid .subject-card { padding: 16px; gap: 10px; }
.subject-grid .subject-card p.desc { margin: 2px 0 0; font-size: .86rem; color: var(--muted); line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.6em; }
.subject-grid .card-actions .btn { flex: 1 1 0; padding-inline: 10px; font-size: .88rem; }
.section-compact { padding-block: clamp(36px, 5vw, 60px); }

/* Question bank band (home) */
.bank-band { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px; align-items: center; padding: clamp(20px, 3vw, 28px); border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); }
.bank-band h3 { margin: 0 0 4px; font-size: 1.15rem; }
.bank-band p { margin: 0; color: var(--muted); }
.bank-band .chips { margin-top: 12px; }
@media (max-width: 760px) { .bank-band { grid-template-columns: 1fr; } }

/* Insights */
.insight-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 980px) { .insight-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .insight-grid { grid-template-columns: minmax(0, 1fr); } }
.insight-card { display: flex; flex-direction: column; padding: 0; overflow: hidden; color: inherit; text-decoration: none !important; }
.insight-card .cover { aspect-ratio: 16 / 9; }
.insight-card .insight-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.insight-card h3 { margin: 0; font-size: 1.05rem; line-height: 1.5; }
.insight-card p { margin: 0; font-size: .9rem; color: var(--muted); }
.insight-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .8rem; color: var(--subtle); margin-top: auto; }
.article { max-width: 760px; margin-inline: auto; }
.article-header { padding-block: 28px 18px; }
.article-header h1 { font-size: clamp(1.6rem, 1.1rem + 1.8vw, 2.4rem); margin-bottom: 10px; }
.article-cover { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); margin-bottom: 26px; }
.article-cover img { width: 100%; height: auto; }
.article-body { font-size: 1.08rem; line-height: 1.95; }
.article-body h2 { font-size: 1.35rem; margin: 1.8em 0 .5em; }
.article-body p, .article-body li { color: var(--text); }
.article-body ul, .article-body ol { padding-inline-start: 1.3em; margin-bottom: 1em; display: grid; gap: 6px; }
.article-body figure { margin: 1.5em 0; }
.article-body figcaption { font-size: .85rem; color: var(--muted); margin-top: 6px; }
.article-sources { margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--border); font-size: .92rem; }
.article-sources ol { padding-inline-start: 1.3em; display: grid; gap: 6px; color: var(--muted); }
.article-related { margin-top: 28px; }

/* About: team in numbers (no names) */
.team-counts { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.team-counts .stat:first-child { padding-inline-start: 0; }
@media (min-width: 1041px) {
  /* Equal side columns keep the links centred on the page, not just between logo and toggle. */
  .header-inner { grid-template-columns: minmax(max-content, 1fr) auto minmax(max-content, 1fr); }
  .brand { justify-self: start; }
  .main-nav { justify-self: center; }
}

/* ==========================================================================
   Living UI — hero helix + reading frame, subject personalities, bento,
   magazine insights, community, micro-interactions.
   Motion is short (150–300ms) except the hero, pauses off-screen, and is
   switched off under prefers-reduced-motion. Content never waits on it.
   ========================================================================== */
.tone-base { --tone: var(--accent); }
.tone-python { --tone: #9B6DFF; }
.tone-r { --tone: #5B9BFF; }
.tone-linux { --tone: #3FCB94; }
.tone-numpy { --tone: #35C3D8; }
.tone-pandas { --tone: #8E95FF; }
.tone-bio { --tone: #EC7DBE; }
.tone-cell { --tone: #F2AE55; }
.tone-seq { --tone: #B9A2FF; }
[data-theme="light"] .tone-python { --tone: #7C3AED; }
[data-theme="light"] .tone-r { --tone: #2563EB; }
[data-theme="light"] .tone-linux { --tone: #0B7D57; }
[data-theme="light"] .tone-numpy { --tone: #0B7186; }
[data-theme="light"] .tone-pandas { --tone: #4F46E5; }
[data-theme="light"] .tone-bio { --tone: #B8327F; }
[data-theme="light"] .tone-cell { --tone: #A15C00; }
[data-theme="light"] .tone-seq { --tone: #6D28D9; }
:root { --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace; --spring: cubic-bezier(.34, 1.4, .64, 1); }

/* ---------- Hero ---------- */
.hero-box {
  --pad: clamp(20px, 3.4vw, 48px);
  grid-template-columns: minmax(0, 1fr) 300px; grid-template-areas: "copy art" "frame frame";
  max-height: none; min-height: 0; row-gap: 18px; padding: clamp(24px, 3.2vw, 40px) var(--pad) 0; overflow: hidden; position: relative;
}
.hero-copy { grid-area: copy; }
.hero-art-box { grid-area: art; max-width: 300px; height: 288px; display: grid; place-items: center; position: relative; }
.hero-art-box::before { content: ""; position: absolute; inset: 8% 14%; border-radius: 50%; background: radial-gradient(closest-side, var(--primary-soft), transparent); filter: blur(6px); }
.hero-box .lead { margin-bottom: 20px; }
.hero-frame {
  grid-area: frame; margin-inline: calc(var(--pad) * -1); padding: 12px var(--pad) 14px;
  border-top: 1px solid var(--border); display: flex; align-items: center; gap: 24px; background: color-mix(in srgb, var(--bg) 35%, transparent);
}
#reading-frame { flex: 1 1 0; min-width: 0; }
.frame-caption { flex: 0 0 290px; margin: 0; font-size: .84rem; line-height: 1.6; color: var(--muted); }

/* CSS double helix: two strands of nucleotides joined by bonds, each row phase-shifted. */
.dna { --amp: 52px; --dur: 7s; position: relative; width: 170px; height: 272px; display: flex; flex-direction: column; justify-content: space-between; padding: 12px 0; }
.dna .bp { position: relative; height: 2px; }
.dna .bp > span { position: absolute; left: 50%; top: 50%; animation: var(--dur) linear infinite both; animation-delay: calc(var(--i) * -.44s); }
.dna .bp > .nt { width: 11px; height: 11px; margin: -5.5px 0 0 -5.5px; border-radius: 50%; animation-name: dna-nt; }
.dna .s1 { background: var(--helix-a); box-shadow: 0 0 10px color-mix(in srgb, var(--helix-a) 55%, transparent); }
.dna .bp > .s2 { background: var(--card); border: 2px solid var(--helix-b); animation-delay: calc(var(--i) * -.44s - 3.5s); }
.dna .bp > .bond { width: calc(var(--amp) * 2); height: 2px; margin: -1px 0 0 calc(var(--amp) * -1); border-radius: 2px; background: linear-gradient(90deg, var(--helix-a), var(--helix-b)); opacity: .5; animation-name: dna-bond; }
.dna.is-paused .bp > span { animation-play-state: paused; }
.dna .end { position: absolute; font: 600 12px/1 var(--font-mono); color: var(--subtle); }
.dna .end-5 { top: -6px; left: 6px; }
.dna .end-3 { bottom: -6px; right: 6px; }
@keyframes dna-nt {
  0%   { transform: translateX(calc(var(--amp) * -1)) scale(.9); opacity: .8; z-index: 1; animation-timing-function: cubic-bezier(.12, 0, .39, 0); }
  25%  { transform: translateX(0) scale(1.25); opacity: 1; z-index: 3; animation-timing-function: cubic-bezier(.61, 1, .88, 1); }
  50%  { transform: translateX(var(--amp)) scale(.9); opacity: .8; z-index: 1; animation-timing-function: cubic-bezier(.12, 0, .39, 0); }
  75%  { transform: translateX(0) scale(.6); opacity: .35; z-index: 0; animation-timing-function: cubic-bezier(.61, 1, .88, 1); }
  100% { transform: translateX(calc(var(--amp) * -1)) scale(.9); opacity: .8; z-index: 1; }
}
@keyframes dna-bond {
  0%   { transform: scaleX(1); animation-timing-function: cubic-bezier(.12, 0, .39, 0); }
  25%  { transform: scaleX(0); animation-timing-function: cubic-bezier(.61, 1, .88, 1); }
  50%  { transform: scaleX(-1); animation-timing-function: cubic-bezier(.12, 0, .39, 0); }
  75%  { transform: scaleX(0); animation-timing-function: cubic-bezier(.61, 1, .88, 1); }
  100% { transform: scaleX(1); }
}

/* Reading frame ribbon */
.frame { --cw: 58px; position: relative; height: 50px; overflow: hidden; user-select: none;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 7%, #000 88%, transparent); mask-image: linear-gradient(90deg, transparent, #000 7%, #000 88%, transparent); }
.frame-track { display: flex; height: 100%; transition: transform .5s var(--ease); will-change: transform; }
.frame-track.no-anim, .frame-track.no-anim * { transition: none !important; }
.codon { flex: 0 0 var(--cw); display: grid; grid-template-rows: 1fr 1fr; place-items: center; font-family: var(--font-mono); position: relative; }
.codon b { font-weight: 500; font-size: 13px; letter-spacing: .14em; color: var(--subtle); transition: color .3s; }
.codon i { font-style: normal; font-size: 11.5px; font-weight: 600; color: var(--accent); opacity: 0; transform: translateY(-4px); transition: opacity .3s, transform .3s var(--ease); }
.codon.is-read i { opacity: .85; transform: none; }
.codon.is-read b { color: var(--muted); }
.codon.is-on b { color: var(--text); }
.codon.is-on i { opacity: 1; color: var(--text); }
.codon::after { content: ""; position: absolute; inset-inline-end: 0; top: 30%; height: 40%; width: 1px; background: var(--border); }
.frame-window { position: absolute; top: 1px; bottom: 1px; left: calc(var(--cw) * 3); width: var(--cw); border: 1.5px solid var(--primary); border-radius: 9px; background: var(--primary-soft); }

@media (prefers-reduced-motion: no-preference) {
  .hero-copy > * { animation: gh-rise .5s var(--ease) both; }
  .hero-copy > :nth-child(2) { animation-delay: .06s; }
  .hero-copy > :nth-child(3) { animation-delay: .12s; }
  .hero-copy > :nth-child(4) { animation-delay: .18s; }
  .hero-art-box { animation: gh-fade .9s .1s var(--ease) both; }
  .hero-frame { animation: gh-fade .6s .26s var(--ease) both; }
}
@keyframes gh-rise { from { opacity: 0; transform: translateY(12px); } }
@keyframes gh-fade { from { opacity: 0; } }
@media (max-width: 860px) {
  .hero-box { grid-template-columns: minmax(0, 1fr); grid-template-areas: "copy" "frame"; }
  .hero-art-box { display: none; }
  .hero-frame { flex-direction: column; align-items: stretch; gap: 8px; }
  #reading-frame { width: 100%; }
  .frame-caption { flex-basis: auto; font-size: .8rem; }
}
@media (max-width: 560px) { .hero-box { padding-top: 22px; } .frame { --cw: 52px; } }

/* ---------- Subject bento ---------- */
#learning-areas:empty { min-height: 560px; }
.bento { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.feature {
  grid-column: span 2; grid-row: span 2; display: grid; grid-template-rows: auto 1fr; gap: 18px; min-width: 0;
  padding: clamp(20px, 2.4vw, 28px); border-radius: 20px;
  background: color-mix(in srgb, var(--tone) 8%, var(--card)); border: 1px solid color-mix(in srgb, var(--tone) 34%, var(--border));
}
.feature h3 { font-size: clamp(1.3rem, 1rem + .9vw, 1.65rem); line-height: 1.4; margin: 12px 0 6px; }
.feature p { margin: 0; color: var(--muted); max-width: 52ch; }
.live-pill { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px 4px 10px; border-radius: 999px; font-size: .82rem; font-weight: 700; color: var(--tone); background: color-mix(in srgb, var(--tone) 15%, transparent); }
.live-pill i { position: relative; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.live-pill i::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 1.5px solid currentColor; opacity: 0; }
@media (prefers-reduced-motion: no-preference) { .live-pill i::after { animation: gh-ping 2.4s ease-out infinite; } }
@keyframes gh-ping { 0% { transform: scale(.5); opacity: .8; } 70%, 100% { transform: scale(1.6); opacity: 0; } }
.meta-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.meta-list li { padding: 2px 10px; border-radius: 999px; border: 1px solid var(--border); font-size: .8rem; color: var(--muted); }
.feature-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.feature-motif { color: var(--tone); align-self: end; }
.feature-motif .motif { width: 100%; height: auto; max-height: 180px; }

.editor { margin: 0; align-self: end; direction: ltr; text-align: left; border-radius: 14px; overflow: hidden; background: #150F24; border: 1px solid #2E2443; color: #ECE6FA; box-shadow: 0 18px 40px -24px rgba(20, 8, 48, .7); }
.editor-bar { display: flex; align-items: center; gap: 6px; padding: 9px 14px; border-bottom: 1px solid #2E2443; }
.editor-bar i { width: 9px; height: 9px; border-radius: 50%; background: #3A3052; }
.editor-bar span { margin-left: 8px; font: 12px var(--font-mono); color: #9D93B5; }
.editor pre { margin: 0; padding: 14px 16px 12px; font: 400 13.5px/1.75 var(--font-mono); white-space: pre; overflow-x: auto; }
.editor .tk-k { color: #C9AEFF; } .editor .tk-s { color: #84E3BD; } .editor .tk-n { color: #F6CB7A; } .editor .tk-c { color: #8C80A3; }
.editor-out { padding: 9px 16px 12px; border-top: 1px dashed #2E2443; font: 500 13.5px var(--font-mono); color: #84E3BD; }
.editor-out span { color: #9D93B5; }
.caret { display: inline-block; width: 7px; height: 14px; margin-left: 6px; vertical-align: -2px; background: #ECE6FA; opacity: .8; }
@media (prefers-reduced-motion: no-preference) { .caret { animation: gh-blink 1.1s steps(1) infinite; } }
@keyframes gh-blink { 50% { opacity: 0; } }

.tile {
  position: relative; display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 16px 16px 14px;
  border-radius: 14px; border: 1px solid var(--border); background: var(--card); color: inherit; text-decoration: none !important;
  transition: transform .22s var(--ease), border-color .22s var(--ease), background-color .22s var(--ease);
}
.tile::before { content: ""; position: absolute; top: -1px; inset-inline: 18px; height: 2px; border-radius: 0 0 2px 2px; background: var(--tone); opacity: .75; }
.tile-art { display: block; height: 52px; color: var(--tone); margin-bottom: 6px; }
.tile-art .motif { height: 100%; width: auto; overflow: visible; transition: transform .3s var(--ease); }
.tile h3 { margin: 0; font-size: 1rem; line-height: 1.4; }
.tile p { margin: 0; font-size: .85rem; line-height: 1.55; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile-foot { margin-top: auto; padding-top: 8px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: .8rem; color: var(--subtle); }
.tile-flag { color: var(--tone); font-weight: 700; }
.tile-channel { --tone: #FF6B81; }
[data-theme="light"] .tile-channel { --tone: #D6264A; }
@media (hover: hover) {
  .tile:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--tone) 50%, var(--border)); background: color-mix(in srgb, var(--tone) 5%, var(--card)); }
  .tile:hover .motif { transform: translateX(-3px); }
}
a.tile:active { transform: translateY(-1px) scale(.985); transition-duration: .1s; }
a.tile:focus-visible { outline: 2px solid var(--tone); outline-offset: 3px; }
@media (max-width: 1100px) {
  .bento { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .feature { grid-row: auto; }
}
@media (max-width: 560px) {
  .bento { gap: 10px; }
  .feature { padding: 18px; gap: 16px; }
  .feature-actions .btn { flex: 1 1 auto; }
  .editor pre { font-size: 12.5px; }
  .tile { padding: 13px 12px 12px; }
  .tile-art { height: 40px; }
  .tile p { font-size: .8rem; }
}

/* Motifs (stroke = subject tone) */
.motif { direction: ltr; }
.motif * { stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.motif .m-bar, .motif .m-dot, .motif .m-cell, .motif .m-head, .motif .m-pick, .motif .m-nucleus, .motif .m-organelle,
.motif .m-base, .motif .m-line-r, .motif .m-progress, .motif .m-play, .motif .m-text, .motif .m-cursor { fill: currentColor; stroke: none; }
.m-bar { opacity: .85; transform-box: fill-box; transform-origin: bottom; }
.m-line { stroke-width: 1.4; opacity: .7; stroke-dasharray: 3 3; }
.m-frame { stroke-width: 1.3; opacity: .65; }
.m-text { font: 500 8.5px var(--font-mono); }
.m-kw { font-weight: 700; }
.m-out, .m-dot { opacity: .6; }
.m-cursor { opacity: 0; }
.m-cell { opacity: .5; transform-box: fill-box; transform-origin: center; }
.m-head { opacity: .2; }
.m-rule { stroke-width: 1; opacity: .45; }
.m-pick { opacity: 0; transition: opacity .25s; }
.m-strand { stroke-width: 2; }
.m-strand-b { opacity: .55; }
.m-rung { stroke-width: 1; opacity: .45; }
.m-nucleus { opacity: .18; }
.m-organelle { opacity: .4; }
.m-base { opacity: .3; }
.m-var { opacity: .95; }
.m-gap { opacity: .08; }
.m-line-r { opacity: .22; }
.m-progress { opacity: .9; }
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .tile:hover .m-bar { animation: gh-grow .45s var(--spring) both; animation-delay: calc(var(--k) * 45ms); }
  .tile:hover .m-cursor { animation: gh-blink .9s steps(1) infinite; opacity: .9; }
  .tile:hover .m-cell { animation: gh-pulse .6s var(--ease) both; animation-delay: calc(var(--k) * 40ms); }
  .tile:hover .m-var { animation: gh-blink .8s steps(1) 2; }
  .tile:hover .m-progress { animation: gh-bar 1.2s var(--ease) both; }
}
.tile:hover .m-pick, .tile:focus-visible .m-pick { opacity: .4; }
@keyframes gh-grow { from { transform: scaleY(.25); } }
@keyframes gh-pulse { 50% { transform: scale(1.35); opacity: .9; } }
@keyframes gh-bar { from { width: 4px; } }

/* ---------- New in Genome Hub (horizontal) ---------- */
.new-strip { list-style: none; margin: 0; padding: 2px 2px 10px; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(240px, 300px); gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain; }
.new-strip li { scroll-snap-align: start; }
.new-card { height: 100%; display: flex; flex-direction: column; gap: 6px; padding: 16px; border-radius: 14px; border: 1px solid var(--border); border-inline-start: 3px solid var(--tone); background: var(--card); color: inherit; text-decoration: none !important; transition: border-color .2s, transform .2s var(--ease); }
.new-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--tone) 50%, var(--border)); border-inline-start-color: var(--tone); }
.new-kind { font-size: .78rem; font-weight: 700; color: var(--tone); }
.new-card strong { line-height: 1.5; }
.new-card time { margin-top: auto; font-size: .8rem; color: var(--subtle); }

/* ---------- Magazine insights ---------- */
.mag { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 18px; align-items: stretch; }
.mag.is-single { grid-template-columns: minmax(0, 1fr); }
.mag-side { display: flex; flex-direction: column; border-top: 1px solid var(--border); }
.insight-card { color: inherit; text-decoration: none !important; display: flex; flex-direction: column; min-width: 0; border-radius: 16px; overflow: hidden; transition: transform .22s var(--ease), border-color .22s; }
.insight-card.is-card, .insight-card.is-lead { background: var(--card); border: 1px solid var(--border); padding: 0; }
.insight-card .cover { aspect-ratio: 16 / 9; border-bottom: 1px solid var(--border); }
.cover-gen { display: grid; place-items: center; color: var(--tone); background:
  radial-gradient(120% 90% at 85% 15%, color-mix(in srgb, var(--tone) 22%, transparent), transparent 60%), color-mix(in srgb, var(--tone) 6%, var(--bg-2)); }
.cover-gen .motif { width: 46%; height: auto; }
.cover-cat { position: absolute; bottom: 12px; inset-inline-start: 14px; font-size: .78rem; font-weight: 700; color: var(--tone); }
.insight-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.insight-cat { font-size: .8rem; font-weight: 700; color: var(--tone); }
.insight-card h3 { margin: 0; font-size: 1.08rem; line-height: 1.55; text-wrap: balance; }
.insight-card.is-lead h3 { font-size: clamp(1.25rem, 1rem + .8vw, 1.6rem); line-height: 1.45; }
.insight-card.is-lead .insight-body { padding: 20px 22px 22px; }
.insight-card p { margin: 0; font-size: .92rem; color: var(--muted); }
.insight-card.is-row { border-radius: 0; flex-direction: row; padding: 16px 0; border-bottom: 1px solid var(--border); }
.insight-card.is-row .insight-body { padding: 0; }
.insight-card.is-row h3 { font-size: 1rem; }
@media (hover: hover) {
  .insight-card.is-card:hover, .insight-card.is-lead:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--tone) 45%, var(--border)); }
  .insight-card.is-row:hover h3 { color: var(--tone); }
}
.insight-grid .insight-card.is-lead { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); }
.insight-grid .insight-card.is-lead .cover { border-bottom: 0; border-inline-end: 1px solid var(--border); aspect-ratio: auto; min-height: 260px; }
@media (max-width: 860px) {
  .mag { grid-template-columns: minmax(0, 1fr); }
  .insight-grid .insight-card.is-lead { display: flex; }
  .insight-grid .insight-card.is-lead .cover { aspect-ratio: 16 / 9; min-height: 0; border-inline-end: 0; border-bottom: 1px solid var(--border); }
}

/* ---------- Community ---------- */
.photo-strip { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(220px, 300px); gap: 12px; overflow-x: auto; padding-bottom: 10px; scroll-snap-type: x mandatory; }
.photo-strip figure { margin: 0; scroll-snap-align: start; border-radius: 14px; overflow: hidden; border: 1px solid var(--border); background: var(--card); }
.photo-strip img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; display: block; }
.photo-strip figcaption { padding: 8px 12px; font-size: .82rem; color: var(--muted); }
.community-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; margin-top: 22px; align-items: start; }
.community-grid > :only-child { grid-column: 1 / -1; }
.quote { margin: 0 0 18px; padding-inline-start: 18px; border-inline-start: 3px solid var(--primary); }
.quote blockquote { margin: 0 0 8px; font-size: 1.12rem; line-height: 1.8; }
.quote figcaption strong { display: block; }
.quote figcaption span { font-size: .85rem; color: var(--subtle); }
.community-lists { display: grid; gap: 18px; }
.community-lists .sub-h { margin: 0 0 8px; font-size: 1rem; text-align: start; }
.trainer-list, .compact-list { list-style: none; margin: 0; padding: 0; }
.trainer-list.wide { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0 24px; }
.trainer { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.trainer img, .trainer .avatar { width: 48px; height: 48px; border-radius: 50%; flex-shrink: 0; object-fit: cover; margin: 0; display: grid; place-items: center; font-size: .9rem; }
.trainer strong { display: block; } .trainer span { display: block; font-size: .84rem; color: var(--muted); }
.trainer .taught { color: var(--subtle); font-size: .8rem; }
.compact-list li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid var(--border); }
.compact-list small { color: var(--subtle); white-space: nowrap; }
@media (max-width: 860px) { .community-grid { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Learn: one published series + compact list of upcoming ---------- */
.grid.one-ready > .series-card { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.grid.one-ready > .series-card .cover { aspect-ratio: auto; min-height: 100%; border-bottom: 0; border-inline-end: 1px solid var(--border); }
.series-card .cover-gen { position: absolute; inset: 0; padding: clamp(14px, 2.4vw, 28px); display: grid; place-items: center; }
.series-card .cover-gen .editor { width: min(100%, 420px); align-self: center; }
.series-card .cover-gen .feature-motif { width: 50%; align-self: center; }
.series-card { transition: transform .22s var(--ease), border-color .22s; }
@media (hover: hover) { .series-card:hover { border-color: color-mix(in srgb, var(--tone) 45%, var(--border)); } }
.upcoming { grid-column: 1 / -1; border: 1px solid var(--border); border-radius: 16px; background: var(--card); padding: clamp(16px, 2.2vw, 24px); }
.upcoming-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 10px; }
.upcoming-head h3 { margin: 0 0 2px; font-size: 1.12rem; }
.upcoming-head p { margin: 0; font-size: .9rem; color: var(--muted); }
.up-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 32px; }
.up-item { display: grid; grid-template-columns: 62px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 12px 0; border-top: 1px solid var(--border); border-radius: 6px; transition: background-color .3s; }
.up-art { color: var(--tone); height: 34px; display: block; }
.up-art .motif { width: 100%; height: 100%; }
.up-text strong { display: block; font-size: .95rem; line-height: 1.5; }
.up-meta { display: block; font-size: .78rem; font-weight: 600; color: var(--tone); }
.up-desc { display: block; font-size: .84rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.up-item.is-target { background: var(--primary-soft); box-shadow: 0 0 0 8px var(--primary-soft); }
@media (max-width: 980px) {
  .grid.one-ready > .series-card { display: flex; }
  .grid.one-ready > .series-card .cover { aspect-ratio: 16 / 9; min-height: 0; border-inline-end: 0; border-bottom: 1px solid var(--border); }
  .up-list { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 620px) {
  .series-card .cover:has(.cover-gen) { height: auto; aspect-ratio: 16 / 10; }
  .series-card .cover-gen { flex-direction: column; }
  .up-item { grid-template-columns: 46px minmax(0, 1fr); }
  .up-item .btn { grid-column: 2; justify-self: start; }
  .up-desc { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
}

/* ---------- Practice: subjects without questions ---------- */
.subject-cards:empty { display: none; }
.soon-row { margin-top: 18px; padding: 16px 18px; border: 1px dashed var(--border-strong); border-radius: 14px; }
.soon-row h3 { margin: 0 0 10px; font-size: .95rem; color: var(--muted); font-weight: 600; }
.soon-row ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.soon-row li > * { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); font-size: .88rem; color: var(--text); text-decoration: none !important; }
.soon-row li .icon { width: 16px; height: 16px; color: var(--tone); }
.soon-row li a:hover { border-color: var(--tone); }
.chip[class*="tone-"]::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--tone); display: inline-block; margin-inline-end: 6px; }

/* ---------- Quiz polish ---------- */
.progress { height: 8px; position: relative; }
.progress-bar { position: relative; overflow: hidden; background: linear-gradient(90deg, var(--primary-strong), var(--accent)); transition: width .45s var(--ease); }
[dir="rtl"] .progress-bar { background: linear-gradient(270deg, var(--primary-strong), var(--accent)); }
.choice { transition: border-color .15s, background-color .15s, transform .15s var(--ease); }
.choice:active:not([aria-disabled="true"]) { transform: scale(.985); }
.choice-key { transition: background-color .2s, color .2s; }
@media (prefers-reduced-motion: no-preference) {
  .just-answered .choice.is-correct { animation: gh-pop .35s var(--spring); }
  .just-answered .choice.is-wrong { animation: gh-shake .35s var(--ease); }
  .just-answered .choice .state-icon { animation: gh-icon .3s var(--spring) both; }
  .just-answered .feedback { animation: gh-unfold .3s var(--ease) both; }
  .just-answered .feedback .explanation { animation: gh-rise .35s .08s var(--ease) both; }
  .just-answered .btn-next { animation: gh-fade .25s .1s both; }
}
@keyframes gh-pop { 40% { transform: scale(1.02); } }
@keyframes gh-shake { 25% { transform: translateX(-5px); } 60% { transform: translateX(4px); } }
@keyframes gh-icon { from { transform: scale(.4); opacity: 0; } }
@keyframes gh-unfold { from { opacity: 0; transform: translateY(-6px); clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }

/* ---------- Micro-interactions ---------- */
.btn { transition: background-color .15s, border-color .15s, color .15s, transform .15s var(--ease), box-shadow .15s; }
.btn:active:not([aria-disabled="true"]) { transform: scale(.97); }
.btn-primary:hover { box-shadow: 0 6px 18px -8px color-mix(in srgb, var(--primary) 80%, transparent); }
.btn .icon { transition: transform .2s var(--ease); }
@media (hover: hover) { .btn:hover .icon-dir { transform: translateX(-3px); } [dir="ltr"] .btn:hover .icon-dir { transform: translateX(3px); } }
.icon-btn { transition: background-color .15s, transform .2s var(--ease); }
.icon-btn:active { transform: scale(.92); }
[data-theme-toggle] .icon { transition: transform .4s var(--spring); }
[data-theme-toggle]:hover .icon { transform: rotate(-25deg); }
.chip { transition: background-color .15s, border-color .15s, color .15s, transform .15s var(--ease); }
.chip:active { transform: scale(.95); }
.search input { transition: border-color .15s, box-shadow .15s; }
.search:focus-within input { box-shadow: 0 0 0 4px var(--primary-soft); }
.result-count { transition: opacity .2s; }

/* Sliding nav indicator (desktop) */
@media (min-width: 1041px) { .main-nav.has-ink { position: relative; } }
.nav-ink { position: absolute; bottom: 0; left: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--primary); opacity: 0; pointer-events: none;
  transition: transform .28s var(--ease), width .28s var(--ease), opacity .2s; }
.nav-ink.no-anim { transition: none; }
@media (min-width: 1041px) { .main-nav.has-ink .nav-link[aria-current="page"]::after { display: none; } }
@media (max-width: 1040px) { .nav-ink { display: none; } }

/* Scroll reveal: below-the-fold items settle into place as they arrive. Opacity is never touched,
   so content is readable even if the animation never runs. */
.reveal { opacity: 1; transform: none; transition: transform .45s var(--ease) var(--stagger, 0ms); }
@media (prefers-reduced-motion: no-preference) { .reveal.is-waiting { transform: translateY(14px); } }
@media print { .reveal.is-waiting { opacity: 1; transform: none; } }

/* Theme switch */
html.theme-fade, html.theme-fade * { transition: background-color .28s var(--ease), border-color .28s var(--ease), color .28s var(--ease), fill .28s, stroke .28s !important; }
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
html.vt-theme::view-transition-new(root) { animation: gh-circle .45s var(--ease); }
@keyframes gh-circle { from { clip-path: circle(0 at var(--vt-x, 50%) var(--vt-y, 0)); } to { clip-path: circle(150vmax at var(--vt-x, 50%) var(--vt-y, 0)); } }

@media (prefers-reduced-motion: reduce) {
  .tile, .insight-card, .new-card, .btn, .chip, .choice, .nav-ink, .frame-track, .progress-bar { transition: none !important; }
  .tile:hover, .insight-card:hover, .new-card:hover { transform: none !important; }
}
.editor code { background: none; border: 0; padding: 0; color: inherit; font-size: inherit; }
.series-card .cover-gen .editor { justify-self: center; }
.up-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; }
.up-meta span + span { color: var(--subtle); font-weight: 500; }
.mag .insight-card.is-lead .cover { aspect-ratio: 2 / 1; }
.choice[aria-disabled="true"]:hover { cursor: default; }
.choice.is-wrong:hover, .choice.is-wrong[aria-disabled="true"] { border-color: var(--error); background: var(--error-soft); }
.choice.is-correct:hover, .choice.is-correct[aria-disabled="true"] { border-color: var(--success); background: var(--success-soft); }
.choice.is-dim:hover { border-color: var(--border); background: transparent; }
@media (hover: none) { .choice:not(.is-correct):not(.is-wrong):hover { border-color: var(--border); background: transparent; } }

/* ---------- Sustainable Development Goals (impact page, deliberately quiet) ---------- */
#sdgs:empty { min-height: 190px; }
.sdg-row { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.sdg { display: flex; align-items: flex-start; gap: 14px; min-width: 0; padding: 18px; border-inline-start: 1px solid var(--border); }
.sdg:first-child { border-inline-start: 0; padding-inline-start: 0; }
.sdg:last-child { padding-inline-end: 0; }
.sdg-art { flex: 0 0 64px; width: 64px; height: 64px; display: block; text-decoration: none !important; }
.sdg-art:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
/* Official icons: always square, uncropped, no radius, shadow or recolouring (UN guidelines). */
.sdg-icon { width: 64px; height: 64px; display: block; border-radius: 0; box-shadow: none; object-fit: contain; }
.sdg-badge { width: 64px; height: 64px; display: grid; place-items: center; border: 2px solid var(--sdg, var(--border-strong)); color: var(--text); font: 700 1.25rem/1 var(--font-en); }
.sdg-text { min-width: 0; }
.sdg-text h3 { margin: 0 0 4px; font-size: .98rem; line-height: 1.45; }
.sdg-num { display: block; font-size: .76rem; font-weight: 600; color: var(--subtle); }
.sdg-text p { margin: 0; font-size: .86rem; line-height: 1.65; color: var(--muted); }
.sdg-tag { display: inline-block; margin-top: 8px; padding: 1px 9px; border-radius: 999px; border: 1px solid var(--border); font-size: .74rem; color: var(--subtle); }
.sdg-text p.sdg-acts { margin-top: 8px; font-size: .8rem; }
.sdg-acts span { color: var(--subtle); }
.sdg-acts a { color: var(--accent); }
.sdg-note { display: flex; align-items: flex-start; gap: 8px; margin: 14px 0 0; font-size: .8rem; line-height: 1.6; color: var(--subtle); }
.sdg-note .icon { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; }
.sdg-note a { color: var(--accent); }
@media (max-width: 1040px) {
  .sdg-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sdg, .sdg:first-child, .sdg:last-child { border-inline-start: 0; padding-inline: 0 18px; }
  .sdg:nth-child(even) { padding-inline: 18px 0; border-inline-start: 1px solid var(--border); }
  .sdg:nth-child(n+3) { border-top: 1px solid var(--border); }
}
@media (max-width: 560px) {
  .sdg { flex-direction: column; gap: 10px; padding-block: 16px; }
  .sdg-art, .sdg-icon, .sdg-badge { width: 56px; height: 56px; flex-basis: 56px; }
}
@media (max-width: 340px) {
  .sdg-row { grid-template-columns: minmax(0, 1fr); }
  .sdg, .sdg:nth-child(even) { padding-inline: 0; border-inline-start: 0; }
  .sdg + .sdg { border-top: 1px solid var(--border); }
}
.program-card.is-target { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }

/* ---------- Genome Insights: article reading experience (pages generated by tools/build-insights.mjs) ---------- */
.read-progress { position: fixed; top: 0; inset-inline: 0; height: 3px; z-index: 150; pointer-events: none; }
.read-progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); transform: scaleX(0); transform-origin: left center; will-change: transform; }
html[dir="rtl"] .read-progress span { transform-origin: right center; background: linear-gradient(270deg, var(--primary), var(--accent)); }
.article { max-width: 760px; }
.article-header { padding-block: 32px 22px; }
.article-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: .86rem; color: var(--subtle); margin-bottom: 14px; }
.article-crumbs a { color: var(--muted); }
.article-crumbs a:hover { color: var(--accent); }
.article-cat { font-weight: 700; color: var(--tone, var(--accent)); }
.article-header h1 { line-height: 1.45; text-wrap: balance; margin: 0 0 12px; }
.article-lead { font-size: 1.14rem; line-height: 1.85; color: var(--muted); margin: 0 0 18px; }
.article-byline { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.article-byline .meta-line { margin: 0; gap: 6px 8px; }
.article-byline strong { color: var(--text); font-weight: 600; }
.share { position: relative; }
.share-menu { position: absolute; top: calc(100% + 6px); inset-inline-end: 0; z-index: 30; min-width: 190px; display: grid; padding: 6px; background: var(--card); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: 0 10px 30px rgba(0, 0, 0, .28); }
.share-menu[hidden] { display: none; }
.share-menu button, .share-menu a { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border: 0; border-radius: 8px; background: none; color: var(--text); font: inherit; font-size: .92rem; text-align: start; cursor: pointer; text-decoration: none; }
.share-menu button:hover, .share-menu a:hover, .share-menu button:focus-visible, .share-menu a:focus-visible { background: var(--primary-soft); color: var(--text); }
.share-menu .icon { width: 16px; height: 16px; }
.article-cover { margin: 0 0 30px; background: var(--bg-2); aspect-ratio: 16 / 9; }
.article-cover img { display: block; width: 100%; height: 100%; object-fit: cover; }
.article-body { font-size: 1.1rem; line-height: 2; overflow-wrap: break-word; }
.article-body > p { margin: 0 0 1.15em; }
.article-body h2 { font-size: 1.42rem; line-height: 1.5; margin: 1.9em 0 .55em; scroll-margin-top: calc(var(--header-h) + 20px); }
.article-body h3 { font-size: 1.18rem; margin: 1.6em 0 .4em; }
.article-body h2 + p, .article-body h3 + p { margin-top: 0; }
.article-body ul, .article-body ol { margin: 0 0 1.15em; gap: 4px; }
.article-body li::marker { color: var(--accent); }
.article-body a, .article-sources a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.article-body a:hover, .article-sources a:hover { text-decoration-color: currentColor; }
.article-body a[dir="ltr"] { overflow-wrap: anywhere; unicode-bidi: isolate; }
.article-body pre.code { margin: 1.2em 0 1.4em; font-size: .92rem; line-height: 1.7; text-align: left; }
.article-note { margin: 1.5em 0; padding: 14px 18px; border-inline-start: 3px solid var(--primary); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; background: var(--primary-soft); }
html[dir="rtl"] .article-note { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.article-note p { margin: 0; font-size: 1.02rem; }
.article-sources { margin-top: 40px; }
.article-sources h2, .article-related h2 { font-size: 1.15rem; margin-bottom: 10px; }
.article-sources li { line-height: 1.8; }
.article-sources a { overflow-wrap: anywhere; }
.src-host { margin-inline-start: 6px; font-family: var(--font-en); font-size: .8rem; color: var(--subtle); }
.article-note-muted { margin-top: 22px; font-size: .86rem; color: var(--subtle); }
.article-more { padding-top: 24px; }
.article-more h2 { font-size: 1.3rem; margin-bottom: 18px; }
.insight-read { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; font-size: .88rem; font-weight: 700; color: var(--tone, var(--accent)); }
.insight-read .icon { width: 16px; height: 16px; transition: transform .2s var(--ease); }
@media (hover: hover) { .insight-card:hover .insight-read .icon { transform: translateX(-3px); } html[lang="en"] .insight-card:hover .insight-read .icon { transform: translateX(3px); } }
@media (max-width: 620px) {
  .article-header { padding-block: 22px 18px; }
  .article-body { font-size: 1.04rem; line-height: 1.95; }
  .article-body h2 { font-size: 1.25rem; }
  .article-lead { font-size: 1.04rem; }
  .article-cover { margin-inline: -16px; border-radius: 0; border-inline: 0; }
  .share-menu { inset-inline-end: auto; inset-inline-start: 0; }
}

/* ---------- Genome Insights: browsing 20+ articles (random / newest, search, show more) ---------- */
.insight-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.insight-toolbar .search { flex: 1 1 260px; max-width: 460px; }
.insight-sort { flex: none; }
.insight-sort .chip .icon { width: 15px; height: 15px; }
.insight-count { margin: -6px 0 14px; font-size: .86rem; color: var(--subtle); min-height: 1.4em; }
.insight-more { display: flex; justify-content: center; margin-top: 26px; }
.insight-more .btn[hidden] { display: none; }
.insight-empty { grid-column: 1 / -1; }
/* Desktop: the lead card spans 2 columns × 2 rows, so the first 9 insights fill four even rows (lead + 2 beside it + 6 below). */
@media (min-width: 981px) {
  .insight-grid.insight-list .insight-card.is-lead { grid-column: span 2; grid-row: span 2; display: flex; flex-direction: column; }
  .insight-grid.insight-list .insight-card.is-lead .cover { flex: 1 1 auto; aspect-ratio: auto; min-height: 320px; border-inline-end: 0; border-bottom: 1px solid var(--border); }
  .insight-grid.insight-list .insight-card.is-lead .insight-body { flex: none; }
}
.home-insights-more { display: flex; justify-content: center; margin-top: 20px; }
.home-insight-grid .insight-card .cover img, .insight-list .insight-card .cover img { transition: transform .5s var(--ease); }
@media (hover: hover) { .insight-card:hover .cover img { transform: scale(1.03); } }
@media (prefers-reduced-motion: reduce) { .insight-card .cover img { transition: none; } .insight-card:hover .cover img { transform: none; } }

/* ---------- Institutional identity: tagline, fields, six values, Vision 2030 ---------- */
.hero-box .lead { margin-bottom: 12px; }
.hero-tagline { margin: 0 0 22px; font-weight: 700; font-size: 1.02rem; color: var(--accent); letter-spacing: .01em; }
.values { grid-template-columns: repeat(6, minmax(0, 1fr)); }
@media (max-width: 1100px) { .values { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 18px; } }
@media (max-width: 560px) { .values { grid-template-columns: 1fr; } }
.field-list { list-style: none; padding: 0; margin: 18px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.field-list li { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--card); font-weight: 600; font-size: .92rem; }
.field-list li:first-child { border-color: color-mix(in srgb, var(--primary) 55%, var(--border)); background: var(--primary-soft); }
.field-list .icon { width: 17px; height: 17px; color: var(--accent); }
.v2030-pillars { list-style: none; padding: 0; margin: 4px 0 18px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 900px) { .v2030-pillars { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .v2030-pillars { grid-template-columns: minmax(0, 1fr); } }
.v2030-pillar { display: flex; align-items: flex-start; gap: 12px; padding: 16px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); }
.v2030-pillar > .icon { width: 22px; height: 22px; flex: none; color: var(--accent); margin-top: 2px; }
.v2030-pillar h3 { margin: 0 0 4px; font-size: 1rem; }
.v2030-sdg { margin: 0; font-size: .82rem; color: var(--subtle); }
.v2030-sdg { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.sdg-mini { display: inline-grid; place-items: center; min-width: 24px; height: 22px; padding: 0 5px; border-radius: 5px; background: var(--sdg); color: #fff; font-family: var(--font-en); font-weight: 700; font-size: .76rem; }

/* ================================================================ Community growth: nav groups, showcase, Ask an Alum, Telegram */

/* ---------- Navigation: Learn & Question Bank stand out; community and institutional pages in two menus ---------- */
.nav-link .nav-ic { width: 17px; height: 17px; margin-inline-end: 6px; color: var(--accent); vertical-align: -3px; }
.nav-link.nav-key { color: var(--text); }
.nav-group { position: relative; }
.nav-trigger { display: inline-flex; align-items: center; gap: 4px; background: none; border: 0; cursor: pointer; font: inherit; height: 100%; }
.nav-trigger .nav-chev { width: 15px; height: 15px; transition: transform .18s var(--ease); opacity: .7; }
.nav-trigger.is-current { color: var(--text); }
.nav-group.is-open .nav-chev { transform: rotate(180deg); }
.nav-menu { position: absolute; top: calc(100% + 2px); inset-inline-start: 50%; transform: translateX(50%) translateY(6px); min-width: 300px; padding: 8px;
  background: var(--card); border: 1px solid var(--border-strong); border-radius: 14px; box-shadow: 0 18px 44px rgba(0, 0, 0, .3);
  opacity: 0; visibility: hidden; transition: opacity .16s var(--ease), transform .16s var(--ease), visibility .16s; z-index: 120; }
html[dir="ltr"] .nav-menu { transform: translateX(-50%) translateY(6px); }
.nav-group.is-open .nav-menu { opacity: 1; visibility: visible; transform: translateX(50%) translateY(0); }
html[dir="ltr"] .nav-group.is-open .nav-menu { transform: translateX(-50%) translateY(0); }
.nav-menu ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.nav-item { display: flex; align-items: flex-start; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--text); text-decoration: none !important; }
.nav-item > .icon { width: 20px; height: 20px; margin-top: 3px; color: var(--accent); flex: none; }
.nav-item strong { display: block; font-size: .98rem; font-weight: 700; line-height: 1.4; }
.nav-item small { display: block; font-size: .8rem; color: var(--subtle); line-height: 1.5; }
.nav-item:hover, .nav-item:focus-visible { background: var(--primary-soft); }
.nav-item[aria-current="page"] strong { color: var(--accent); }
@media (max-width: 1040px) {
  .nav-link .nav-ic { display: none; }
  .nav-group { border-bottom: 1px solid var(--border); padding-bottom: 6px; }
  .nav-trigger { pointer-events: none; padding: 16px 4px 4px; font-size: .78rem; font-weight: 700; color: var(--subtle); border-bottom: 0 !important; letter-spacing: .02em; }
  .nav-trigger .nav-chev { display: none; }
  .nav-menu, .nav-group.is-open .nav-menu, html[dir="ltr"] .nav-menu, html[dir="ltr"] .nav-group.is-open .nav-menu { position: static; transform: none; opacity: 1; visibility: visible; min-width: 0; padding: 0; background: none; border: 0; box-shadow: none; }
  .nav-item { padding: 10px 4px; }
  .nav-item small { display: none; }
  .nav-list > li:has(+ .nav-group) > .nav-link { border-bottom: 0; }
}

/* ---------- Shared: tool chips, selects, notices ---------- */
.tool-chips { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tool-chips li { padding: 3px 10px; border-radius: 999px; background: var(--bg-2); border: 1px solid var(--border); font-family: var(--font-en); font-size: .84rem; font-weight: 600; color: var(--muted); }
.tool-chips.small li { padding: 1px 8px; font-size: .74rem; }
.select-wrap select { appearance: none; -webkit-appearance: none; min-height: 42px; padding: 0 14px 0 34px; border-radius: 999px; border: 1px solid var(--border); background: var(--card) no-repeat left 12px center / 14px
  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238C80A3' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); color: var(--text); font-weight: 600; font-size: .9rem; cursor: pointer; }
html[dir="ltr"] .select-wrap select { padding: 0 34px 0 14px; background-position: right 12px center; }
.select-wrap select:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.notice-line { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; margin: 0 0 22px; border-radius: var(--radius); background: var(--primary-soft); color: var(--text); font-size: .92rem; line-height: 1.8; }
.notice-line .icon { width: 18px; height: 18px; flex: none; margin-top: 4px; color: var(--accent); }
.showcase-empty .state { padding: 56px 20px; }

/* ---------- Student Showcase ---------- */
.showcase-header .kicker { margin-bottom: 4px; }
.policy { margin-top: 16px; max-width: 720px; }
.policy summary { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 700; font-size: .9rem; color: var(--accent); list-style: none; }
.policy summary::-webkit-details-marker { display: none; }
.policy summary .icon { width: 16px; height: 16px; }
.policy p { margin: 8px 0 0; font-size: .92rem; color: var(--muted); }
.project-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
@media (max-width: 980px) { .project-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .project-grid { grid-template-columns: minmax(0, 1fr); } }
.project-card { display: flex; flex-direction: column; min-width: 0; border-radius: 18px; overflow: hidden; background: var(--card); border: 1px solid var(--border); color: inherit; text-decoration: none !important;
  transition: transform .22s var(--ease), border-color .22s, box-shadow .22s; }
@media (hover: hover) { .project-card:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--tone) 50%, var(--border)); box-shadow: 0 16px 36px rgba(0, 0, 0, .22); } }
.project-cover { position: relative; aspect-ratio: 16 / 10; background: var(--bg-2); overflow: hidden; }
.project-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease); }
@media (hover: hover) { .project-card:hover .project-cover img { transform: scale(1.04); } }
.project-cover::after { content: ""; position: absolute; inset: auto 0 0 0; height: 45%; background: linear-gradient(to top, rgba(10, 6, 20, .55), transparent); pointer-events: none; }
.project-cover-gen { position: absolute; inset: 0; display: grid; place-items: center; color: var(--tone);
  background: radial-gradient(120% 90% at 80% 10%, color-mix(in srgb, var(--tone) 22%, transparent), transparent 60%), var(--bg-2); }
.project-cover-gen .motif { width: 42%; height: auto; }
.project-cat { position: absolute; z-index: 1; bottom: 12px; inset-inline-start: 12px; padding: 3px 11px; border-radius: 999px; font-size: .78rem; font-weight: 700; color: #fff;
  background: color-mix(in srgb, var(--tone) 70%, #120b22); }
.project-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.project-body h3 { margin: 0; font-size: 1.08rem; line-height: 1.55; text-wrap: balance; }
.project-body > p { margin: 0; font-size: .9rem; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.project-foot { display: flex; align-items: center; gap: 10px; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--border); font-size: .86rem; font-weight: 600; }
.faces { display: inline-flex; flex: none; }
.face { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; overflow: hidden; background: var(--primary-soft); color: var(--accent); font-size: .72rem; font-weight: 700; border: 2px solid var(--card); }
.face + .face { margin-inline-start: -9px; }
.face img { width: 100%; height: 100%; object-fit: cover; }
.project-people { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .78rem; color: var(--subtle); }
.project-meta span + span::before { content: "·"; margin-inline-end: 12px; }

/* Project page */
.project-facts { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: .9rem; color: var(--muted); }
.project-facts li { display: inline-flex; align-items: center; gap: 6px; }
.project-facts .icon { width: 16px; height: 16px; color: var(--accent); }
.project-page .article-body .tool-chips { margin-bottom: 1.2em; }
.project-links { display: flex; flex-wrap: wrap; gap: 10px; margin: 28px 0 8px; }
.project-team { margin-top: 36px; padding-top: 22px; border-top: 1px solid var(--border); }
.project-team h2 { font-size: 1.2rem; margin-bottom: 14px; }
.people { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.person { display: flex; gap: 14px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); }
.person-photo { width: 56px; height: 56px; border-radius: 50%; overflow: hidden; flex: none; display: grid; place-items: center; background: var(--primary-soft); color: var(--accent); font-weight: 700; }
.person-photo img { width: 100%; height: 100%; object-fit: cover; }
.person-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: .9rem; }
.person-text strong { font-size: 1rem; }
.person-text p { margin: 6px 0 0; color: var(--muted); font-size: .86rem; }
.person-link { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; font-weight: 700; font-size: .86rem; }
.person-link .icon { width: 15px; height: 15px; }

/* ---------- Ask an Alum ---------- */
.mentor-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
@media (max-width: 980px) { .mentor-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .mentor-grid { grid-template-columns: minmax(0, 1fr); } }
.mentor-card { display: flex; flex-direction: column; gap: 12px; padding: 20px; border-radius: 18px; background: var(--card); border: 1px solid var(--border); position: relative; overflow: hidden; }
.mentor-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: linear-gradient(90deg, var(--primary), var(--accent)); opacity: .7; }
.mentor-card header { display: flex; gap: 14px; align-items: center; }
.mentor-card h3 { margin: 0; font-size: 1.05rem; }
.mentor-photo { width: 64px; height: 64px; border-radius: 50%; overflow: hidden; flex: none; display: grid; place-items: center; background: var(--primary-soft); color: var(--accent); font-weight: 700; font-size: 1.1rem; border: 2px solid color-mix(in srgb, var(--primary) 40%, var(--border)); }
.mentor-photo img { width: 100%; height: 100%; object-fit: cover; }
.mentor-role { margin: 2px 0 0; font-size: .86rem; color: var(--muted); }
.mentor-exp { display: flex; gap: 8px; align-items: flex-start; margin: 0; font-size: .86rem; font-weight: 600; color: var(--text); }
.mentor-exp .icon { width: 16px; height: 16px; flex: none; margin-top: 4px; color: var(--accent); }
.mentor-bio { margin: 0; font-size: .9rem; color: var(--muted); }
.mentor-topics > span { display: block; font-size: .78rem; color: var(--subtle); margin-bottom: 6px; }
.mentor-topics .tool-chips li { font-family: var(--font-ar); }
.mentor-cta { margin-top: auto; align-self: flex-start; }
.join-band { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 18px 32px; }
.join-band h2 { font-size: clamp(1.2rem, 1rem + .8vw, 1.55rem); margin: 0 0 8px; max-width: 640px; }
.join-band p { margin: 0; color: var(--muted); max-width: 640px; }

/* ---------- Telegram invitation ---------- */
.telegram-band { display: flex; flex-wrap: wrap; align-items: center; gap: 18px 24px; padding: clamp(20px, 3vw, 30px); border-radius: 20px; border: 1px solid color-mix(in srgb, var(--primary) 35%, var(--border));
  background: radial-gradient(90% 140% at 100% 0%, var(--primary-soft), transparent 60%), var(--card); }
.telegram-band > div { flex: 1 1 320px; }
.telegram-band h2 { margin: 0 0 6px; font-size: 1.35rem; }
.telegram-band p { margin: 0; color: var(--muted); }
.telegram-mark { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: var(--primary); color: #fff; flex: none; }
.telegram-mark .icon { width: 26px; height: 26px; }
@media (prefers-reduced-motion: reduce) { .project-card, .project-cover img, .nav-menu, .nav-chev { transition: none !important; } }
/* fixes: inline icons in nav links; tool chips inside article bodies */
@media (min-width: 1041px) { .nav-list > li > .nav-link { display: inline-flex; align-items: center; height: var(--header-h); line-height: 1; } }
.nav-link .nav-ic { display: inline-block; flex: none; }
.article-body ul.tool-chips { display: flex; padding: 0; gap: 6px; }
.article-body ul.tool-chips li { list-style: none; color: var(--muted); }

/* ================================================================ Question Bank v3: domains, topic checkboxes, practice hints, exam mode */
.bank-total { margin: 0 0 18px; font-size: .9rem; color: var(--muted); font-weight: 600; }
.domain-group { margin-bottom: 26px; }
.domain-title { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; font-size: 1.05rem; margin: 0 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.domain-title small { font-size: .8rem; font-weight: 600; color: var(--subtle); }
fieldset.field { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.field legend { padding: 0; margin-bottom: 8px; }
.field-note { display: block; margin-top: 6px; font-size: .84rem; color: var(--subtle); }
.field-note.is-block { display: flex; align-items: center; gap: 8px; color: var(--warning); font-weight: 600; }
.field-note.is-block .icon { width: 16px; height: 16px; flex: none; }
.topic-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-bottom: 10px; }
.topic-tools .btn[disabled] { opacity: .45; cursor: default; }
.topic-count { margin-inline-start: auto; font-size: .84rem; color: var(--muted); font-weight: 600; }
.topic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.topic-check { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--card-2); cursor: pointer; transition: border-color .15s, background-color .15s; }
.topic-check:hover { border-color: color-mix(in srgb, var(--primary) 55%, var(--border)); }
.topic-check.is-on { border-color: var(--primary); background: var(--primary-soft); }
.topic-check input { width: 18px; height: 18px; accent-color: var(--primary); flex: none; margin: 0; }
.topic-check:focus-within { outline: 2px solid var(--primary); outline-offset: 2px; }
.topic-name { flex: 1; min-width: 0; font-weight: 600; font-size: .92rem; }
.topic-n { display: flex; flex-direction: column; align-items: flex-end; font-size: .78rem; font-weight: 700; color: var(--accent); white-space: nowrap; }
.topic-n small { font-weight: 500; color: var(--subtle); font-size: .72rem; }
.chip[disabled] { opacity: .45; cursor: not-allowed; }
.mode-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.mode-card { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; text-align: start; border-radius: var(--radius); border: 1px solid var(--border); background: var(--card-2); color: var(--text); font: inherit; cursor: pointer; }
.mode-card > .icon { width: 22px; height: 22px; flex: none; color: var(--accent); margin-top: 2px; }
.mode-card strong { display: block; font-size: .95rem; }
.mode-card small { display: block; font-size: .8rem; color: var(--muted); line-height: 1.6; margin-top: 2px; }
.mode-card[aria-checked="true"] { border-color: var(--primary); background: var(--primary-soft); box-shadow: inset 0 0 0 1px var(--primary); }
.question-text, .choice-text, .review-q { unicode-bidi: plaintext; }
.feedback.retry { border-color: color-mix(in srgb, var(--warning) 45%, var(--border)); }
.feedback.retry .feedback-title { color: var(--warning); }
.feedback.retry .btn { margin-top: 10px; }
.hint-box { margin-top: 8px; padding: 10px 12px; border-radius: var(--radius-sm); border-inline-start: 3px solid var(--warning); background: var(--warning-soft); }
.hint-box p { margin: 4px 0 0; font-size: .92rem; color: var(--text); }
.hint-tag { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 800; color: var(--warning); letter-spacing: .02em; }
.hint-tag .icon { width: 15px; height: 15px; }
.choice.is-selected { border-color: var(--primary); background: var(--primary-soft); box-shadow: inset 0 0 0 1px var(--primary); }
.choice.is-selected .choice-key { background: var(--primary); color: #fff; }
.choice.is-selected .choice-tag { color: var(--accent); }
.exam-note { display: flex; gap: 8px; align-items: flex-start; margin: 0 0 12px; font-size: .84rem; color: var(--muted); }
.exam-note .icon { width: 16px; height: 16px; flex: none; margin-top: .3em; }
.exam-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 14px; }
.exam-nav .btn[disabled] { opacity: .45; cursor: default; }
.q-palette { margin-top: 16px; }
.q-palette ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.q-palette button { min-width: 34px; height: 34px; padding: 0 6px; border-radius: 8px; border: 1px solid var(--border); background: var(--card-2); color: var(--muted); font: inherit; font-family: var(--font-en); font-weight: 700; font-size: .82rem; cursor: pointer; }
.q-palette button.is-answered { background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 50%, var(--border)); color: var(--text); }
.q-palette button.is-current { outline: 2px solid var(--primary); outline-offset: 1px; color: var(--text); }
.submit-confirm { margin-top: 16px; padding: 14px 16px; border-radius: var(--radius); border: 1px solid color-mix(in srgb, var(--warning) 50%, var(--border)); background: var(--warning-soft); }
.submit-confirm p { display: flex; gap: 8px; align-items: center; margin: 0 0 10px; font-weight: 700; }
.submit-confirm p .icon { width: 18px; height: 18px; color: var(--warning); flex: none; }
.submit-confirm div { display: flex; flex-wrap: wrap; gap: 8px; }
.result-counts { flex-wrap: wrap; }
.result-counts .none dd { color: var(--subtle); }
.result-dist { font-size: .84rem; color: var(--subtle); margin: 0 0 10px; }
.learn-signal { justify-content: center; color: var(--text); }
.learn-signal .icon { color: var(--warning); }
.topic-results { margin: 18px auto 6px; max-width: 520px; text-align: start; }
.topic-results td.num { white-space: nowrap; }
.meter { display: inline-block; width: 70px; height: 6px; border-radius: 999px; background: var(--bg-2); margin-inline-end: 8px; vertical-align: middle; overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--primary); border-radius: inherit; }
.review-meta { margin: 0 0 6px; font-size: .8rem; color: var(--subtle); }
.review-item.is-right .review-state { color: var(--success); }
.review-item.is-wrong .review-state { color: var(--error); }
.review-item.is-none .review-state { color: var(--warning); }
.review-more { margin-top: 18px; text-align: start; }
.review-more summary { cursor: pointer; font-weight: 700; color: var(--accent); padding: 8px 0; }
.review-more .review-list { margin-top: 10px; }
@media (max-width: 620px) {
  .topic-count { margin-inline-start: 0; width: 100%; }
  .exam-nav .btn { flex: 1; }
}
.ws-choice { white-space: pre; font-family: var(--font-mono); }
.ws-mark { color: var(--warning); opacity: .85; }

/* ---------- Learning Encyclopedia (موسوعة جينوم التعليمية) — academy/ pages, generated by tools/academy.mjs ---------- */
.academy-layout { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 36px; align-items: start; padding-block: 24px 56px; }
.academy-layout > * { min-width: 0; }
.academy-layout .lesson { max-width: 800px; margin-inline: 0; }
.side-toggle { display: none; }
.academy-side { position: sticky; top: calc(var(--header-h) + 16px); max-height: calc(100vh - var(--header-h) - 32px); overflow-y: auto; overscroll-behavior: contain;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; scrollbar-width: thin; }
.side-head { display: grid; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.side-course { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; }
.side-course strong { display: block; font-size: .98rem; line-height: 1.4; }
.side-course small { display: block; color: var(--subtle); font-size: .78rem; }
.side-progress, .course-progress { display: grid; gap: 6px; font-size: .8rem; color: var(--muted); }
.course-progress { max-width: 420px; margin-top: 16px; }
.course-card .course-progress { margin-top: 16px; }
.side-search, .course-search { padding-inline: 10px; }
.side-search input, .course-search input { font-size: .9rem; padding: 8px 0; }
.side-unit h3 { display: grid; font-size: .86rem; font-weight: 700; color: var(--text); margin: 14px 4px 6px; line-height: 1.5; }
.unit-n { font-size: .74rem; font-weight: 600; color: var(--accent); }
.side-unit ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.side-unit a { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 6px 8px; border-radius: 8px; color: var(--muted); font-size: .88rem; line-height: 1.45; text-decoration: none; }
.side-unit a:hover { background: var(--primary-soft); color: var(--text); }
.side-unit a[aria-current="page"] { background: var(--primary-soft); color: var(--text); font-weight: 700; box-shadow: inset -3px 0 0 var(--primary); }
html[dir="ltr"] .side-unit a[aria-current="page"] { box-shadow: inset 3px 0 0 var(--primary); }
.ln { flex-shrink: 0; min-width: 26px; height: 22px; display: inline-grid; place-items: center; border-radius: 6px; background: var(--bg-2); font-family: var(--font-en); font-size: .74rem; font-weight: 600; color: var(--subtle); }
.side-unit a[aria-current="page"] .ln { background: var(--primary-strong); color: #fff; }
.lt { flex: 1; min-width: 0; }
.done-mark { flex-shrink: 0; width: 18px; height: 18px; display: grid; place-items: center; border-radius: 50%; color: transparent; }
.done-mark .icon { width: 12px; height: 12px; }
.is-done .done-mark { background: var(--success-soft); color: var(--success); }
.side-empty { font-size: .86rem; padding: 10px 6px; }
[data-lesson-item][hidden] { display: none; }

.lesson-header { padding-block: 4px 18px; }
.lesson-kicker { display: flex; align-items: center; gap: 8px; font-size: .86rem; color: var(--subtle); margin: 0 0 8px; }
.lesson-header h1 { font-size: clamp(1.55rem, 1.1rem + 1.6vw, 2.2rem); line-height: 1.45; margin: 0 0 4px; text-wrap: balance; }
.lesson-en { font-family: var(--font-en); font-size: 1rem; font-weight: 600; color: var(--accent); margin: 0 0 16px; }
h1 .lesson-en, h2 .lesson-en { display: block; margin: 4px 0 0; font-size: .55em; }
.lesson-toc { margin: 0 0 22px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); }
.lesson-toc summary { cursor: pointer; padding: 10px 14px; font-weight: 600; font-size: .92rem; min-height: 44px; display: flex; align-items: center; }
.lesson-toc ol { margin: 0; padding: 0 34px 12px 14px; display: grid; gap: 4px; font-size: .9rem; }
html[dir="ltr"] .lesson-toc ol { padding: 0 14px 12px 34px; }
.lesson-intro > p:first-child { font-size: 1.12rem; }
.lesson-body h2 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; font-size: 1.32rem; margin: 1.9em 0 .6em; padding-top: 1.1em; border-top: 1px solid var(--border); }
.lesson-body h3 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; font-size: 1.06rem; margin: 1.3em 0 .4em; }
.sec-en { font-family: var(--font-en); font-size: .78rem; font-weight: 600; color: var(--subtle); letter-spacing: .02em; }
.lesson-body code, .lesson-intro code { font-family: var(--font-mono); font-size: .88em; background: var(--bg-2); border: 1px solid var(--border); border-radius: 5px; padding: 0 5px; white-space: pre-wrap; overflow-wrap: anywhere; }
.lesson-body pre code { white-space: pre; overflow-wrap: normal; }
.lesson-body table code { overflow-wrap: normal; white-space: nowrap; }
.lesson-body, .lesson-intro, .lesson-header { overflow-wrap: break-word; min-width: 0; }
.sec-goals ul { list-style: none; padding: 16px 18px; margin: 0; background: var(--primary-soft); border-radius: var(--radius); }
.sec-goals li { position: relative; padding-inline-start: 26px; }
.sec-goals li::before { content: ""; position: absolute; inset-inline-start: 3px; top: .72em; width: 11px; height: 6px; border-left: 2px solid var(--accent); border-bottom: 2px solid var(--accent); transform: rotate(-45deg); }
.lesson-header .meta-line span { display: inline-flex; align-items: center; gap: 5px; }
.sec-mistake { border-inline-start: 3px solid var(--warning); padding-inline-start: 16px; }
.sec-mistake h2 { border-top: 0; }
.lesson-note { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; margin: 1em 0; border-radius: var(--radius); background: var(--bg-2); border: 1px solid var(--border); font-size: .98rem; }
.lesson-note .icon { flex-shrink: 0; width: 18px; height: 18px; margin-top: .45em; color: var(--accent); }
.lesson-note p { margin: 0; }

.code-block, .code-output { margin: 14px 0; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--bg-2); }
.code-head { display: flex; align-items: center; gap: 8px; padding: 4px 6px 4px 12px; background: var(--card-2); border-bottom: 1px solid var(--border); font-family: var(--font-en); font-size: .78rem; font-weight: 600; color: var(--muted); }
html[dir="rtl"] .code-head { padding: 4px 12px 4px 6px; }
.code-block.is-file .code-head { font-family: var(--font-ar); }
.code-tag { font-family: var(--font-ar); font-size: .72rem; padding: 0 8px; border-radius: 999px; }
.code-tag.is-error { background: var(--error-soft); color: var(--error); }
.code-copy { margin-inline-start: auto; display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 4px 10px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font: inherit; font-family: var(--font-ar); cursor: pointer; }
.code-copy:hover, .code-copy.is-done { background: var(--primary-soft); color: var(--text); }
.code-copy .icon { width: 15px; height: 15px; }
.code-block pre.code { margin: 0; border: 0; border-radius: 0; background: transparent; font-size: .9rem; }
.code-output { background: var(--bg); border-style: dashed; }
.code-output figcaption { padding: 6px 12px 0; font-size: .76rem; font-weight: 700; color: var(--success); }
.code-output pre { margin: 0; padding: 6px 14px 12px; overflow-x: auto; font-family: var(--font-mono); font-size: .88rem; line-height: 1.6; white-space: pre; text-align: left; direction: ltr; color: var(--text); }
.code-output samp { font-family: inherit; }
.tk-f { color: #8FC7FF; }
[data-theme="light"] .tk-f { color: #1D5FB4; }
.lesson-figure { margin: 14px 0; }
.lesson-figure img { width: 100%; max-width: 560px; height: auto; border-radius: 10px; border: 1px solid var(--border); background: #fff; }
.lesson-figure figcaption { font-size: .86rem; color: var(--muted); margin-top: 6px; }
.table-wrap { overflow-x: auto; margin: 1em 0; border: 1px solid var(--border); border-radius: 10px; }
.lesson-table { width: 100%; border-collapse: collapse; font-size: .94rem; }
.lesson-table th, .lesson-table td { padding: 8px 12px; border-bottom: 1px solid var(--border); text-align: start; vertical-align: top; }
.lesson-table th { background: var(--card-2); font-weight: 700; }
.lesson-table tr:last-child td { border-bottom: 0; }

.quick-check { padding: 18px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--card); }
.qc-q { font-family: var(--font-en); font-size: 1.02rem; font-weight: 600; line-height: 1.6; text-align: left; margin-bottom: 12px; }
.qc-q p { margin: 0 0 6px; }
.quick-check .choices { margin: 0; padding: 0; }
.quick-check .choice { min-height: 48px; font-family: var(--font-en); text-align: left; color: var(--text); }
.quick-check .choice code { white-space: pre-wrap; }
.qc-feedback:empty { display: none; }
.qc-feedback { margin-top: 14px; padding: 12px 14px; border-radius: var(--radius); background: var(--bg-2); border: 1px solid var(--border); }
.qc-feedback.is-ok { border-color: var(--success); background: var(--success-soft); }
.qc-feedback.is-retry { border-color: var(--warning); background: var(--warning-soft); }
.qc-feedback.is-bad { border-color: var(--error); background: var(--error-soft); }
.qc-feedback .feedback-title .icon { width: 18px; height: 18px; }
.qc-feedback p { margin: 4px 0 0; font-size: .98rem; }
.solution { margin: 14px 0 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); }
.solution > summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; padding: 8px 14px; font-weight: 600; color: var(--accent); }
.solution > :not(summary) { margin-inline: 14px; }
.solution > :last-child { margin-bottom: 14px; }
.test-box { display: flex; gap: 14px; align-items: flex-start; padding: 18px; border-radius: var(--radius); background: var(--primary-soft); border: 1px solid var(--border); }
.test-box p { margin: 0 0 12px; }
.lesson-done { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 36px; padding-top: 22px; border-top: 1px solid var(--border); }
.lesson-done [aria-pressed="true"] { border-color: var(--success); background: var(--success-soft); color: var(--text); }
.lesson-done [aria-pressed="true"] .icon { color: var(--success); }
.lesson-done-note { font-size: .84rem; }
.lesson-pager { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: stretch; margin-top: 22px; }
.pager-link { display: grid; gap: 2px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); color: var(--text); text-decoration: none; min-height: 64px; }
.pager-link:hover { border-color: var(--primary); }
.pager-link small { display: inline-flex; align-items: center; gap: 4px; color: var(--accent); font-weight: 600; font-size: .8rem; }
.pager-link small .icon { width: 14px; height: 14px; }
.pager-link strong { font-size: .94rem; line-height: 1.5; }
.pager-link.is-next { text-align: end; }
.pager-link.is-next small { justify-content: flex-end; }
.pager-link.is-empty { border: 0; background: none; }
.pager-index { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 14px; border-radius: var(--radius); color: var(--muted); font-size: .88rem; font-weight: 600; text-decoration: none; }
.pager-index:hover { background: var(--primary-soft); color: var(--text); }

.course-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.course-index { max-width: 900px; }
.course-search { margin-bottom: 8px; max-width: 480px; }
.unit-block h2 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; font-size: 1.2rem; margin: 30px 0 12px; }
.unit-block h2 .unit-n { width: 100%; }
.lesson-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.lesson-row { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); color: var(--text); text-decoration: none; }
.lesson-row:hover { border-color: var(--primary); }
.lesson-row .ln { min-width: 34px; height: 30px; font-size: .82rem; }
.lr-body { flex: 1; min-width: 0; display: grid; }
.lr-body strong { font-size: 1rem; line-height: 1.5; }
.lr-body small { font-family: var(--font-en); color: var(--accent); font-size: .8rem; }
.lr-sum { color: var(--muted); font-size: .86rem; line-height: 1.6; margin-top: 2px; }
.lr-meta { flex-shrink: 0; font-size: .8rem; color: var(--subtle); }
.academy-search { margin-top: 18px; max-width: 560px; }
.academy-results { max-width: 560px; margin-top: 8px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 6px; position: relative; z-index: 2; }
.academy-results a { display: grid; gap: 1px; padding: 9px 12px; border-radius: 8px; color: var(--text); text-decoration: none; }
.academy-results a:hover, .academy-results a:focus-visible { background: var(--primary-soft); }
.academy-results small { color: var(--subtle); font-size: .78rem; }
.academy-results p { margin: 0; padding: 10px 12px; color: var(--muted); font-size: .9rem; }
.course-card h2 { font-size: 1.2rem; margin: 4px 0 8px; }
.course-card h2 .card-link::after, .course-card h3 .card-link::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.course-card:hover { border-color: var(--primary); }
.academy-continue { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 14px 18px; margin-bottom: 22px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--card); }
.academy-continue p { margin: 0; flex: 1; min-width: 220px; }
.academy-continue small { display: block; color: var(--subtle); }

@media (max-width: 1040px) {
  .academy-layout { grid-template-columns: minmax(0, 1fr); gap: 16px; padding-top: 16px; }
  .side-toggle { display: flex; justify-content: flex-start; gap: 10px; width: 100%; min-height: 48px; }
  .side-toggle small { margin-inline-start: auto; color: var(--subtle); font-weight: 400; }
  .academy-side { position: static; max-height: none; display: none; }
  .academy-side.is-open { display: block; }
  .academy-layout .lesson { max-width: none; }
}
@media (max-width: 620px) {
  .lesson-pager { grid-template-columns: 1fr; }
  .pager-link.is-empty { display: none; }
  .pager-index { order: 3; }
  .pager-link.is-next, .pager-link.is-next small { text-align: start; justify-content: flex-start; }
  .lesson-row { flex-wrap: wrap; gap: 6px 12px; padding: 12px; }
  .lr-meta { width: 100%; padding-inline-start: 46px; }
  .test-box { flex-direction: column; }
  .quick-check { padding: 14px; }
  .lesson-body h2 { font-size: 1.2rem; }
}
@media print { .academy-side, .side-toggle, .lesson-pager, .lesson-done, .code-copy { display: none !important; } .academy-layout { display: block; } }

/* Header with the Encyclopedia item: tighter spacing on narrow desktops so all links fit in one row (Arabic and English). */
@media (min-width: 1041px) and (max-width: 1199px) {
  .header-inner { gap: 14px; }
  .nav-list { gap: 6px; }
  .nav-link { padding: 0 8px; font-size: .88rem; }
  .nav-link[aria-current="page"]::after { inset-inline: 8px; }
}

/* Partners + "let's make an impact together" invitation (about.html «شركاؤنا», impact.html «الشراكات").
   New verified partners in data/impact.json are added as cards before the invitation; the grid wraps on its own. */
.partners-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 16px; align-items: stretch; }
.partners-grid > .card { height: 100%; display: flex; align-items: center; }
.partners-grid > .card-link .partner { width: 100%; }
.partner-invite { gap: 14px; align-items: flex-start !important; background: var(--primary-soft); border-color: var(--border-strong); }
.partner-invite h3 { margin: 0 0 4px; font-size: 1.05rem; }
.partner-invite p { margin: 0 0 14px; font-size: .9rem; color: var(--muted); }
.partner-invite .btn { min-height: 44px; }
.partner-invite .btn .icon { width: 15px; height: 15px; }
.contribute-grid > .card { display: flex; flex-direction: column; }
.contribute-grid > .card > div:last-child, .contribute-grid > .card > ul:last-child { margin-top: auto; }
@media (max-width: 620px) { .partner-invite { flex-direction: column; } .partner-invite .btn { width: 100%; justify-content: center; } }

/* About → «شركاؤنا»: heading and partner cards on one compact row; cards keep a natural width and wrap as partners are added. */
#sec-about-partners { padding-block: clamp(32px, 4vw, 48px); }
#sec-about-partners .container { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 40px; }
#sec-about-partners .section-head { margin: 0; }
#sec-about-partners .partners-grid { flex: 1 1 320px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 400px)); }

/* Mobile readability: English subtitles in encyclopedia cards/headings at least 12px; larger copy-code button for touch. */
h1 .lesson-en, h2 .lesson-en { font-size: max(.55em, 12px); }
@media (max-width: 620px) { .code-copy { min-height: 40px; padding: 6px 12px; } }

/* Privacy policy: comfortable reading column, first heading flush with the top. */
.privacy-page .prose > h2:first-child { margin-top: 0; }
.privacy-page .prose p { line-height: 1.95; margin: 0 0 .9em; }

/* Home → «أثرنا بالأرقام»: large figures, short titles, thin dividers (no cards, no gradients). */
#sec-stats { padding-block: clamp(36px, 5vw, 56px); }
#sec-stats .section-head { margin-bottom: 20px; }
.home-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.home-stats .stat { padding: clamp(22px, 3vw, 34px) 16px; text-align: center; }
.home-stats .stat:first-child { padding-inline-start: 16px; }
.home-stats .stat-value { font-size: clamp(2.5rem, 4.6vw, 3.5rem); font-weight: 700; letter-spacing: -.03em; color: var(--text); }
.home-stats .stat-label { margin-top: 10px; font-size: 1rem; font-weight: 600; color: var(--muted); line-height: 1.5; }
@media (max-width: 600px) {
  .home-stats { grid-template-columns: 1fr; }
  .home-stats .stat { padding: 18px 8px; border-inline-start: 0; border-top: 1px solid var(--border); }
  .home-stats .stat:first-child { border-top: 0; }
  .home-stats .stat-value { font-size: 2.6rem; }
}

/* About → «فريق جينوم»: founder card on top; department cards open (accordion) to show their approved members. */
#sec-genome-team .team-head { justify-content: center; text-align: center; margin-bottom: 26px; }
.org { display: flex; flex-direction: column; align-items: center; }
.org-card { position: relative; display: flex; align-items: center; gap: 14px; padding: 16px 18px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); text-align: start; }
.org-card .avatar { margin: 0; flex-shrink: 0; }
.org-text { min-width: 0; }
.org-text h3 { margin: 0; font-size: 1.02rem; line-height: 1.4; }
.org-role { margin: 2px 0 0; font-size: .88rem; color: var(--muted); }
.org-li { display: grid; place-items: center; width: 36px; height: 36px; border-radius: var(--radius-sm); color: var(--muted); margin-inline-start: auto; flex-shrink: 0; }
.org-li:hover { color: var(--text); background: var(--primary-soft); }
.org-li .icon { width: 18px; height: 18px; }
.org-founder { min-width: min(100%, 420px); padding: 20px 22px; background: var(--primary-soft); border-color: var(--border-strong); }
.org-founder .avatar { width: 80px; height: 80px; font-size: 1.5rem; border-color: var(--primary); }
.org-founder h3 { font-size: 1.22rem; }
.org-founder .org-role { color: var(--accent); font-weight: 600; font-size: .95rem; }
.tracks-block { margin-top: 36px; padding-top: 28px; border-top: 1px solid var(--border); }
.tracks-title { font-size: 1.12rem; margin: 0 0 4px; text-align: center; }
.tracks-desc { text-align: center; margin: 0 0 18px; font-size: .92rem; }
.tracks { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; align-items: start; }
.track { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); transition: border-color .2s var(--ease); }
.track-head { display: flex; align-items: flex-start; gap: 12px; width: 100%; padding: 14px; border: 0; background: none; color: inherit; font: inherit; text-align: start; border-radius: inherit; }
button.track-head { cursor: pointer; }
button.track-head:hover .track-title { color: var(--accent); }
button.track-head:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.track.is-open { border-color: var(--border-strong); }
.track .icon-box { width: 38px; height: 38px; flex-shrink: 0; }
.track-text { display: grid; gap: 3px; flex: 1; min-width: 0; }
.track-title { font-weight: 700; font-size: .95rem; line-height: 1.45; transition: color .15s; }
.track-desc { font-size: .84rem; color: var(--muted); line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.track { position: relative; }
.track-chev { position: absolute; top: 10px; inset-inline-end: 10px; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; color: var(--accent); background: var(--primary-soft); transition: transform .25s var(--ease); }
.track-chev .icon { width: 14px; height: 14px; }
.track.is-expandable .track-title { padding-inline-end: 22px; }
.track.is-open .track-chev { transform: rotate(180deg); }
.track-panel { display: grid; grid-template-rows: 0fr; visibility: hidden; transition: grid-template-rows .28s var(--ease), visibility 0s linear .28s; }
.track.is-open .track-panel { grid-template-rows: 1fr; visibility: visible; transition: grid-template-rows .28s var(--ease), visibility 0s; }
.track-panel-inner { overflow: hidden; }
.track-members { display: grid; gap: 8px; padding: 0 12px 12px; }
.org-member { padding: 10px 12px; gap: 10px; background: var(--bg-2); }
.org-member .avatar { width: 44px; height: 44px; font-size: .95rem; }
.org-member h3 { font-size: .95rem; }
.org-member .org-role { font-size: .82rem; }
@media (prefers-reduced-motion: reduce) { .track-panel, .track-chev { transition: none !important; } }
@media (max-width: 1100px) { .tracks { grid-template-columns: repeat(2, minmax(0, 1fr)); } .track-desc { -webkit-line-clamp: unset; display: block; } }
@media (max-width: 560px) { .tracks { grid-template-columns: 1fr; } .org-founder { min-width: 0; width: 100%; } }

/* Ask an Alum: participants list sits close to the page title; balanced gap before the invitation band. */
.mentors-list { padding-bottom: clamp(36px, 5vw, 56px); }

/* Encyclopedia diagrams — inline SVG built by tools/academy.mjs; colours follow the theme. */
.lesson-diagram { margin: 18px 0; --nt-a: #3FCB94; --nt-t: #F27D8E; --nt-g: #F2AE55; --nt-c: #5B9BFF; --nt-u: #EC7DBE; --nt-ink: #0E0B18; }
[data-theme="light"] .lesson-diagram { --nt-a: #38B985; --nt-t: #EC6F82; --nt-g: #EDA54C; --nt-c: #5A92F0; --nt-u: #D9609F; --nt-ink: #140C24; }
.lesson-diagram svg { display: block; width: 100%; max-width: 620px; height: auto; margin-inline: auto; padding: 10px; box-sizing: border-box; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-2); direction: ltr; font-family: Inter, "IBM Plex Sans Arabic", system-ui, sans-serif; }
.lesson-diagram figcaption { text-align: center; }
.lesson-diagram .dg-text { fill: var(--text); font-size: 17px; font-weight: 600; }
.lesson-diagram .dg-sub { fill: var(--muted); font-size: 14px; }
.lesson-diagram .dg-on { fill: var(--nt-ink); font-size: 18px; font-weight: 700; }
.lesson-diagram .dg-line { stroke: var(--muted); stroke-width: 2.5; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.lesson-diagram .dg-thin { stroke: var(--subtle); stroke-width: 2; fill: none; stroke-linecap: round; }
.lesson-diagram .dg-dash { stroke: var(--subtle); stroke-width: 2; stroke-dasharray: 4 4; fill: none; }
.lesson-diagram .dg-accent { stroke: var(--accent); stroke-width: 3; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.lesson-diagram .dg-accent-fill { fill: var(--accent); }
.lesson-diagram .dg-muted-fill { fill: var(--muted); }
.lesson-diagram .dg-box { fill: var(--card); stroke: var(--border-strong, var(--border)); stroke-width: 2; }
.lesson-diagram .dg-soft { fill: var(--card-2, var(--card)); stroke: var(--border); stroke-width: 1.5; }
.lesson-diagram .dg-prim { fill: var(--primary); }
.lesson-diagram .dg-a { fill: var(--nt-a); } .lesson-diagram .dg-t { fill: var(--nt-t); }
.lesson-diagram .dg-g { fill: var(--nt-g); } .lesson-diagram .dg-c { fill: var(--nt-c); } .lesson-diagram .dg-u { fill: var(--nt-u); }
