/* ==========================================================================
   HornVPN design tokens  (see /design-system.md)
   Layer 1: primitives (raw palette, scales). Never use these in components.
   Layer 2: semantic tokens (--color-*, --surface-*). Components use these only.
   Light is the default; dark comes from prefers-color-scheme or [data-theme].
   ========================================================================== */
:root {
  /* ---- Primitive palette: teal (brand, matches the app's connect circle) */
  --teal-50:  #f0fdfa;
  --teal-100: #ccfbf1;
  --teal-200: #99f6e4;
  --teal-300: #5eead4;
  --teal-400: #2dd4bf;
  --teal-500: #14b8a6;
  --teal-600: #0d9488;
  --teal-700: #0f766e;
  --teal-800: #115e59;
  --teal-900: #134e4a;
  --teal-950: #042f2e;

  /* ---- Primitive palette: neutral (cool grey) */
  --gray-0:   #ffffff;
  --gray-25:  #fbfcfc;
  --gray-50:  #f6f7f8;
  --gray-100: #eef0f2;
  --gray-200: #e1e4e8;
  --gray-300: #cbd0d6;
  --gray-400: #98a0aa;
  --gray-500: #68717c;
  --gray-600: #4b535d;
  --gray-700: #343a42;
  --gray-800: #22262c;
  --gray-850: #191c21;
  --gray-900: #131619;
  --gray-950: #0b0d0f;

  /* ---- Primitive palette: status */
  --green-600: #15803d;  --green-400: #4ade80;
  --amber-600: #b45309;  --amber-400: #fbbf24;
  --red-600:   #c02626;  --red-400:   #f87171;
  --blue-600:  #1d4ed8;  --blue-400:  #60a5fa;

  /* ---- Typography */
  --font-sans: "Inter", "InterVariable", ui-sans-serif, system-ui, -apple-system,
               "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif,
               "Apple Color Emoji", "Segoe UI Emoji";
  --font-mono: ui-monospace, "SFMono-Regular", "SF Mono", Menlo, Consolas,
               "Liberation Mono", monospace;

  --text-xs:   0.75rem;    /* 12 */
  --text-sm:   0.875rem;   /* 14 */
  --text-base: 1rem;       /* 16 */
  --text-lg:   1.125rem;   /* 18 */
  --text-xl:   1.25rem;    /* 20 */
  --text-2xl:  1.5rem;     /* 24 */
  --text-3xl:  1.875rem;   /* 30 */
  --text-4xl:  2.25rem;    /* 36 */
  --text-5xl:  3rem;       /* 48 */
  --text-display: clamp(2.375rem, 1.6rem + 3vw, 3.75rem); /* 38 -> 60 */
  --text-h1:      clamp(2rem, 1.5rem + 2vw, 3rem);         /* 32 -> 48 */
  --text-h2:      clamp(1.625rem, 1.3rem + 1.3vw, 2.25rem);/* 26 -> 36 */

  --leading-tight: 1.1;
  --leading-snug:  1.3;
  --leading-normal: 1.55;
  --leading-relaxed: 1.7;

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

  --tracking-tight: -0.025em;
  --tracking-tighter: -0.035em;
  --tracking-wide: 0.06em;

  /* ---- Spacing (4px base) */
  --space-0: 0;
  --space-px: 1px;
  --space-0-5: 0.125rem; /* 2 */
  --space-1: 0.25rem;    /* 4 */
  --space-2: 0.5rem;     /* 8 */
  --space-3: 0.75rem;    /* 12 */
  --space-4: 1rem;       /* 16 */
  --space-5: 1.25rem;    /* 20 */
  --space-6: 1.5rem;     /* 24 */
  --space-8: 2rem;       /* 32 */
  --space-10: 2.5rem;    /* 40 */
  --space-12: 3rem;      /* 48 */
  --space-16: 4rem;      /* 64 */
  --space-20: 5rem;      /* 80 */
  --space-24: 6rem;      /* 96 */
  --space-32: 8rem;      /* 128 */
  --section-y: clamp(4rem, 2.5rem + 6vw, 7.5rem);

  /* ---- Radius */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 24px;
  --radius-full: 999px;

  /* ---- Layout */
  --container: 1120px;
  --container-wide: 1280px;
  --container-narrow: 720px;
  --header-h: 64px;
  --gutter: clamp(1.25rem, 0.8rem + 2vw, 2rem);

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

  /* ---- Z-index */
  --z-base: 0;
  --z-raised: 10;
  --z-header: 100;
  --z-overlay: 200;

  /* ======================================================================
     Semantic tokens - LIGHT (default)
     ====================================================================== */
  color-scheme: light;
  --color-bg: var(--gray-0);
  --color-bg-subtle: var(--gray-25);
  --color-bg-muted: var(--gray-50);
  --color-surface: var(--gray-0);
  --color-surface-raised: var(--gray-0);
  --color-surface-sunken: var(--gray-50);
  --color-border: var(--gray-200);
  --color-border-subtle: var(--gray-100);
  --color-border-strong: var(--gray-300);

  --color-text: var(--gray-900);
  --color-text-muted: var(--gray-600);   /* 7.6:1 on white */
  --color-text-subtle: var(--gray-500);  /* 4.9:1 on white */
  --color-text-inverse: var(--gray-0);

  --color-primary: var(--teal-700);       /* 5.5:1 with white text */
  --color-primary-hover: var(--teal-800);
  --color-primary-active: var(--teal-900);
  --color-on-primary: var(--gray-0);
  --color-primary-soft: var(--teal-50);
  --color-primary-soft-border: var(--teal-200);
  --color-primary-text: var(--teal-700);  /* links, eyebrow */
  --color-brand: var(--teal-500);         /* decorative only (circle, glow) */
  --color-brand-2: var(--teal-400);

  --color-success: var(--green-600);
  --color-success-soft: #ecfdf3;
  --color-warning: var(--amber-600);
  --color-warning-soft: #fffbeb;
  --color-danger: var(--red-600);
  --color-danger-soft: #fef2f2;
  --color-info: var(--blue-600);
  --color-info-soft: #eff6ff;

  --color-focus: var(--teal-600);
  --focus-ring: 0 0 0 2px var(--color-bg), 0 0 0 4px var(--color-focus);

  --shadow-xs: 0 1px 2px rgba(16, 24, 32, 0.05);
  --shadow-sm: 0 1px 2px rgba(16, 24, 32, 0.06), 0 1px 3px rgba(16, 24, 32, 0.06);
  --shadow-md: 0 4px 12px -2px rgba(16, 24, 32, 0.08), 0 2px 4px -2px rgba(16, 24, 32, 0.05);
  --shadow-lg: 0 16px 40px -12px rgba(16, 24, 32, 0.16), 0 4px 10px -4px rgba(16, 24, 32, 0.06);
  --shadow-glow: 0 20px 60px -20px rgba(20, 184, 166, 0.55);

  --header-bg: rgba(255, 255, 255, 0.8);
  --grid-line: rgba(16, 24, 32, 0.045);
}

