/* ==========================================================================
   CEPC · Panel de Control
   base.css — Reinicio, tipografía y utilidades generales.
   ========================================================================== */

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

* { margin: 0; }

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

body {
  min-height: 100dvh;
  /* Respeta el notch y la barra de gestos en los teléfonos. */
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  overflow-x: hidden;
  background: var(--fondo);
  color: var(--texto);
  font-family: var(--fuente);
  font-size: var(--t-base);
  line-height: 1.55;
  font-weight: 400;
  letter-spacing: -0.006em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

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

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

/* En Windows con modo oscuro, las opciones nativas heredan el color del
   sistema si no se fija explícitamente. */
select option {
  background-color: var(--superficie);
  color: var(--texto);
}

/* Toque en móvil: sin retardo de doble tap ni destello gris de Android. */
a, button, summary, label, [role='button'], input, select, textarea {
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(81, 130, 242, 0.18);
}

h1, h2, h3, h4 {
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.022em;
  text-wrap: balance;
}

h1 { font-size: var(--t-2xl); }
h2 { font-size: var(--t-xl); }
h3 { font-size: var(--t-lg); }
h4 { font-size: var(--t-md); }

p { text-wrap: pretty; }

a {
  color: var(--marca);
  text-decoration: none;
  transition: color var(--v-rapida) var(--ease-suave);
}
a:hover { color: var(--marca-hover); }

code, kbd, samp, .num, .mono {
  font-family: var(--fuente-mono);
  font-size: 0.92em;
  font-variant-numeric: tabular-nums;
}

code {
  background: var(--superficie-3);
  border: 1px solid var(--borde);
  border-radius: var(--r-xs);
  padding: 0.1em 0.38em;
}

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

ul, ol { padding-left: 1.15rem; }

/* --- Foco visible --------------------------------------------------------- */

:focus-visible {
  outline: 2px solid var(--marca);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}
:focus:not(:focus-visible) { outline: none; }

/* --- Barras de desplazamiento -------------------------------------------- */

* { scrollbar-width: thin; scrollbar-color: var(--borde-fuerte) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--borde-fuerte);
  border: 3px solid transparent;
  background-clip: content-box;
  border-radius: var(--r-pill);
}
*::-webkit-scrollbar-thumb:hover { background-color: var(--texto-3); background-clip: content-box; }

/* --- Selección ------------------------------------------------------------ */

::selection {
  background: var(--marca-tenue-2);
  color: var(--texto);
}

/* --- Utilidades ----------------------------------------------------------- */

.visualmente-oculto {
  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;
}

.saltar-al-contenido {
  position: fixed;
  top: var(--e-3);
  left: var(--e-3);
  z-index: 200;
  transform: translateY(-160%);
  background: var(--marca);
  color: #fff;
  padding: 0.6rem 1rem;
  border-radius: var(--r-md);
  font-weight: 500;
  transition: transform var(--v-media) var(--ease);
}
.saltar-al-contenido:focus { transform: translateY(0); color: #fff; }

.texto-tenue { color: var(--texto-3); }
.texto-suave { color: var(--texto-2); }
.texto-marca { color: var(--marca); }
.texto-pequeno { font-size: var(--t-sm); }
.texto-mini { font-size: var(--t-xs); }
.ta-der { text-align: right; }
.ta-cen { text-align: center; }
.negrita { font-weight: 600; }
.mayusculitas {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: var(--t-xs);
  font-weight: 600;
  color: var(--texto-3);
}
.nowrap { white-space: nowrap; }
.sin-margen { margin: 0; }
.ancho-completo { width: 100%; }

.pila { display: flex; flex-direction: column; gap: var(--e-3); }
.pila--sm { gap: var(--e-2); }
.pila--lg { gap: var(--e-5); }
.fila { display: flex; align-items: center; gap: var(--e-3); flex-wrap: wrap; }
.fila--entre { justify-content: space-between; }
.fila--fin { justify-content: flex-end; }
.fila--sm { gap: var(--e-2); }
.fila--apretada { flex-wrap: nowrap; }

.rejilla { display: grid; gap: var(--e-4); }
.rejilla--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.rejilla--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.rejilla--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.rejilla--auto { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

@media (max-width: 1100px) {
  .rejilla--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rejilla--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .rejilla--2,
  .rejilla--3,
  .rejilla--4 { grid-template-columns: minmax(0, 1fr); }
}

/* --- Tema: mostrar/ocultar según modo ------------------------------------- */

:root[data-tema='oscuro'] .solo-claro { display: none; }
:root[data-tema='claro'] .solo-oscuro { display: none; }

/* --- Animaciones compartidas ---------------------------------------------- */

@keyframes aparecer {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

@keyframes aparecer-suave {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes escalar-entrada {
  from { opacity: 0; transform: translateY(14px) scale(0.975); }
  to   { opacity: 1; transform: none; }
}

@keyframes pulso-suave {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.45; }
}

@keyframes brillo-cargando {
  from { background-position: -420px 0; }
  to   { background-position: 420px 0; }
}

@keyframes girar {
  to { transform: rotate(360deg); }
}
