    /* === SIMPLIFIED HEADER - NO HAMBURGER MENU === */

/* Sticky compact header (Etap 11, nr 19, owner decision 7; initStickyHeader() in assets/js/main.js).
   - The header sticks to the top of the window (under the admin bar). On <= 768px main.js pulls it up by
     --mgredline-header-compact-shift (the logo row minus 8px), so after scrolling only the icon row stays.
   - Scrolling down hides it with a transform (.is-hidden), scrolling up shows it; only `transform` moves, 0.2s.
   - scroll-padding-top keeps anchors and keyboard focus below the visible header (WCAG 2.4.11).
   Flat dark background without a shadow: style.css HEADER (owner decision 10). */
.site-header {
    position: sticky;
    top: calc(var(--wp-admin--admin-bar--height, 0px) - var(--mgredline-header-compact-shift, 0px));
    transition: transform 0.2s ease;
}

/* <= 600px the admin bar scrolls away with the page (WordPress makes it position: absolute there). */
@media (max-width: 600px) {
    .site-header {
        top: calc(0px - var(--mgredline-header-compact-shift, 0px));
    }
}

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

/* Compact header with keyboard focus in its logo row (main.js): the whole header shows, the shift is dropped. A sticky
   top moves nothing else on the page. */
.site-header.is-full {
    top: var(--wp-admin--admin-bar--height, 0px);
}

@media (max-width: 600px) {
    .site-header.is-full {
        top: 0;
    }
}

/* Focused checkout: logo and "Back to cart" only, nothing to keep at hand; main.js leaves it alone. */
.mgredline-focused-checkout .site-header {
    position: relative;
    top: auto;
}

html {
    scroll-padding-top: var(--mgredline-sticky-h, 0px);
}

/* The header's own controls sit inside that padding: without this, focusing one (Tab, Shift+Tab) makes the browser
   scroll the page by half a window to "uncover" it. The negative margin cancels the padding for them. Not for the panels
   that scroll on their own (the mini cart's item list; the menu panel on <= 1024px, below): there the margin would
   count a hidden item as shown. */
.site-header :not(.astra-cart-drawer, .astra-cart-drawer *) {
    scroll-margin-top: calc(-1 * var(--mgredline-sticky-h, 0px));
}

@media (max-width: 1024px) {
    .site-header .main-navigation,
    .site-header .main-navigation * {
        scroll-margin-top: 0;
    }
}

/* Focus coming into a hidden header shows it at once (main.js), before the browser checks that the control is in view. */
.site-header.is-instant {
    transition: none;
}

@media (prefers-reduced-motion: reduce) {
    .site-header {
        transition: none;
    }
}

/* The offer bar (#mgrs-pbar, Code Snippets) scrolls away with the page instead of sticking above the header
   (author decision 3). Beats the snippet's `#mgrs-pbar { position: sticky; top: ... }` on specificity. */
body > #mgrs-pbar {
    position: relative;
    top: auto;
}

/* Language switcher (mgredline_language_switcher() in inc/template-functions.php, initLanguageSwitcher() in main.js):
   a 44px button with the language name (the two-letter code on <= 768px) and a dark list of links under it. */
.mgredline-header-actions > .mgredline-lang {
    width: auto;
    height: auto;
    border-radius: 0;
    flex: 0 0 auto;
}

.mgredline-header-actions > .mgredline-lang:hover {
    background: transparent;
    transform: none;
}

.mgredline-header-actions .mgredline-lang__toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-sizing: border-box;
    min-height: var(--control-height-sm);
    margin: 0;
    padding: 0 10px;
    border: 0;
    border-radius: var(--radius-control);
    background: transparent;
    color: var(--white);
    font-family: var(--font-primary);
    font-size: 15px;
    font-weight: 500;
    line-height: 1;
    text-transform: none;
    letter-spacing: 0;
    white-space: nowrap;
    cursor: pointer;
}

.mgredline-header-actions .mgredline-lang__toggle:hover,
.mgredline-header-actions .mgredline-lang__toggle[aria-expanded="true"] {
    background: var(--on-dark-hover);
    color: var(--white);
}

/* Caret drawn in CSS (no icon font), points up while the list is open. */
.mgredline-lang__toggle::after {
    content: '';
    width: 6px;
    height: 6px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: translateY(-2px) rotate(45deg);
}

