/* ==========================================================================
   Hermaily · Sistema de diseño — tokens
   Tipografía Jost (revival libre de Futura) + JetBrains Mono, autoalojadas.
   ========================================================================== */

/* Sustituto con métricas ajustadas a Jost: el texto no salta al cargar la fuente. */
@font-face {
  font-family: "Jost Fallback";
  src: local("Arial"), local("Helvetica Neue"), local("Helvetica");
  size-adjust: 92.3%;
  ascent-override: 115.9%;
  descent-override: 40.6%;
  line-gap-override: 0%;
}

/* Ángulo y matiz animables: el acento «respira» sin JavaScript. */
@property --hm-angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}
@property --hm-shift {
  syntax: "<percentage>";
  inherits: false;
  initial-value: 0%;
}

:root {
  color-scheme: light;

  /* ---- Tipografía ---- */
  --font-sans: "Jost Variable", "Jost Fallback", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono Variable", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --fs-2xs: 0.6875rem; /* 11 · etiquetas en versalitas */
  --fs-xs: 0.75rem; /* 12 */
  --fs-sm: 0.875rem; /* 14 */
  --fs-base: 1rem; /* 16 · cuerpo */
  --fs-md: 1.125rem; /* 18 · títulos de tarjeta */
  --fs-lg: 1.375rem; /* 22 */
  --fs-xl: clamp(1.5rem, 1.2rem + 1vw, 2rem);
  --fs-display: clamp(2.25rem, 1.55rem + 2.6vw, 3.5rem); /* títulos de página */
  --fs-kpi: clamp(1.875rem, 1.4rem + 1.5vw, 2.625rem);
  --fs-kpi-hero: clamp(2.75rem, 1.9rem + 3.2vw, 4.5rem);
  --fs-hero: clamp(3.25rem, 1.4rem + 7vw, 7.5rem); /* portada de acceso */

  --lh-tight: 1.02;
  --lh-snug: 1.22;
  --lh-body: 1.55;
  --track-caps: 0.14em;
  --track-display: -0.032em;
  --track-tight: -0.015em;

  /* ---- Espaciado (escala 4/8) ---- */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-7: 32px;
  --sp-8: 40px;
  --sp-9: 48px;
  --sp-10: 64px;

  /* ---- Radios ---- */
  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --r-pill: 999px;

  /* ---- Movimiento ---- */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-1: 120ms; /* micro: hover, pulsación */
  --dur-2: 200ms; /* controles */
  --dur-3: 320ms; /* paneles, diálogos */
  --dur-4: 520ms; /* entradas de página */
  --dur-5: 900ms; /* dibujo de gráficos */
  --stagger: 28ms;

  /* ---- Dimensiones del armazón ---- */
  --sidebar-w: 264px;
  --rail-w: 76px;
  --topbar-h: 64px;
  --bottom-h: 64px;
  --content-max: 1280px;
  --tap: 40px;

  /* ---- Marca ---- */
  --brand-1: #6d5dfc;
  --brand-2: #3b82f6;
  --brand-3: #22d3ee;
  --brand-4: #a855f7;
  --g-brand: linear-gradient(115deg, var(--brand-1) 0%, var(--brand-2) 52%, var(--brand-3) 100%);
  --g-brand-wide: linear-gradient(115deg, var(--brand-1), var(--brand-2), var(--brand-3), var(--brand-4), var(--brand-1));

  /* ---- Tinta (paneles oscuros fijos: barra lateral, código, portada) ---- */
  --ink-0: #060918;
  --ink-1: #0b1028;
  --ink-2: #141a3a;
  --ink-3: #20284f;
  --ink-text: #eef0fb;
  --ink-muted: #9aa1c4;

  /* ---- Colores · tema claro ---- */
  --c-bg: #f4f5fa;
  --c-bg-glow: rgb(109 93 252 / 0.07);
  --c-surface: #ffffff;
  --c-surface-2: #f2f4f9;
  --c-surface-3: #e7eaf3;
  --c-overlay: rgb(255 255 255 / 0.78);
  --c-border: #e2e5ef;
  --c-border-strong: #c9cfdf;
  --c-text: #0b1028;
  --c-text-2: #353c5e;
  --c-muted: #5c6382; /* 5,9:1 sobre blanco */
  --c-faint: #8d93ad; /* solo elementos decorativos o texto grande */
  --c-accent: #4f46e5; /* 6,3:1 sobre blanco */
  --c-accent-hover: #4338ca;
  --c-accent-soft: #eef0ff;
  --c-accent-line: #c7c9fb;
  --c-focus: #6366f1;
  --c-scrim: rgb(6 9 24 / 0.48);

  --c-success: #047857;
  --c-success-soft: #e6f6ee;
  --c-success-line: #a6dfc2;
  --c-success-vivid: #10b981;
  --c-warning: #9a5a06;
  --c-warning-soft: #fdf2df;
  --c-warning-line: #f0cf95;
  --c-warning-vivid: #f59e0b;
  --c-danger: #be123c;
  --c-danger-soft: #fdebef;
  --c-danger-line: #f4b5c3;
  --c-danger-vivid: #f43f5e;
  --c-info: #1d4ed8;
  --c-info-soft: #eaf1fe;
  --c-info-line: #b8cdf8;
  --c-info-vivid: #3b82f6;
  --c-violet: #6d28d9;
  --c-violet-soft: #f1ebfe;
  --c-violet-line: #d5c3fb;
  --c-violet-vivid: #8b5cf6;
  --c-neutral: #4b5372;
  --c-neutral-soft: #eef0f5;
  --c-neutral-line: #d5d9e5;
  --c-neutral-vivid: #8d93ad;

  /* ---- Elevación ---- */
  --e-1: 0 1px 2px rgb(11 16 40 / 0.05), 0 0 0 1px rgb(11 16 40 / 0.02);
  --e-2: 0 1px 2px rgb(11 16 40 / 0.04), 0 8px 24px -10px rgb(11 16 40 / 0.14);
  --e-3: 0 16px 40px -12px rgb(11 16 40 / 0.22), 0 4px 12px -6px rgb(11 16 40 / 0.1);
  --e-4: 0 32px 80px -20px rgb(11 16 40 / 0.38), 0 8px 24px -12px rgb(11 16 40 / 0.18);
  --e-accent: 0 10px 30px -10px rgb(79 70 229 / 0.55);
}

