
.ib-header-space {
  height: 96px;
}

.ib-header {
  --ib-pink: #F2AEC7;
  --ib-pink-hover: #EA98B7;
  --ib-pale: #FFF5F8;
  --ib-border: #EED6DF;
  --ib-text: #333333;

  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 1000;
  background: #FFFFFF;
  color: var(--ib-text);
  border-bottom: 1px solid var(--ib-border);
  font-family: "Poppins", Arial, sans-serif;
  transform: translateY(0);
  transition: transform 280ms ease, box-shadow 280ms ease;
}

.ib-header,
.ib-header * {
  box-sizing: border-box;
}

.ib-header.is-hidden {
  transform: translateY(-100%);
}

.ib-header.is-scrolled {
  box-shadow: 0 5px 20px rgb(90 65 75 / 7%);
}

.ib-header-inner {
  width: 84%;
  max-width: 1600px;
  min-height: 96px;
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
}

.ib-header a {
  color: inherit;
  text-decoration: none;
}

.ib-header-brand {
  flex-shrink: 0;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.6px;
}

.ib-header-brand span {
  display: block;
  margin-top: 5px;
  color: #626262;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.ib-header-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ib-header-nav a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 13px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  transition: background-color 180ms ease;
}

.ib-header-nav a:hover,
.ib-header-nav a[aria-current="page"] {
  background: var(--ib-pale);
}

.ib-header .ib-header-cta {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 14px 22px;
  border-radius: 12px;
  background: var(--ib-pink);
  color: var(--ib-text);
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  transition: background-color 180ms ease;
}

.ib-header .ib-header-cta:hover {
  background: var(--ib-pink-hover);
}

.ib-header-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  min-width: 70px;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--ib-border);
  border-radius: 10px;
  background: var(--ib-pale);
  color: var(--ib-text);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.ib-header a:focus-visible,
.ib-header button:focus-visible {
  outline: 2px solid var(--ib-text);
  outline-offset: 4px;
}

@media (max-width: 1200px) {
  .ib-header-inner {
    width: 92%;
    gap: 16px;
  }

  .ib-header-brand {
    font-size: 21px;
  }

  .ib-header-nav {
    gap: 2px;
  }

  .ib-header-nav a {
    padding-inline: 9px;
    font-size: 13px;
  }
}

/* El contacto dentro del menú solo aparece en móvil. */
.ib-header .ib-header-mobile-contact {
  display: none;
}

@media (max-width: 1000px) {
  .ib-header-space {
    height: 80px;
  }

  .ib-header-inner {
    width: calc(100% - 32px);
    min-height: 80px;
    gap: 14px;
    flex-wrap: wrap;
  }

  .ib-header.is-ready .ib-header-inner {
    flex-wrap: nowrap;
  }

  .ib-header-brand {
    min-width: 0;
    margin-right: auto;
    font-size: clamp(18px, 4.5vw, 22px);
    letter-spacing: -.5px;
  }

  .ib-header-brand span {
    margin-top: 5px;
    font-size: 8px;
    line-height: 1.5;
    letter-spacing: 1px;
  }

  /* El CTA exterior se traslada al menú móvil. */
  .ib-header-inner > .ib-header-cta {
    display: none;
  }

  /* Botón circular de hamburguesa. */
  .ib-header .ib-header-toggle {
    position: relative;
    display: inline-flex;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--ib-pink);
    color: var(--ib-text);
    transition: background-color 180ms ease;
  }

  .ib-header-toggle:hover {
    background: var(--ib-pink-hover);
  }

  .ib-header-burger {
    position: relative;
    display: block;
    width: 20px;
    height: 16px;
  }

  .ib-header-burger span {
    position: absolute;
    left: 0;
    display: block;
    width: 20px;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
    transition:
      top 240ms ease,
      transform 240ms ease,
      opacity 160ms ease;
  }

  .ib-header-burger span:nth-child(1) {
    top: 0;
  }

  .ib-header-burger span:nth-child(2) {
    top: 7px;
  }

  .ib-header-burger span:nth-child(3) {
    top: 14px;
  }

  /* La hamburguesa se convierte en una cruz. */
  .ib-header.is-open .ib-header-burger span:nth-child(1) {
    top: 7px;
    transform: rotate(45deg);
  }

  .ib-header.is-open .ib-header-burger span:nth-child(2) {
    opacity: 0;
  }

  .ib-header.is-open .ib-header-burger span:nth-child(3) {
    top: 7px;
    transform: rotate(-45deg);
  }

  /* Navegación disponible también si JavaScript no carga. */
  .ib-header-nav {
    order: 3;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 5px;
    padding-bottom: 16px;
  }

  /* Panel desplegable, separado de la fila superior. */
  .ib-header.is-ready .ib-header-nav {
    position: absolute;
    top: calc(100% + 8px);
    right: 16px;
    left: 16px;
    display: flex;
    width: auto;
    max-height: calc(100vh - 112px);
    max-height: calc(100dvh - 112px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 16px;
    border: 1px solid var(--ib-border);
    border-radius: 18px;
    background: #FFFFFF;
    box-shadow: 0 16px 35px rgb(90 65 75 / 10%);

    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-10px);
    transition:
      opacity 220ms ease,
      transform 280ms ease,
      visibility 0s linear 280ms;
  }

  .ib-header.is-ready.is-open .ib-header-nav {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
    transition-delay: 0s;
  }

  .ib-header-nav > a,
  .ib-header-dropdown > summary {
    min-height: 52px;
    padding: 14px 16px;
    font-size: 16px;
    font-weight: 500;
  }

  /* Entrada escalonada de los elementos principales. */
  .ib-header.is-ready .ib-header-nav > * {
    opacity: 0;
    transform: translateY(-8px);
    transition:
      opacity 220ms ease,
      transform 280ms ease,
      background-color 180ms ease;
    transition-delay: 0s;
  }

  .ib-header.is-ready.is-open .ib-header-nav > * {
    opacity: 1;
    transform: translateY(0);
    transition-delay: var(--ib-menu-delay, 0ms);
  }

  .ib-header-nav > :nth-child(1) {
    --ib-menu-delay: 30ms;
  }

  .ib-header-nav > :nth-child(2) {
    --ib-menu-delay: 65ms;
  }

  .ib-header-nav > :nth-child(3) {
    --ib-menu-delay: 100ms;
  }

  .ib-header-nav > :nth-child(4) {
    --ib-menu-delay: 135ms;
  }

  .ib-header-nav > :nth-child(5) {
    --ib-menu-delay: 170ms;
  }

  .ib-header-nav > :nth-child(6) {
    --ib-menu-delay: 205ms;
  }

  .ib-header-nav > :nth-child(7) {
    --ib-menu-delay: 240ms;
  }

  .ib-header .ib-header-mobile-contact {
    display: flex;
    justify-content: center;
    width: 100%;
    max-width: none;
    margin-top: 12px;
    border-radius: 12px;
    background: var(--ib-pink);
  }

  .ib-header .ib-header-mobile-contact:hover {
    background: var(--ib-pink-hover);
  }

  /* Entrada suave del submenú de categorías. */
  .ib-header-dropdown[open] > .ib-header-dropdown-panel {
    animation: ib-header-submenu-in 240ms ease both;
  }
}

