/* ==========================================================================
   Finflow v2 — base
   Tokens, reset and typography shared by every section.
   Section styles live in css/sections/*.css and must be scoped to their
   own root class — nothing in a section file may style a bare element.
   ========================================================================== */

/* ─── Tokens ──────────────────────────────────────────────────────────── */
:root {
  /* Blue scale (carried over from the original site) */
  --blue-50:  #EBF3FC;
  --blue-100: #C5DCF7;
  --blue-200: #93BEF0;
  --blue-400: #378ADD;
  --blue-600: #1565C0;
  --blue-700: #0D47A1;
  --blue-800: #0A2F6B;
  --blue-900: #061A40;

  /* Text */
  --text-body:      #1a1f2e;
  --text-primary:   #0D1B2A;
  --text-secondary: #4A5568;
  --text-muted:     #8A95A3;

  /* Surfaces & lines */
  --surface:        #ffffff;
  --surface-raised: #F7F9FC;
  --border:         rgba(0,0,0,0.08);
  --border-strong:  rgba(0,0,0,0.14);

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  /* Type */
  --font-display: 'Plus Jakarta Sans', sans-serif;
  --font-body:    'DM Sans', sans-serif;
  --font-mono:    'DM Mono', 'Courier New', monospace;

  /* Section headers — every section uses the same scale */
  --fs-section-title: clamp(30px, 3.2vw, 42px);
  --fs-section-sub:   clamp(16px, 1.3vw, 18px);

  /* Motion */
  --ease-sweep: cubic-bezier(0.76, 0, 0.24, 1);   /* button sweep / arrow */
  --ease-out:   cubic-bezier(0.22, 1, 0.36, 1);   /* reveals, panels */
  --transition: 0.22s ease;

  /* Accent roles (switch with the theme) */
  --accent:      var(--blue-600);
  --accent-text: var(--blue-700);
  --accent-soft: var(--blue-50);
  --accent-line: var(--blue-200);

  /* Status */
  --good:      #12806A;
  --good-soft: #DDF3EC;
  --warn:      #B4400A;
  --warn-soft: #FDEBDD;

  /* Layout */
  --nav-height: 64px;
  /* One container for the whole site: the header, every section and the
     footer share these edges so content lines up down the page.
     --page-px  side margin, scaling 20px (phones) → 48px (laptops+)
     --container max content width
     --gutter   side padding for full-width bars (e.g. the header) that
                lines their content up with the container               */
  --container: 1280px;
  --page-px: clamp(20px, 4vw, 48px);
  --gutter: max(var(--page-px), calc((100% - var(--container)) / 2));
  --z-header: 1000;

  color-scheme: light;
}

/* ─── Dark theme ──────────────────────────────────────────────────────────
   Applied via <html data-theme="dark"> (set by js/core/theme-init.js from
   the saved choice, or the OS preference when nothing is saved).
   ──────────────────────────────────────────────────────────────────────── */
:root[data-theme="dark"] {
  --text-body:      #D3DDEC;
  --text-primary:   #EEF4FC;
  --text-secondary: #A7B6CC;
  --text-muted:     #7C8BA3;

  --surface:        #061530;
  --surface-raised: #0B1F42;
  --border:         rgba(255,255,255,0.08);
  --border-strong:  rgba(255,255,255,0.18);

  --accent:      var(--blue-400);
  --accent-text: var(--blue-200);
  --accent-soft: rgba(55,138,221,0.16);
  --accent-line: rgba(147,190,240,0.45);

  --good:      #4FD1B0;
  --good-soft: rgba(79,209,176,0.14);
  --warn:      #FFA066;
  --warn-soft: rgba(255,160,102,0.14);

  color-scheme: dark;
}

@media (max-width: 600px) {
  :root { --nav-height: 56px; }
}

/* ─── Reset ───────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* anchors jump straight to their target, no smooth scroll */
html {
  scroll-padding-top: var(--nav-height);
}

body {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-body);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Set by the header while the mobile drawer is open */
body.is-scroll-locked { overflow: hidden; }

img, svg { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; }
ul, ol { list-style: none; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ─── Typography ──────────────────────────────────────────────────────── */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--text-primary);
  font-weight: 600;
  letter-spacing: -0.4px;
  line-height: 1.15;
}

/* ─── Utilities ───────────────────────────────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: 8px; left: 8px;
  z-index: calc(var(--z-header) + 10);
  padding: 10px 16px;
  background: var(--blue-700);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  border-radius: var(--radius-sm);
  transform: translateY(-160%);
  transition: transform var(--transition);
}
.skip-link:focus { transform: translateY(0); }

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