/* ============================================================
   Tema institucional — Preparación Champagnat (Sofía)
   Paleta derivada del escudo Maristas Chile y del sitio
   https://www.cch.maristas.cl :
   - Azul marista  #363777 (escudo) / #2c276d, #3c50a0 (portada)
   - Rojo marista  #dc0b1c (escudo)  → texto accesible #b00d18
   - Dorado marista #ffd500 (escudo) / #ffcd00 (botones del sitio)
   ============================================================ */
:root {
  --azul: #363777;
  --azul-oscuro: #2c276d;
  --azul-medio: #3c50a0;
  --rojo: #b00d18;
  --rojo-vivo: #dc0b1c;
  --dorado: #ffd500;
  --dorado-suave: #fff3bf;
  --tinta: #232333;
  --tinta-suave: #5a5a6e;
  --fondo: #f4f4f8;
  --panel: #ffffff;
  --borde: #d9d9e6;
  --azul-suave: #e9eaf5;
  --nav-alto: 3.5rem;
}

/* ---------- Base (sobrescribe el CSS de pandoc) ---------- */
html { background-color: var(--fondo); color: var(--tinta); }
body {
  max-width: 46rem;
  padding: calc(var(--nav-alto) + 1.6rem) 1.25rem 4rem;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.06rem;
  line-height: 1.65;
  color: var(--tinta);
}
@media (min-width: 768px) {
  body { font-size: 1.12rem; padding-left: 2rem; padding-right: 2rem; }
}
h1, h2, h3, h4, h5 {
  font-family: 'Avenir Next', 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  color: var(--azul);
  line-height: 1.25;
}
h1 { font-size: 1.55rem; margin-top: 1.2em; }
h2 {
  font-size: 1.28rem;
  margin-top: 2em;
  padding-bottom: 0.25em;
  border-bottom: 3px solid var(--dorado);
}
h3 { font-size: 1.12rem; }
a { color: var(--azul-medio); }
a:visited { color: var(--azul); }
strong { color: inherit; }
blockquote {
  color: var(--tinta-suave);
  border-left: 4px solid var(--azul-medio);
  margin-left: 0;
  padding-left: 1em;
}
hr { border: 0; border-top: 1px solid var(--borde); margin: 2rem 0; }
code { background: var(--azul-suave); border-radius: 4px; padding: 0.08em 0.3em; }

/* ---------- Tablas: scroll propio y estilo ---------- */
table { border-collapse: collapse; width: 100%; font-size: 0.95em; }
th, td { border: 1px solid var(--borde); padding: 0.45em 0.6em; text-align: left; }
th { background: var(--azul); color: #ffffff; font-family: 'Avenir Next', 'Segoe UI', Arial, sans-serif; }
tr:nth-child(even) td { background: #f7f7fb; }
.table-wrap, .tabla-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 1rem 0; }
.table-wrap > table { min-width: 30rem; }

/* ---------- Enlace "volver" de las páginas generadas ---------- */
nav.vuelta { margin: 0 0 1rem; font-family: 'Avenir Next', 'Segoe UI', Arial, sans-serif; font-size: 0.92rem; }
nav.vuelta a { color: var(--tinta-suave); text-decoration: none; }
nav.vuelta a:hover { color: var(--azul); text-decoration: underline; }

/* ---------- Menú superior fijo ---------- */
#menu-sitio {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  background: var(--azul);
  border-bottom: 3px solid var(--dorado);
  font-family: 'Avenir Next', 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
}
#menu-sitio .barra {
  max-width: 72rem;
  margin: 0 auto;
  min-height: var(--nav-alto);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0 1rem;
}
#menu-sitio .marca {
  color: #ffffff;
  text-decoration: none;
  font-weight: 600;
  font-size: 1.02rem;
  letter-spacing: 0.01em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
}
#menu-sitio .marca .mm {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.7rem; height: 1.7rem;
  background: var(--dorado); color: var(--azul-oscuro);
  border-radius: 6px; font-weight: 700; font-size: 0.95rem;
}
#btn-mapa {
  appearance: none;
  background: transparent;
  color: #ffffff;
  border: 2px solid rgba(255, 255, 255, 0.55);
  border-radius: 8px;
  min-height: 44px;
  padding: 0.35rem 0.9rem;
  font: inherit;
  font-weight: 600;
  font-size: 0.98rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
