/*
 * HEADER ÚNICO CIB · wp-content/cib-home/partials/cib-header.css
 * Todo bajo el prefijo .cib-hdr para no chocar con Kadence/WooCommerce/LearnDash.
 * Tokens: verde #3d8b2f / #007a3d · dorado #c8961a · navy #021126 · Poppins + Space Grotesk.
 */
.cib-hdr,
.cib-hdr *,
.cib-hdr *::before,
.cib-hdr *::after {
  box-sizing: border-box;
}

.cib-hdr {
  --cib-hdr-h: 84px;
  position: fixed;
  z-index: 100;
  top: 0;
  right: 0;
  left: 0;
  height: var(--cib-hdr-h);
  margin: 0;
  padding: 0;
  color: #fff;
  font-family: "Space Grotesk", system-ui, sans-serif;
  font-size: 16px;
  line-height: normal;
  letter-spacing: normal;
  text-align: left;
  -webkit-font-smoothing: antialiased;
  transform: translateY(0);
  transition: background 220ms ease, box-shadow 220ms ease, transform 240ms ease;
}

.cib-hdr :focus-visible {
  outline: 3px solid #e8b334;
  outline-offset: 4px;
}

.cib-hdr a,
.cib-hdr button {
  -webkit-tap-highlight-color: transparent;
}

.cib-hdr.is-scrolled {
  background: rgba(2, 17, 38, 0.9);
  box-shadow: 0 8px 32px rgba(0, 7, 19, 0.18);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

.cib-hdr.is-hidden {
  transform: translateY(-110%);
}

.cib-hdr__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(calc(100% - 64px), 1400px);
  height: 100%;
  margin-inline: auto;
  border-bottom: 1px solid rgba(255, 255, 255, 0.13);
}

.cib-hdr.is-scrolled .cib-hdr__inner {
  border-color: transparent;
}

.cib-hdr__brand {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  text-decoration: none;
}

.cib-hdr__brand img {
  display: block;
  width: 200px;
  height: 50px;
  max-width: 100%;
  object-fit: contain;
  object-position: left center;
}

.cib-hdr__nav {
  display: flex;
  align-items: center;
  gap: clamp(16px, 1.65vw, 30px);
  font-size: clamp(0.73rem, 0.78vw, 0.86rem);
  font-weight: 600;
}

/* .cib-hdr delante: gana a `.cib-home a { color: inherit }` de la home. */
.cib-hdr .cib-hdr__nav a {
  position: relative;
  color: rgba(255, 255, 255, 0.73);
  text-decoration: none;
  transition: color 180ms ease;
}

.cib-hdr__nav a:not(.cib-hdr__login)::after {
  position: absolute;
  right: 0;
  bottom: -8px;
  left: 0;
  height: 1px;
  content: "";
  background: #c8961a;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 220ms ease;
}

.cib-hdr .cib-hdr__nav a:hover {
  color: #fff;
}

/* Estado activo: mismo subrayado dorado que el hover */
.cib-hdr .cib-hdr__nav a.is-active {
  color: #fff;
}

.cib-hdr__nav a.is-active:not(.cib-hdr__login)::after {
  transform: scaleX(1);
  transform-origin: left;
}

.cib-hdr__nav a:not(.cib-hdr__login):hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* Entrar / Mi cuenta */
.cib-hdr__nav a.cib-hdr__login {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 16px;
  color: #fff !important;
  font-family: "Poppins", sans-serif;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 30px;
}

.cib-hdr__login svg {
  width: 17px;
  margin-left: 9px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
  transition: transform 180ms ease;
}

.cib-hdr__login:hover svg {
  transform: translateX(4px);
}

.cib-hdr__toggle {
  display: none;
}

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

html.cib-menu-open,
body.cib-menu-open {
  overflow: hidden;
}

/* Páginas internas (no home): en el flujo, sticky y con fondo navy sólido.
   La home usa body.cib-home-canvas y mantiene su header fijo y transparente sobre el hero. */
body:not(.cib-home-canvas) .cib-hdr {
  position: sticky;
  background: #021126;
}

body:not(.cib-home-canvas) .cib-hdr.is-scrolled {
  background: rgba(2, 17, 38, 0.97);
}

