/* ===========================================================================
   MailGuardHQ design tokens - the single source of colour, type, space, radius
   and elevation for the marketing site AND (later) the app. Nothing else in the
   codebase may hard-code a hex value, a px font size or a shadow.

   Theme states, deliberately three:
     :root                                  -> light palette (the base)
     @media (prefers-color-scheme: dark)     -> dark, guarded so an explicit
       :root:not([data-theme="light"])          light choice still wins
     :root[data-theme="dark"]               -> explicit dark choice
   =========================================================================== */

:root {
  /* ---- brand ---------------------------------------------------------- */
  --mg-brand-ink: #0d1b2a;      /* deep navy - the security-product base   */
  --mg-brand-accent: #0e8f7e;   /* guard teal - the single confident hue   */
  --mg-brand-accent-strong: #0a6f62;
  --mg-brand-accent-soft: #d7f0ec;

  /* ---- surfaces + text (light) ---------------------------------------- */
  --mg-bg: #f6f8fa;
  --mg-bg-alt: #eef2f6;
  --mg-surface: #ffffff;
  --mg-surface-raised: #ffffff;
  --mg-surface-sunken: #f1f4f8;
  --mg-border: #d8e0e8;
  --mg-border-strong: #b7c3d0;

  --mg-text: #10202f;
  --mg-text-muted: #51677c;
  --mg-text-faint: #7b8da0;
  --mg-text-invert: #ffffff;

  --mg-accent: var(--mg-brand-accent);
  --mg-accent-hover: var(--mg-brand-accent-strong);
  --mg-accent-contrast: #ffffff;
  --mg-accent-soft: var(--mg-brand-accent-soft);
  --mg-focus: #1668d6;

  /* ---- verdict semantics ---------------------------------------------
     pass / warn / fail / not-applicable. "Not applicable" is deliberately a
     NEUTRAL slate, never a red or amber - a parked domain with no MX is
     correct, not broken, and colouring it as a failure is a lie. */
  --mg-pass: #1a7f4b;
  --mg-pass-bg: #dff3e6;
  --mg-pass-border: #9ed5b5;

  --mg-warn: #96610a;
  --mg-warn-bg: #fdf0d5;
  --mg-warn-border: #e8c384;

  --mg-fail: #b3261e;
  --mg-fail-bg: #fce8e6;
  --mg-fail-border: #efb4ae;

  --mg-na: #5a6a7a;
  --mg-na-bg: #eceff3;
  --mg-na-border: #c2ccd7;

  --mg-info: #1a5fb4;
  --mg-info-bg: #e3edfb;
  --mg-info-border: #a8c6ee;

  /* ---- type ------------------------------------------------------------ */
  --mg-font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mg-font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;

  --mg-fs-xs: 0.78rem;
  --mg-fs-sm: 0.875rem;
  --mg-fs-base: 1rem;
  --mg-fs-md: 1.075rem;
  --mg-fs-lg: 1.25rem;
  --mg-fs-xl: 1.5rem;
  --mg-fs-2xl: 1.95rem;
  --mg-fs-3xl: clamp(2.1rem, 1.4rem + 2.6vw, 3.1rem);
  --mg-fs-4xl: clamp(2.6rem, 1.5rem + 4vw, 4rem);

  --mg-lh-tight: 1.18;
  --mg-lh-snug: 1.35;
  --mg-lh-normal: 1.62;

  --mg-fw-normal: 400;
  --mg-fw-medium: 550;
  --mg-fw-bold: 680;

  /* ---- space ----------------------------------------------------------- */
  --mg-space-1: 0.25rem;
  --mg-space-2: 0.5rem;
  --mg-space-3: 0.75rem;
  --mg-space-4: 1rem;
  --mg-space-5: 1.5rem;
  --mg-space-6: 2rem;
  --mg-space-7: 3rem;
  --mg-space-8: 4rem;
  --mg-space-9: 6rem;

  /* ---- shape + elevation ----------------------------------------------- */
  --mg-radius-sm: 6px;
  --mg-radius-md: 10px;
  --mg-radius-lg: 16px;
  --mg-radius-pill: 999px;

  --mg-shadow-sm: 0 1px 2px rgba(13, 27, 42, 0.07), 0 1px 3px rgba(13, 27, 42, 0.05);
  --mg-shadow-md: 0 4px 12px rgba(13, 27, 42, 0.08), 0 2px 4px rgba(13, 27, 42, 0.05);
  --mg-shadow-lg: 0 18px 42px rgba(13, 27, 42, 0.12), 0 4px 10px rgba(13, 27, 42, 0.06);

  /* ---- layout ---------------------------------------------------------- */
  --mg-shell-max: 1140px;
  --mg-prose-max: 68ch;
  --mg-header-h: 68px;

  --mg-motion-fast: 120ms;
  --mg-motion-base: 220ms;
  --mg-ease: cubic-bezier(0.2, 0.6, 0.3, 1);
}

