/* ============================================================
   Tools.BD — Shared design foundations
   Single source of truth for:
     - self-hosted fonts (Inter / JetBrains Mono, CSP-clean),
     - the light + dark design token sets,
     - the responsive breakpoint scale (documented below).
   Loaded BEFORE /assets/style.css (public pages) and
   /panel/panel.css (user + admin panels) so both surfaces share
   one palette and one set of fonts.
   These are CSS custom properties only — class names remain the
   public contract inside style.css / panel.css. Rename nothing
   without grepping the whole frontend first.
   ============================================================ */

/* ---------------- Fonts ---------------- */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/inter-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/assets/fonts/inter-latin-500-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/assets/fonts/inter-latin-600-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/assets/fonts/inter-latin-700-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/jetbrains-mono-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/assets/fonts/jetbrains-mono-latin-600-normal.woff2') format('woff2');
}

/* ---------------- Design tokens (light) ---------------- */
:root {
  color-scheme: light;

  /* Surfaces — neutral, no blue cast */
  --bg: #f6f7f7;
  --panel: #ffffff;
  --panel-2: #f2f4f4;
  --border: #e3e6e8;
  --border-strong: #c9cfd3;

  /* Text */
  --text: #14181b;
  --muted: #5c666d;

  /* Brand — greens sampled from the Tools.BD logo; red reserved for errors */
  --head: #0b6e4f;
  --link: #0b6e4f;
  --accent: #0b7a56;
  --accent-strong: #085c41;
  --accent-soft: #e5f3ec;
  --accent-ring: rgba(11, 122, 86, 0.2);
  --on-accent: #ffffff;
  --brand-red: #d81e2c;

  /* Semantic */
  --pass: #0b7a56;
  --warn: #b45309;
  --fail: #d81e2c;
  --info: #1f6fae;

  /* Nav (glass, themed) */
  --nav-bg: rgba(255, 255, 255, 0.85);
  --nav-text: #14181b;
  --nav-link: #48525a;
  --nav-border: rgba(20, 24, 27, 0.08);

  /* Inputs / code */
  --input-bg: #ffffff;
  --code-bg: #14181b;
  --code-text: #e2e7e4;

  /* Tables */
  --table-even: rgba(20, 24, 27, 0.015);
  --table-hover: rgba(11, 122, 86, 0.05);
  --table-header-bg: #f4f6f6;
  --table-header-text: #5c666d;
  --table-border: #e9ecec;

  /* Tinted surfaces */
  --test-pass-bg: #e8f5ee;
  --test-warn-bg: #fdf4e3;
  --test-fail-bg: #fdecec;
  --test-info-bg: #e9f2f9;
  --tag-bg: #f2f4f4;
  --tag-border: #e3e6e8;
  --info-label-bg: #f7f8f8;

  /* Pre / raw blocks (always dark for premium contrast) */
  --pre-bg: #14181b;
  --pre-border: #2a3236;
  --pre-text: #d3dad6;

  /* Footer */
  --footer-bg: #ffffff;

  /* Grades */
  --badge-a-bg: #e8f5ee;
  --badge-a-text: #076246;
  --badge-b-bg: #f0f8ec;
  --badge-b-text: #47701d;
  --badge-c-bg: #fdf4e3;
  --badge-c-text: #96570a;
  --badge-d-bg: #fcefe4;
  --badge-d-text: #b04c12;
  --badge-f-bg: #fdecec;
  --badge-f-text: #ab1c28;

  /* Radii */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(20, 24, 27, 0.05);
  --shadow-md: 0 4px 14px rgba(20, 24, 27, 0.07);
  --shadow-lg: 0 16px 40px rgba(20, 24, 27, 0.14);

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  accent-color: var(--accent);
}

