/* ============================================================
   base.css — Reset, tipografía, layout y accesibilidad
   ============================================================ */

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

* {
  margin: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

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

/* Bandas oscuras (bloques de autoridad): superficie + textura de puntos sutil.
   El fondo por defecto de la página es claro; el ritmo lo dan las .band--dark. */
.band--dark {
  position: relative;
  background-color: var(--bg);
  color: var(--text);
}

.band--dark::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image: radial-gradient(var(--grid-dot) 1px, transparent 1.5px);
  background-size: 30px 30px;
  pointer-events: none;
}

/* El contenido de la banda va por encima de la textura */
.band--dark > * {
  position: relative;
  z-index: 1;
}

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

a {
  color: var(--link);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

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

/* --- Tipografía --- */
h1,
h2,
h3 {
  font-family: var(--font-display);
  line-height: 1.1;
  font-weight: 650;
  letter-spacing: -0.02em;
  color: var(--text);
  text-wrap: balance;
}

h1 {
  font-size: var(--fs-h1);
  letter-spacing: -0.03em;
}

h2 {
  font-size: var(--fs-h2);
}

h3 {
  font-size: var(--fs-h3);
  letter-spacing: -0.01em;
}

p {
  text-wrap: pretty;
}

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

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

.section {
  padding-block: var(--section-y);
  border-top: 1px solid var(--border);
  scroll-margin-top: 5rem;
}

.section__head {
  max-width: var(--measure);
  margin-bottom: clamp(2rem, 4vw, 3rem);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: var(--fs-eyebrow);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-text);
  margin-bottom: 1rem;
}

.eyebrow::before {
  content: "";
  width: 1.75rem;
  height: 1px;
  background: var(--accent);
  opacity: 0.6;
}

.lead {
  font-size: var(--fs-lead);
  color: var(--text-muted);
  max-width: var(--measure);
  line-height: 1.55;
}

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

/* --- Botones --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font: inherit;
  font-size: 1rem;
  font-weight: 550;
  line-height: 1;
  padding: 0.95rem 1.5rem;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.2s var(--ease), background-color 0.2s var(--ease),
    border-color 0.2s var(--ease), color 0.2s var(--ease);
  text-decoration: none;
}

.btn:hover {
  text-decoration: none;
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(0);
}

.btn--primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

.btn--primary:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.btn--ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}

.btn--ghost:hover {
  background: var(--bg-elev-2);
  border-color: var(--text-muted);
}

.btn__icon {
  width: 1.1em;
  height: 1.1em;
}

/* --- Accesibilidad --- */
:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--focus-ring);
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  z-index: 1000;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 0.75rem 1.25rem;
  border-radius: 0 0 var(--radius-sm) 0;
  font-weight: 600;
}

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

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

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

/* --- Reveal al hacer scroll (microinteracción discreta) ---
   .reveal se oculta por defecto y app.js lo va revelando. Sin JS, noscript.css
   lo muestra (fallback de robustez/accesibilidad), cargado vía <noscript>. */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
  will-change: opacity, transform;
}

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

/* Respeta a quien prefiere menos movimiento (sin !important: solo
   elementos animados de este proyecto, ya que controlamos todo el CSS) */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .btn,
  .site-header,
  .service-card,
  .nav__toggle {
    transition: none;
  }
  .btn:hover,
  .btn:active {
    transform: none;
  }
}
