/*
 * CBD Astra Child: header.css  (header redesign, pass 2, 2026-12-05; approved by Markus; guided by the impeccable skill)
 * Layout comes from Astra's Header Builder (Customizer, editable): desktop = logo left / menu centre / search, language, account, cart right;
 * mobile = logo left / cart + hamburger right (search + account inside the off-canvas drawer).
 * This file only STYLES it. Direction: airy, text-only navigation (no boxes, no green), hairline + soft shadow, white panels.
 * Tokens: ink #1E293B, black, slate #475569, white, hairline rgba(15,23,42,.08), neutral tint rgba(15,23,42,.05). Brand teal #006C68 only as a tiny accent
 * (current-page underline, cart badge).
 * Pass 1 version (lime pill) is in git commit ca1919f. Revert everything: remove the enqueue of this file in functions.php (or empty it) and
 * restore astra-settings from the backup folder named in docs/change-log.md.
 * Blocks are labelled so each can be removed on its own.
 */

/* ---------------------------------------------------------------------------
 * H1. Sticky, flat header: CSS sticky (no JavaScript, no layout shift), hairline always, soft shadow fades in over the first 120px of scroll.
 * ------------------------------------------------------------------------- */
#masthead { position: sticky; top: 0; z-index: 999; background: #fff; box-shadow: 0 1px 0 rgba(15, 23, 42, 0.08); }
@supports (animation-timeline: scroll()) {
  @keyframes cbd-header-shadow { from { box-shadow: 0 1px 0 rgba(15, 23, 42, 0.08); } to { box-shadow: 0 10px 30px rgba(15, 23, 42, 0.09), 0 1px 0 rgba(15, 23, 42, 0.08); } }
  #masthead { animation: cbd-header-shadow linear both; animation-timeline: scroll(root); animation-range: 0 120px; }
}

/* ---------------------------------------------------------------------------
 * D. DESKTOP and TABLET LANDSCAPE (Astra switches to the mobile header at 921px)
 *    Heights: 80px (1181px and up), 72px (922-1180px). Mirrored in assets/critical.css (first-paint reservation).
 * ------------------------------------------------------------------------- */
