/* =========================================================
   NAVBAR MÓVIL (< 992px) — design.md §5, §8, §9, §10, §14, §15, §16
   Se carga desde navbar.php para todas las páginas. Usa clases propias
   (sx-navbar-mobile / sx-mobile-*) para no heredar las reglas antiguas
   de .navbar.mobile que siguen en varias hojas de página.
   ========================================================= */

.sx-navbar-mobile,
.sx-mobile-menu {
  --sxm-blue: var(--azulsurexs, #005290);
  --sxm-blue-l1: var(--azulsurexsl1, #0077bc);
  --sxm-blue-l4: var(--azulsurexsl4, #dbf0ff);
  --sxm-ink: var(--azulsurexsd1, #173656);
  --sxm-text: var(--grisobscuro, #404040);
  --sxm-white: #ffffff;
  --sxm-border: #a8d5ff;
  --sxm-surface-soft: #f6fbff;
  --sxm-yellow: var(--amarillo, #ffc23d);
  --sxm-yellow-d2: var(--amarillod2, #7e5a19);
  --sxm-green: var(--verde, #c0e16c);
  --sxm-green-hover: #aec95f;
  --sxm-green-text: #505a29;
  --sxm-focus: 3px solid rgba(0, 119, 188, .35);
  --sxm-ease: cubic-bezier(.22, 1, .36, 1);
  --sxm-font-headline: "Urbanist", sans-serif;
  --sxm-font-body: "Open Sans", sans-serif;
  font-family: var(--sxm-font-body);
}

.sx-navbar-mobile *,
.sx-mobile-menu * {
  box-sizing: border-box;
}

.sx-navbar-mobile a,
.sx-mobile-menu a {
  text-decoration: none;
}

.sx-navbar-mobile a:focus-visible,
.sx-navbar-mobile button:focus-visible,
.sx-mobile-menu a:focus-visible,
.sx-mobile-menu button:focus-visible {
  outline: var(--sxm-focus);
  outline-offset: 2px;
}

/* Icono monocromático recoloreado con máscara (§9.3) */
.sx-mobile-menu .sx-mask-icon {
  display: inline-block;
  flex: 0 0 auto;
  width: 1.25rem;
  height: 1.25rem;
  background-color: currentColor;
  -webkit-mask: var(--icon-url) center / contain no-repeat;
  mask: var(--icon-url) center / contain no-repeat;
}

/* ---------- Barra ---------- */

.sx-navbar-mobile {
  position: sticky;
  top: 0;
  z-index: 1030;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 64px;
  padding: .5rem 1rem;
  border-bottom: 1px solid rgba(0, 82, 144, .08);
  background-color: var(--sxm-white);
  box-shadow: 0 10px 35px rgba(0, 119, 188, .08);
}

.sx-navbar-mobile__brand {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.sx-navbar-mobile__brand img {
  width: 100px;
  height: auto;
  object-fit: contain;
}

.sx-navbar-mobile__toggler {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1.5px solid var(--sxm-blue-l4);
  border-radius: 12px;
  background-color: var(--sxm-white);
  color: var(--sxm-blue);
  transition: border-color .3s ease, background-color .3s ease;
}

.sx-navbar-mobile__toggler:hover,
.sx-navbar-mobile__toggler[aria-expanded="true"] {
  border-color: var(--sxm-blue-l1);
  background-color: var(--sxm-blue-l4);
}

/* Hamburguesa de tres líneas dibujada con CSS */
.sx-navbar-mobile__burger,
.sx-navbar-mobile__burger::before,
.sx-navbar-mobile__burger::after {
  display: block;
  width: 20px;
  height: 2.4px;
  border-radius: 999px;
  background-color: currentColor;
}

.sx-navbar-mobile__burger {
  position: relative;
}

.sx-navbar-mobile__burger::before,
.sx-navbar-mobile__burger::after {
  content: "";
  position: absolute;
  left: 0;
}

.sx-navbar-mobile__burger::before {
  top: -6.5px;
}

.sx-navbar-mobile__burger::after {
  top: 6.5px;
}

/* ---------- Panel ---------- */

.sx-mobile-menu.offcanvas {
  width: min(420px, 100vw);
  max-width: 100vw;
  border-left: 0 !important;
  background-color: var(--sxm-white);
  box-shadow: -18px 0 45px rgba(0, 82, 144, .16);
}

.sx-mobile-menu__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: .5rem 1rem .5rem 1.25rem;
  border-bottom: 1px solid var(--sxm-blue-l4);
}

.sx-mobile-menu__header img {
  width: 100px;
  height: auto;
}

.sx-mobile-menu__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1.5px solid var(--sxm-blue-l4);
  border-radius: 12px;
  background-color: var(--sxm-white);
  color: var(--sxm-blue);
  transition: border-color .3s ease, background-color .3s ease;
}

.sx-mobile-menu__close:hover {
  border-color: var(--sxm-blue-l1);
  background-color: var(--sxm-blue-l4);
}

/* Tache dibujado con CSS */
.sx-mobile-menu__close span {
  position: relative;
  width: 18px;
  height: 18px;
}

.sx-mobile-menu__close span::before,
.sx-mobile-menu__close span::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  height: 2.4px;
  border-radius: 999px;
  background-color: currentColor;
}

.sx-mobile-menu__close span::before {
  transform: translateY(-50%) rotate(45deg);
}

.sx-mobile-menu__close span::after {
  transform: translateY(-50%) rotate(-45deg);
}

.sx-mobile-menu__body {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: .75rem 1.25rem 2rem;
}

.sx-mobile-menu ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* ---------- Secciones ---------- */

.sx-mobile-section {
  border-bottom: 1px solid var(--sxm-blue-l4);
}

.sx-mobile-section__toggle,
.sx-mobile-section__link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  min-height: 56px;
  padding: .5rem .25rem;
  border: 0;
  background: transparent;
  color: var(--sxm-ink) !important;
  font-family: var(--sxm-font-headline);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.3;
  text-align: left;
  transition: color .3s ease;
}

.sx-mobile-section__toggle[aria-expanded="true"],
.sx-mobile-section__toggle:hover,
.sx-mobile-section__link:hover {
  color: var(--sxm-blue-l1) !important;
}

/* Chevron dibujado con bordes; gira al abrir */
.sx-mobile-chevron {
  flex: 0 0 auto;
  width: .55rem;
  height: .55rem;
  margin-right: .35rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  transition: transform .3s var(--sxm-ease);
}

[aria-expanded="true"] > .sx-mobile-chevron {
  transform: translateY(2px) rotate(-135deg);
}

.sx-mobile-section__panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: .25rem 0 1.25rem;
}

/* Enlaces con icono, título y descripción (mismo contenido que escritorio) */
.sx-mobile-links {
  display: flex;
  flex-direction: column;
  gap: .25rem;
}

.sx-mobile-card {
  display: grid;
  grid-template-columns: 2.75rem minmax(0, 1fr);
  gap: .85rem;
  align-items: center;
  min-height: 44px;
  padding: .75rem;
  border: 1px solid transparent;
  border-radius: 18px;
  color: var(--sxm-text);
  font-weight: 400;
  transition: background-color .3s ease, border-color .3s ease;
}

.sx-mobile-card:hover,
.sx-mobile-card:focus-visible {
  border-color: var(--sxm-border);
  background-color: var(--sxm-surface-soft);
}

/* Icono claro (§9.1) */
.sx-mobile-card__icon {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: .55rem;
  background-color: var(--sxm-blue-l4);
}

.sx-mobile-card__icon img {
  display: block;
  width: 55%;
  height: 55%;
  object-fit: contain;
}

.sx-mobile-card b {
  display: block;
  color: var(--sxm-blue);
  font-family: var(--sxm-font-headline);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
}

.sx-mobile-card small {
  display: block;
  padding-top: .2rem;
  color: var(--sxm-text);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.5;
}

/* Seguros: grupos plegables equivalentes a las pestañas de escritorio */
.sx-mobile-groups {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.sx-mobile-group {
  border: 1px solid var(--sxm-blue-l4);
  border-radius: 20px;
  overflow: hidden;
  transition: border-color .3s ease;
}

.sx-mobile-group:has(> [aria-expanded="true"]) {
  border-color: var(--sxm-border);
}

.sx-mobile-group__toggle {
  display: grid;
  grid-template-columns: 2.75rem minmax(0, 1fr) auto;
  gap: .85rem;
  align-items: center;
  width: 100%;
  min-height: 56px;
  padding: .65rem .75rem;
  border: 0;
  background: transparent;
  color: var(--sxm-ink);
  font-family: var(--sxm-font-body);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  text-align: left;
  transition: background-color .3s ease, color .3s ease;
}

.sx-mobile-group__toggle[aria-expanded="true"] {
  background-color: var(--sxm-surface-soft);
  color: var(--sxm-blue);
}

.sx-mobile-group__toggle[aria-expanded="true"] .sx-mobile-card__icon {
  background-color: var(--sxm-white);
}

.sx-mobile-group__links {
  padding: .25rem .5rem .75rem !important;
  background-color: var(--sxm-surface-soft);
}

.sx-mobile-group__links a {
  display: flex;
  align-items: center;
  gap: .6rem;
  min-height: 44px;
  padding: .5rem .75rem;
  border-radius: 14px;
  color: var(--sxm-text);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.4;
  transition: background-color .3s ease, color .3s ease;
}

.sx-mobile-group__links a::before {
  content: "";
  flex: 0 0 auto;
  width: .4rem;
  height: .4rem;
  border-top: 2px solid var(--sxm-blue-l1);
  border-right: 2px solid var(--sxm-blue-l1);
  transform: rotate(45deg);
}

.sx-mobile-group__links a:hover,
.sx-mobile-group__links a:focus-visible {
  background-color: var(--sxm-white);
  color: var(--sxm-blue);
}

/* CTA de cada sección: mismo contenido que el lateral de escritorio */
.sx-mobile-cta {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  padding: 1.15rem;
  border: 1px solid var(--sxm-border);
  border-radius: 24px;
  background-color: var(--sxm-surface-soft);
}

.sx-mobile-cta b {
  color: var(--sxm-blue);
  font-family: var(--sxm-font-headline);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
}

.sx-mobile-cta p {
  margin: 0;
  color: var(--sxm-text);
  font-size: 14px;
  line-height: 1.5;
}

/* Botón primario canónico: verde con pulso, ancho completo en móvil (§10) */
.sx-mobile-cta__button {
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 3rem;
  margin-top: .6rem;
  padding: .7rem 1.25rem;
  border: 2px solid var(--sxm-green);
  border-radius: 999px;
  background-color: var(--sxm-green);
  color: var(--sxm-green-text) !important;
  font-family: var(--sxm-font-headline);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: .015em;
  line-height: 1.2;
  transition: background-color .3s ease, border-color .3s ease;
}

.sx-mobile-cta__button::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -2px;
  border-radius: inherit;
  box-shadow: 0 0 0 0 rgba(140, 154, 70, .48);
  animation: sxm-button-pulse 2.2s ease-out infinite;
  pointer-events: none;
}

.sx-mobile-cta__button:hover,
.sx-mobile-cta__button:focus-visible {
  border-color: var(--sxm-green-hover);
  background-color: var(--sxm-green-hover);
}

.sx-mobile-cta__button:focus-visible,
.sx-mobile-sales:focus-visible {
  border-radius: 999px;
}

@keyframes sxm-button-pulse {
  70%, 100% { box-shadow: 0 0 0 .8rem transparent; }
}

/* ---------- Pie del panel ---------- */

.sx-mobile-sales {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 3rem;
  margin-top: 1.5rem;
  padding: .7rem 1.25rem;
  border: 1.5px solid var(--sxm-yellow);
  border-radius: 999px;
  background-color: var(--sxm-yellow);
  color: var(--sxm-yellow-d2) !important;
  font-family: var(--sxm-font-headline);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.2;
  box-shadow: 0 10px 24px rgba(188, 141, 38, .18);
}

.sx-mobile-sales .sx-mask-icon {
  width: 1.35rem;
  height: 1.35rem;
}

.sx-mobile-utility {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  margin-top: 1.25rem;
  padding: 1rem;
  border-radius: 20px;
  background-color: var(--sxm-surface-soft);
}

.sx-mobile-utility__link {
  display: flex;
  align-items: center;
  gap: .6rem;
  min-height: 44px;
  color: var(--sxm-ink) !important;
  font-size: 15px;
  font-weight: 600;
}

.sx-mobile-languages {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
  color: var(--sxm-ink);
}

.sx-mobile-languages > .sx-mask-icon {
  margin-right: .1rem;
}

.sx-mobile-languages__item {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 1rem;
  border: 1.5px solid var(--sxm-blue-l4);
  border-radius: 999px;
  background-color: var(--sxm-white);
  color: var(--sxm-ink) !important;
  font-size: 14px;
  font-weight: 600;
}

.sx-mobile-languages__item.is-current {
  border-color: var(--sxm-blue-l1);
  background-color: var(--sxm-blue-l4);
  color: var(--sxm-blue) !important;
}

a.sx-mobile-languages__item:hover {
  border-color: var(--sxm-blue-l1);
}

/* ---------- Pantallas muy estrechas (§15.1) ---------- */

@media (max-width: 380px) {
  .sx-mobile-menu__body {
    padding-inline: 1rem;
  }

  .sx-mobile-card {
    grid-template-columns: 2.5rem minmax(0, 1fr);
    padding: .65rem;
  }

  .sx-mobile-card__icon {
    width: 2.5rem;
    height: 2.5rem;
  }
}

/* Movimiento reducido (§14.3) */
@media (prefers-reduced-motion: reduce) {
  .sx-navbar-mobile *,
  .sx-mobile-menu,
  .sx-mobile-menu *,
  .sx-mobile-menu *::before,
  .sx-mobile-menu *::after {
    transition: none !important;
    animation: none !important;
  }
}
