/* Header structure and existing identity/actions. The shared service owns navigation. */
/* Keep Orbitta's horizontal clipping without making body the sticky scroll container. */
@supports (overflow: clip) {
  body.almc-core-header {
    overflow-x: clip;
    overflow-y: visible;
  }
}
.almc-header {
  --almc-color-primary: #2388CC;
  --almc-color-dark: #172140;
  --almc-color-muted: #64748B;
  --almc-color-border: #E5E9F0;
  --almc-header-height: 94px;
  --almc-header-height-sticky: 58px;
  --almc-header-current-height: var(--almc-header-height);
  --almc-header-offset: var(--wp-admin--admin-bar--height, 0px);
  position: sticky;
  top: var(--almc-header-offset);
  z-index: 9000;
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
.almc-header, .almc-header__bar, .almc-header__inner, .almc-header__nav-host, .almc-header__actions { box-sizing: border-box; }
.almc-header__bar { background: #fff; border-bottom: 1px solid var(--almc-color-border); }
.almc-header.is-condensed { --almc-header-current-height: var(--almc-header-height-sticky); }
.almc-header.is-condensed .almc-header__bar { box-shadow: 0 4px 14px rgb(23 33 64 / 8%); }
.almc-header__inner {
  max-width: 1280px; margin: 0 auto; padding: 0 24px;
  display: flex; align-items: center; gap: 24px;
  min-height: var(--almc-header-current-height);
}
.almc-header__logo-link { display: flex; align-items: center; flex-shrink: 0; }
.almc-header .almc-header__logo { display: block; width: auto; max-width: 180px; height: 56px; object-fit: contain; }
.almc-header.is-condensed .almc-header__logo { height: 30px; }
.almc-header__nav-host { flex: 1 1 auto; min-width: 0; }
.almc-header__nav-host[hidden], .almc-header__burger[hidden] { display: none !important; }
/* Links and submenus are styled by navigation.css, not by Header-specific copies. */
.almc-header__actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.almc-header__action-label { display: none; }

.almc-header__icon-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  color: var(--almc-color-dark);
  text-decoration: none;
}

.almc-header__icon-link svg {
  width: 24px;
  height: 24px;
}

.almc-header .almc-header__search .dgwt-wcas-ico-magnifier-handler {
  width: 24px;
  max-width: 24px;
}

.almc-header .almc-header__actions .almc-header__search .dgwt-wcas-search-wrapp {
  width: 24px;
  max-width: 24px;
}

.almc-header__icon-link:hover {
  background: #F4F8FC;
  color: var(--almc-color-primary);
}

.almc-header .almc-header__cart-count {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #0876B0;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}

.almc-header__cart-count:empty,
.almc-header__cart-count[data-count="0"] {
  display: none;
}

/* Botón hamburguesa — solo visible en móvil (ver media query). */
.almc-header__burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
}

.almc-header__burger:hover {
  background: #F4F8FC;
}

.almc-header__burger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--almc-color-dark);
  border-radius: 2px;
  transition: transform 150ms ease, opacity 150ms ease;
}

