/* iBridge design tokens. Source of truth for the site; tokens.json mirrors it.
   Light is the default; dark follows the OS via prefers-color-scheme.
   A page may force a scheme with <html data-theme="light|dark">. */

:root {
  color-scheme: light dark;

  /* ---- Brand (fixed, used by the icon too) ---- */
  --brand-ink: #0F2538;
  --brand-teal: #0B7A80;
  --brand-coral: #E0532B;

  /* ---- Colour: light ---- */
  --color-bg: #FFFFFF;
  --color-bg-subtle: #F5F7F8;        /* alternating section band */
  --color-bg-sky: #EAF5F5;           /* hero wash, top of gradient */
  --color-surface: #FFFFFF;          /* cards */
  --color-surface-sunken: #F0F4F6;   /* code box, inputs */
  --color-border: #DCE3E8;
  --color-border-strong: #C3CED6;
  --color-text: #0F2538;             /* 15.7:1 on bg */
  --color-text-secondary: #46576A;   /* 7.4:1 on bg */
  --color-text-tertiary: #5B6B7B;    /* 5.5:1 on bg, 4.9:1 on surface-sunken */
  --color-link: #0A6C72;             /* 6.2:1 on bg */
  --color-brand: #0B7A80;            /* button fill; white text 5.1:1 */
  --color-brand-hover: #08656A;
  --color-brand-pressed: #06555A;
  --color-on-brand: #FFFFFF;
  --color-brand-tint: #E3F2F2;       /* icon wells, selected states */
  --color-accent: #E0532B;           /* decorative only (icon, rules) */
  --color-accent-text: #B03C17;      /* 6.0:1 on bg, for accent-coloured text */
  --color-accent-tint: #FCEBE4;
  --color-danger: #B3261E;           /* destructive button fill; white text 6.5:1 */
  --color-danger-hover: #8F1E18;
  --color-on-danger: #FFFFFF;
  --color-focus: #0B7A80;
  --color-dusk: #0F2538;             /* dark band used by the Horizon direction */
  --color-on-dusk: #EAF2F5;
  --color-on-dusk-secondary: #B4C3CF;

  /* ---- Typography ---- */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, Menlo, Consolas, "Liberation Mono", monospace;

  /* size / line-height / tracking / weight per role */
  --text-display: clamp(2.5rem, 1.6rem + 3.6vw, 4.5rem);   /* 40 → 72 */
  --leading-display: 1.04;
  --tracking-display: -0.035em;
  --text-h1: clamp(2.125rem, 1.6rem + 2vw, 3.25rem);       /* 34 → 52 */
  --leading-h1: 1.08;
  --tracking-h1: -0.03em;
  --text-h2: clamp(1.75rem, 1.4rem + 1.4vw, 2.5rem);       /* 28 → 40 */
  --leading-h2: 1.12;
  --tracking-h2: -0.025em;
  --text-h3: 1.25rem;                                       /* 20 */
  --leading-h3: 1.3;
  --tracking-h3: -0.012em;
  --text-lede: clamp(1.125rem, 1.05rem + 0.35vw, 1.3125rem); /* 18 → 21 */
  --leading-lede: 1.5;
  --text-body: 1.0625rem;                                   /* 17 */
  --leading-body: 1.55;
  --text-small: 0.9375rem;                                  /* 15 */
  --leading-small: 1.5;
  --text-caption: 0.8125rem;                                /* 13 */
  --leading-caption: 1.4;
  --text-eyebrow: 0.8125rem;                                /* 13, uppercase */
  --tracking-eyebrow: 0.08em;
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;

  /* ---- Spacing (4 px base) ---- */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  --space-9: 96px;
  --space-10: 128px;
  --section-y: clamp(64px, 40px + 6vw, 128px);  /* vertical rhythm between sections */
  --gutter: clamp(16px, 4vw, 32px);             /* page side padding; 16 at 390 */
  --container: 1120px;
  --container-narrow: 760px;

  /* ---- Radii ---- */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-pill: 999px;

  /* ---- Shadows ---- */
  --shadow-sm: 0 1px 2px rgb(15 37 56 / 0.06), 0 1px 1px rgb(15 37 56 / 0.04);
  --shadow-md: 0 4px 12px rgb(15 37 56 / 0.06), 0 1px 3px rgb(15 37 56 / 0.06);
  --shadow-lg: 0 24px 48px -12px rgb(15 37 56 / 0.18), 0 4px 12px rgb(15 37 56 / 0.06);
  --shadow-focus: 0 0 0 3px rgb(11 122 128 / 0.35);

  /* ---- Motion ---- */
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --duration-fast: 120ms;
  --duration-base: 200ms;
  --duration-slow: 320ms;

  /* ---- Layering ---- */
  --z-nav: 50;
}

