/* ==========================================================================
   Design tokens: the ONLY place for colours, fonts and the scales.
   Brand: Public Aspirants. Deep navy primary, warm gold accent,
   white and light-grey surfaces. Thin borders, very little shadow.
   ========================================================================== */

/* ---- Fonts (bundled locally; see assets/fonts/) ----
   One stack: Inter draws English letters and 0-9. Li Ador Noirrit draws every Bangla
   letter AND every Bangla digit (০-৯, U+09E6-09EF), so digits always match the letters.
   Noto Sans Bengali is only a fallback for the few rare Bangla signs Li Ador does not have
   (ঌ ৄ ৠ-ৣ and some currency/fraction signs). It never covers Bangla digits.
   Inter's ranges never include U+0980-09FF (Bengali block) or U+200C-200D (ZWNJ/ZWJ).
   Li Ador Noirrit is a commercial font (Lipighor Font Foundry). The file is used exactly as
   supplied (not converted or subset); see assets/fonts/LICENCE-LiAdorNoirrit.txt. */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/Inter-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-200B, U+200E-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/Inter-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* Bangla text: Li Ador Noirrit (variable, weight axis 100-500; its own "Regular" is 300).
   See the [lang="bn"] weight tokens below. */
@font-face {
  font-family: 'Li Ador Noirrit';
  font-style: normal;
  font-weight: 100 500;
  font-display: swap;
  src: url('../fonts/LiAdorNoirritVR-VF.ttf') format('truetype');
  unicode-range: U+0964-0965, U+0980-0983, U+0985-098B, U+098D-0990, U+0993-09A8, U+09AA-09B0, U+09B2, U+09B6-09B9, U+09BC-09C3, U+09C7-09C8, U+09CB-09CE, U+09D7, U+09DC-09DD, U+09DF, U+09F0-09F1, U+09F3, U+09FA, U+09FD, U+200C-200D, U+25CC;
}
/* Bangla digits ০-৯: same family, SAME FILE as Bangla text, so ১ always matches the letters. */
@font-face {
  font-family: 'Li Ador Noirrit';
  font-style: normal;
  font-weight: 100 500;
  font-display: swap;
  src: url('../fonts/LiAdorNoirritVR-VF.ttf') format('truetype');
  unicode-range: U+09E6-09EF;
}
/* Fallback only for Bangla signs missing from Li Ador Noirrit. Digits are NOT in this range. */
@font-face {
  font-family: 'Noto Sans Bengali';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/NotoSansBengali-Variable-bengali.woff2') format('woff2');
  unicode-range: U+0951-0952, U+098C, U+09C4, U+09E0-09E3, U+09F2, U+09F4-09F9, U+09FB-09FC, U+09FE, U+1CD0, U+1CD2, U+1CD5-1CD6, U+1CD8, U+1CE1, U+1CEA, U+1CED, U+1CF2, U+1CF5-1CF7, U+20B9, U+A8F1;
}

