/* =============================================================================
   Superintelligent Labs Design System — Tokens  v2
   Single source of truth. Components and pages reference these variables only.
   Documentation: /DESIGN_SYSTEM.md  ·  Live reference: /design/
   ============================================================================= */

/* ---- Typefaces (self-hosted, SIL Open Font License) ------------------------
   Source Sans 3 + Source Serif 4 are one superfamily, drawn to be used together.
   Preloaded in the page head and shown with font-display: block, so text never appears first
   in a stand-in font and then jumps (most visible on the splash right after the launch image). */
@font-face {
  font-family: "Source Sans 3";
  src: url("./fonts/source-sans-3.woff2") format("woff2-variations"), url("./fonts/source-sans-3.woff2") format("woff2");
  font-weight: 200 900; font-style: normal; font-display: block;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("./fonts/source-serif-4.woff2") format("woff2-variations"), url("./fonts/source-serif-4.woff2") format("woff2");
  font-weight: 200 900; font-style: normal; font-display: block;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("./fonts/source-serif-4-italic.woff2") format("woff2-variations"), url("./fonts/source-serif-4-italic.woff2") format("woff2");
  font-weight: 200 900; font-style: italic; font-display: swap;
}

:root {
  /* ===========================================================================
     COLOUR · primitives (never referenced outside this file)
     =========================================================================== */
  --stone-0:   #ffffff;
  --stone-25:  #fcfbf9;
  --stone-50:  #f8f6f3;
  --stone-100: #f1eee9;
  --stone-150: #e9e5df;
  --stone-200: #e0dbd4;
  --stone-300: #cbc4bb;
  --stone-400: #a39c94;
  --stone-500: #7c756e;
  --stone-600: #5e5852;
  --stone-700: #45403b;
  --stone-800: #2f2b28;
  --stone-900: #1f1c1a;

  --green-50: #edf6f0;  --green-200: #c9e3d2;  --green-700: #26704a;
  --amber-50: #fcf3e6;  --amber-200: #f0d6ad;  --amber-700: #95580f;
  --red-50:   #fcefee;  --red-200:   #f1c9c5;  --red-700:   #b42f27;

  /* ===========================================================================
     COLOUR · semantic (what components use)
     =========================================================================== */
  --color-canvas:          var(--stone-50);   /* page background */
  --color-surface:         var(--stone-0);    /* cards, inputs, sheets */
  --color-surface-subtle:  var(--stone-25);   /* card footers, zebra rows */
  --color-surface-sunken:  var(--stone-100);  /* tracks, pressed fills */
  --color-border:          var(--stone-150);  /* dividers, card outlines */
  --color-border-strong:   var(--stone-200);  /* inputs, controls */
  --color-border-hover:    var(--stone-300);

  --color-text:            var(--stone-900);  /* headings, values */
  --color-text-body:       var(--stone-700);  /* paragraphs, table cells */
  --color-text-muted:      #6b645e;           /* hints, meta, labels: ≥ 4.5:1 on white, the canvas and every event card */
  --color-text-faint:      #78716a;           /* placeholders, quiet labels: ≥ 4.5:1 on white (Apple HIG › Color › contrast) */
  --color-control-border:  #8f8880;           /* input, select, chip and secondary-button outlines: ≥ 3:1 so fields are easy to find */
  --color-text-inverse:    var(--stone-0);

  --color-success: var(--green-700); --color-success-bg: var(--green-50); --color-success-border: var(--green-200);
  --color-warning: var(--amber-700); --color-warning-bg: var(--amber-50); --color-warning-border: var(--amber-200);
  --color-danger:  var(--red-700);   --color-danger-bg:  var(--red-50);   --color-danger-border:  var(--red-200);
  --color-switch-on: #34c759;        /* iOS system green */

  /* ---- Brand (Annsborough Park) — header, footer, splash, icons. Never themed. */
  --brand-green:    #23493a;   /* the kairi line, wordmark accents */
  --brand-gold:     #b8862d;   /* kolam dots */
  --brand-marigold: #d9822b;   /* the heart of the kairi */
  --brand-ivory:    #fbf7ef;   /* splash and icon backgrounds */

  /* ---- Event theme (body only; header & footer stay neutral) ----------------
     Default: Saffron. Themes override these seven values and nothing else. */
  --theme-accent:       #a64b16;   /* primary button, active tab, eyebrow, links */
  --theme-accent-ink:   #3d2414;   /* event title, selected text */
  --theme-accent-bg:    #fbf1e7;   /* selected chip, badge, table header */
  --theme-accent-line:  #e8c7a6;   /* selected chip border */
  --theme-highlight:    #d9822b;   /* one decorative highlight (the year) */
  --theme-hero-bg:      #f8eadb;   /* event card */
  --theme-hero-line:    #efd9c2;

  --color-focus-ring: var(--theme-accent-text, var(--theme-accent));   /* solid: ≥ 3:1 against the page */
  --color-focus-halo: color-mix(in srgb, var(--theme-accent) 10%, transparent);

  /* ===========================================================================
     TYPOGRAPHY
     =========================================================================== */
  --font-sans:  "Source Sans 3", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-serif: "Source Serif 4", Georgia, "Times New Roman", serif;

  /* Size scale (px values in comments). Keep to these steps. */
  --size-11: 0.6875rem;  /* 11 */
  --size-12: 0.75rem;    /* 12 */
  --size-13: 0.8125rem;  /* 13 */
  --size-14: 0.875rem;   /* 14 */
  --size-15: 0.9375rem;  /* 15 */
  --size-16: 1rem;       /* 16 — inputs only (prevents iOS zoom) */
  --size-17: 1.0625rem;  /* 17 */
  --size-20: 1.25rem;    /* 20 */
  --size-24: 1.5rem;     /* 24 */
  --size-28: 1.75rem;    /* 28 */
  --size-display: clamp(2.375rem, 10.5vw, 3rem); /* 38–48 */

  /* Role sizes — components and pages use THESE, not the raw steps above.
     Calibrated to iPhone reading sizes (Apple: body 17pt, footnote 13pt). Source Sans runs
     slightly smaller than SF, so body is 16px — comfortable at arm's length, and inputs at
     16px never trigger iOS zoom. */
  --text-display:    var(--size-display);
  --text-title-1:    1.625rem;    /* 26 panel titles */
  --text-title-2:    1.375rem;    /* 22 card headings, sheets */
  --text-title-3:    1.0625rem;   /* 17 section titles */
  --text-headline:   1rem;        /* 16 emphasised row text */
  --text-body:       1rem;        /* 16 paragraphs */
  --text-callout:    0.9375rem;   /* 15 secondary sentences, table cells */
  --text-footnote:   0.8125rem;   /* 13 hints, meta */
  --text-caption:    0.75rem;     /* 12 badges, tags */
  --text-overline:   0.75rem;     /* 12 caps labels (HIG Caption 1) */
  --text-label:      0.9375rem;   /* 15 field labels */
  --text-control:    1rem;        /* 16 buttons */
  --text-control-sm: 0.875rem;    /* 14 tabs, chips, small buttons */
  --text-input:      1rem;        /* 16 typed values */
  --text-stat:       1.625rem;    /* 26 tile values */

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

  --leading-display: 1.04;
  --leading-heading: 1.2;
  --leading-body:    1.5;

  --tracking-display: -0.022em;
  --tracking-heading: -0.012em;
  --tracking-caps:    0.16em;

  /* ===========================================================================
     SPACE · 4pt grid
     =========================================================================== */
  --space-0-5: 2px;
  --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;

  /* ===========================================================================
     SHAPE
     =========================================================================== */
  --radius-xs:   6px;    /* badges, tags */
  --radius-sm:   10px;   /* buttons, inputs, chips */
  --radius-md:   14px;   /* tiles, tables, row cards */
  --radius-lg:   20px;   /* page cards */
  --radius-full: 999px;
  --stroke: 1px;

  /* ===========================================================================
     SIZE · Apple HIG minimum hit target 44×44pt
     =========================================================================== */
  --hit-min:       44px;
  --control-h:     44px;   /* buttons, chips, selects */
  --control-h-lg:  48px;   /* primary call to action, text inputs */
  --icon-sm: 16px;
  --icon-md: 20px;
  --mark-size: 28px;
  --page-max: 680px;
  --gutter: 16px;

  /* ===========================================================================
     ELEVATION
     =========================================================================== */
  --shadow-1: 0 1px 2px rgba(31, 28, 26, .04);
  --shadow-2: 0 1px 2px rgba(31, 28, 26, .04), 0 6px 20px rgba(31, 28, 26, .05);
  --shadow-3: 0 12px 40px rgba(31, 28, 26, .18);
  --material:      rgba(248, 246, 243, .86);
  --material-blur: saturate(180%) blur(20px);
  --scrim:         rgba(31, 28, 26, .32);
  --z-sticky: 10; --z-header: 20; --z-overlay: 50; --z-toast: 60;

  /* ===========================================================================
     MOTION
     =========================================================================== */
  --ease-standard: cubic-bezier(.2, .8, .2, 1);
  --duration-1: 120ms;  /* press, hover */
  --duration-2: 220ms;  /* tabs, fades */
  --duration-3: 320ms;  /* sheets, toasts */
  --press-scale: .98;
}

