/* =============================================
   BASE: Reset + Tipografía + Utilidades
   juanmazapata.site v2.0
   ============================================= */

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

html {
  scroll-behavior: auto !important;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
  overflow-x: clip;
}

html.lenis, html.lenis body {
  height: auto;
}

.lenis.lenis-smooth {
  scroll-behavior: auto !important;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  overflow-x: clip;
}

@media (hover: hover) {
  body.js-cursor-active, body.js-cursor-active a, body.js-cursor-active button, body.js-cursor-active [role="button"] { cursor: none; }
}

img, video { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
button { font-family: inherit; border: none; background: none; cursor: pointer; }
input, textarea, select { font-family: inherit; }

/* ─── TIPOGRAFÍA ─────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.12;
  color: var(--text-primary);
}

h1 { font-size: clamp(2.8rem, 7vw, 6.5rem); font-family: var(--font-display); font-weight: 800; }
h2 { font-size: clamp(1.9rem, 4vw, 3.2rem); }
h3 { font-size: clamp(1.25rem, 2.5vw, 1.8rem); }
h4 { font-size: clamp(1.05rem, 2vw, 1.35rem); }

p { color: var(--text-secondary); line-height: 1.78; }

/* ─── CONTENEDOR ─────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: clamp(20px, 5vw, 56px);
}
.container--md { max-width: var(--container-md); }
.container--sm { max-width: var(--container-sm); }

/* ─── UTILIDADES ─────────────────────────────── */
.text-gradient {
  background: var(--gradient-text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.text-accent  { color: var(--accent); }
.text-muted   { color: var(--text-muted); }
.text-center  { text-align: center; }
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border-width: 0;
}

.section-label {
  font-size: 0.72rem;
  font-family: var(--font-body);
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

/* ─── SCROLLBAR ──────────────────────────────── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: rgba(232, 93, 48, 0.3); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ─── SELECCIÓN ──────────────────────────────── */
::selection { background-color: rgba(232, 93, 48, 0.35); color: #fff; }

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

/* ─── ANCHOR OFFSET ──────────────────────────── */
[id] { scroll-margin-top: 88px; }

/* ─── SCROLL VIGNETTES (DESVANECIDO OSCURO CINEMATOGRÁFICO) ─ */
.scroll-vignette {
  position: fixed;
  left: 0;
  right: 0;
  pointer-events: none;
  z-index: 45;
  transition: opacity 0.45s cubic-bezier(0.16, 1, 0.3, 1), height 0.45s cubic-bezier(0.16, 1, 0.3, 1), transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, height, transform;
}

/* Viñeta superior: desvanece y sumerge en la oscuridad lo que sube */
.scroll-vignette--top {
  top: 0;
  height: 150px;
  background: linear-gradient(
    to bottom,
    #0e0e10 0%,
    rgba(14, 14, 16, 0.96) 35%,
    rgba(14, 14, 16, 0.72) 65%,
    rgba(14, 14, 16, 0.28) 85%,
    transparent 100%
  );
  opacity: 0.9;
}

/* Viñeta inferior: desvanece y sumerge en la oscuridad lo que baja */
.scroll-vignette--bottom {
  bottom: 0;
  height: 150px;
  background: linear-gradient(
    to top,
    #0e0e10 0%,
    rgba(14, 14, 16, 0.96) 35%,
    rgba(14, 14, 16, 0.72) 65%,
    rgba(14, 14, 16, 0.28) 85%,
    transparent 100%
  );
  opacity: 0.9;
}

/* Intensificación más oscura y profunda al desplazarse */
body.scrolling-down .scroll-vignette--top {
  opacity: 1;
  height: 215px;
}
body.scrolling-down .scroll-vignette--bottom {
  opacity: 0.65;
  height: 120px;
}

body.scrolling-up .scroll-vignette--bottom {
  opacity: 1;
  height: 215px;
}
body.scrolling-up .scroll-vignette--top {
  opacity: 0.65;
  height: 120px;
}

/* Desaparición en el fondo: al anclar en el footer, la viñeta inferior desaparece por completo */
body.at-bottom .scroll-vignette--bottom {
  opacity: 0 !important;
  transform: translateY(24px);
  pointer-events: none;
}
body.at-bottom .scroll-vignette--radial {
  opacity: 0.25;
}

/* Viñeta radial cinematográfica periférica que se intensifica al desplazar */
.scroll-vignette--radial {
  top: 0;
  bottom: 0;
  height: 100vh;
  background: radial-gradient(
    ellipse at center,
    transparent 50%,
    rgba(14, 14, 16, 0.4) 75%,
    rgba(14, 14, 16, 0.85) 100%
  );
  opacity: 0.65;
}

body.scrolling-down .scroll-vignette--radial,
body.scrolling-up .scroll-vignette--radial {
  opacity: 0.88;
}

/* Adaptación responsive para pantallas móviles: viñetas sutiles que no obstaculizan lectura */
@media (max-width: 768px) {
  .scroll-vignette--top,
  .scroll-vignette--bottom {
    height: 55px;
    opacity: 0.75;
  }
  body.scrolling-down .scroll-vignette--top {
    height: 75px;
    opacity: 0.9;
  }
  body.scrolling-down .scroll-vignette--bottom {
    height: 40px;
    opacity: 0.45;
  }
  body.scrolling-up .scroll-vignette--bottom {
    height: 75px;
    opacity: 0.9;
  }
  body.scrolling-up .scroll-vignette--top {
    height: 40px;
    opacity: 0.45;
  }
  .scroll-vignette--radial {
    opacity: 0.35;
    background: radial-gradient(
      ellipse at center,
      transparent 65%,
      rgba(14, 14, 16, 0.3) 85%,
      rgba(14, 14, 16, 0.65) 100%
    );
  }
  body.scrolling-down .scroll-vignette--radial,
  body.scrolling-up .scroll-vignette--radial {
    opacity: 0.55;
  }
}

.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  z-index: 10000;
  padding: 12px 24px;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: 0 0 8px 8px;
  text-decoration: none;
  transition: top 0.2s;
}
.skip-link:focus {
  top: 0;
}

@media print {
  body { background: #fff !important; color: #000 !important; }
  .navbar, .cursor-dot, .cursor-ring, .scroll-vignette, .ticker-wrap, .footer, .particles-canvas, .hero__bg, .about__bg { display: none !important; }
  * { box-shadow: none !important; text-shadow: none !important; }
}
