/*
  Ludifica design tokens.

  Framework-neutral custom properties, shared by the public site and (later) the
  logged-in app pages. No selectors other than :root and the .ludi-surface-room
  scope below, no component styles. Every value here is a decision; components
  should consume these names rather than repeat raw values.

  Naming: --ludi-<group>-<role>[-<variant>]
    color   ink, paper, line, accent, role-*, room-*
    font    family, size (type scale), weight, leading, tracking
    space   4px-based scale
    radius, shadow, motion (duration, easing)
*/

/* Self-hosted faces (wwwroot/fonts/ludi, SIL OFL 1.1, licences next to the files).
   Both are variable fonts: one file per subset covers every weight. Only the latin
   and latin-ext subsets are shipped; the browser fetches latin-ext only for the
   characters in its unicode-range. The layouts preload the two latin files used
   above the fold (Familjen Grotesk, Atkinson Hyperlegible Next roman). */
@font-face {
  font-family: "Familjen Grotesk";
  src: url("/fonts/ludi/familjen-grotesk-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Familjen Grotesk";
  src: url("/fonts/ludi/familjen-grotesk-latin-ext.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("/fonts/ludi/atkinson-next-latin.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("/fonts/ludi/atkinson-next-latin-ext.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("/fonts/ludi/atkinson-next-italic-latin.woff2") format("woff2");
  font-weight: 200 800;
  font-style: italic;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("/fonts/ludi/atkinson-next-italic-latin-ext.woff2") format("woff2");
  font-weight: 200 800;
  font-style: italic;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* The body face (Atkinson Hyperlegible Next) draws zero with a slash, which
   pt-BR readers take for "Ø" in dates, PINs and prices. "Ludi Zero" maps only
   U+0030 to the display face and sits first in the body stack. */
@font-face {
  font-family: "Ludi Zero";
  src: url("/fonts/ludi/familjen-grotesk-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
  unicode-range: U+0030;
}

:root {
  /* ---------- Palette (raw) ---------------------------------------------
     Chalk and ink are the room; sky is the logo blue. The role colours are
     the only saturated hues on the page and they always carry meaning
     (what an interaction does), never decoration. */
  --ludi-chalk-50: #f7f9f8;
  --ludi-chalk-100: #eef2f1;
  --ludi-chalk-200: #dfe5e4;
  --ludi-chalk-300: #c5cfcf;

  --ludi-ink-900: #13232e;
  --ludi-ink-800: #1d3240;
  --ludi-ink-700: #33495a;
  --ludi-ink-600: #4b6070;
  --ludi-ink-500: #5d7080;

  --ludi-sky-300: #8fcde8;
  --ludi-sky-400: #48acd7; /* logo blue: fills and marks only, fails AA as text on light */
  --ludi-sky-600: #1f78a3;
  --ludi-sky-700: #165f82; /* text/link blue on light surfaces, 6.6:1 on chalk-50 */

  --ludi-room-950: #0c1c27;
  --ludi-room-900: #112634;
  --ludi-room-800: #183242;
  --ludi-room-700: #24435a;

  --ludi-marigold-400: #f3b73b;
  --ludi-marigold-700: #8a5a00;
  --ludi-mint-400: #5cc8a0;
  --ludi-mint-700: #1d6e51;
  --ludi-lilac-400: #b9a8f2;
  --ludi-lilac-700: #5a45a8;
  --ludi-coral-500: #c8433a;

  /* ---------- Semantic colour (light theme) ---------------------------- */
  --ludi-color-bg: var(--ludi-chalk-50);
  --ludi-color-bg-sunken: var(--ludi-chalk-100);
  --ludi-color-surface: #ffffff;
  --ludi-color-text: var(--ludi-ink-900);
  --ludi-color-text-muted: var(--ludi-ink-600); /* 6.2:1 on chalk-50 */
  --ludi-color-text-subtle: var(--ludi-ink-500); /* 4.9:1 on chalk-50, secondary text */
  --ludi-color-line: var(--ludi-chalk-200);
  --ludi-color-line-strong: var(--ludi-chalk-300);
  --ludi-color-link: var(--ludi-sky-700);
  --ludi-color-link-hover: var(--ludi-ink-900);
  --ludi-color-accent: var(--ludi-sky-400);
  --ludi-color-focus: var(--ludi-sky-600);

  --ludi-color-action-bg: var(--ludi-ink-900);
  --ludi-color-action-text: var(--ludi-chalk-50);
  --ludi-color-action-bg-hover: var(--ludi-sky-700);

  --ludi-color-success-bg: #e3f4ec;
  --ludi-color-success-text: var(--ludi-mint-700);
  --ludi-color-danger-bg: #fbe6e4;
  --ludi-color-danger-text: #9c2a22;

  /* Interaction roles (catalog.json "role"). Fill = mark/dot/bar,
     text = AA-safe label colour on light surfaces. */
  --ludi-role-capture: var(--ludi-sky-400);
  --ludi-role-capture-text: var(--ludi-sky-700);
  --ludi-role-generate: var(--ludi-marigold-400);
  --ludi-role-generate-text: var(--ludi-marigold-700);
  --ludi-role-decide: var(--ludi-mint-400);
  --ludi-role-decide-text: var(--ludi-mint-700);
  --ludi-role-facilitate: var(--ludi-lilac-400);
  --ludi-role-facilitate-text: var(--ludi-lilac-700);

  /* Device frames (host screen, phone). Neutral placeholder when no poster. */
  --ludi-device-bezel: #0f1a21;
  --ludi-device-bezel-edge: #2a3a45;
  --ludi-device-screen-empty: #23384a;

  /* ---------- Typography ----------------------------------------------- */
  --ludi-font-display: "Familjen Grotesk", "Helvetica Neue", Arial, sans-serif;
  --ludi-font-body: "Ludi Zero", "Atkinson Hyperlegible Next", "Segoe UI", system-ui, sans-serif;

  /* Modular scale, ratio 1.25 (major third) from a 17px body. Display steps
     use clamp() so headlines scale with the viewport without breakpoints. */
  --ludi-text-xs: 0.8125rem;   /* 13px  meta, captions */
  --ludi-text-sm: 0.9375rem;   /* 15px  secondary */
  --ludi-text-md: 1.0625rem;   /* 17px  body */
  --ludi-text-lg: 1.3125rem;   /* 21px  lead */
  --ludi-text-xl: 1.625rem;    /* 26px  h3 */
  --ludi-text-2xl: clamp(1.75rem, 1.2rem + 1.8vw, 2.5rem);    /* h2 */
  --ludi-text-3xl: clamp(2.25rem, 1.3rem + 3.6vw, 4.25rem);   /* page title */
  --ludi-text-4xl: clamp(2.5rem, 1.4rem + 3.4vw, 4.25rem);    /* hero */

  --ludi-weight-regular: 400;
  --ludi-weight-medium: 500;
  --ludi-weight-semibold: 600;
  --ludi-weight-bold: 700;

  --ludi-leading-tight: 1.02;
  --ludi-leading-snug: 1.2;
  --ludi-leading-body: 1.55;

  --ludi-tracking-display: -0.025em;
  --ludi-tracking-tight: -0.01em;

  --ludi-measure: 62ch;
  --ludi-measure-narrow: 44ch;

  /* ---------- Space (4px base) ----------------------------------------- */
  --ludi-space-1: 0.25rem;
  --ludi-space-2: 0.5rem;
  --ludi-space-3: 0.75rem;
  --ludi-space-4: 1rem;
  --ludi-space-5: 1.5rem;
  --ludi-space-6: 2rem;
  --ludi-space-7: 3rem;
  --ludi-space-8: 4rem;
  --ludi-space-9: 6rem;
  --ludi-space-10: 8rem;

  --ludi-section-pad: clamp(4rem, 2.5rem + 6vw, 8rem);
  --ludi-gutter: clamp(1rem, 0.5rem + 2.5vw, 2.5rem);
  --ludi-container: 76rem;

  /* ---------- Radius ---------------------------------------------------
     Hierarchy, not one-size: controls are small, panels medium, the stage
     (dark showcase blocks) large, phones their own. */
  --ludi-radius-xs: 4px;
  --ludi-radius-sm: 8px;
  --ludi-radius-md: 14px;
  --ludi-radius-lg: 28px;
  --ludi-radius-pill: 999px;
  --ludi-radius-phone: 2.2em; /* em: scales with the phone frame's font-size */

  /* ---------- Shadow --------------------------------------------------- */
  --ludi-shadow-sm: 0 1px 2px rgb(19 35 46 / 0.08);
  --ludi-shadow-md: 0 6px 18px -6px rgb(19 35 46 / 0.22);
  --ludi-shadow-device: 0 30px 60px -20px rgb(4 12 18 / 0.65), 0 12px 24px -12px rgb(4 12 18 / 0.5);

  /* ---------- Motion --------------------------------------------------- */
  --ludi-duration-fast: 120ms;
  --ludi-duration-base: 220ms;
  --ludi-duration-slow: 600ms;
  --ludi-ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);
  --ludi-ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
}

/* Dark showcase surface ("the room"). Apply .ludi-surface-room to a section
   and the semantic tokens flip; components inside need no dark variants. */
.ludi-surface-room {
  --ludi-color-bg: var(--ludi-room-900);
  --ludi-color-bg-sunken: var(--ludi-room-950);
  --ludi-color-surface: var(--ludi-room-800);
  --ludi-color-text: #eef4f7;
  --ludi-color-text-muted: #b2c3cf;   /* 8.6:1 on room-900 */
  --ludi-color-text-subtle: #8fa5b4;  /* 6.0:1 */
  --ludi-color-line: var(--ludi-room-700);
  --ludi-color-line-strong: #3a5a72;
  --ludi-color-link: var(--ludi-sky-300);
  --ludi-color-link-hover: #ffffff;
  --ludi-color-focus: var(--ludi-sky-300);
  --ludi-color-action-bg: var(--ludi-chalk-50);
  --ludi-color-action-text: var(--ludi-ink-900);
  --ludi-color-action-bg-hover: var(--ludi-sky-300);
  --ludi-role-capture-text: var(--ludi-sky-300);
  --ludi-role-generate-text: var(--ludi-marigold-400);
  --ludi-role-decide-text: var(--ludi-mint-400);
  --ludi-role-facilitate-text: var(--ludi-lilac-400);
  background-color: var(--ludi-color-bg);
  color: var(--ludi-color-text);
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --ludi-duration-fast: 0ms;
    --ludi-duration-base: 0ms;
    --ludi-duration-slow: 0ms;
  }
}