/* =============================================================================
   Event themes — <html data-theme="…">
   Contrast: --theme-accent on white ≥ 4.5:1 for every theme.
   ============================================================================= */
[data-theme="saffron"] {   /* explicit copy of the default so nested previews can reset it */
  --theme-accent: #a64b16; --theme-accent-ink: #3d2414; --theme-accent-bg: #fbf1e7; --theme-accent-line: #e8c7a6;
  --theme-highlight: #d9822b; --theme-highlight-text: #c07122; --theme-hero-bg: #f8eadb; --theme-hero-line: #efd9c2;
}
[data-theme="peacock"] {
  --theme-accent: #0f6466; --theme-accent-ink: #12302f; --theme-accent-bg: #eaf4f3; --theme-accent-line: #a9cfcc;
  --theme-highlight: #b9860f; --theme-highlight-text: #ad7d0e; --theme-hero-bg: #e5f1ef; --theme-hero-line: #cfe3e0;
}
[data-theme="indigo"] {
  --theme-accent: #4140a0; --theme-accent-ink: #1f1e4a; --theme-accent-bg: #efeffa; --theme-accent-line: #bebde6;
  --theme-highlight: #c97a2c; --theme-highlight-text: #bc7229; --theme-hero-bg: #ecebf8; --theme-hero-line: #dad9f0;
}
[data-theme="rose"] {
  --theme-accent: #9a2f55; --theme-accent-ink: #3e1626; --theme-accent-bg: #fbeff3; --theme-accent-line: #e3b6c6;
  --theme-highlight: #c97a2c; --theme-highlight-text: #bc7229; --theme-hero-bg: #f7e8ec; --theme-hero-line: #eed6dd;
}
[data-theme="forest"] {
  --theme-accent: #2f6a3d; --theme-accent-ink: #1b3322; --theme-accent-bg: #eef5ec; --theme-accent-line: #b7d3b5;
  --theme-highlight: #b9860f; --theme-highlight-text: #ad7d0e; --theme-hero-bg: #e8f1e5; --theme-hero-line: #d4e4cf;
}

