/* ================================================================
   MAPA-METRO FICHA V3 — compatible visualmente con index radical
   Objetivo:
   - Layout de ficha moderna.
   - Estética coherente con mapa-metro.css/index radical.
   - Sin Bootstrap/jQuery.
   - Espacios de anuncios reservados para evitar CLS.
   ================================================================ */

:root {
  --ink: #071225;
  --ink-2: #16233A;
  --text: #24324A;
  --muted: #65748B;
  --muted-2: #8995A8;
  --paper: #FFFFFF;
  --surface: #FFFFFF;
  --soft: #F3F7FC;
  --soft-2: #EEF4FF;
  --line: #D9E2EF;
  --line-strong: #C0CCE0;
  --blue: #0039A6;
  --blue-2: #0B4FE8;
  --red: #E1251B;
  --red-2: #B91C16;
  --yellow: #FFD329;
  --green: #12A878;
  --orange: #F97316;
  --cyan: #06A7C8;
  --amber: #F4B400;
  --maxw: 1480px;
  --contentw: 780px;
  --sidebarw: 340px;
  --radius: 18px;
  --radius-sm: 10px;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

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

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

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.58;
  font-weight: 500;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(0,57,166,.040) 1px, transparent 1px),
    linear-gradient(0deg, rgba(225,37,27,.030) 1px, transparent 1px),
    var(--paper);
  background-size: 48px 48px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv11" 1, "ss01" 1;
}

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

img {
  max-width: 100%;
  height: auto;
  display: block;
}

iframe {
  max-width: 100%;
  border: 0;
  display: block;
  aspect-ratio: 16 / 9;
  height: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 28px 0;
  overflow: hidden;
  font-size: .95rem;
  background: #fff;
}

th, td {
  border: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
}

th {
  background: var(--soft-2);
  color: var(--ink);
  font-weight: 900;
}

.mm-container {
  width: min(100%, var(--maxw));
  margin-inline: auto;
  padding-left: clamp(22px, 4vw, 56px);
  padding-right: clamp(22px, 4vw, 56px);
}

/* Header */
.mm-site-header {
  position: sticky;
  top: 0;
  z-index: 80;
  background: rgba(7, 17, 36, .94);
  color: #fff;
  border-bottom: 4px solid var(--red);
  backdrop-filter: blur(12px) saturate(160%);
  -webkit-backdrop-filter: blur(12px) saturate(160%);
}

.mm-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 12px;
  padding-bottom: 12px;
}

.mm-logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  text-decoration: none;
  font-weight: 950;
  letter-spacing: -0.045em;
  font-size: clamp(1.08rem, 2.15vw, 1.42rem);
  white-space: nowrap;
}

.mm-logo:hover { color: #fff; }
.mm-logo small { color: rgba(255,255,255,.68); font-weight: 900; letter-spacing: -0.03em; }

.mm-roundel {
  width: 46px;
  height: 46px;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,.25));
  flex: 0 0 auto;
}

.mm-roundel-m {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.mm-header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.mm-header-actions a {
  color: rgba(255,255,255,.84);
  font-weight: 850;
  font-size: .92rem;
}

.mm-header-actions a:hover { color: #fff; }

/* Language selector */
.lang-switcher { position: relative; }
.lang-switcher summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 13px;
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 999px;
  background: rgba(255,255,255,.09);
  color: #fff;
  font-size: .86rem;
  font-weight: 800;
  user-select: none;
}
.lang-switcher summary::-webkit-details-marker { display: none; }
.lang-switcher summary::marker { content: ""; }
.lang-switcher[open] summary,
.lang-switcher summary:hover { background: #fff; color: var(--ink); }

.lang-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 230px;
  max-height: min(70vh, 480px);
  overflow-y: auto;
  padding: 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 18px 50px rgba(7,17,36,.24);
  z-index: 100;
}

.lang-panel a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 10px;
  color: var(--ink);
  font-size: .93rem;
  font-weight: 700;
  text-decoration: none;
}

