/* =====================================================================================
   Seoffix Tech Lab — Unified Web Design Tokens
   =====================================================================================
   The single source of truth for colour, type, spacing and elevation across every
   seoffix.com surface: public pages and all tools, /dashboard, /admin/, and /agents.

   Values are locked to design/SEOFFIX_CLOUDFLARE_W3CRM_VISUAL_SPEC.md Section 2.
   Change a value here and every page follows. Never hardcode a hex outside this file.

   Light is the default. Dark applies through html.dark, which the theme cookie drives.
   ===================================================================================== */

:root {
  /* --- Brand accent ------------------------------------------------------------- */
  --sfx-primary: #0D99FF;
  --sfx-primary-hover: #0A7FD6;
  --sfx-primary-deep: #2563EB;
  --sfx-primary-soft: rgba(13, 153, 255, 0.10);

  /* --- Surfaces ----------------------------------------------------------------- */
  --sfx-canvas: #F8FAFC;
  --sfx-sidebar-bg: #FFFFFF;
  --sfx-card-bg: #FFFFFF;
  --sfx-subtle-bg: #F3F4F6;
  --sfx-hover-bg: #F1F5F9;
  --sfx-surface-2: #F1F5F9;

  /* --- Borders and hairlines ---------------------------------------------------- */
  --sfx-border: #E5E7EB;
  --sfx-border-soft: #F1F5F9;
  --sfx-hairline: #F1F5F9;

  /* --- Ink hierarchy ------------------------------------------------------------ */
  --sfx-ink: #111827;
  --sfx-ink-secondary: #374151;
  --sfx-muted: #64748B;
  --sfx-muted-light: #94A3B8;

  /* --- Semantic status ---------------------------------------------------------- */
  --sfx-green: #18A594;
  --sfx-green-soft: rgba(24, 165, 148, 0.12);
  --sfx-amber: #F59E0B;
  --sfx-amber-soft: rgba(245, 158, 11, 0.14);
  --sfx-red: #EF4444;
  --sfx-red-soft: rgba(239, 68, 68, 0.12);
  --sfx-pink: #EC4899;
  --sfx-violet: #7C5CFC;
  --sfx-blue: #3B82F6;

  /* --- Chart series (5-band choropleth and stacked bars) ------------------------ */
  --sfx-chart-1: #0D99FF;
  --sfx-chart-2: #18A594;
  --sfx-chart-3: #F59E0B;
  --sfx-chart-4: #EC4899;
  --sfx-chart-5: #7C5CFC;
  --sfx-chart-grid: #F1F5F9;
  --sfx-chart-axis: #64748B;
  --sfx-geo-0: #E5E7EB;
  --sfx-geo-1: #BFDBFE;
  --sfx-geo-2: #60A5FA;
  --sfx-geo-3: #2563EB;
  --sfx-geo-4: #1E3A8A;

  /* --- Typography --------------------------------------------------------------- */
  --sfx-font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --sfx-font-brand: 'Poppins', 'Inter', sans-serif;
  --sfx-font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sfx-fs-body: 13px;
  --sfx-fs-label: 11px;
  --sfx-fs-table: 12px;
  --sfx-fs-kpi: 20px;
  --sfx-lh-body: 1.45;

  /* --- Geometry ----------------------------------------------------------------- */
  --sfx-radius-card: 8px;
  --sfx-radius-ctrl: 6px;
  --sfx-radius-pill: 999px;
  --sfx-shadow-card: 0 1px 2px rgba(15, 23, 42, 0.04);
  --sfx-shadow-tab: 0 1px 2px rgba(15, 23, 42, 0.07);
  --sfx-shadow-tooltip: 0 4px 14px rgba(15, 23, 42, 0.10);

  /* --- Spacing scale ------------------------------------------------------------ */
  --sfx-gap: 12px;
  --sfx-space-1: 4px;
  --sfx-space-2: 8px;
  --sfx-space-3: 12px;
  --sfx-space-4: 16px;
  --sfx-space-5: 20px;
  --sfx-space-6: 24px;

  /* --- Layout dimensions -------------------------------------------------------- */
  --sfx-sidebar-w: 228px;
  --sfx-topbar-h: 48px;
  --sfx-tabbar-h: 46px;
}

/* Dark mode. Applied by html.dark, which the seoffix_theme cookie sets before paint. */
html.dark,
[data-theme="dark"] {
  --sfx-canvas: #0B1120;
  --sfx-sidebar-bg: #0F172A;
  --sfx-card-bg: #111827;
  --sfx-subtle-bg: #1E293B;
  --sfx-hover-bg: #1E293B;
  --sfx-surface-2: #1E293B;
  --sfx-border: #1F2937;
  --sfx-border-soft: #1E293B;
  --sfx-hairline: #182132;
  --sfx-ink: #F8FAFC;
  --sfx-ink-secondary: #CBD5E1;
  --sfx-muted: #94A3B8;
  --sfx-muted-light: #64748B;
  --sfx-primary-soft: rgba(13, 153, 255, 0.16);
  --sfx-shadow-card: 0 1px 2px rgba(0, 0, 0, 0.25);
  --sfx-chart-grid: #1E293B;
  --sfx-geo-0: #1E293B;
}

/* --- Base typography -------------------------------------------------------------- */
body.sfx-web,
body.sfx-web input,
body.sfx-web select,
body.sfx-web textarea,
body.sfx-web button {
  font-family: var(--sfx-font-ui);
}

body.sfx-web {
  font-size: var(--sfx-fs-body);
  line-height: var(--sfx-lh-body);
  color: var(--sfx-ink);
  background: var(--sfx-canvas);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Metrics, counts, latencies, percentages and timestamps all line up in columns. */
.sfx-num,
.sfx-kpi-num,
.sfx-rank-val,
.sfx-metric,
table.sfx-table td.sfx-num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.sfx-brand-wordmark {
  font-family: var(--sfx-font-brand);
  font-weight: 600;
}

/* Focus ring shared by every interactive element in the system. */
body.sfx-web :focus-visible {
  outline: 2px solid var(--sfx-primary);
  outline-offset: 2px;
}

/* Reduced-motion respect: charts and reveals stay still for anyone who asks. */
@media (prefers-reduced-motion: reduce) {
  body.sfx-web *,
  body.sfx-web *::before,
  body.sfx-web *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
