/**
 * Site header — menu bar, category panels, account menu, mobile chips/tab bar/search sheet.
 * Tokens only (css/design-tokens.css). Markup: parts/header.html + inc/site-header.php.
 *
 *   Desktop (≥ 1025px): logo · categories · period · account · cart
 *   Tablet + mobile (≤ 1024px): logo · period · cart, category chips, bottom tab bar
 */

/* Sticky wrapper (the template part's <header>) */
.wp-block-template-part:has(> .dh-header),
header:has(> .dh-header) {
    position: sticky;
    top: var(--wp-admin--admin-bar--height, 0px);
    z-index: 200;
    margin: 0 !important;
}

.dh-header {
    position: relative;
    background: var(--dh-background);
    color: var(--dh-foreground);
    font-family: var(--dh-font-sans);
}

.dh-header > * {
    margin-block: 0 !important;
}

.dh-header .dh-i {
    width: 16px;
    height: 16px;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ---------- Bar ---------- */
.dh-header__bar {
    display: flex !important;
    align-items: center;
    gap: 8px;
    max-width: none;
    padding: 12px var(--dh-gutter);
}

.dh-header__bar > * {
    margin: 0 !important;
}

.dh-header__logo {
    flex: none;
    margin-right: 16px !important;
}

.dh-header__logo img {
    display: block;
    height: auto;
}

@media (min-width: 768px) {
    .dh-header__bar { padding-inline: 1.5rem; }
}

@media (min-width: 1024px) {
    .dh-header__bar { padding-inline: 2rem; }
}

/* ---------- Shared controls ---------- */
.dh-header button {
    font: inherit;
    color: inherit;
}

.dh-header :is(button, a):focus-visible {
    outline: 3px solid color-mix(in oklch, var(--dh-ring) 50%, transparent);
    outline-offset: 1px;
}

.dh-iconbtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid var(--dh-border);
    border-radius: var(--dh-radius-full);
    background: var(--dh-card);
    color: var(--dh-foreground);
    cursor: pointer;
    transition: background-color var(--dh-ease);
}

.dh-iconbtn:hover,
.dh-iconbtn[aria-expanded="true"] {
    background: var(--dh-accent);
}

.dh-tile {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex: none;
    border-radius: var(--dh-radius-md);
    background: var(--dh-muted);
    color: var(--dh-foreground);
}

.dh-tile .dh-i {
    width: 18px;
    height: 18px;
}

.dh-label {
    margin: 0;
    font-family: var(--dh-font-sans);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--dh-muted-foreground);
}

/* ---------- Category bar (desktop) ---------- */
.dh-nav {
    flex: 1;
    min-width: 0;
}

.dh-nav__list {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.dh-nav__btn {
    display: inline-flex;
    align-items: center;
    height: 34px;
    padding: 0 14px;
    border: 1px solid transparent;
    border-radius: var(--dh-radius-pill);
    background: none;
    font-size: 14px !important;
    font-weight: 500;
    color: var(--dh-muted-foreground) !important;
    cursor: pointer;
    transition: color var(--dh-ease), background-color var(--dh-ease);
}

.dh-nav__btn:hover,
.dh-nav__btn.is-current {
    color: var(--dh-foreground) !important;
}

.dh-nav__btn[aria-expanded="true"] {
    background: var(--dh-card);
    border-color: var(--dh-border);
    box-shadow: var(--dh-shadow-card);
    color: var(--dh-foreground) !important;
}

/* ---------- Category panel ---------- */
.dh-mega {
    position: absolute;
    top: calc(100% + 8px);
    left: 2rem;
    right: 2rem;
    z-index: 3;
    max-width: 1080px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 300px;
    gap: 16px 24px;
    padding: 20px 24px;
    background: var(--dh-popover);
    border: 1px solid var(--dh-border);
    border-radius: var(--dh-radius-2xl);
    box-shadow: var(--dh-shadow-pop);
    color: var(--dh-foreground);
}

.dh-mega[hidden],
.dh-scrim[hidden] {
    display: none;
}

.dh-mega__head {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--dh-border);
}

