/* ==========================================================================
   Mateo · Ilustre Ayuntamiento de Vega de San Mateo
   Hoja de estilos compartida por todas las vistas públicas.

   Identidad «La Vega en diagonal»: colores de la bandera municipal (naranja
   Tinamar y azul, partida en diagonal), escudo oficial y paisaje de medianías.

   Contrastes WCAG 2.x calculados (no a ojo):
     basalto #24282C / cal #F7F4EE ........ 13,52:1 (AAA)   texto de cuerpo
     texto-2 #4A4F55 / cal ................. 7,53:1 (AAA)   texto secundario
     azul #11589F / cal .................... 6,55:1 (AA)    enlaces y botones
     blanco / azul ......................... 7,19:1 (AAA)   botón primario
     azul-noche #0B2E4F / cal ............. 12,60:1 (AAA)   titulares
     blanco / azul-noche .................. 13,83:1 (AAA)
     #D8E1EA / azul-noche ................. 10,46:1 (AAA)   texto sobre oscuro
     naranja-texto #B04E00 / cal ........... 4,86:1 (AA)    antetítulos
     naranja #FF7913 / azul-noche .......... 5,27:1 (AA)    solo cifras grandes sobre oscuro
     naranja #FF7913 / cal ................. 2,39:1  → NUNCA como texto sobre claro
     pinar #2F5D46 / cal ................... 6,89:1 (AA)
     basalto / verde WhatsApp #25D366 ...... 7,48:1 (AAA)   botón de WhatsApp
     oro #C8A04A / azul-noche .............. 5,65:1         solo filetes finos
   ========================================================================== */

/* ---------- Tipografías autoalojadas (OFL, ver /fonts/OFL-*.txt) ---------- */
@font-face {
  font-family: 'Atkinson Hyperlegible Next';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/atkinson-hyperlegible-next-latin-400-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Atkinson Hyperlegible Next';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/fonts/atkinson-hyperlegible-next-latin-700-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/fonts/montserrat-latin-600-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/fonts/montserrat-latin-700-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- Tokens ---------- */
:root {
  /* Bandera y territorio */
  --azul: #11589F;
  --azul-700: #0D4A87;
  --azul-noche: #0B2E4F;
  --azul-noche-2: #12406B;
  --azul-tenue: #E8EEF5;
  --naranja: #FF7913;          /* solo rellenos, diagonal y cifras grandes sobre oscuro */
  --naranja-texto: #B04E00;    /* naranja para texto sobre claro */
  --naranja-claro: #FFB27A;    /* naranja para texto/foco sobre azul noche (7,84:1) */
  --naranja-tenue: #FCEBDD;
  --pinar: #2F5D46;
  --pinar-tenue: #E3ECE6;
  --cal: #F7F4EE;
  --cal-2: #EFEAE1;
  --blanco: #FFFFFF;
  --basalto: #24282C;
  --texto-2: #4A4F55;
  --oro: #C8A04A;              /* solo filetes finos sobre azul noche */
  --wa: #25D366;               /* SOLO para el botón de WhatsApp */
  --wa-hover: #1FBF5B;
  --sobre-oscuro: #FFFFFF;
  --sobre-oscuro-2: #D8E1EA;
  --linea: rgba(36, 40, 44, 0.14);
  --linea-fuerte: rgba(36, 40, 44, 0.28);
  --linea-oscuro: rgba(255, 255, 255, 0.18);

  /* Tipografía */
  --font-titulos: 'Montserrat', 'Atkinson Hyperlegible Next', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-texto: 'Atkinson Hyperlegible Next', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

  /* Espacio y forma */
  --gutter: 16px;
  --ancho: 1200px;
  --seccion: clamp(56px, 7vw, 104px);
  --radio: 14px;
  --radio-sm: 10px;
  --header-h: 64px;
  --diag: clamp(28px, 4vw, 56px);
  --sombra: 0 1px 2px rgba(11, 46, 79, 0.06), 0 8px 24px -12px rgba(11, 46, 79, 0.18);
  --sombra-alta: 0 2px 4px rgba(11, 46, 79, 0.06), 0 24px 48px -20px rgba(11, 46, 79, 0.32);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

@media (min-width: 640px) { :root { --gutter: 24px; } }
@media (min-width: 1100px) { :root { --gutter: 32px; --header-h: 72px; } }

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 16px);
  overflow-x: clip;
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  background: var(--cal);
  color: var(--basalto);
  font-family: var(--font-texto);
  font-size: 1.125rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}

