/*
  style.css — visual language of the RASIN presentation: drafting-paper background, hairline rules,
  sheet/plate numbering and the five security-zone colours shared with the architectural drawings.
  All colours are tokens on :root, redefined for dark mode. No gradients (grid lines use hard stops only),
  no heavy shadows.
*/

/* ---------- Tokens ---------- */
:root {
  --paper:#EBF0F3; --sheet:#FBF8F0; --ink:#1B2226; --ink-2:#55616A; --rule:#D8D1C0; --wall:#1F282D; --accent:#1E5B74;
  --head:#172B38; --gold:#8A6514;
  --z0:#E2E5E0; --z0s:#7C857F;                                  /* Z0 perimeter — same values as the embedded drawings */
  --z1:#D4EADC; --z2:#D2E0F0; --z3:#F0DEB6; --z4:#EAB2A4;      /* zone fills */
  --z1s:#3B8660; --z2s:#3A6CA3; --z3s:#9C7019; --z4s:#AE3F2A;  /* zone strokes & text */

  /* CIA — fixed mapping across the whole site */
  --cia-c: var(--z2s); --cia-i: var(--z3s); --cia-a: var(--z1s);

  /* blueprint-tinted page under cream sheets */
  --grid: color-mix(in srgb, var(--accent) 6%, transparent);
  --grid-major: color-mix(in srgb, var(--accent) 11%, transparent);
  --frame-opacity: .16;

  --f-body: "IBM Plex Sans Arabic", Tahoma, "Segoe UI", sans-serif;
  --f-head: "Noto Kufi Arabic", Tahoma, "Segoe UI", sans-serif;
  --f-mono: "IBM Plex Mono", Consolas, "Courier New", monospace;

  --hdr: 64px;
  --gutter: clamp(16px, 4vw, 48px);
  --maxw: 1240px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --paper:#0F1416; --sheet:#161D20; --ink:#E2E7E5; --ink-2:#9AA6AA; --rule:#2E383C; --wall:#D3DBD8; --accent:#72B6CF;
  --head:#EFE4CC; --gold:#D9B25C;
  --z0:#232A2C; --z0s:#8A9490;
  --z1:#1D3A2B; --z2:#1C2F47; --z3:#463818; --z4:#5A271E;
  --z1s:#6CC296; --z2s:#7FA9DE; --z3s:#E1B04F; --z4s:#F08A72;
  --frame-opacity: .2;
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: var(--hdr); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  overflow-x: hidden;
  font-family: var(--f-body);
  font-size: 17px;
  line-height: 1.75;
  color: var(--ink);
  background-color: var(--paper);
  /* drafting grid: 8px minor, 40px major — hard-stop lines, not colour gradients */
  background-image:
    linear-gradient(var(--grid-major) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-major) 1px, transparent 1px),
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 40px 40px, 40px 40px, 8px 8px, 8px 8px;
  background-attachment: fixed;
}
:root[data-theme="dark"] body { --grid: color-mix(in srgb, var(--rule) 45%, transparent); }

h1, h2, h3 { font-family: var(--f-head); line-height: 1.4; margin: 0; font-weight: 700; }
p { margin: 0; }
a { color: var(--accent); }
.mono, .num, .plate { font-family: var(--f-mono); }
html[lang="en"] body { line-height: 1.6; }

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

.skip {
  position: absolute; inset-inline-start: 12px; top: -60px; z-index: 100;
  background: var(--sheet); color: var(--ink); border: 1px solid var(--wall); padding: 8px 14px;
}
.skip:focus-visible { top: 12px; }

/* ---------- Top bar ---------- */
.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  height: var(--hdr);
  display: flex; align-items: center; gap: 16px;
  padding-inline: var(--gutter);
  background: var(--sheet);
  border-bottom: 1px solid var(--wall);
}
.brand {
  display: flex; flex-direction: column; align-items: flex-start; flex: none;
  color: var(--ink); text-decoration: none; line-height: 1;
}
.brand-name { font-family: var(--f-head); font-weight: 700; font-size: 22px; line-height: 1.25; }
.brand-latin { font-family: var(--f-mono); font-size: 10.5px; letter-spacing: .28em; color: var(--ink-2); margin-top: 2px; }

.nav { flex: 1; min-width: 0; display: flex; justify-content: center; position: relative; }
.nav-list {
  list-style: none; margin: 0; padding: 0;
  display: flex; align-items: stretch; gap: 2px;
}
.nav-list a {
  display: flex; align-items: center; gap: 6px; height: var(--hdr);
  padding-inline: 8px;
  font-size: 13.5px; line-height: 1.3; white-space: nowrap;
  color: var(--ink-2); text-decoration: none;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.nav-list a .num { font-size: 11px; color: var(--ink-2); }
.nav-list a:hover { color: var(--ink); }
.nav-list a[aria-current="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.nav-list a[aria-current="true"] .num { color: var(--accent); }
.nav-list a:focus-visible { outline-offset: -4px; }

.nav-toggle {
  display: none; align-items: center; gap: 8px;
  height: 40px; padding: 0 12px; max-width: 100%;
  font: inherit; font-size: 14px; color: var(--ink);
  background: transparent; border: 1px solid var(--rule); border-radius: 2px; cursor: pointer;
}
.nav-toggle svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; }
.nav-toggle-num { font-family: var(--f-mono); font-size: 12px; color: var(--accent); }
.nav-toggle-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tools { display: flex; gap: 6px; flex: none; }
.tool {
  position: relative;
  width: 40px; height: 40px; display: grid; place-items: center;
  background: transparent; color: var(--ink);
  border: 1px solid var(--rule); border-radius: 2px; cursor: pointer;
}
.tool:hover { border-color: var(--ink-2); }
.tool svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.tool[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }

/* theme icon: moon in light mode, sun in dark mode */
.ic-sun { display: none; }
:root[data-theme="dark"] .ic-sun { display: block; }
:root[data-theme="dark"] .ic-moon { display: none; }

/* language icon: globe + small glyph badge */
.tool-lang svg { width: 18px; height: 18px; transform: translate(-5px, -4px); }
.lang-glyph {
  position: absolute; bottom: 3px; inset-inline-end: 3px;
  font-family: var(--f-mono); font-size: 10px; font-weight: 600; line-height: 1;
  padding: 1px 2px; background: var(--sheet); color: var(--ink);
}
html[lang="en"] .lang-glyph { font-family: var(--f-head); font-size: 12px; }
html[dir="ltr"] .tool-lang svg { transform: translate(-5px, -4px); }

/* Collapse nav into a dropdown below this width */
/* Dropdown nav: main.js adds .is-compact whenever the links don't fit on one line (any language);
   below 900px it is always compact. */
.nav.is-compact { justify-content: flex-start; }
.nav.is-compact .nav-toggle { display: inline-flex; }
.nav.is-compact .nav-list {
  display: none;
  position: absolute; top: calc(100% + 12px); inset-inline-start: 0;
  flex-direction: column; gap: 0;
  min-width: min(320px, calc(100vw - 2 * var(--gutter)));
  background: var(--sheet); border: 1px solid var(--wall);
  padding: 6px 0;
}
.nav.is-compact.is-open .nav-list { display: flex; }
.nav.is-compact .nav-list a { height: auto; padding: 10px 16px; font-size: 15px; border-bottom: 0; border-inline-start: 2px solid transparent; margin: 0; }
.nav.is-compact .nav-list a[aria-current="true"] { border-inline-start-color: var(--accent); background: var(--paper); }
/* while measuring, keep the inline list laid out but invisible */
.nav.is-measuring .nav-list { visibility: hidden; }
@media (max-width: 520px) {
  :root { --hdr: 58px; }
  .topbar { gap: 10px; }
  .brand-name { font-size: 19px; }
  .tool { width: 36px; height: 36px; }
  .tools { gap: 4px; }
  .nav-toggle { padding: 0 9px; height: 36px; }
  .nav-toggle-label { display: none; }
}

/* ---------- Sections (generic) ---------- */
main { padding-top: var(--hdr); }
.sec {
  position: relative;
  min-height: calc(100vh - var(--hdr));
  min-height: calc(100svh - var(--hdr));
  padding: clamp(40px, 7vh, 88px) var(--gutter);
  border-bottom: 1px solid var(--rule);
}
.sec-inner { max-width: var(--maxw); margin: 0 auto; }
.sec-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 28px; }
.sec-head h2 { font-size: clamp(24px, 3.2vw, 38px); }

.plate {
  display: inline-block; flex: none;
  font-size: 12px; font-weight: 500; letter-spacing: .08em; line-height: 1;
  padding: 6px 9px; color: var(--ink);
  border: 1px solid var(--wall); background: var(--sheet);
}
.plate-row { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.plate-name { font-size: 13px; color: var(--ink-2); }

.sheet { background: var(--sheet); border: 1px solid var(--wall); position: relative; }
/* inner drawing margin line */
.sheet::before {
  content: ""; position: absolute; inset: 6px; border: 1px solid var(--rule); pointer-events: none;
}


/* ---------- SEC-01 · Hero ---------- */
.sec-hero {
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  padding-top: clamp(32px, 6vh, 72px); padding-bottom: clamp(32px, 6vh, 72px);
}
.hero-bg { position: absolute; inset: 0; pointer-events: none; }
.hero-fallback { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-fallback .fb-wall { fill: none; stroke: var(--ink-2); stroke-width: 1.5; }
.hero-fallback .fb-open { fill: none; stroke: var(--rule); stroke-width: 1; }
.hero-fallback .fb-ground { stroke: var(--wall); stroke-width: 2; }
.hero-fallback .fb-dim { fill: none; stroke: var(--ink-2); stroke-width: .75; stroke-dasharray: 4 3; }
.hero-fallback .fb-label { font-family: var(--f-mono); font-size: 13px; fill: var(--ink-2); text-anchor: middle; }
.hero-frame {
  position: absolute; inset: 0; width: 100%; height: 100%;
  border: 0; opacity: 0; transition: opacity .8s ease;
}
.hero-bg.is-live .hero-frame { opacity: var(--frame-opacity); }
.hero-bg.is-live .hero-fallback { opacity: 0; }

.hero-inner { position: relative; width: 100%; max-width: 980px; }
.hero-sheet { padding: clamp(24px, 4.5vw, 56px); }
.hero-title {
  margin-top: clamp(20px, 3vh, 32px);
  font-size: clamp(30px, 5.2vw, 60px);
  font-weight: 800; line-height: 1.35;
  text-wrap: balance;
}
/* "Why RASIN?" bulb button and its note */
.title-wrap { position: relative; }
.why-btn {
  display: inline-flex; align-items: center; gap: 8px; vertical-align: middle;
  margin-inline-start: .2em; padding: 0; line-height: 1;
  background: transparent; border: 0; cursor: pointer; color: var(--ink-2);
  --bulb: #F5C518;
}
.why-icon {
  display: grid; place-items: center; flex: none;
  width: .78em; height: .78em; min-width: 40px; min-height: 40px;
  border: 1px solid var(--rule); border-radius: 50%;
}
.why-btn:hover .why-icon, .why-btn[aria-expanded="true"] .why-icon { border-color: var(--bulb); }
.why-btn:hover .why-label, .why-btn[aria-expanded="true"] .why-label { color: var(--ink); }
.why-btn svg { width: 64%; height: 64%; overflow: visible; }
.why-label { font-family: var(--f-body); font-size: 14px; font-weight: 500; letter-spacing: 0; white-space: nowrap; }
.why-btn .glass { fill: var(--bulb); stroke: var(--ink); stroke-width: 1.4; stroke-linejoin: round; }
.why-btn .base { fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.why-btn .rays { fill: none; stroke: var(--bulb); stroke-width: 2; stroke-linecap: round; animation: why-glow 2.4s ease-in-out infinite; }
@keyframes why-glow { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
.why-pop {
  position: absolute; z-index: 5; top: calc(100% + 10px); left: 0;
  width: min(480px, 100%);
  padding: 18px 20px 20px;
  background: var(--sheet); border: 1px solid var(--wall); border-top: 4px solid #F5C518;
}
.why-q { font-family: var(--f-head); font-weight: 700; font-size: 15px; color: var(--ink-2); margin-bottom: 8px; }
.why-a { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-family: var(--f-head); font-weight: 700; font-size: clamp(18px, 2vw, 22px); line-height: 1.6; }
.why-name { color: var(--accent); }
.why-bar { width: 2px; align-self: stretch; background: #F5C518; }
.why-note { margin-top: 10px; font-size: 15px; line-height: 1.8; color: var(--ink-2); }

/* line-drawn lock beside the title, about the height of the letters */
.title-lock {
  display: inline-block; height: .95em; width: auto; aspect-ratio: 24 / 28;
  margin-inline-end: .22em; vertical-align: -.1em;
  fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
/* crown to the left of the course instructor's name in the title block */
.tb-instructor { display: flex; align-items: center; gap: 6px; }
html[dir="ltr"] .tb-instructor { flex-direction: row-reverse; justify-content: flex-end; }
.tb-instructor .crown {
  flex: none; height: 14px; width: auto; aspect-ratio: 24 / 16;
  fill: none; stroke: var(--z3s); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
}
html[lang="en"] .hero-title { line-height: 1.15; letter-spacing: -.01em; }
.hero-latin {
  margin-top: 8px;
  font-family: var(--f-mono); font-size: clamp(12px, 1.3vw, 14px); letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-2);
}
html[lang="en"] .hero-latin { display: none; }
.hero-tagline {
  margin-top: clamp(16px, 2.6vh, 24px);
  max-width: 44ch;
  font-size: clamp(17px, 1.9vw, 22px); line-height: 1.7;
  color: var(--ink);
  padding-inline-start: 14px; border-inline-start: 2px solid var(--accent);
}

.stats {
  margin: clamp(24px, 4vh, 40px) 0 0;
  display: grid; grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--wall); background: var(--sheet);
}
.hero-tagline + .titleblock { margin-top: clamp(24px, 4vh, 40px); }
.stat {
  display: flex; flex-direction: column; gap: 4px;
  padding: 14px 16px;
  border-inline-start: 1px solid var(--rule);
}
.stat:first-child { border-inline-start: 0; }
.stat dt { order: 2; font-size: 15px; color: var(--ink-2); }
.stat dd { order: 1; margin: 0; }
.stat-num { font-family: var(--f-mono); font-weight: 500; font-size: clamp(32px, 4.4vw, 52px); line-height: 1.05; color: var(--ink); }

.titleblock {
  margin: 18px 0 0;
  display: grid; grid-template-columns: 1fr 1.4fr;
  border: 1px solid var(--rule);
  font-size: 13.5px; line-height: 1.55;
}
.titleblock > div { padding: 8px 12px; border-top: 1px solid var(--rule); border-inline-start: 1px solid var(--rule); }
.titleblock > div:nth-child(-n+2) { border-top: 0; }
.titleblock > div:nth-child(odd) { border-inline-start: 0; }
.titleblock dt { font-family: var(--f-mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); }
html[lang="ar"] .titleblock dt { font-family: var(--f-body); font-size: 12px; letter-spacing: 0; }
.titleblock dd { margin: 0; color: var(--ink); }
.tb-term { color: var(--ink-2); margin-inline-start: .6em; padding-inline-start: .6em; border-inline-start: 1px solid var(--rule); white-space: nowrap; }
@media (max-width: 520px) { .tb-term { display: block; margin: 2px 0 0; padding: 0; border: 0; } }

@media (max-width: 720px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(3) { border-inline-start: 0; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--rule); }
  .titleblock { grid-template-columns: 1fr; }
  .titleblock > div { border-inline-start: 0 !important; }
  .titleblock > div:nth-child(2) { border-top: 1px solid var(--rule); }
}

/* ---------- Shared bits ---------- */
.label {
  font-family: var(--f-body); font-size: 13px; font-weight: 600; line-height: 1.4;
  color: var(--ink-2); margin: 0 0 8px;
}
html[lang="en"] .label { font-family: var(--f-mono); font-size: 11.5px; font-weight: 500; letter-spacing: .1em; text-transform: uppercase; }

/* ---------- SEC-03 · Selected organization ---------- */
.s2-grid {
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: clamp(28px, 5vw, 64px); align-items: start;
}
.s2-lead {
  font-family: var(--f-head); font-weight: 700;
  font-size: clamp(21px, 2.4vw, 30px); line-height: 1.6;
  text-wrap: balance;
}
html[lang="en"] .s2-lead { line-height: 1.35; }
.s2-why { margin-top: clamp(24px, 4vh, 36px); padding-top: 20px; border-top: 1px solid var(--rule); }
.s2-why p { font-size: 18px; }
.goal {
  margin: clamp(24px, 4vh, 36px) 0 0;
  padding: 16px 20px;
  background: var(--sheet); border: 1px solid var(--wall); border-inline-start: 4px solid var(--accent);
}
.goal .label { color: var(--accent); }
.goal-text { font-family: var(--f-head); font-weight: 700; font-size: clamp(18px, 2vw, 24px); line-height: 1.6; }

.building { margin: 0; padding: 22px 22px 0; }
.building-cap { position: relative; font-size: 14px; color: var(--ink-2); padding-bottom: 14px; }
.floors { list-style: none; margin: 0; padding: 0; position: relative; border: 2px solid var(--wall); border-bottom: 0; }
.floor {
  display: grid; grid-template-columns: auto 1fr; column-gap: 14px; row-gap: 2px; align-items: center;
  min-height: 108px; padding: 18px 18px;
  border-bottom: 1px solid var(--wall);
}
.floor + .floor { border-top: 0; }
.floor .plate { grid-row: span 2; align-self: center; }
.floor-name { font-size: 13px; color: var(--ink-2); line-height: 1.4; }
.floor-use { font-family: var(--f-head); font-weight: 700; font-size: clamp(17px, 1.7vw, 21px); line-height: 1.5; }
/* ground line with hatch marks (repeating hard-stop lines, not a colour gradient) */
.ground {
  position: relative; height: 18px; margin: 0 -22px;
  border-top: 2px solid var(--wall);
  background-image: repeating-linear-gradient(-45deg, var(--rule) 0 1px, transparent 1px 9px);
}

@media (max-width: 860px) {
  .s2-grid { grid-template-columns: 1fr; }
}

/* ---------- Shared: sub-titles, tick lists, schedule tables, CIA chips ---------- */
.sub-title {
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
  margin: clamp(40px, 7vh, 64px) 0 18px;
  font-size: clamp(20px, 2.2vw, 26px);
  padding-bottom: 10px; border-bottom: 1px solid var(--wall);
}
.sub-latin { font-size: 13px; font-weight: 400; color: var(--ink-2); letter-spacing: .06em; }

.ticks { list-style: none; margin: 0; padding: 0; }
.ticks li { position: relative; padding-inline-start: 20px; margin-top: 8px; font-size: 16px; line-height: 1.7; }
.ticks li::before {
  content: ""; position: absolute; inset-inline-start: 2px; top: .72em;
  width: 8px; height: 8px; border: 1.5px solid var(--tick, var(--ink-2));
}

.table-wrap { overflow-x: auto; border: 1px solid var(--wall); background: var(--sheet); }
.schedule { width: 100%; border-collapse: collapse; font-size: 16px; }
.schedule th, .schedule td { padding: 12px 16px; text-align: start; vertical-align: middle; border-top: 1px solid var(--rule); }
.schedule thead th {
  border-top: 0; border-bottom: 1px solid var(--wall);
  font-size: 13px; font-weight: 600; color: var(--ink-2); background: var(--paper);
}
html[lang="en"] .schedule thead th { font-family: var(--f-mono); font-weight: 500; font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; }
.schedule tbody th { font-weight: 600; white-space: nowrap; }
.schedule tbody th .plate { margin-inline-end: 6px; }

/* CIA colour is carried by borders / large glyphs; small text stays in --ink for contrast */
.cia-c { --cia: var(--cia-c); --cia-fill: var(--z2); }
.cia-i { --cia: var(--cia-i); --cia-fill: var(--z3); }
.cia-a { --cia: var(--cia-a); --cia-fill: var(--z1); }
.chip {
  display: inline-block; padding: 2px 10px; margin: 2px 0; font-size: 14.5px; line-height: 1.6;
  background: var(--cia-fill); color: var(--ink); border: 1px solid var(--cia);
}

/* ---------- SEC-04 · Plan & CIA ---------- */
.s3-idea {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: clamp(28px, 5vw, 64px); align-items: end;
}
.s3-thesis {
  font-family: var(--f-head); font-weight: 800;
  font-size: clamp(26px, 3.4vw, 42px); line-height: 1.45;
  text-wrap: balance;
}
html[lang="en"] .s3-thesis { line-height: 1.2; }
.s3-explain { margin-top: 14px; font-size: 18px; max-width: 46ch; }

.zones { margin: 0; }
/* Stepped strip: each zone a step higher — sensitivity rises inward/upward */
.zone-steps {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: end;
  border-bottom: 2px solid var(--wall);
}
.zone {
  display: flex; flex-direction: column; justify-content: flex-end; gap: 2px;
  padding: 10px 10px 12px;
  background: var(--zf); border: 1px solid var(--zs); border-bottom: 0;
  border-top-width: 3px;
}
.zone + .zone { border-inline-start: 0; }
.z0 { --zf: var(--z0); --zs: var(--z0s); height: 72px; }
.z1 { --zf: var(--z1); --zs: var(--z1s); height: 104px; }
.z2 { --zf: var(--z2); --zs: var(--z2s); height: 136px; }
.z3 { --zf: var(--z3); --zs: var(--z3s); height: 168px; }
.z4 { --zf: var(--z4); --zs: var(--z4s); height: 200px; }
.zone-code { font-family: var(--f-mono); font-weight: 600; font-size: 15px; color: var(--ink); }
.zone-name { font-size: 14px; line-height: 1.45; color: var(--ink); }
.zones-axis {
  display: flex; align-items: center; gap: 8px; justify-content: flex-end;
  margin-top: 8px; font-size: 13px; color: var(--ink-2);
}
.zones-axis svg { width: 40px; height: 10px; fill: none; stroke: currentColor; stroke-width: 1.2; }
html[dir="rtl"] .zones-axis svg { transform: scaleX(-1); }

.cia-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.cia-card {
  --tick: var(--cia);
  background: var(--sheet); border: 1px solid var(--wall); border-top: 4px solid var(--cia);
  padding: 20px 20px 22px;
}
.cia-card header { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.cia-letter {
  flex: none; width: 52px; height: 52px; display: grid; place-items: center;
  font-family: var(--f-mono); font-weight: 600; font-size: 30px; line-height: 1;
  color: var(--cia); border: 1.5px solid var(--cia); background: var(--cia-fill);
}
.cia-card h4 { margin: 0; font-family: var(--f-head); font-size: 21px; line-height: 1.4; display: flex; flex-direction: column; }
.cia-card h4 .mono { font-family: var(--f-mono); font-weight: 400; font-size: 12.5px; color: var(--ink-2); letter-spacing: .05em; }
.cia-def { font-size: 16px; padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px dashed var(--rule); }
.cia-card .label { margin-bottom: 0; }

/* Heading with its Latin twin underneath (Arabic only; .dup-en hides it in English) */
.h2-bi { display: flex; flex-direction: column; }
.h2-bi .sub-latin { margin-top: 2px; }

/* ---------- SEC-04 · Strategies & controls strip ---------- */
.strat-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px;
  margin: 18px 0 16px;
}
.strat-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.strat-filter .label { margin: 0 0 0 4px; }
.strat-fbtn {
  font: inherit; font-size: 14.5px; font-weight: 600; line-height: 1.5; cursor: pointer;
  padding: 4px 12px; color: var(--ink); background: var(--sheet); border: 1px solid var(--wall);
}
.strat-fbtn[aria-pressed="true"] { background: var(--wall); color: var(--sheet); }
.strat-fbtn.cia-c[aria-pressed="true"], .strat-fbtn.cia-i[aria-pressed="true"], .strat-fbtn.cia-a[aria-pressed="true"] {
  background: var(--cia-fill); color: var(--ink); border-color: var(--cia); box-shadow: inset 0 -3px 0 var(--cia);
}
.strats { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 980px) { .strats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .strats { grid-template-columns: 1fr; } }
.strat {
  display: flex; flex-direction: column; gap: 10px;
  padding: 18px 18px 16px; background: var(--sheet); border: 1px solid var(--wall); border-top: 3px solid var(--wall);
}
/* defense in depth: the starting point */
.strat-anchor { border-top: 4px solid var(--accent); }
.strat-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.strat-icon { width: 30px; height: 30px; flex: none; fill: none; stroke: var(--accent); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.strat-type { font-family: var(--f-mono); font-size: 12px; color: var(--ink-2); letter-spacing: .04em; }
html[lang="ar"] .strat-type { font-family: var(--f-body); font-size: 13px; }
.strat h4 { margin: 0; font-family: var(--f-head); font-size: 19px; line-height: 1.45; display: flex; flex-direction: column; }
.strat h4 .mono { font-weight: 400; font-size: 12.5px; color: var(--ink-2); letter-spacing: .04em; }
.strat-p { font-size: 15.5px; line-height: 1.7; }
.strat-a { font-size: 15px; line-height: 1.7; color: var(--ink-2); padding-top: 10px; border-top: 1px dashed var(--rule); }
.strat-a .label { display: block; margin-bottom: 2px; color: var(--accent); }
.strat-more { display: inline-block; margin-top: 4px; font-size: 14px; font-weight: 600; color: var(--accent); text-underline-offset: 3px; }
.strat-more::after { content: " ←"; }
html[dir="ltr"] .strat-more::after { content: " →"; }
.strat-cia { display: flex; gap: 6px; margin-top: auto; padding-top: 4px; }
.cia-tag {
  width: 26px; height: 26px; display: grid; place-items: center;
  font-family: var(--f-mono); font-size: 13px; font-weight: 600;
  color: var(--cia); background: var(--cia-fill); border: 1px solid var(--cia);
}
/* CIA filter: cards that do not support the chosen goal step back */
.strats[data-filter="c"] .strat:not([data-cia~="c"]),
.strats[data-filter="i"] .strat:not([data-cia~="i"]),
.strats[data-filter="a"] .strat:not([data-cia~="a"]) { opacity: .3; }

@media (max-width: 980px) {
  .s3-idea { grid-template-columns: 1fr; }
  .cia-cards { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .zone { padding: 8px 6px 10px; }
  .zone-name { font-size: 12px; }
  .z0 { height: 64px; } .z1 { height: 88px; } .z2 { height: 112px; } .z3 { height: 136px; } .z4 { height: 160px; }
  .schedule th, .schedule td { padding: 10px 12px; font-size: 15px; }
  .schedule tbody th { white-space: normal; }
}

/* ---------- SEC-05 · Security design ---------- */
.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;
}

.el-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.el-card {
  display: flex; flex-direction: column;
  background: var(--sheet); border: 1px solid var(--wall);
}
.el-head {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--wall);
}
.el-num { font-size: 13px; color: var(--ink-2); }
.el-head h3 { flex: 1; font-size: 20px; line-height: 1.4; }

.el-body { margin: 0; padding: 4px 18px 16px; flex: 1; }
.el-body > div { padding-top: 12px; }
.el-body > div + div { margin-top: 12px; border-top: 1px dashed var(--rule); }
.el-body dt { font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 2px; }
html[lang="en"] .el-body dt { font-family: var(--f-mono); font-weight: 500; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }
.el-body dd { margin: 0; font-size: 15.5px; line-height: 1.75; }
.el-body .ticks li { font-size: 15.5px; margin-top: 4px; }

.el-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px 18px; border-top: 1px solid var(--wall); background: var(--paper);
}
/* Function strip: all four shown, the element's own functions filled */
.fn { list-style: none; margin: 0; padding: 0; display: flex; }
.fn li {
  font-size: 13px; line-height: 1.6;
  color: var(--ink-2); border: 1px dashed var(--rule);
}
.fn-btn {
  display: block; padding: 3px 9px; font: inherit; color: inherit; background: none; border: 0; cursor: pointer;
  text-decoration: underline dotted; text-underline-offset: 3px;
}
.fn-btn:hover, .fn-btn[aria-expanded="true"] { text-decoration-style: solid; }
/* Short note on a function word; main.js moves it into the pressed card's footer */
.el-foot { position: relative; }
.fn-pop {
  position: absolute; z-index: 5; bottom: calc(100% + 8px); inset-inline: 12px;
  padding: 12px 14px; background: var(--sheet); border: 1px solid var(--wall); border-top: 4px solid var(--accent);
}
.fn-pop-t { font-family: var(--f-head); font-weight: 700; font-size: 16px; color: var(--accent); margin-bottom: 4px; }
.fn-pop-d { font-size: 14.5px; line-height: 1.7; color: var(--ink); }
.fn-pop-off { margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--rule); font-size: 13px; color: var(--ink-2); }
.fn li + li { border-inline-start: 0; }
.fn li.on { color: var(--sheet); background: var(--accent); border: 1px solid var(--accent); }
.fn li.on + li { border-inline-start: 0; }
:root[data-theme="dark"] .fn li.on { color: var(--paper); }

.cia-mini { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; }
.cia-mini li {
  width: 28px; height: 28px; display: grid; place-items: center;
  font-family: var(--f-mono); font-weight: 600; font-size: 15px;
  color: var(--ink); background: var(--cia-fill); border: 1.5px solid var(--cia);
}

@media (max-width: 1100px) { .el-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 680px)  { .el-cards { grid-template-columns: 1fr; } }

/* ---------- SEC-06 · Standards ---------- */
.std + .std { margin-top: clamp(28px, 5vh, 44px); }
.std-head {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 14px 18px; background: var(--wall); color: var(--paper);
}
.std-code {
  flex: none; font-size: 15px; font-weight: 600; letter-spacing: .02em;
  padding: 6px 10px; border: 1px solid currentColor; direction: ltr; unicode-bidi: isolate;
}
.std-head h3 { font-size: 19px; line-height: 1.4; color: var(--paper); }
.std-head p { font-size: 14px; color: var(--paper); opacity: .85; }
.std .table-wrap { border-top: 0; }
.std-table tbody th { white-space: normal; width: 44%; font-weight: 500; }
.std-table .ctl {
  display: inline-block; min-width: 4.4em; margin-right: 12px;
  font-family: var(--f-mono); font-weight: 600; font-size: 14px; color: var(--accent);
  direction: ltr; unicode-bidi: isolate;
}
.std-table td { font-size: 15.5px; line-height: 1.7; }
/* .ctl is direction:ltr, so logical margins would land on the wrong side in RTL — use physical ones */
html[dir="rtl"] .std-table .ctl { margin-right: 0; margin-left: 12px; text-align: right; }

@media (max-width: 680px) {
  .std-table thead { display: none; }
  .std-table tr { display: block; border-top: 1px solid var(--rule); }
  .std-table tbody th, .std-table td { display: block; width: auto; border-top: 0; }
  .std-table tbody th { padding-bottom: 2px; }
  .std-table td { padding-top: 0; }
}

/* ---------- SEC-07 · Interactive tours ---------- */
.sec-wide .sec-inner { max-width: 1520px; }
.tours { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.tour {
  display: grid; grid-template-columns: 1fr auto; grid-template-areas: "plate steps" "title title" "note note";
  align-items: center; row-gap: 10px;
  padding: 16px 18px; background: var(--sheet); border: 1px solid var(--wall);
}
.tour .plate { grid-area: plate; justify-self: start; }
.tour h3 { grid-area: title; font-size: clamp(19px, 1.8vw, 22px); line-height: 1.45; }
.tour-steps { grid-area: steps; display: flex; align-items: baseline; gap: 6px; color: var(--ink-2); font-size: 14px; }
.tour-steps .mono { font-size: 30px; font-weight: 500; line-height: 1; color: var(--ink); }
.tour-note {
  grid-area: note; font-size: 14.5px; line-height: 1.6;
  padding-top: 10px; border-top: 1px dashed var(--rule);
}
.tour-note .mono { display: block; font-size: 12px; color: var(--ink-2); letter-spacing: .05em; }
.tour-howto {
  display: flex; align-items: center; gap: 8px; margin-top: 18px;
  font-size: 16px; font-weight: 600; color: var(--ink);
}
.tour-howto svg { width: 20px; height: 20px; flex: none; fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; }
/* "As large as possible": taller than the standard embed */
.embed-xl { margin-top: 12px; }
.embed-xl .embed-frame { height: min(calc(100vh - var(--hdr) - 48px), 980px); min-height: 520px; }

@media (max-width: 860px) { .tours { grid-template-columns: 1fr; } }

/* ---------- SEC-08 · Closing messages ---------- */
.takeaways { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.takeaways li {
  padding: 22px 22px 26px; background: var(--sheet); border: 1px solid var(--wall); border-top: 4px solid var(--accent);
}
.takeaways .mono { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 12px; }
.takeaways p { font-family: var(--f-head); font-weight: 700; font-size: clamp(20px, 2.1vw, 26px); line-height: 1.5; text-wrap: balance; }
html[lang="en"] .takeaways p { line-height: 1.3; }
.takeaways p.takeaway-sub {
  margin-top: 12px;
  font-family: var(--f-body); font-weight: 400; font-size: 16px; line-height: 1.75;
  color: var(--ink-2); text-wrap: pretty;
}
@media (max-width: 860px) { .takeaways { grid-template-columns: 1fr; } }

/* "لا تفتح مجال" awareness block — warning colour is the Z4 (restricted) stroke */
.nogap {
  --warn: var(--z4s);
  margin-top: 40px; padding: clamp(22px, 4vw, 44px);
  background: var(--sheet); border: 1px solid var(--wall); border-inline-start: 6px solid var(--warn);
}
.nogap-title {
  display: flex; align-items: flex-start; gap: 16px;
  font-size: clamp(28px, 4.4vw, 52px); line-height: 1.35; text-wrap: balance;
}
.nogap-icon {
  width: 1.1em; height: 1.1em; flex: none; margin-top: .12em;
  fill: none; stroke: var(--warn); stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round;
}
.nogap-bar { color: var(--warn); font-weight: 400; margin-inline: .35em; }
.nogap-sub { color: var(--ink-2); }
.nogap-lead { margin-top: 18px; max-width: 60ch; font-size: clamp(18px, 1.8vw, 21px); font-weight: 500; text-wrap: pretty; }

.nogap-steps { list-style: none; margin: 28px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.nogap-steps li { padding: 18px 18px 20px; border: 1px dashed var(--wall); border-top: 3px solid var(--warn); }
.nogap-steps .mono { display: block; font-size: 12.5px; color: var(--ink-2); margin-bottom: 8px; }
.nogap-steps h4 { margin: 0 0 6px; font-family: var(--f-head); font-size: 20px; line-height: 1.4; }
.nogap-steps p { font-size: 16px; color: var(--ink-2); text-wrap: pretty; }

.nogap-risk { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--rule); }
.nogap-formula {
  display: inline-block; margin-bottom: 12px; padding: 6px 14px;
  font-family: var(--f-head); font-weight: 700; font-size: clamp(18px, 2vw, 22px);
  border: 1px solid var(--wall); background: var(--paper);
}
.nogap-risk > p:not(.nogap-formula) { max-width: 72ch; font-size: 17px; text-wrap: pretty; }
.nogap-cia { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.nogap-cia li { padding: 2px 12px; font-size: 15px; font-weight: 600; background: var(--cia-fill); color: var(--ink); border: 1px solid var(--cia); }

.nogap-quote {
  margin: 32px 0 0; padding: 22px 24px;
  background: var(--wall); color: var(--sheet);
}
.nogap-quote p { font-family: var(--f-head); font-weight: 700; font-size: clamp(20px, 2.6vw, 30px); line-height: 1.6; text-wrap: balance; }
.nogap-note { margin-top: 16px; font-size: 13.5px; color: var(--ink-2); }
@media (max-width: 860px) { .nogap-steps { grid-template-columns: 1fr; } }

.nogap-plate { margin-bottom: 18px; color: var(--warn); border-color: var(--warn); }
.nogap-icon-in { stroke-width: 3; }
/* the campaign phrase is the focal point: warn colour on a Z4 fill band */
.nogap-key { color: var(--warn); background: linear-gradient(transparent 62%, var(--z4) 62%); padding-inline: .08em; }
mark.kw {
  color: inherit; font-weight: 700; padding: 0 .2em; white-space: nowrap;
  background: var(--z4); box-shadow: inset 0 -2px 0 var(--warn);
}
.nogap-steps li:hover { border-color: var(--warn); }

/* Booklet button — opens the NCA PDF in a new tab */
.nogap-cta { margin-top: 28px; }
.nogap-btn {
  display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 10px 20px;
  font-family: var(--f-head); font-weight: 700; font-size: 17px; text-decoration: none;
  color: var(--sheet); background: var(--warn); border: 1px solid var(--warn);
  transition: background-color .2s ease, color .2s ease, transform .2s ease;
}
.nogap-btn svg { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.nogap-btn .nogap-btn-ext { width: 16px; height: 16px; transition: transform .2s ease; }
html[dir="rtl"] .nogap-btn .nogap-btn-ext { transform: scaleX(-1); }
.nogap-btn:hover { background: var(--sheet); color: var(--warn); transform: translateY(-2px); }
.nogap-btn:hover .nogap-btn-ext { transform: translate(2px, -2px); }
html[dir="rtl"] .nogap-btn:hover .nogap-btn-ext { transform: scaleX(-1) translate(2px, -2px); }
.nogap-btn-note { margin-top: 8px; font-size: 13.5px; color: var(--ink-2); }
.nogap-btn-note .mono { font-size: 11.5px; padding: 1px 6px; border: 1px solid var(--rule); margin-inline-start: 4px; }
@media (max-width: 520px) { .nogap-btn { display: flex; justify-content: center; } .nogap-title { gap: 10px; } }

/* after the box rises in (see "Reveal" below), the shield pulses once */
.nogap.rv.in-view .nogap-icon { animation: nogap-pulse 1.2s ease .5s 1; }
@keyframes nogap-pulse { 0%, 100% { transform: scale(1); } 40% { transform: scale(1.12); } }

/* ---------- SEC-06 · Intruder challenge (collapsed until opened) ---------- */
.chal { margin-bottom: 20px; background: var(--sheet); border: 1px solid var(--wall); border-inline-start: 4px solid var(--z4s); }
.chal-open {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 18px;
  font: inherit; color: inherit; text-align: start; background: none; border: 0; cursor: pointer;
}
.chal-ic { width: 30px; height: 30px; --ic: var(--z4s); margin: 0; }
.chal-text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.chal-badge { font-size: 12.5px; font-weight: 600; color: var(--z4s); }
.chal-title { font-family: var(--f-head); font-weight: 700; font-size: clamp(18px, 2vw, 22px); line-height: 1.5; color: var(--accent); }
.chal-lead { font-size: 14.5px; color: var(--ink-2); }
.chal-cta {
  flex: none; padding: 7px 14px; font-weight: 700; font-size: 14.5px;
  color: var(--sheet); background: var(--z4s); border: 1px solid var(--z4s);
}
.chal-open:hover .chal-cta, .chal-open[aria-expanded="true"] .chal-cta { color: var(--z4s); background: var(--sheet); }
.chal-body { padding: 4px 18px 18px; border-top: 1px dashed var(--rule); }
.chal-steps { list-style: none; margin: 14px 0 10px; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.chal-steps li { height: 6px; background: var(--rule); }
.chal-steps li.done, .chal-steps li.now { background: var(--zc); }
.chal-steps li.now { outline: 2px solid var(--zc); outline-offset: 1px; }
.cz0 { --zc: var(--z0s); } .cz1 { --zc: var(--z1s); } .cz2 { --zc: var(--z2s); } .cz3 { --zc: var(--z3s); } .cz4 { --zc: var(--z4s); }
.chal-layer { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.chal-z { display: inline-block; padding: 0 6px; font-family: var(--f-mono); font-size: 12px; color: var(--ink); border: 1px solid var(--zc); background: color-mix(in srgb, var(--zc) 18%, transparent); }
.chal-q { margin: 6px 0 12px; font-family: var(--f-head); font-size: 19px; line-height: 1.5; }
.chal-q:focus, .chal-res-t:focus { outline: none; }
.chal-opts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.chal-opt {
  padding: 10px 12px; font: inherit; font-size: 15px; font-weight: 600; text-align: start; line-height: 1.5;
  color: var(--ink); background: var(--paper); border: 1px solid var(--wall); cursor: pointer;
}
.chal-opt:hover:not(:disabled) { border-color: var(--z4s); color: var(--z4s); }
.chal-opt:disabled { cursor: default; opacity: .45; }
.chal-opt.is-chosen { opacity: 1; border: 2px solid var(--z4s); color: var(--z4s); }
.chal-res { margin-top: 12px; padding: 12px 14px; background: color-mix(in srgb, var(--z4) 35%, var(--sheet)); border: 1px solid var(--z4s); }
.chal-res-t { font-family: var(--f-head); font-weight: 700; font-size: 16.5px; color: var(--ink); }
.chal-stop { color: var(--z4s); }
.chal-res-w { margin-top: 4px; font-size: 15px; line-height: 1.7; }
.chal-type { display: inline-block; margin-top: 8px; padding: 1px 8px; font-size: 12.5px; font-weight: 600; color: var(--accent); border: 1px solid var(--accent); }
.chal-btn {
  margin-top: 12px; padding: 8px 14px; font: inherit; font-size: 14.5px; font-weight: 700; cursor: pointer;
  color: var(--sheet); background: var(--accent); border: 1px solid var(--accent);
}
.chal-btn:hover { color: var(--accent); background: var(--sheet); }
.chal-btn-ghost { color: var(--accent); background: transparent; }
.chal-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.chal-end-text { font-size: 15.5px; line-height: 1.8; max-width: 80ch; margin-bottom: 12px; }
.chal-log { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 6px; }
.chal-log li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 15px; }
.chal-log .chal-type { margin-top: 0; }
@media (max-width: 760px) {
  .chal-opts { grid-template-columns: 1fr; }
  .chal-open { flex-wrap: wrap; }
  .chal-cta { width: 100%; text-align: center; }
}

/* ---------- Glossary terms (marked by main.js) ---------- */
.term {
  color: var(--accent); font-weight: 600;
  text-decoration: underline dotted; text-decoration-color: var(--gold); text-decoration-thickness: 2px; text-underline-offset: 5px;
  cursor: help;
}
.term:hover, .term:focus-visible { text-decoration-style: solid; }
/* inside dark table heads and coloured labels keep the surrounding colour */
.std-head .term, .label .term { color: inherit; }
.term-pop {
  position: fixed; z-index: 80; max-width: min(300px, calc(100vw - 16px));
  padding: 10px 12px; background: var(--sheet); border: 1px solid var(--wall); border-top: 3px solid var(--accent);
  pointer-events: none;
}
.term-pop-t { font-family: var(--f-head); font-weight: 700; font-size: 14.5px; color: var(--accent); margin-bottom: 2px; }
.term-pop-d { font-size: 14px; line-height: 1.65; color: var(--ink); }

/* ---------- SEC-10 · References ---------- */
.refs-table th[scope="row"] { white-space: normal; font-weight: 600; }
.refs-table td.ref-num { width: 40px; color: var(--gold); font-weight: 600; }
.refs-table td.ref-year { white-space: nowrap; font-variant-numeric: tabular-nums; }
.refs-table td.ref-link-cell { white-space: nowrap; }
.ref-open { font-weight: 600; color: var(--accent); text-underline-offset: 3px; }
.refs-note { margin-top: 14px; font-size: 14px; color: var(--ink-2); }

/* ---------- SEC-09 · National note (own green palette, this section only) ---------- */
.sec-national {
  --g-bg:#0E3B26; --g-ink:#F2F5F1; --g-acc:#4FBF85; --g-red:#EF4444;
  position: relative; overflow: hidden;
  display: flex; align-items: center;
  background: var(--g-bg); color: var(--g-ink);
  border-bottom: 0;
}
:root[data-theme="dark"] .sec-national { --g-bg:#0B2A1C; --g-ink:#E6EEE8; --g-acc:#6FD39C; }

/* faint red outline of the Kingdom ("the borders are a red line"); centred behind the text on phones */
.nat-map {
  position: absolute; top: 50%; inset-inline-end: 4%; width: min(44vw, 600px); height: auto; translate: 0 -50%;
  pointer-events: none; fill: none; stroke: var(--g-red); stroke-width: 1.6; stroke-linejoin: round; opacity: .7;
}
.nat-map path { vector-effect: non-scaling-stroke; }
@media (max-width: 760px) { .nat-map { inset-inline-end: auto; left: 50%; translate: -50% -50%; width: 92vw; opacity: .36; } }

.nat-inner { position: relative; width: 100%; }
.sec-national .plate { background: transparent; color: var(--g-ink); border-color: var(--g-acc); }
.sec-national .plate-name { color: var(--g-ink); opacity: .85; }
.sec-national :focus-visible { outline-color: var(--g-acc); }

.nat-title {
  margin-top: clamp(24px, 5vh, 48px);
  font-family: var(--f-head); font-weight: 800;
  font-size: clamp(38px, 7.4vw, 96px); line-height: 1.35;
  color: var(--g-ink);
  display: flex; flex-wrap: wrap; column-gap: .3em; align-items: baseline;
}
html[lang="en"] .nat-title { line-height: 1.12; }
.redline { position: relative; color: var(--g-red); white-space: nowrap; }
/* thin red rule under "خط أحمر" — drawn in from the reading start when the section enters view */
.redline::after {
  content: ""; position: absolute; inset-inline: 0; bottom: .04em; height: 3px;
  background: var(--g-red);
  transform-origin: right center;
  transition: transform 1.6s cubic-bezier(.25, .6, .3, 1) .2s;
}
html[dir="ltr"] .redline::after { transform-origin: left center; }
html.js .sec-national:not(.in-view) .redline::after { transform: scaleX(0); }

.nat-quote {
  margin: clamp(28px, 5vh, 48px) 0 0; max-width: 860px;
  padding: 22px 26px; border: 1px solid var(--g-acc);
}
.nat-quote figcaption {
  font-size: 14px; font-weight: 600; color: var(--g-acc); margin-bottom: 10px;
}
.nat-quote blockquote { margin: 0; }
.nat-quote blockquote p {
  font-family: var(--f-head); font-weight: 500;
  font-size: clamp(19px, 2.1vw, 26px); line-height: 1.8;
}
.nat-link { margin-top: 22px; max-width: 860px; font-size: clamp(14.5px, 1.2vw, 16.5px); line-height: 1.85; }

/* ---------- SEC-02 · Project team ---------- */
.team { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.team li {
  display: grid; grid-template-columns: 24px minmax(0, 1fr); align-items: center; gap: 4px 12px;
  padding: 16px 18px; background: var(--sheet); border: 1px solid var(--wall); border-top: 4px solid var(--accent);
}
.team .cap { grid-row: span 2; width: 24px; height: 24px; fill: none; stroke: var(--accent); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.team .member { font-family: var(--f-head); font-size: 17px; font-weight: 700; line-height: 1.5; color: var(--accent); }
.team .sid { justify-self: start; font-family: var(--f-mono); font-size: 13.5px; letter-spacing: .04em; color: var(--ink-2); direction: ltr; unicode-bidi: isolate; }
@media (max-width: 980px) { .team { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .team { grid-template-columns: 1fr; } }

/* ---------- Embeds (shared by sections 3, 4, 6) ---------- */
.embed { margin-top: 28px; }
.embed-note {
  display: none; margin-bottom: 8px;
  font-family: var(--f-mono); font-size: 12px; color: var(--ink-2);
}
html[lang="en"] .embed-note { display: block; }
.embed-frame {
  display: block; width: 100%; height: min(80vh, 760px);
  border: 1px solid var(--wall); background: var(--sheet);
}
.embed-open {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 10px;
  padding: 8px 14px; font-size: 14px; text-decoration: none;
  color: var(--ink); border: 1px solid var(--wall); background: var(--sheet);
}
.embed-open svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; }
html[dir="rtl"] .embed-open svg { transform: scaleX(-1); }

/* ---------- Presentation mode ---------- */
.progress {
  position: fixed; bottom: 14px; left: 50%; z-index: 60;
  transform: translateX(-50%);
  display: none; align-items: center; gap: 12px;
  padding: 7px 12px;
  background: var(--sheet); border: 1px solid var(--wall);
  font-family: var(--f-mono); font-size: 13px; color: var(--ink);
}
html.is-presenting .progress { display: flex; }
.progress-ticks { display: flex; gap: 3px; }
.progress-ticks i { display: block; width: 14px; height: 3px; background: var(--rule); }
.progress-ticks i.on { background: var(--accent); }
.progress-text { direction: ltr; unicode-bidi: isolate; }

html.is-presenting .sec { scroll-margin-top: var(--hdr); }

.toast {
  position: fixed; top: calc(var(--hdr) + 12px); inset-inline-end: var(--gutter); z-index: 70;
  max-width: min(360px, calc(100vw - 2 * var(--gutter)));
  padding: 10px 14px; font-size: 14px;
  background: var(--sheet); color: var(--ink); border: 1px solid var(--wall); border-inline-start: 3px solid var(--accent);
  opacity: 0; visibility: hidden; transition: opacity .2s ease, visibility .2s;
}
.toast.show { opacity: 1; visibility: visible; }

/* ---------- Reveal & hover for the SEC-08 phrase boxes ----------
   main.js adds .rv (only when motion is allowed) and .in-view once the box is on screen.
   Reveal moves `translate`, hover moves `transform`, so the two never fight over one property. */
.rv {
  transition:
    opacity .6s ease calc(var(--rv-i, 0) * 90ms),
    translate .6s cubic-bezier(.25, .6, .3, 1) calc(var(--rv-i, 0) * 90ms),
    transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}
.rv:not(.in-view) { opacity: 0; translate: 0 18px; }
@media (hover: hover) {
  /* hard-edged drafting shadow, no blur */
  .takeaways li:hover, .nogap-steps li:hover {
    transform: translateY(-3px); box-shadow: 0 4px 0 var(--rule);
  }
}

/* ---------- NCA-based sections (SEC-07 standards, SEC-08 awareness) ----------
   Teal / navy inspired by the NCA identity — colour only, no logo. */
.sec-nca { --nca: #0B7A73; --nca-deep: #0F3D52; --nca-fill: #DDEFEC; }
:root[data-theme="dark"] .sec-nca { --nca: #5CCFC3; --nca-deep: #8FD9D0; --nca-fill: #133A38; }
.sec-nca .sec-head h2 { box-shadow: inset 0 -3px 0 var(--nca); padding-bottom: 2px; }
.nca-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 12px 5px 10px; font-size: 14px; font-weight: 600; line-height: 1.5;
  color: var(--ink); background: var(--nca-fill); border: 1px solid var(--nca);
}
.nca-badge svg { width: 20px; height: 20px; flex: none; fill: none; stroke: var(--nca); stroke-width: 1.7; stroke-linejoin: round; stroke-linecap: round; }
.std-nca .std-head { background: var(--nca-deep); }

/* ---------- Heading icons & colour accents ---------- */
.ic {
  display: inline-block; flex: none; width: 1.05em; height: 1.05em;
  margin-inline-end: .4em; vertical-align: -.16em;
  fill: none; stroke: var(--ic, var(--accent)); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}
.hero-title, .sec-head h2, .sub-title, .el-head h3, .tour h3, .strat h4, .team .member { color: var(--head); }
.s2-why .label, .zones .label { color: var(--accent); }
.sec-head .plate { color: var(--gold); border-color: var(--gold); }
.stat-num, .tour-steps .mono, .el-num { color: var(--gold); }
.cia-card { --ic: var(--cia); }
.cia-card .label, .cia-card h4 span:not(.mono) { color: var(--cia); }
.std-head { --ic: currentColor; }
.sec-nca { --ic: var(--nca); }
.sec-nca .sec-head h2, .takeaways li > p:not(.takeaway-sub) { color: var(--nca); }
.nogap { --ic: var(--warn); }
.nogap-steps h4 { color: var(--warn); }
.sec-national { --ic: var(--g-acc); }

/* ---------- Beyond RASIN: cover link (pulsing hub) + closing hub ---------- */
.beyond-link {
  display: inline-flex; align-items: center; gap: 10px; margin-top: 18px;
  font-size: 15px; font-weight: 600; color: var(--accent); text-decoration: none;
}
.beyond-arrow { display: inline-block; transition: translate .2s ease; }
html[lang="en"] .beyond-arrow { scale: -1 1; }
.beyond-link:hover .beyond-arrow, .beyond-link:focus-visible .beyond-arrow { translate: -4px 0; }
html[lang="en"] .beyond-link:hover .beyond-arrow, html[lang="en"] .beyond-link:focus-visible .beyond-arrow { translate: 4px 0; }
.beyond-link:hover span[data-i18n] { text-decoration: underline; text-underline-offset: 5px; text-decoration-color: var(--gold); }
.hub { width: 38px; height: 38px; flex: none; fill: none; stroke: var(--accent); stroke-linecap: round; overflow: visible; }
.hub-spokes { stroke-width: 1.2; opacity: .35; }
/* a short gold dash runs from the centre to each node, then the nodes light up */
.hub-pulse { stroke: var(--gold); stroke-width: 2.2; stroke-dasharray: 5 20; stroke-dashoffset: 5; animation: hub-pulse 3.6s ease-in-out infinite; }
.hub-dot { fill: var(--sheet); stroke-width: 1.4; animation: hub-dot 3.6s ease-in-out infinite; }
.hub-core { fill: var(--accent); stroke: none; transform-box: fill-box; transform-origin: center; animation: hub-core 3.6s ease-in-out infinite; }
@keyframes hub-pulse { 0%, 8% { stroke-dashoffset: 5; } 45%, 100% { stroke-dashoffset: -20; } }
@keyframes hub-dot { 0%, 36%, 75%, 100% { fill: var(--sheet); stroke: var(--accent); } 48% { fill: var(--gold); stroke: var(--gold); } }
@keyframes hub-core { 0%, 20%, 100% { scale: 1; } 8% { scale: 1.22; } }

.bx-lead { max-width: 62ch; font-size: clamp(17px, 1.8vw, 21px); line-height: 1.85; color: var(--ink); }
.bx-map { position: relative; max-width: 820px; aspect-ratio: 820 / 400; margin: clamp(28px, 5vh, 52px) auto; }
.bx-lines { position: absolute; inset: 0; width: 100%; height: 100%; fill: none; stroke: var(--accent); stroke-width: 1.5; opacity: .5; }
.bx-lines path { stroke-dasharray: 1; stroke-dashoffset: 0; transition: stroke-dashoffset .9s ease-out calc(var(--i) * .1s); }
.bx-core, .bx-node { position: absolute; translate: -50% -50%; margin: 0; text-align: center; }
.bx-core {
  left: 50%; top: 50%; padding: 16px 26px; border-radius: 999px;
  background: var(--accent); color: var(--sheet); font-size: clamp(16px, 1.7vw, 19px); font-weight: 700; white-space: nowrap;
  box-shadow: 0 0 0 5px var(--paper), 0 0 0 6px var(--gold);
}
.bx-nodes { list-style: none; margin: 0; padding: 0; }
.bx-node {
  padding: 9px 18px; border-radius: 999px; white-space: nowrap;
  background: var(--sheet); border: 1px solid var(--rule); color: var(--head); font-size: 15px; font-weight: 600;
  transition: opacity .5s ease calc(.6s + var(--i) * .1s);
}
/* first three sit on the reading-start side: right in Arabic, left in English */
.bx-a1, .bx-a2, .bx-a3 { left: 85.4%; }
.bx-b1, .bx-b2, .bx-b3 { left: 14.6%; }
html[lang="en"] .bx-a1, html[lang="en"] .bx-a2, html[lang="en"] .bx-a3 { left: 14.6%; }
html[lang="en"] .bx-b1, html[lang="en"] .bx-b2, html[lang="en"] .bx-b3 { left: 85.4%; }
.bx-a1, .bx-b1 { top: 15%; } .bx-a2, .bx-b2 { top: 50%; } .bx-a3, .bx-b3 { top: 85%; }
.bx-map.bx-ready .bx-lines path { stroke-dashoffset: 1; }
.bx-map.bx-ready .bx-node { opacity: 0; }
.bx-map.bx-ready.in-view .bx-lines path { stroke-dashoffset: 0; }
.bx-map.bx-ready.in-view .bx-node { opacity: 1; }
.bx-close {
  max-width: 50ch; margin: 0 auto; text-align: center;
  font-size: clamp(18px, 2vw, 23px); line-height: 1.8; font-weight: 600; color: var(--head);
}
.bx-close::before { content: ""; display: block; width: 48px; height: 2px; margin: 0 auto 18px; background: var(--gold); }
@media (max-width: 680px) {
  .bx-map { aspect-ratio: auto; display: flex; flex-direction: column; align-items: center; gap: 14px; }
  .bx-lines { display: none; }
  .bx-core, .bx-node { position: static; translate: none; }
  .bx-nodes { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
  .bx-node { font-size: 14px; padding: 8px 14px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0s !important; animation-duration: 0s !important; animation-iteration-count: 1 !important; }
}

/* Latin subtitles that would just repeat the heading in English */
html[lang="en"] .dup-en { display: none; }
@media (max-width: 520px) {
  .z0 { height: 76px; } .z1 { height: 96px; } .z2 { height: 118px; } .z3 { height: 140px; } .z4 { height: 162px; }
}
