/* ==========================================================================
   inote — design tokens
   Light and dark themes. Every page links this file first, then base.css.
   js/theme.js sets <html data-theme="light|dark"> before first paint (user choice
   in Settings, or the system setting). Dark values live in the block at the end.
   Sky blue («хөх тэнгэр») is the one accent; sun gold is the warm secondary
   and always means "important" («Чухал») or "pay attention".
   Contrast ratios in comments are WCAG 2.x, measured against the named surface.
   ========================================================================== */

:root {
  color-scheme: light;

  /* ---- Colour: surfaces -------------------------------------------------- */
  --bg: #F3F7FC;            /* page background */
  --surface: #FFFFFF;       /* cards, sheets, inputs */
  --surface-2: #E9EFF8;     /* wells, hover fill, skeleton, segmented track */

  /* ---- Colour: text ------------------------------------------------------ */
  --ink: #0D1B2E;           /* primary text      16.1:1 on bg, 17.3:1 on surface */
  --ink-2: #40506A;         /* secondary text     7.6:1 on bg,  8.2:1 on surface */
  --ink-3: #5C6B84;         /* hints, placeholder 5.0:1 on bg,  5.4:1 on surface, 4.7:1 on surface-2 */

  /* ---- Colour: lines ----------------------------------------------------- */
  --line: #D9E2EE;          /* hairlines, dividers (decorative) */
  --line-strong: #7C8AA1;   /* form control borders 3.5:1 on surface, 3.3:1 on bg */

  /* ---- Colour: accent (sky blue) ---------------------------------------- */
  --accent: #0B63E0;        /* fills, links       5.4:1 with white, 5.0:1 on bg */
  --accent-hover: #0958CB;  /* hover fill */
  --accent-strong: #0A4DB3; /* pressed fill; accent text on accent-soft (6.5:1) */
  --accent-ink: #FFFFFF;    /* text and icons ON an accent fill */
  --accent-soft: #E2EDFD;   /* tinted surface */
  --accent-soft-2: #CCDFFB; /* pressed tint, selection, focus halo */

  /* ---- Colour: warm (sun gold) ------------------------------------------ */
  --warm: #FFB224;          /* fill only — never text on a light surface */
  --warm-hover: #F5A30F;
  --warm-ink: #3A2400;      /* text and icons ON a warm fill (8.1:1) */
  --warm-strong: #8A5200;   /* warm text on surface (6.4:1) and on warm-soft (5.7:1) */
  --warm-soft: #FFF1D1;

  /* ---- Colour: status ---------------------------------------------------- */
  --success: #087450;       /* 5.8:1 with white, 5.1:1 on success-soft */
  --success-soft: #DDF5EA;
  --warning: #9A5600;       /* 5.7:1 on surface, 5.0:1 on warning-soft */
  --warning-soft: #FFF0D4;
  --warning-ink: #FFFFFF;   /* glyph ON a warning fill (5.7:1) */
  --danger: #C92234;        /* 5.6:1 with white, 4.7:1 on danger-soft */
  --danger-hover: #B41D2E;
  --danger-strong: #A01828;
  --danger-soft: #FDE7EA;
  --danger-ink: #FFFFFF;    /* text and icons ON a danger fill (5.6:1) */

  /* ---- Colour: utility --------------------------------------------------- */
  --focus: #0B63E0;                       /* focus ring */
  --backdrop: rgb(13 27 46 / 0.42);       /* sheet backdrop */
  --toast-bg: #0D1B2E;
  --toast-ink: #FFFFFF;
  --toast-ok: #5EE0A8;                    /* 10.5:1 on toast-bg */
  --toast-err: #FF8A95;                   /*  7.7:1 on toast-bg */

  /* Channels for alpha mixing: rgb(var(--ink-rgb) / 0.08) */
  --bg-rgb: 243 247 252;
  --ink-rgb: 13 27 46;
  --accent-rgb: 11 99 224;
  --warm-rgb: 255 178 36;

  /* ---- Colour: listening circle (listen view) --------------------------- */
  --listen-quiet: #8DB8F5;  /* idle breathing ring */
  --listen-voice: #0B63E0;  /* normal speech */
  --listen-loud: #FFB224;   /* loud peaks shift toward sun gold */
  --listen-paused: #B4BFCE; /* frozen, grey */
  --listen-halo: #E2EDFD;   /* outermost soft ring */

  /* ---- Colour: interaction fills (tokenised so dark mode can swap them) ---- */
  --hover-fill: #F6F9FD;     /* hover on white rows, chips, neutral buttons */
  --accent-pressed: #B9D3F9; /* pressed secondary button */
  --danger-pressed: #FAD3D8; /* pressed quiet destructive button */
  --scrollbar: #B4BFCE;
  --shimmer-rgb: 255 255 255;
  --shimmer-alpha: 0.75;

  /* ---- Typography -------------------------------------------------------- */
  /* System fonts only. All of these carry Mongolian Cyrillic (Ө ө Ү ү) and ₮. */
  --font-sans: -apple-system, system-ui, "SF Pro Text", "Segoe UI", Roboto, "Noto Sans",
    "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;

  --text-xs: 0.75rem;       /* 12 — badges, legal footnotes */
  --text-sm: 0.875rem;      /* 14 — meta, hints, labels */
  --text-md: 1rem;          /* 16 — body, inputs, buttons */
  --text-lg: 1.125rem;      /* 18 — card titles, lead */
  --text-xl: 1.375rem;      /* 22 — section titles (h2) */
  --text-2xl: 1.75rem;      /* 28 — page titles (h1) */
  --text-3xl: 2.25rem;      /* 36 — stats */
  --text-4xl: 3rem;         /* 48 — big stats */
  --text-5xl: 3.75rem;      /* 60 — timer */
  --text-display: clamp(2.375rem, 1.5rem + 4.4vw, 4.25rem); /* landing hero only */

  --leading-tight: 1.15;
  --leading-snug: 1.3;
  --leading-normal: 1.5;

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

  --tracking-tight: -0.02em;
  --tracking-normal: 0;

  /* ---- Spacing (4px grid) ------------------------------------------------ */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-20: 80px;
  --space-24: 96px;

  /* ---- Radii ------------------------------------------------------------- */
  --radius-xs: 6px;
  --radius-sm: 10px;        /* segmented item, small buttons */
  --radius-md: 14px;        /* buttons, inputs */
  --radius-lg: 20px;        /* cards, lists, banners */
  --radius-xl: 28px;        /* sheets */
  --radius-full: 999px;     /* chips, badges, icon buttons */

  /* ---- Shadows (ink-tinted, always offset + blur) ------------------------ */
  --shadow-1: 0 1px 2px rgb(13 27 46 / 0.05), 0 2px 8px rgb(13 27 46 / 0.05);
  --shadow-2: 0 2px 4px rgb(13 27 46 / 0.05), 0 8px 20px rgb(13 27 46 / 0.09);
  --shadow-3: 0 4px 10px rgb(13 27 46 / 0.06), 0 20px 48px rgb(13 27 46 / 0.16);
  --shadow-up: 0 -2px 6px rgb(13 27 46 / 0.04), 0 -12px 40px rgb(13 27 46 / 0.14);
  --shadow-accent: 0 1px 2px rgb(11 99 224 / 0.3), 0 5px 14px rgb(11 99 224 / 0.24);

  /* ---- Motion ------------------------------------------------------------ */
  --dur-1: 120ms;           /* press feedback, colour */
  --dur-2: 180ms;           /* hover, small state changes */
  --dur-3: 240ms;           /* exits, dialog enter */
  --dur-4: 320ms;           /* toast, larger moves */
  --dur-5: 450ms;           /* bottom sheet enter */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);       /* entering, responding */
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);   /* moving on screen */
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);    /* bottom sheet */
  --ease-soft: ease;                                /* colour, hover */

  /* ---- Z-index ----------------------------------------------------------- */
  --z-base: 0;
  --z-raised: 1;
  --z-sticky: 100;          /* topbar, bottom-bar */
  --z-backdrop: 200;
  --z-sheet: 210;
  --z-toast: 300;

  /* ---- Layout ------------------------------------------------------------ */
  --w-narrow: 440px;        /* auth, single forms */
  --w-sheet: 480px;         /* dialog width on desktop */
  --w-app: 720px;           /* app column */
  --w-site: 1120px;         /* landing */
  --gutter: 16px;
  --tap: 48px;              /* minimum touch target */
  --control-h: 48px;        /* button height */
  --control-h-lg: 56px;
  --input-h: 52px;
  --topbar-h: 56px;

  /* ---- Safe areas -------------------------------------------------------- */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

