/*
 * Maqraa landing (v7): ALL colour, size, space, radius, font and motion values live in this one file.
 * Nothing else in the css folder holds a raw colour, a raw size or a font declaration (RULES.md, T1).
 * The structure (names, slots, ladder, bar and footer numbers) is the shared house layout of the project's pages.
 * The colour VALUES are Maqraa's own, from work\static\css\maqraa.css (the institute keeps its colours).
 *
 * How the theme works for an engineer:
 *  - The page starts light.
 *  - If the visitor's device prefers dark and has made no choice, the dark values apply.
 *  - The theme button writes data-theme="light" or "dark" on <html>; that choice wins over the device.
 */

/* ---- Fonts: the only place a font is declared (local files, no outside service) ----
 * Fonts chosen by Claude, to confirm with Esslam (his words 19 Nov 2026 name the four faces; the weights below are Claude's).
 * Display and serif: Crimson Pro. UI and body: Instrument Sans. Arabic Quran text: Scheherazade New. Arabic UI and body: Noto Naskh Arabic.
 * Regular files cover weights 400 to 500, Bold files 600 to 700, so the browser never fakes a weight.
 * Only 400 and 600 are used on the page. No italics are used, so the italic file is not declared. */
@font-face { font-family: 'Crimson Pro'; src: url('../fonts/v7/CrimsonPro-Regular.woff2') format('woff2'); font-weight: 400 500; font-style: normal; font-display: swap; }
@font-face { font-family: 'Crimson Pro'; src: url('../fonts/v7/CrimsonPro-Bold.woff2') format('woff2'); font-weight: 600 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'Instrument Sans'; src: url('../fonts/v7/InstrumentSans-Regular.woff2') format('woff2'); font-weight: 400 500; font-style: normal; font-display: swap; }
@font-face { font-family: 'Instrument Sans'; src: url('../fonts/v7/InstrumentSans-Bold.woff2') format('woff2'); font-weight: 600 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'Scheherazade New'; src: url('../fonts/v7/ScheherazadeNew-Regular.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Noto Naskh Arabic'; src: url('../fonts/v7/NotoNaskhArabic.woff2') format('woff2'); font-weight: 400 700; font-style: normal; font-display: swap; }
/* Fonts for the other languages (all OFL, self-hosted). unicode-range: the file downloads only when a glyph of that script is on the page;
 * the html[lang] stacks below name a script font only on pages in that language. */
@font-face { font-family: 'Noto Sans Extra'; src: url('../fonts/v7/NotoSansExtra-Regular.woff2') format('woff2'); font-weight: 400 500; font-style: normal; font-display: swap; unicode-range: U+0100-024F, U+0259, U+0300-036F, U+1E00-1EFF, U+2C60-2C7F, U+A720-A7FF, U+0400-052F, U+1C80-1C8F, U+2DE0-2DFF, U+A640-A69F; }
@font-face { font-family: 'Noto Sans Extra'; src: url('../fonts/v7/NotoSansExtra-Bold.woff2') format('woff2'); font-weight: 600 700; font-style: normal; font-display: swap; unicode-range: U+0100-024F, U+0259, U+0300-036F, U+1E00-1EFF, U+2C60-2C7F, U+A720-A7FF, U+0400-052F, U+1C80-1C8F, U+2DE0-2DFF, U+A640-A69F; }
@font-face { font-family: 'Noto Sans Bengali'; src: url('../fonts/v7/NotoSansBengali-Regular.woff2') format('woff2'); font-weight: 400 500; font-style: normal; font-display: swap; unicode-range: U+0980-09FF, U+200C-200D, U+25CC; }
@font-face { font-family: 'Noto Sans Bengali'; src: url('../fonts/v7/NotoSansBengali-Bold.woff2') format('woff2'); font-weight: 600 700; font-style: normal; font-display: swap; unicode-range: U+0980-09FF, U+200C-200D, U+25CC; }
@font-face { font-family: 'Noto Sans Devanagari'; src: url('../fonts/v7/NotoSansDevanagari-Regular.woff2') format('woff2'); font-weight: 400 500; font-style: normal; font-display: swap; unicode-range: U+0900-097F, U+1CD0-1CFF, U+200C-200D, U+25CC, U+A8E0-A8FF; }
@font-face { font-family: 'Noto Sans Devanagari'; src: url('../fonts/v7/NotoSansDevanagari-Bold.woff2') format('woff2'); font-weight: 600 700; font-style: normal; font-display: swap; unicode-range: U+0900-097F, U+1CD0-1CFF, U+200C-200D, U+25CC, U+A8E0-A8FF; }
@font-face { font-family: 'Noto Sans Tamil'; src: url('../fonts/v7/NotoSansTamil-Regular.woff2') format('woff2'); font-weight: 400 500; font-style: normal; font-display: swap; unicode-range: U+0B80-0BFF, U+200C-200D, U+25CC; }
@font-face { font-family: 'Noto Sans Tamil'; src: url('../fonts/v7/NotoSansTamil-Bold.woff2') format('woff2'); font-weight: 600 700; font-style: normal; font-display: swap; unicode-range: U+0B80-0BFF, U+200C-200D, U+25CC; }
@font-face { font-family: 'Noto Sans Malayalam'; src: url('../fonts/v7/NotoSansMalayalam-Regular.woff2') format('woff2'); font-weight: 400 500; font-style: normal; font-display: swap; unicode-range: U+0D00-0D7F, U+200C-200D, U+25CC; }
@font-face { font-family: 'Noto Sans Malayalam'; src: url('../fonts/v7/NotoSansMalayalam-Bold.woff2') format('woff2'); font-weight: 600 700; font-style: normal; font-display: swap; unicode-range: U+0D00-0D7F, U+200C-200D, U+25CC; }
@font-face { font-family: 'Noto Sans Ethiopic'; src: url('../fonts/v7/NotoSansEthiopic-Regular.woff2') format('woff2'); font-weight: 400 500; font-style: normal; font-display: swap; unicode-range: U+1200-139F, U+2D80-2DDF, U+AB00-AB2F; }
@font-face { font-family: 'Noto Sans Ethiopic'; src: url('../fonts/v7/NotoSansEthiopic-Bold.woff2') format('woff2'); font-weight: 600 700; font-style: normal; font-display: swap; unicode-range: U+1200-139F, U+2D80-2DDF, U+AB00-AB2F; }
@font-face { font-family: 'Noto Nastaliq Urdu'; src: url('../fonts/v7/NotoNastaliqUrdu-Regular.woff2') format('woff2'); font-weight: 400 500; font-style: normal; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F; }
@font-face { font-family: 'Noto Nastaliq Urdu'; src: url('../fonts/v7/NotoNastaliqUrdu-Bold.woff2') format('woff2'); font-weight: 600 700; font-style: normal; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F; }


:root {
  /* ---- Maqraa palette (raw, only used below to fill the slots) ---- */
  --maqraa-green-950: #062a21;
  --maqraa-green-900: #0a3f32;
  --maqraa-green-800: #0b4f3f;
  --maqraa-green-700: #0f6650;
  --maqraa-green-100: #dcefe7;
  --maqraa-green-50: #eef7f3;
  --maqraa-gold-500: #c9a24a;
  --maqraa-gold-300: #e7cf8a;

  /* ---- Colour slots, light (slot names) ---- */
  --color-paper: #f8f4ea;        /* the page */
  --color-panel: #f3eee1;        /* a soft second ground: footer sheet, steps sheet */
  --color-card: #fffdf7;         /* a raised card on paper */
  --color-ink: #1d2b26;          /* text */
  --color-ink-soft: #52605a;     /* quieter text, 6:1 on paper */
  --color-edge: #cdbf9d;         /* the one hairline */
  --color-green: #0b4f3f;        /* primary button and deep card */
  --color-green-hover: #0f6650;
  --color-link: #0b4f3f;          /* text links; lifted in dark to keep 4.5:1 on panel and tint (fault 41) */
  --color-on-green: #fffdf5;
  --color-tint: #dcefe7;         /* a soft green panel */
  --color-ground: #062a21;       /* the dark forest Ground panel */
  --color-ground-2: #0a3f32;     /* a step lighter than Ground: bar, chain nodes */
  --color-on-ground: #f8f4ea;
  --color-on-ground-soft: #c6d5cd;
  --color-gold: #c9a24a;         /* only ever used on a Ground panel */
  --color-on-gold: #1a1405;
  --color-focus: #0f6650;        /* focus ring on paper */
  --color-focus-on-ground: #e7cf8a;
  --color-footer: var(--color-panel);
  --color-bar: #0a3f32;          /* the island */
  --color-shadow: 6, 42, 33;     /* r, g, b of the one shadow tint */
  --color-btn-ground-bg: #f8f4ea;/* the button on a Ground panel */
  --color-btn-ground-ink: #062a21;

  /* ---- Type families ---- */
  --font-display: 'Crimson Pro', Georgia, 'Noto Sans Extra', 'Times New Roman', serif;
  --font-brand: 'Crimson Pro', Georgia, 'Times New Roman', serif;   /* the name in words (partials/brand_mark.html) */
  --font-body: 'Instrument Sans', 'Noto Sans Extra', 'Segoe UI', system-ui, sans-serif;
  --font-arabic: 'Noto Naskh Arabic', 'Instrument Sans', 'Segoe UI', system-ui, sans-serif;
  --font-quran: 'Scheherazade New', 'Noto Naskh Arabic', serif;
  --font-mono: ui-monospace, 'Cascadia Mono', Consolas, monospace;   /* the verify code cells only */
  --lh-quran: 1.95;   /* Quran text needs room for its marks: 1.9 to 2 */

  /* ---- Type ladder, Latin  ---- */
  --text-display: clamp(2.5rem, 1.45rem + 4.4vw, 4.75rem);   /* 40 to 76 */
  --text-display-lh: 1.04;
  --text-statement: clamp(1.75rem, 1.2rem + 2.3vw, 3.25rem); /* 28 to 52 */
  --text-statement-lh: 1.22;
  --text-h2: clamp(1.75rem, 1.3rem + 1.9vw, 3.375rem);        /* 28 to 54 */
  --text-h2-lh: 1.1;
  --text-h3: clamp(1.5rem, 1.35rem + 0.62vw, 1.875rem);       /* 24 to 30 */
  --text-h3-lh: 1.2;
  --text-lead: clamp(1.1875rem, 1.15rem + 0.15vw, 1.3125rem); /* 19 to 21 */
  --text-lead-lh: 1.55;
  --text-body: 1.125rem;                                      /* 18 */
  --text-body-lh: 1.6;
  --text-label: 1rem;                                         /* 16 */
  --text-small: 0.875rem;                                     /* 14 */
  --tracking-display: -0.02em;
  --tracking-heading: -0.012em;
  --tracking-label: 0.01em;

  /* ---- Space, 4px scale ---- */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  --space-9: 96px;
  --space-10: 128px;
  --gutter: clamp(16px, 4vw, 48px);       /* the side space of the whole page */
  --section-pad: clamp(48px, 6.5vw, 96px); /* above and below a section */
  --grid-gap: 24px;
  --measure: 62ch;
  --page-max: 1240px;

  /* ---- Shape ---- */
  --radius-card: 28px;
  --radius-panel: 36px;
  --radius-sheet: 36px;     /* footer sheet, top corners */
  --radius-pill: 999px;
  --radius-input: 999px;
  --btn-height: 54px;
  --btn-pad: 24px;
  --tap: 44px;              /* the smallest thing a finger must hit */

  /* ---- Shell numbers  ---- */
  --bar-height: 68px;
  --bar-float: 12px;
  --bar-island-height: calc(var(--bar-height) - 4px);
  --bar-word-height: 44px;
  --bar-word-pad: 16px;
  --bar-max: 1180px;

  /* ---- Motion (transform and opacity only) ---- */
  --dur-fast: 160ms;
  --dur-base: 280ms;
  --dur-slow: 720ms;
  --dur-reveal: 640ms;
  --dur-sun: 2.5s;   /* one half of the sun's single breath (in, then out = 5s, then it rests) */
  --ease-out: cubic-bezier(0.22, 0.61, 0.36, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);   /* the one small overshoot (ticks, the lane word) */
  --ease-soft: cubic-bezier(0.4, 0, 0.2, 1);
  --rise: 24px;             /* how far a block rises as it appears */
  --press: 0.97;
}

/* Wide and narrow steps of the shared numbers  */
@media (max-width: 760px) {
  :root {
    --grid-gap: 16px;
    --radius-panel: 26px;
    --radius-sheet: 28px;
    --radius-card: 24px;
  }
}

/* ---- Dark values: Maqraa's own dark tokens (RULES.md, T2) ---- */
:root:not([data-theme='light']) {
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --color-paper: #0b1512;
    --color-panel: #182b25;
    --color-card: #101d19;
    --color-ink: #e8efe9;
    --color-ink-soft: #a4b8ae;
    --color-edge: #335245;
    --color-green: #2aa383;
    --color-green-hover: #35b893;
    --color-link: #5cc9a7;
    --color-on-green: #04140f;
    --color-tint: #12372c;
    --color-ground: #0a3f32;
    --color-ground-2: #0f5240;
    --color-on-ground: #f1f5ef;
    --color-on-ground-soft: #c6d5cd;
    --color-focus: #e7cf8a;
    --color-bar: #13221d;
    --color-footer: #13221d;
    --color-shadow: 0, 0, 0;
    --color-btn-ground-bg: #f8f4ea;
    --color-btn-ground-ink: #062a21;
  }
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --color-paper: #0b1512;
  --color-panel: #182b25;
  --color-card: #101d19;
  --color-ink: #e8efe9;
  --color-ink-soft: #a4b8ae;
  --color-edge: #335245;
  --color-green: #2aa383;
  --color-green-hover: #35b893;
  --color-link: #5cc9a7;
  --color-on-green: #04140f;
  --color-tint: #12372c;
  --color-ground: #0a3f32;
  --color-ground-2: #0f5240;
  --color-on-ground: #f1f5ef;
  --color-on-ground-soft: #c6d5cd;
  --color-focus: #e7cf8a;
  --color-bar: #13221d;
  --color-footer: #13221d;
  --color-shadow: 0, 0, 0;
  --color-btn-ground-bg: #f8f4ea;
  --color-btn-ground-ink: #062a21;
}

