/* ==========================================================================
   base.css — fuentes, tokens de diseño, reset y utilidades globales
   ========================================================================== */

/* ---------- Fuentes autohospedadas (SIL OFL) ---------- */
@font-face {
  font-family: "Inter";
  src: url("../fonts/Inter.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Space Grotesk";
  src: url("../fonts/SpaceGrotesk.woff2") format("woff2");
  font-weight: 500 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/JetBrainsMono.woff2") format("woff2");
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  color-scheme: dark;

  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Space Grotesk", "Inter", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;

  /* Superficies */
  --bg: #080a09;
  --bg-elevated: #0d100e;
  --surface: #111513;
  --surface-2: #171c19;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);

  /* Texto */
  --text: #eef3ee;
  --text-muted: #a0aba3;
  --text-dim: #6f7a72;

  /* Acento */
  --accent: #6dff7c;
  --accent-2: #29e0b0;
  --accent-ink: #04120a; /* texto sobre fondos de acento */
  --accent-soft: rgba(109, 255, 124, 0.1);
  --accent-line: rgba(109, 255, 124, 0.28);
  --accent-gradient: linear-gradient(120deg, var(--accent), var(--accent-2));

  --danger: #ff7b72;

  /* Medidas */
  --container: 1160px;
  --gutter: clamp(1rem, 4vw, 2rem);
  --nav-h: 68px;
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;

  --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 20px 40px -24px rgba(0, 0, 0, 0.7);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

:root[data-theme="light"] {
  color-scheme: light;

  --bg: #f5f7f5;
  --bg-elevated: #ffffff;
  --surface: #ffffff;
  --surface-2: #eef2ee;
  --line: rgba(10, 24, 14, 0.1);
  --line-strong: rgba(10, 24, 14, 0.2);

  --text: #0c1410;
  --text-muted: #46524a;
  --text-dim: #66726a;

  --accent: #0a7a35;
  --accent-2: #0b8f74;
  --accent-ink: #ffffff;
  --accent-soft: rgba(10, 122, 53, 0.09);
  --accent-line: rgba(10, 122, 53, 0.35);

  --shadow-card: 0 1px 2px rgba(10, 24, 14, 0.06), 0 18px 36px -24px rgba(10, 24, 14, 0.25);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 16px);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

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

img {
  height: auto;
}

[hidden] {
  display: none !important;
}

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

ul,
ol {
  list-style: none;
}

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

button {
  cursor: pointer;
  background: none;
  border: 0;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-weight: 600;
}

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

/* ---------- Accesibilidad ---------- */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 200;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  transform: translateY(-200%);
  transition: transform 0.2s var(--ease);
}

.skip-link:focus {
  transform: translateY(0);
}

.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;
}

/* ---------- Layout ---------- */
.container {
  width: min(var(--container), 100% - var(--gutter) * 2);
  margin-inline: auto;
}

.section {
  padding-block: clamp(4rem, 9vw, 7rem);
  position: relative;
}

.section-head {
  max-width: 46rem;
  margin-bottom: clamp(2rem, 5vw, 3.5rem);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  color: var(--accent);
}

.eyebrow::before {
  content: "";
  width: 1.6rem;
  height: 1px;
  background: currentColor;
  opacity: 0.7;
}

.section-title {
  font-size: clamp(1.9rem, 4.2vw, 3rem);
  margin-bottom: 0.9rem;
}

.section-lead {
  color: var(--text-muted);
  font-size: clamp(1rem, 1.5vw, 1.125rem);
  max-width: 40rem;
}

.text-gradient {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- Fondo ambiental ---------- */
.ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(60rem 36rem at 85% -10%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 60%),
    radial-gradient(40rem 30rem at -10% 30%, color-mix(in srgb, var(--accent-2) 9%, transparent), transparent 60%),
    var(--bg);
}

.ambient::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 70% 55% at 50% 0%, #000 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 70% 55% at 50% 0%, #000 20%, transparent 75%);
  opacity: 0.5;
}

/* Resplandor que sigue al cursor (solo punteros precisos) */
.cursor-glow {
  position: fixed;
  top: 0;
  left: 0;
  z-index: -1;
  width: 34rem;
  height: 34rem;
  margin: -17rem 0 0 -17rem;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 11%, transparent), transparent 65%);
  opacity: 0;
  transition: opacity 0.4s var(--ease);
  will-change: transform;
}

.cursor-glow.is-active {
  opacity: 1;
}

/* ---------- Revelado al hacer scroll ---------- */
.js .reveal {
  opacity: 0;
  transform: translateY(22px);
  transition:
    opacity 0.7s var(--ease),
    transform 0.7s var(--ease);
  transition-delay: var(--reveal-delay, 0ms);
}

.js .reveal.is-visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  .js .reveal {
    opacity: 1;
    transform: none;
  }

  .cursor-glow {
    display: none;
  }
}
