/* ElasticForest identity shared (carried over from ForestMail) design tokens.
   One source of truth for color, type, spacing, radius, elevation and motion,
   shared by every surface (marketing, mail, calendar, admin, auth) so the
   product reads as one system in both light and dark — crafted to feel more
   polished and calmer than the competition, not merely functional.

   Theme model: light is the default. Dark applies under the OS preference,
   but a surface can force a theme with <html data-theme="light|dark">.
   Every existing --fm-* name is preserved; newer tokens (accent-2, ring,
   gradient, easing, header/overlay) are additive. */
:root {
  /* Brand — a confident emerald, warmer and more alive than a flat forest. */
  --fm-green: #14785c;
  --fm-green-strong: #0f5e49;
  --fm-green-soft: #e4f3ec;
  --fm-green-tint: #f0f8f3;
  --fm-accent: #8fe3b6;          /* luminous mint for highlights/gradient ends */
  --fm-accent-2: #d7a54a;        /* warm gold — stars, subtle secondary accents */
  --fm-brand-grad: linear-gradient(135deg, #14785c 0%, #1f9c6e 55%, #43c489 100%);

  /* Neutrals — a clean, faintly warm paper that makes color pop. */
  --fm-bg: #f3f6f3;
  --fm-surface: #ffffff;
  --fm-surface-2: #f5f8f5;
  --fm-surface-3: #eef3ee;
  --fm-line: #e4eae3;
  --fm-line-soft: #eef2ec;

  --fm-text: #16231f;
  --fm-text-soft: #45584f;
  --fm-text-muted: #4c5951; /* darkened from #6a7b70 (4.12:1 on --fm-bg, 4.49:1 on white — both fail WCAG AA at the small sizes this is used at); axe's real-pixel sampling at 11-12px text needs real margin above the 4.5:1 floor to not flake, so this targets ~6.5-7.4:1 (see #170 evidence) */
  --fm-text-invert: #f3faf4;

  --fm-link: #10795d;
  --fm-focus: #35b487;
  --fm-ring: 0 0 0 3px rgba(53, 180, 135, .35);   /* focus ring / selection glow */

  /* Semantic status */
  --fm-danger: #b0472c; --fm-danger-bg: #fbeae4;
  --fm-warn: #8a6a1f; --fm-warn-bg: #fbf4e4;
  --fm-ok: #145a3a; --fm-ok-bg: #e6f4ec; /* darkened from #1f8a5a (3.82:1 on --fm-ok-bg, fails WCAG AA); targets ~7.3:1 for margin against axe's pixel-sampling variance at small sizes (see #170 evidence) */
  --fm-info: #2f6f95; --fm-info-bg: #e7f0f6;

  /* Typography */
  --fm-font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  --fm-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --fm-fs-0: 11px; --fm-fs-1: 12px; --fm-fs-2: 13.5px; --fm-fs-3: 15px;
  --fm-fs-4: 18px; --fm-fs-5: 23px; --fm-fs-6: 29px; --fm-fs-7: 38px; --fm-fs-8: 52px;

  /* Spacing scale (4px base) */
  --fm-s-1: 4px; --fm-s-2: 8px; --fm-s-3: 12px; --fm-s-4: 16px;
  --fm-s-5: 20px; --fm-s-6: 24px; --fm-s-7: 32px; --fm-s-8: 48px; --fm-s-9: 64px;

  /* Radius — a little rounder reads friendlier and more modern. */
  --fm-r-1: 8px; --fm-r-2: 11px; --fm-r-3: 15px; --fm-r-4: 20px; --fm-r-pill: 999px;

  /* Elevation — soft, layered, low-contrast so depth feels expensive. */
  --fm-shadow-1: 0 1px 2px rgba(16,40,32,.05), 0 2px 6px rgba(16,40,32,.05);
  --fm-shadow-2: 0 4px 14px rgba(16,40,32,.08), 0 10px 30px rgba(16,40,32,.07);
  --fm-shadow-3: 0 12px 28px rgba(16,40,32,.12), 0 30px 70px rgba(16,40,32,.16);

  /* Motion — one calm easing family; snappy but not abrupt. */
  --fm-dur: .16s;
  --fm-dur-2: .26s;
  --fm-ease: cubic-bezier(.2, .7, .2, 1);
  --fm-ease-out: cubic-bezier(0, .6, .3, 1);

  --fm-header-bg: rgba(255,255,255,.78);   /* translucent sticky chrome */
  --fm-overlay: rgba(14,28,22,.42);
  --fm-gutter: 16px;
  --fm-maxw: 1200px;
}

:root[data-theme="dark"],
:root:not([data-theme="light"]) {
  color-scheme: light;
}

/* Dark palette — deep and desaturated, never pure black; mint stays vivid. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --fm-green: #4cc896;
    --fm-green-strong: #6fd8ac;
    --fm-green-soft: #16342a;
    --fm-green-tint: #12271f;
    --fm-accent: #3f7a60;
    --fm-accent-2: #d8b25f;
    --fm-brand-grad: linear-gradient(135deg, #1f9c6e 0%, #36b981 55%, #58d79b 100%);

    --fm-bg: #0d1813;
    --fm-surface: #121f19;
    --fm-surface-2: #172720;
    --fm-surface-3: #1d2f27;
    --fm-line: #273b32;
    --fm-line-soft: #21342c;

    --fm-text: #e9f1ea;
    --fm-text-soft: #c2d3c8;
    --fm-text-muted: #8ea396;
    --fm-text-invert: #0d1813;

    --fm-link: #6fd8ac;
    --fm-focus: #4cc896;
    --fm-ring: 0 0 0 3px rgba(76,200,150,.38);

    --fm-danger: #ee9b84; --fm-danger-bg: #3a1f17;
    --fm-warn: #ddc078; --fm-warn-bg: #332a15;
    --fm-ok: #71d3a0; --fm-ok-bg: #123026;
    --fm-info: #8fc0e0; --fm-info-bg: #13262f;

    --fm-shadow-1: 0 1px 2px rgba(0,0,0,.35), 0 2px 8px rgba(0,0,0,.3);
    --fm-shadow-2: 0 6px 18px rgba(0,0,0,.45), 0 14px 36px rgba(0,0,0,.4);
    --fm-shadow-3: 0 16px 36px rgba(0,0,0,.55), 0 34px 80px rgba(0,0,0,.6);

    --fm-header-bg: rgba(18,31,25,.72);
    --fm-overlay: rgba(0,0,0,.55);
  }
}

/* Explicit dark override, independent of OS preference */
:root[data-theme="dark"] {
  color-scheme: dark;
  --fm-green: #4cc896;
  --fm-green-strong: #6fd8ac;
  --fm-green-soft: #16342a;
  --fm-green-tint: #12271f;
  --fm-accent: #3f7a60;
  --fm-accent-2: #d8b25f;
  --fm-brand-grad: linear-gradient(135deg, #1f9c6e 0%, #36b981 55%, #58d79b 100%);
  --fm-bg: #0d1813;
  --fm-surface: #121f19;
  --fm-surface-2: #172720;
  --fm-surface-3: #1d2f27;
  --fm-line: #273b32;
  --fm-line-soft: #21342c;
  --fm-text: #e9f1ea;
  --fm-text-soft: #c2d3c8;
  --fm-text-muted: #8ea396;
  --fm-text-invert: #0d1813;
  --fm-link: #6fd8ac;
  --fm-focus: #4cc896;
  --fm-ring: 0 0 0 3px rgba(76,200,150,.38);
  --fm-danger: #ee9b84; --fm-danger-bg: #3a1f17;
  --fm-warn: #ddc078; --fm-warn-bg: #332a15;
  --fm-ok: #71d3a0; --fm-ok-bg: #123026;
  --fm-info: #8fc0e0; --fm-info-bg: #13262f;
  --fm-shadow-1: 0 1px 2px rgba(0,0,0,.35), 0 2px 8px rgba(0,0,0,.3);
  --fm-shadow-2: 0 6px 18px rgba(0,0,0,.45), 0 14px 36px rgba(0,0,0,.4);
  --fm-shadow-3: 0 16px 36px rgba(0,0,0,.55), 0 34px 80px rgba(0,0,0,.6);
  --fm-header-bg: rgba(18,31,25,.72);
  --fm-overlay: rgba(0,0,0,.55);
}

/* ---- Colour palettes -------------------------------------------------------
   Four simple choices, applied with <html data-palette="..."> (forest is the
   default and needs no attribute). Each overrides the brand and neutral tones
   for light and dark; nothing else changes. Kept after the dark blocks above so
   it wins at equal specificity. */
:root[data-palette="ocean"] {
  --fm-green: #1b6fb5;
  --fm-green-strong: #134f86;
  --fm-green-soft: #e3eefa;
  --fm-green-tint: #f0f6fc;
  --fm-accent: #9cc9f0;
  --fm-brand-grad: linear-gradient(135deg, #1b6fb5 0%, #2d8bd6 55%, #5fb0ee 100%);
  --fm-link: #1a68ab;
  --fm-focus: #3b95dd;
  --fm-ring: 0 0 0 3px rgba(59, 149, 221, .35);
  --fm-bg: #f2f5f9;
  --fm-surface-2: #f4f7fb;
  --fm-surface-3: #edf2f8;
  --fm-line: #e1e8f0;
  --fm-line-soft: #ebf0f6;
  --fm-text-muted: #667788;
}
:root[data-palette="ocean"][data-theme="dark"] {
  --fm-green: #6cb4f0;
  --fm-green-strong: #92c8f5;
  --fm-green-soft: #15283a;
  --fm-green-tint: #101f2e;
  --fm-accent: #3d6a94;
  --fm-brand-grad: linear-gradient(135deg, #2d78b8 0%, #3f94d6 55%, #6cb4f0 100%);
  --fm-link: #7cbcf0;
  --fm-focus: #4a9de0;
  --fm-ring: 0 0 0 3px rgba(74, 157, 224, .4);
  --fm-bg: #0c1520;
  --fm-surface: #111d2b;
  --fm-surface-2: #162434;
  --fm-surface-3: #1c2d40;
  --fm-line: #263a50;
  --fm-line-soft: #203245;
  --fm-text-muted: #8a9db0;
}
@media (prefers-color-scheme: dark) {
  :root[data-palette="ocean"]:not([data-theme="light"]) {
    --fm-green: #6cb4f0;
    --fm-green-strong: #92c8f5;
    --fm-green-soft: #15283a;
    --fm-green-tint: #101f2e;
    --fm-accent: #3d6a94;
    --fm-brand-grad: linear-gradient(135deg, #2d78b8 0%, #3f94d6 55%, #6cb4f0 100%);
    --fm-link: #7cbcf0;
    --fm-focus: #4a9de0;
    --fm-ring: 0 0 0 3px rgba(74, 157, 224, .4);
    --fm-bg: #0c1520;
    --fm-surface: #111d2b;
    --fm-surface-2: #162434;
    --fm-surface-3: #1c2d40;
    --fm-line: #263a50;
    --fm-line-soft: #203245;
    --fm-text-muted: #8a9db0;
  }
}
:root[data-palette="sunset"] {
  --fm-green: #c4571d;
  --fm-green-strong: #9a4214;
  --fm-green-soft: #fbebe0;
  --fm-green-tint: #fdf4ee;
  --fm-accent: #f3b88f;
  --fm-brand-grad: linear-gradient(135deg, #c4571d 0%, #e0742d 55%, #f2a15f 100%);
  --fm-link: #b24c16;
  --fm-focus: #e0742d;
  --fm-ring: 0 0 0 3px rgba(224, 116, 45, .35);
  --fm-bg: #f8f4f0;
  --fm-surface-2: #faf6f2;
  --fm-surface-3: #f4eee8;
  --fm-line: #ebe2d9;
  --fm-line-soft: #f2ebe4;
  --fm-text-muted: #7d6e62;
}
:root[data-palette="sunset"][data-theme="dark"] {
  --fm-green: #f0a169;
  --fm-green-strong: #f5be91;
  --fm-green-soft: #3a2418;
  --fm-green-tint: #2a1a11;
  --fm-accent: #8a5a3a;
  --fm-brand-grad: linear-gradient(135deg, #c4571d 0%, #e0742d 55%, #f0a169 100%);
  --fm-link: #f2ad7c;
  --fm-focus: #e98a4d;
  --fm-ring: 0 0 0 3px rgba(233, 138, 77, .4);
  --fm-bg: #17110c;
  --fm-surface: #1e1611;
  --fm-surface-2: #261c16;
  --fm-surface-3: #2f241c;
  --fm-line: #43342a;
  --fm-line-soft: #392c23;
  --fm-text-muted: #a59384;
}
@media (prefers-color-scheme: dark) {
  :root[data-palette="sunset"]:not([data-theme="light"]) {
    --fm-green: #f0a169;
    --fm-green-strong: #f5be91;
    --fm-green-soft: #3a2418;
    --fm-green-tint: #2a1a11;
    --fm-accent: #8a5a3a;
    --fm-brand-grad: linear-gradient(135deg, #c4571d 0%, #e0742d 55%, #f0a169 100%);
    --fm-link: #f2ad7c;
    --fm-focus: #e98a4d;
    --fm-ring: 0 0 0 3px rgba(233, 138, 77, .4);
    --fm-bg: #17110c;
    --fm-surface: #1e1611;
    --fm-surface-2: #261c16;
    --fm-surface-3: #2f241c;
    --fm-line: #43342a;
    --fm-line-soft: #392c23;
    --fm-text-muted: #a59384;
  }
}
:root[data-palette="graphite"] {
  --fm-green: #3f4b5b;
  --fm-green-strong: #2b3440;
  --fm-green-soft: #e6e9ee;
  --fm-green-tint: #f1f3f6;
  --fm-accent: #aab4c2;
  --fm-brand-grad: linear-gradient(135deg, #3f4b5b 0%, #566478 55%, #7a8aa0 100%);
  --fm-link: #3a4a5f;
  --fm-focus: #6b7c93;
  --fm-ring: 0 0 0 3px rgba(107, 124, 147, .35);
  --fm-bg: #f3f4f6;
  --fm-surface-2: #f6f7f9;
  --fm-surface-3: #eceef2;
  --fm-line: #e2e5ea;
  --fm-line-soft: #eceff2;
  --fm-text-muted: #6b7482;
}
:root[data-palette="graphite"][data-theme="dark"] {
  --fm-green: #aab6c6;
  --fm-green-strong: #c8d0dc;
  --fm-green-soft: #222a35;
  --fm-green-tint: #1a2029;
  --fm-accent: #5d6b7e;
  --fm-brand-grad: linear-gradient(135deg, #566478 0%, #7a8aa0 55%, #aab6c6 100%);
  --fm-link: #b9c4d3;
  --fm-focus: #8ea0b8;
  --fm-ring: 0 0 0 3px rgba(142, 160, 184, .4);
  --fm-bg: #0f1217;
  --fm-surface: #151a21;
  --fm-surface-2: #1b212a;
  --fm-surface-3: #222a34;
  --fm-line: #303a47;
  --fm-line-soft: #28313c;
  --fm-text-muted: #8c96a5;
}
@media (prefers-color-scheme: dark) {
  :root[data-palette="graphite"]:not([data-theme="light"]) {
    --fm-green: #aab6c6;
    --fm-green-strong: #c8d0dc;
    --fm-green-soft: #222a35;
    --fm-green-tint: #1a2029;
    --fm-accent: #5d6b7e;
    --fm-brand-grad: linear-gradient(135deg, #566478 0%, #7a8aa0 55%, #aab6c6 100%);
    --fm-link: #b9c4d3;
    --fm-focus: #8ea0b8;
    --fm-ring: 0 0 0 3px rgba(142, 160, 184, .4);
    --fm-bg: #0f1217;
    --fm-surface: #151a21;
    --fm-surface-2: #1b212a;
    --fm-surface-3: #222a34;
    --fm-line: #303a47;
    --fm-line-soft: #28313c;
    --fm-text-muted: #8c96a5;
  }
}
