/* CSXXI – Cabecera, pie y navegación de celular. Tokens en csxxi-ux.css. */

.csx-wrap {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 16px;
}

.csx-ico {
  width: 1em;
  height: 1em;
  flex: none;
}

/* =========================================================================
 * Barra superior institucional
 * ====================================================================== */

.csx-topbar {
  background: #083f6e;
  color: #cfe3f5;
  font: 400 13px/1 Roboto, Arial, sans-serif;
}

.csx-topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 36px;
}

.csx-topbar__links {
  display: flex;
  align-items: center;
  gap: 20px;
}

.csx-topbar a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #e6f1fb !important;
  text-decoration: none !important;
  transition: color .2s;
}

.csx-topbar a:hover {
  color: #fff !important;
  text-decoration: underline !important;
}

.csx-topbar .csx-ico {
  font-size: 15px;
}

.csx-topbar__cta {
  background: rgba(255, 255, 255, .12);
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 600;
}

.csx-topbar__cta:hover {
  background: rgba(255, 255, 255, .22);
  text-decoration: none !important;
}

/* =========================================================================
 * Cabecera principal (fija al hacer scroll)
 * ====================================================================== */

.csx-header {
  position: sticky;
  top: var(--wp-admin--admin-bar--height, 0px);
  z-index: 1000;
  background: linear-gradient(100deg, #0a5594 0%, #0077c8 60%, #0a86d8 100%);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .08) inset, 0 4px 18px rgba(8, 63, 110, .18);
  transition: transform .3s var(--csx-ease, ease), box-shadow .3s;
  will-change: transform;
  overflow-anchor: none;
}

.csx-header__inner {
  display: flex;
  align-items: center;
  gap: 28px;
  min-height: 72px;
}

.csx-header.csx-compact {
  box-shadow: 0 6px 24px rgba(8, 63, 110, .28);
}

.csx-logo {
  display: block;
  flex: none;
  line-height: 0;
}

.csx-logo__img {
  height: 40px;
  width: auto;
  transform-origin: left center;
  transition: transform .25s var(--csx-ease, ease);
}

@media (min-width: 768px) {
  .csx-header.csx-compact .csx-logo__img {
    transform: scale(.85);
  }
}

.csx-logo__text {
  color: #fff;
  font: 700 20px/1 Roboto, Arial, sans-serif;
}

.csx-nav {
  flex: 1;
  min-width: 0;
}

.csx-nav ul {
  display: flex;
  align-items: center;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.csx-nav li {
  margin: 0;
}

.csx-nav__link {
  position: relative;
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  color: #fff !important;
  font: 600 15px/1 Roboto, Arial, sans-serif;
  text-decoration: none !important;
  white-space: nowrap;
  transition: background .2s;
}

.csx-nav__link:hover {
  background: rgba(255, 255, 255, .12);
}

.csx-nav__link[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 2px;
  height: 3px;
  border-radius: 3px;
  background: #fff;
}

.csx-nav__link--pill {
  margin-left: 6px;
  background: #fff;
  color: #0a5594 !important;
  padding: 10px 16px;
  border-radius: 999px;
}

.csx-nav__link--pill:hover {
  background: #e6f1fb;
}

.csx-nav__link--pill[aria-current="page"]::after {
  display: none;
}

/* Buscador */
.csx-search {
  position: relative;
  display: flex;
  align-items: center;
  margin: 0;
}

.csx-search > .csx-ico {
  position: absolute;
  left: 12px;
  font-size: 18px;
  color: #6b7280;
  pointer-events: none;
}

.csx-search input[type="search"] {
  width: 100%;
  height: 42px;
  margin: 0 !important;
  padding: 0 12px 0 38px !important;
  border: 1px solid transparent !important;
  border-radius: 999px !important;
  background: #fff !important;
  color: #111 !important;
  font: 400 15px/1 Roboto, Arial, sans-serif !important;
  box-shadow: none !important;
  -webkit-appearance: none;
}

.csx-search input[type="search"]:focus {
  border-color: #0077c8 !important;
  box-shadow: 0 0 0 3px rgba(0, 119, 200, .25) !important;
  outline: none;
}

.csx-search__btn {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.csx-header__search {
  flex: 0 0 240px;
  transition: flex-basis .25s var(--csx-ease, ease);
}

.csx-header__search:focus-within {
  flex-basis: 320px;
}

.csx-header__search .csx-search input[type="search"] {
  background: rgba(255, 255, 255, .16) !important;
  color: #fff !important;
  border-color: rgba(255, 255, 255, .25) !important;
}

.csx-header__search .csx-search input[type="search"]::placeholder {
  color: rgba(255, 255, 255, .75);
}

.csx-header__search .csx-search > .csx-ico {
  color: rgba(255, 255, 255, .85);
}

.csx-header__search .csx-search input[type="search"]:focus {
  background: #fff !important;
  color: #111 !important;
}

.csx-header__search .csx-search:focus-within > .csx-ico {
  color: #6b7280;
}

#csx-main {
  outline: none;
}

@media (max-width: 1180px) {
  .csx-header__search {
    flex-basis: 44px;
  }
  .csx-header__search .csx-search input[type="search"] {
    padding-right: 0 !important;
    cursor: pointer;
  }
  .csx-header__search:focus-within {
    flex-basis: 260px;
  }
}

/* =========================================================================
 * Pie
 * ====================================================================== */

.csx-footer {
  margin-top: 48px;
  background: #0a2f52;
  color: #c7d8e8;
  font: 400 15px/1.6 Roboto, Arial, sans-serif;
}

.csx-footer__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) repeat(3, minmax(0, 1fr));
  gap: 40px;
  padding-top: 52px;
  padding-bottom: 40px;
}

