/* ==========================================================================
   SILVER Platform – Design Tokens
   Calm, professional, accessible. Teal public surface, indigo provider,
   burnt-orange admin.
   ========================================================================== */

:root {
  /* Brand */
  --color-teal-900: #0A3B39;
  --color-teal-800: #0B4A47;
  --color-teal-700: #0E5B57;
  --color-teal-600: #12706B;
  --color-teal-50: #EDF4F3;
  --color-teal-tint: #E6F1EF;

  /* Ink & surfaces */
  --color-ink-900: #15282A;
  --color-ink-700: #33474A;
  --color-ink-600: #5C6F71;
  --color-ink-500: #76888A;
  --color-white: #FFFFFF;
  --color-canvas: #F5F7F7;
  --color-canvas-sunk: #EFF2F1;
  --color-border: #E2E8E7;
  --color-border-strong: #CBD6D4;
  --color-border-input: #C6D2D0;

  /* Semantic */
  --color-success: #16703F;
  --color-success-tint: #E7F4EC;
  --color-warning: #96540B;
  --color-warning-tint: #FDF2E3;
  --color-danger: #B42318;
  --color-danger-tint: #FCEBEA;
  --color-info: #1C5A9E;
  --color-info-tint: #E9F1FA;

  /* Surface accents */
  --color-accent-public: #0E5B57;
  --color-accent-public-tint: #E6F1EF;
  --color-accent-provider: #5B4699;
  --color-accent-provider-tint: #EFEBF8;
  --color-accent-admin: #C2410C;
  --color-accent-admin-tint: #FDF0E8;

  --surface-accent: var(--color-accent-public);
  --surface-accent-tint: var(--color-accent-public-tint);
  --surface-accent-ink: var(--color-accent-public);
  --surface-accent-soft: #F1F7F6;

  /* Focus ring */
  --color-focus: #F5A524;

  /* Typography */
  --font-latin: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-sinhala: "Noto Sans Sinhala", "Iskoola Pota", system-ui, sans-serif;
  --font-tamil: "Noto Sans Tamil", "Latha", system-ui, sans-serif;

  --text-scale: 1;
  --text-display: calc(2.625rem * var(--text-scale));    /* 42px */
  --text-h1: calc(2rem * var(--text-scale));             /* 32px */
  --text-h2: calc(1.5rem * var(--text-scale));           /* 24px */
  --text-h3: calc(1.25rem * var(--text-scale));          /* 20px */
  --text-body-l: calc(1.125rem * var(--text-scale));     /* 18px */
  --text-body: calc(1.0625rem * var(--text-scale));      /* 17px */
  --text-label: calc(1rem * var(--text-scale));          /* 16px */
  --text-caption: calc(0.875rem * var(--text-scale));    /* 14px */
  --text-micro: calc(0.6875rem * var(--text-scale));     /* 11px */

  --leading-body: 1.6;
  --leading-indic: 1.8;

  /* Spacing (4px base) */
  --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;

  /* Shape */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-input: 6px;
  --radius-pill: 6px;
  --radius-button: 6px;
  --radius-card: 10px;
  --radius-lg: 14px;
  --radius-sheet: 14px;

  --shadow-card: 0 1px 1px rgba(21, 40, 42, 0.02);
  --shadow-raised: 0 1px 2px rgba(21, 40, 42, 0.05), 0 8px 24px rgba(21, 40, 42, 0.06);
  --shadow-elevated: 0 18px 48px rgba(15, 35, 36, 0.18);

  /* Controls */
  --target-min: 48px;
  --target-primary: 52px;
  --input-height: 42px;

  /* Layout */
  --max-width: 1128px;
  --reading-width: 720px;
  --sidebar-width: 224px;
  --topbar-height: 56px;

  /* Motion */
  --motion-fast: 120ms;
  --motion-base: 200ms;
}

@media (min-width: 960px) {
  :root {
    --text-display: calc(2.625rem * var(--text-scale)); /* 42px */
    --text-h1: calc(2rem * var(--text-scale));          /* 32px */
  }
}

/* Text-size scaling (100%, 125%, 150%) */
[data-text-scale="100"] { --text-scale: 1; }
[data-text-scale="125"] { --text-scale: 1.25; }
[data-text-scale="150"] { --text-scale: 1.5; }

/* Surface accents */
[data-surface="provider"] {
  --surface-accent: var(--color-accent-provider);
  --surface-accent-tint: var(--color-accent-provider-tint);
  --surface-accent-ink: #4B3985;
  --surface-accent-soft: #F6F3FB;
}

[data-surface="admin"] {
  --surface-accent: var(--color-accent-admin);
  --surface-accent-tint: var(--color-accent-admin-tint);
  --surface-accent-ink: #AD3A0B;
  --surface-accent-soft: #FFF8F4;
}

/* High-contrast theme (ink on white, 2px borders, no tints) */
[data-contrast="high"] {
  --color-canvas: #FFFFFF;
  --color-canvas-sunk: #FFFFFF;
  --color-teal-50: #FFFFFF;
  --color-teal-tint: #FFFFFF;
  --color-border: #1B2B2A;
  --color-border-input: #1B2B2A;
  --color-ink-600: #1B2B2A;
  --color-ink-500: #1B2B2A;
  --color-success-tint: #FFFFFF;
  --color-warning-tint: #FFFFFF;
  --color-danger-tint: #FFFFFF;
  --color-info-tint: #FFFFFF;
  --surface-accent-tint: #FFFFFF;
  --surface-accent-soft: #FFFFFF;
  --shadow-card: none;
}

[data-contrast="high"] .card,
[data-contrast="high"] .pill,
[data-contrast="high"] .btn-secondary,
[data-contrast="high"] .seg-tabs {
  border-width: 2px;
}

/* Language-specific script & line-height */
:lang(si) {
  font-family: var(--font-sinhala);
  line-height: var(--leading-indic);
}

:lang(ta) {
  font-family: var(--font-tamil);
  line-height: var(--leading-indic);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

[data-reduced-motion="true"] *,
[data-reduced-motion="true"] *::before,
[data-reduced-motion="true"] *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
  scroll-behavior: auto !important;
}
