/* File: /assets/css/base.css
 * Cimientos: reinicio, tipografía y ritmo vertical.
 *
 * Las variables las define theme.css (que genera el admin). Aquí solo se USAN,
 * nunca se escribe un color a mano: así el día que cambien los acentos, cambia
 * todo el sitio y no hay que ir a buscar hexadecimales sueltos por los módulos.
 */

/* ── Reinicio ─────────────────────────────────────────────────────────────── */

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

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  /* El desplazamiento suave se apaga solo para quien pidió menos movimiento. */
  scroll-behavior: smooth;
}

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

body {
  min-height: 100dvh;
  font-family: var(--font, system-ui, sans-serif);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text, #111827);
  /* Fondo explícito: el visor pinta su propio lienzo detrás, y un body
     transparente toma prestado el tema del anfitrión. */
  background: var(--bg, #f6f7fb);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

img { height: auto; }

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

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

p, h1, h2, h3, h4, h5, h6 { overflow-wrap: break-word; }

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

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

hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }

/* Solo se ve el aro al navegar con teclado: con el ratón estorba, sin él la
   plataforma es inusable para quien no usa ratón. */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

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

/* ── Tipografía ───────────────────────────────────────────────────────────── */

h1, h2, h3, h4 {
  font-weight: 650;
  line-height: 1.22;
  letter-spacing: -.021em;
  color: var(--text);
}

h1 { font-size: 1.72rem; }
h2 { font-size: 1.32rem; }
h3 { font-size: 1.08rem; }
h4 { font-size: .96rem; }

@media (min-width: 768px) {
  h1 { font-size: 2.05rem; }
  h2 { font-size: 1.48rem; }
}

.lead      { font-size: 1.02rem; color: var(--text-soft); line-height: 1.62; }
.muted     { color: var(--text-soft); }
.mute      { color: var(--text-mute); }
.small     { font-size: .84rem; }
.tiny      { font-size: .76rem; }
.strong    { font-weight: 600; }
.nowrap    { white-space: nowrap; }
.center    { text-align: center; }
.right     { text-align: right; }
.accent    { color: var(--accent); }
.mono      { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .88em; }

/* Corta a N líneas con puntos suspensivos. Lo usan las tarjetas para que un
   texto largo no descuadre la rejilla. */
.clamp-1, .clamp-2, .clamp-3 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.clamp-1 { -webkit-line-clamp: 1; }
.clamp-2 { -webkit-line-clamp: 2; }
.clamp-3 { -webkit-line-clamp: 3; }

/* ── Contenedores y rejilla ───────────────────────────────────────────────── */

.container {
  width: 100%;
  max-width: 1120px;
  margin-inline: auto;
  padding-inline: 16px;
}
.container-narrow { max-width: 720px; }
.container-wide   { max-width: 1360px; }

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

.grid { display: grid; gap: 16px; }

/* auto-fit con minmax en vez de un número fijo de columnas: la rejilla se
   reacomoda sola y no hace falta una regla por punto de corte. */
.grid-auto  { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.grid-cards { grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }

.grid-2 { grid-template-columns: 1fr; }
.grid-3 { grid-template-columns: 1fr; }
.grid-4 { grid-template-columns: repeat(2, 1fr); }

@media (min-width: 640px) {
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 992px) {
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
}

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.row-between { justify-content: space-between; }
.row-end     { justify-content: flex-end; }
.row-center  { justify-content: center; }
.row-top     { align-items: flex-start; }
.row-tight   { gap: 8px; }

.stack { display: flex; flex-direction: column; gap: 14px; }
.stack-sm { gap: 8px; }
.stack-lg { gap: 22px; }

.fill  { flex: 1 1 auto; min-width: 0; }
.spacer{ flex: 1 1 auto; }

/* ── Espaciado ────────────────────────────────────────────────────────────── */

.mt-0{margin-top:0}   .mt-1{margin-top:6px}  .mt-2{margin-top:12px}
.mt-3{margin-top:18px}.mt-4{margin-top:26px} .mt-5{margin-top:38px}
.mb-0{margin-bottom:0}.mb-1{margin-bottom:6px}.mb-2{margin-bottom:12px}
.mb-3{margin-bottom:18px}.mb-4{margin-bottom:26px}.mb-5{margin-bottom:38px}

/* ── Ayudantes de visibilidad ─────────────────────────────────────────────── */

.hidden { display: none !important; }

/* only-desktop SOLO oculta. No impone display al mostrarse: cuando lo hacía,
   un botón que era flex pasaba a block y el icono se le iba encima del texto. */
@media (max-width: 991px) { .only-desktop { display: none !important; } }
@media (min-width: 992px) { .only-mobile  { display: none !important; } }

/* Visible para lectores de pantalla, invisible en pantalla. */
.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;
}

/* Salta directo al contenido. Aparece solo al tabular. */
.skip-link {
  position: absolute;
  left: 12px; top: -60px;
  z-index: 200;
  background: var(--accent);
  color: var(--accent-text);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  transition: top .18s;
}
.skip-link:focus { top: 12px; color: var(--accent-text); }