@media (min-width: 922px) {

  /* H2. One airy row; equal side columns so the menu is truly centred on the page. */
  .ast-primary-header-bar, .ast-primary-header-bar .site-primary-header-wrap, .ast-primary-header-bar .ast-builder-grid-row { min-height: 80px; }
  .ast-primary-header-bar .site-primary-header-wrap { padding-top: 0; padding-bottom: 0; }
  #ast-desktop-header .ast-builder-grid-row { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) !important; align-items: center; }
  .site-header-primary-section-left { justify-content: flex-start; }
  .site-header-primary-section-center { flex: 0 0 auto; }
  .site-header-primary-section-right { gap: 4px; align-items: center; justify-content: flex-end; }

  /* H3. Navigation: clean text, no pill, no box. Small, medium-weight, wide-tracked labels; a 1px underline draws in from the left on hover/focus;
   *     the current section keeps a 2px teal underline (the only accent). */
  html body #mega-menu-wrap-primary { background: transparent !important; border-radius: 0 !important; padding: 0 !important; box-shadow: none !important; border: 0 !important; }
  html body #mega-menu-wrap-primary #mega-menu-primary { display: flex; align-items: center; gap: 0; flex-wrap: nowrap; white-space: nowrap; padding: 0 !important; background: transparent !important; }
  html body #mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item > a.mega-menu-link {
    --cbd-pad: 18px;
    height: 48px !important; line-height: 48px !important; padding: 0 var(--cbd-pad) !important; margin: 0 !important; border-radius: 0 !important; box-shadow: none !important;
    font-size: 12.5px !important; font-weight: 600 !important; letter-spacing: 0.1em !important; text-decoration: none !important; color: #1E293B !important;
    /* underline = one background layer; shorthand so repeat/position/size are always reset by every state */
    background: linear-gradient(currentColor, currentColor) no-repeat var(--cbd-pad) calc(100% - 6px) / 0 1px !important;
    transition: background-size 0.28s cubic-bezier(0.16, 1, 0.3, 1), color 0.2s ease-out;
  }
  html body #mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item > a.mega-menu-link:hover,
  html body #mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item:focus-within > a.mega-menu-link,
  html body #mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item.mega-toggle-on > a.mega-menu-link {
    color: #000 !important; background: linear-gradient(currentColor, currentColor) no-repeat var(--cbd-pad) calc(100% - 6px) / calc(100% - 2 * var(--cbd-pad)) 1px !important;
  }
  html body #mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item.mega-current-menu-item > a.mega-menu-link,
  html body #mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item.mega-current-menu-ancestor > a.mega-menu-link,
  html body #mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item.mega-current_page_parent > a.mega-menu-link {
    color: #000 !important; background: linear-gradient(#006C68, #006C68) no-repeat var(--cbd-pad) calc(100% - 6px) / calc(100% - 2 * var(--cbd-pad)) 2px !important;
  }
  html body #mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item > a.mega-menu-link:focus-visible { outline: 2px solid #1E293B; outline-offset: -4px; border-radius: 6px !important; }

  /* H4. Search, account, cart: 44px targets, ink icons, neutral hover disc, small teal cart badge. */
  #ast-desktop-header .ast-search-icon,
  #ast-desktop-header .ast-header-account-link,
  #ast-desktop-header .ast-site-header-cart a.cart-container {
    display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 50%; color: #1E293B;
    transition: background-color 0.18s ease-out;
  }
  #ast-desktop-header .ast-search-icon:hover,
  #ast-desktop-header .ast-header-account-link:hover,
  #ast-desktop-header .ast-site-header-cart a.cart-container:hover { background: rgba(15, 23, 42, 0.06); }
  #ast-desktop-header .ast-search-icon:focus-visible,
  #ast-desktop-header .ast-header-account-link:focus-visible,
  #ast-desktop-header .ast-site-header-cart a.cart-container:focus-visible,
  #ast-desktop-header .ast-header-account-wrap:focus-visible { outline: 2px solid #1E293B; outline-offset: 2px; }
  #ast-desktop-header [data-cart-total]::after { background: #006C68 !important; color: #fff !important; }

  /* H5. Language select (GTranslate widget): quiet hairline pill. The widget ships two empty <p> with 28px margins that stretched the row. */
  #ast-desktop-header .header-widget-area, #ast-desktop-header .header-widget-area .widget { margin: 0 !important; padding-top: 0; padding-bottom: 0; }
  #ast-desktop-header .header-widget-area .widget p { margin: 0 !important; }
  #ast-desktop-header .gtranslate_wrapper { min-width: 120px; }
  #ast-desktop-header .gtranslate_wrapper select.gt_selector {
    width: 100% !important; height: 38px !important; padding: 0 28px 0 14px !important; border: 1px solid rgba(15, 23, 42, 0.14) !important;
    border-radius: 999px !important; background-color: #fff !important; color: #1E293B !important; font-size: 13px !important; letter-spacing: 0.02em;
  }

  /* H6. DROPDOWN (Kategorier mega panel: 12 groups, 41 links in 6 columns). White card, hairline, soft layered shadow, 14px corners,
   *     opens under the header (not under the link) with an opacity + 8px rise; hover, keyboard focus-within and MMM's own .mega-toggle-on all open it. */
  html body #mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-megamenu > ul.mega-sub-menu {
    position: absolute !important; top: calc(100% + 24px) !important; left: 50% !important; right: auto !important; box-sizing: border-box;
    width: min(1040px, calc(100vw - 48px)) !important; max-width: none !important; padding: 30px 34px 32px !important;
    background: #fff !important; border: 1px solid rgba(15, 23, 42, 0.08) !important; border-radius: 14px !important;
    box-shadow: 0 28px 64px rgba(15, 23, 42, 0.14), 0 4px 14px rgba(15, 23, 42, 0.06) !important;
    display: flex !important; flex-wrap: wrap; align-items: flex-start; opacity: 0; visibility: hidden; pointer-events: none; transform: translate(-50%, 8px);
    transition: opacity 0.18s ease-out, transform 0.24s cubic-bezier(0.16, 1, 0.3, 1), visibility 0s linear 0.24s;
  }
  html body #mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-megamenu:hover > ul.mega-sub-menu,
  html body #mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-megamenu:focus-within > ul.mega-sub-menu,
  html body #mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-megamenu.mega-toggle-on > ul.mega-sub-menu {
    opacity: 1; visibility: visible; pointer-events: auto; transform: translate(-50%, 0); transition-delay: 0s;
  }
  /* invisible bridge so the pointer can travel from the link to the panel without closing it */
  html body #mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-megamenu > ul.mega-sub-menu::before { content: ""; position: absolute; left: 0; right: 0; top: -26px; height: 26px; }
  /* group headings (the 12 top-level categories): small, tracked, muted caps */
  html body #mega-menu-wrap-primary ul.mega-sub-menu > li.mega-menu-item > a.mega-menu-link {
    padding: 0 0 10px !important; margin: 0 !important; background: transparent !important; box-shadow: none !important;
    font-size: 11.5px !important; font-weight: 700 !important; letter-spacing: 0.12em !important; text-transform: uppercase !important; color: #475569 !important; line-height: 1.3 !important;
  }
  html body #mega-menu-wrap-primary ul.mega-sub-menu > li.mega-menu-item > a.mega-menu-link:hover { color: #000 !important; background: transparent !important; }
  html body #mega-menu-wrap-primary ul.mega-sub-menu > li.mega-menu-item { padding-bottom: 22px; }
  /* the links inside each group: neutral grey hover tint, generous rows */
  html body #mega-menu-wrap-primary ul.mega-sub-menu ul.mega-sub-menu { background: transparent !important; box-shadow: none !important; border: 0 !important; padding: 0 !important; }
  html body #mega-menu-wrap-primary ul.mega-sub-menu ul.mega-sub-menu > li.mega-menu-item > a.mega-menu-link {
    display: block; padding: 7px 10px !important; margin: 0 -10px !important; border-radius: 8px !important; background: transparent !important;
    font-size: 14.5px !important; font-weight: 500 !important; letter-spacing: 0 !important; text-transform: none !important; color: #1E293B !important; line-height: 1.35 !important;
    transition: background-color 0.15s ease-out;
  }
  html body #mega-menu-wrap-primary ul.mega-sub-menu ul.mega-sub-menu > li.mega-menu-item > a.mega-menu-link:hover,
  html body #mega-menu-wrap-primary ul.mega-sub-menu ul.mega-sub-menu > li.mega-menu-item > a.mega-menu-link:focus-visible { background: rgba(15, 23, 42, 0.05) !important; color: #000 !important; }
  html body #mega-menu-wrap-primary ul.mega-sub-menu a.mega-menu-link:focus-visible { outline: 2px solid #1E293B; outline-offset: 1px; }
}