#btn-mapa:hover, #btn-mapa:focus-visible { background: var(--azul-medio); border-color: var(--dorado); }
#btn-mapa:focus-visible { outline: 3px solid var(--dorado); outline-offset: 2px; }
#btn-mapa[aria-expanded="true"] { background: var(--azul-oscuro); border-color: var(--dorado); }

/* Panel del mapa del sitio */
#mapa-sitio {
  display: none;
  background: var(--panel);
  border-bottom: 3px solid var(--dorado);
  box-shadow: 0 12px 24px rgba(20, 20, 60, 0.25);
  max-height: calc(100vh - var(--nav-alto) - 3px);
  max-height: calc(100dvh - var(--nav-alto) - 3px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
#mapa-sitio.abierto { display: block; }
#mapa-sitio .grupos {
  max-width: 72rem;
  margin: 0 auto;
  padding: 1.1rem 1rem 1.4rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1.1rem 1.6rem;
}
#mapa-sitio h2 {
  margin: 0 0 0.4rem;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--azul);
  border-bottom: 2px solid var(--dorado);
  padding-bottom: 0.25rem;
}
#mapa-sitio ul { list-style: none; margin: 0; padding: 0; }
#mapa-sitio li { margin: 0; }
#mapa-sitio a {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 44px;
  padding: 0.3rem 0.4rem;
  border-radius: 6px;
  color: var(--tinta);
  text-decoration: none;
  font-size: 0.97rem;
  line-height: 1.3;
}
#mapa-sitio a:visited { color: var(--tinta); }
#mapa-sitio a:hover { background: var(--azul-suave); color: var(--azul-oscuro); }
#mapa-sitio a:focus-visible { outline: 3px solid var(--azul-medio); outline-offset: -2px; }
#mapa-sitio a[aria-current="page"] { background: var(--dorado-suave); font-weight: 600; }
#mapa-sitio .chip-pauta {
  flex: none;
  background: #fdeaea;
  color: var(--rojo);
  border: 1px solid var(--rojo);
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.05rem 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
#mapa-sitio .chip-pdf {
  flex: none;
  background: var(--azul-suave);
  color: var(--azul);
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.05rem 0.5rem;
}
#mapa-sitio .nota-pauta {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 0.88rem;
  color: var(--rojo);
  background: #fdeaea;
  border-radius: 8px;
  padding: 0.5rem 0.8rem;
}

/* ---------- Figuras con leyenda ---------- */
figure.figura {
  margin: 1.6rem auto;
  max-width: 26rem;
  text-align: center;
}
figure.figura.ancha { max-width: 36rem; }
figure.figura img {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--borde);
  border-radius: 8px;
  background: #ffffff;
  padding: 0.4rem;
  box-shadow: 0 2px 8px rgba(20, 20, 60, 0.08);
}
figure.figura figcaption {
  font-family: 'Avenir Next', 'Segoe UI', Arial, sans-serif;
  font-size: 0.85rem;
  color: var(--tinta-suave);
  margin-top: 0.5rem;
  line-height: 1.4;
}

/* ---------- Aviso de pauta ---------- */
.aviso-pauta {
  background: #fdeaea;
  border-left: 5px solid var(--rojo-vivo);
  border-radius: 0 8px 8px 0;
  padding: 0.75rem 1rem;
  margin: 1rem 0 1.5rem;
  font-family: 'Avenir Next', 'Segoe UI', Arial, sans-serif;
  font-size: 0.98rem;
  color: var(--rojo);
  font-weight: 600;
}

/* ---------- Impresión ---------- */
@media print {
  #menu-sitio, #mapa-sitio, nav.vuelta { display: none !important; }
  html, body { background: #ffffff; }
  body { padding-top: 0; max-width: none; font-size: 11pt; }
  h1, h2, h3 { color: #000000; }
  h2 { border-bottom-color: #999999; }
  th { background: #eeeeee !important; color: #000000; }
  figure.figura img { box-shadow: none; }
  a { color: #000000; text-decoration: none; }
}