/* ---------------- Design tokens (dark) ---------------- */
[data-theme="dark"] {
  color-scheme: dark;

  --bg: #0e1315;
  --panel: #14191c;
  --panel-2: #1c2327;
  --border: #262e33;
  --border-strong: #3a444b;

  --text: #e4e9e7;
  --muted: #8d999f;

  --head: #35c08e;
  --link: #35c08e;
  --accent: #128a63;
  --accent-strong: #27b483;
  --accent-soft: rgba(24, 160, 115, 0.16);
  --accent-ring: rgba(24, 160, 115, 0.35);
  --on-accent: #ffffff;
  --brand-red: #f04352;

  --pass: #2fbf8f;
  --warn: #f5b83d;
  --fail: #f0565f;
  --info: #559fd4;

  --nav-bg: rgba(14, 19, 21, 0.8);
  --nav-text: #e4e9e7;
  --nav-link: #a3aeae;
  --nav-border: rgba(228, 233, 231, 0.09);

  --input-bg: #1a2125;
  --code-bg: #0e1315;
  --code-text: #d6ddd8;

  --table-even: rgba(255, 255, 255, 0.015);
  --table-hover: rgba(24, 160, 115, 0.09);
  --table-header-bg: #191f23;
  --table-header-text: #8d999f;
  --table-border: #262e33;

  --test-pass-bg: rgba(16, 185, 129, 0.10);
  --test-warn-bg: rgba(245, 158, 11, 0.10);
  --test-fail-bg: rgba(239, 68, 68, 0.10);
  --test-info-bg: rgba(56, 189, 248, 0.10);
  --tag-bg: #1c2327;
  --tag-border: #262e33;
  --info-label-bg: #191f23;

  --pre-bg: #0b0f11;
  --pre-border: #262e33;
  --pre-text: #c6cfc9;

  --footer-bg: #101619;

  --badge-a-bg: rgba(16, 185, 129, 0.12);
  --badge-a-text: #4ade9c;
  --badge-b-bg: rgba(132, 204, 22, 0.12);
  --badge-b-text: #a3d34a;
  --badge-c-bg: rgba(245, 158, 11, 0.12);
  --badge-c-text: #fbbf24;
  --badge-d-bg: rgba(249, 115, 22, 0.12);
  --badge-d-text: #fb923c;
  --badge-f-bg: rgba(239, 68, 68, 0.12);
  --badge-f-text: #f87171;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 44px rgba(0, 0, 0, 0.55);
}

/* System preference dark mode (manual toggle overrides via data-theme) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;

    --bg: #0e1315;
    --panel: #14191c;
    --panel-2: #1c2327;
    --border: #262e33;
    --border-strong: #3a444b;

    --text: #e4e9e7;
    --muted: #8d999f;

    --head: #35c08e;
    --link: #35c08e;
    --accent: #128a63;
    --accent-strong: #27b483;
    --accent-soft: rgba(24, 160, 115, 0.16);
    --accent-ring: rgba(24, 160, 115, 0.35);
    --on-accent: #ffffff;
    --brand-red: #f04352;

    --pass: #2fbf8f;
    --warn: #f5b83d;
    --fail: #f0565f;
    --info: #559fd4;

    --nav-bg: rgba(14, 19, 21, 0.8);
    --nav-text: #e4e9e7;
    --nav-link: #a3aeae;
    --nav-border: rgba(228, 233, 231, 0.09);

    --input-bg: #1a2125;
    --code-bg: #0e1315;
    --code-text: #d6ddd8;

    --table-even: rgba(255, 255, 255, 0.015);
    --table-hover: rgba(24, 160, 115, 0.09);
    --table-header-bg: #191f23;
    --table-header-text: #8d999f;
    --table-border: #262e33;

    --test-pass-bg: rgba(16, 185, 129, 0.10);
    --test-warn-bg: rgba(245, 158, 11, 0.10);
    --test-fail-bg: rgba(239, 68, 68, 0.10);
    --test-info-bg: rgba(56, 189, 248, 0.10);
    --tag-bg: #1c2327;
    --tag-border: #262e33;
    --info-label-bg: #191f23;

    --pre-bg: #0b0f11;
    --pre-border: #262e33;
    --pre-text: #c6cfc9;

    --footer-bg: #101619;

    --badge-a-bg: rgba(16, 185, 129, 0.12);
    --badge-a-text: #4ade9c;
    --badge-b-bg: rgba(132, 204, 22, 0.12);
    --badge-b-text: #a3d34a;
    --badge-c-bg: rgba(245, 158, 11, 0.12);
    --badge-c-text: #fbbf24;
    --badge-d-bg: rgba(249, 115, 22, 0.12);
    --badge-d-text: #fb923c;
    --badge-f-bg: rgba(239, 68, 68, 0.12);
    --badge-f-text: #f87171;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 16px 44px rgba(0, 0, 0, 0.55);
  }
}

/* ---------------- Breakpoints (use by value) ----------------
   CSS custom properties cannot be referenced inside @media queries,
   so these are documented here and used by literal value in the
   rules. Keep to this scale so responsive behavior is predictable:
     sm  640px   phones
     md  768px   tablets / mobile nav
     lg  1024px  small laptops
     xl  1200px  desktop nav collapse
   ------------------------------------------------------------ */
