/* Design system "Grafite & Azul" — tokens and base (DESIGN-SYSTEM.md §2, §4, §5).
 *
 * Generic: nothing in here knows about certificates. app.css builds the app's
 * components on top of these tokens. Screens use the SEMANTIC tokens only —
 * never a raw color. Dark theme = class `.dark` on <html>.
 */

@font-face {
  font-family: 'Geist';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../fonts/geist-latin-wght-normal.woff2') format('woff2-variations');
}
@font-face {
  font-family: 'Geist Mono';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../fonts/geist-mono-latin-wght-normal.woff2') format('woff2-variations');
}

:root {
  color-scheme: light;
  /* layers (back to front) */
  --canvas: #f3f3f2;
  --panel: #ffffff;
  --surface-1: #f7f7f6;
  --surface-2: #ffffff;
  --surface-3: #f0f0ef;
  --inner-line: #e9e9e7;
  --elevated: #ffffff;
  --hover: #f2f2f1;
  --active: #eaeae8;
  --line: #e7e7e5;
  --line-strong: #d5d5d2;
  --input: #ffffff;
  --row: #f7f7f6;
  --row-hover: #f0f0ef;

  /* text — all ≥ AA */
  --fg: #1a1a1c;
  --fg-muted: #5e5e64;
  --fg-subtle: #717177;

  /* the single accent */
  --accent: #0a6fe0;
  --accent-hover: #0b5cc5;
  --accent-fg: #ffffff;
  --accent-text: #0a62cc;
  --accent-soft: rgb(10 111 224 / 0.09);
  --accent-bright: #1e7ff2;
  --accent-track: rgb(10 111 224 / 0.14);

  /* meaning */
  --success: #16a34a;  --success-text: #15803d;  --success-soft: rgb(22 163 74 / 0.10);
  --warning: #f59e0b;  --warning-text: #b45309;  --warning-soft: rgb(245 158 11 / 0.12);
  --danger:  #dc2626;  --danger-text:  #b91c1c;  --danger-soft:  rgb(239 68 68 / 0.09);
  --danger-solid: #dc2626;
  --info:    #0891b2;  --info-text:    #0e7490;  --info-soft:    rgb(8 145 178 / 0.10);
  --violet:  #7c3aed;  --violet-text:  #6d28d9;  --violet-soft:  rgb(124 58 237 / 0.09);

  --ring: rgb(10 111 224 / 0.35);
  --overlay: rgb(20 20 22 / 0.32);
  --shadow-color: 30 6% 12%;
  --hatch-on: rgb(255 255 255 / 0.28);

  /* shadows (§5) */
  --shadow-xs: 0 1px 2px hsl(var(--shadow-color) / 0.06);
  --shadow-sm: 0 1px 3px hsl(var(--shadow-color) / 0.08), 0 1px 2px hsl(var(--shadow-color) / 0.04);
  --shadow-md: 0 4px 12px -2px hsl(var(--shadow-color) / 0.10), 0 2px 4px -2px hsl(var(--shadow-color) / 0.06);
  --shadow-lg: 0 12px 28px -8px hsl(var(--shadow-color) / 0.18), 0 4px 10px -4px hsl(var(--shadow-color) / 0.08);
  --shadow-xl: 0 24px 56px -12px hsl(var(--shadow-color) / 0.28), 0 8px 18px -6px hsl(var(--shadow-color) / 0.10);
  --shadow-inset-panel: 0 0 0 1px hsl(var(--shadow-color) / 0.02), 0 8px 30px -12px hsl(var(--shadow-color) / 0.14), 0 2px 6px -2px hsl(var(--shadow-color) / 0.05);
  --shadow-primary: inset 0 1px 0 rgb(255 255 255 / 0.16), 0 1px 2px hsl(var(--shadow-color) / 0.12);

  /* radii and motion (§5) */
  --r-sm: 5px; --r-md: 7px; --r-lg: 10px; --r-xl: 14px; --r-2xl: 16px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --dur: 150ms;

  --font: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  /* the real visible height (mobile browser bars); kept in sync by app.js */
  --app-h: 100vh;
}

.dark {
  color-scheme: dark;
  --canvas: #0c0c0e;
  --panel: #141417;
  --surface-1: #19191c;
  --surface-2: #202024;
  --surface-3: #29292e;
  --inner-line: rgb(255 255 255 / 0.035);
  --elevated: #1d1d21;
  --hover: #222226;
  --active: #2a2a2f;
  --line: #26262a;
  --line-strong: #36363c;
  --input: #111114;
  --row: #1c1c20;
  --row-hover: #232327;

  --fg: #ededef;
  --fg-muted: #a8a8b0;
  --fg-subtle: #88888f;

  --accent: #1270e3;
  --accent-hover: #2a82f0;
  --accent-fg: #ffffff;
  --accent-text: #5aa8ff;
  --accent-soft: rgb(30 139 255 / 0.14);
  --accent-bright: #1e8bff;
  --accent-track: rgb(30 139 255 / 0.20);

  --success: #22c55e;  --success-text: #4ade80;  --success-soft: rgb(34 197 94 / 0.13);
  --warning: #f59e0b;  --warning-text: #fbbf24;  --warning-soft: rgb(245 158 11 / 0.14);
  --danger:  #ef4444;  --danger-text:  #f87171;  --danger-soft:  rgb(239 68 68 / 0.14);
  --danger-solid: #dc2626;
  --info:    #22d3ee;  --info-text:    #67e8f9;  --info-soft:    rgb(34 211 238 / 0.12);
  --violet:  #8b5cf6;  --violet-text:  #b9a1fc;  --violet-soft:  rgb(139 92 246 / 0.16);

  --ring: rgb(30 139 255 / 0.45);
  --overlay: rgb(0 0 0 / 0.6);
  --shadow-color: 0 0% 0%;
  --hatch-on: rgb(255 255 255 / 0.20);
}

/* Theme switch without flashing: app.js adds this for 2 frames. */
.theme-switching, .theme-switching * { transition: none !important; }

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

/* ---- base ---- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html, body {
  height: 100%;
  background: var(--canvas);
  color: var(--fg);
  font-family: var(--font);
  font-size: 13px;
  line-height: 20px;
  font-feature-settings: 'ss01', 'cv11';
  -webkit-font-smoothing: antialiased;
}
code, kbd, pre, .mono { font-family: var(--font-mono); }
.num { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum', 'ss01'; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* section label (§4) */
.section-label {
  font-size: 10.5px; line-height: 16px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--fg-subtle);
}

/* nested card (§8.5) */
.card-outer      { border-radius: var(--r-xl); background: var(--surface-1); padding: 4px; }
.card-outer-head { display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 10px; font-size: 13px; font-weight: 500; }
.card-inner      { border-radius: var(--r-lg); border: 1px solid var(--inner-line); background: var(--surface-2); }

/* signature hatch (§6): only where something is automated or in progress */
.bg-hatch {
  background-image: repeating-linear-gradient(135deg, var(--hatch-on) 0 4px, transparent 4px 8px);
}
.hatch-animate { animation: hatch-move 1s linear infinite; background-size: 11.3px 11.3px; }
@keyframes hatch-move { from { background-position: 0 0; } to { background-position: 11.3px 0; } }

/* thin scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }
