/* ============================================================
 * base.css — Tipografía, body, selección y scrollbar.
 * ============================================================ */

/* Sin scroll-behavior global para que la rueda sea inmediata.
   El smooth sólo se aplica cuando el usuario clickea anclas del menú
   (gestionado desde JS vía window.scrollTo con behavior: 'smooth'). */

/* Color base en html para que los canvases a z-index:-1 sean visibles bajo el body */
html { background-color: var(--bg-primary); }

body {
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-weight: 400;
  color: var(--text-primary);
  background-color: transparent;
  position: relative;
}

body.modal-open { overflow: hidden; }

/* --- Tipografía --- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  line-height: var(--lh-heading);
  color: var(--text-primary);
  font-weight: 700;
  letter-spacing: -0.01em;
}

h1 { font-size: var(--fs-hero); line-height: var(--lh-tight); font-weight: 700; }
h2 { font-size: var(--fs-h2); font-weight: 600; }
h3 { font-size: var(--fs-h3); font-weight: 600; }

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

strong { color: var(--text-primary); font-weight: 600; }

code, kbd, samp {
  font-family: var(--font-display);
  font-size: 0.9em;
  color: var(--accent);
}

/* --- Texto mono/etiqueta terminal --- */
.mono {
  font-family: var(--font-display);
  font-size: var(--fs-small);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--accent);
}

.mono-prompt::before {
  content: '> ';
  color: var(--accent);
}

.mono-comment::before {
  content: '// ';
  color: var(--text-muted);
}

/* --- Enlaces --- */
a {
  color: var(--accent);
  transition: color var(--duration-fast) var(--ease-out);
}
a:hover { color: var(--text-primary); }

/* --- Selección --- */
::selection {
  background: var(--accent);
  color: var(--bg-primary);
  text-shadow: none;
}

/* --- Scrollbar custom --- */
html {
  scrollbar-width: thin;
  scrollbar-color: var(--accent) var(--bg-primary);
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb {
  background: var(--accent-hover);
  border-radius: var(--radius-sm);
  border: 2px solid var(--bg-primary);
}
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

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

/* --- Skip link --- */
.skip-link {
  position: absolute;
  top: -40px;
  left: var(--space-4);
  background: var(--accent);
  color: var(--bg-primary);
  padding: var(--space-2) var(--space-4);
  font-family: var(--font-display);
  font-size: var(--fs-small);
  z-index: var(--z-preloader);
  border-radius: var(--radius-sm);
  transition: top var(--duration-fast);
}
.skip-link:focus { top: var(--space-4); color: var(--bg-primary); }

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

/* --- Secciones --- */
.section {
  padding-block: var(--section-padding);
  position: relative;
}

.section-label {
  display: inline-block;
  font-family: var(--font-display);
  font-size: var(--fs-small);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--accent);
  margin-bottom: var(--space-4);
}

.section-title {
  font-family: var(--font-display);
  margin-bottom: var(--space-3);
  color: var(--text-primary);
}
.section-title .hash { color: var(--accent); }

.section-subtitle {
  font-family: var(--font-display);
  font-size: var(--fs-small);
  color: var(--text-secondary);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  margin-bottom: var(--space-7);
}
.section-subtitle::before { content: '> '; color: var(--accent); }

/* --- Scroll progress bar --- */
#scroll-progress {
  position: fixed;
  top: 0; left: 0;
  width: 0;
  height: 2px;
  background: var(--accent);
  z-index: var(--z-sticky);
  box-shadow: var(--glow-accent-sm);
  transition: width 100ms linear;
}

/* --- Canvases de fondo (starfield + matrix) --- */
#starfield-canvas,
#matrix-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
}
#starfield-canvas {
  z-index: -2;
  opacity: 1;
  /* Máscara vertical: intensidad plena en la zona del hero (primeros 100vh)
     y se desvanece hacia abajo, para que el fondo siga presente pero sin
     competir con las secciones inferiores. */
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 60%, rgba(0,0,0,0.35) 100%);
          mask-image: linear-gradient(180deg, #000 0%, #000 60%, rgba(0,0,0,0.35) 100%);
}
#matrix-canvas {
  z-index: -1;
  opacity: 0.08;
  transition: opacity 400ms;
}

/* En móvil el fondo de partículas compite con la lectura: lo atenuamos
   ~80% para que el texto respire. */
@media (max-width: 767px) {
  #starfield-canvas { opacity: 0.3; }
  #matrix-canvas    { opacity: 0.06; }
}

/* --- Utilidades --- */
.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;
}

.text-accent { color: var(--accent); }
.text-muted { color: var(--text-muted); }

.visually-hidden-mobile { }
@media (max-width: 767px) {
  .hide-mobile { display: none !important; }
}
@media (min-width: 1024px) {
  .hide-desktop { display: none !important; }
}