/* ---------------------------------------------------------------------------
 * Tablet landscape / small desktop (922-1180px): 72px row, tighter nav, 4-column panel.
 * ------------------------------------------------------------------------- */
@media (min-width: 922px) and (max-width: 1180px) {
  .ast-primary-header-bar, .ast-primary-header-bar .site-primary-header-wrap, .ast-primary-header-bar .ast-builder-grid-row { min-height: 72px; }
  html body #mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item > a.mega-menu-link { --cbd-pad: 12px; font-size: 12px !important; letter-spacing: 0.08em !important; }
  #ast-desktop-header .gtranslate_wrapper { min-width: 0; width: 104px; }
  #ast-desktop-header .gtranslate_wrapper select.gt_selector { padding: 0 22px 0 10px !important; font-size: 12.5px !important; }
  #ast-desktop-header .site-logo-img img { max-width: 168px; height: auto; }
  .site-header-primary-section-right { gap: 2px; }
  html body #mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-megamenu > ul.mega-sub-menu { padding: 24px 26px 26px !important; }
  html body #mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-megamenu > ul.mega-sub-menu > li.mega-menu-item { width: 25% !important; }
}
@media (min-width: 922px) and (max-width: 1040px) {
  html body #mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item > a.mega-menu-link { --cbd-pad: 9px; font-size: 11.5px !important; letter-spacing: 0.06em !important; }
  #ast-desktop-header .site-logo-img img { max-width: 140px; }
  #ast-desktop-header .gtranslate_wrapper { width: 82px; }
  #ast-desktop-header .gtranslate_wrapper select.gt_selector { padding: 0 18px 0 8px !important; font-size: 12px !important; }
  #ast-desktop-header .ast-search-icon, #ast-desktop-header .ast-header-account-link, #ast-desktop-header .ast-site-header-cart a.cart-container { width: 40px; height: 40px; }
  .site-header-primary-section-right { gap: 0; }
}

