/*
  base.css — reset, utilidades compartidas y accesibilidad.
  Sin colores de marca: cada página los define en su propio archivo de tokens.
*/

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

* {
  margin: 0;
}

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

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

body {
  min-height: 100svh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

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

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

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

ul[role="list"],
ol[role="list"] {
  list-style: none;
  padding: 0;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: inherit;
  line-height: 1.1;
}

p {
  max-width: 70ch;
}

/* ---------- Accesibilidad ---------- */

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

.skip-link {
  position: absolute;
  top: -999px;
  left: 0;
  z-index: 1000;
  padding: 12px 20px;
  background: var(--color-texto);
  color: var(--color-fondo);
  font-weight: 600;
  border-radius: 0 0 8px 0;
}

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

:focus-visible {
  outline-offset: 3px;
}

/* ---------- Layout utilities ---------- */

.container {
  width: 100%;
  max-width: var(--page-max-width, 1200px);
  margin-inline: auto;
  padding-inline: 20px;
}

@media (min-width: 768px) {
  .container {
    padding-inline: 40px;
  }
}

.visually-hidden-focusable:not(:focus):not(:focus-within) {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

/* ---------- Lightbox (compartido entre ambas páginas) ---------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: color-mix(in srgb, var(--color-texto) 88%, transparent);
}

.lightbox[data-open="true"] {
  display: flex;
}

.lightbox__figure {
  position: relative;
  max-width: min(900px, 92vw);
  max-height: 86vh;
}

.lightbox__img {
  width: 100%;
  height: auto;
  max-height: 86vh;
  object-fit: contain;
  border-radius: 12px;
}

.lightbox__caption {
  color: var(--color-fondo);
  font-size: 14px;
  margin-top: 12px;
  text-align: center;
}

.lightbox__close {
  position: absolute;
  top: -48px;
  right: 0;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--color-fondo);
  color: var(--color-texto);
}

@media (max-width: 640px) {
  .lightbox__close {
    top: -56px;
    right: 4px;
  }
}

/* ---------- Progreso de lectura y volver arriba (colores en cada página) ---------- */

.read-progress {
  position: fixed;
  inset: 0 0 auto 0;
  height: 4px;
  z-index: 300;
  transform-origin: 0 50%;
  transform: scaleX(0);
  pointer-events: none;
}

.to-top {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 300;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  font-size: 20px;
  line-height: 1;
  opacity: 0;
  visibility: hidden;
  translate: 0 12px;
  transition: opacity 0.25s ease, translate 0.25s ease, visibility 0s linear 0.25s;
}

.to-top[data-visible="true"] {
  opacity: 1;
  visibility: visible;
  translate: 0 0;
  transition: opacity 0.25s ease, translate 0.25s ease, visibility 0s;
}

/* ---------- Fotos: zoom de entrada que se asienta + zoom suave al hover ----------
   Los estados animados solo existen con html.motion-ok (lo agrega main.js si
   no hay prefers-reduced-motion). Sin JS, las fotos se ven quietas y nítidas. */

.photo-zoom {
  overflow: clip;
}

.motion-ok .photo-zoom img {
  transition: scale 1.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.motion-ok .photo-zoom:not(.is-in) img {
  scale: 1.14;
}

@media (hover: hover) {
  .motion-ok .photo-zoom.is-in:hover img {
    scale: 1.05;
    transition-duration: 0.8s;
  }
}

.motion-ok .photo-zoom.is-in:focus-visible img {
  scale: 1.05;
  transition-duration: 0.8s;
}

@media print {
  .read-progress,
  .to-top {
    display: none;
  }
}