.dh-mega__title {
    font-family: var(--dh-font-heading);
    font-size: 1rem;
    font-weight: 600;
}

.dh-mega__all {
    margin-left: auto;
    font-size: 14px;
    color: var(--dh-foreground);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.dh-mega__list {
    display: grid;
    gap: 2px;
    align-content: start;
    margin: 0;
    padding: 0;
    list-style: none;
}

.dh-mega__list a {
    display: block;
    margin: 0 -12px;
    padding: 7px 12px;
    border-radius: 0.8rem;
    font-size: 15px;
    color: var(--dh-foreground);
    text-decoration: none;
    transition: background-color var(--dh-ease);
}

.dh-mega__list a:hover {
    background: var(--dh-accent);
}

.dh-mega__feat {
    grid-column: 3;
    grid-row: 2;
    align-self: start;
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 14px;
    align-items: center;
    padding: 10px;
    border-radius: 1.2rem;
    background: var(--dh-background);
    color: var(--dh-foreground);
    text-decoration: none;
}

.dh-mega__img {
    display: block;
    aspect-ratio: 1;
    overflow: hidden;
    padding: 8%;
    box-sizing: border-box;
    border-radius: var(--dh-radius-md);
    background: var(--dh-photo);
}

.dh-mega__img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.dh-mega__meta {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.dh-mega__name {
    font-weight: 500;
}

.dh-mega__brand {
    font-size: 0.875rem;
    color: var(--dh-muted-foreground);
}

.dh-mega__price {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.dh-scrim {
    position: fixed;
    inset: 0;
    z-index: -1;
    background: var(--dh-background);
    opacity: 0.55;
}

/* ---------- Period pill (date selector button) ---------- */
.dh-period {
    flex: none;
}

.dh-period .date-selector-container {
    width: auto;
}

.dh-period .rental-picker,
.dh-period .date-grid {
    display: block;
    width: auto;
}

.dh-period .delivery-return-wrapper {
    display: none !important;
}

.dh-header .dh-period .date-picker-button {
    width: auto;
    height: 36px !important;
    min-height: 36px !important;
    display: inline-flex !important;
    align-items: center;
    gap: 8px;
    padding: 0 14px !important;
    border: 1px solid var(--dh-border) !important;
    border-radius: var(--dh-radius-pill) !important;
    background: var(--dh-card) !important;
    color: var(--dh-foreground) !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    transition: background-color var(--dh-ease);
}

.dh-header .dh-period .date-picker-button:hover {
    background: var(--dh-accent) !important;
}

.dh-period .date-selector-button-content,
.dh-period .date-selector-placeholder,
.dh-period .date-selector-dates {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.dh-period .date-selector-text,
.dh-period .date-selector-date-range {
    font-size: 14px !important;
    font-weight: 500 !important;
    color: inherit !important;
    grid-row: auto !important;
}

/* ---------- Account ---------- */
.dh-account {
    position: relative;
    flex: none;
}

.dh-account__menu {
    position: absolute;
    top: 44px;
    right: 0;
    z-index: 5;
    width: 260px;
    display: grid;
    padding: 6px;
    background: var(--dh-popover);
    border: 1px solid var(--dh-border);
    border-radius: 1.3rem;
    box-shadow: var(--dh-shadow-pop);
    color: var(--dh-foreground);
}

.dh-account__menu[hidden] {
    display: none;
}

.dh-account__who {
    display: grid;
    gap: 2px;
    padding: 10px 12px 8px;
}

.dh-account__name {
    font-weight: 500;
}

.dh-account__company {
    font-size: 0.875rem;
    color: var(--dh-muted-foreground);
}

.dh-account__menu > a,
.dh-account__menu > button,
.dh-account__theme {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 38px;
    padding: 0 12px;
    border: 0;
    border-radius: 0.9rem;
    background: none;
    font-size: 14.5px;
    font-weight: 400;
    color: var(--dh-foreground);
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: background-color var(--dh-ease);
}

.dh-account__menu > a:hover,
.dh-account__menu > button:hover {
    background: var(--dh-accent);
}

.dh-account__menu .dh-i {
    color: var(--dh-muted-foreground);
}

.dh-account__theme {
    cursor: default;
}

.dh-account__sep {
    height: 1px;
    margin: 4px 6px;
    background: var(--dh-border);
}

.dh-seg {
    display: inline-flex;
    gap: 2px;
    margin-left: auto;
    padding: 2px;
    border-radius: var(--dh-radius-pill);
    background: var(--dh-muted);
}

.dh-seg button {
    height: 26px;
    padding: 0 9px;
    border: 0;
    border-radius: var(--dh-radius-pill);
    background: none;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--dh-muted-foreground);
    cursor: pointer;
}

.dh-seg button[aria-pressed="true"] {
    background: var(--dh-card);
    color: var(--dh-foreground);
    box-shadow: var(--dh-shadow-card);
}

/* ---------- Cart (WooCommerce mini-cart block as outline pill with sum) ---------- */
.dh-header .wp-block-woocommerce-mini-cart {
    flex: none;
}

.dh-header .wc-block-mini-cart__button {
    display: inline-flex !important;
    align-items: center;
    gap: 8px;
    height: 36px;
    padding: 0 14px !important;
    border: 1px solid var(--dh-border) !important;
    border-radius: var(--dh-radius-pill);
    background: var(--dh-card) !important;
    color: var(--dh-foreground) !important;
    font-size: 14px !important;
    font-weight: 500;
    cursor: pointer;
    transition: background-color var(--dh-ease);
}

.dh-header .wc-block-mini-cart__button:hover {
    background: var(--dh-accent) !important;
}

.dh-header .wc-block-mini-cart__amount {
    display: inline !important;
    color: inherit !important;
    font-size: 14px !important;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.dh-header .wc-block-mini-cart__quantity-badge {
    display: inline-flex;
}

.dh-header .wc-block-mini-cart__icon {
    display: block !important;
    width: 16px !important;
    height: 16px !important;
    color: currentColor;
}

.dh-header .wc-block-mini-cart__badge {
    display: none !important;
}

/* ---------- Mobile: chips, tab bar, search sheet ---------- */
.dh-chips,
.dh-tabbar {
    display: none;
}

@media (max-width: 1024px) {
    .dh-nav,
    .dh-mega,
    .dh-scrim,
    .dh-account__btn {
        display: none !important;
    }

    .dh-header__logo {
        margin-right: auto !important;
    }

    .dh-chips {
        display: flex;
        gap: 6px;
        overflow-x: auto;
        padding: 0 var(--dh-gutter) 12px;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .dh-chips::-webkit-scrollbar {
        display: none;
    }

    .dh-chip {
        display: inline-flex;
        align-items: center;
        flex: none;
        height: 32px;
        padding: 0 12px;
        border: 1px solid var(--dh-border);
        border-radius: var(--dh-radius-pill);
        background: var(--dh-card);
        font-size: 13px;
        font-weight: 500;
        color: var(--dh-foreground);
        text-decoration: none;
    }

    .dh-tabbar {
        position: fixed;
        inset: auto 0 0 0;
        z-index: 300;
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        padding: 8px 8px calc(10px + env(safe-area-inset-bottom, 0px));
        background: var(--dh-card);
        border-top: 1px solid var(--dh-border);
    }

    .dh-tabbar > a,
    .dh-tabbar > button {
        display: grid;
        justify-items: center;
        gap: 2px;
        padding: 0;
        border: 0;
        background: none;
        font-size: 11px;
        font-weight: 500;
        color: var(--dh-muted-foreground);
        text-decoration: none;
        cursor: pointer;
    }

    .dh-tabbar .dh-i {
        width: 48px;
        height: 28px;
        padding: 5px 15px;
        border-radius: var(--dh-radius-full);
        box-sizing: border-box;
    }

    .dh-tabbar [aria-current="page"],
    .dh-tabbar [aria-expanded="true"] {
        color: var(--dh-foreground);
    }

    .dh-tabbar [aria-current="page"] .dh-i,
    .dh-tabbar [aria-expanded="true"] .dh-i {
        background: var(--dh-accent);
    }

    body {
        padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
    }

    /* Account menu becomes a sheet above the tab bar */
    .dh-account__menu {
        position: fixed;
        top: auto;
        right: 8px;
        left: 8px;
        bottom: calc(72px + env(safe-area-inset-bottom, 0px));
        z-index: 310;
        width: auto;
    }

    .dh-account__menu > a,
    .dh-account__menu > button,
    .dh-account__theme {
        min-height: 44px;
        font-size: 15px;
    }
}

@media (max-width: 600px) {
    .dh-header__logo img {
        width: 96px !important;
    }

    .dh-header .dh-period .date-picker-button,
    .dh-header .wc-block-mini-cart__button {
        height: 32px !important;
        min-height: 32px !important;
        padding: 0 12px !important;
        font-size: 13px !important;
    }

    .dh-period .date-selector-text,
    .dh-period .date-selector-date-range,
    .dh-header .wc-block-mini-cart__amount {
        font-size: 13px !important;
    }
}

/* Search sheet */
.dh-sheet {
    position: fixed;
    inset: 0;
    z-index: 400;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    gap: 4px;
    overflow-y: auto;
    background: var(--dh-background);
    color: var(--dh-foreground);
    padding-top: var(--wp-admin--admin-bar--height, 0px);
}

.dh-sheet[hidden] {
    display: none;
}

.dh-sheet__head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px var(--dh-gutter) 10px;
}

.dh-search {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    height: 44px;
    padding: 0 16px;
    border: 1px solid var(--dh-input);
    border-radius: var(--dh-radius-pill);
    background: var(--dh-card);
}

.dh-search:focus-within {
    border-color: var(--dh-ring);
    box-shadow: 0 0 0 3px color-mix(in oklch, var(--dh-ring) 50%, transparent);
}

.dh-search .dh-i {
    color: var(--dh-muted-foreground);
}

.dh-search input[type="search"] {
    flex: 1;
    min-width: 0;
    height: 100%;
    padding: 0;
    border: 0;
    outline: 0;
    background: none;
    font: inherit;
    font-size: 16px;
    color: var(--dh-foreground);
}

.dh-search input::placeholder {
    color: var(--dh-muted-foreground);
    font-weight: 300;
}

.dh-sheet .dh-label {
    padding: 4px var(--dh-gutter);
}

.dh-catlist {
    display: grid;
    align-content: start;
    margin: 0;
    padding: 0 var(--dh-gutter);
    list-style: none;
}

.dh-catlist a {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 56px;
    border-bottom: 1px solid var(--dh-border);
    font-size: 15px;
    font-weight: 500;
    color: var(--dh-foreground);
    text-decoration: none;
}

.dh-catlist li:last-child a {
    border-bottom: 0;
}

.dh-catlist a > .dh-i:last-child {
    margin-left: auto;
    color: var(--dh-muted-foreground);
}

.dh-sheet .dh-i {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.dh-sheet .dh-tile .dh-i {
    width: 18px;
    height: 18px;
}

@media (prefers-reduced-motion: reduce) {
    .dh-header *,
    .dh-sheet * {
        transition: none !important;
    }
}

/* ---------- Logo: «Blokk» word mark (docs/redesign/dryhire-logo-blokk.svg), follows currentColor ---------- */
.dh-logo {
    display: inline-flex;
    align-items: center;
    color: var(--dh-foreground);
    text-decoration: none;
}

.dh-logo__svg {
    display: block;
    width: auto;
    height: 17px;
}