.csx-flogo {
  display: inline-block;
  line-height: 0;
  margin-bottom: 16px;
}

.csx-flogo__img {
  height: 44px;
  width: auto;
}

.csx-footer__brand p {
  margin: 0 0 18px;
  color: #c7d8e8;
  max-width: 34ch;
}

.csx-footer ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.csx-footer li {
  margin: 0 0 10px;
}

.csx-footer a {
  color: #e6f1fb !important;
  text-decoration: none !important;
  transition: color .2s;
}

.csx-footer a:hover {
  color: #fff !important;
  text-decoration: underline !important;
}

.csx-footer__contact li {
  display: flex;
  align-items: center;
  gap: 10px;
  word-break: break-word;
}

.csx-footer__contact .csx-ico {
  font-size: 18px;
  color: #6fb7ec;
}

.csx-footer__title {
  margin: 0 0 16px !important;
  font: 700 13px/1.2 Roboto, Arial, sans-serif !important;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #fff !important;
}

.csx-footer__edition {
  display: block;
  margin-bottom: 14px;
}

.csx-footer__edition img {
  width: 100%;
  max-width: 220px;
  height: auto;
  aspect-ratio: 428 / 400;
  object-fit: cover;
  border-radius: 8px;
  display: block;
  margin-bottom: 8px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .3);
}

.csx-footer__edition span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

.csx-footer__note {
  border-top: 1px solid rgba(255, 255, 255, .1);
  padding: 16px 0;
  font-size: 13px;
  color: #9fb8cf;
}

.csx-footer__legal {
  background: #082640;
  padding: 16px 0;
  font-size: 13px;
}

.csx-footer__legal-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 24px;
}

.csx-footer__legal nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
}