@media (min-width: 600px) {
  :root {
    --gutter: 24px;
  }
}

/* ---- Dark theme ------------------------------------------------------------
   Deep navy, same one accent. Ratios measured on the dark surfaces:
   ink 15.9:1 on bg · ink-2 8.8:1 on surface · ink-3 6.1:1 on surface ·
   accent text 5.6:1 on bg · accent-ink on accent 5.6:1 · line-strong 3.6:1 on surface. */
:root[data-theme="dark"] {
  color-scheme: dark;

  --bg: #0B1220;
  --surface: #131C2E;
  --surface-2: #1C2740;

  --ink: #E7EDF6;
  --ink-2: #AEBBD0;
  --ink-3: #8E9CB4;

  --line: #26324A;
  --line-strong: #64748F;

  --accent: #3D8BFD;
  --accent-hover: #5B9BFF;
  --accent-strong: #8AB8FF;
  --accent-ink: #06101F;
  --accent-soft: #16294A;
  --accent-soft-2: #1F3A66;

  --warm: #FFB224;
  --warm-hover: #FFC14D;
  --warm-ink: #2A1A00;
  --warm-strong: #FFC857;
  --warm-soft: #3A2A0E;

  --success: #4CD49A;
  --success-soft: #0F3226;
  --warning: #F2B04A;
  --warning-soft: #3A2A0E;
  --warning-ink: #2A1A00;   /* 8.9:1 on warning */
  --danger: #FF6B7A;
  --danger-hover: #FF8592;
  --danger-strong: #FF9AA5;
  --danger-soft: #3A1620;
  --danger-ink: #2A0A10;    /* 6.6:1 on danger */

  --focus: #5B9BFF;
  --backdrop: rgb(0 0 0 / 0.6);
  --toast-bg: #E7EDF6;
  --toast-ink: #0B1220;
  --toast-ok: #087450;
  --toast-err: #C92234;

  --bg-rgb: 11 18 32;
  --ink-rgb: 231 237 246;
  --accent-rgb: 61 139 253;
  --warm-rgb: 255 178 36;

  --listen-quiet: #3E6FB8;
  --listen-voice: #3D8BFD;
  --listen-loud: #FFB224;
  --listen-paused: #4A5872;
  --listen-halo: #14223D;

  --hover-fill: #18233A;
  --accent-pressed: #24457A;
  --danger-pressed: #4A1C27;
  --scrollbar: #3A4760;
  --shimmer-rgb: 255 255 255;
  --shimmer-alpha: 0.06;

  --shadow-1: 0 1px 2px rgb(0 0 0 / 0.4), 0 2px 8px rgb(0 0 0 / 0.25);
  --shadow-2: 0 2px 4px rgb(0 0 0 / 0.4), 0 8px 20px rgb(0 0 0 / 0.35);
  --shadow-3: 0 4px 10px rgb(0 0 0 / 0.45), 0 20px 48px rgb(0 0 0 / 0.5);
  --shadow-up: 0 -2px 6px rgb(0 0 0 / 0.35), 0 -12px 40px rgb(0 0 0 / 0.5);
  --shadow-accent: 0 1px 2px rgb(61 139 253 / 0.3), 0 5px 14px rgb(61 139 253 / 0.2);
}