/* =============================================================================
   Appearance — light (default) and dark.
   <html data-mode="light|dark">; without it the page follows the device setting.
   Dark rules: warm charcoal greys that step up in lightness for each layer, ivory text,
   ONE accent per event theme. Buttons keep the exact light-mode fill with white text;
   only accent-coloured text and indicators use a brighter tint. No brand green on dark.
   Generated from one palette, so the two dark selectors below can never drift apart.
   ============================================================================= */
:root { color-scheme: light; --color-selected: #ffffff; --color-field: #ffffff; --glass: rgba(255, 255, 255, .7); --glass-strong: rgba(255, 255, 255, .92); --color-on-brand: #ffffff; --brand-ink: var(--brand-green); --toast-bg: rgba(31, 28, 26, .92); --toast-text: #ffffff; --color-on-accent: #ffffff; --hero-glow: transparent; }
@media (prefers-color-scheme: dark) {
  :root:not([data-mode="light"]) { color-scheme: dark; --color-canvas: #0f0e0d; --color-surface: #1a1918; --color-surface-subtle: #1d1c1a; --color-surface-sunken: #272523; --color-selected: #3a3734; --color-field: #232120; --color-border: #2c2a28; --color-border-strong: #3f3c38; --color-control-border: #77716a; --color-border-hover: #55514c; --color-text: #faf8f5; --color-text-body: #ebe7e1; --color-text-muted: #c2bcb4; --theme-highlight-text: var(--theme-highlight); --color-text-faint: #8a847c; --color-text-inverse: #14110e; --color-success: #5fd08f; --color-success-bg: rgba(95, 208, 143, .13); --color-success-border: rgba(95, 208, 143, .3); --color-warning: #f2b65c; --color-warning-bg: rgba(242, 182, 92, .13); --color-warning-border: rgba(242, 182, 92, .3); --color-danger: #ff8a80; --color-danger-bg: rgba(255, 138, 128, .13); --color-danger-border: rgba(255, 138, 128, .32); --brand-green: #f5f2ed; --brand-ink: #f5f2ed; --brand-ivory: #0f0e0d; --material: rgba(15, 14, 13, .82); --scrim: rgba(0, 0, 0, .6); --glass: rgba(255, 255, 255, .06); --glass-strong: rgba(26, 25, 24, .92); --toast-bg: rgba(58, 55, 52, .96); --toast-text: #f5f2ed; --shadow-1: 0 1px 2px rgba(0, 0, 0, .4); --shadow-2: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35); --shadow-3: 0 16px 48px rgba(0, 0, 0, .65); }
  :root:not([data-mode="light"])[data-theme="saffron"], :root:not([data-mode="light"]) [data-theme="saffron"] { --theme-accent: #a64b16; --theme-accent-text: #f39a5a; --theme-accent-ink: #faf8f5; --theme-accent-bg: color-mix(in srgb, #f39a5a 14%, transparent); --theme-accent-line: color-mix(in srgb, #f39a5a 38%, transparent); --theme-highlight: #f6b071; --theme-hero-bg: #1a1918; --theme-hero-line: #2c2a28; --hero-glow: color-mix(in srgb, #f39a5a 17%, transparent); --art-fill: color-mix(in srgb, #f39a5a 24%, transparent); --art-line: color-mix(in srgb, #f39a5a 55%, #faf8f5); }
  :root:not([data-mode="light"])[data-theme="peacock"], :root:not([data-mode="light"]) [data-theme="peacock"] { --theme-accent: #0f6466; --theme-accent-text: #4fc7bf; --theme-accent-ink: #faf8f5; --theme-accent-bg: color-mix(in srgb, #4fc7bf 14%, transparent); --theme-accent-line: color-mix(in srgb, #4fc7bf 38%, transparent); --theme-highlight: #e6bd52; --theme-hero-bg: #1a1918; --theme-hero-line: #2c2a28; --hero-glow: color-mix(in srgb, #4fc7bf 17%, transparent); --art-fill: color-mix(in srgb, #4fc7bf 24%, transparent); --art-line: color-mix(in srgb, #4fc7bf 55%, #faf8f5); }
  :root:not([data-mode="light"])[data-theme="indigo"], :root:not([data-mode="light"]) [data-theme="indigo"] { --theme-accent: #4140a0; --theme-accent-text: #a5a4f6; --theme-accent-ink: #faf8f5; --theme-accent-bg: color-mix(in srgb, #a5a4f6 14%, transparent); --theme-accent-line: color-mix(in srgb, #a5a4f6 38%, transparent); --theme-highlight: #f0ad66; --theme-hero-bg: #1a1918; --theme-hero-line: #2c2a28; --hero-glow: color-mix(in srgb, #a5a4f6 17%, transparent); --art-fill: color-mix(in srgb, #a5a4f6 24%, transparent); --art-line: color-mix(in srgb, #a5a4f6 55%, #faf8f5); }
  :root:not([data-mode="light"])[data-theme="rose"], :root:not([data-mode="light"]) [data-theme="rose"] { --theme-accent: #9a2f55; --theme-accent-text: #f38db1; --theme-accent-ink: #faf8f5; --theme-accent-bg: color-mix(in srgb, #f38db1 14%, transparent); --theme-accent-line: color-mix(in srgb, #f38db1 38%, transparent); --theme-highlight: #f0ad66; --theme-hero-bg: #1a1918; --theme-hero-line: #2c2a28; --hero-glow: color-mix(in srgb, #f38db1 17%, transparent); --art-fill: color-mix(in srgb, #f38db1 24%, transparent); --art-line: color-mix(in srgb, #f38db1 55%, #faf8f5); }
  :root:not([data-mode="light"])[data-theme="forest"], :root:not([data-mode="light"]) [data-theme="forest"] { --theme-accent: #2f6a3d; --theme-accent-text: #82cf96; --theme-accent-ink: #faf8f5; --theme-accent-bg: color-mix(in srgb, #82cf96 14%, transparent); --theme-accent-line: color-mix(in srgb, #82cf96 38%, transparent); --theme-highlight: #e6bd52; --theme-hero-bg: #1a1918; --theme-hero-line: #2c2a28; --hero-glow: color-mix(in srgb, #82cf96 17%, transparent); --art-fill: color-mix(in srgb, #82cf96 24%, transparent); --art-line: color-mix(in srgb, #82cf96 55%, #faf8f5); }
}
:root[data-mode="dark"] { color-scheme: dark; --color-canvas: #0f0e0d; --color-surface: #1a1918; --color-surface-subtle: #1d1c1a; --color-surface-sunken: #272523; --color-selected: #3a3734; --color-field: #232120; --color-border: #2c2a28; --color-border-strong: #3f3c38; --color-control-border: #77716a; --color-border-hover: #55514c; --color-text: #faf8f5; --color-text-body: #ebe7e1; --color-text-muted: #c2bcb4; --theme-highlight-text: var(--theme-highlight); --color-text-faint: #8a847c; --color-text-inverse: #14110e; --color-success: #5fd08f; --color-success-bg: rgba(95, 208, 143, .13); --color-success-border: rgba(95, 208, 143, .3); --color-warning: #f2b65c; --color-warning-bg: rgba(242, 182, 92, .13); --color-warning-border: rgba(242, 182, 92, .3); --color-danger: #ff8a80; --color-danger-bg: rgba(255, 138, 128, .13); --color-danger-border: rgba(255, 138, 128, .32); --brand-green: #f5f2ed; --brand-ink: #f5f2ed; --brand-ivory: #0f0e0d; --material: rgba(15, 14, 13, .82); --scrim: rgba(0, 0, 0, .6); --glass: rgba(255, 255, 255, .06); --glass-strong: rgba(26, 25, 24, .92); --toast-bg: rgba(58, 55, 52, .96); --toast-text: #f5f2ed; --shadow-1: 0 1px 2px rgba(0, 0, 0, .4); --shadow-2: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35); --shadow-3: 0 16px 48px rgba(0, 0, 0, .65); }
:root[data-mode="dark"][data-theme="saffron"], :root[data-mode="dark"] [data-theme="saffron"] { --theme-accent: #a64b16; --theme-accent-text: #f39a5a; --theme-accent-ink: #faf8f5; --theme-accent-bg: color-mix(in srgb, #f39a5a 14%, transparent); --theme-accent-line: color-mix(in srgb, #f39a5a 38%, transparent); --theme-highlight: #f6b071; --theme-hero-bg: #1a1918; --theme-hero-line: #2c2a28; --hero-glow: color-mix(in srgb, #f39a5a 17%, transparent); --art-fill: color-mix(in srgb, #f39a5a 24%, transparent); --art-line: color-mix(in srgb, #f39a5a 55%, #faf8f5); }
:root[data-mode="dark"][data-theme="peacock"], :root[data-mode="dark"] [data-theme="peacock"] { --theme-accent: #0f6466; --theme-accent-text: #4fc7bf; --theme-accent-ink: #faf8f5; --theme-accent-bg: color-mix(in srgb, #4fc7bf 14%, transparent); --theme-accent-line: color-mix(in srgb, #4fc7bf 38%, transparent); --theme-highlight: #e6bd52; --theme-hero-bg: #1a1918; --theme-hero-line: #2c2a28; --hero-glow: color-mix(in srgb, #4fc7bf 17%, transparent); --art-fill: color-mix(in srgb, #4fc7bf 24%, transparent); --art-line: color-mix(in srgb, #4fc7bf 55%, #faf8f5); }
:root[data-mode="dark"][data-theme="indigo"], :root[data-mode="dark"] [data-theme="indigo"] { --theme-accent: #4140a0; --theme-accent-text: #a5a4f6; --theme-accent-ink: #faf8f5; --theme-accent-bg: color-mix(in srgb, #a5a4f6 14%, transparent); --theme-accent-line: color-mix(in srgb, #a5a4f6 38%, transparent); --theme-highlight: #f0ad66; --theme-hero-bg: #1a1918; --theme-hero-line: #2c2a28; --hero-glow: color-mix(in srgb, #a5a4f6 17%, transparent); --art-fill: color-mix(in srgb, #a5a4f6 24%, transparent); --art-line: color-mix(in srgb, #a5a4f6 55%, #faf8f5); }
:root[data-mode="dark"][data-theme="rose"], :root[data-mode="dark"] [data-theme="rose"] { --theme-accent: #9a2f55; --theme-accent-text: #f38db1; --theme-accent-ink: #faf8f5; --theme-accent-bg: color-mix(in srgb, #f38db1 14%, transparent); --theme-accent-line: color-mix(in srgb, #f38db1 38%, transparent); --theme-highlight: #f0ad66; --theme-hero-bg: #1a1918; --theme-hero-line: #2c2a28; --hero-glow: color-mix(in srgb, #f38db1 17%, transparent); --art-fill: color-mix(in srgb, #f38db1 24%, transparent); --art-line: color-mix(in srgb, #f38db1 55%, #faf8f5); }
:root[data-mode="dark"][data-theme="forest"], :root[data-mode="dark"] [data-theme="forest"] { --theme-accent: #2f6a3d; --theme-accent-text: #82cf96; --theme-accent-ink: #faf8f5; --theme-accent-bg: color-mix(in srgb, #82cf96 14%, transparent); --theme-accent-line: color-mix(in srgb, #82cf96 38%, transparent); --theme-highlight: #e6bd52; --theme-hero-bg: #1a1918; --theme-hero-line: #2c2a28; --hero-glow: color-mix(in srgb, #82cf96 17%, transparent); --art-fill: color-mix(in srgb, #82cf96 24%, transparent); --art-line: color-mix(in srgb, #82cf96 55%, #faf8f5); }

/* ---- Increase Contrast (Apple HIG › Color: "work well in light, dark, and increased contrast contexts").
   iPhone Settings › Accessibility › Display & Text Size › Increase Contrast, and the macOS equivalent. */
@media (prefers-contrast: more) {
  :root { --color-text-muted: #45403b; --color-text-faint: #5e5852; --color-border: #a39c94; --color-border-strong: #7c756e; --color-control-border: #5e5852; }
}
@media (prefers-contrast: more) and (prefers-color-scheme: dark) {
  :root:not([data-mode="light"]) { --color-text-muted: #e6e1da; --color-text-faint: #c2bcb4; --color-border: #55514c; --color-border-strong: #8a847c; --color-control-border: #a39c94; }
}
@media (prefers-contrast: more) {
  :root[data-mode="dark"] { --color-text-muted: #e6e1da; --color-text-faint: #c2bcb4; --color-border: #55514c; --color-border-strong: #8a847c; --color-control-border: #a39c94; }
}