h1, h2, h3, h4, p, ul, ol, dl, dd, figure, blockquote { margin: 0; }
ul[class], ol[class], nav ul, nav ol, .footer-col ul, .lang ul { padding: 0; margin: 0; list-style: none; }
img, svg, picture, video { display: block; max-width: 100%; }
img { height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

h1, h2, h3, h4 {
  font-family: var(--font-titulos);
  font-weight: 700;
  color: var(--azul-noche);
  line-height: 1.15;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
h3, h4 { font-weight: 600; line-height: 1.25; }
p, li, dd { text-wrap: pretty; }
strong, b { font-weight: 700; }

a { color: var(--azul); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 3px solid var(--azul);
  outline-offset: 3px;
  border-radius: 4px;
}
.oscuro :focus-visible,
.on-dark :focus-visible { outline-color: var(--naranja-claro); }

kbd {
  display: inline-block;
  padding: 0 0.4em;
  border: 1px solid var(--linea-fuerte);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--blanco);
  font-family: var(--font-texto);
  font-size: 0.9em;
  font-weight: 700;
  line-height: 1.5;
  color: var(--basalto);
}

code {
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 0.92em;
}

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.nowrap { white-space: nowrap; }

.container {
  width: 100%;
  max-width: calc(var(--ancho) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.icon { width: 1.25em; height: 1.25em; flex: 0 0 auto; }

main:focus { outline: none; }

/* ---------- Saltar al contenido ---------- */
.skip-link {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 400;
  padding: 12px 18px;
  border-radius: var(--radio-sm);
  background: var(--azul-noche);
  color: var(--blanco);
  font-weight: 700;
  text-decoration: none;
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; outline-color: var(--naranja-claro); }

/* ==========================================================================
   Barra institucional (escudo + Ilustre Ayuntamiento)
   ========================================================================== */
.gov-bar {
  position: relative;
  background: var(--blanco);
  color: var(--basalto);
  font-size: 0.9375rem;
}

.gov-inner {
  display: flex;
  align-items: center;
  gap: 12px 24px;
  min-height: 56px;
  padding-block: 6px;
}

.gov-id {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  color: var(--azul-noche);
  text-decoration: none;
  border-radius: 6px;
}

/* Zona de respeto del escudo: nada se acerca a menos de 1/4 de su altura */
.gov-id .escudo { flex: none; padding: 2px; }
.gov-id .escudo img { width: 33px; height: 44px; }

.gov-name {
  display: grid;
  line-height: 1.2;
  font-family: var(--font-titulos);
}
.gov-pre { font-size: 0.75rem; font-weight: 600; color: var(--texto-2); letter-spacing: 0.01em; }
.gov-main { font-size: 1rem; font-weight: 700; color: var(--azul-noche); }

.gov-links {
  display: none;
  margin-left: auto;
}
.gov-links ul { display: flex; align-items: center; gap: 4px; }
.gov-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 10px;
  border-radius: 8px;
  color: var(--azul);
  font-weight: 700;
  font-size: 0.9375rem;
  text-decoration: none;
  white-space: nowrap;
}
.gov-links a:hover { background: var(--azul-tenue); text-decoration: underline; }
.gov-links .icon { width: 18px; height: 18px; }

@media (min-width: 900px) {
  .gov-links { display: block; }
}

/* Firma gráfica: el subrayado partido de la bandera (naranja / azul) */
.franja {
  height: 5px;
  background: linear-gradient(100deg, var(--naranja) 0 62%, var(--azul) 62% 100%);
}

/* ==========================================================================
   Cabecera de Mateo (fija al hacer scroll)
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(247, 244, 238, 0.94);
  border-bottom: 1px solid var(--linea);
  -webkit-backdrop-filter: saturate(1.2) blur(12px);
  backdrop-filter: saturate(1.2) blur(12px);
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .site-header { background: var(--cal); }
}

.header-inner {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  color: var(--azul-noche);
  text-decoration: none;
  border-radius: 8px;
  flex: 0 0 auto;
}
.brand-mark { width: 40px; height: 40px; border-radius: 10px; flex: none; }
.brand-text { display: grid; line-height: 1.15; }
.brand-name { font-family: var(--font-titulos); font-weight: 700; font-size: 1.15rem; }
.brand-tag {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--naranja-texto);
  white-space: nowrap;
}

.main-nav { margin-left: auto; }
.nav-list { display: flex; align-items: center; gap: 2px; }
.nav-list a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 8px;
  color: var(--basalto);
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  white-space: nowrap;
}
.nav-list a:hover { background: var(--azul-tenue); color: var(--azul-noche); }
.nav-list a[aria-current] {
  color: var(--azul);
  box-shadow: inset 0 -3px 0 var(--naranja);
  border-radius: 8px 8px 0 0;
}
.nav-list .nav-demo svg { width: 16px; height: 16px; margin-right: 6px; color: var(--naranja-texto); }

.nav-extra { display: none; }
.header-cta { flex: 0 0 auto; }

.nav-toggle {
  display: none;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  min-width: 44px;
  padding: 0 14px;
  border: 1px solid var(--linea-fuerte);
  border-radius: var(--radio-sm);
  background: var(--blanco);
  color: var(--azul-noche);
  font-weight: 700;
}
.nav-toggle[hidden] { display: none !important; }
.burger { position: relative; width: 18px; height: 12px; }
.burger span {
  position: absolute; left: 0; width: 100%; height: 2px; border-radius: 2px;
  background: currentColor;
  transition: transform 0.2s var(--ease), opacity 0.2s, top 0.2s var(--ease);
}
.burger span:nth-child(1) { top: 0; }
.burger span:nth-child(2) { top: 5px; }
.burger span:nth-child(3) { top: 10px; }
.menu-open .burger span:nth-child(1) { top: 5px; transform: rotate(45deg); }
.menu-open .burger span:nth-child(2) { opacity: 0; }
.menu-open .burger span:nth-child(3) { top: 5px; transform: rotate(-45deg); }

@media (max-width: 1099.98px) {
  .nav-ready .nav-toggle { display: inline-flex; }
  .nav-ready .lang { margin-left: auto; }
  .nav-ready .main-nav {
    position: absolute;
    top: calc(100% + 1px);
    left: 0;
    right: 0;
    margin: 0;
    padding: 12px var(--gutter) 20px;
    background: var(--cal);
    border-bottom: 1px solid var(--linea-fuerte);
    box-shadow: 0 24px 40px -24px rgba(11, 46, 79, 0.45);
    max-height: calc(100dvh - var(--header-h));
    overflow-y: auto;
    display: none;
  }
  .nav-ready .menu-open .main-nav { display: block; }
  .nav-ready .nav-list { flex-direction: column; align-items: stretch; }
  .nav-ready .nav-list a {
    display: flex;
    min-height: 52px;
    padding: 0 12px;
    font-size: 1.0625rem;
    border-bottom: 1px solid var(--linea);
    border-radius: 0;
  }
  .nav-ready .nav-list a[aria-current] { box-shadow: inset 4px 0 0 var(--naranja); }
  .nav-ready .nav-extra { display: block; margin-top: 16px; }
  .nav-extra p {
    font-family: var(--font-titulos);
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--texto-2);
    margin-bottom: 4px;
  }
  .nav-extra ul { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
  .nav-extra a {
    display: flex; align-items: center; min-height: 48px;
    color: var(--azul); font-weight: 700; text-decoration: none;
  }
  .nav-extra a:hover { text-decoration: underline; }
  .nav-extra .btn { width: 100%; margin-top: 12px; }

  /* Sin JavaScript: la navegación se muestra en una fila desplazable */
  html:not(.nav-ready) .header-inner { flex-wrap: wrap; padding-bottom: 6px; }
  html:not(.nav-ready) .main-nav { order: 3; width: 100%; overflow-x: auto; margin: 0; }
}

@media (max-width: 559.98px) {
  .nav-ready .header-cta { display: none; }
  .brand-tag { font-size: 0.75rem; }
}
@media (max-width: 399.98px) {
  .header-inner { gap: 8px; }
  .brand { gap: 8px; }
  .brand-mark { width: 36px; height: 36px; }
  .nav-toggle { padding: 0 12px; }
  .nav-toggle-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
  .lang summary { padding: 0 8px; }
}

/* ==========================================================================
   Botones y enlaces de acción
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 24px;
  border: 2px solid transparent;
  border-radius: var(--radio-sm);
  font-family: var(--font-texto);
  font-weight: 700;
  font-size: 1.0625rem;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.btn:hover { text-decoration: none; }
.btn .icon { width: 22px; height: 22px; }

.btn-wa { background: var(--wa); color: var(--basalto); box-shadow: 0 6px 18px -8px rgba(15, 120, 60, 0.55); }
.btn-wa:hover { background: var(--wa-hover); }

.btn-primario { background: var(--azul); color: var(--blanco); }
.btn-primario:hover { background: var(--azul-700); }

.btn-secundario { background: var(--blanco); border-color: var(--azul); color: var(--azul); }
.btn-secundario:hover { background: var(--azul-tenue); }

.btn-claro { background: transparent; border-color: rgba(255, 255, 255, 0.7); color: var(--blanco); }
.btn-claro:hover { background: rgba(255, 255, 255, 0.12); border-color: var(--blanco); }

.btn-sm { min-height: 44px; padding: 0 16px; font-size: 1rem; gap: 8px; }
.btn-sm .icon { width: 20px; height: 20px; }

.enlace-flecha {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  font-weight: 700;
  color: var(--azul);
}
.enlace-flecha svg { width: 18px; height: 18px; transition: transform 0.15s var(--ease); }
.enlace-flecha:hover svg { transform: translateX(3px); }
.oscuro .enlace-flecha { color: var(--naranja-claro); }

/* Etiqueta de IA (art. 50 del Reglamento europeo de IA) */
.etiqueta-ia {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--naranja-tenue);
  color: var(--naranja-texto);
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1.4;
  white-space: nowrap;
}
.etiqueta-ia::before {
  content: '';
  width: 8px; height: 8px; border-radius: 2px;
  background: linear-gradient(135deg, var(--naranja) 50%, var(--azul) 50%);
}
.oscuro .etiqueta-ia { background: rgba(255, 255, 255, 0.12); color: var(--blanco); }