@media (max-width: 1024px) {
  .csx-footer__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* =========================================================================
 * Barra inferior "liquid glass" y hojas – solo celular
 * ====================================================================== */

.csx-tabbar,
.csx-sheet,
.csx-backdrop {
  display: none;
}

@media (max-width: 767px) {

  /* --- Cabecera compacta; se oculta al bajar y vuelve al subir --- */
  .csx-topbar,
  .csx-nav,
  .csx-header__search {
    display: none;
  }

  .csx-header__inner {
    min-height: 56px;
    justify-content: center;
  }

  .csx-logo__img {
    height: 30px;
  }

  .csx-header.csx-hide {
    transform: translateY(-110%);
  }

  /* --- Pie en una columna, sin repetir lo que ya está en la barra --- */
  .csx-footer {
    margin-top: 32px;
  }

  .csx-footer__grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 28px 20px;
    padding-top: 36px;
    padding-bottom: 28px;
  }

  .csx-footer__brand {
    grid-column: 1 / -1;
  }

  .csx-footer__mag {
    grid-column: 1 / -1;
  }

  .csx-footer__edition {
    display: flex;
    align-items: center;
    gap: 14px;
  }

  .csx-footer__edition img {
    width: 96px;
    margin: 0;
  }

  .csx-footer li {
    margin: 0;
  }

  .csx-footer__col li a {
    display: block;
    padding: 9px 0;
  }

  .csx-footer__legal-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .csx-footer__legal nav a {
    display: inline-block;
    padding: 6px 0;
  }

  /* Espacio para la barra inferior */
  body {
    padding-bottom: calc(96px + env(safe-area-inset-bottom)) !important;
  }

  .scroll_to_top {
    display: none !important;
  }

  /* --- Barra inferior --- */
  .csx-tabbar {
    display: block;
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    z-index: 9995;
    pointer-events: none;
  }

  .csx-tabbar__glass {
    pointer-events: auto;
    position: relative;
    display: flex;
    align-items: stretch;
    justify-content: space-around;
    height: 66px;
    padding: 6px;
    border-radius: 26px;
    overflow: hidden;
    isolation: isolate;
    /* Vidrio: tinte claro + desenfoque + saturación del fondo */
    background: rgba(255, 255, 255, .58);
    -webkit-backdrop-filter: blur(22px) saturate(190%) contrast(105%);
    backdrop-filter: blur(22px) saturate(190%) contrast(105%);
    border: 1px solid rgba(255, 255, 255, .7);
    box-shadow:
      0 12px 32px rgba(10, 47, 82, .22),
      0 2px 6px rgba(10, 47, 82, .12),
      inset 0 1px 0 rgba(255, 255, 255, .95),
      inset 0 -1px 0 rgba(255, 255, 255, .35),
      inset 0 0 0 .5px rgba(255, 255, 255, .5);
    transition: height .3s var(--csx-ease, ease), border-radius .3s var(--csx-ease, ease), transform .3s var(--csx-ease, ease);
  }

  /* Brillo especular arriba y refracción en los bordes */
  .csx-tabbar__glass::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    border-radius: inherit;
    background:
      linear-gradient(180deg, rgba(255, 255, 255, .75) 0%, rgba(255, 255, 255, .15) 38%, rgba(255, 255, 255, 0) 60%),
      radial-gradient(120% 90% at 50% 120%, rgba(0, 119, 200, .10) 0%, rgba(0, 119, 200, 0) 60%);
    pointer-events: none;
  }

  .csx-tabbar__glass::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    border-radius: inherit;
    box-shadow: inset 6px 0 12px -10px rgba(255, 255, 255, .9), inset -6px 0 12px -10px rgba(255, 255, 255, .9);
    pointer-events: none;
  }

  /* Sin soporte de backdrop-filter o con "reducir transparencia": vidrio opaco */
  @supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .csx-tabbar__glass {
      background: rgba(255, 255, 255, .96);
    }
  }

  .csx-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 20px;
    background: transparent;
    color: #2b3440 !important;
    font: 600 11px/1 Roboto, Arial, sans-serif;
    letter-spacing: .01em;
    text-decoration: none !important;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: color .2s, background .25s, transform .15s;
  }

  .csx-tab .csx-ico {
    font-size: 24px;
    transition: transform .25s var(--csx-ease, ease);
  }

  .csx-tab span {
    transition: opacity .2s, max-height .25s;
    max-height: 14px;
    white-space: nowrap;
  }

  .csx-tab:active {
    transform: scale(.94);
  }

  /* Pestaña activa: gota de vidrio azul */
  .csx-tab.is-active,
  .csx-tab[aria-expanded="true"] {
    color: #0063a8 !important;
    background: linear-gradient(180deg, rgba(0, 119, 200, .16), rgba(0, 119, 200, .08));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8), inset 0 0 0 1px rgba(0, 119, 200, .12);
  }

  .csx-tab.is-active .csx-ico {
    transform: translateY(-1px);
  }

  .csx-tab:focus-visible {
    outline: 2px solid #0077c8;
    outline-offset: -2px;
  }

  /* Al bajar leyendo, la barra se achica (solo íconos) */
  .csx-tabbar.csx-min .csx-tabbar__glass {
    height: 52px;
    border-radius: 22px;
  }

  .csx-tabbar.csx-min .csx-tab span {
    opacity: 0;
    max-height: 0;
  }

  /* La publicidad fija de celular se apoya sobre la barra */
  .csx-ad--mobile_anchor {
    bottom: calc(86px + env(safe-area-inset-bottom)) !important;
    left: 12px !important;
    right: 12px !important;
    border-radius: 14px;
    padding-top: 6px !important;
    padding-bottom: 6px !important;
  }

  body.csx-has-anchor {
    padding-bottom: calc(160px + env(safe-area-inset-bottom)) !important;
  }

  body.csx-sheet-open .csx-ad--mobile_anchor {
    display: none;
  }

  /* --- Hojas (Secciones / Buscar) --- */
  .csx-backdrop:not([hidden]) {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 9996;
    background: rgba(8, 38, 64, .35);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    animation: csx-fade .2s ease;
  }

  .csx-sheet:not([hidden]) {
    display: block;
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: calc(8px + env(safe-area-inset-bottom));
    z-index: 9997;
    max-height: 82vh;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 8px 18px 22px;
    border-radius: 28px;
    background: rgba(255, 255, 255, .82);
    -webkit-backdrop-filter: blur(28px) saturate(180%);
    backdrop-filter: blur(28px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, .8);
    box-shadow: 0 -8px 40px rgba(8, 38, 64, .25), inset 0 1px 0 #fff;
    animation: csx-up .32s var(--csx-ease, ease);
  }

  .csx-sheet__grabber {
    width: 40px;
    height: 5px;
    border-radius: 3px;
    background: rgba(0, 0, 0, .18);
    margin: 4px auto 10px;
  }

  .csx-sheet__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
  }

  .csx-sheet__head h2 {
    margin: 0 !important;
    font: 700 22px/1.2 Roboto, Arial, sans-serif !important;
    color: #111 !important;
  }

  .csx-sheet__close {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, .06);
    color: #111;
    font-size: 20px;
    padding: 0;
    cursor: pointer;
  }

  .csx-sheet__tiles {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    list-style: none;
    margin: 0 0 18px;
    padding: 0;
  }

  .csx-sheet__tiles li {
    margin: 0;
  }

  .csx-tile {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 60px;
    padding: 10px 12px;
    border-radius: 16px;
    background: rgba(255, 255, 255, .75);
    border: 1px solid rgba(0, 0, 0, .06);
    color: #1f2328 !important;
    font: 600 15px/1.2 Roboto, Arial, sans-serif;
    text-decoration: none !important;
  }

  .csx-tile.is-active {
    border-color: rgba(0, 119, 200, .45);
    background: rgba(0, 119, 200, .08);
    color: #0063a8 !important;
  }

  .csx-tile__ico {
    display: grid;
    place-items: center;
    flex: none;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: linear-gradient(135deg, #0077c8, #0a5594);
    color: #fff;
    font-size: 20px;
  }

  .csx-sheet__links {
    list-style: none;
    margin: 0;
    padding: 0;
    border-top: 1px solid rgba(0, 0, 0, .08);
  }

  .csx-sheet__links li {
    margin: 0;
    border-bottom: 1px solid rgba(0, 0, 0, .06);
  }

  .csx-sheet__links a {
    display: block;
    padding: 14px 4px;
    color: #1f2328 !important;
    font: 500 16px/1.2 Roboto, Arial, sans-serif;
    text-decoration: none !important;
  }

  .csx-sheet .csx-search input[type="search"] {
    height: 50px;
    font-size: 17px !important;
    border: 1px solid rgba(0, 0, 0, .1) !important;
    background: #fff !important;
  }

  .csx-sheet__hint {
    margin: 18px 0 10px !important;
    font-size: 14px !important;
    color: #4b5563 !important;
  }

  .csx-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .csx-chip {
    display: inline-block;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(0, 119, 200, .1);
    color: #0063a8 !important;
    font: 600 14px/1 Roboto, Arial, sans-serif;
    text-decoration: none !important;
  }

  body.csx-sheet-open {
    overflow: hidden;
  }
}

@keyframes csx-up {
  from { transform: translateY(40px); opacity: 0; }
  to { transform: none; opacity: 1; }
}

@keyframes csx-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (prefers-reduced-transparency: reduce) {
  .csx-tabbar__glass,
  .csx-sheet:not([hidden]) {
    background: #fff !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }
}
