/* =============================================================================
   FLYOSUM DESIGN TOKENS  —  single source of truth (implements W2)
   Two tiers: primitives (raw scales) -> semantic (intent). Components consume
   ONLY semantic tokens. Light is default on :root; dark via [data-theme="dark"].
   Token prefix: fly-
   ============================================================================= */

:root {
  /* ---------- PRIMITIVE: color — indigo (primary), anchor 600 = #2B38B8 ---- */
  --fly-indigo-50:  #eef0fb;
  --fly-indigo-100: #dfe3f7;
  --fly-indigo-200: #c2c9f0;
  --fly-indigo-300: #9aa5e6;
  --fly-indigo-400: #6c7bd8;
  --fly-indigo-500: #4654c8;
  --fly-indigo-600: #2b38b8;
  --fly-indigo-700: #2530a0;
  --fly-indigo-800: #1f2880;
  --fly-indigo-900: #1b2266;

  /* ---------- PRIMITIVE: color — azure (accent), anchor 600 = #0089BD ------ */
  --fly-azure-50:  #e6f6fc;
  --fly-azure-100: #c9ecf8;
  --fly-azure-200: #9bdcf2;
  --fly-azure-300: #5fc6ea;
  --fly-azure-400: #1fbef0;   /* dark-mode accent */
  --fly-azure-500: #0aa3d6;
  --fly-azure-600: #0089bd;   /* light-mode accent (AA on white) */
  --fly-azure-700: #00729c;
  --fly-azure-800: #075c7e;
  --fly-azure-900: #0c4d69;

  /* ---------- PRIMITIVE: color — neutral / ink, anchor 950 = #0B0E16 ------- */
  --fly-neutral-0:   #ffffff;
  --fly-neutral-25:  #fbfcfd;
  --fly-neutral-50:  #f6f8fa;
  --fly-neutral-100: #eef1f4;
  --fly-neutral-200: #e2e7ec;
  --fly-neutral-300: #cdd4dc;
  --fly-neutral-400: #9aa4b0;
  --fly-neutral-500: #6b7682;
  --fly-neutral-600: #4b545e;
  --fly-neutral-700: #353c45;
  --fly-neutral-800: #20262d;
  --fly-neutral-900: #131820;
  --fly-neutral-950: #0b0e16;

  /* ---------- PRIMITIVE: status ------------------------------------------- */
  --fly-green-600:  #15924f;
  --fly-amber-600:  #b7791f;
  --fly-red-600:    #c2362f;

  /* ---------- PRIMITIVE: typography --------------------------------------- */
  --fly-font-sans: 'Inter Variable', 'Inter', system-ui, -apple-system, 'Segoe UI',
    Roboto, Helvetica, Arial, sans-serif;
  --fly-font-mono: 'JetBrains Mono Variable', 'JetBrains Mono', ui-monospace,
    SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;

  --fly-text-xs:   0.75rem;   /* 12 */
  --fly-text-sm:   0.875rem;  /* 14 */
  --fly-text-base: 1rem;      /* 16 */
  --fly-text-md:   1.125rem;  /* 18 */
  --fly-text-lg:   1.25rem;   /* 20 */
  --fly-text-xl:   1.5rem;    /* 24 */
  --fly-text-2xl:  1.875rem;  /* 30 */
  --fly-text-3xl:  2.25rem;   /* 36 */
  --fly-text-4xl:  3rem;      /* 48 */

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

  --fly-leading-tight:   1.15;
  --fly-leading-snug:    1.3;
  --fly-leading-normal:  1.6;
  --fly-leading-relaxed: 1.7;

  --fly-tracking-tight:  -0.02em;
  --fly-tracking-normal: 0;
  --fly-tracking-wide:   0.08em;   /* mono eyebrows */

  --fly-measure: 72ch;             /* max body line length */

  /* ---------- PRIMITIVE: spacing (4px base) ------------------------------- */
  --fly-space-1:  0.25rem;  /* 4  */
  --fly-space-2:  0.5rem;   /* 8  */
  --fly-space-3:  0.75rem;  /* 12 */
  --fly-space-4:  1rem;     /* 16 */
  --fly-space-5:  1.25rem;  /* 20 */
  --fly-space-6:  1.5rem;   /* 24 */
  --fly-space-8:  2rem;     /* 32 */
  --fly-space-10: 2.5rem;   /* 40 */
  --fly-space-12: 3rem;     /* 48 */
  --fly-space-16: 4rem;     /* 64 */
  --fly-space-20: 5rem;     /* 80 */
  --fly-space-24: 6rem;     /* 96 */
  --fly-space-32: 8rem;     /* 128 */

  /* ---------- PRIMITIVE: radius ------------------------------------------- */
  --fly-radius-sm: 0.375rem; /* 6  */
  --fly-radius-md: 0.5rem;   /* 8  — base & buttons (W2 §6.2) */
  --fly-radius-lg: 0.75rem;  /* 12 — cards (W2 §6.2) */
  --fly-radius-xl: 1rem;     /* 16 */
  --fly-radius-2xl:1.5rem;   /* 24 */
  --fly-radius-pill: 999px;  /* badges, avatars, dots only */

  /* ---------- PRIMITIVE: elevation --------------------------------------- */
  --fly-shadow-xs: 0 1px 2px rgba(11, 14, 22, 0.06);
  --fly-shadow-sm: 0 1px 3px rgba(11, 14, 22, 0.08), 0 1px 2px rgba(11, 14, 22, 0.05);
  --fly-shadow-md: 0 4px 14px rgba(11, 14, 22, 0.08);
  --fly-shadow-lg: 0 14px 36px rgba(11, 14, 22, 0.12);

  /* ---------- PRIMITIVE: z-index ----------------------------------------- */
  --fly-z-base: 1;
  --fly-z-dropdown: 1000;
  --fly-z-header: 1100;
  --fly-z-mega: 1200;
  --fly-z-overlay: 1300;
  --fly-z-drawer: 1310;
  --fly-z-modal: 1400;
  --fly-z-toast: 1500;

  /* ---------- PRIMITIVE: motion ------------------------------------------ */
  --fly-dur-fast: 120ms;
  --fly-dur-base: 200ms;
  --fly-dur-slow: 320ms;
  --fly-ease: cubic-bezier(0.4, 0, 0.2, 1);
  --fly-ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  /* ---------- LAYOUT scalars (responsive overrides below) ---------------- */
  --fly-container: 1200px;
  --fly-container-wide: 1320px;
  --fly-container-narrow: 760px;
  --fly-gutter: 1.5rem;
  --fly-section-y: var(--fly-space-24); /* 96 desktop */
  --fly-header-h: 4.5rem;               /* 72px */

  /* =========================================================================
     SEMANTIC TOKENS — LIGHT (default). Components use ONLY these.
     ========================================================================= */
  --fly-bg:            var(--fly-neutral-25);
  --fly-bg-subtle:     var(--fly-neutral-50);
  --fly-surface:       var(--fly-neutral-0);
  --fly-surface-2:     var(--fly-neutral-50);
  --fly-border:        var(--fly-neutral-200);
  --fly-border-strong: var(--fly-neutral-300);

  --fly-text:        var(--fly-neutral-900);
  --fly-text-muted:  var(--fly-neutral-600);
  --fly-text-subtle: var(--fly-neutral-500);
  --fly-text-inverse:var(--fly-neutral-50);

  --fly-primary:        var(--fly-indigo-600);
  --fly-primary-hover:  var(--fly-indigo-700);
  --fly-on-primary:     var(--fly-neutral-0);

  --fly-accent:        var(--fly-azure-600);
  --fly-accent-hover:  var(--fly-azure-700);
  --fly-on-accent:     var(--fly-neutral-0);

  --fly-focus:    var(--fly-indigo-600);
  --fly-ring:     0 0 0 3px rgba(43, 56, 184, 0.35);

  --fly-success: var(--fly-green-600);
  --fly-warning: var(--fly-amber-600);
  --fly-danger:  var(--fly-red-600);
  --fly-info:    var(--fly-azure-600);

  /* glow tints for dimensional-dark sections (U0) */
  --fly-glow-indigo: rgba(94, 114, 228, 0.20);
  --fly-glow-azure:  rgba(31, 190, 240, 0.16);

  color-scheme: light;
}