/* Antetítulo */
.kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  font-family: var(--font-titulos);
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--naranja-texto);
}
.kicker::before {
  content: '';
  width: 22px;
  height: 4px;
  background: linear-gradient(100deg, var(--naranja) 0 60%, var(--azul) 60% 100%);
}
.oscuro .kicker { color: var(--naranja-claro); }

/* Superficies oscuras */
.oscuro { background: var(--azul-noche); color: var(--sobre-oscuro-2); }
.oscuro h1, .oscuro h2, .oscuro h3 { color: var(--blanco); }
.oscuro a:not(.btn) { color: var(--blanco); }

/* Franja con el patrón de la vega (solo en franjas: CTA final) */
.con-patron {
  background-color: var(--azul-noche);
  background-image: url('/ilustraciones/patron-vega-tile-alpha-512.webp');
  background-size: 256px;
  background-repeat: repeat;
}
@media (prefers-contrast: more) {
  .con-patron { background-image: none; }
}

/* Corte diagonal de la bandera */
.corte-diagonal { clip-path: polygon(0 0, 100% 0, 100% calc(100% - var(--diag)), 0 100%); }
.corte-diagonal-sup { clip-path: polygon(0 var(--diag), 100% 0, 100% 100%, 0 100%); }

/* ==========================================================================
   Secciones comunes
   ========================================================================== */
