/*
 * Human Data Lab Vietnam — design tokens
 * Three layers: primitive -> semantic -> component.
 * Components consume semantic/component tokens only; never primitives directly.
 * Source of truth for rationale and usage rules: docs/design-system.md
 */

@import url("https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap");

/* ---------- 1. Primitives ---------- */
:root {
  /* Brand navy — 900 sampled from the logo bracket (#160B67) */
  --navy-50: #f4f3fd;
  --navy-100: #e8e6fa;
  --navy-200: #cfccf3;
  --navy-300: #a6a1e8;
  --navy-400: #7a73db;
  --navy-500: #5249cc;
  --navy-600: #3a30b8;
  --navy-700: #2a1fa0;
  --navy-800: #1f1585;
  --navy-900: #160b67;
  --navy-950: #0a0533;

  /* Brand cyan — 600 sampled from the logo data points (#029DD3) */
  --cyan-50: #f0fafe;
  --cyan-100: #e0f5fd;
  --cyan-200: #bdebfa;
  --cyan-300: #85d9f5;
  --cyan-400: #4cc6f0;
  --cyan-500: #1ab4e8;
  --cyan-600: #029dd3;
  --cyan-700: #0383b5;
  --cyan-800: #046a91;
  --cyan-900: #034a66;
  --cyan-950: #022c3d;

  /* Neutral (slate) */
  --slate-0: #ffffff;
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;

  /* Status */
  --green-600: #16a34a;
  --green-100: #dcfce7;
  --amber-600: #d97706;
  --amber-100: #fef3c7;
  --red-600: #dc2626;
  --red-100: #fee2e2;

  /* Type */
  --font-sans: "Be Vietnam Pro", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Consolas, 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: 2rem;     /* 32 */
  --text-4xl: 2.5rem;   /* 40 */
  --text-5xl: 3.5rem;   /* 56 */
  --text-6xl: 4.5rem;   /* 72 */

  /* Spacing — 4px base */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --radius-pill: 999px;

  /* Motion — "Corporate precision" personality: no overshoot, decelerated entrances.
     Signature curve (--ease-out) covers ~80% of motion; --ease-in is for exits only. */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-standard: cubic-bezier(0.2, 0, 0, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --duration-fast: 120ms;     /* hover, press */
  --duration-base: 200ms;     /* state change, menu exit */
  --duration-slow: 360ms;     /* card / section reveal */
  --duration-reveal: 520ms;   /* hero entrance, line draws */
  --stagger: 70ms;            /* between siblings; keep a group under ~400ms */
  --reveal-distance: 20px;
}

/* ---------- 2. Semantic (light surfaces = default) ---------- */
:root {
  --color-bg: var(--slate-50);
  --color-surface: var(--slate-0);
  --color-surface-muted: var(--slate-100);
  --color-surface-brand: var(--cyan-50);
  --color-border: var(--slate-200);
  --color-border-strong: var(--slate-300);

  --color-text: var(--navy-950);
  --color-text-muted: var(--slate-600);
  --color-text-subtle: var(--slate-500);
  --color-text-on-brand: var(--slate-0);
  --color-heading: var(--navy-900);

  --color-brand: var(--navy-900);
  --color-accent: var(--cyan-600);          /* decoration, icons, large text only on white */
  --color-link: var(--cyan-800);            /* 6.0:1 on white — body-size safe */
  --color-focus: var(--cyan-500);

  --color-success: var(--green-600);
  --color-success-bg: var(--green-100);
  --color-warning: var(--amber-600);
  --color-warning-bg: var(--amber-100);
  --color-danger: var(--red-600);
  --color-danger-bg: var(--red-100);

  --gradient-brand: linear-gradient(110deg, var(--navy-900) 0%, var(--navy-800) 45%, var(--cyan-700) 100%);
  --gradient-accent-text: linear-gradient(90deg, var(--cyan-500), var(--cyan-300));

  --shadow-sm: 0 1px 2px rgba(10, 5, 51, 0.06);
  --shadow-md: 0 6px 20px -6px rgba(10, 5, 51, 0.14);
  --shadow-lg: 0 18px 48px -12px rgba(10, 5, 51, 0.22);
  --shadow-glow: 0 0 0 1px rgba(26, 180, 232, 0.35), 0 8px 32px -8px rgba(26, 180, 232, 0.45);
}

/* Dark surfaces: hero, data bands, footer, product UI dark mode. Apply with [data-surface="dark"]. */
[data-surface="dark"] {
  --color-bg: var(--navy-950);
  --color-surface: rgba(255, 255, 255, 0.04);
  --color-surface-muted: rgba(255, 255, 255, 0.07);
  --color-surface-brand: rgba(26, 180, 232, 0.1);
  --color-border: rgba(255, 255, 255, 0.1);
  --color-border-strong: rgba(255, 255, 255, 0.2);

  --color-text: var(--slate-100);
  --color-text-muted: var(--slate-300);
  --color-text-subtle: var(--slate-400);
  --color-heading: var(--slate-0);

  --color-accent: var(--cyan-400);
  --color-link: var(--cyan-400);

  --shadow-md: 0 8px 28px -8px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 24px 60px -16px rgba(0, 0, 0, 0.6);

  color: var(--color-text);
  background: var(--color-bg);
}

/* ---------- 3. Component tokens ----------
 * Declared on [data-surface] too, so var() references re-resolve against the
 * dark semantic values instead of inheriting values computed at :root. */
:root,
[data-surface] {
  --button-height: 44px;
  --button-padding-x: var(--space-6);
  --button-radius: var(--radius-pill);
  --button-primary-bg: var(--cyan-500);
  --button-primary-bg-hover: var(--cyan-400);
  --button-primary-text: var(--navy-950);   /* navy on cyan = 6.8:1; never white on cyan */
  --button-secondary-border: var(--color-border-strong);
  --button-secondary-text: var(--color-heading);
  --button-dark-bg: var(--navy-900);
  --button-dark-text: var(--slate-0);

  --card-bg: var(--color-surface);
  --card-border: var(--color-border);
  --card-radius: var(--radius-lg);
  --card-padding: var(--space-6);

  --eyebrow-font: var(--font-mono);
  --eyebrow-size: var(--text-xs);
  --eyebrow-tracking: 0.14em;
  --eyebrow-color: var(--color-accent);

  --stat-value-size: var(--text-4xl);
  --stat-label-font: var(--font-mono);

  --input-height: 44px;
  --input-radius: var(--radius-md);
  --input-border: var(--color-border-strong);

  --container-max: 1200px;
  --section-padding-y: var(--space-24);
  --frame-corner: 18px;   /* viewfinder bracket size, echoes the logo */
}

@media (max-width: 768px) {
  :root,
  [data-surface] {
    --section-padding-y: var(--space-16);
    --stat-value-size: var(--text-3xl);
  }
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --duration-fast: 0ms;
    --duration-base: 0ms;
    --duration-slow: 0ms;
    --duration-reveal: 0ms;
    --stagger: 0ms;
    --reveal-distance: 0px;
  }
}