/* ---- dark: OS preference, unless an explicit light choice is stored ----- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --mg-bg: #0b1520;
    --mg-bg-alt: #0f1c29;
    --mg-surface: #13212f;
    --mg-surface-raised: #172836;
    --mg-surface-sunken: #0d1a26;
    --mg-border: #263a4c;
    --mg-border-strong: #375066;

    --mg-text: #e9f0f6;
    --mg-text-muted: #a3b6c8;
    --mg-text-faint: #7d92a6;
    --mg-text-invert: #0b1520;

    --mg-accent: #2fbfa8;
    --mg-accent-hover: #55d3bf;
    --mg-accent-contrast: #06231f;
    --mg-accent-soft: #113630;
    --mg-focus: #6aa9f5;

    --mg-pass: #58d497;
    --mg-pass-bg: #102e21;
    --mg-pass-border: #1f6746;

    --mg-warn: #f0be6a;
    --mg-warn-bg: #33260f;
    --mg-warn-border: #7a5a20;

    --mg-fail: #f4907f;
    --mg-fail-bg: #351815;
    --mg-fail-border: #7d3a31;

    --mg-na: #9db0c2;
    --mg-na-bg: #1a2836;
    --mg-na-border: #35485c;

    --mg-info: #8dbaf5;
    --mg-info-bg: #12263c;
    --mg-info-border: #2d4d75;

    --mg-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --mg-shadow-md: 0 4px 14px rgba(0, 0, 0, 0.45);
    --mg-shadow-lg: 0 20px 46px rgba(0, 0, 0, 0.55);
  }
}

/* ---- dark: explicit choice (wins in both directions) -------------------- */
:root[data-theme="dark"] {
  --mg-bg: #0b1520;
  --mg-bg-alt: #0f1c29;
  --mg-surface: #13212f;
  --mg-surface-raised: #172836;
  --mg-surface-sunken: #0d1a26;
  --mg-border: #263a4c;
  --mg-border-strong: #375066;

  --mg-text: #e9f0f6;
  --mg-text-muted: #a3b6c8;
  --mg-text-faint: #7d92a6;
  --mg-text-invert: #0b1520;

  --mg-accent: #2fbfa8;
  --mg-accent-hover: #55d3bf;
  --mg-accent-contrast: #06231f;
  --mg-accent-soft: #113630;
  --mg-focus: #6aa9f5;

  --mg-pass: #58d497;
  --mg-pass-bg: #102e21;
  --mg-pass-border: #1f6746;

  --mg-warn: #f0be6a;
  --mg-warn-bg: #33260f;
  --mg-warn-border: #7a5a20;

  --mg-fail: #f4907f;
  --mg-fail-bg: #351815;
  --mg-fail-border: #7d3a31;

  --mg-na: #9db0c2;
  --mg-na-bg: #1a2836;
  --mg-na-border: #35485c;

  --mg-info: #8dbaf5;
  --mg-info-bg: #12263c;
  --mg-info-border: #2d4d75;

  --mg-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --mg-shadow-md: 0 4px 14px rgba(0, 0, 0, 0.45);
  --mg-shadow-lg: 0 20px 46px rgba(0, 0, 0, 0.55);
}
