/* ============================================================================
   CorporeIA · base.css
   Fuentes self-hosted, reset, tipografía base, utilidades y accesibilidad.
   ========================================================================== */

/* ---- Fuentes (woff2 locales, variables; sin peticiones externas) ---- */
@font-face {
  font-family: 'Geist';
  src: url('/assets/fonts/geist-latin.woff2') format('woff2');
  font-weight: 100 900;
  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+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Geist';
  src: url('/assets/fonts/geist-latin-ext.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Geist Mono';
  src: url('/assets/fonts/geist-mono-latin.woff2') format('woff2');
  font-weight: 100 900;
  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+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Geist Mono';
  src: url('/assets/fonts/geist-mono-latin-ext.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Instrument Serif';
  src: url('/assets/fonts/instrument-serif-latin.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Instrument Serif';
  src: url('/assets/fonts/instrument-serif-italic-latin.woff2') format('woff2');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}
html.lenis { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }

body {
  font-family: var(--font-sans);
  font-size: var(--t-body);
  font-weight: 420;
  line-height: 1.6;
  color: var(--ink-2);
  background: var(--bg-0);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;               /* el body nunca scrollea en horizontal */
  min-height: 100vh;
}

img, video, svg { display: block; max-width: 100%; height: auto; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
::selection { background: var(--lime); color: #0a0a0b; }

/* Scrollbar sobria */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--bg-0); }
::-webkit-scrollbar-thumb { background: #232329; border-radius: 5px; border: 2px solid var(--bg-0); }

/* ---- Foco visible (teclado) ---- */
:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 3px;
  border-radius: 2px;
}
.skip-link {
  position: fixed;
  top: -100%;
  left: 1rem;
  z-index: calc(var(--z-cursor) + 1);
  padding: .8rem 1.4rem;
  background: var(--lime);
  color: #0a0a0b;
  font-weight: 600;
  border-radius: 999px;
  transition: top var(--dur-fast) var(--ease-out);
}
.skip-link:focus-visible { top: 1rem; }

/* ---- Tipografía ---- */
h1, h2, h3, h4 {
  font-weight: 510;
  line-height: 1.04;
  letter-spacing: -.035em;
  color: var(--ink);
  text-wrap: balance;
}
h1 { font-size: var(--t-display); }
h2 { font-size: var(--t-title); }
h3 { font-size: var(--t-sub); letter-spacing: -.02em; line-height: 1.2; }
p  { max-width: 62ch; }
strong { color: var(--ink); font-weight: 560; }

/* Acento editorial: palabra en serif italic dentro de un titular */
.serif {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -.01em;
}
.text-lime { color: var(--lime); }
.text-cyan { color: var(--cyan); }
.text-grad {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Label mono de sección: "01 — CAPTACIÓN" */
.label {
  display: inline-flex;
  align-items: center;
  gap: .65em;
  font-family: var(--font-mono);
  font-size: var(--t-label);
  font-weight: 460;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.label::before {
  content: '';
  width: .5em;
  height: .5em;
  border-radius: 50%;
  background: currentColor;
  opacity: .55;
}
.label--lime { color: var(--lime); }
.label--cyan { color: var(--cyan); }

.mono {
  font-family: var(--font-mono);
  font-weight: 440;
  letter-spacing: .02em;
}

/* ---- Layout ---- */
.container {
  width: var(--container);
  margin-inline: auto;
}
.section {
  position: relative;
  padding-block: var(--sect);
}
main {
  position: relative;
  z-index: var(--z-content);
}
main:focus { outline: none; }

/* ---- Canvas del sistema (lo monta js/scene/system.js) ---- */
.system-canvas {
  position: fixed;
  inset: 0;
  z-index: var(--z-canvas);
  pointer-events: none;
}

/* ---- Grano (feTurbulence, tile SVG inline — cero peticiones) ---- */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: var(--z-grain);
  pointer-events: none;
  opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 240px 240px;
}

/* ---- Atmósfera de respaldo (sin WebGL o reduced-motion): auroras CSS ---- */
.no-webgl .system-canvas { display: none; }
.aurora {
  position: fixed;
  inset: 0;
  z-index: var(--z-canvas);
  pointer-events: none;
  display: none;
}
.no-webgl .aurora { display: block; }
.aurora::before,
.aurora::after {
  content: '';
  position: absolute;
  width: 60vmax;
  height: 60vmax;
  border-radius: 50%;
  filter: blur(90px);
  opacity: .14;
}
.aurora::before { background: radial-gradient(circle, var(--lime), transparent 65%); top: -22vmax; left: -14vmax; }
.aurora::after  { background: radial-gradient(circle, var(--cyan), transparent 65%); bottom: -24vmax; right: -12vmax; }

/* ---- Utilidades ---- */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.hairline { border: 0; border-top: 1px solid var(--line); }

/* ---- Estados de revelado (solo si hay JS; sin JS todo es visible) ---- */
html.js [data-reveal] { opacity: 0; }
html.js [data-reveal].is-revealed { opacity: 1; }
html.js .line-mask { overflow: hidden; display: block; }
html.js .line-mask > .line-inner { display: block; transform: translateY(115%); }

/* ---- Movimiento reducido: sin animaciones, contenido visible ---- */
@media (prefers-reduced-motion: reduce) {
  html.js [data-reveal] { opacity: 1 !important; transform: none !important; }
  html.js .line-mask > .line-inner { transform: none !important; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