.almc-header__burger[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.almc-header__burger[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

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

/* Foco visible en todo el header — nunca se neutraliza el outline. */
.almc-header a:focus-visible,
.almc-header button:focus-visible {
  outline: 2px solid var(--almc-color-primary);
  outline-offset: 2px;
}


@media (min-width: 1024px) {
  .almc-header {
    --almc-header-height: 124px; --almc-header-height-sticky: 80px;
    --almc-header-gutter: clamp(24px, 2vw, 40px);
    --almc-header-logo-width: clamp(180px, 15vw, 220px);
    --almc-header-column-gap: 36px;
    --almc-header-search-max: 720px;
  }
  /* First row: 79px interior + the bar's single 1px border = 80px sticky.
     The normal secondary row adds its own 44px; neither row animates geometry. */
  .almc-header__inner {
    width: calc(100% - var(--almc-header-gutter) - var(--almc-header-gutter));
    max-width: 1800px; padding-inline: 0;
    display: grid; grid-template-columns: var(--almc-header-logo-width) minmax(0, 1fr);
    column-gap: var(--almc-header-column-gap); row-gap: 0; min-height: 0;
  }
  /* Both rows share the existing bar; color never changes their geometry. */
  .almc-header__bar {
    background: linear-gradient(to bottom, #fff 0 calc(var(--almc-header-height-sticky) - 1px), #1D3043 calc(var(--almc-header-height-sticky) - 1px) 100%);
  }
  .almc-header.is-condensed .almc-header__bar { background: #fff; }
  .almc-header__logo-link { grid-column: 1; grid-row: 1; }
  .almc-header .almc-header__logo,
  .almc-header.is-condensed .almc-header__logo { width: 100%; max-width: 220px; height: 56px; }
  .almc-header__actions {
    grid-column: 2; grid-row: 1; min-width: 0; gap: 16px;
    min-height: calc(var(--almc-header-height-sticky) - 1px);
  }
  .almc-header__search {
    flex: 1 1 auto; min-width: 230px; max-width: var(--almc-header-search-max);
    /* Percentages resolve against actions: (actions - search - logo - gap) / 2
       centers the capped field on the whole Header, not the remaining column. */
    margin-inline-start: max(0px, calc((100% - var(--almc-header-search-max) - var(--almc-header-logo-width) - var(--almc-header-column-gap)) / 2));
    margin-inline-end: auto;
  }
  .almc-header .almc-header__actions .almc-header__search .dgwt-wcas-search-wrapp {
    width: 100%; max-width: none; min-width: 230px;
  }
  .almc-header .almc-header__search input.dgwt-wcas-search-input { height: 48px; }
  .almc-header__icon-link {
    box-sizing: border-box; flex: 0 0 auto; width: auto; min-width: 44px;
    height: 48px; padding: 0 8px; gap: 8px; white-space: nowrap;
  }
  .almc-header__icon-link svg { flex: 0 0 auto; }
  .almc-header__action-label { display: inline; font-size: 15px; }
  .almc-header__cart { gap: 16px; }
  /* Match the base selector's specificity: left + right must not stretch the badge. */
  .almc-header .almc-header__cart-count {
    box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center;
    width: 22px; min-width: 22px; height: 22px; padding: 0;
    left: 24px; right: auto; top: 0; border-radius: 50%;
    font-size: 11px; line-height: 1; font-variant-numeric: tabular-nums;
  }
  .almc-header .almc-header__cart-count:empty,
  .almc-header .almc-header__cart-count[data-count="0"] { display: none; }
  .almc-header__nav-host {
    grid-column: 1 / -1; grid-row: 2; align-self: stretch;
    display: flex; min-height: 44px;
  }
  .almc-header__nav-host > .almc-navigation { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; }
  .almc-header__nav-host > .almc-navigation > .almc-megamenu-panel {
    top: calc(100% + 1px);
    max-height: min(80vh, calc(100dvh - var(--almc-header-offset) - var(--almc-header-height) - 16px));
  }
  .almc-header .almc-navigation__list > li { display: flex; align-items: center; }
  .almc-header .almc-navigation__list > li > a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 500; }
  /* First-level controls only: preserve the editorial panel's colors and typography. */
  .almc-header .almc-navigation__list > li > a,
  .almc-header .almc-navigation__list > li > .almc-navigation__toggle { color: #fff; font-size: 16px; }
  .almc-header .almc-navigation__list > li > a:hover { text-decoration: underline; text-underline-offset: .2em; }
  .almc-header .almc-navigation__list > li > a:focus-visible,
  .almc-header .almc-navigation__list > li > button:focus-visible { outline-color: #fff; }
  .almc-header .almc-navigation__toggle { box-sizing: border-box; min-width: 44px; min-height: 44px; }
  /* Decorate the existing source disclosure. No extra button or local item ID. */
  .almc-header .almc-navigation__toggle[aria-controls^="almc-nav-panel-"] { order: -1; border-radius: 6px; }
  .almc-header .almc-navigation__list > li > .almc-navigation__toggle[aria-controls^="almc-nav-panel-"]:hover,
  .almc-header .almc-navigation__list > li > .almc-navigation__toggle[aria-expanded="true"] { background: rgb(255 255 255 / 12%); }
  .almc-header .almc-navigation__toggle[aria-controls^="almc-nav-panel-"] > span { font-size: 0; }
  .almc-header .almc-navigation__toggle[aria-controls^="almc-nav-panel-"] > span::before {
    content: ''; display: inline-block; width: 20px; height: 24px; vertical-align: middle;
    background: linear-gradient(currentColor, currentColor) center 5px / 20px 2px no-repeat,
      linear-gradient(currentColor, currentColor) center 11px / 20px 2px no-repeat,
      linear-gradient(currentColor, currentColor) center 17px / 20px 2px no-repeat;
  }
  /* display:none removes the entire row from layout, Tab and accessibility.
     header.js closes its panel and rescues focus before applying this state. */
  .almc-header.is-condensed .almc-header__nav-host { display: none; }
}

@media (max-width: 1023px) {
  .almc-header { --almc-header-height: 72px; }
  .almc-header__inner { flex-wrap: wrap; gap: 8px; padding: 0 12px; }
  .almc-header__actions { margin-left: auto; gap: 6px; }
  .almc-header .almc-header__logo { max-width: 110px; height: 38px; }
  .almc-header__nav-host { flex-basis: 100%; order: 3; }
  /* Without JS the single navigation stays visible in normal flow. */
  .almc-header__nav-host[data-almc-host-ready="true"] {
    position: fixed; top: calc(var(--almc-header-offset) + var(--almc-header-current-height));
    left: 0; right: 0; max-height: calc(100vh - var(--almc-header-offset) - var(--almc-header-current-height));
    max-height: calc(100dvh - var(--almc-header-offset) - var(--almc-header-current-height));
    overflow: auto; overscroll-behavior: contain; padding: 20px; background: #fff;
    border-bottom: 1px solid var(--almc-color-border); box-shadow: 0 8px 20px rgb(0 0 0 / 8%);
  }
  .almc-header__burger:not([hidden]) { display: flex; }
}