.section { padding-block: var(--seccion); }
@media (max-width: 639.98px) { :root { --seccion: 44px; } .section-head { margin-bottom: 24px; } }
.section-head { max-width: 720px; margin-bottom: clamp(28px, 4vw, 48px); }
.section-head.center { margin-inline: auto; text-align: center; }
.section-head h2 { font-size: clamp(1.75rem, 1.2rem + 2vw, 2.6rem); margin-bottom: 14px; }
.section-head p { color: var(--texto-2); font-size: 1.1875rem; }
.section-head.center .kicker { justify-content: center; }

.card {
  background: var(--blanco);
  border: 1px solid var(--linea);
  border-radius: var(--radio);
  box-shadow: var(--sombra);
}

/* ==========================================================================
   Cabecera de páginas interiores (ayuda, legal, 404)
   ========================================================================== */
.page-hero {
  position: relative;
  background: var(--blanco);
  border-bottom: 1px solid var(--linea);
  overflow: hidden;
}
.page-hero-grid {
  display: grid;
  gap: 20px;
  align-items: center;
  padding-block: clamp(24px, 4vw, 48px);
}
.page-hero h1 { font-size: clamp(2rem, 1.3rem + 2.6vw, 3rem); margin-bottom: 12px; }
.page-hero .lead { font-size: 1.1875rem; color: var(--texto-2); max-width: 60ch; }
.page-hero-art {
  margin: 0 calc(var(--gutter) * -1);
  height: 132px;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 calc(100% - 24px));
}
.page-hero-art img { width: 100%; height: 100%; object-fit: cover; object-position: 60% 45%; }