.lang-panel a:hover { background: #F4F6FF; color: var(--blue); }
.lang-panel a.active { background: var(--blue); color: #fff; }
.lang-panel .flag { width: 1.5em; text-align: center; font-size: 1.2rem; }
.lang-panel .name { flex: 1; }
.lang-panel .code { font-size: .72rem; letter-spacing: .08em; color: var(--muted-2); }
.lang-panel a.active .code { color: rgba(255,255,255,.78); }

/* Breadcrumb */
.mm-breadcrumb {
  padding-top: 18px;
  padding-bottom: 8px;
  color: var(--muted);
  font-size: .92rem;
  font-weight: 700;
}

.mm-breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.mm-breadcrumb li::after {
  content: "/";
  margin-left: 8px;
  color: var(--muted-2);
}

.mm-breadcrumb li:last-child::after { content: ""; }

/* Hero */
.mm-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(240px, .55fr);
  align-items: end;
  gap: clamp(24px, 4vw, 64px);
  padding-top: clamp(38px, 6vw, 82px);
  padding-bottom: clamp(24px, 4vw, 42px);
}

.mm-hero::after {
  content: "";
  position: absolute;
  right: clamp(22px, 4vw, 56px);
  top: 28px;
  width: min(28vw, 360px);
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, transparent 0 42%, var(--red) 43% 50%, transparent 51%),
    linear-gradient(var(--blue), var(--blue));
  background-size: 100% 100%, 100% 18%;
  background-repeat: no-repeat;
  background-position: center, center;
  opacity: .075;
  pointer-events: none;
}

.mm-eyebrow {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
  color: var(--blue);
  font-size: .82rem;
  font-weight: 950;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.mm-eyebrow::before {
  content: "";
  width: 26px;
  height: 5px;
  border-radius: 999px;
  background: var(--red);
}

.mm-h1 {
  max-width: 900px;
  margin: 0 0 18px;
  font-size: clamp(2.45rem, 6.4vw, 5.7rem);
  line-height: .88;
  letter-spacing: -0.075em;
  font-weight: 950;
  color: var(--ink);
  text-wrap: balance;
}

.mm-lead {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  font-size: clamp(1.03rem, 1.4vw, 1.22rem);
  font-weight: 560;
  letter-spacing: -0.018em;
  text-wrap: balance;
}

.mm-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.mm-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: .96rem;
  font-weight: 950;
  text-decoration: none;
  box-shadow: 4px 4px 0 rgba(7,17,36,.10);
}

.mm-button:hover {
  color: #fff;
  background: var(--red);
  border-color: var(--red);
}

.mm-button--secondary {
  background: #fff;
  color: var(--ink);
}

.mm-button--secondary:hover {
  color: #fff;
  background: var(--blue);
  border-color: var(--blue);
}

.mm-system-icon-wrap {
  margin: 0;
  justify-self: end;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mm-system-icon {
  position: relative;
  z-index: 1;
  width: clamp(150px, 14vw, 180px);
  height: clamp(150px, 14vw, 180px);
  object-fit: contain;
  border: 2px solid var(--ink);
  border-radius: 22px;
  background: rgba(255, 255, 255, .92);
  padding: 14px;
  box-shadow: 6px 6px 0 rgba(7, 17, 36, .08);
}

/* Skip link (a11y) */
.mm-skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 1000;
  padding: 10px 14px;
  background: var(--ink);
  color: #fff;
  font-weight: 900;
  border-radius: 0 0 8px 0;
  text-decoration: none;
}
.mm-skip:focus { left: 0; }

/* Top ad: exactly reserved visible block after hero */
.mm-top-ad-wrap {
  display: flex;
  justify-content: center;
  padding-top: 4px;
  padding-bottom: 24px;
}

/* Layout */
.mm-main {
  padding: 14px 0 64px;
}

.mm-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

@media (min-width: 1080px) {
  .mm-layout {
    /* Columnas de ancho real: contenido (con tope para legibilidad) y
       sidebar fija. Centramos las dos tracks dentro del .mm-container
       para que el hueco entre ambas sea SOLO el gap, no espacio sobrante
       del propio track. */
    grid-template-columns: minmax(0, var(--contentw)) var(--sidebarw);
    gap: clamp(28px, 3vw, 56px);
    justify-content: center;
  }
}

.mm-content,
.mm-sidebar { min-width: 0; }

.mm-sidebar {
  display: grid;
  gap: 18px;
}

@media (min-width: 1080px) {
  .mm-sidebar {
    position: sticky;
    top: 92px;
  }
}

/* Article */
.mm-article {
  display: flow-root;
  background: rgba(255,255,255,.90);
  border: 2px solid var(--ink);
  border-radius: 22px;
  box-shadow: 6px 6px 0 rgba(7,17,36,.07);
  padding: clamp(22px, 3.4vw, 42px);
}

.mm-article > :first-child { margin-top: 0; }

.mm-article h2 {
  margin: 44px 0 16px;
  font-size: clamp(1.65rem, 3vw, 2.35rem);
  line-height: 1.05;
  letter-spacing: -.055em;
  font-weight: 950;
  color: var(--ink);
}

