/* ---------------------------------------------------------------------------
   Shared tokens for the app (app.html) and the public pages (landing, legal).
   Every colour in styles.css and site.css resolves through a token here.
   The public pages carry data-theme="light" and stay light like
   s-o.solutions; the app follows the system into the navy dark theme.
   tests/test_tokens.py checks contrast in both themes.
   --------------------------------------------------------------------------- */

@font-face {
  font-family: "Newsreader";
  src: url("/assets/fonts/Newsreader-Roman.woff2") format("woff2");
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
}

@font-face {
  font-family: "Newsreader";
  src: url("/assets/fonts/Newsreader-Italic.woff2") format("woff2");
  font-style: italic;
  font-weight: 200 800;
  font-display: swap;
}

/* Local fallbacks scaled to Newsreader's measured widths (CoreText, wght 400,
   opsz 72): text drawn before the web font arrives keeps the same line
   breaks. Iowan ships on iPad and Mac, Georgia almost everywhere else. */
@font-face {
  font-family: "Newsreader Fallback";
  src: local("Iowan Old Style Roman"), local("IowanOldStyle-Roman");
  font-style: normal;
  size-adjust: 94%;
  ascent-override: 78%;
  descent-override: 28%;
  line-gap-override: 0%;
}

@font-face {
  font-family: "Newsreader Fallback";
  src: local("Iowan Old Style Italic"), local("IowanOldStyle-Italic");
  font-style: italic;
  size-adjust: 98%;
  ascent-override: 75%;
  descent-override: 27%;
  line-gap-override: 0%;
}

@font-face {
  font-family: "Newsreader Fallback Georgia";
  src: local("Georgia");
  font-style: normal;
  size-adjust: 94.7%;
  ascent-override: 77.6%;
  descent-override: 28%;
  line-gap-override: 0%;
}

@font-face {
  font-family: "Newsreader Fallback Georgia";
  src: local("Georgia Italic"), local("Georgia-Italic");
  font-style: italic;
  size-adjust: 83%;
  ascent-override: 88.5%;
  descent-override: 32%;
  line-gap-override: 0%;
}

:root {
  color-scheme: light;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 40px;
  --space-7: 64px;
  --space-8: 96px;

  --text-xs: 0.8125rem;
  --text-sm: 0.875rem;
  --text-base: clamp(0.94rem, 1.7vw, 1.04rem);
  --text-lg: clamp(1.06rem, 2.6vw, 1.3rem);
  --text-xl: clamp(1.55rem, 5vw, 2.35rem);
  --text-2xl: clamp(2rem, 7vw, 3.2rem);
  --text-display: clamp(2.9rem, 11.5vw, 6rem);
  --text-figure: clamp(4.6rem, 22vw, 10rem);

  --radius-sm: 6px;
  --radius-md: 20px;
  --radius-lg: 30px;
  --radius-pill: 999px;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-soft: cubic-bezier(0.2, 1.2, 0.3, 1);
  --dur-fast: 130ms;
  --dur-base: 260ms;

  /* Cool paper, white cards, navy ink, one Apple blue. Blue on the grey
     ground is 4.3:1, so blue text uses --accent-text. */
  --bg: #f4f5f7;
  --bg-deep: #e9ebef;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --ink: #0c1423;
  --ink-soft: #5d6677;
  --ink-faint: #646d7c;
  --line: #dfe3e8;
  --line-strong: #c3c9d2;
  --accent: #0071e3;
  --accent-hover: #0062c4;
  --accent-ink: #ffffff;
  --accent-text: #005bb5;
  --tint: #eaf2fd;
  --tint-ink: #005bb5;
  --bubble: #e9e9eb;
  --highlight: #ffe98a;
  --switch-on: #34c759;
  /* Second chart series (validated against --accent with the dataviz checks). */
  --chart-series-2: #eb6834;
  --success: #1c7a37;
  --warning: #8a5510;
  --danger: #c4302b;
  --focus: #0062c4;

  /* The one emphasised card (Pro): deeper blue so soft text still reads. */
  --inverse-bg: #0062c4;
  --inverse-ink: #ffffff;
  --inverse-soft: #dbe9fb;
  --inverse-accent: #ffffff;

  --shadow-low: 0 0 0 1px rgba(12, 20, 35, 0.05), 0 18px 40px -24px rgba(12, 28, 60, 0.28);
  --shadow-high: 0 0 0 1px rgba(12, 20, 35, 0.05), 0 24px 60px -28px rgba(12, 28, 60, 0.32);

  --header-height: 66px;
  --content-max: 1440px;
  --font-ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-editorial: "Newsreader", "Newsreader Fallback", "Newsreader Fallback Georgia", "Iowan Old Style", Georgia, serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;

    /* Deep navy for dim classrooms and evening work. */
    --bg: #061122;
    --bg-deep: #040b17;
    --surface: #0b1a31;
    --surface-raised: #0f213d;
    --ink: #eef2f8;
    --ink-soft: #a9b4c6;
    --ink-faint: #8a96aa;
    --line: #1c2c47;
    --line-strong: #2c3f5f;
    --accent: #3d95ff;
    --accent-hover: #6aafff;
    --accent-ink: #061122;
    --accent-text: #7fb6ff;
    --tint: #10284b;
    --tint-ink: #a9cdff;
    --bubble: #24314a;
    --highlight: #5a4710;
    --success: #4fd27a;
    --warning: #f0b453;
    --danger: #ff7a70;
    --focus: #7fb6ff;

    --shadow-low: 0 0 0 1px rgba(238, 242, 248, 0.06), 0 18px 40px -24px rgba(0, 0, 0, 0.8);
    --shadow-high: 0 0 0 1px rgba(238, 242, 248, 0.06), 0 24px 60px -28px rgba(0, 0, 0, 0.9);
  }
}
