/* =============================================================
   BASE — reset, tipografía base, utilidades, accesibilidad
============================================================= */

/* ---- Tipografía local — Montserrat (Regular 400 / Bold 700) ----
   Ronda 3 (2026-07-28): cargada LOCALMENTE desde issets/fonts/ por
   pedido explícito del cliente — la tipografía corporativa no debe
   depender solo de Google Fonts para el "look" principal del sitio.
   Montserrat toma el rol de --font-body (ver tokens.css): texto de
   cuerpo, navegación, botones, formulario y footer en TODO el sitio —
   es el texto que domina visualmente la página, mucho más que el
   titular. Por eso Inter se retira del <link> de Google Fonts en
   index.html (ya no se usa en ningún token). Fraunces (titulares
   editoriales H1/H2, con su eje óptico variable) y JetBrains Mono
   (etiquetas técnicas) siguen viniendo de Google Fonts: no hay
   archivos locales provistos para esas dos, y su huella visual es
   mucho menor (titulares puntuales y etiquetas, no el cuerpo del
   sitio) — combinación "complementa con criterio", no reemplazo total. */
@font-face {
  font-family: 'Montserrat';
  src: url('../fonts/montserrat-400.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Montserrat';
  src: url('../fonts/montserrat-700.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

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

html {
  scroll-behavior: smooth;
  color-scheme: dark;
}

body {
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-ink);
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: var(--lh-normal);
}

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

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

ul, ol {
  list-style: none;
}

h1, h2, h3, h4 {
  font-weight: 600;
  line-height: var(--lh-tight);
}

/* ---- Selección de texto ---- */
::selection {
  background: var(--color-blue);
  color: var(--color-bg);
}

/* ---- Foco visible — piso de accesibilidad, nunca se retira ----
   Usa --color-focus (indirección) en vez de --color-cyan directo: las
   secciones con fondo claro (--color-surface-light) sobreescriben
   --color-focus localmente porque el cian pierde visibilidad de foco
   sobre un fondo crema (ver #clientes en layout.css). */
:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* ---- Utilidades ---- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-pad);
}

.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: -100%;
  left: var(--space-4);
  z-index: 10000;
  background: var(--color-signal);
  color: #1a1200;
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  font-weight: 700;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  transition: top var(--dur-fast) var(--ease-out);
}

.skip-link:focus {
  top: var(--space-4);
}

/* ---- Grano de textura editorial — sutil, no interactivo ---- */
#grain-overlay {
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  opacity: 0.045;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---- Cursor personalizado — solo pointer fino con hover (desktop) ---- */
@media (hover: hover) and (pointer: fine) {
  body { cursor: none; }

  #cursor-dot, #cursor-ring {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 9999;
    pointer-events: none;
    transform: translate(-50%, -50%);
    will-change: transform;
  }

  #cursor-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--color-cyan);
  }

  #cursor-ring {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid rgba(56, 189, 248, 0.55);
    mix-blend-mode: difference;
    transition: width var(--dur-fast) var(--ease-out), height var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out);
  }

  #cursor-ring.is-active {
    width: 58px;
    height: 58px;
    border-color: var(--color-signal);
  }

  /* Tinte de acento por fila en #proyectos — ver cursor.js. --cursor-tint
     se escribe por JS al entrar a una fila con [data-cursor-accent];
     no cambia el tamaño del anillo (eso sigue siendo exclusivo de
     is-active, reservado para elementos realmente clicables). */
  #cursor-ring.is-tinted {
    border-color: var(--cursor-tint, var(--color-signal));
  }
}

@media not all and (hover: hover) and (pointer: fine) {
  #cursor-dot, #cursor-ring { display: none; }
}

/* ---- Reduced motion — piso de accesibilidad ---- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