@keyframes ib-header-submenu-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ib-header *,
  .ib-header *::before,
  .ib-header *::after {
    transition: none !important;
    animation: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ib-header,
  .ib-header a {
    transition: none;
  }
}
.ib-header-dropdown {
  position: relative;
}

.ib-header-dropdown summary {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 13px;
  border-radius: 8px;
  color: var(--ib-text);
  font-size: 14px;
  font-weight: 500;
  list-style: none;
  cursor: pointer;
  transition: background-color 180ms ease;
}

.ib-header-dropdown summary::-webkit-details-marker {
  display: none;
}

.ib-header-dropdown summary:hover,
.ib-header-dropdown[open] > summary {
  background: var(--ib-pale);
}

.ib-header-dropdown summary:focus-visible {
  outline: 2px solid var(--ib-text);
  outline-offset: 4px;
}

.ib-header-chevron {
  width: 7px;
  height: 7px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  transition: transform 180ms ease;
}

.ib-header-dropdown[open] .ib-header-chevron {
  transform: rotate(225deg);
}

.ib-header-dropdown-panel {
  position: absolute;
  top: calc(100% + 14px);
  left: 50%;
  transform: translateX(-50%);
  width: min(660px, 90vw);
  max-height: calc(100dvh - 150px);
  overflow-y: auto;
  padding: 20px;
  border: 1px solid var(--ib-border);
  border-radius: 18px;
  background: #FFFFFF;
  box-shadow: 0 15px 40px rgb(90 65 75 / 10%);
}

.ib-header-categories {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ib-header-categories li {
  min-width: 0;
  margin: 0;
  padding: 0;
}

.ib-header .ib-header-categories a {
  height: 100%;
  min-height: 46px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.5;
}

.ib-header .ib-header-all-courses {
  display: flex;
  width: 100%;
  max-width: none;
  margin-top: 16px;
}

@media (max-width: 1200px) {
  .ib-header-dropdown summary {
    padding-inline: 9px;
    font-size: 13px;
  }
}

@media (max-width: 1000px) {
  .ib-header-dropdown {
    width: 100%;
  }

  .ib-header-dropdown summary {
    justify-content: space-between;
    min-height: 48px;
    padding: 12px 16px;
    font-size: 16px;
  }

  .ib-header-dropdown-panel {
    position: static;
    width: 100%;
    max-height: none;
    margin-top: 8px;
    padding: 12px;
    transform: none;
    box-shadow: none;
  }
}

@media (max-width: 600px) {
  .ib-header-categories {
    grid-template-columns: 1fr;
  }

  .ib-header .ib-header-categories a {
    font-size: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ib-header-dropdown summary,
  .ib-header-chevron {
    transition: none;
  }
}
