/* ============================================================
   GoDatalize │ Finanzas — Brand foundation
   Source of truth: docs/brand/identidad-para-sistemas.md (§5, §6, §12)
   Loaded before every other stylesheet. Components should use
   these --color-* / --font-* tokens; the legacy variables in
   main.css are aliases of them.
   ============================================================ */

/* ── Self-hosted fonts (SIL OFL, latin subset) ─────────────── */
@font-face {
  font-family: 'Sora';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/sora-latin-600-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Sora';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/sora-latin-700-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter Variable';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../fonts/inter-latin-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/jetbrains-mono-latin-500-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ── Dark theme (Approved, default) ────────────────────────── */
:root {
  color-scheme: dark;
  --color-bg: #0a0e14;
  --color-surface: #121823;
  --color-surface-raised: #1a2230;
  --color-border: #2a3446;
  --color-border-strong: #5b6982;
  --color-text: #e8edf4;
  --color-text-body: #c9d2de;
  --color-text-muted: #9aa6b8;
  --color-brand: #36d7b7;
  --color-brand-hover: #62e3ca;
  --color-brand-active: #2bbfa2;
  --color-on-brand: #04211b;
  --color-brand-tint: rgb(54 215 183 / 0.1);
  --color-flow: #6e9bff;
  --color-decision: #ffb547;
  --color-success: #5ee08f;
  --color-error: #ff7a7a;
  --color-focus: var(--color-decision);

  /* Translucent versions for chips, icon backgrounds and selected rows */
  --color-flow-tint: rgb(110 155 255 / 0.12);
  --color-decision-tint: rgb(255 181 71 / 0.12);
  --color-success-tint: rgb(94 224 143 / 0.12);
  --color-error-tint: rgb(255 122 122 / 0.12);
  --color-success-on-tint: var(--color-success);
  --color-error-on-tint: var(--color-error);
  --color-flow-on-tint: var(--color-flow);
  --color-decision-on-tint: var(--color-decision);
  --color-brand-on-tint: var(--color-brand);
  --color-overlay: rgb(10 14 20 / 0.72);

  --font-display: 'Sora', ui-sans-serif, system-ui, sans-serif;
  --font-body: 'Inter Variable', 'Inter', ui-sans-serif, system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', monospace;

  --space-1: 0.25rem; --space-2: 0.5rem; --space-3: 0.75rem; --space-4: 1rem; --space-5: 1.5rem;
  --space-6: 2rem; --space-7: 3rem; --space-8: 4rem; --space-9: 6rem; --space-10: 8rem;

  --brand-radius-sm: 6px; --brand-radius-md: 10px; --brand-radius-lg: 14px; --brand-radius-xl: 20px;
  --border-width: 1px;
  --highlight-1: inset 0 1px 0 rgb(255 255 255 / 0.06);
  --shadow-2: 0 12px 32px rgb(0 0 0 / 0.4);

  --motion-fast: 150ms; --motion-base: 200ms; --motion-reveal: 400ms;
  --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);
  --target-min: 44px;
}

/* ── Light theme (Proposal for systems; user-selectable) ───── */
:root[data-theme="light"] {
  color-scheme: light;
  --color-bg: #f5f7fa;
  --color-surface: #ffffff;
  --color-surface-raised: #ffffff;
  --color-border: #d5dce5;
  --color-border-strong: #7a879b;
  --color-text: #0a0e14;
  --color-text-body: #2b3442;
  --color-text-muted: #556277;
  --color-brand: #0a7f6c;
  --color-brand-hover: #086a5a;
  --color-brand-active: #075a4c;
  --color-on-brand: #ffffff;
  --color-brand-tint: rgb(10 127 108 / 0.1);
  --color-flow: #3459c9;
  --color-decision: #b45309;
  --color-success: #15803d;
  --color-error: #c0362c;
  --color-focus: var(--color-decision);

  --color-flow-tint: rgb(52 89 201 / 0.1);
  --color-decision-tint: rgb(180 83 9 / 0.1);
  --color-success-tint: rgb(21 128 61 / 0.1);
  --color-error-tint: rgb(192 54 44 / 0.1);
  /* Text on its own tint (badges, alerts, chips): the same hue, deeper, so it
     keeps 4.5:1 over the tint (WCAG 1.4.3). Approved colours stay as they are. */
  --color-success-on-tint: #136f37;
  --color-error-on-tint: #a53028;
  --color-flow-on-tint: #2e4eae;
  --color-decision-on-tint: #9a490b;
  --color-brand-on-tint: #0a6e5f;
  --color-overlay: rgb(10 14 20 / 0.45);

  --highlight-1: none;
  --shadow-2: 0 12px 32px rgb(10 14 20 / 0.12);
}