.mm-article h3 {
  margin: 34px 0 12px;
  font-size: clamp(1.32rem, 2.1vw, 1.65rem);
  line-height: 1.15;
  letter-spacing: -.035em;
  font-weight: 950;
}

.mm-article h4 {
  margin: 28px 0 10px;
  color: var(--ink-2);
  font-size: 1.08rem;
  line-height: 1.25;
  font-weight: 950;
}

.mm-article p,
.mm-article li {
  color: var(--text);
  font-size: 1.03rem;
}

.mm-article p { margin: 0 0 18px; }
.mm-article ul,
.mm-article ol { padding-left: 1.25rem; }

.mm-article .center-block {
  margin: 26px auto;
}

.mm-article .img-responsive,
.mm-article img {
  border-radius: 16px;
}

/* Map anchor positioning */
#mapa-anchor {
  display: block;
  height: 1px;
  scroll-margin-top: 92px;
}

@media (max-width: 767px) {
  #mapa-anchor {
    scroll-margin-top: 78px;
  }
}

/* Cards/sidebars */
.mm-card,
.mm-map-section,
.mm-help,
.mm-related {
  background: rgba(255,255,255,.92);
  border: 2px solid var(--ink);
  border-radius: 20px;
  box-shadow: 5px 5px 0 rgba(7,17,36,.07);
  padding: 18px;
}

.mm-card h2,
.mm-map-section h2,
.mm-help h2,
.mm-related h2 {
  margin: 0 0 14px;
  font-size: 1.15rem;
  line-height: 1.15;
  letter-spacing: -.035em;
  font-weight: 950;
}

.mm-map-card img,
.mm-map-section img {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--soft);
}

.mm-facts-list {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  font-size: .95rem;
}

.mm-fact {
  display: grid;
  gap: 2px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--line-strong);
}

.mm-fact:last-child { border-bottom: 0; }

.mm-fact dt {
  color: var(--muted);
  font-size: .75rem;
  font-weight: 950;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.mm-fact dd {
  margin: 0;
  color: var(--ink);
  font-weight: 600;
  word-break: break-word;
}

.mm-fact dd a {
  word-break: break-all;
}

/* Map */
.mm-map-section {
  margin-top: 28px;
  scroll-margin-top: 96px;
}

.mm-map-title {
  font-size: clamp(1.65rem, 3vw, 2.35rem) !important;
}

.mm-map-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}

.mm-help,
.mm-related { margin-top: 28px; }

/* Related links */
.mm-related-groups {
  display: grid;
  gap: 18px;
}

.mm-related-group h3 {
  margin: 0 0 10px;
  font-size: 1rem;
  font-weight: 950;
  letter-spacing: -.02em;
}

.mm-related-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mm-related-links a {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #fff;
  padding: 6px 11px;
  color: var(--ink-2);
  font-size: .9rem;
  font-weight: 780;
}

.mm-related-links a:hover {
  border-color: var(--blue);
  color: var(--blue);
}

/* Ads */
.mm-ad {
  width: 100%;
  overflow: hidden;
  contain: layout paint;
  border-radius: 16px;
  background: transparent;
}

.mm-ad__label {
  margin-bottom: 6px;
  color: var(--muted-2);
  font-size: .70rem;
  font-weight: 850;
  letter-spacing: .08em;
  text-align: center;
  text-transform: uppercase;
}

.mm-ad--placeholder {
  pointer-events: none;
}

.mm-ad--top-rectangle {
  width: min(970px, 100%);
  min-height: 250px;
  margin: 0 auto;
}

.mm-ad--inarticle {
  min-height: 320px;
  margin: 34px 0;
}

.mm-ad--sidebar {
  min-height: 600px;
  margin: 0;
}

.mm-ad--pre-map-mobile {
  display: none;
}

@media (max-width: 767px) {
  .mm-ad--top-rectangle {
    width: 300px;
    min-width: 300px;
    max-width: 300px;
    min-height: 250px;
  }

  .mm-ad--sidebar {
    min-height: 280px;
  }

  .mm-ad--pre-map-mobile {
    display: block;
    width: 300px;
    min-width: 300px;
    max-width: 300px;
    min-height: 600px;
    margin: 28px auto 20px;
  }
}

/* Footer */
.mm-footer {
  margin-top: 76px;
  padding: 34px 0;
  background: var(--ink);
  border-top: 4px solid var(--red);
  color: rgba(255,255,255,.75);
  font-size: .92rem;
  text-align: center;
}