@media (min-width: 900px) {
  .page-hero-grid { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 40px; padding-block: 40px; min-height: 300px; }
  .page-hero-art {
    order: 2;
    position: absolute;
    top: 0; right: 0; bottom: 0;
    width: 44%;
    margin: 0;
    height: auto;
    clip-path: polygon(22% 0, 100% 0, 100% 100%, 0 100%);
  }
  .page-hero-copy { grid-column: 1; }
}

.breadcrumb ol { display: flex; flex-wrap: wrap; gap: 4px 8px; margin-bottom: 14px; font-size: 1rem; }
.breadcrumb li { display: inline-flex; align-items: center; gap: 8px; color: var(--texto-2); }
.breadcrumb li + li::before { content: '/'; color: var(--linea-fuerte); }
.breadcrumb a { display: inline-flex; align-items: center; min-height: 32px; font-weight: 700; }

.meta-list { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 16px; font-size: 1rem; color: var(--texto-2); }
.meta-list li { display: inline-flex; align-items: center; gap: 8px; }
.meta-list svg { width: 18px; height: 18px; color: var(--azul); }

/* ---------- Documento con índice ---------- */
.doc-layout {
  display: grid;
  gap: 24px;
  padding-block: clamp(28px, 4vw, 56px) var(--seccion);
}
@media (min-width: 1024px) {
  .doc-layout { grid-template-columns: 280px minmax(0, 1fr); gap: 56px; align-items: start; }
}

