/* ==========================================================================
   base.css — fuentes, tokens de color y tipografía, reseteo
   Tema oscuro por defecto. El claro se activa con <html data-theme="light">.
   ========================================================================== */

/* Fuentes alojadas en local (subconjunto latino, cubre el español) */
@font-face {
  font-family: "Manrope";
  src: url("../fonts/manrope-latin.woff2") format("woff2");
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
  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";
  src: url("../fonts/jetbrains-mono-latin.woff2") format("woff2");
  font-weight: 400 500;
  font-style: normal;
  font-display: swap;
  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;
}

/* Tokens: tema oscuro (por defecto) */
:root {
  color-scheme: dark;

  --bg: #0f1b2d;
  --surface: #172740;
  --text: #e8eef5;
  --text-muted: #a9b7c9;
  --accent: #2dd4bf;
  --accent-hover: #7ee8d9;
  --accent-ink: #0f1b2d; /* texto sobre fondo de acento */
  --warm: #ffb4a2;
  --border: #2a3b57;
  --border-strong: #6b7f9e; /* bordes de controles (3:1 mínimo) */
  --focus: #ffd400;

  --font-body: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --step--1: clamp(0.85rem, 0.83rem + 0.1vw, 0.9rem);
  --step-0: clamp(1rem, 0.96rem + 0.2vw, 1.125rem);
  --step-1: clamp(1.2rem, 1.1rem + 0.5vw, 1.45rem);
  --step-2: clamp(1.6rem, 1.3rem + 1.4vw, 2.25rem);
  --step-3: clamp(2.1rem, 1.4rem + 3.4vw, 3.8rem);

  --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: clamp(3rem, 2rem + 5vw, 6rem);

  --radius: 0.75rem;
  --gutter: clamp(1rem, 0.5rem + 2.5vw, 2rem);
  --max-width: 70rem;
}

/* Tokens: tema claro (lo elige la persona usuaria con el botón de tema) */
:root[data-theme="light"] {
  color-scheme: light;

  --bg: #f7f8fb;
  --surface: #ffffff;
  --text: #0f1b2d;
  --text-muted: #4a5a70;
  --accent: #0f766e;
  --accent-hover: #115e59;
  --accent-ink: #ffffff;
  --warm: #b4452b;
  --border: #c9d2e0;
  --border-strong: #7a8699;
  --focus: #2b44ff;
}

/* Reseteo mínimo */
*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img,
svg,
video {
  display: block;
  max-width: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

/* Tipografía */
h1,
h2,
h3 {
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

h1 {
  font-size: var(--step-3);
}

h2 {
  font-size: var(--step-2);
}

h3 {
  font-size: var(--step-1);
}

p {
  max-width: 65ch;
}

a {
  color: var(--accent);
  text-underline-offset: 0.2em;
}

a:hover {
  color: var(--accent-hover);
}

/* Foco visible para teclado, en los dos temas */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 2px;
}

::selection {
  background: var(--accent);
  color: var(--accent-ink);
}

/* Respetar la preferencia de movimiento reducido */
@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;
  }
}