.mm-footer a {
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.35);
}

.mm-footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
}

/* Mobile */
@media (max-width: 920px) {
  .mm-hero {
    grid-template-columns: 1fr;
    text-align: left;
  }

  .mm-system-icon-wrap {
    justify-self: start;
    order: -1;
    margin-bottom: 8px;
  }

  .mm-system-icon {
    width: 160px;
    height: 160px;
    padding: 12px;
  }
}

@media (max-width: 640px) {
  .mm-header-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px 12px;
  }

  .mm-logo {
    font-size: 1.05rem;
    min-width: 0;
  }

  .mm-logo span {
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .mm-roundel {
    width: 56px;
    height: 56px;
  }

  .mm-hero {
    padding-top: 32px;
  }

  .mm-h1 {
    font-size: clamp(2.2rem, 13vw, 3.9rem);
  }

  .mm-system-icon {
    width: 170px;
    height: 170px;
  }

  .mm-card,
  .mm-map-section,
  .mm-help,
  .mm-related,
  .mm-article {
    border-radius: 16px;
    box-shadow: 4px 4px 0 rgba(7,17,36,.07);
  }
}

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

@media print {
  .mm-site-header,
  .mm-ad,
  .mm-footer {
    display: none !important;
  }

  body {
    background: #fff;
  }

  .mm-article,
  .mm-card,
  .mm-map-section,
  .mm-help,
  .mm-related {
    box-shadow: none;
    border: 1px solid #999;
  }
}


/* Related links estilo original pero con estética v4 */
.mm-related-original {
  display: grid;
  gap: 22px;
  text-align: center;
}

.mm-related-block h2 {
  margin: 0 0 12px;
  font-size: 1.05rem;
  font-weight: 950;
  letter-spacing: -.025em;
}

.mm-related-inline-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.mm-related-inline-links a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #fff;
  color: var(--ink-2);
  font-size: .9rem;
  font-weight: 780;
}

.mm-related-inline-links a:hover {
  border-color: var(--blue);
  color: var(--blue);
}


/* El bloque de ayuda debe dejar claro el enlace de contacto */
.mm-help a {
  font-weight: 900;
  border-bottom: 2px solid rgba(0,57,166,.18);
}
.mm-help a:hover {
  border-bottom-color: rgba(225,37,27,.25);
}

/* Logo/header refinements en móvil */
@media (max-width: 640px) {
  .mm-logo {
    gap: 14px;
    font-size: 1.18rem;
  }
  .mm-header-inner {
    padding-top: 12px;
    padding-bottom: 12px;
  }
}

/* ================================================================
   SHARE
   - Desktop (≥901px): inline, dentro del bloque .mm-map-actions,
     justo después de los botones del mapa.
   - Móvil (≤900px): barra horizontal sticky pegada al footer.
   ================================================================ */

.mm-share {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 0;
  padding: 0;
}

/* Label oculto en versión inline (sí lo lee un screen reader) */
.mm-share__label,
.mm-share__sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.mm-share__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 999px;
  color: #fff;
  background: #444;
  text-decoration: none;
  transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
  box-shadow: 0 4px 10px rgba(0, 0, 0, .18);
}

.mm-share__btn:hover,
.mm-share__btn:focus-visible {
  color: #fff;
  transform: translateY(-2px) scale(1.04);
  filter: brightness(1.08);
  outline: none;
}

.mm-share__btn svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