.toc-mobile {
  position: sticky;
  top: calc(var(--header-h) + 8px);
  z-index: 20;
  background: var(--blanco);
  border: 1px solid var(--linea-fuerte);
  border-radius: var(--radio-sm);
  box-shadow: var(--sombra);
}
.toc-mobile summary {
  display: flex; align-items: center; gap: 10px;
  min-height: 52px; padding: 0 16px;
  list-style: none; cursor: pointer; font-weight: 700; color: var(--azul-noche);
}
.toc-mobile summary::-webkit-details-marker { display: none; }
.toc-mobile .toc-current { flex: 1; min-width: 0; color: var(--texto-2); font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toc-mobile .chev { width: 20px; height: 20px; transition: transform 0.2s; }
.toc-mobile[open] .chev { transform: rotate(180deg); }
.toc-mobile .toc-list { padding: 4px 8px 12px; max-height: 60vh; overflow-y: auto; }
@media (min-width: 1024px) { .toc-mobile { display: none; } }

.toc-desktop { display: none; }
@media (min-width: 1024px) {
  .toc-desktop { display: block; position: sticky; top: calc(var(--header-h) + 24px); }
}
.toc-title {
  font-family: var(--font-titulos); font-size: 0.875rem; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--texto-2); margin-bottom: 10px;
}
.toc-list a {
  display: flex; gap: 10px; align-items: baseline;
  min-height: 44px; padding: 10px 12px;
  border-left: 3px solid var(--linea);
  color: var(--basalto); text-decoration: none; font-size: 1rem; line-height: 1.35;
}
.toc-list a:hover { background: var(--azul-tenue); }
.toc-list a.is-active, .toc-list a[aria-current] { border-left-color: var(--naranja); color: var(--azul-noche); font-weight: 700; background: var(--blanco); }
.toc-num { font-family: var(--font-titulos); font-weight: 700; color: var(--naranja-texto); min-width: 1.6em; }
.toc-card {
  margin-top: 20px; padding: 18px; border-radius: var(--radio);
  background: var(--azul-noche); color: var(--sobre-oscuro-2); font-size: 1rem;
}
.toc-card strong { display: block; color: var(--blanco); font-family: var(--font-titulos); margin-bottom: 4px; }
.toc-card .btn { width: 100%; margin-top: 12px; }

/* ---------- Prosa ---------- */
.prose { max-width: 72ch; }
.doc-article { min-width: 0; }
.doc-section { padding-bottom: 40px; margin-bottom: 40px; border-bottom: 1px solid var(--linea); }
.doc-section:last-of-type { border-bottom: 0; }
.doc-section h2 {
  display: flex; align-items: baseline; gap: 12px;
  font-size: clamp(1.5rem, 1.15rem + 1.2vw, 2rem);
  margin-bottom: 16px;
}
.doc-section h2 .num { color: var(--naranja-texto); flex: none; }
.doc-section h3 { font-size: 1.25rem; margin: 28px 0 10px; }
.prose p + p, .prose p + ul, .prose ul + p, .prose p + ol { margin-top: 14px; }
.prose ul:not([class]), .prose ol:not([class]) { padding-left: 1.3em; margin-top: 10px; list-style: revert; }
.prose ul:not([class]) li, .prose ol:not([class]) li { margin-top: 8px; }
.prose ul:not([class]) li::marker { color: var(--naranja-texto); }
.prose .lead { font-size: 1.25rem; color: var(--basalto); }
.prose a { overflow-wrap: anywhere; }

.callout {
  display: flex; gap: 14px; align-items: flex-start;
  margin: 20px 0; padding: 16px 18px;
  border-radius: var(--radio-sm);
  border-left: 5px solid var(--azul);
  background: var(--azul-tenue);
}
.callout > svg { width: 22px; height: 22px; flex: none; margin-top: 3px; color: var(--azul); }
.callout-aviso { border-left-color: var(--naranja); background: var(--naranja-tenue); }
.callout-aviso > svg { color: var(--naranja-texto); }
.callout-ok { border-left-color: var(--pinar); background: var(--pinar-tenue); }
.callout-ok > svg { color: var(--pinar); }
.callout p + p { margin-top: 8px; }

.datos {
  display: grid; gap: 0;
  margin: 16px 0; border: 1px solid var(--linea); border-radius: var(--radio-sm); background: var(--blanco);
}
.datos > div { display: grid; gap: 2px 20px; padding: 14px 18px; border-top: 1px solid var(--linea); }
.datos > div:first-child { border-top: 0; }
.datos dt { font-weight: 700; color: var(--azul-noche); }
.datos dd { color: var(--basalto); }
@media (min-width: 720px) { .datos > div { grid-template-columns: 220px minmax(0, 1fr); } }

