/*
 * Estilo común del sitio de la escuela.
 * Colores de la marca: los mismos tokens que frontend/src/styles/app.css del repo de la app (tomados del escudo).
 * Fuentes propias en fuentes/ (OFL): ningún recurso de terceros, así no hay seguimiento.
 */
@font-face {
  font-family: "Inter";
  src: url("fuentes/inter.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("fuentes/jetbrains-mono.woff2") format("woff2");
  font-weight: 100 800;
  font-display: swap;
}

:root {
  --bg: #ffffff;
  --bg-alt: #f1f4f8;
  --surface: #ffffff;
  --text: #16202b;
  --text-soft: #3a4654;
  --muted: #586473;
  --accent: #1f66d9;
  --accent-hover: #1a56b8;
  --accent-soft: #e4edfc;
  --on-accent: #ffffff;
  --border: #d9e0e8;
  --green: #1e7a2b;
  --yellow: #f2c200;
  --red: #c9271c;
  /* Bloque oscuro de las especialidades: igual en los dos temas. */
  --ink: #0e1a2b;
  --ink-2: #16253a;
  --ink-text: #e8eef6;
  --ink-muted: #a9b6c7;
  --ink-border: #2a3b52;
  --shadow: 0 10px 30px rgb(15 20 25 / 0.08);
  --radius: 12px;
  --ancho: 1160px;
  --lectura: 70ch;
  --barra: 64px;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11161d;
    --bg-alt: #171e27;
    --surface: #1a222c;
    --text: #e8edf3;
    --text-soft: #c3ccd6;
    --muted: #94a1b0;
    --accent: #82aeff;
    --accent-hover: #a6c5ff;
    --accent-soft: #1d2b40;
    --on-accent: #0e1a2b;
    --border: #2a3542;
    --ink: #0b1420;
    --ink-2: #121e2e;
    --shadow: 0 10px 30px rgb(0 0 0 / 0.35);
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: var(--barra); -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.7 var(--sans);
  font-feature-settings: "cv11", "ss01";
  text-rendering: optimizeLegibility;
}
@media (max-width: 640px) { body { font-size: 16px; } }
img { max-width: 100%; height: auto; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
code { font-family: var(--mono); font-size: 0.88em; background: var(--bg-alt); padding: 1px 5px; border-radius: 4px; }
svg.icono { width: 1.25em; height: 1.25em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.saltar { position: absolute; left: -9999px; top: 8px; background: var(--accent); color: var(--on-accent); padding: 8px 14px; border-radius: 6px; z-index: 30; }
.saltar:focus { left: 16px; }

.contenedor, .pagina, .barra-interior, .docs-interior, .pie-interior, .pie-final {
  max-width: var(--ancho);
  margin: 0 auto;
  padding-left: 24px;
  padding-right: 24px;
}
@media (max-width: 640px) {
  .contenedor, .pagina, .barra-interior, .docs-interior, .pie-interior, .pie-final { padding-left: 16px; padding-right: 16px; }
}

/* --- barra superior ----------------------------------------------------- */

.barra {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.barra-interior { display: flex; align-items: center; gap: 24px; height: var(--barra); }
.marca { display: flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; margin-right: auto; }
.marca:hover { color: var(--text); }
.marca img { width: 40px; height: 40px; }
.marca strong { display: block; font-size: 1rem; font-weight: 700; line-height: 1.2; letter-spacing: -0.01em; }
.marca small { display: block; color: var(--muted); font-size: 0.78rem; line-height: 1.3; }
@media (max-width: 460px) { .marca small { display: none; } }

.principal ul { display: flex; gap: 4px; margin: 0; padding: 0; list-style: none; }
.principal a {
  display: block;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--text-soft);
  font-size: 0.93rem;
  font-weight: 500;
  text-decoration: none;
}
.principal a:hover { background: var(--bg-alt); color: var(--text); }
.principal a[aria-current="page"], .principal a.activo { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.boton-menu { display: none; }

/* En el teléfono el menú se abre con un botón. Sin JavaScript (sin la clase js) queda siempre visible. */
@media (max-width: 860px) {
  .js .boton-menu {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 44px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    font: 600 0.9rem var(--sans);
    cursor: pointer;
  }
  .barra-interior { flex-wrap: wrap; height: auto; min-height: var(--barra); padding-top: 10px; padding-bottom: 10px; }
  .principal { flex-basis: 100%; }
  .js .principal { display: none; }
  .js .barra.abierta .principal { display: block; }
  .principal ul { flex-direction: column; gap: 2px; padding: 4px 0 6px; }
  .principal a { padding: 12px; font-size: 1rem; }
}

/* Segunda fila: los documentos legales. */
.docs { border-top: 1px solid var(--border); }
.docs-interior { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.docs-interior::-webkit-scrollbar { display: none; }
.docs a {
  flex: none;
  padding: 10px 12px 11px;
  color: var(--text-soft);
  font-size: 0.88rem;
  font-weight: 500;
  text-decoration: none;
  border-bottom: 2px solid transparent;
}
.docs a:hover { color: var(--text); }
.docs a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

/* --- botones y piezas comunes ------------------------------------------- */

.boton {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 22px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.98rem;
  text-decoration: none;
  transition: background-color 0.15s, border-color 0.15s, transform 0.15s;
}
.boton:active { transform: scale(0.98); }
.boton.primario { background: var(--accent); color: var(--on-accent); }
.boton.primario:hover { background: var(--accent-hover); color: var(--on-accent); }
.boton.secundario { border: 1px solid var(--border); color: var(--text); background: var(--surface); }
.boton.secundario:hover { border-color: var(--accent); color: var(--accent); }

.franja { display: flex; height: 4px; }
.franja i { flex: 1; }
.franja i:nth-child(1) { background: var(--accent); }
.franja i:nth-child(2) { background: var(--green); }
.franja i:nth-child(3) { background: var(--yellow); }
.franja i:nth-child(4) { background: var(--red); }

.antetitulo {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.seccion { padding: 88px 0; }
.seccion.alt { background: var(--bg-alt); }
@media (max-width: 640px) { .seccion { padding: 60px 0; } }
.seccion h2 { font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.2rem); line-height: 1.2; letter-spacing: -0.02em; margin: 0 0 16px; }
.seccion .bajada { max-width: 62ch; margin: 0 0 40px; color: var(--text-soft); font-size: 1.06rem; }

/* --- portada ------------------------------------------------------------ */

.portada {
  position: relative;
  overflow: hidden;
  padding: 96px 0 88px;
  background:
    radial-gradient(60rem 30rem at 85% -10%, var(--accent-soft), transparent 70%),
    var(--bg);
}
/* Cuadrícula de fondo, apenas visible. */
.portada::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 40px 40px;
  opacity: 0.35;
  mask-image: linear-gradient(to bottom, #000, transparent 85%);
  pointer-events: none;
}
.portada .contenedor { position: relative; display: grid; gap: 48px; align-items: center; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .portada .contenedor { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); } }
@media (max-width: 640px) { .portada { padding: 56px 0 60px; } }
.portada h1 {
  margin: 0;
  font-size: clamp(2.1rem, 1.3rem + 3.4vw, 3.6rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
  font-weight: 800;
}
.portada h1 span { display: block; color: var(--accent); }
.portada .lema { max-width: 56ch; margin: 22px 0 32px; color: var(--text-soft); font-size: 1.12rem; }
.acciones { display: flex; flex-wrap: wrap; gap: 12px; }
.portada .escudo { justify-self: center; text-align: center; }
.portada .escudo img { width: min(260px, 60vw); filter: drop-shadow(0 18px 30px rgb(15 20 25 / 0.18)); }
@media (max-width: 899px) { .portada .escudo { order: -1; } .portada .escudo img { width: 120px; } }

.datos { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin: 0; padding: 0; list-style: none; }
.datos li { padding: 24px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.datos strong { display: block; font-size: 1.05rem; margin-bottom: 4px; }
.datos span { color: var(--muted); font-size: 0.95rem; line-height: 1.55; }
.datos .icono { display: inline-flex; width: 40px; height: 40px; align-items: center; justify-content: center; margin-bottom: 14px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); }
.datos .icono svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* --- especialidades (bloque oscuro) ------------------------------------- */

.especialidades { background: var(--ink); color: var(--ink-text); }
.especialidades .antetitulo { color: #82aeff; }
.especialidades .bajada { color: var(--ink-muted); }
.especialidades .contenedor { display: grid; gap: 48px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 980px) { .especialidades .contenedor { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); align-items: start; } }
.titulos { display: grid; gap: 16px; }
.titulo {
  padding: 26px;
  border: 1px solid var(--ink-border);
  border-radius: var(--radius);
  background: var(--ink-2);
}
.titulo h3 { margin: 0 0 8px; font-size: 1.2rem; letter-spacing: -0.01em; display: flex; align-items: center; gap: 12px; }
.titulo h3 svg { width: 26px; height: 26px; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.titulo.prog h3 svg { stroke: #82aeff; }
.titulo.info h3 svg { stroke: #6fd9a0; }
.titulo p { margin: 0; color: var(--ink-muted); }

/* Ventana de código decorativa. */
.codigo {
  margin: 0;
  border: 1px solid var(--ink-border);
  border-radius: var(--radius);
  background: #0a121d;
  box-shadow: 0 20px 50px rgb(0 0 0 / 0.35);
  overflow: hidden;
}
.codigo .ventana { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--ink-border); }
.codigo .ventana i { width: 11px; height: 11px; border-radius: 50%; }
.codigo .ventana i:nth-child(1) { background: var(--red); }
.codigo .ventana i:nth-child(2) { background: var(--yellow); }
.codigo .ventana i:nth-child(3) { background: #3fb950; }
.codigo .ventana span { margin-left: 8px; color: var(--ink-muted); font: 0.8rem var(--mono); }
.codigo pre {
  margin: 0;
  padding: 20px;
  border: 0;
  border-radius: 0;
  background: none;
  color: #d6e1ee;
  font: 0.9rem/1.75 var(--mono);
  white-space: pre;
  overflow-x: auto;
  max-height: none;
}
.codigo .k { color: #ff7b72; }
.codigo .s { color: #a5d6ff; }
.codigo .f { color: #d2a8ff; }
.codigo .c { color: #8b98a8; }
.codigo .salida { display: block; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--ink-border); color: #6fd9a0; }

/* --- plataforma --------------------------------------------------------- */

.funciones { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); margin: 0 0 32px; padding: 0; list-style: none; }
.funciones li { padding: 24px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); }
.funciones h3 { margin: 0 0 6px; font-size: 1.08rem; display: flex; align-items: center; gap: 10px; }
.funciones h3 svg { width: 24px; height: 24px; color: var(--accent); }
.funciones p { margin: 0; color: var(--muted); font-size: 0.95rem; line-height: 1.6; }
.accesos { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; color: var(--text-soft); }
.insignia {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px dashed var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.9rem;
}

/* --- contacto ----------------------------------------------------------- */

.contacto { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.tarjeta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.tarjeta h3 { margin: 0 0 4px; font-size: 1rem; display: flex; align-items: center; gap: 10px; }
.tarjeta h3 svg { color: var(--accent); }
.tarjeta p { margin: 0; color: var(--text-soft); }
.tarjeta .enlace { margin-top: auto; padding-top: 10px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; }
.tarjeta ul { list-style: none; margin: 0; padding: 0; }
.tarjeta li a { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; font-weight: 500; }

/* --- encabezado de las páginas internas --------------------------------- */

.encabezado {
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
  padding: 40px 0 34px;
}
.miga { margin: 0 0 10px; font-size: 0.88rem; color: var(--muted); }
.miga a { color: var(--muted); }
.encabezado h1 { font-size: clamp(1.75rem, 1.3rem + 1.8vw, 2.4rem); line-height: 1.15; margin: 0; letter-spacing: -0.02em; font-weight: 800; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 14px 0 0; padding: 0; list-style: none; color: var(--muted); font-size: 0.9rem; }
.meta strong { color: var(--text-soft); font-weight: 600; }
.encabezado .bajada { max-width: var(--lectura); margin: 14px 0 0; color: var(--text-soft); font-size: 1.05rem; }

/* --- cuerpo de los documentos: índice + texto --------------------------- */

.cuerpo { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 56px; padding-top: 36px; padding-bottom: 64px; }
@media (min-width: 960px) { .cuerpo { grid-template-columns: 250px minmax(0, 1fr); } }

.indice { font-size: 0.9rem; }
.indice details { border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-alt); margin-bottom: 24px; }
.indice summary { cursor: pointer; padding: 12px 16px; font-weight: 600; list-style: none; display: flex; justify-content: space-between; }
.indice summary::-webkit-details-marker { display: none; }
.indice summary::after { content: "▾"; color: var(--muted); }
.indice details[open] summary::after { content: "▴"; }
.indice ol { list-style: none; margin: 0; padding: 0 8px 12px; }
.indice li { margin: 0; }
.indice a { display: block; padding: 5px 8px; border-radius: 6px; color: var(--text-soft); text-decoration: none; line-height: 1.4; }
.indice a:hover { background: var(--accent-soft); color: var(--text); }
.indice a.actual { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
@media (min-width: 960px) {
  .indice > details { position: sticky; top: calc(var(--barra) + 64px); max-height: calc(100vh - var(--barra) - 88px); overflow-y: auto; background: none; border: 0; border-left: 2px solid var(--border); border-radius: 0; margin: 0; }
  .indice summary { pointer-events: none; padding: 0 0 8px 14px; color: var(--muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; }
  .indice summary::after { content: none; }
  .indice ol { padding: 0 0 0 4px; }
}

.doc { max-width: var(--lectura); min-width: 0; }
/* Debajo de la barra y de la fila de documentos. */
.doc h2 { font-size: 1.3rem; line-height: 1.35; letter-spacing: -0.01em; margin: 44px 0 12px; scroll-margin-top: 64px; }
.doc h2:first-child { margin-top: 0; }
.doc h3 { font-size: 1.05rem; margin: 26px 0 8px; }
.doc p, .doc li { color: var(--text-soft); }
.doc p { margin: 0 0 14px; }
.doc ul, .doc ol { padding-left: 24px; margin: 0 0 16px; }
.doc li { margin: 6px 0; }
.doc li::marker { color: var(--muted); }
.doc strong { color: var(--text); }
.aviso {
  background: var(--accent-soft);
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 14px 18px;
}
.arriba { display: inline-block; margin-top: 40px; font-size: 0.9rem; }

/* --- índice de la información legal ------------------------------------- */

.tarjetas { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); margin: 0; padding: 36px 0 8px; list-style: none; }
.tarjetas a {
  display: flex;
  flex-direction: column;
  gap: 6px;
  height: 100%;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.tarjetas a:hover { border-color: var(--accent); box-shadow: var(--shadow); color: var(--text); }
.tarjetas strong { font-size: 1.08rem; }
.tarjetas span { color: var(--muted); font-size: 0.92rem; line-height: 1.5; }
.tarjetas em { margin-top: auto; padding-top: 8px; color: var(--accent); font-style: normal; font-size: 0.88rem; font-weight: 600; }
.ficha { display: grid; gap: 4px 24px; grid-template-columns: max-content 1fr; margin: 0; padding: 24px 0 64px; font-size: 0.95rem; }
.ficha dt { color: var(--muted); }
.ficha dd { margin: 0; color: var(--text-soft); }
@media (max-width: 640px) { .ficha { grid-template-columns: 1fr; } .ficha dd { margin-bottom: 10px; } }

/* --- licencias ---------------------------------------------------------- */

.buscador { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin: 0 0 20px; }
.buscador input {
  flex: 1 1 280px;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
}
.buscador input:focus { outline: 3px solid var(--accent-soft); border-color: var(--accent); }
.buscador output { color: var(--muted); font-size: 0.88rem; }
.tabla { overflow-x: auto; margin: 0 0 16px; border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
th, td { text-align: left; vertical-align: top; padding: 8px 12px; border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: 0; }
td { overflow-wrap: anywhere; color: var(--text-soft); }
th { background: var(--bg-alt); font-weight: 600; position: sticky; top: 0; }
.doc details summary { cursor: pointer; color: var(--muted); font-size: 0.82rem; }
pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: var(--mono);
  font-size: 0.76rem;
  line-height: 1.5;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  padding: 12px;
  border-radius: 8px;
  max-height: 420px;
  overflow-y: auto;
}
.archivo { margin: 8px 0 2px; font-size: 0.8rem; color: var(--muted); }
.doc.ancho { max-width: none; }

/* --- página no encontrada ----------------------------------------------- */

.no-encontrada { padding: 96px 0; text-align: center; }
.no-encontrada .codigo-error { font: 800 clamp(4rem, 3rem + 6vw, 7rem)/1 var(--mono); color: var(--accent); margin: 0; letter-spacing: -0.04em; }
.no-encontrada h1 { margin: 16px 0 8px; font-size: 1.6rem; }
.no-encontrada p { color: var(--text-soft); margin: 0 auto 28px; max-width: 48ch; }
.no-encontrada .acciones { justify-content: center; }

/* --- pie ---------------------------------------------------------------- */

.pie { background: var(--bg-alt); border-top: 1px solid var(--border); font-size: 0.92rem; color: var(--muted); }
.pie-interior { display: grid; gap: 32px 40px; grid-template-columns: minmax(0, 1fr); padding-top: 48px; padding-bottom: 32px; }
@media (min-width: 600px) { .pie-interior { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 980px) { .pie-interior { grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(0, 1fr)); } }
.pie .escuela { display: flex; gap: 16px; align-items: flex-start; }
.pie .escuela img { width: 52px; height: 52px; }
.pie .escuela strong { display: block; color: var(--text); font-size: 1rem; }
.pie h2 { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-soft); margin: 0 0 10px; }
.pie p { margin: 0; line-height: 1.6; }
.pie ul { list-style: none; margin: 0; padding: 0; line-height: 1.95; }
.pie a { color: var(--text-soft); }
.pie a:hover { color: var(--accent); }
.pie .pie-final { margin: 0 auto; padding-top: 18px; padding-bottom: 28px; border-top: 1px solid var(--border); font-size: 0.82rem; }

/* --- impresión ---------------------------------------------------------- */

@media print {
  body { font-size: 11pt; color: #000; background: #fff; }
  .barra, .indice, .pie, .arriba, .saltar, .franja, .buscador { display: none; }
  .encabezado { background: none; border: 0; padding: 0 0 12pt; }
  .cuerpo { display: block; padding: 0; }
  .doc { max-width: none; }
  .doc p, .doc li { color: #000; }
  a { color: #000; text-decoration: none; }
  h2 { break-after: avoid; }
}