/* ---- Semantic tokens - DARK. Duplicated on purpose: one block for the
        system preference, one for the manual toggle. Keep them identical. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --color-bg: var(--gray-950);
    --color-bg-subtle: #0e1013;
    --color-bg-muted: var(--gray-900);
    --color-surface: var(--gray-900);
    --color-surface-raised: var(--gray-850);
    --color-surface-sunken: #0e1013;
    --color-border: #262b31;
    --color-border-subtle: #1b1f24;
    --color-border-strong: #353b43;
    --color-text: #eef1f4;
    --color-text-muted: #a9b1bb;
    --color-text-subtle: #858e99;
    --color-text-inverse: var(--gray-950);
    --color-primary: var(--teal-400);
    --color-primary-hover: var(--teal-300);
    --color-primary-active: var(--teal-200);
    --color-on-primary: var(--teal-950);
    --color-primary-soft: rgba(45, 212, 191, 0.1);
    --color-primary-soft-border: rgba(45, 212, 191, 0.28);
    --color-primary-text: var(--teal-300);
    --color-brand: var(--teal-400);
    --color-brand-2: var(--teal-300);
    --color-success: var(--green-400);
    --color-success-soft: rgba(74, 222, 128, 0.1);
    --color-warning: var(--amber-400);
    --color-warning-soft: rgba(251, 191, 36, 0.1);
    --color-danger: var(--red-400);
    --color-danger-soft: rgba(248, 113, 113, 0.1);
    --color-info: var(--blue-400);
    --color-info-soft: rgba(96, 165, 250, 0.1);
    --color-focus: var(--teal-300);
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 6px 16px -4px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 20px 48px -12px rgba(0, 0, 0, 0.7);
    --shadow-glow: 0 20px 70px -18px rgba(45, 212, 191, 0.45);
    --header-bg: rgba(11, 13, 15, 0.75);
    --grid-line: rgba(255, 255, 255, 0.04);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --color-bg: var(--gray-950);
  --color-bg-subtle: #0e1013;
  --color-bg-muted: var(--gray-900);
  --color-surface: var(--gray-900);
  --color-surface-raised: var(--gray-850);
  --color-surface-sunken: #0e1013;
  --color-border: #262b31;
  --color-border-subtle: #1b1f24;
  --color-border-strong: #353b43;
  --color-text: #eef1f4;
  --color-text-muted: #a9b1bb;
  --color-text-subtle: #858e99;
  --color-text-inverse: var(--gray-950);
  --color-primary: var(--teal-400);
  --color-primary-hover: var(--teal-300);
  --color-primary-active: var(--teal-200);
  --color-on-primary: var(--teal-950);
  --color-primary-soft: rgba(45, 212, 191, 0.1);
  --color-primary-soft-border: rgba(45, 212, 191, 0.28);
  --color-primary-text: var(--teal-300);
  --color-brand: var(--teal-400);
  --color-brand-2: var(--teal-300);
  --color-success: var(--green-400);
  --color-success-soft: rgba(74, 222, 128, 0.1);
  --color-warning: var(--amber-400);
  --color-warning-soft: rgba(251, 191, 36, 0.1);
  --color-danger: var(--red-400);
  --color-danger-soft: rgba(248, 113, 113, 0.1);
  --color-info: var(--blue-400);
  --color-info-soft: rgba(96, 165, 250, 0.1);
  --color-focus: var(--teal-300);
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 6px 16px -4px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 20px 48px -12px rgba(0, 0, 0, 0.7);
  --shadow-glow: 0 20px 70px -18px rgba(45, 212, 191, 0.45);
  --header-bg: rgba(11, 13, 15, 0.75);
  --grid-line: rgba(255, 255, 255, 0.04);
}