.mgredline-lang__toggle[aria-expanded="true"]::after {
    transform: translateY(1px) rotate(225deg);
}

.mgredline-lang__code {
    display: none;
}

/* Dark like the Shop dropdown, so the header's white focus ring stays visible; 8px side padding keeps the ring
   inside the list. */
.mgredline-lang__list {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: var(--z-dropdown);
    min-width: 180px;
    margin: 4px 0 0;
    padding: 8px;
    list-style: none;
    background: var(--dark-color);
    border: 1px solid var(--on-dark-border);
    border-radius: var(--radius-control);
}

.mgredline-lang__list li {
    margin: 0;
}

.mgredline-lang__list a {
    display: flex;
    align-items: center;
    min-height: var(--control-height-sm);
    padding: 0 12px;
    border-radius: var(--radius-control);
    color: var(--white);
    font-family: var(--font-primary);
    font-size: 15px;
    text-decoration: none;
    white-space: nowrap;
}

.mgredline-lang__list a:hover {
    background: var(--on-dark-hover);
    color: var(--white);
}

.mgredline-lang__list a[aria-current="true"] {
    font-weight: 700;
    box-shadow: inset 3px 0 0 var(--primary-color);
}

/* Phones: the code (EN, DE, HU) is shown, the name stays for screen readers (same rules as .screen-reader-text). */
@media (max-width: 768px) {
    .mgredline-lang__code {
        display: inline;
    }

    .mgredline-lang__name {
        position: absolute;
        width: 1px;
        height: 1px;
        margin: -1px;
        padding: 0;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        clip-path: inset(50%);
        white-space: nowrap;
        border: 0;
    }

    .mgredline-header-actions .mgredline-lang__toggle {
        height: var(--control-height-sm);
        padding: 0 8px;
        gap: 6px;
    }
}

    /* Header Layout */
    .mgredline-header-main .container {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 20px;
        padding: 0 20px;
    }
    
    /* Site Branding */
    .site-branding {
        display: flex;
        align-items: center;
        flex-shrink: 0;
    }
    
    .custom-logo {
        max-height: 50px;
        width: auto;
    }
    
    /* Main Navigation - Always Visible */
    .main-navigation {
        display: flex;
        flex: 1;
        justify-content: center;
    }
    
    .main-navigation ul {
        display: flex;
        list-style: none;
        margin: 0;
        padding: 0;
        gap: 25px;
        align-items: center;
    }
    
    .main-navigation a {
        color: var(--white);
        font-family: var(--font-heading);
        font-weight: 600;
        font-size: 1rem;
        padding: 12px 0;
        display: block;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        transition: color 0.2s ease;
        position: relative;
        text-decoration: none;
    }
    
    /* Current page: one calm cue, the 2px red underline below; the text stays white (no red box or side line). */
    .main-navigation .current-menu-item > a {
        color: var(--white);
    }

    .main-navigation a:hover {
        color: var(--primary-color);
    }
    
    .main-navigation .current-menu-item > a::after {
        content: '';
        position: absolute;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 2px;
        background: var(--primary-color);
    }
    
    /* Header Actions - Always Visible */
    .mgredline-header-actions {
        display: flex;
        align-items: center;
        gap: 20px;
        flex-shrink: 0;
    }
    
    /* Header icons: 44x44 targets (WCAG 2.5.8), flat square hover, no circles (Etap 11). */
    .mgredline-header-actions > * {
        position: relative;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        border-radius: var(--radius-control);
        transition: var(--transition);
        color: var(--white);
        background: transparent;
        border: none;
        cursor: pointer;
        text-decoration: none;
        font-size: 1.1rem;
    }
    
    /* Astra's inline `button:focus` paints focused buttons in --ast-global-color-1 (the blue hamburger, nr 8): header
       icons keep their transparent look; the focus ring comes from controls.css (white on the dark header). */
    .mgredline-header-actions button:focus {
        background-color: transparent;
        border-color: transparent;
        color: var(--white);
    }

    @media (hover: hover) {
        .mgredline-header-actions > *:hover {
            background: var(--on-dark-hover);
            color: var(--primary-color);
        }
    }

    /* Touch: a tap leaves :hover stuck; style.css paints the search toggle grey with a red icon on :hover. */
    @media (hover: none) {
        .mgredline-header-actions .mgredline-search-toggle:hover {
            background: transparent;
            color: var(--white);
        }
    }

    /* Open state of the header panels' buttons (search, language, cart): a light box with a red bar underneath, like
       the current menu item. The cart button's background is forced to none in style.css, so the cart wrapper
       carries it. After the hover and :focus rules (same or higher weight). */
    .mgredline-header-actions .mgredline-search-toggle[aria-expanded="true"],
    .mgredline-header-actions .mgredline-lang__toggle[aria-expanded="true"],
    .mgredline-header-actions > .ast-site-header-cart:has(.ast-cart-collapsible[aria-expanded="true"]) {
        background: var(--on-dark-active);
        color: var(--white);
        box-shadow: inset 0 -3px 0 var(--primary-color);
    }
    
    /* Enhanced Astra Cart with Dropdown Styling */
    .ast-site-header-cart {
        position: relative;
    }
    
    .ast-site-header-cart-data {
        position: relative;
    }
    
    /* Header cart button (owner request 14.11): outline bag icon, a small red count badge, the subtotal next to it.
       style.css still forces padding 10px and the 8px radius on this button with !important (legacy). */
    /* No extra left margin (style.css: 15px): the cart sits at the same gap as the other icons. */
    .mgredline-header-actions > .ast-site-header-cart {
        width: auto;
        margin-left: 0;
    }

    .mgredline-header-actions > .ast-site-header-cart:hover {
        background: transparent;
    }

    .ast-cart-collapsible {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 14px; /* room for the badge, which sticks out right of the bag */
        box-sizing: border-box;
        width: auto;
        min-width: var(--control-height-sm);
        height: var(--control-height-sm);
        font-family: var(--font-primary);
        /* Inherits all other styles from .mgredline-header-actions > * */
    }

    .ast-cart-menu-wrap {
        position: relative;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Shopping bag, solid like the Font Awesome header icons (search, sign-in, bars), drawn with a mask in the text
       colour (white on the dark header). On the wrap's ::before because the WooCommerce cart fragments replace the
       wrap's content (functions.php). */
    .ast-cart-menu-wrap::before {
        content: '';
        display: block;
        width: 22px;
        height: 22px;
        background-color: currentColor;
        -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4.6 8.5h14.8l-1.1 11.7a1.6 1.6 0 0 1-1.6 1.4H7.3a1.6 1.6 0 0 1-1.6-1.4z'/%3E%3Cpath d='M8.6 8.5V7a3.4 3.4 0 0 1 6.8 0v1.5' fill='none' stroke='black' stroke-width='2.2'/%3E%3C/svg%3E") center / 22px 22px no-repeat;
        mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4.6 8.5h14.8l-1.1 11.7a1.6 1.6 0 0 1-1.6 1.4H7.3a1.6 1.6 0 0 1-1.6-1.4z'/%3E%3Cpath d='M8.6 8.5V7a3.4 3.4 0 0 1 6.8 0v1.5' fill='none' stroke='black' stroke-width='2.2'/%3E%3C/svg%3E") center / 22px 22px no-repeat;
    }

    /* Count badge: a small rounded rectangle at the bag's top right, hidden at 0 (not printed, or the fragment's
       inline display: none). The count is also in the button's aria-label (header.php, syncCartLabel() in main.js). */
    .ast-cart-menu-wrap .count {
        position: absolute;
        top: -9px;
        right: -11px; /* clear of the bag's handle */
        display: flex;
        align-items: center;
        justify-content: center;
        box-sizing: border-box;
        min-width: 18px;
        min-height: 0; /* Astra: 2.1em */
        height: 18px;
        padding: 0 4px;
        border: 0; /* Astra: 2px solid, and a bag handle in ::after (removed below) */
        border-radius: 4px;
        background: var(--primary-color);
        color: var(--white);
        font-family: var(--font-heading);
        font-size: 12px;
        font-weight: 700;
        line-height: 1;
        text-align: center;
    }

    .ast-cart-menu-wrap .count::after {
        content: none;
    }

    .ast-cart-menu-wrap .count:empty,
    .ast-cart-menu-wrap .count[data-count="0"] {
        display: none;
    }
    
    .ast-woo-header-cart-info-wrap {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        font-size: 0.9rem;
    }
    
    .ast-woo-header-cart-total {
        font-family: var(--font-heading);
        font-weight: 600;
        color: inherit;
    }
    
    /* Cart Dropdown/Drawer */
    .astra-cart-drawer {
        position: absolute;
        top: 100%;
        right: 0;
        width: 350px;
        max-width: 90vw;
        min-height: 100px;
        background: var(--white);
        border-radius: var(--border-radius);
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
        opacity: 0;
        visibility: hidden;
        transform: translateY(-10px);
        /* visibility flips at once on open (focus can move into the panel) and after the fade on close */
        transition: opacity 0.3s ease, transform 0.3s ease, visibility 0s linear 0.3s;
        z-index: 9999;
        border: 1px solid var(--medium-gray);
        /* Flex column: header and footer keep their size, only .mgredline-mini-cart-items scrolls.
           --mgredline-drawer-top (header bottom in the viewport) is set by main.js on open. */
        display: flex;
        flex-direction: column;
        max-height: calc(100vh - var(--mgredline-drawer-top, 80px) - 16px);
        overflow: visible;
    }
    
    .ast-cart-collapsible[aria-expanded="true"] ~ .astra-cart-drawer,
    .ast-site-header-cart-data .astra-cart-drawer.show {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
        transition-delay: 0s;
    }

    /* Header scrolled out of view (main.js adds .is-floating): pin the panel to the window.
       On <= 768px --mgredline-drawer-top is already 8px and the mobile rule below applies. */
    .astra-cart-drawer.is-floating {
        position: fixed;
        top: 16px;
        right: 16px;
        max-height: calc(100vh - 32px);
    }

    /* While the panel is open the header must not be the containing block of the fixed (phone) panel: no transform,
       not even while .is-hidden is being taken off (initStickyHeader() never hides the header while it is open). */
    .site-header:has(.astra-cart-drawer.show) {
        transform: none;
    }

    /* The cart wrapper also holds the panel: no transform on it (a transform would squeeze the fixed panel into it). */
    .mgredline-header-actions > .ast-site-header-cart:hover {
        transform: none;
    }

    
    /* Cart Dropdown Header */
    .astra-cart-drawer .cart-dropdown-header {
        flex: none;
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 15px 20px;
    }

    /* Title (h2, line-height of the old h4); colour and font in style.css. */
    .astra-cart-drawer .cart-dropdown-header h2 {
        font-size: 1rem;
        line-height: 1.2;
    }

    /* The title gets script focus when the panel opens (tabindex="-1"): no ring, see controls.css. */

    /* Close x: its look and its 44x44 target (audit C-09) are in style.css (.astra-cart-drawer .cart-dropdown-header
       .cart-close-btn, plain rules); here only the alignment with the panel edge. */
    .astra-cart-drawer .cart-dropdown-header .cart-close-btn {
        margin-right: -8px;
    }
    
    /* The only scrolling part of the panel */
    .astra-cart-drawer .mgredline-mini-cart-items {
        flex: 1 1 auto;
        min-height: 0;
        max-height: min(50vh, 320px);
        overflow-y: auto;
        overscroll-behavior: contain;
    }
    
    /* Professional Mini Cart Items */
    .astra-cart-drawer .mgredline-mini-cart-item {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 15px 20px;
        border-bottom: 1px solid var(--light-gray);
        transition: background-color 0.2s ease;
    }
    
    .astra-cart-drawer .mgredline-mini-cart-item:hover {
        background: rgba(0, 0, 0, 0.02);
    }
    
    .astra-cart-drawer .mgredline-mini-cart-item:last-child {
        border-bottom: none;
    }
    
    .astra-cart-drawer .mgredline-mini-cart-item .item-image {
        flex-shrink: 0;
        display: block;
        position: relative;
    }

    /* YITH badges ("Best Value") cover the 50 px thumbnail */
    /* keep: badge products (367, 415) are not in the audited carts */
    .astra-cart-drawer .yith-wcbm-badge {
        display: none;
    }
    
    .astra-cart-drawer .mgredline-mini-cart-item .item-image img {
        width: 50px;
        height: 50px;
        object-fit: cover;
        border-radius: var(--border-radius);
        border: 1px solid var(--light-gray);
    }
    
    .astra-cart-drawer .mgredline-mini-cart-item .item-details {
        flex: 1;
        min-width: 0;
    }
    
    .astra-cart-drawer .mgredline-mini-cart-item .product-name {
        font-size: 0.9rem;
        font-weight: 500;
        color: var(--dark-color);
        text-decoration: none;
        line-height: 1.3;
        margin: 0 0 4px 0;
        display: block;
    }

    .astra-cart-drawer .mgredline-mini-cart-item a.product-name:hover,
    .astra-cart-drawer .mgredline-mini-cart-item a.product-name:focus-visible {
        color: var(--primary-color);
        text-decoration: underline;
    }
    
    .astra-cart-drawer .mgredline-mini-cart-item .quantity {
        font-size: 0.8rem;
        color: var(--secondary-color);
        font-weight: 400;
    }
    
    .astra-cart-drawer .mgredline-mini-cart-item .item-price {
        font-size: 0.9rem;
        font-weight: 600;
        color: var(--primary-color);
        flex-shrink: 0;
        margin-right: 8px;
    }
    
    .astra-cart-drawer .mgredline-mini-cart-item .item-remove {
        flex-shrink: 0;
    }
    
    .astra-cart-drawer .mgredline-mini-cart-item .remove-item {
        color: var(--secondary-color);
        text-decoration: none;
        font-size: 1.2rem;
        width: 44px; /* touch target (audit C-09) */
        height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: var(--radius-control);
        transition: var(--transition);
        font-weight: bold;
    }
    
    .astra-cart-drawer .mgredline-mini-cart-item .remove-item:hover {
        background: var(--light-gray);
        color: var(--dark-color);
    }
    
    /* Mini Cart Footer: outside the scrolling list, always visible */
    .astra-cart-drawer .mgredline-cart-footer {
        flex: none;
        padding: 16px 20px 20px;
        border-top: 1px solid var(--border);
        background: var(--light-gray);
        border-radius: 0 0 var(--border-radius) var(--border-radius);
    }
    
    /* Cross-sell suggestion: one compact row above the subtotal */
    .astra-cart-drawer .mgredline-mini-cart-upsell {
        margin: 0 0 12px;
        padding-bottom: 12px;
        border-bottom: 1px solid var(--medium-gray);
    }

    .astra-cart-drawer .mgredline-mini-cart-upsell__title {
        margin: 0 0 8px;
        font-size: 0.8rem;
        line-height: 1.4;
        color: var(--text-color);
    }

    .astra-cart-drawer .mgredline-mini-cart-upsell__row {
        display: flex;
        align-items: flex-start;
        gap: 10px;
    }

    .astra-cart-drawer .mgredline-mini-cart-upsell__image {
        flex: none;
        width: 48px;
        height: 48px;
        border-radius: var(--border-radius);
        overflow: hidden;
        background: var(--white);
    }

    .astra-cart-drawer .mgredline-mini-cart-upsell__image img {
        display: block;
        width: 48px;
        height: 48px;
        object-fit: cover;
    }

    .astra-cart-drawer .mgredline-mini-cart-upsell__info {
        flex: 1;
        min-width: 0;
        display: flex;
        flex-direction: column;
        gap: 4px;
    }

    .astra-cart-drawer .mgredline-mini-cart-upsell__name {
        font-size: 0.85rem;
        font-weight: 600;
        line-height: 1.25;
        color: var(--dark-color);
        text-decoration: none;
        overflow-wrap: anywhere;
    }

    .astra-cart-drawer .mgredline-mini-cart-upsell__name:hover {
        color: var(--primary-color);
    }

    /* The button moves under the price when both do not fit on one line (320px, Etap 13: it overflowed by 4px) */
    .astra-cart-drawer .mgredline-mini-cart-upsell__buy {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
    }

    .astra-cart-drawer .mgredline-mini-cart-upsell__price {
        font-size: 0.85rem;
        color: var(--dark-color);
    }

    /* The block cart already shows cross-sells; adding from here would reload the page */
    body.woocommerce-cart .astra-cart-drawer .mgredline-mini-cart-upsell {
        display: none;
    }

    /* Secondary 44px button (look from controls.css) */
    .astra-cart-drawer .mgredline-mini-cart-upsell__add.button {
        flex: none;
        max-width: 100%;
    }

    .astra-cart-drawer .mgredline-mini-cart-upsell__add.button.loading {
        opacity: 0.6;
    }

    .astra-cart-drawer .cart-subtotal {
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        gap: 12px;
        font-family: var(--font-heading);
        color: var(--dark-color);
    }

    .astra-cart-drawer .cart-subtotal__label {
        font-size: 1rem;
        font-weight: 600;
    }

    .astra-cart-drawer .cart-subtotal__amount {
        font-size: 1.2rem;
        font-weight: 700;
    }

    .astra-cart-drawer .cart-tax-note {
        margin: 2px 0 14px;
        font-size: 0.8rem;
        line-height: 1.4;
        color: var(--text-color);
    }
    
    .astra-cart-drawer .cart-buttons {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }
    
    .astra-cart-drawer .cart-btn {
        width: 100%;
    }

    /* Empty Cart State */
    .astra-cart-drawer .mgredline-empty-cart {
        flex: none;
        padding: 30px 20px 20px;
        text-align: center;
    }

    .astra-cart-drawer .mgredline-empty-cart__message {
        margin: 0 0 16px;
        color: var(--secondary-color);
    }

    .astra-cart-drawer .mgredline-empty-cart__action {
        margin: 0;
    }

    /* Active cart dropdown styling */
    .astra-cart-drawer.show {
        /* Inherits opacity, visibility, and transform from base selector */
    }
    
    /* Header search panel (#mgredline-header-search, a sibling of .mgredline-header-actions): layout and background in
       components/dynamic.css (SEARCH FORM); field and button from components/controls.css. */

    /* === RESPONSIVE DESIGN === */
    
    /* Large Tablet (1024px and down) */
    @media (max-width: 1024px) {
        .mgredline-header-main .container {
            gap: 15px;
        }
        
        .mgredline-header-actions {
            gap: 12px;
        }
    }
    
    /* Tablet (768px and down) */
    @media (max-width: 768px) {
        .mgredline-header-main .container {
            padding: 0 15px;
            gap: 10px;
            flex-wrap: wrap;
        }

        /* 8px under the icon row, as above it in the compact header (initStickyHeader()): 8 + 44 + 8 px. */
        body:not(.mgredline-focused-checkout) .mgredline-header-main {
            padding-bottom: 8px;
        }

        /* The open search row (dynamic.css) is the header's last row and white: without the padding no dark strip
           shows under it. */
        body:not(.mgredline-focused-checkout) .mgredline-header-main:has(#mgredline-header-search:not([hidden])) {
            padding-bottom: 0;
        }
        
        .site-branding {
            order: 1;
            flex: 1;
        }
        
        .mgredline-header-actions {
            order: 2;
            gap: 4px;
        }

        /* Touch targets: every header icon (search, account, cart, menu) is at least 44x44 (WCAG 2.5.8 / Etap 9).
           The cart wrapper grows with its button (icon + total), so the cart no longer runs into the menu button. */
        .mgredline-header-actions > *:not(.shop-lang-switcher) {
            width: auto;
            min-width: 44px;
            height: 44px;
        }

        .mgredline-header-actions .ast-cart-collapsible {
            min-width: 44px;
            height: 44px;
        }

        .mgredline-header-actions .mgredline-menu-toggle {
            width: 44px;
            padding: 0;
        }

        /* Search panel on phones: a full-width row under the icons (components/dynamic.css). */

        /* Mini cart: fixed under the header (or 8px from the top when floating), 16 px from both screen edges */
        .astra-cart-drawer,
        .astra-cart-drawer.is-floating {
            position: fixed;
            top: var(--mgredline-drawer-top, 72px);
            left: 16px;
            right: 16px;
            width: auto;
            max-width: none;
            max-height: calc(100vh - var(--mgredline-drawer-top, 72px) - 16px);
            max-height: calc(100dvh - var(--mgredline-drawer-top, 72px) - 16px);
        }

        .astra-cart-drawer .mgredline-mini-cart-item {
            gap: 10px;
            padding: 12px 8px 12px 16px;
        }

        .astra-cart-drawer .mgredline-mini-cart-item .item-price {
            margin-right: 0;
        }
        
        .ast-woo-header-cart-info-wrap {
            font-size: 13px;
        }
    }
    
    /* Mobile (480px and down) */
    @media (max-width: 480px) {
        .mgredline-header-main .container {
            padding: 0 10px;
        }
        
        .mgredline-header-actions > * {
            font-size: 1rem;
        }
        
    }
    
    /* Very Small Screens (360px and down) */
    @media (max-width: 360px) {
        .mgredline-header-actions {
            gap: 0;
        }

        .mgredline-header-actions > * {
            font-size: 0.9rem;
        }
        
        .ast-woo-header-cart-info-wrap {
            display: none; /* Hide cart total on very small screens */
        }
    }
    
    /* === PRIMARY MENU === */

    .main-navigation li {
        position: relative;
    }

    .main-navigation .sub-menu {
        list-style: none;
        margin: 0;
        padding: 0;
    }

    /* Desktop: inline menu, "Shop" opens a dropdown on hover and keyboard focus. */
    @media (min-width: 1025px) {
        .mgredline-header-actions .mgredline-menu-toggle,
        .main-navigation .mgredline-submenu-toggle {
            display: none;
        }

        .main-navigation .sub-menu {
            display: flex;
            flex-direction: column;
            align-items: stretch;
            gap: 0;
            position: absolute;
            top: 100%;
            left: -16px;
            min-width: 230px;
            padding: 8px 0;
            background: var(--dark-color);
            border-top: 2px solid var(--primary-color);
            border-radius: 0 0 var(--border-radius) var(--border-radius);
            box-shadow: var(--box-shadow-lg);
            opacity: 0;
            visibility: hidden;
            transform: translateY(-6px);
            transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
            z-index: var(--z-dropdown);
        }

        .main-navigation li:hover > .sub-menu,
        .main-navigation li:focus-within > .sub-menu {
            opacity: 1;
            visibility: visible;
            transform: translateY(0);
        }

        .main-navigation .sub-menu a {
            padding: 10px 20px;
            white-space: nowrap;
        }

        .main-navigation .sub-menu a:hover,
        .main-navigation .sub-menu a:focus {
            background: var(--on-dark-subtle);
        }

        .main-navigation .menu-item-has-children > a {
            display: flex;
            align-items: center;
            gap: 6px;
        }

        .main-navigation .menu-item-has-children > a::after {
            content: '';
            width: 6px;
            height: 6px; /* overrides the 2px current-item underline above */
            border-right: 2px solid currentColor;
            border-bottom: 2px solid currentColor;
            transform: translateY(-2px) rotate(45deg);
            position: static;
            background: none;
            transition: transform 0.2s ease;
        }

        .main-navigation .menu-item-has-children:hover > a::after,
        .main-navigation .menu-item-has-children:focus-within > a::after {
            transform: translateY(1px) rotate(225deg);
        }

        /* Esc closes the dropdown (initDesktopSubmenuEscape() in main.js) until the pointer leaves the item or focus
           moves out of it. Same weight as the :hover / :focus-within rules above, later in the file. */
        .main-navigation li.is-dismissed > .sub-menu {
            opacity: 0;
            visibility: hidden;
            transform: translateY(-6px);
        }

        .main-navigation .menu-item-has-children.is-dismissed > a::after {
            transform: translateY(-2px) rotate(45deg);
        }
    }

    /* Tablet and mobile: hamburger button, full-width panel under the header. */
    @media (max-width: 1024px) {
        .mgredline-header-actions .mgredline-menu-toggle {
            order: 2; /* after the cart, which is order: 1 in style.css */
        }

        .mgredline-menu-toggle .fa-times,
        .mgredline-menu-toggle[aria-expanded="true"] .fa-bars {
            display: none;
        }

        .mgredline-menu-toggle[aria-expanded="true"] .fa-times {
            display: inline-block;
        }

        .site-header .main-navigation {
            display: block;
            position: absolute;
            top: 100%;
            left: 0;
            right: 0;
            width: auto;
            flex: none; /* base rule has flex: 1 (zero basis) */
            height: auto; /* a parent theme rule gives .main-navigation a percentage height, which would clip the panel to the header height */
            max-height: calc(100vh - 80px);
            overflow-y: auto;
            background: var(--dark-color);
            border-top: 1px solid var(--on-dark-divider-strong);
            box-shadow: var(--box-shadow-lg);
            opacity: 0;
            visibility: hidden;
            transform: translateY(-8px);
            transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
            z-index: var(--z-dropdown);
        }

        .site-header .main-navigation.is-open {
            transition: opacity 0.2s ease, transform 0.2s ease; /* no visibility transition: links must be focusable immediately on open */
            opacity: 1;
            visibility: visible;
            transform: translateY(0);
        }

        .site-header .main-navigation > ul {
            display: block;
            padding: 8px 0;
        }

        .main-navigation > ul > li {
            display: grid;
            grid-template-columns: 1fr 52px;
            align-items: stretch;
            border-bottom: 1px solid var(--on-dark-divider);
        }

        .main-navigation > ul > li:last-child {
            border-bottom: none;
        }

        .site-header .main-navigation a {
            padding: 14px 20px;
            font-size: 1.1rem;
            /* Base rule uses "all", which would also transition the inherited visibility and keep links unfocusable for 0.3s after opening. */
            transition: color 0.3s ease, background-color 0.3s ease;
        }

        .main-navigation > ul > li:not(.menu-item-has-children) > a {
            grid-column: 1 / -1;
        }

        .main-navigation .current-menu-item > a::after {
            display: none;
        }

        /* Current page in the panel: the red bar on the left only (white text, as on desktop). */
        .main-navigation .current-menu-item > a {
            box-shadow: inset 3px 0 0 var(--primary-color);
        }

        .main-navigation .mgredline-submenu-toggle {
            display: flex;
            align-items: center;
            justify-content: center;
            background: transparent;
            border: none;
            border-left: 1px solid var(--on-dark-divider);
            border-radius: 0;
            padding: 0;
            color: var(--white);
            cursor: pointer;
            font-size: 0.9rem;
            transition: var(--transition);
        }

        .main-navigation .mgredline-submenu-toggle:hover {
            color: var(--primary-color);
        }

        .main-navigation .mgredline-submenu-toggle i {
            transition: transform 0.2s ease;
        }

        .main-navigation .mgredline-submenu-toggle[aria-expanded="true"] i {
            transform: rotate(180deg);
        }

        .main-navigation .sub-menu {
            display: none;
            grid-column: 1 / -1;
            background: rgba(0, 0, 0, 0.25);
            padding: 4px 0;
        }

        .main-navigation li.submenu-open > .sub-menu {
            display: block;
        }

        .main-navigation .sub-menu a {
            padding: 11px 20px 11px 36px;
            font-size: 1rem;
        }
    }

    @media (prefers-reduced-motion: reduce) {
        .site-header .main-navigation,
        .site-header .main-navigation.is-open,
        .main-navigation .sub-menu,
        .main-navigation .mgredline-submenu-toggle i,
        .main-navigation .menu-item-has-children > a::after {
            transition: none;
        }
    }

    @media (prefers-reduced-motion: reduce) {
        .mgredline-header-actions > * {
            transition: none !important;
        }
    }

/* === Focused checkout header (inc/checkout.php): logo, "Secure checkout", "Back to cart" === */
.mgredline-checkout-secure {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--white);
}

.mgredline-checkout-secure .fa-lock {
    color: var(--primary-color);
}

.mgredline-checkout-back {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 4px;
    font-family: var(--font-heading);
    font-weight: 600;
    color: var(--white);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.mgredline-checkout-back:hover {
    color: var(--primary-color);
}

/* No link columns above the footer bottom: drop the footer top padding. */
.mgredline-focused-checkout .site-footer {
    padding-top: 0;
}

@media (max-width: 768px) {
    /* style.css stacks this container in a column below 768px; keep logo and link on one row. */
    .mgredline-focused-checkout .mgredline-header-main .container {
        flex-direction: row;
        align-items: center;
        gap: 4px 10px;
    }

    .mgredline-focused-checkout .site-branding {
        order: 1;
        flex: 1 1 auto;
    }

    .mgredline-checkout-back {
        order: 2;
    }

    .mgredline-checkout-secure {
        order: 3;
        flex-basis: 100%;
        font-size: 1rem;
    }
}