/* Colores de marca oficiales */
.mm-share__btn.is-whatsapp  { background: #25D366; }
.mm-share__btn.is-facebook  { background: #1877F2; }
.mm-share__btn.is-pinterest { background: #E60023; }
.mm-share__btn.is-email     { background: #444444; }

/* Separador visual entre los botones de mapa y los de compartir (desktop) */
@media (min-width: 901px) {
  .mm-map-actions .mm-share {
    position: relative;
    padding-left: 14px;
    margin-left: 6px;
  }
  .mm-map-actions .mm-share::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 1px;
    height: 28px;
    background: var(--line-strong);
  }
}

/* ---- Móvil (≤900px): la barra de compartir vuela al footer ---- */
@media (max-width: 900px) {
  .mm-share {
    position: fixed;
    z-index: 70;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: row;
    justify-content: space-around;
    align-items: center;
    padding: 10px 12px max(10px, env(safe-area-inset-bottom));
    background: rgba(7, 17, 36, .96);
    -webkit-backdrop-filter: blur(10px) saturate(160%);
    backdrop-filter: blur(10px) saturate(160%);
    border-top: 3px solid var(--red);
    border-radius: 0;
    box-shadow: 0 -8px 24px rgba(7, 17, 36, .22);
  }
  .mm-share__btn { width: 50px; height: 50px; }
  .mm-share__btn svg { width: 24px; height: 24px; }

  /* Evitar que la barra tape el final del contenido / footer */
  body {
    padding-bottom: 84px;
  }

  /* Si por casualidad mm-share está dentro de .mm-map-actions,
     no debe ocupar espacio en el flujo del mapa. */
  .mm-map-actions .mm-share { display: flex; }
}

/* En impresión, ocultar la barra de compartir */
@media print {
  .mm-share { display: none !important; }
}

/* Related links último bloque */
.mm-related {
  margin-top: 34px;
}
.mm-related-original {
  display: grid;
  gap: 22px;
  text-align: center;
}
.mm-related-block h2 {
  margin: 0 0 12px;
  font-size: 1.05rem;
  font-weight: 950;
  letter-spacing: -.025em;
}
.mm-related-inline-links ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.mm-related-inline-links li {
  display: inline;
}
.mm-related-inline-links a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  margin: 4px;
  padding: 6px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #fff;
  color: var(--ink-2);
  font-size: .9rem;
  font-weight: 780;
}
.mm-related-inline-links a:hover {
  border-color: var(--blue);
  color: var(--blue);
}

/* ================================================================
   MOBILE LAYOUT REORDER
   En móvil/tablet (<1080px) queremos esta secuencia visual:

     1. article (contenido editorial)
     2. datos rápidos (facts card del sidebar)
     3. ancla mapa + ad pre-map (si lo hay)
     4. sección mapa principal (única; sin duplicado)
     5. ayúdanos a mejorar
     6. metros relacionados (ÚLTIMO bloque, sin ads detrás)

   Se ocultan en móvil:
     - mm-map-card  (mapa duplicado del sidebar)
     - mm-ad--sidebar (anuncio que quedaría al final del contenido)
   ================================================================ */

@media (max-width: 1079px) {
  .mm-layout {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 18px;
    min-width: 0;
    width: 100%;
  }

  /* Promovemos los hijos directos de content/sidebar al layout flex
     para poder reordenar transversalmente. */
  .mm-content,
  .mm-sidebar {
    display: contents;
  }

  /* Cualquier hijo del layout debe poder encogerse y no salirse del ancho.
     Sin esto, una tabla legacy o una URL larga en el contenido editorial
     fuerza scroll horizontal en móvil. */
  .mm-layout > * {
    min-width: 0;
    max-width: 100%;
  }

  /* Orden visual en móvil.
     IMPORTANTE: en móvil .mm-ad (pre_map_mobile, 300x600) va ANTES que
     #mapa-anchor para que el click en "Ver mapa" caiga justo encima del
     título del mapa, no encima del ad. En desktop el ad está display:none,
     da igual el orden. */
  .mm-content > .mm-article            { order: 1; }
  .mm-sidebar > .mm-card               { order: 2; }   /* facts card */
  .mm-content > .mm-ad                 { order: 3; }   /* pre_map_mobile (PRIMERO) */
  .mm-content > #mapa-anchor           { order: 4; }   /* anchor (DESPUÉS del ad) */
  .mm-content > .mm-map-section        { order: 5; }
  .mm-content > .mm-help               { order: 6; }
  .mm-content > .mm-related            { order: 7; }

  /* Ocultar duplicados / anuncio terminal en móvil */
  .mm-sidebar > .mm-map-card,
  .mm-sidebar > .mm-ad--sidebar {
    display: none !important;
  }

  /* Contenido editorial: tablas, iframes, imágenes y palabras largas
     no deben empujar el ancho del article. */
  .mm-article,
  .mm-card,
  .mm-map-section,
  .mm-help,
  .mm-related {
    overflow-wrap: anywhere;
    word-wrap: break-word;
  }
  .mm-article table,
  .mm-card table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .mm-article img,
  .mm-article iframe,
  .mm-article video,
  .mm-article embed,
  .mm-article object {
    max-width: 100%;
    height: auto;
  }
  .mm-article pre,
  .mm-article code {
    white-space: pre-wrap;
    word-break: break-word;
    max-width: 100%;
  }
}

/* Cinturón y tirantes: garantizamos que el body NUNCA tenga scroll horizontal */
html, body {
  overflow-x: clip;
}