:root[data-theme='light'] {
  color-scheme: light;
}

/* ---- Other languages: the script's own face first, then the house faces. Naskh covers Arabic-script Persian, Pashto, Sindhi, Sorani. ---- */
html[lang='fa'], html[lang='ps'], html[lang='sd'], html[lang='ckb'] {
  --font-display: 'Noto Naskh Arabic', 'Crimson Pro', Georgia, serif;
  --font-body: 'Noto Naskh Arabic', 'Instrument Sans', 'Segoe UI', system-ui, sans-serif;
}
html[lang='ur'] {   /* Nastaliq is very tall: the line needs air or the marks collide */
  --font-display: 'Noto Nastaliq Urdu', 'Noto Naskh Arabic', serif;
  --font-body: 'Noto Nastaliq Urdu', 'Noto Naskh Arabic', 'Segoe UI', system-ui, sans-serif;
}
html[lang='ur'] body { line-height: 2.1; }
html[lang='bn'] { --font-display: 'Noto Sans Bengali', 'Crimson Pro', serif; --font-body: 'Noto Sans Bengali', 'Instrument Sans', system-ui, sans-serif; }
html[lang='hi'] { --font-display: 'Noto Sans Devanagari', 'Crimson Pro', serif; --font-body: 'Noto Sans Devanagari', 'Instrument Sans', system-ui, sans-serif; }
html[lang='ta'] { --font-display: 'Noto Sans Tamil', 'Crimson Pro', serif; --font-body: 'Noto Sans Tamil', 'Instrument Sans', system-ui, sans-serif; }
html[lang='ml'] { --font-display: 'Noto Sans Malayalam', 'Crimson Pro', serif; --font-body: 'Noto Sans Malayalam', 'Instrument Sans', system-ui, sans-serif; }
html[lang='am'] { --font-display: 'Noto Sans Ethiopic', 'Crimson Pro', serif; --font-body: 'Noto Sans Ethiopic', 'Instrument Sans', system-ui, sans-serif; }
html:is([lang='bn'], [lang='hi'], [lang='ta'], [lang='ml'], [lang='am']) body { line-height: 1.75; }

/* ---- Arabic ladder: Noto Naskh Arabic is tall, so the sizes sit below the old face; line-height 1.7 to 1.9 for the joined letters ---- */
html[lang='ar'] {
  --font-brand: 'Scheherazade New', 'Noto Naskh Arabic', serif;   /* the brand Arabic face (design/decisions.md) */
  --font-display: 'Noto Naskh Arabic', 'Crimson Pro', Georgia, serif;
  --font-body: 'Noto Naskh Arabic', 'Instrument Sans', 'Segoe UI', system-ui, sans-serif;
  --tracking-display: 0;
  --tracking-heading: 0;
  --tracking-label: 0;
  --text-display: clamp(2.375rem, 1.6rem + 3.2vw, 4.5rem);     /* 38 to 72 */
  --text-display-lh: 1.45;
  --text-statement: clamp(1.75rem, 1.25rem + 2vw, 3rem);       /* 28 to 48 */
  --text-statement-lh: 1.35;
  --text-h2: clamp(1.75rem, 1.3rem + 1.9vw, 3.125rem);         /* 28 to 50 */
  --text-h2-lh: 1.35;
  --text-h3: clamp(1.5rem, 1.35rem + 0.62vw, 1.875rem);        /* 24 to 30 */
  --text-h3-lh: 1.4;
  --text-lead: clamp(1.3125rem, 1.28rem + 0.15vw, 1.4375rem);  /* 21 to 23 */
  --text-lead-lh: 1.9;
  --text-body: clamp(1.1875rem, 1.16rem + 0.12vw, 1.3125rem);  /* 19 to 21 */
  --text-body-lh: 1.9;
  --text-label: 1.1875rem;
  --text-small: 1.0625rem;
  --hero-title-size: clamp(2.125rem, 1.35rem + 2.9vw, 3.5rem);
  --hero-title-lh: 1.3;
}

/* ---- v4 additions ---- */
/* A calm spring (overshoot about 4 percent), generated: damped spring zeta 0.72, wn 11, 26 points. Used by the lane words. */
:root { --spring: linear(0, 0.073, 0.235, 0.424, 0.603, 0.753, 0.867, 0.946, 0.997, 1.025, 1.036, 1.038, 1.034, 1.027, 1.02, 1.013, 1.008, 1.004, 1.001, 1, 0.999, 0.999, 0.999, 0.999, 0.999, 0.999, 1); }

/* Platform colours for the social logos: the one declared exception to "no raw colour outside tokens" (RULES.md, T3).
   These are the platforms' own brand colours; they are not Maqraa colours and do not change with the theme,
   except the X/TikTok tile, which flips so it stays visible on both grounds. */