/* Dark tokens inside a light page (e.g. the ink cover band of the PDF report) */
.theme-dark-scope {
  color-scheme: dark;
  --color-bg: #0a0e14;
  --color-surface: #121823;
  --color-surface-raised: #1a2230;
  --color-border: #2a3446;
  --color-border-strong: #5b6982;
  --color-text: #e8edf4;
  --color-text-body: #c9d2de;
  --color-text-muted: #9aa6b8;
  --color-brand: #36d7b7;
  --color-on-brand: #04211b;
  --color-brand-tint: rgb(54 215 183 / 0.1);
  --color-flow: #6e9bff;
  --color-decision: #ffb547;
  --color-success: #5ee08f;
  --color-error: #ff7a7a;
  background: var(--color-bg);
  color: var(--color-text);
}
.theme-dark-scope .brand-on-light { display: none; }
.theme-dark-scope .brand-on-dark { display: block; }

/* ── Base typography ───────────────────────────────────────── */
html {
  font-family: var(--font-body);
  /* Tabular figures everywhere: amounts line up in columns and don't jump while updating */
  font-variant-numeric: tabular-nums;
}

h1, h2, h3, .font-display {
  font-family: var(--font-display);
  font-weight: 600;
}
h1 { font-weight: 700; letter-spacing: -0.015em; }
h2 { letter-spacing: -0.01em; }

/* Amounts and numeric columns: tabular figures in Inter (§5 "Cifras y montos").
   The mono font is reserved for codes and references, not amounts. */
.amount, .money, .stat-value, .font-mono-amount, td.num, th.num,
[data-amount], .tabular-nums {
  font-variant-numeric: tabular-nums;
}

/* Uppercase labels (§5 text-label) */
.text-label {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ── Icons: Lucide, 1.5px stroke (§7), drawn as a mask so they take the text colour ─
   Templates: {{ icon('camera') }} · JS: icon('camera'). Sizes: 16 (small text), 20 (buttons), 24 (cards). */
.ico {
  display: inline-block;
  flex-shrink: 0;
  width: 1.25em;
  height: 1.25em;
  vertical-align: -0.25em;
  background-color: currentColor;
  -webkit-mask: var(--ico) center / contain no-repeat;
  mask: var(--ico) center / contain no-repeat;
}
/* Inline line icons follow the same 1.5px stroke */
svg[stroke="currentColor"] { stroke-width: 1.5; }

.ico-16 { width: 16px; height: 16px; }
.ico-20 { width: 20px; height: 20px; }
.ico-24 { width: 24px; height: 24px; }
.ico-32 { width: 32px; height: 32px; }

/* ── Focus: 2px decision ring with 2px offset (§9) ─────────── */
:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

/* ── Co-brand lockup: [symbol + GoDatalize] │ System name (§2) ─ */
.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}
.brand-lockup__logo {
  display: block;
  height: 24px;
  width: auto;
  flex-shrink: 0;
}
.brand-lockup__symbol {
  display: block;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}
.brand-lockup__divider {
  width: 1px;
  align-self: stretch;
  min-height: 20px;
  background: var(--color-border);
  flex-shrink: 0;
}
.brand-lockup__name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  line-height: 1;
  color: var(--color-text-muted);
  white-space: nowrap;
}
/* Inline symbol: arc in the brand colour, node in the decision colour.
   Uses the tokens, so it is the "oscuro" palette on dark and the "claro" palette on light. */
.brand-symbol {
  display: block;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}
.brand-symbol path { stroke: var(--color-brand); }
.brand-symbol circle { fill: var(--color-decision); }

/* Logo files per theme: dark palette by default, light palette in light theme */
.brand-on-light { display: none; }
:root[data-theme="light"] .brand-on-dark { display: none; }
:root[data-theme="light"] .brand-on-light { display: block; }

/* ── Motion (§6): no loops, honour reduced motion ──────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