.tabla-wrap { overflow-x: auto; margin: 16px 0; border: 1px solid var(--linea); border-radius: var(--radio-sm); background: var(--blanco); }
.tabla { width: 100%; border-collapse: collapse; font-size: 1rem; min-width: 560px; }
.tabla th, .tabla td { padding: 12px 14px; text-align: left; vertical-align: top; border-top: 1px solid var(--linea); }
.tabla thead th { border-top: 0; background: var(--cal-2); color: var(--azul-noche); font-family: var(--font-titulos); font-weight: 600; }

.contact-card {
  display: grid; gap: 16px;
  margin-top: 20px; padding: 20px;
  border-radius: var(--radio); background: var(--blanco); border: 1px solid var(--linea);
}
.contact-card address { font-style: normal; }
.contact-card strong { display: block; color: var(--azul-noche); font-family: var(--font-titulos); }
.contact-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.doc-end { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; color: var(--texto-2); font-size: 1rem; }

/* Preguntas frecuentes */
.faq { border-bottom: 1px solid var(--linea); }
.faq summary {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 56px; padding: 12px 0; cursor: pointer; list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary h3 { margin: 0; font-size: 1.125rem; }
.faq summary::after {
  content: '+'; flex: none; display: grid; place-items: center;
  width: 32px; height: 32px; border-radius: 50%;
  border: 2px solid var(--azul); color: var(--azul); font-weight: 700; font-size: 1.25rem; line-height: 1;
}
.faq[open] summary::after { content: '−'; }
.faq-body { padding: 0 0 18px; color: var(--basalto); }

/* Comandos de WhatsApp */
.cmd-list { display: grid; gap: 12px; margin-top: 16px; }
.cmd { padding: 16px 18px; border-radius: var(--radio-sm); background: var(--blanco); border: 1px solid var(--linea); }
.cmd-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; }
.cmd-head h3, .cmd-head h4 { margin: 0; font-size: 1.125rem; }
.cmd-key {
  display: inline-block; padding: 2px 10px; border-radius: 8px;
  background: var(--azul-noche); color: var(--blanco); font-weight: 700;
}
.cmd .alias { margin-top: 8px; font-size: 1rem; color: var(--texto-2); }

/* Pasos numerados (ayuda) */
.pasos { counter-reset: paso; display: grid; gap: 16px; margin-top: 18px; }
.pasos > li {
  counter-increment: paso;
  position: relative;
  padding: 18px 18px 18px 72px;
  border-radius: var(--radio); background: var(--blanco); border: 1px solid var(--linea);
}
.pasos > li::before {
  content: counter(paso);
  position: absolute; left: 18px; top: 18px;
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px;
  background: linear-gradient(135deg, var(--naranja) 0 50%, var(--azul) 50% 100%);
  color: var(--blanco); font-family: var(--font-titulos); font-weight: 700;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.35);
}
.pasos h3 { margin: 4px 0 6px; font-size: 1.1875rem; }

/* Botón «volver arriba» */
.to-top {
  position: fixed; right: 16px; bottom: 16px; z-index: 50;
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 48px; padding: 0 16px;
  border-radius: var(--radio-sm); background: var(--azul-noche); color: var(--blanco);
  font-weight: 700; text-decoration: none; box-shadow: var(--sombra-alta);
  opacity: 0; visibility: hidden; transition: opacity 0.2s, visibility 0.2s;
}
.to-top.is-visible { opacity: 1; visibility: visible; }
.to-top svg { width: 18px; height: 18px; }
.to-top:focus-visible { outline-color: var(--naranja); }

/* ==========================================================================
   Pie institucional (idéntico en todas las vistas)
   ========================================================================== */
.site-footer { background: var(--blanco); color: var(--basalto); font-size: 1rem; }

.footer-main {
  display: grid;
  gap: 32px 24px;
  padding-block: 40px 28px;
}
.footer-main { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.footer-id { grid-column: 1 / -1; }
@media (min-width: 640px) { .footer-main { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .footer-main { grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr)); } .footer-id { grid-column: auto; } }