/* Reduced motion: no slide, no underline animation; the panel and underline still appear. */
@media (prefers-reduced-motion: reduce) {
  html body #mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item > a.mega-menu-link { transition: none; }
  html body #mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-megamenu > ul.mega-sub-menu { transition: none; transform: translate(-50%, 0); }
  @supports (animation-timeline: scroll()) { #masthead { animation: none; } }
}

/* ---------------------------------------------------------------------------
 * M. MOBILE and TABLET PORTRAIT (Astra mobile header, up to 921px)
 *    Bar: logo left, cart + hamburger right (search and account live inside the drawer). 64px.
 *    The hamburger opens an off-canvas drawer (Astra "off-canvas" type); the old "dropdown" type swallowed the first tap.
 * ------------------------------------------------------------------------- */
@media (max-width: 921px) {

  /* M1. 64px bar, 44px touch targets, ink icons, small teal cart badge, visible keyboard focus. */
  .ast-below-header-bar { min-height: 64px; }
  .ast-below-header-bar .ast-builder-grid-row { min-height: 64px; align-items: center; }
  #ast-mobile-header .site-header-below-section-right { gap: 2px; align-items: center; }
  #ast-mobile-header .ast-site-header-cart a.cart-container,
  #ast-mobile-header .ast-button-wrap .menu-toggle {
    display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 50%; color: #1E293B;
  }
  #ast-mobile-header .ast-site-header-cart a.cart-container:active,
  #ast-mobile-header .ast-button-wrap .menu-toggle:active { background: rgba(15, 23, 42, 0.06); }
  #ast-mobile-header .ast-site-header-cart a.cart-container:focus-visible,
  #ast-mobile-header .ast-button-wrap .menu-toggle:focus-visible { outline: 2px solid #1E293B; outline-offset: 2px; }
  #ast-mobile-header [data-cart-total]::after { background: #006C68 !important; color: #fff !important; }

  /* M2. Drawer: white panel, dimmed backdrop, big close button. */
  #ast-mobile-popup .ast-mobile-popup-overlay { background: rgba(15, 23, 42, 0.45); }
  #ast-mobile-popup .ast-mobile-popup-inner { background: #fff; }
  #ast-mobile-popup .ast-mobile-popup-header { min-height: 64px; padding: 0 8px; align-items: center; }
  #ast-mobile-popup .menu-toggle-close { width: 48px; height: 48px; border-radius: 50%; color: #1E293B; }
  #ast-mobile-popup .menu-toggle-close:focus-visible { outline: 2px solid #1E293B; outline-offset: 2px; }
  #ast-mobile-popup .ast-mobile-popup-content { padding: 4px 20px 32px; }

  /* M3. Search: 48px pill, 16px text (stops iOS zoom-on-focus). */
  #ast-mobile-popup .ast-search-menu-icon .search-form { border: 1px solid rgba(15, 23, 42, 0.16); border-radius: 999px; overflow: hidden; }
  #ast-mobile-popup .ast-search-menu-icon .search-field { height: 46px; font-size: 16px; color: #1E293B; padding-left: 18px; }
  #ast-mobile-popup .ast-search-menu-icon .search-submit { height: 46px; color: #1E293B; }

  /* M4. Menu rows: left aligned, 56px, 17px semibold, hairlines, no colour boxes; current page = heavier weight only.
   *     Submenu: neutral tinted block, 48px rows (above the 44px minimum), indented, chevron toggle on the right that rotates when open. */
  #ast-mobile-popup #ast-hf-mobile-menu { background: transparent; margin-top: 8px; }
  #ast-mobile-popup #ast-hf-mobile-menu .menu-item, #ast-mobile-popup #ast-hf-mobile-menu .menu-item > .menu-link { box-shadow: none !important; background: transparent; }
  #ast-mobile-popup #ast-hf-mobile-menu .menu-item > .menu-link {
    display: flex; align-items: center; justify-content: flex-start; text-align: left; min-height: 56px; padding: 0 56px 0 4px;
    font-size: 17px; font-weight: 600; letter-spacing: 0.02em; color: #1E293B; border-radius: 0;
  }
  #ast-mobile-popup #ast-hf-mobile-menu > .menu-item { border-bottom: 1px solid rgba(15, 23, 42, 0.08); position: relative; }
  #ast-mobile-popup #ast-hf-mobile-menu > .menu-item:last-child { border-bottom: 0; }
  #ast-mobile-popup #ast-hf-mobile-menu .menu-item.current-menu-item > .menu-link,
  #ast-mobile-popup #ast-hf-mobile-menu .menu-item.current-menu-ancestor > .menu-link,
  #ast-mobile-popup #ast-hf-mobile-menu .menu-item.current_page_parent > .menu-link { font-weight: 800; color: #000; }
  #ast-mobile-popup #ast-hf-mobile-menu .menu-item > .menu-link:active { background: rgba(15, 23, 42, 0.05); }
  #ast-mobile-popup #ast-hf-mobile-menu .menu-item > .menu-link:focus-visible { outline: 2px solid #1E293B; outline-offset: -2px; border-radius: 6px; }
  #ast-mobile-popup #ast-hf-mobile-menu .menu-item-has-children > .ast-menu-toggle { left: auto; right: 0; width: 56px; height: 56px; top: 0; color: #1E293B; background: transparent; border-radius: 50%; }
  #ast-mobile-popup #ast-hf-mobile-menu .menu-item-has-children > .ast-menu-toggle:active { background: rgba(15, 23, 42, 0.06); }
  #ast-mobile-popup #ast-hf-mobile-menu .menu-item-has-children > .ast-menu-toggle .ast-icon, #ast-mobile-popup #ast-hf-mobile-menu .menu-item-has-children > .ast-menu-toggle svg { transition: transform 0.2s ease-out; }
  #ast-mobile-popup #ast-hf-mobile-menu .sub-menu { background: rgba(15, 23, 42, 0.03); border-radius: 12px; margin: 0 0 8px; padding: 4px 0; border: 0; }
  #ast-mobile-popup #ast-hf-mobile-menu .sub-menu .menu-item { border: 0; }
  #ast-mobile-popup #ast-hf-mobile-menu .sub-menu .menu-link { font-size: 16px; font-weight: 500; min-height: 48px; padding: 0 12px 0 20px; }
  #ast-mobile-popup #ast-hf-mobile-menu .sub-menu .sub-menu .menu-link { padding-left: 36px; font-size: 15px; color: #334155; }
  /* one chevron per row: hide Astra's leading arrow icon and the duplicate arrow inside the link; the separate toggle button stays (56px) */
  #ast-mobile-popup #ast-hf-mobile-menu .menu-link > .ast-icon.icon-arrow,
  #ast-mobile-popup #ast-hf-mobile-menu .menu-link > .dropdown-menu-toggle { display: none !important; }
  #ast-mobile-popup #ast-hf-mobile-menu .ast-menu-toggle { border: 0 !important; box-shadow: none !important; background: transparent !important; }
  #ast-mobile-popup #ast-hf-mobile-menu .ast-menu-toggle:focus { outline: none; }
  #ast-mobile-popup #ast-hf-mobile-menu .ast-menu-toggle:focus-visible { outline: 2px solid #1E293B; outline-offset: -4px; }

  /* M5. Account row: icon plus the site's own wording "Min side" (same text as the footer link). */
  #ast-mobile-popup .ast-header-account-wrap { width: 100%; }
  #ast-mobile-popup .ast-header-account-link { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 0 4px; color: #1E293B; border-top: 1px solid rgba(15, 23, 42, 0.08); }
  #ast-mobile-popup .ast-header-account-link::after { content: "Min side"; font-size: 17px; font-weight: 600; letter-spacing: 0.02em; }
}