/* =============================================================================
   SEMANTIC TOKENS — DARK
   Applied when [data-theme="dark"] is set (by the inline theme-init script).
   ============================================================================= */
[data-theme='dark'] {
  --fly-bg:            var(--fly-neutral-950);
  --fly-bg-subtle:     var(--fly-neutral-900);
  --fly-surface:       var(--fly-neutral-900);
  --fly-surface-2:     var(--fly-neutral-800);
  --fly-border:        var(--fly-neutral-800);
  --fly-border-strong: var(--fly-neutral-700);

  --fly-text:        var(--fly-neutral-50);
  --fly-text-muted:  var(--fly-neutral-300);
  --fly-text-subtle: var(--fly-neutral-400);
  --fly-text-inverse:var(--fly-neutral-900);

  --fly-primary:       var(--fly-indigo-400);
  --fly-primary-hover: var(--fly-indigo-300);
  --fly-on-primary:    var(--fly-neutral-0);

  --fly-accent:        var(--fly-azure-400);
  --fly-accent-hover:  var(--fly-azure-300);
  --fly-on-accent:     var(--fly-neutral-950);

  --fly-focus: var(--fly-indigo-400);
  --fly-ring:  0 0 0 3px rgba(94, 114, 228, 0.45);

  --fly-info: var(--fly-azure-400);

  --fly-shadow-md: 0 4px 14px rgba(0, 0, 0, 0.4);
  --fly-shadow-lg: 0 14px 36px rgba(0, 0, 0, 0.5);

  color-scheme: dark;
}

/* ---------- responsive layout scalars ----------------------------------- */
@media (max-width: 1024px) {
  :root { --fly-section-y: var(--fly-space-20); } /* 80 */
}
@media (max-width: 768px) {
  :root {
    --fly-section-y: var(--fly-space-16); /* 64 */
    --fly-gutter: 1.25rem;
  }
}
