/* ==========================================================================
   ANSELTRONICA — Reset, base tipográfica y accesibilidad
   ========================================================================== */

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

* {
  margin: 0;
}

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

body {
  min-height: 100dvh;
  background-color: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-synthesis-weight: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body.is-locked {
  overflow: hidden;
}

/* Fondo técnico global: retícula de plano + halos de instrumentación */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background-image:
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: var(--grid-size) var(--grid-size);
  mask-image: radial-gradient(ellipse 100% 80% at 50% 0%, #000 20%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 100% 80% at 50% 0%, #000 20%, transparent 78%);
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -3;
  pointer-events: none;
  background:
    radial-gradient(ellipse 60% 45% at 12% -4%, rgba(132, 204, 22, 0.12), transparent 70%),
    radial-gradient(ellipse 55% 40% at 92% 6%, rgba(101, 163, 13, 0.14), transparent 72%),
    radial-gradient(ellipse 70% 50% at 50% 108%, rgba(77, 124, 15, 0.1), transparent 75%);
}

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

img,
video {
  height: auto;
}

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

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

ul,
ol {
  list-style: none;
  padding: 0;
}

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

table {
  border-collapse: collapse;
}

/* ------------------------------------------------------------- tipografía */

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: var(--lh-heading);
  letter-spacing: var(--ls-tight);
  text-wrap: balance;
}

h1 {
  font-size: var(--fs-h1);
  letter-spacing: var(--ls-tighter);
}
h2 {
  font-size: var(--fs-h2);
  letter-spacing: var(--ls-tighter);
}
h3 {
  font-size: var(--fs-h3);
}
h4 {
  font-size: var(--fs-h4);
  line-height: 1.32;
}

p {
  text-wrap: pretty;
}

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

::selection {
  background: rgba(132, 204, 22, 0.35);
  color: #1a2413;
}

/* --------------------------------------------------------------- enlaces */

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: 3px;
  border-radius: var(--r-xs);
}

/* -------------------------------------------------------- accesibilidad */

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: var(--gutter);
  z-index: 999;
  padding: 0.85rem 1.35rem;
  background: var(--c-accent);
  color: #1a2413;
  font-weight: 600;
  border-radius: 0 0 var(--r-sm) var(--r-sm);
  transition: top var(--t-base) var(--ease-out);
}

.skip-link:focus {
  top: 0;
}

[hidden] {
  display: none !important;
}

/* ------------------------------------------------------- preferencias */

@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;
    scroll-behavior: auto !important;
  }
}

@media (prefers-contrast: more) {
  :root {
    --c-text-soft: #3f4d33;
    --c-text-muted: #54613f;
    --c-border: rgba(58, 82, 32, 0.4);
  }
}

@media print {
  body::before,
  body::after {
    display: none;
  }
  .site-header,
  .site-footer,
  .to-top {
    display: none !important;
  }
}