/* ---- Colour: dark ---- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-bg: #0B1118;
    --color-bg-subtle: #0F1720;
    --color-bg-sky: #0F2129;
    --color-surface: #131D27;
    --color-surface-sunken: #0A1017;
    --color-border: #233140;
    --color-border-strong: #33475A;
    --color-text: #EAF2F5;            /* 16.7:1 on bg */
    --color-text-secondary: #A9B9C6;  /* 9.4:1 on bg */
    --color-text-tertiary: #8A9CAB;   /* 6.7:1 on bg */
    --color-link: #6CD0D3;
    --color-brand: #5CC8CC;           /* button fill; dark text 8.1:1 */
    --color-brand-hover: #78D5D8;
    --color-brand-pressed: #4AB4B8;
    --color-on-brand: #062528;
    --color-brand-tint: #12303A;
    --color-accent: #FF7F57;
    --color-accent-text: #FF9A7A;
    --color-accent-tint: #3A1F18;
    --color-danger: #FF8A80;          /* destructive button fill; dark text 8.1:1 */
    --color-danger-hover: #FFA39B;
    --color-on-danger: #2A0806;
    --color-focus: #6CD0D3;
    --color-dusk: #070C12;
    --color-on-dusk: #EAF2F5;
    --color-on-dusk-secondary: #A9B9C6;
    --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.4);
    --shadow-md: 0 4px 12px rgb(0 0 0 / 0.35), 0 1px 3px rgb(0 0 0 / 0.3);
    --shadow-lg: 0 24px 48px -12px rgb(0 0 0 / 0.6), 0 4px 12px rgb(0 0 0 / 0.3);
    --shadow-focus: 0 0 0 3px rgb(108 208 211 / 0.45);
  }
}
:root[data-theme="dark"] {
  --color-bg: #0B1118;
  --color-bg-subtle: #0F1720;
  --color-bg-sky: #0F2129;
  --color-surface: #131D27;
  --color-surface-sunken: #0A1017;
  --color-border: #233140;
  --color-border-strong: #33475A;
  --color-text: #EAF2F5;
  --color-text-secondary: #A9B9C6;
  --color-text-tertiary: #8A9CAB;
  --color-link: #6CD0D3;
  --color-brand: #5CC8CC;
  --color-brand-hover: #78D5D8;
  --color-brand-pressed: #4AB4B8;
  --color-on-brand: #062528;
  --color-brand-tint: #12303A;
  --color-accent: #FF7F57;
  --color-accent-text: #FF9A7A;
  --color-accent-tint: #3A1F18;
  --color-danger: #FF8A80;
  --color-danger-hover: #FFA39B;
  --color-on-danger: #2A0806;
  --color-focus: #6CD0D3;
  --color-dusk: #070C12;
  --color-on-dusk: #EAF2F5;
  --color-on-dusk-secondary: #A9B9C6;
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.4);
  --shadow-md: 0 4px 12px rgb(0 0 0 / 0.35), 0 1px 3px rgb(0 0 0 / 0.3);
  --shadow-lg: 0 24px 48px -12px rgb(0 0 0 / 0.6), 0 4px 12px rgb(0 0 0 / 0.3);
  --shadow-focus: 0 0 0 3px rgb(108 208 211 / 0.45);
}