.footer-id { display: grid; gap: 14px; align-content: start; }
.footer-inst { display: flex; align-items: center; gap: 14px; }
.footer-inst .escudo { flex: none; padding: 4px; }
.footer-inst .escudo img { width: 54px; height: 72px; }
.footer-inst p { font-family: var(--font-titulos); line-height: 1.25; color: var(--azul-noche); }
.footer-inst .pre { display: block; font-size: 0.875rem; font-weight: 600; color: var(--texto-2); }
.footer-inst .main { display: block; font-size: 1.1875rem; font-weight: 700; }
.footer-id address { font-style: normal; color: var(--texto-2); line-height: 1.55; }
.footer-id address a { font-weight: 700; }
.footer-mateo { display: flex; align-items: center; gap: 10px; color: var(--azul-noche); font-weight: 700; }
.footer-mateo img { width: 32px; height: 32px; border-radius: 8px; }
.footer-mateo span span { display: block; font-weight: 400; color: var(--texto-2); font-size: 0.9375rem; }

.footer-col h2 {
  font-family: var(--font-titulos);
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--texto-2);
  margin-bottom: 8px;
}
.footer-col a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--azul);
  font-weight: 700;
  text-decoration: none;
}
.footer-col a:hover { text-decoration: underline; }
.footer-col a[aria-current] { color: var(--azul-noche); text-decoration: underline; text-decoration-color: var(--naranja); text-decoration-thickness: 3px; }

.sello {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
  padding: 14px 18px;
  border: 2px solid var(--azul);
  border-radius: var(--radio);
  background: var(--azul-tenue);
  color: var(--azul-noche);
  text-decoration: none;
}
.sello:hover { background: #DCE6F1; }
.sello svg { width: 32px; height: 32px; flex: none; color: var(--azul); }
.sello strong { display: block; font-family: var(--font-titulos); font-size: 1.0625rem; }
.sello span span { display: block; color: var(--basalto); text-decoration: underline; text-underline-offset: 0.18em; }

.footer-bottom { background: var(--azul-noche); color: var(--sobre-oscuro-2); font-size: 0.9375rem; }
.footer-bottom .container { display: grid; gap: 8px; padding-block: 20px 24px; }
.footer-bottom p { line-height: 1.5; }
.footer-bottom .nota-ia { color: var(--sobre-oscuro-2); font-size: 0.875rem; }
.footer-bottom a { color: var(--blanco); }
.footer-bottom :focus-visible { outline-color: var(--naranja-claro); }

/* ==========================================================================
   Accesibilidad y preferencias
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

@media (forced-colors: active) {
  .btn, .nav-toggle, .sello, .card { border: 2px solid CanvasText; }
  .franja, .kicker::before, .etiqueta-ia::before { forced-color-adjust: none; }
}

@media print {
  .gov-links, .site-header, .to-top, .nav-toggle, .no-print, .footer-col, .sello { display: none !important; }
  body { background: #fff; font-size: 12pt; }
  .page-hero-art { display: none; }
  .doc-layout { display: block; }
  .toc-desktop, .toc-mobile { display: none; }
  a { color: #000; }
}

/* ==========================================================================
   Selector de idioma (sin cookies ni almacenamiento: enlaces a /en/, /de/…)
   ========================================================================== */
.lang { position: relative; flex: none; }
.lang summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  min-width: 44px;
  padding: 0 10px;
  border: 1px solid var(--linea-fuerte);
  border-radius: var(--radio-sm);
  background: var(--blanco);
  color: var(--azul-noche);
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}
.lang summary::-webkit-details-marker { display: none; }
.lang summary svg { width: 20px; height: 20px; color: var(--azul); }
.lang[open] summary { border-color: var(--azul); }
.lang ul {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 120;
  min-width: 200px;
  padding: 6px;
  background: var(--blanco);
  border: 1px solid var(--linea-fuerte);
  border-radius: var(--radio-sm);
  box-shadow: var(--sombra-alta);
}
.lang a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 8px;
  color: var(--basalto);
  font-weight: 700;
  text-decoration: none;
}
.lang a:hover { background: var(--azul-tenue); }
.lang a[aria-current] { color: var(--azul); box-shadow: inset 3px 0 0 var(--naranja); }
.lang a span { color: var(--texto-2); font-weight: 400; font-size: 0.875rem; }