/* Barra de administración de WordPress */
.admin-bar .cib-hdr {
  top: 32px;
}

/* Altura del header (igual que --header-height de la home). */
@media (max-width: 1180px) {
  .cib-hdr {
    --cib-hdr-h: 76px;
  }
}

/* Menú hamburguesa */
@media (max-width: 1180px) {
  .cib-hdr.is-open {
    transform: none !important;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  .cib-hdr__toggle {
    z-index: 110;
    display: grid;
    width: 46px;
    height: 46px;
    padding: 0;
    color: #fff;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.17);
    border-radius: 50%;
    place-content: center;
    gap: 6px;
  }

  .cib-hdr__toggle span:not(.cib-hdr__sr) {
    display: block;
    width: 18px;
    height: 1px;
    background: currentColor;
    transition: transform 180ms ease;
  }

  .cib-hdr__toggle[aria-expanded="true"] span:nth-child(2) {
    transform: translateY(3.5px) rotate(45deg);
  }

  .cib-hdr__toggle[aria-expanded="true"] span:nth-child(3) {
    transform: translateY(-3.5px) rotate(-45deg);
  }

  .cib-hdr__nav {
    position: fixed;
    z-index: 105;
    top: var(--cib-hdr-h);
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 16px;
    max-height: calc(100dvh - var(--cib-hdr-h));
    padding: clamp(28px, 6vh, 56px) 10vw 40px;
    overflow-y: auto;
    visibility: hidden;
    opacity: 0;
    background: rgba(2, 17, 38, 0.99);
    transform: none;
    transition: visibility 220ms, opacity 220ms ease;
    overscroll-behavior: contain;
  }

  .cib-hdr__nav.is-open {
    visibility: visible;
    opacity: 1;
  }

  .cib-hdr__nav a {
    display: inline-flex;
    flex: 0 0 auto;
    font-family: "Poppins", sans-serif;
    font-size: clamp(1.15rem, 3.2vw, 1.8rem);
  }

  .cib-hdr__nav a.cib-hdr__login {
    min-height: 48px;
    margin-top: 4px;
    padding-inline: 20px;
    font-family: "Space Grotesk", sans-serif;
    font-size: 0.95rem;
  }

  .admin-bar .cib-hdr__nav {
    top: calc(var(--cib-hdr-h) + 32px);
    max-height: calc(100dvh - var(--cib-hdr-h) - 32px);
  }
}

@media (max-width: 980px) {
  .cib-hdr__inner {
    width: min(calc(100% - 40px), 1400px);
  }

  .cib-hdr__brand img {
    width: 174px;
    height: 44px;
  }
}

@media (max-width: 782px) {
  .admin-bar .cib-hdr {
    top: 46px;
  }

  .admin-bar .cib-hdr__nav {
    top: calc(var(--cib-hdr-h) + 46px);
    max-height: calc(100dvh - var(--cib-hdr-h) - 46px);
  }
}

@media (max-width: 720px) {
  .cib-hdr__inner {
    width: min(calc(100% - 32px), 1400px);
  }
}

@media (max-width: 600px) {
  /* La barra de admin deja de ser fija: el header vuelve al borde superior. */
  .admin-bar .cib-hdr {
    top: 0;
  }

  .admin-bar .cib-hdr__nav {
    top: var(--cib-hdr-h);
    max-height: calc(100dvh - var(--cib-hdr-h));
  }
}

/* Páginas HTML estáticas (fuera de WordPress): el header es hijo directo del body. */
body > .cib-hdr {
  flex: 1 1 100%;
  width: 100%;
}

/* Marcador mientras carga el header (reserva el alto, evita saltos) y respaldo sin JS. */
.cib-hdr-ph {
  display: flex;
  align-items: center;
  flex: 1 1 100%;
  width: 100%;
  height: 84px;
  padding: 0 32px;
  background: #021126;
  border-bottom: 1px solid rgba(255, 255, 255, 0.13);
}

.cib-hdr-ph a {
  color: #fff;
  font-family: "Poppins", sans-serif;
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
}

@media (max-width: 1180px) {
  .cib-hdr-ph {
    height: 76px;
  }
}
