/* Design tokens — source of truth: docs/design-system.md §9. Do not add colors here without adding them there first. */

@font-face {
  font-family: "Vazirmatn";
  src: url("../fonts/Vazirmatn-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  /* brand */
  --brand-orange: #F47B20;
  --brand-orange-dark: #D9661A;
  --brand-amber: #F7A11A;
  --brand-navy: #1C2E63;
  --brand-blue: #2F4FA0;
  --brand-blue-light: #A9D4EA;

  /* semantic */
  --red: #E31E24;
  --green: #33A853;
  --green-text: #1B7F37;
  --yellow-mark: #FFF200;
  --warning-bg: #FFF4D6;
  --warning-text: #8A5A00;
  --success-bg: #E3F3E8;
  --error-bg: #FCE4E4;

  /* neutrals & tints */
  --ink: #1A1A1A;
  --charcoal: #2B2B2B;
  --gray-600: #5B6473;
  --gray-300: #D9DEE7;
  --gray-200: #E6E9F0;
  --gray-100: #F3F5F9;
  --white: #FFFFFF;
  --tint-blue: #E4EBF6;
  --tint-peach: #FBE2CF;
  --tint-periwinkle: #C3CCE6;

  /* tracks (رشته) */
  --track-math: #3D6EAE;      --track-math-tint: #D9E7F6;
  --track-exp: #8E3233;       --track-exp-tint: #F7E2E2;
  --track-hum: #7F9C3B;       --track-hum-tint: #E4EDD3;

  /* performance scale for reports (design-system §2.4b) */
  --perf-1: #FCE4E4; --perf-1-text: #B3171C;
  --perf-2: #FBE2CF; --perf-2-text: #9A4A0F;
  --perf-3: #FFF4D6; --perf-3-text: #8A5A00;
  --perf-4: #E3F3E8; --perf-4-text: #1B7F37;
  --perf-5: #BFE3CB; --perf-5-text: #145F2A;

  /* surfaces and one-off tints, named so the dark theme can swap them (design-system §2.6, 2026-10-18) */
  --surface: var(--white);    /* cards, tables, popovers, dialogs */
  --surface-soft: #FAFBFD;    /* hovered or striped row, a quiet panel inside a card */
  --surface-sunk: #F6F8FC;    /* striped report row, table group header */
  --line-soft: #F1F3F7;       /* row dividers inside a card */
  --gray-400: #B7BECB; --gray-500: #8C95A8; --gray-700: #4A5262;
  --mark-correct: #7CC59A; --mark-correct-text: #0F4D24;
  --mark-wrong: #F08C8C;
  --mark-trap: #F6B47F;    --mark-trap-text: #7A3A06;
  --mark-blank: #E1E5EC;
  --hl: #FFF8F2; --hl-strong: #FFF1E4;   /* "this is me / this one" rows */
  --success-line: #BFE3CB; --error-line: #F3C2C2;
  --note-bg: #FFF8E6; --note-text: #5A4A1A; --note-field: #FFFDF6;
  --primary-hover: #142249;
  --sidebar-bg: var(--brand-navy);
  --bubble-1: rgb(169 212 234 / .6); --bubble-2: rgb(251 226 207 / .95); --bubble-3: rgb(169 212 234 / .45);

  /* aliases used by components */
  --bg: var(--white);
  --bg-alt: var(--gray-100);
  --text: #141B34;
  --text-muted: var(--gray-600);
  --border: var(--gray-200);
  --link: var(--brand-blue);
  --heading: var(--brand-navy);
  --primary: var(--brand-navy);
  --primary-contrast: var(--white);
  --accent: var(--brand-orange);
  --accent-contrast: var(--ink);

  /* type */
  --font-sans: "Vazirmatn", "IRANSansX", "Segoe UI", Tahoma, sans-serif;
  --font-mono: "Vazir Code", ui-monospace, Consolas, monospace;
  --lh-body: 1.8;
  --lh-heading: 1.3;

  /* shape */
  /* v0.2 (direction E1): rounder, pill buttons, soft layered shadows */
  --r-sm: 10px; --r-md: 14px; --r-lg: 22px; --r-pill: 999px;
  --r-btn: var(--r-pill);
  --shadow-1: 0 1px 2px rgb(28 46 99 / .05), 0 4px 14px rgb(28 46 99 / .05);
  --shadow-2: 0 10px 30px rgb(28 46 99 / .10);
  --shadow-glass: 0 10px 30px rgb(0 0 0 / .18);
  --focus-ring: rgb(244 123 32 / .20);
  --hero-overlay: linear-gradient(to left, rgb(28 46 99 / .96), rgb(28 46 99 / .80) 45%, rgb(28 46 99 / .45));

  /* spacing */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-6: 24px;
  --s-8: 32px; --s-12: 48px; --s-16: 64px; --s-24: 96px;
}

/* Dark theme (design-system §2.7; design/dark-mode-showcase.html B «گرافیت», decided 2026-10-18). <html data-theme> is set
   before first paint from the user's choice (Layout/ThemeSwitch.razor: light, follow the device, dark). Only the signed-in
   pages follow it (the panel and the review page); the public site and the login stay light, and print is always light. */
@media screen {
  :root[data-theme="dark"]:has(.panel, .focus) {
    color-scheme: dark;
    --bg-alt: #0F1115;
    --surface: #171A20; --surface-soft: #1B1F26; --surface-sunk: #1D2129; --line-soft: #222730;
    --gray-100: #13161B; --gray-200: #2A2F38; --gray-300: #3A404B; --gray-400: #555D6B; --gray-500: #7D8594;
    --gray-600: #A0A7B4; --gray-700: #C9CED8;
    --text: #E6E8EC; --ink: #EBEDF0; --charcoal: #D3D6DC; --heading: #F5F6F8; --text-muted: #A0A7B4; --link: #8DB1FF;
    --brand-navy: #3456B0; --brand-blue: #4467C6; --brand-blue-light: #3B4F7E; --primary-hover: #3F63C2;
    --sidebar-bg: #0A0C0F;
    --tint-blue: #1C2538; --tint-peach: #33241A; --tint-periwinkle: #283048;
    --green: #3DBA63; --green-text: #6FD594; --success-bg: #12271A; --success-line: #22482F;
    --red: #F0565B; --error-bg: #34171A; --error-line: #5E2A2D;
    --warning-bg: #2E2610; --warning-text: #F0C35E;
    --perf-1: #34171A; --perf-1-text: #FF9EA0;
    --perf-2: #352418; --perf-2-text: #F6B17F;
    --perf-3: #2E2610; --perf-3-text: #F0C35E;
    --perf-4: #12271A; --perf-4-text: #7FD69F;
    --perf-5: #18402A; --perf-5-text: #A4EABD;
    --track-math: #8FB4E8; --track-math-tint: #1A2536;
    --track-exp: #E59092;  --track-exp-tint: #321B1C;
    --track-hum: #B5CF80;  --track-hum-tint: #222A19;
    --mark-correct: #3B925F; --mark-correct-text: #E1F7E9; --mark-wrong: #BB5555;
    --mark-trap: #BB763F; --mark-trap-text: #FFE9D6; --mark-blank: #2B3038;
    --hl: #292220; --hl-strong: #372820;
    --note-bg: #2B2716; --note-text: #EADCA8; --note-field: #1A1C1E;
    --bubble-1: transparent; --bubble-2: transparent; --bubble-3: transparent;
    --accent-contrast: #1A1A1A;
    --primary-contrast: #FFFFFF;
    --bg: var(--surface);
    --border: var(--gray-200);
    --focus-ring: rgb(244 123 32 / .38);
    --shadow-1: 0 1px 2px rgb(0 0 0 / .35), 0 4px 14px rgb(0 0 0 / .22);
    --shadow-2: 0 10px 30px rgb(0 0 0 / .45);
    /* Bootstrap's own controls (forms, checkboxes) read these */
    --bs-body-bg: var(--surface);
    --bs-body-color: var(--text);
    --bs-border-color: var(--gray-300);
    --bs-secondary-bg: var(--gray-100);
    --bs-tertiary-bg: var(--surface-soft);
    --bs-emphasis-color: var(--heading);
    --bs-secondary-color: var(--text-muted);
    --bs-heading-color: var(--heading);
  }
  :root[data-theme="dark"]:has(.panel, .focus) .form-select {
    --bs-form-select-bg-img: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23dee2e6' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
  }
  /* question images are white scans: they stay white, a touch dimmed so they do not glare */
  :root[data-theme="dark"]:has(.panel, .focus) :is(.qdlg__b, .sp-qimg, .st-qimg, .rv-imgs, .nb-thumb, .qtip) img { filter: brightness(.93); border-radius: 6px; }
}