:root {
  /* ---- Font ---- */
  --font-sans: 'Inter', 'Li Ador Noirrit', 'Noto Sans Bengali', system-ui, -apple-system, 'Segoe UI', 'Nirmala UI', 'Vrinda', sans-serif;
  --font-mono: ui-monospace, Consolas, 'Courier New', 'Li Ador Noirrit', 'Noto Sans Bengali', monospace;  /* Bangla digits in code text also use Li Ador */
  --root-size: 100%;
  --root-size-bn: 106.25%;   /* Bangla glyphs need a touch more size to match Inter visually */
  --leading: 1.55;
  --leading-bn: 1.7;
  --leading-tight: 1.25;

  /* ---- Type scale (rem) ---- */
  --text-xs: .75rem;
  --text-sm: .875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.375rem;
  --text-2xl: 1.75rem;
  --text-3xl: 2.25rem;
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;

  /* ---- Spacing scale (4px base) ---- */
  --s-1: .25rem;   /*  4 */
  --s-2: .5rem;    /*  8 */
  --s-3: .75rem;   /* 12 */
  --s-4: 1rem;     /* 16 */
  --s-5: 1.5rem;   /* 24 */
  --s-6: 2rem;     /* 32 */
  --s-7: 3rem;     /* 48 */
  --s-8: 4rem;     /* 64 */

  /* ---- Brand palette ---- */
  --navy-950: #0b1730;
  --navy-900: #0f1f3d;
  --navy-800: #16294d;
  --navy-700: #1c3461;
  --navy-600: #2a4578;
  --navy-100: #e6ebf4;
  --navy-50:  #f3f5fa;
  --gold-700: #8a6518;
  --gold-500: #c49a3c;
  --gold-100: #f7efdc;
  --white: #ffffff;
  --grey-25:  #fafbfc;
  --grey-50:  #f5f6f8;
  --grey-100: #eef0f4;
  --grey-200: #e3e7ed;
  --grey-300: #cfd5de;
  --grey-500: #6b7487;
  --grey-600: #535c6e;
  --grey-900: #141b2b;
  --green-700: #1a6e45;
  --green-50:  #e8f3ed;
  --red-700: #a8261c;
  --red-50:  #fbeceb;
  --red-100: #f6d9d6;
  --amber-700: #8a5a00;
  --amber-50:  #fdf4e0;

  /* ---- Roles (components use only these) ---- */
  --c-bg: var(--grey-50);
  --c-surface: var(--white);
  --c-surface-2: var(--grey-25);
  --c-surface-3: var(--grey-100);
  --c-text: var(--grey-900);
  --c-muted: var(--grey-600);
  --c-faint: var(--grey-500);
  --c-border: var(--grey-200);
  --c-border-strong: var(--grey-300);

  --c-primary: var(--navy-700);
  --c-primary-hover: var(--navy-800);
  --c-primary-active: var(--navy-900);
  --c-primary-ink: var(--white);
  --c-primary-soft: var(--navy-100);
  --c-primary-tint: var(--navy-50);

  --c-accent: var(--gold-700);       /* gold text/icons on light backgrounds (AA contrast) */
  --c-accent-line: var(--gold-500);  /* gold rules and bars */
  --c-accent-soft: var(--gold-100);

  --c-success: var(--green-700);
  --c-success-soft: var(--green-50);
  --c-danger: var(--red-700);
  --c-danger-soft: var(--red-50);
  --c-danger-soft-hover: var(--red-100);
  --c-warning: var(--amber-700);
  --c-warning-soft: var(--amber-50);

  --c-demo-bg: var(--navy-950);
  --c-demo-ink: var(--white);
  --c-demo-accent: var(--gold-500);
  --c-demo-line: rgba(255, 255, 255, .35);

  --c-backdrop: rgba(11, 23, 48, .5);
  --swatch-navy: #1c3461;     /* palette samples on the Account page (step 7) */
  --swatch-green: #0b5e55;
  --swatch-maroon: #7a2038;
  --swatch-gold: #c49a3c;  /* behind dialogs (question list, hand-in check) */

  --c-toast-bg: var(--navy-950);
  --c-toast-ink: var(--white);
  --c-focus: var(--navy-600);
  --c-theme: var(--navy-700);  /* browser UI colour on phones; read by src/brand.js */

  /* ---- Shape, depth, focus ---- */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --border: 1px solid var(--c-border);
  --shadow-overlay: 0 8px 24px rgba(11, 23, 48, .14);  /* only for floating things (toasts) */
  --focus-ring: 0 0 0 2px var(--c-surface), 0 0 0 4px var(--c-focus);

  /* ---- Layout ---- */
  --tap: 2.75rem;        /* 44px minimum tap target */
  --topbar-h: 3.75rem;
  --tap-answer: 3.5rem;  /* answer buttons on the exam screen: bigger than the minimum */
  --container: 70rem;
  --container-narrow: 28rem;
}

/* Li Ador Noirrit's weight scale is one step lighter than CSS: its Regular is 300 and its
   Bold is 500 (the axis stops there). Bangla text (the Bangla UI, and Bangla question content
   marked lang="bn") uses these values. Inter clamps 300 to its lightest weight, 400. */
[lang="bn"] {
  --weight-regular: 300;
  --weight-medium: 400;
  --weight-semibold: 500;
  --weight-bold: 500;
}
/* English inside a Bangla page (e.g. the language switch, English question content) goes back
   to the normal scale. */
[lang="en"] {
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;
}

/* ==========================================================================
   Colour palettes and themes (step 7). Chosen per device on the Account page
   (src/ui/theme.js sets html[data-palette] and html[data-theme]).
   A palette changes only the primary colour family; gold accents stay.
   Dark colours apply on screen only: printouts and PDFs are always light.
   ========================================================================== */