/* ---- Tema oscuro: por preferencia del sistema o elección explícita ---- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --c-bg: #060918;
    --c-bg-glow: rgb(109 93 252 / 0.14);
    --c-surface: #0d1126;
    --c-surface-2: #131834;
    --c-surface-3: #1b2144;
    --c-overlay: rgb(13 17 38 / 0.78);
    --c-border: #1f2649;
    --c-border-strong: #2f3866;
    --c-text: #eef0fb;
    --c-text-2: #c5cae4;
    --c-muted: #979ec2;
    --c-faint: #646c94;
    --c-accent: #9a97ff;
    --c-accent-hover: #b4b2ff;
    --c-accent-soft: rgb(124 118 255 / 0.14);
    --c-accent-line: rgb(124 118 255 / 0.36);
    --c-focus: #8f8cff;
    --c-scrim: rgb(2 4 12 / 0.66);

    --c-success: #4ade9c;
    --c-success-soft: rgb(52 211 153 / 0.12);
    --c-success-line: rgb(52 211 153 / 0.32);
    --c-success-vivid: #34d399;
    --c-warning: #fbbf4a;
    --c-warning-soft: rgb(251 191 36 / 0.12);
    --c-warning-line: rgb(251 191 36 / 0.32);
    --c-warning-vivid: #fbbf24;
    --c-danger: #fb8197;
    --c-danger-soft: rgb(251 113 133 / 0.13);
    --c-danger-line: rgb(251 113 133 / 0.34);
    --c-danger-vivid: #fb7185;
    --c-info: #7cb2ff;
    --c-info-soft: rgb(96 165 250 / 0.13);
    --c-info-line: rgb(96 165 250 / 0.34);
    --c-info-vivid: #60a5fa;
    --c-violet: #c0a6ff;
    --c-violet-soft: rgb(167 139 250 / 0.14);
    --c-violet-line: rgb(167 139 250 / 0.34);
    --c-violet-vivid: #a78bfa;
    --c-neutral: #b4bad6;
    --c-neutral-soft: rgb(163 170 200 / 0.12);
    --c-neutral-line: rgb(163 170 200 / 0.26);
    --c-neutral-vivid: #7a82a8;

    --e-1: 0 1px 2px rgb(0 0 0 / 0.4), 0 0 0 1px rgb(255 255 255 / 0.02);
    --e-2: 0 1px 2px rgb(0 0 0 / 0.4), 0 10px 30px -12px rgb(0 0 0 / 0.6);
    --e-3: 0 18px 44px -14px rgb(0 0 0 / 0.7), 0 4px 12px -6px rgb(0 0 0 / 0.5);
    --e-4: 0 36px 90px -20px rgb(0 0 0 / 0.85);
    --e-accent: 0 12px 34px -10px rgb(109 93 252 / 0.6);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --c-bg: #060918;
  --c-bg-glow: rgb(109 93 252 / 0.14);
  --c-surface: #0d1126;
  --c-surface-2: #131834;
  --c-surface-3: #1b2144;
  --c-overlay: rgb(13 17 38 / 0.78);
  --c-border: #1f2649;
  --c-border-strong: #2f3866;
  --c-text: #eef0fb;
  --c-text-2: #c5cae4;
  --c-muted: #979ec2;
  --c-faint: #646c94;
  --c-accent: #9a97ff;
  --c-accent-hover: #b4b2ff;
  --c-accent-soft: rgb(124 118 255 / 0.14);
  --c-accent-line: rgb(124 118 255 / 0.36);
  --c-focus: #8f8cff;
  --c-scrim: rgb(2 4 12 / 0.66);

  --c-success: #4ade9c;
  --c-success-soft: rgb(52 211 153 / 0.12);
  --c-success-line: rgb(52 211 153 / 0.32);
  --c-success-vivid: #34d399;
  --c-warning: #fbbf4a;
  --c-warning-soft: rgb(251 191 36 / 0.12);
  --c-warning-line: rgb(251 191 36 / 0.32);
  --c-warning-vivid: #fbbf24;
  --c-danger: #fb8197;
  --c-danger-soft: rgb(251 113 133 / 0.13);
  --c-danger-line: rgb(251 113 133 / 0.34);
  --c-danger-vivid: #fb7185;
  --c-info: #7cb2ff;
  --c-info-soft: rgb(96 165 250 / 0.13);
  --c-info-line: rgb(96 165 250 / 0.34);
  --c-info-vivid: #60a5fa;
  --c-violet: #c0a6ff;
  --c-violet-soft: rgb(167 139 250 / 0.14);
  --c-violet-line: rgb(167 139 250 / 0.34);
  --c-violet-vivid: #a78bfa;
  --c-neutral: #b4bad6;
  --c-neutral-soft: rgb(163 170 200 / 0.12);
  --c-neutral-line: rgb(163 170 200 / 0.26);
  --c-neutral-vivid: #7a82a8;

  --e-1: 0 1px 2px rgb(0 0 0 / 0.4), 0 0 0 1px rgb(255 255 255 / 0.02);
  --e-2: 0 1px 2px rgb(0 0 0 / 0.4), 0 10px 30px -12px rgb(0 0 0 / 0.6);
  --e-3: 0 18px 44px -14px rgb(0 0 0 / 0.7), 0 4px 12px -6px rgb(0 0 0 / 0.5);
  --e-4: 0 36px 90px -20px rgb(0 0 0 / 0.85);
  --e-accent: 0 12px 34px -10px rgb(109 93 252 / 0.6);
}

/* Punteros gruesos: objetivos táctiles de al menos 44 px. */
@media (pointer: coarse) {
  :root {
    --tap: 44px;
  }
}

/* Movimiento reducido: sin animaciones decorativas y transiciones instantáneas. */
@media (prefers-reduced-motion: reduce) {
  :root {
    --dur-1: 1ms;
    --dur-2: 1ms;
    --dur-3: 1ms;
    --dur-4: 1ms;
    --dur-5: 1ms;
    --stagger: 0ms;
  }
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
}