:root {
  --x-bg: #111111; --x-fg: #ffffff;
  --fb: #1877f2; --sc: #fffc00;
  --ink-fixed: #111111; --on-brand: #ffffff;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) { --x-bg: #f1f5ef; --x-fg: #111111; } }
:root[data-theme='dark'] { --x-bg: #f1f5ef; --x-fg: #111111; }

/* ---- v5 hero: the stage, the logo and its timeline (RULES.md, H rules). The stage is always Ground, in both themes. ---- */
:root {
  --hero-glint: #ead3a2;               /* the paler gold of the light that passes round the logo */
  --hero-control-edge: #3f6f60;        /* solid hairline of the quiet bar button and the ghost buttons on the Ground (no blur, no glass) */
  --hero-stage-min: 560px;
  --hero-logo-size: min(78svh, 760px, 50vw);
  --hero-logo-size-phone: min(88vw, 560px);
  --hero-logo-top: 53%;
  --hero-logo-inset: 5vw;
  --hero-words-max: min(46vw, 36rem);
  --hero-title-size: clamp(2.25rem, 1.35rem + 3.3vw, 3.875rem);   /* 36 to 62: the hero title is smaller than the page display size so it sets in two or three calm lines */
  --hero-title-lh: 1.12;
  --hero-pad-bottom: calc(var(--tap) + var(--space-8));
  --hero-rise-from: 26%;               /* how far below its place the logo starts */
  --hero-rise-turn: -30deg;
  --hero-stroke-width: 1.4;
  --hero-breath-turn: 3deg;
  --hero-breath-grow: 1.04;
  --hero-t0: 1900ms;                   /* the words arrive when the logo is nearly in place */
  --hero-title-dur: 760ms;
  --hero-line-dur: 640ms;
  --hero-rise-dur: 2400ms;
  --hero-draw-dur: 700ms;
  --hero-draw-delay: 500ms;
  --hero-draw-step: 45ms;
  --hero-fill-dur: 600ms;
  --hero-fill-delay: 1500ms;
  --hero-fill-step: 20ms;
  --hero-stroke-out-wait: 400ms;       /* the stroke leaves this long after its fill starts */
  --hero-stroke-out-dur: 400ms;
  --hero-breath-dur: 9s;
  --hero-breath-delay: 3s;
  --hero-glint-cycle: 10s;
  --hero-glint-delay: 2800ms;
  --hero-glint-step: 160ms;
  --ease-showpiece: cubic-bezier(0.16, 1, 0.3, 1);
}

/* =====================================================================
   Muqra'a design system  (blueprint §15)
   Calm green + gold Islamic theme, light/dark, true bidirectional layout
   using logical CSS properties only (no separate RTL stylesheet).
   ===================================================================== */

:root {
  --green-950: #062a21;
  --green-900: #0a3f32;
  --green-800: #0b4f3f;
  --green-700: #0f6650;
  --green-600: #17795f;
  --green-500: #1f8f71;
  --green-100: #dcefe7;
  --green-50:  #eef7f3;
  --gold-700: #8a6620;
  --gold-600: #a87d2a;
  --gold-500: #c9a24a;
  --gold-300: #e7cf8a;
  --gold-100: #f6ecd0;

  --bg: #f8f4ea;
  --bg-elevated: #fffdf7;
  --surface: #ffffff;
  --surface-2: #f3eee1;
  --text: #1d2b26;
  --text-muted: #5c6b64;
  --border: #e3dac4;
  --border-strong: #cdbf9d;
  --primary: var(--green-800);
  --primary-hover: var(--green-700);
  --primary-contrast: #fffdf5;
  --accent: var(--gold-600);
  --accent-soft: var(--gold-100);
  --link: var(--green-700);
  --danger: #a3322a; --on-danger: #ffffff;
  --danger-soft: #fbe7e4;
  --warning: #8a5a00;
  --warning-soft: #fff1d1;
  --success: #1c6b3c;
  --success-soft: #def3e4;
  --info: #1f5f8b;
  --info-soft: #e1eef8;
  --shadow-sm: 0 1px 2px rgba(10, 63, 50, .08);
  --shadow: 0 6px 24px -8px rgba(10, 63, 50, .18);
  --radius: 14px;
  --radius-sm: 9px;
  --pattern-opacity: .35;

  --font-ui: "IBM Plex Sans Arabic", "Noto Sans Arabic", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Amiri", "Noto Naskh Arabic", serif;
  --font-quran: "Amiri Quran", "Amiri", "Noto Naskh Arabic", serif;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1512;
    --bg-elevated: #101d19;
    --surface: #13221d;
    --surface-2: #182b25;
    --text: #e8efe9;
    --text-muted: #9fb3aa;
    --border: #24392f;
    --border-strong: #335245;
    --primary: #2aa383;
    --primary-hover: #35b893;
    --primary-contrast: #04140f;
    --accent: var(--gold-500);
    --accent-soft: #2b2512;
    --link: #5cc9a7;
    --danger: #f08378; --danger-soft: #3a1a17; --on-danger: var(--danger-soft);
    --warning: #f2c26b; --warning-soft: #33280f;
    --success: #6fd49a; --success-soft: #12301f;
    --info: #7cb8e6; --info-soft: #132a3b;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
    --shadow: 0 8px 28px -10px rgba(0,0,0,.6);
    --pattern-opacity: .12;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1512;
  --bg-elevated: #101d19;
  --surface: #13221d;
  --surface-2: #182b25;
  --text: #e8efe9;
  --text-muted: #9fb3aa;
  --border: #24392f;
  --border-strong: #335245;
  --primary: #2aa383;
  --primary-hover: #35b893;
  --primary-contrast: #04140f;
  --accent: var(--gold-500);
  --accent-soft: #2b2512;
  --link: #5cc9a7;
  --danger: #f08378; --danger-soft: #3a1a17; --on-danger: var(--danger-soft);
  --warning: #f2c26b; --warning-soft: #33280f;
  --success: #6fd49a; --success-soft: #12301f;
  --info: #7cb8e6; --info-soft: #132a3b;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow: 0 8px 28px -10px rgba(0,0,0,.6);
  --pattern-opacity: .12;
  color-scheme: dark;
}

/* ---------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 1rem;
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
html[lang="en"] body { font-family: "Inter", var(--font-ui); line-height: 1.6; }
main { flex: 1; }
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--primary-hover); }
img, svg { max-width: 100%; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.35; margin-block: 0 .6em; color: var(--text); }
h1 { font-size: clamp(1.7rem, 3.6vw, 2.5rem); }
h2 { font-size: clamp(1.35rem, 2.6vw, 1.8rem); }
h3, .h3 { font-size: 1.25rem; } /* .h3: a level-2 heading that keeps the level-3 size (heading order, A10-27) */
p { margin-block: 0 1em; }
hr { border: 0; border-block-start: 1px solid var(--border); margin-block: 1.5rem; }
:focus-visible { outline: 3px solid var(--gold-500); outline-offset: 2px; border-radius: 4px; }
.skip-link { position: absolute; inset-inline-start: 1rem; inset-block-start: -4rem; z-index: 100; background: var(--primary); color: var(--primary-contrast); padding: .5rem 1rem; border-radius: var(--radius-sm); }
.skip-link:focus { inset-block-start: 1rem; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.container { width: 100%; max-width: 1200px; margin-inline: auto; padding-inline: 16px; }
@media (min-width: 720px) { .container { padding-inline: 24px; } }
.narrow { max-width: 760px; }

/* ---------------------------------------------------------------- header */
.site-header {
  background: var(--green-900);
  color: #f4ecd6;
  border-block-end: 3px solid var(--gold-500);
  position: sticky; inset-block-start: 0; z-index: 50;
}
.site-header .container { display: flex; align-items: center; gap: 1rem; min-height: 68px; }
.brand { display: flex; align-items: center; gap: .65rem; color: inherit; text-decoration: none; flex-shrink: 0; }
.brand img { width: 46px; height: 46px; filter: drop-shadow(0 2px 4px rgba(0,0,0,.25)); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 1.3rem; color: #fff8e5; }
.brand-sub { font-size: .72rem; color: var(--gold-300); letter-spacing: .02em; }
.main-nav { display: flex; align-items: center; gap: .15rem; margin-inline-start: auto; flex-wrap: wrap; }
.main-nav a, .main-nav button.linklike {
  color: #e9e0c7; text-decoration: none; padding: .45rem .7rem; border-radius: 8px; font-size: .95rem;
  background: none; border: 0; font: inherit; cursor: pointer;
}
.main-nav a:hover, .main-nav a[aria-current="page"] { background: rgba(255,255,255,.09); color: #fff; }
.main-nav a[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--gold-500); }
.header-tools { display: flex; align-items: center; gap: .4rem; }
.icon-btn {
  display: inline-grid; place-items: center; inline-size: 38px; block-size: 38px; border-radius: 10px;
  border: 1px solid rgba(231, 207, 138, .35); background: rgba(255,255,255,.05); color: #f4ecd6; cursor: pointer;
}
.icon-btn:hover { background: rgba(255,255,255,.12); }
.icon-btn.has-count { position: relative; }
.icon-btn .count {
  position: absolute; inset-block-start: -6px; inset-inline-end: -6px; min-inline-size: 18px; block-size: 18px;
  padding-inline: 4px; border-radius: 999px; background: var(--gold-500); color: #2a1e05;
  font-size: .68rem; font-weight: 700; line-height: 18px; text-align: center; font-variant-numeric: tabular-nums;
}
.lang-form select {
  background: rgba(255,255,255,.06); color: #f4ecd6; border: 1px solid rgba(231,207,138,.35);
  border-radius: 10px; padding: .35rem .5rem; font: inherit; font-size: .9rem;
}
.lang-form option { color: #111; }
.nav-toggle { display: none; }
@media (max-width: 1080px) {
  .nav-toggle { display: inline-grid; margin-inline-start: auto; }
  .main-nav {
    display: none; position: absolute; inset-inline: 0; inset-block-start: 100%;
    background: var(--green-900); flex-direction: column; align-items: stretch; padding: .75rem 16px 1rem;
    border-block-end: 3px solid var(--gold-500);
  }
  .main-nav.open { display: flex; }
  .header-tools { margin-inline-start: 0; }
}
/* Wide screens whose menu would not fit on one line (long English labels, staff extras):
   app.js adds .nav-compact and the header uses the phone menu instead of wrapping. */
.main-nav a { white-space: nowrap; }
.site-header.nav-compact .nav-toggle { display: inline-grid; margin-inline-start: auto; }
.site-header.nav-compact .main-nav {
  display: none; position: absolute; inset-inline: 0; inset-block-start: 100%;
  background: var(--green-900); flex-direction: column; align-items: stretch; padding: .75rem 16px 1rem;
  border-block-end: 3px solid var(--gold-500);
}
.site-header.nav-compact .main-nav.open { display: flex; }
.site-header.nav-compact .header-tools { margin-inline-start: 0; }

/* ornamental band under header / hero */
.ornament-band {
  height: 14px;
  background: var(--green-800);
  opacity: .9;
}

/* ---------------------------------------------------------------- hero */
.hero {
  position: relative; overflow: hidden;
  background: var(--green-900);
  color: #f7f0dc; padding-block: clamp(3rem, 8vw, 6rem) clamp(3rem, 7vw, 5rem);
  text-align: center;
}
.hero::before {
  content: none;
  opacity: .18; pointer-events: none;
}
.hero > .container { position: relative; }
.hero h1 { color: #fff8e5; font-size: clamp(2rem, 5vw, 3.3rem); margin-block-end: .3em; }
.hero .lead { font-size: clamp(1.05rem, 2vw, 1.25rem); color: #e8dcb8; max-width: 760px; margin-inline: auto; }
.hero .ayah-banner {
  font-family: var(--font-quran); font-size: clamp(1.4rem, 3vw, 2rem); color: var(--gold-300);
  margin-block-end: 1.25rem; direction: rtl;
}
.hero-logo { width: clamp(96px, 14vw, 140px); margin-block-end: 1rem; filter: drop-shadow(0 8px 20px rgba(0,0,0,.35)); }
.hero-actions { display: flex; gap: .75rem; justify-content: center; flex-wrap: wrap; margin-block-start: 1.75rem; }

/* ---------------------------------------------------------------- page header */
.page-header {
  position: relative; padding-block: 2rem 1.5rem; margin-block-end: 1.5rem;
  background: var(--surface-2);
  border-block-end: 1px solid var(--border);
}
.page-header::after {
  content: none;
  opacity: var(--pattern-opacity); pointer-events: none;
}
.page-header > .container { position: relative; z-index: 1; display: flex; gap: 1rem; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; }
.page-header h1 { margin: 0; }
.page-header .subtitle { color: var(--text-muted); margin: .25rem 0 0; }
.breadcrumbs { font-size: .88rem; color: var(--text-muted); margin-block-end: .4rem; }
.breadcrumbs a { color: var(--text-muted); }

/* ---------------------------------------------------------------- layout helpers */
.section { padding-block: 2.5rem; }
.stack > * + * { margin-block-start: 1rem; }
.cluster { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.between { justify-content: space-between; }
.grid { display: grid; gap: 1.1rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.layout-sidebar { display: grid; gap: 1.5rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 960px) { .layout-sidebar { grid-template-columns: 280px minmax(0, 1fr); } }
.muted { color: var(--text-muted); }
.small { font-size: .875rem; }
.text-center { text-align: center; }
.mt-0 { margin-block-start: 0; } .mb-0 { margin-block-end: 0; }
.mt-1 { margin-block-start: 1rem; } .mb-1 { margin-block-end: 1rem; }
.mt-2 { margin-block-start: 2rem; } .mb-2 { margin-block-end: 2rem; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.nums { font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- cards */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 1.25rem;
}
.card > :last-child { margin-block-end: 0; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-block-end: .85rem; }
.card-header h2, .card-header h3 { margin: 0; font-size: 1.2rem; }
.card-ornate { position: relative; border-color: var(--border-strong); }
.card-ornate::before {
  content: ""; position: absolute; inset: 6px; border: 1px solid var(--accent-soft); border-radius: calc(var(--radius) - 5px); pointer-events: none;
}
a.card { display: block; text-decoration: none; color: inherit; transition: transform .15s, box-shadow .15s, border-color .15s; }
a.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--gold-500); }
.feature-card .icon {
  inline-size: 52px; block-size: 52px; border-radius: 14px; display: grid; place-items: center;
  background: var(--green-800); color: var(--gold-300);
  margin-block-end: .8rem; box-shadow: inset 0 0 0 1px rgba(231,207,138,.35);
}
.feature-card .icon svg { inline-size: 26px; block-size: 26px; }
.feature-card h3, .feature-card .h3 { margin-block-end: .35rem; }
.feature-card p { color: var(--text-muted); margin: 0; font-size: .95rem; }

/* stat tiles */
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.2rem; border-inline-start: 4px solid var(--accent); }
.stat .label { color: var(--text-muted); font-size: .88rem; }
.stat .value { font-family: var(--font-display); font-size: 2rem; font-weight: 700; color: var(--primary); line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat .delta { font-size: .82rem; }

/* buttons: v7-buttons.css (style B, linked last in base.html) */
@media (pointer: coarse) { .icon-btn { inline-size: 44px; block-size: 44px; } }

/* ---------------------------------------------------------------- forms */
.form { display: grid; gap: 1rem; }
.form-row { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.field { display: grid; gap: .3rem; }
.field label, .field > .label { font-weight: 600; font-size: .92rem; }
.field .help, .helptext { color: var(--text-muted); font-size: .82rem; }
.field .errorlist, .errorlist { color: var(--danger); font-size: .85rem; margin: 0; padding: 0; list-style: none; }
input[type="text"], input[type="email"], input[type="password"], input[type="tel"], input[type="number"],
input[type="date"], input[type="datetime-local"], input[type="time"], input[type="search"], input[type="url"],
input[type="file"], select, textarea {
  inline-size: 100%; padding: .6rem .8rem; border: 1px solid var(--border-strong); border-radius: 10px;
  background: var(--bg-elevated); color: var(--text); font: inherit; min-block-size: 44px;
}
textarea { min-block-size: 110px; resize: vertical; }
input:placeholder-shown { text-overflow: ellipsis; }
/* Arabic search fields on the English UI: show the English hint from its start, switch to RTL once typing */
html[dir="ltr"] input[dir="rtl"]:placeholder-shown { direction: ltr; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold-500); outline-offset: 0; border-color: var(--gold-500); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); inline-size: 1.1rem; block-size: 1.1rem; }
.choice-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.choice-list label, .check { display: flex; gap: .55rem; align-items: center; font-weight: 500; }
.radio-cards > div { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.radio-cards label { display: flex; align-items: center; gap: .6rem; border: 1px solid var(--border-strong); border-radius: 12px; padding: .8rem 1rem; cursor: pointer; background: var(--bg-elevated); }
.radio-cards label:has(input:checked) { border-color: var(--primary); box-shadow: 0 0 0 2px var(--green-100); }
.input-group { display: flex; gap: .5rem; }
.input-group > input { flex: 1; }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table.table { inline-size: 100%; border-collapse: collapse; font-size: .95rem; }
.table th, .table td { padding: .7rem .9rem; text-align: start; border-block-end: 1px solid var(--border); vertical-align: top; }
.table th { background: var(--surface-2); font-weight: 700; font-size: .85rem; color: var(--text-muted); white-space: nowrap; }
.table tr:last-child td { border-block-end: 0; }
.table tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }

/* ---------------------------------------------------------------- badges & alerts */
.badge {
  display: inline-flex; align-items: center; gap: .3rem; padding: .12rem .6rem; border-radius: 999px;
  font-size: .78rem; font-weight: 600; background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border);
  white-space: nowrap;
}
.badge-success { background: var(--success-soft); color: var(--success); border-color: transparent; }
.badge-warning { background: var(--warning-soft); color: var(--warning); border-color: transparent; }
.badge-danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge-info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.badge-gold { background: var(--accent-soft); color: var(--gold-700); border-color: var(--gold-300); }
.badge-ai { background: var(--info-soft); color: var(--info); border: 1px dashed var(--info); }

.alert { padding: .85rem 1rem; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); margin-block-end: 1rem; display: flex; gap: .6rem; }
.alert-success { background: var(--success-soft); border-color: transparent; color: var(--success); }
.alert-warning { background: var(--warning-soft); border-color: transparent; color: var(--warning); }
.alert-error, .alert-danger { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.alert-info { background: var(--info-soft); border-color: transparent; color: var(--info); }
.messages { list-style: none; padding: 0; margin: 1rem 0 0; }

/* AI suggestion box — AI assists, never decides (blueprint §7) */
.ai-suggestion { border: 1px dashed var(--info); background: var(--info-soft); border-radius: 12px; padding: .9rem 1rem; }
.ai-suggestion .ai-tag { font-weight: 700; font-size: .72rem; color: var(--info); border: 1px solid var(--info); border-radius: 6px; padding: 0 .35rem; margin-inline-end: .5rem; display: inline; }

/* ---------------------------------------------------------------- tabs, lists, empty */
.tabs { display: flex; gap: .25rem; border-block-end: 1px solid var(--border); margin-block-end: 1.25rem; overflow-x: auto; }
.tabs a { padding: .6rem 1rem; text-decoration: none; color: var(--text-muted); border-block-end: 3px solid transparent; white-space: nowrap; }
.tabs a[aria-current="page"], .tabs a.active { color: var(--primary); border-block-end-color: var(--accent); font-weight: 700; }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: .8rem 0; border-block-end: 1px solid var(--border); display: flex; gap: .75rem; align-items: center; justify-content: space-between; }
.list > li:last-child { border-block-end: 0; }
.empty { text-align: center; padding: 2.5rem 1rem; color: var(--text-muted); }
.empty img { inline-size: 64px; opacity: .55; margin-block-end: .5rem; }
.pagination { display: flex; gap: .35rem; justify-content: center; margin-block-start: 1.25rem; }
.pagination a, .pagination span { padding: .35rem .75rem; border-radius: 8px; border: 1px solid var(--border); text-decoration: none; }
.pagination .current { background: var(--primary); color: var(--primary-contrast); border-color: var(--primary); }

/* ---------------------------------------------------------------- workflow timeline (state machines) */
.steps { display: flex; flex-wrap: wrap; gap: .4rem; list-style: none; padding: 0; margin: 0 0 1rem; counter-reset: step; }
.steps li {
  counter-increment: step; display: flex; align-items: center; gap: .4rem; padding: .35rem .8rem; border-radius: 999px;
  background: var(--surface-2); color: var(--text-muted); font-size: .85rem; border: 1px solid var(--border);
}
.steps li::before { content: counter(step); font-weight: 700; font-size: .75rem; inline-size: 1.4rem; block-size: 1.4rem; display: grid; place-items: center; border-radius: 50%; background: var(--border); color: var(--text); }
.steps li.done { background: var(--success-soft); color: var(--success); border-color: transparent; }
.steps li.done::before { content: "✓"; background: var(--success); color: #fff; }
.steps li.current { background: var(--primary); color: var(--primary-contrast); border-color: transparent; }
.steps li.current::before { background: var(--gold-500); color: #2a1e05; }
.timeline { list-style: none; margin: 0; padding: 0; border-inline-start: 2px solid var(--border); }
.timeline li { position: relative; padding-inline-start: 1.2rem; padding-block-end: 1rem; }
.timeline li::before { content: ""; position: absolute; inset-inline-start: -7px; inset-block-start: .45rem; inline-size: 12px; block-size: 12px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); }
.timeline time { color: var(--text-muted); font-size: .82rem; }

/* ---------------------------------------------------------------- Quran / corpus text */
.quran, .ayah-text {
  font-family: var(--font-quran); direction: rtl; text-align: justify; text-align-last: center;
  font-size: clamp(1.45rem, 3.2vw, 1.95rem); line-height: 2.35; color: var(--text);
  font-feature-settings: "liga", "calt";
}
.mushaf-page {
  background: #fffaf0; color: #1b1b1b; border-radius: 6px; padding: clamp(1.25rem, 4vw, 2.5rem);
  border: 10px solid transparent;
  border-color: var(--gold-300);
  box-shadow: var(--shadow), inset 0 0 0 1px var(--gold-300);
  max-width: 820px; margin-inline: auto;
}
:root[data-theme="dark"] .mushaf-page { background: #1b1912; color: #f1e9d2; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .mushaf-page { background: #1b1912; color: #f1e9d2; } }
.ayah { cursor: pointer; border-radius: 6px; transition: background .15s; }
.ayah:hover, .ayah.pointer { background: color-mix(in srgb, var(--gold-300) 40%, transparent); }
.ayah-number {
  display: inline-grid; place-items: center; inline-size: 1.9em; block-size: 1.9em; font-size: .62em;
  background: url("../img/ayah-marker.svg") center / contain no-repeat; color: var(--green-800);
  font-family: var(--font-ui); vertical-align: middle; margin-inline: .15em; font-weight: 700;
}
.surah-header {
  text-align: center; margin: 1.2rem 0 1rem; padding: .55rem 1rem; font-family: var(--font-display); font-size: 1.35rem;
  background: var(--accent-soft);
  border-block: 2px solid var(--gold-500); color: var(--gold-700);
}
.basmala { text-align: center; font-family: var(--font-quran); font-size: 1.6rem; margin-block-end: .6rem; }
.matn-line { font-family: var(--font-display); font-size: 1.3rem; line-height: 2.1; }
.citation { font-size: .82rem; color: var(--text-muted); }
.mistake { text-decoration: underline wavy var(--danger); text-underline-offset: 6px; }

/* ---------------------------------------------------------------- isnad chart (shajara) */
.chain-chart { display: flex; flex-direction: column; align-items: center; gap: 0; padding: 1rem 0; }
.chain-node {
  position: relative; min-inline-size: min(100%, 320px); text-align: center; padding: .6rem 1.2rem; border-radius: 999px;
  background: var(--surface); border: 2px solid var(--gold-500); font-family: var(--font-display); font-size: 1.1rem; box-shadow: var(--shadow-sm);
}
.chain-node.terminal { background: var(--green-800); color: #fff8e5; border-color: var(--gold-300); }
.chain-node .meta { display: block; font-family: var(--font-ui); font-size: .75rem; color: var(--text-muted); }
.chain-node.terminal .meta { color: var(--gold-300); }
.chain-edge { inline-size: 2px; block-size: 34px; background: var(--gold-500); position: relative; }
.chain-edge .edge-label { position: absolute; inset-inline-start: 10px; inset-block-start: 6px; white-space: nowrap; font-size: .75rem; }
.result-documented { color: var(--success); } .result-attested { color: var(--info); } .result-unverified { color: var(--warning); }

/* ---------------------------------------------------------------- certificate */
.certificate {
  position: relative; background: #fffdf6; color: #1f2a24; padding: clamp(1.5rem, 5vw, 3rem); text-align: center;
  border: 14px solid #fffdf6;
  outline: 3px double var(--gold-600); outline-offset: -26px;
}
.certificate h1 { color: var(--green-800); }

/* ---------------------------------------------------------------- footer */
.site-footer { margin-block-start: 3rem; background: var(--green-950); color: #cfc6ad; }
.site-footer .ornament-band { opacity: .6; }
.site-footer .container { padding-block: 2rem; display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.site-footer h4 { color: var(--gold-300); font-size: 1rem; margin-block-end: .5rem; }
.site-footer a { color: #e6dcc0; text-decoration: none; }
.site-footer a:hover { color: #fff; text-decoration: underline; }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: .35rem; font-size: .92rem; }
.footer-contact a { overflow-wrap: anywhere; }
.footer-bottom { border-block-start: 1px solid rgba(231,207,138,.2); text-align: center; padding: 1rem; font-size: .82rem; color: #a59d86; }

/* ---------------------------------------------------------------- misc */
.divider-ornament { display: flex; align-items: center; gap: 1rem; color: var(--accent); margin-block: 2rem; }
.divider-ornament::before, .divider-ornament::after { content: ""; flex: 1; block-size: 1px; background: var(--gold-500); }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .4rem 1rem; margin: 0; }
.kv dt { color: var(--text-muted); font-size: .9rem; }
.kv dd { margin: 0; font-weight: 600; }
.avatar { inline-size: 40px; block-size: 40px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--green-100); color: var(--green-800); font-weight: 700; flex-shrink: 0; }
.progress { block-size: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; block-size: 100%; background: var(--green-600); border-radius: inherit; }
.qr { background: #fff; padding: 8px; border-radius: 10px; display: inline-block; border: 1px solid var(--border); }
.child-mode { --radius: 20px; }

@media print {
  .site-header, .site-footer, .no-print, .ornament-band { display: none !important; }
  body { background: #fff; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* Maqraa v7 shell: top bar B (detached seal) and footer B (dock). Pieces of the approved v7 landing (design/v7/landing/css), joined for the site. */

/* Plain resets for the new shell only (the rest of the site keeps its own spacing) */
html { scroll-padding-top: calc(var(--bar-height) + var(--bar-float) + var(--space-5)); --dir: 1; --o: left; }
html[dir='rtl'] { --dir: -1; --o: right; }
:where(.bar, .footB) :is(h1, h2, h3, p, ol, ul) { margin: 0; }
:where(.bar, .footB) :is(ol, ul) { padding: 0; list-style: none; }
:where(.bar, .footB) :is(h1, h2, h3, h4) { color: inherit; font-family: var(--font-body); line-height: 1.4; }
.footB .h-statement { font-family: var(--font-display); line-height: var(--text-statement-lh); }
:where(.bar, .footB) :is(img, svg) { display: block; }
:where(.bar, .footB) button { font: inherit; color: inherit; }
:where(.bar, .footB) a:hover { color: inherit; }
.footB .link:hover { color: var(--color-green); }
.bar .menu-btn { color: var(--color-on-ground); }
.bar .brand, .foot .foot__brand { color: inherit; }
.bar .brand img, .foot .foot__brand img { filter: none; }
.bar .brand__word { color: inherit; font-family: var(--font-display); }
.sheet-nav a:hover { background: color-mix(in srgb, var(--color-on-ground) 16%, transparent); }
.bar .badge-count {
  min-inline-size: 20px; block-size: 20px; padding-inline: 5px; border-radius: var(--radius-pill); margin-inline-start: 4px;
  background: var(--color-gold); color: var(--color-on-gold); font-size: .75rem; font-weight: 600; line-height: 20px; text-align: center; font-variant-numeric: tabular-nums;
}
.q-tools .tool-link, .q-tools .tool-btn {
  position: relative; display: inline-grid; place-items: center; min-width: var(--tap); min-height: var(--tap); padding: 0 var(--space-2);
  background: transparent; border: 0; border-radius: var(--radius-pill); cursor: pointer; text-decoration: none; font-size: var(--text-small); font-weight: 600;
  color: var(--q-ink, var(--color-on-ground-soft));
}
.q-tools .tool-link:hover, .q-tools .tool-btn:hover { color: var(--q-ink-on, var(--color-on-ground)); }
.q-tools .tool-link svg { width: 20px; height: 20px; }
.q-tools .tool-link .count {
  position: absolute; inset-block-start: 4px; inset-inline-end: 2px; min-inline-size: 18px; block-size: 18px; padding-inline: 4px; border-radius: var(--radius-pill);
  background: var(--color-gold); color: var(--color-on-gold); font-size: .6875rem; font-weight: 600; line-height: 18px; text-align: center;
}
.q-tools form { display: inline-flex; margin: 0; }
.barB__nav a[aria-current='page'], .sheet-nav a[aria-current='page'] { box-shadow: inset 0 -3px 0 var(--color-gold); }
.barB__nav a[aria-current='page'] { border-radius: 0; }
.barB__nav { flex-wrap: nowrap; }

:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 3px;
  border-radius: var(--space-1);
}
.on-ground :focus-visible { outline-color: var(--color-focus-on-ground); }

.wrap { width: min(var(--page-max), 100% - 2 * var(--gutter)); margin-inline: auto; }
.h-statement { font-family: var(--font-display); font-weight: 400; font-size: var(--text-statement); line-height: var(--text-statement-lh); letter-spacing: var(--tracking-heading); text-wrap: pretty; }
/* A text link with a sliding arrow  */
.more {
  display: inline-flex; align-items: center; gap: var(--space-2);
  min-height: var(--tap); font-size: var(--text-label); font-weight: 600; text-decoration: none;
}
/* No plain underline on hover (anti-AI checklist hard ban): the arrow slide below is the hover cue. */
.more svg { width: 18px; height: 18px; transform: scaleX(var(--dir)); transition: transform var(--dur-base) var(--ease-out); }
.more:hover svg { transform: translateX(calc(var(--dir) * 4px)) scaleX(var(--dir)); }

/* ---------- Shared small parts: language links, theme button, menu button, brand, arrow ---------- */
.q-seg { display: inline-flex; }
.q-seg a, .q-seg button {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  min-width: var(--tap); min-height: var(--tap); padding: 0 var(--space-2);
  background: transparent; border: 0; border-radius: var(--radius-pill); cursor: pointer; text-decoration: none;
  color: var(--q-ink, var(--color-on-ground-soft)); font-size: var(--text-small); font-weight: 400;
}
html[lang='ar'] .q-seg a { font-size: 1.0625rem; }
.q-seg [aria-current='true'] { color: var(--q-ink-on, var(--color-on-ground)); font-weight: 600; }
.q-seg [aria-current='true']::after {
  content: ''; position: absolute; inset-inline-start: 50%; inset-block-end: 7px;
  width: 5px; height: 5px; margin-inline-start: -2.5px; border-radius: 50%; background: var(--q-dot, var(--color-gold));
}
.q-seg a:hover { color: var(--q-ink-on, var(--color-on-ground)); }

.q-theme {
  display: inline-grid; place-items: center; width: var(--tap); height: var(--tap); padding: 0;
  background: transparent; border: 0; border-radius: var(--radius-pill); cursor: pointer;
  color: var(--q-ink, var(--color-on-ground-soft));
}
.q-theme:hover { color: var(--q-ink-on, var(--color-on-ground)); }
.q-theme svg { width: 20px; height: 20px; }
.q-theme .i-sun { display: none; }
:root[data-theme='dark'] .q-theme .i-sun { display: block; }
:root[data-theme='dark'] .q-theme .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .q-theme .i-sun { display: block; }
  :root:not([data-theme='light']) .q-theme .i-moon { display: none; }
}

.menu-btn {
  display: inline-grid; place-items: center; width: var(--tap); height: var(--tap); padding: 0; cursor: pointer;
  background: transparent; border-radius: var(--radius-pill); color: inherit;
  border: 1.5px solid color-mix(in srgb, currentColor 35%, transparent);
}
.menu-btn span { position: relative; width: 18px; height: 11px; display: block; }
.menu-btn span::before, .menu-btn span::after {
  content: ''; position: absolute; inset-inline: 0; height: 2px; border-radius: 2px; background: currentColor;
  transition: transform var(--dur-base) var(--ease-out);
}
.menu-btn span::before { inset-block-start: 0; }
.menu-btn span::after { inset-block-end: 0; }
.menu-btn[aria-expanded='true'] span::before { transform: translateY(4.5px) rotate(45deg); }
.menu-btn[aria-expanded='true'] span::after { transform: translateY(-4.5px) rotate(-45deg); }

.brand { display: inline-flex; align-items: center; gap: var(--space-3); min-height: var(--tap); text-decoration: none; }
.brand img { width: 40px; height: 40px; }
.brand__word { font-family: var(--font-display); font-size: 1.5rem; line-height: 1; letter-spacing: 0.01em; }
html[lang='ar'] .brand__word { font-size: 1.75rem; line-height: 1.2; letter-spacing: 0; }
.arrow { width: 18px; height: 18px; transform: scaleX(var(--dir)); flex: none; }

/*
 * Maqraa v4: the shared shell. Top bar B ("detached seal") and footer B ("dock").
 * Reused by every v4 page (README.md). Reads tokens.css only.
 * The bar is absolute over the first screen; a page without a hero adds class "has-spacer" to <main> (README.md).
 */

/* ---------- Top bar ---------- */
.bar {
  position: absolute; inset-block-start: var(--bar-float); inset-inline: 0; z-index: 5;
  padding-inline: var(--space-4); display: grid; justify-items: center; pointer-events: none;
  color: var(--color-on-ground);
}
/* M14 (Esslam, 21 Nov: the header stays visible on desktop too): the bar is fixed at every width, with the L18 solid strip once the page moves. */
.bar {
  position: fixed; inset-block-start: 0; padding-block: calc(var(--bar-float) + env(safe-area-inset-top, 0px)) var(--bar-float);
  background: transparent; transition: background-color 180ms var(--ease-out);
}
.bar.bar--solid { background: var(--color-paper); pointer-events: auto; }
.bar.bar--solid.bar--hero { background: var(--color-ground); }
.bar > * { pointer-events: auto; }
.bar nav a { text-decoration: none; }
.q-tools { display: inline-flex; align-items: center; gap: 0; --q-ink: var(--color-on-ground-soft); --q-ink-on: var(--color-on-ground); }
.q-tools--bar { display: none; }
.sheet-nav { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); }
.sheet-nav a {
  display: flex; align-items: center; min-height: 56px; padding-inline: var(--space-4); border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--color-on-ground) 10%, transparent); font-size: var(--text-label); font-weight: 600; text-decoration: none;
}
.sheet-tools { display: flex; align-items: center; justify-content: space-between; margin-block-start: var(--space-3); padding-inline: var(--space-2); }
.has-spacer { padding-block-start: calc(var(--bar-height) + var(--bar-float) + var(--space-6)); }

.barB__row { width: min(var(--bar-max), 100%); display: flex; align-items: stretch; gap: var(--space-3); }
.barB__island { container: island / inline-size; flex: 1 1 0; min-width: 0; height: var(--bar-island-height); position: relative; }
.barB__in {
  height: 100%; display: flex; align-items: center; gap: var(--space-4); padding-inline: 22px var(--space-2);
  background: var(--color-bar); border-radius: 22px;
  box-shadow: 0 1px 2px rgba(var(--color-shadow), 0.18), 0 18px 40px -22px rgba(var(--color-shadow), 0.55);
}
.barB__nav { display: none; margin-inline: auto; align-items: center; gap: var(--space-1); }
.barB__nav a {
  display: inline-flex; align-items: center; height: var(--bar-word-height); padding-inline: var(--bar-word-pad);
  font-size: var(--text-label); font-weight: 400; white-space: nowrap; transition: opacity var(--dur-base) var(--ease-out);
}
.barB__nav:has(a:hover) a:not(:hover), .barB__nav:has(a:focus-visible) a:not(:focus-visible) { opacity: 0.55; }
.barB__end { display: flex; align-items: center; gap: var(--space-1); margin-inline-start: auto; }
.barB__sheet {
  position: absolute; inset-inline: 0; inset-block-start: 100%; display: grid; grid-template-rows: 0fr; z-index: 3;
  transition: grid-template-rows var(--dur-base) var(--ease-out);
}
.barB__sheet > div { overflow: clip; min-height: 0; visibility: hidden; transition: visibility 0s linear var(--dur-base); }
.barB:has(.menu-btn[aria-expanded='true']) .barB__sheet > div { visibility: visible; transition-delay: 0s; }
.barB__sheetin {
  margin-block-start: var(--space-2); padding: var(--space-4); background: var(--color-bar); border-radius: 22px;
  box-shadow: 0 18px 40px -22px rgba(var(--color-shadow), 0.55);
}
.barB:has(.menu-btn[aria-expanded='true']) .barB__sheet { grid-template-rows: 1fr; }
/* 21 Nov fix 6: the bar switches to the full nav at 1160 (a media query, because the menu sheet now lives outside the island) */
@media (min-width: 1160px) {
  .barB__nav { display: flex; }
  .barB .q-tools--bar { display: inline-flex; }
  .barB .menu-btn { display: none; }
  .barB__sheet { display: none; }
}
@media (max-width: 430px) {
  .barB__row { gap: var(--space-2); }
  .barB__in { padding-inline-start: var(--space-3); gap: var(--space-2); }
  .barB .brand { gap: var(--space-2); }
  .barB .brand img { width: 32px; height: 32px; }
  .barB .brand__word { font-size: 1.1875rem; }
  html[lang='ar'] .barB .brand__word { font-size: 1.3125rem; }
}
@media (prefers-reduced-motion: reduce) { .barB__sheet, .barB__nav a { transition: none; } }
/*
 * Maqraa v5 shared kit: Footer B (Esslam's pick), the dock of four platform tiles.
 * Link after tokens.css + base.css. Markup: see README.md (footer.foot.footB, .dock a.s[data-k], svg.glyph > use).
 * v5 fix: the glyphs were unfilled (black), so TikTok and X vanished on the dark tile and Facebook was weak in dark.
 * Now the glyph takes currentColor, and each tile has its own light/dark pairing (platform colours stay fixed, Design decision 20).
 */
/* ---------- Footer B: the dock ---------- */
.glyph { width: 24px; height: 24px; display: block; fill: currentColor; }
.s {
  position: relative; display: inline-grid; place-items: center; text-decoration: none; cursor: pointer;
  transition: transform var(--dur-base) var(--ease-out);
}
.s:active { transform: scale(var(--press)); }
.foot { position: relative; }
.foot h2 { font-size: var(--text-label); font-weight: 600; margin-block-end: var(--space-2); }
.foot a { text-decoration: none; }
.foot .link { display: inline-flex; align-items: center; min-height: var(--tap); font-size: var(--text-label); transition: color var(--dur-base) var(--ease-out); }
.foot__note { font-size: var(--text-small); max-width: 70ch; text-wrap: balance; }
.foot__brand { display: inline-flex; align-items: center; gap: var(--space-3); min-height: var(--tap); }
.foot__brand img { width: 44px; height: 44px; }
.foot .q-seg { --q-ink: var(--color-ink-soft); --q-ink-on: var(--color-ink); --q-dot: var(--color-green); margin-inline-start: calc(-1 * var(--space-2)); }

.footB {
  background: var(--color-panel); color: var(--color-ink);
  border-start-start-radius: var(--radius-sheet); border-start-end-radius: var(--radius-sheet);
  padding-block: clamp(40px, 5vw, 72px) var(--space-6);
}
.footB__id { display: grid; gap: var(--space-6); align-content: space-between; }
.footB__lead { display: grid; gap: var(--space-4); align-content: start; }
.footB__lead .h-statement { max-width: 34ch; font-size: var(--text-lead); line-height: var(--text-lead-lh); }
.footB__mid { display: grid; gap: var(--space-7) var(--grid-gap); align-items: stretch; }
.dockwrap { position: relative; display: grid; gap: var(--space-3); align-content: start; }
.dock { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.dock .s {
  width: 64px; height: 64px; border-radius: 20px; background: var(--color-card);
  box-shadow: 0 1px 2px rgba(var(--color-shadow), 0.12), 0 12px 24px -16px rgba(var(--color-shadow), 0.4);
}
.dock .s[data-k='fb'] { background: var(--fb); color: var(--on-brand); }
.dock .s[data-k='tt'], .dock .s[data-k='x'] { background: var(--x-bg); color: var(--x-fg); }
.dock .s[data-k='sc'] { background: var(--sc); color: var(--ink-fixed); }
.dock .glyph { width: 28px; height: 28px; }
.dock .s:hover, .dock .s:focus-visible { transform: translateY(-8px) scale(1.1); }
.dock .s:hover + .s, .dock .s:has(+ .s:hover), .dock .s:focus-visible + .s, .dock .s:has(+ .s:focus-visible) { transform: translateY(-3px) scale(1.04); }
.dock .s:active { transform: scale(var(--press)); }
.dock__cap { position: absolute; inset-inline-start: 0; inset-block-start: calc(100% + var(--space-2)); min-height: 1.6em; color: var(--color-ink-soft); font-size: var(--text-small); font-weight: 600; display: none; }
.dock__cap > span { position: absolute; inset-inline-start: 0; inset-block-start: 0; opacity: 0; transition: opacity var(--dur-fast) var(--ease-out); }
html[lang='ar'] .dock__cap { font-size: 1.0625rem; }
@media (hover: hover) and (min-width: 761px) { .dock__cap { display: block; } }
.dockwrap:has(.s[data-k='fb']:hover, .s[data-k='fb']:focus-visible) .c-fb,
.dockwrap:has(.s[data-k='tt']:hover, .s[data-k='tt']:focus-visible) .c-tt,
.dockwrap:has(.s[data-k='sc']:hover, .s[data-k='sc']:focus-visible) .c-sc,
.dockwrap:has(.s[data-k='x']:hover, .s[data-k='x']:focus-visible) .c-x { opacity: 1; }
.footB__cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-6) var(--grid-gap); align-content: space-between; }
.footB h2 { color: var(--color-ink-soft); }
.footB .link:hover { color: var(--color-green); }
.footB__base {
  margin-block-start: var(--space-8); padding-block-start: var(--space-5); border-block-start: 1px solid var(--color-edge);
  display: flex; flex-wrap: wrap; gap: var(--space-4); justify-content: space-between; align-items: center;
}
.footB .foot__note { color: var(--color-ink-soft); }
/* Footer legal row (Esslam, 21 Nov: privacy, terms and copyright on every page). KIT: small text, ink-soft, 44px tap height. */
.foot__legal { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-5); font-size: var(--text-small); color: var(--color-ink-soft); }
.foot__legal .link { display: inline-flex; align-items: center; min-block-size: 44px; }
@media (min-width: 900px) {
  .footB__mid { grid-template-columns: repeat(12, 1fr); }
  .footB__id { grid-column: 1 / span 5; }
  .footB__cols { grid-column: 7 / span 6; grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) { .footB__cols > div:last-child { grid-column: 1 / -1; } }
@media (max-width: 430px) { .dock { gap: var(--space-2); } .dock .s { width: 56px; height: 56px; border-radius: 18px; } }
@media (prefers-reduced-motion: reduce) {
  .s, .dock__cap > span, .foot .link { transition: none; }
  .dock .s:hover, .dock .s:focus-visible, .dock .s:hover + .s, .dock .s:has(+ .s:hover), .dock .s:focus-visible + .s, .dock .s:has(+ .s:focus-visible) { transform: none; }
}

@media (max-width: 430px) {
  .barB__end { gap: 4px; }
}
@media (max-width: 430px) {
  .barB .brand__word, .barB .wordmark__svg { max-width: 100%; }
}
@media (max-width: 380px) {
  .barB__row { gap: 4px; }
  .barB__in { padding-inline-start: 10px; gap: 2px; }
  .barB .wordmark__svg { height: 1.05em; }
}
.barB__nav a { padding-inline: 12px; }
@media (max-width: 380px) {
  .barB .wordmark__svg { height: 0.95em; }
}

/* ---------- v7 night fix 2 (H2), fault 18: footer ----------
 * One surface (the footer token, the same green as the bar in dark), single-colour social icons from the palette (no platform brand colours: rule P1/T3 palette only),
 * link columns stack one per row at phone width so words never wrap one by one. [CLAUDE-FILLED] */
.footB { background: var(--color-footer); }
.dock .s, .dock .s[data-k] { background: var(--color-card); color: var(--color-ink); box-shadow: inset 0 0 0 1px var(--color-edge); }
@media (max-width: 480px) {
  .footB__cols { grid-template-columns: minmax(0, 1fr); }
  .footB__cols > div:last-child { grid-column: auto; }
}

/* ---------- 21 Nov fix: the bar stays on one row at 320 (join, sign-in, menu and name never touch). Rule: KIT A, phone layout; tap targets keep their height ---------- */
@media (max-width: 340px) {
  .bar .barB__row .btn--join { --ps: 5px; --pe: 5px; font-size: 0.8125rem; }
  .barB__in { padding-inline-end: 4px; }
}

/* 21 Nov fix 3, faults 2 and 3: the phone menu tools row (language, theme, bell, mail, sign out) wraps to a second row instead of widening the page, and no tool shrinks under 44px wide. KIT A (phone layout), v5 RULES P4. */
.sheet-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.sheet-tools { flex-wrap: wrap; }
.sheet-tools .q-tools { flex-wrap: wrap; justify-content: space-between; inline-size: 100%; row-gap: var(--space-1); }
.q-theme, .q-tools .tool-link, .q-tools .tool-btn { flex: none; min-inline-size: var(--tap); }

/* ---------- 21 Nov 2026, batch 4, fix 6: phone and tablet header ----------
 * Esslam: "menu button at the end; Create account not in the top header at page load (hero has it); a small quiet Create account appears
 * in the header only after scrolling past the hero, signed-out users only; the open menu large (full width), not a small panel."
 * Rules: KIT A (phone layout), v5 RULES P2 (solid fills, no glass, no gradients), P4 (reduced motion), 44px taps.
 * Below 1160px the big pill leaves the row, and the menu opens as a full-screen sheet. */
.bar__quiet { display: none; }
@media (max-width: 1159px) {
  .barB__row { position: relative; z-index: 2; }
  .barB__row > .btn--join { display: none; }
  .bar--past .bar__quiet {
    display: inline-flex; align-items: center; min-height: var(--tap); padding-inline: 14px; border-radius: var(--radius-pill);
    font-size: 0.9375rem; font-weight: 600; line-height: 1.1; white-space: nowrap; text-decoration: none; flex: none;
    box-shadow: inset 0 0 0 1.5px var(--hero-control-edge);
    animation: bar-quiet-in 260ms var(--ease-out) backwards;
  }
  .bar--past .bar__quiet:hover { background: color-mix(in srgb, var(--color-on-ground) 12%, transparent); }
  .bar--past .bar__quiet:focus-visible { outline: 3px solid var(--color-focus-on-ground); outline-offset: 2px; }
  @keyframes bar-quiet-in { from { opacity: 0; transform: translateY(-4px); } }

  /* the open menu: a full-screen solid sheet under the bar row (the row, with the close button, stays on top) */
  .barB__sheet {
    position: fixed; inset: 0; z-index: 1; display: block; overflow-y: auto; overscroll-behavior: contain;
    padding: calc(var(--bar-float) + var(--bar-island-height) + var(--space-5)) var(--space-4) var(--space-7);
    background: var(--color-ground); opacity: 0; visibility: hidden; transform: translateY(-10px);
    transition: opacity var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out), visibility 0s linear var(--dur-base);
  }
  .barB__sheet > div { overflow: visible; visibility: inherit; transition: none; }
  .barB:has(.menu-btn[aria-expanded='true']) .barB__sheet { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
  html:has(.menu-btn[aria-expanded='true']) { overflow: hidden; }
  .barB__sheetin { max-width: 40rem; margin: 0 auto; padding: 0; background: transparent; box-shadow: none; border-radius: 0; }
  .sheet-nav { grid-template-columns: minmax(0, 1fr); gap: var(--space-2); }
  .sheet-nav a { min-height: 64px; padding-inline: var(--space-5); border-radius: 20px; font-size: 1.25rem; }
  .sheet-cta { display: grid; gap: var(--space-3); margin-block-start: var(--space-5); }
  .sheet-cta .btn { justify-content: space-between; min-height: 64px; font-size: 1.1875rem; }
  .sheet-tools { margin-block-start: var(--space-5); }
}
@media (max-width: 599px) { .bar--past.barB .btn--signin { display: none; } }
/* the open menu lists Sign in only when the bar is not showing it (scrolled on a phone) */
@media (min-width: 600px) { .sheet-cta .btn--ghost { display: none; } }
@media (min-width: 360px) and (max-width: 599px) { .barB:not(.bar--past) .sheet-cta .btn--ghost { display: none; } }
/* MQC-2026-XXXX-XXXX must fit whole on a 320px phone (verify page and home) */
@media (max-width: 400px) { :is(#code, #home-code)::placeholder { font-size: 0.8em; } }

/* ---------- 21 Nov 2026, fix 5 (check 3: M15, L17, L18) ----------
 * L17: below 1160 Sign in and the scrolled-in Create account are ONE family: the same small quiet pill (44px high, 15px type, a 1.5px edge, no fill, no arrow tile).
 * M15: the same pill gives the label real room at 320 (14px each side, 12px under 380) in both languages.
 * L18: while the page has moved, the strip behind the island, up to the top edge and the safe area, is a solid ground (the hero's own ground over the hero, the page paper below it), and it takes the taps, so no page text shows above the bar.
 * Rules: KIT A (phone layout), v5 RULES P2 (solid fills, no gradients, no glass), P4 (44px taps, reduced motion). */
@media (max-width: 1159px) {
  .bar .btn--signin {
    --ps: 16px; --pe: 16px; --rs: 0px; min-height: var(--tap); border-radius: var(--radius-pill); background: transparent; color: var(--color-on-ground);
    font-size: 0.9375rem; line-height: 1.1;
  }
  .bar .btn--signin::before, .bar .btn--signin::after { display: none; }
  .bar .btn--signin:hover { background: color-mix(in srgb, var(--color-on-ground) 12%, transparent); }
}
@media (max-width: 440px) { .bar .btn--signin { --ps: 12px; --pe: 12px; } .bar--past .bar__quiet { padding-inline: 11px; } }
@media (max-width: 400px) { .bar .btn--signin { --ps: 10px; --pe: 10px; } .bar--past .bar__quiet { padding-inline: 9px; } }
@media (max-width: 340px) { .bar .btn--signin, .bar--past .bar__quiet { font-size: 0.875rem; } }
@media (prefers-reduced-motion: reduce) { .bar { transition: none; } }
@media (prefers-reduced-motion: reduce) { .bar--past .bar__quiet { animation: none; } .barB__sheet { transition: none; transform: none; } }

/* ---------- 21 Nov 2026, batch 4, header fix D: tight desktop bar ----------
 * Esslam / brief: at 1160 and wider the island content (name, links, language and theme, Sign in) must never run under the Create account pill.
 * shell.js measures the island with the links shown and adds .barB--tight when they do not fit; then the bar shows the menu button (as below 1160)
 * and the menu opens as a calm centred panel under the bar (not the full-screen phone sheet). The pill (Create account / My dashboard) stays beside the island.
 * Rules: KIT A (layout, one bar for every width), v5 RULES P2 (solid fill, no glass), P4 (44px taps, reduced motion). [CLAUDE-FILLED] for the panel width. */
@media (min-width: 1160px) {
  .barB.barB--tight .barB__nav, .barB.barB--tight .q-tools--bar { display: none; }
  .barB.barB--tight .menu-btn { display: inline-grid; }
  .barB.barB--tight .barB__sheet {
    display: grid; inset-inline: 0; margin-inline: auto; inline-size: min(44rem, calc(100% - 2 * var(--space-4)));
    padding-block-start: var(--space-1);
  }
  /* Create account and Sign in are already in the bar beside the island, so the panel does not repeat them */
  .barB.barB--tight .sheet-cta { display: none; }
}

/* 21 Nov, fix 6 (check 4, M3): Arabic labels are wider than English, so at laptop width the full nav fell back to the menu button.
   Tighter link padding and gap in Arabic make it fit again from 1160; the tight fallback in shell.js still runs when it truly does not fit.
   Taps stay 44px high. Rule: design-basics 2-fonts "Buttons and touch", KIT A (same product on every width). */
@media (min-width: 1160px) and (max-width: 1399px) {
  html[lang='ar'] .barB__nav a { padding-inline: 10px; }
  html[lang='ar'] .barB__in { gap: var(--space-3); }
}

/* 21 Nov, fix 6 (check 4, L12): the language and theme toggles in the menu sheet read as tiny. Taps were 44px already; now the words are 17px and the icon 24px.
   Rule: design-basics 2-fonts "Buttons and touch" (44px taps, readable size). */
.sheet-tools .q-seg a, .sheet-tools .q-seg button { font-size: 1.0625rem; padding-inline: var(--space-3); }
.sheet-tools .q-theme svg { inline-size: 24px; block-size: 24px; }

/* ---------- Language menu: one button, 33 native names (plain details/summary, no library) ----------
 * Taps are --tap (44px) high; the panel is a scrolling grid that fits 400px; the bar one drops below the button. */
.lang-menu { position: relative; display: inline-block; }
.lang-menu__btn {
  display: inline-flex; align-items: center; gap: var(--space-2); min-height: var(--tap); padding-inline: var(--space-3);
  border-radius: var(--radius-pill); cursor: pointer; list-style: none; font-size: var(--text-small); font-weight: 600;
  color: var(--q-ink-on, var(--color-on-ground));
}
.lang-menu__btn::-webkit-details-marker { display: none; }
.lang-menu__btn:focus-visible, .lang-menu__panel button:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.q-tools .lang-menu__panel, .lang-menu__panel {
  position: absolute; inset-inline-end: 0; inset-block-start: 100%; z-index: 60; display: grid; gap: var(--space-1);
  grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); inline-size: min(34rem, calc(100vw - 2 * var(--space-4)));
  max-block-size: min(70vh, 30rem); overflow-y: auto; padding: var(--space-3);
  background: var(--color-card); color: var(--color-ink); border: 1px solid var(--color-edge); border-radius: var(--radius-card);
  box-shadow: 0 12px 32px rgba(var(--color-shadow), .22);
}
.lang-menu__panel button {
  min-block-size: var(--tap); padding: 0 var(--space-3); border: 0; border-radius: var(--radius-pill); background: transparent;
  color: inherit; font: inherit; font-size: var(--text-small); cursor: pointer; text-align: start;
}
.lang-menu__panel button:hover { background: var(--color-tint); }
.lang-menu__panel button[aria-current='true'] { background: var(--color-tint); font-weight: 600; }
/* In the footer and the mobile sheet the list opens in the flow, so it never leaves the screen. */
.foot .lang-menu__panel, .sheet-tools .lang-menu__panel { position: static; inline-size: 100%; margin-block-start: var(--space-2); box-shadow: none; }
.foot .lang-menu, .sheet-tools .lang-menu { display: block; }
.foot .lang-menu__btn { color: var(--color-ink); }
.sheet-tools .lang-menu { flex: 1 1 100%; }
.tr-notice { margin: 0; padding: var(--space-2) var(--space-4); text-align: center; font-size: var(--text-small); color: var(--color-ink-soft); }
.tr-notice a { color: var(--color-link); text-underline-offset: 3px; }

/* ---------- 30 Nov, the Sheikh: the language button must be clear at the top on phones. Below 1160 (and on the tight desktop bar) it sits in the bar itself:
 * a bordered pill like Sign in, globe plus the language code (one width for all 33 languages). The list drops under the whole bar so it never leaves the screen.
 * Rules: KIT A (phone layout), v5 RULES P2 (solid fills), P4 (44px taps). ---------- */
.lang-menu__code { display: none; }
.barB .bar-lang { display: inline-flex; flex: none; }
.bar-lang .lang-menu { position: static; }
.bar-lang .lang-menu__btn {
  justify-content: center; gap: 5px; min-inline-size: var(--tap); padding-inline: 10px;
  border: 1px solid color-mix(in srgb, var(--color-on-ground) 38%, transparent);
}
/* Beats the page rule `details > summary:not(.btn)` that stacked the globe over the code. */
.lang-menu > .lang-menu__btn { display: inline-flex; padding-block: 0; }
.bar-lang .lang-menu > .lang-menu__btn:focus-visible, .q-tools--bar .lang-menu > .lang-menu__btn:focus-visible { outline-color: var(--color-focus-on-ground); }
.lang-menu__panel { overscroll-behavior: contain; }
.bar-lang .lang-menu__btn span { display: none; }
.bar-lang .lang-menu__code { display: inline; font-family: 'Instrument Sans', system-ui, sans-serif; font-size: 0.8125rem; font-weight: 600; line-height: 1; }
.barB .bar-lang .lang-menu__panel { inset-inline: 0; inset-block-start: calc(100% + var(--space-2)); margin-inline: auto; inline-size: min(34rem, 100%); }
@media (max-width: 400px) { .bar-lang .lang-menu__code { font-size: 0.75rem; } }
@media (max-width: 359px) { .bar-lang .lang-menu__code { display: none; } .bar-lang .lang-menu__btn { padding-inline: 0; } }
/* Scrolled past the hero on a phone, Create account joins the bar and there is no room for both; the language button is back at the top of the page. */
@media (max-width: 599px) { .barB.bar--past .bar-lang { display: none; } }
@media (min-width: 1160px) {
  .barB .bar-lang { display: none; }
  .barB.barB--tight .bar-lang { display: inline-flex; }
}
/* On phones the buttons never crowd the logo (12px at least). Long words may take a second line, broken only between words. */
@media (max-width: 599px) {
  .barB .barB__end { min-inline-size: 0; }
  .barB .barB__in > .brand { flex: none; margin-inline-end: 10px; }
  .barB .barB__end > .btn--signin, .barB.bar--past .barB__end > .bar__quiet { flex: 0 1 auto; min-inline-size: min-content; white-space: normal; text-align: center; line-height: 1.15; }
  .barB .barB__end > .menu-btn { flex: none; }
}
/* The narrowest phones: Sign in lives in the menu, so the long-word languages keep the menu button on screen. */
@media (max-width: 359px) { .barB .barB__end > .btn--signin { display: none; } }

/* Maqraa v7 site layer. Loads after maqraa.css and v7-tokens.css on every page.
   It keeps every class name the templates use and gives it the v7 look: flat solid colour, pill buttons,
   large radii, v7 type. No gradients, patterns or drawn objects (v7 landing RULES: solid shapes only).
   Colours come from v7-tokens.css; maqraa.css palette values already match them, so only shapes and type change here. */

:root {
  --font-ui: var(--font-body);
  --font-display: 'Crimson Pro', Georgia, 'Times New Roman', serif;   /* maqraa.css sets Amiri here and loads later; Arabic pages take the face from v7-tokens.css */
  --font-quran: "Muqraa Quran", "Amiri Quran", "Scheherazade New", "Noto Naskh Arabic", serif;
  --radius: var(--radius-card);
  --radius-sm: 18px;
  --shadow-sm: none;
  --shadow: none;
}
.v7home { --font-quran: "Scheherazade New", "Noto Naskh Arabic", serif; }

/* ---- base ---- */
body { font-family: var(--font-body); background: var(--color-paper); color: var(--color-ink); font-size: 1rem; line-height: 1.7; }
html[lang="en"] body { font-family: var(--font-body); line-height: 1.6; }
html[lang="ar"] body { font-size: var(--text-body); line-height: var(--text-body-lh); letter-spacing: 0; }
h1, h2, h3, h4 { font-family: var(--font-display); color: var(--color-ink); font-weight: 400; letter-spacing: var(--tracking-heading, 0); }
h1 { font-size: var(--text-statement); line-height: var(--text-statement-lh); }
h2 { font-size: var(--text-h3); line-height: var(--text-h3-lh); }
h3, .h3 { font-size: 1.25rem; }
html[lang="ar"] :where(h1, h2, h3, h4) { letter-spacing: 0; }
a { color: var(--color-link); }
:where(main, footer) a:hover { color: var(--color-green-hover); }
:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 3px; border-radius: 6px; }
.skip-link { background: var(--color-green); color: var(--color-on-green); border-radius: var(--radius-pill); }
.muted, .citation { color: var(--color-ink-soft); }
hr { border-block-start-color: var(--color-edge); }
.container { padding-inline: var(--gutter, 16px); }
@media (min-width: 720px) { .container { padding-inline: var(--gutter, 24px); } }

/* ---- main area under the floating bar ---- */
main.has-spacer { padding-block-start: calc(var(--bar-height) + var(--bar-float) + var(--space-5)); }
main.has-spacer.is-home { padding-block-start: 0; }

/* ---- page headers (templates/partials and page_header blocks) ---- */
.page-header { background: transparent; border-block-end: 1px solid var(--color-edge); padding-block: 0 var(--space-5); margin-block-end: var(--space-5); }
.page-header::after { content: none; }
.page-header h1 { font-size: var(--text-statement); line-height: var(--text-statement-lh); }
.page-header .subtitle, .breadcrumbs, .breadcrumbs a { color: var(--color-ink-soft); }
.breadcrumbs a:hover { color: var(--color-green); }

/* ---- sections ---- */
.section { padding-block: var(--space-7); }
.divider-ornament { color: var(--color-edge); }
.divider-ornament::before, .divider-ornament::after { background: var(--color-edge); }
.divider-ornament svg { display: none; }

/* ---- cards ---- */
.card { background: var(--color-card); border: 1px solid var(--color-edge); border-radius: var(--radius-card); box-shadow: none; padding: var(--space-5); }
.card-ornate { border-color: var(--color-edge); }
.card-ornate::before { content: none; }
a.card:hover { border-color: var(--color-green); box-shadow: none; color: inherit; }
.card-header h2, .card-header h3 { font-size: 1.2rem; }
.feature-card .icon { background: var(--color-green); color: var(--color-on-green); border-radius: var(--radius-sm); box-shadow: none; }
.feature-card p { color: var(--color-ink-soft); }
.stat { background: var(--color-card); border: 1px solid var(--color-edge); border-radius: var(--radius-card); border-inline-start: 1px solid var(--color-edge); padding: var(--space-4) var(--space-5); }
.stat .label { color: var(--color-ink-soft); }
.stat .value { color: var(--color-green); font-family: var(--font-display); }


/* ---- forms ---- */
input[type="text"], input[type="email"], input[type="password"], input[type="tel"], input[type="number"],
input[type="date"], input[type="datetime-local"], input[type="time"], input[type="search"], input[type="url"],
input[type="file"], select, textarea {
  background: var(--color-card); color: var(--color-ink); border: 1px solid var(--color-edge);
  border-radius: var(--radius-input); padding: .6rem 1.1rem; font-family: inherit;
}
textarea { border-radius: var(--radius-sm); padding: .8rem 1.1rem; }
input[type="file"] { border-radius: var(--radius-sm); }
input:focus, select:focus, textarea:focus { outline: 3px solid var(--color-focus); outline-offset: 1px; border-color: var(--color-focus); }
.field .help, .helptext { color: var(--color-ink-soft); }
.field .errorlist, .errorlist { color: var(--danger); }
.radio-cards label { border-radius: var(--radius-sm); border-color: var(--color-edge); background: var(--color-card); }
.radio-cards label:has(input:checked) { border-color: var(--color-green); box-shadow: 0 0 0 2px var(--color-tint); }

/* ---- tables ---- */
.table-wrap { border-radius: var(--radius-card); border-color: var(--color-edge); background: var(--color-card); }
.table th { background: var(--color-panel); color: var(--color-ink-soft); }
.table th, .table td { border-block-end-color: var(--color-edge); }
.table tbody tr:hover { background: var(--color-panel); }

/* ---- badges, alerts, lists, tabs ---- */
.badge { border-radius: var(--radius-pill); }
.badge-gold { background: var(--color-panel); color: var(--color-ink); border-color: var(--color-edge); }
.alert { border-radius: var(--radius-sm); }
.ai-suggestion { border-radius: var(--radius-sm); }
.list > li { border-block-end-color: var(--color-edge); }
.tabs { border-block-end-color: var(--color-edge); }
.tabs a[aria-current="page"], .tabs a.active { color: var(--color-green); border-block-end-color: var(--color-green); }
.pagination a, .pagination span { border-color: var(--color-edge); border-radius: var(--radius-pill); }
.pagination .current { background: var(--color-green); color: var(--color-on-green); border-color: var(--color-green); }
.progress > span { background: var(--color-green); }
.avatar { background: var(--color-tint); color: var(--color-green); }
.qr { border-radius: var(--radius-sm); border-color: var(--color-edge); }
.steps li { border-color: var(--color-edge); background: var(--color-panel); color: var(--color-ink-soft); }
.steps li.current { background: var(--color-green); color: var(--color-on-green); }
.steps li.current::before { background: var(--color-on-green); color: var(--color-green); }
/* 21 Nov, fix 6 (check 4, M10 and L8): the musnad steps are soft tinted rows, no vertical line and no dots; the path note has no coloured edge stripe.
   Rule: design-basics 5-anti-ai-checklist hard bans (a thin line between steps, a thick coloured line on a card edge). */
html .timeline { border-inline-start: 0; display: grid; gap: var(--space-2); }
html .timeline li { background: var(--color-tint); border-radius: 14px; padding: var(--space-3) var(--space-4); }
html .timeline li::before { content: none; }
html .neutral-note { border-inline-start: 0; background: var(--color-tint); }

/* ---- Quran and text pages: border is one solid hairline ---- */
.mushaf-page { border: 2px solid var(--color-edge); border-image: none; border-radius: var(--radius-card); box-shadow: none; }
.surah-header { background: var(--color-panel); border-block: 1px solid var(--color-edge); border-radius: var(--radius-sm); color: var(--color-ink); }
.certificate { border: 2px solid var(--color-edge); border-image: none; outline-color: var(--color-edge); border-radius: var(--radius-card); }

/* ---- isnad chart nodes: solid ---- */
.chain-node { border: 1px solid var(--color-edge); box-shadow: none; background: var(--color-card); }
.chain-node.terminal { background: var(--color-ground-2); color: var(--color-on-ground); border-color: var(--color-ground-2); }
.chain-node.terminal .meta { color: var(--color-on-ground-soft); }
.chain-edge { background: var(--color-edge); }

/* ---- sponsorship page hero: flat Ground panel (the page stays hidden from the menu) ---- */
.sp-hero { background: var(--color-ground); color: var(--color-on-ground); border-radius: var(--radius-panel); margin-inline: var(--gutter, 16px); padding-block: var(--space-8); }
.sp-hero::before { content: none; }
.sp-hero h1 { color: var(--color-on-ground); }
.sp-hero .lead { color: var(--color-on-ground-soft); }
.hero-logo { filter: none; }
.sp-hero .ayah-banner { color: var(--color-gold); }
.ornament-band { display: none; }

/* ---- plain-page bar tools that need no v7 landing markup ---- */
.messages { margin-block-start: var(--space-4); }

@media print {
  .bar, .footB, .skip { display: none !important; }
}

/* ---- links inside the dark bar and any Ground panel keep the panel's own ink (the plain-link green is for paper) ---- */
.bar a:not(.btn), .bar a:not(.btn):hover, .on-ground a:not(.btn), .on-ground a:not(.btn):hover { color: inherit; }

/* the desktop row is 1320 wide for everyone (Arabic words and the signed-in links are wider than 1180); signed-in links sit tighter.
   When even that does not fit, shell.js adds barB--tight and the bar uses the menu button (v7-shell.css, end of file) */
.barB__row { width: min(1320px, 100%); }
.barB--auth .barB__nav { gap: 0; }
.barB--auth .barB__nav a { padding-inline: 7px; }

/* the logo spot: the name in words for launch. This block, partials/brand_mark.html and the three includes are the only places to touch when the real logo arrives */
.wordmark { font-family: var(--font-brand); font-weight: 400; line-height: 1.15; letter-spacing: 0; color: var(--color-green); white-space: nowrap; }
.bar .wordmark, .hero .wordmark { color: var(--color-on-ground); }
.bar .wordmark { font-size: 1.75rem; }
html[lang='ar'] .bar .wordmark { font-size: 2rem; }
@media (max-width: 430px) { .bar .wordmark { font-size: 1.5rem; } html[lang='ar'] .bar .wordmark { font-size: 1.75rem; } }
.foot .wordmark { font-size: 2.25rem; }
html[lang='ar'] .foot .wordmark { font-size: 2.5rem; }

/* Logo 8a (round 6, refined from his pick 8 on 21 Nov 2026; approved by Esslam 21 Nov): the name drawn as one shape; sized by the wordmark font-size. */
.wordmark--logo { display: inline-block; line-height: 0; }
.wordmark__svg { display: block; height: 1.25em; width: auto; overflow: visible; }