[data-palette="green"] {      /* the dark green of the logo */
  --c-primary: #0b5e55;
  --c-primary-hover: #084a43;
  --c-primary-active: #063a35;
  --c-primary-soft: #d8ece8;
  --c-primary-tint: #eef7f5;
  --c-focus: #0b5e55;
  --c-theme: #0b5e55;
}
[data-palette="maroon"] {
  --c-primary: #7a2038;
  --c-primary-hover: #651a2e;
  --c-primary-active: #50142a;
  --c-primary-soft: #f3dde3;
  --c-primary-tint: #faf0f3;
  --c-focus: #7a2038;
  --c-theme: #7a2038;
}

@media screen {
  html[data-theme="dark"] {
    color-scheme: dark;
    --c-bg: #0e131d;
    --c-surface: #151c28;
    --c-surface-2: #19212f;
    --c-surface-3: #212a3a;
    --c-text: #e7ebf2;
    --c-muted: #aab3c4;
    --c-faint: #8c95a7;
    --c-border: #2a3345;
    --c-border-strong: #3a4559;
    --c-primary: #8fb0f0;
    --c-primary-hover: #a9c3f5;
    --c-primary-active: #c3d5f8;
    --c-primary-ink: #0b1730;
    --c-primary-soft: #22314f;
    --c-primary-tint: #182238;
    --c-accent: #e3bc63;
    --c-accent-line: #c49a3c;
    --c-accent-soft: #2e2717;
    --c-success: #6fd39d;
    --c-success-soft: #10291d;
    --c-danger: #ff9a90;
    --c-danger-soft: #3b1916;
    --c-danger-soft-hover: #4b201c;
    --c-warning: #f3c063;
    --c-warning-soft: #33280f;
    --c-toast-bg: #2a3448;
    --c-toast-ink: #ffffff;
    --c-focus: #8fb0f0;
    --c-theme: #151c28;
    --c-backdrop: rgba(0, 0, 0, .6);
  }
  html[data-theme="dark"][data-palette="green"] {
    --c-primary: #6fcdbc;
    --c-primary-hover: #8ad8ca;
    --c-primary-active: #a6e2d7;
    --c-primary-ink: #062a26;
    --c-primary-soft: #183a35;
    --c-primary-tint: #13221f;
    --c-focus: #6fcdbc;
  }
  html[data-theme="dark"][data-palette="maroon"] {
    --c-primary: #f09ab0;
    --c-primary-hover: #f4b1c2;
    --c-primary-active: #f7c7d3;
    --c-primary-ink: #3a0d19;
    --c-primary-soft: #3d1c25;
    --c-primary-tint: #26141a;
    --c-focus: #f09ab0;
  }
}
@media screen and (prefers-color-scheme: dark) {
  html[data-theme="system"] {
    color-scheme: dark;
    --c-bg: #0e131d;
    --c-surface: #151c28;
    --c-surface-2: #19212f;
    --c-surface-3: #212a3a;
    --c-text: #e7ebf2;
    --c-muted: #aab3c4;
    --c-faint: #8c95a7;
    --c-border: #2a3345;
    --c-border-strong: #3a4559;
    --c-primary: #8fb0f0;
    --c-primary-hover: #a9c3f5;
    --c-primary-active: #c3d5f8;
    --c-primary-ink: #0b1730;
    --c-primary-soft: #22314f;
    --c-primary-tint: #182238;
    --c-accent: #e3bc63;
    --c-accent-line: #c49a3c;
    --c-accent-soft: #2e2717;
    --c-success: #6fd39d;
    --c-success-soft: #10291d;
    --c-danger: #ff9a90;
    --c-danger-soft: #3b1916;
    --c-danger-soft-hover: #4b201c;
    --c-warning: #f3c063;
    --c-warning-soft: #33280f;
    --c-toast-bg: #2a3448;
    --c-toast-ink: #ffffff;
    --c-focus: #8fb0f0;
    --c-theme: #151c28;
    --c-backdrop: rgba(0, 0, 0, .6);
  }
  html[data-theme="system"][data-palette="green"] {
    --c-primary: #6fcdbc;
    --c-primary-hover: #8ad8ca;
    --c-primary-active: #a6e2d7;
    --c-primary-ink: #062a26;
    --c-primary-soft: #183a35;
    --c-primary-tint: #13221f;
    --c-focus: #6fcdbc;
  }
  html[data-theme="system"][data-palette="maroon"] {
    --c-primary: #f09ab0;
    --c-primary-hover: #f4b1c2;
    --c-primary-active: #f7c7d3;
    --c-primary-ink: #3a0d19;
    --c-primary-soft: #3d1c25;
    --c-primary-tint: #26141a;
    --c-focus: #f09ab0;
  }
}
