/* Storefront's original header is hidden when our header supplies the same links. */
body:has(> .tlp-site-header) #page > #masthead.site-header { display: none !important; }

body:is(.woocommerce-cart, .woocommerce-account, .woocommerce-checkout):has(> .tlp-site-header) #primary > #main {
    padding-block-start: clamp(1.25rem, 3vw, 2rem);
}

body.tlp-mi-cuenta-acceso:has(> .tlp-site-header) #primary > #main > article > .entry-header {
    margin-block-start: 0;
}

.tlp-site-header {
    --header-surface: var(--tlp-night-panel, #fffdfa);
    --header-ink: var(--tlp-night-text, #283c37);
    --header-line: var(--tlp-night-line, #e6dfd8);
    --header-accent: var(--tlp-night-mint, #255a52);
    --header-hover: var(--tlp-night-selected, #e8f4ef);
    position: sticky;
    top: var(--tlp-site-header-top, 0px);
    z-index: 20;
    display: grid;
    align-items: center;
    box-sizing: border-box;
    width: 100%;
    background: var(--header-surface);
    color: var(--header-ink);
    border-block-end: 1px solid var(--header-line);
    font-family: system-ui, sans-serif;
}

.tlp-site-header .tlp-site-control {
    display: grid;
    place-items: center;
    inline-size: 44px;
    block-size: 44px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: .7rem;
    background: transparent;
    color: inherit;
    text-decoration: none;
    cursor: pointer;
}
.tlp-site-header .tlp-site-control svg { display: block; width: 21px; height: 21px; }
.tlp-site-header .tlp-site-menu-toggle { display: none; }
.tlp-site-header .tlp-site-theme .tlp-theme-picker { --tlp-picker-ink: var(--header-ink); margin: 0; }
.tlp-site-header .tlp-site-brand { justify-self: center; }
.tlp-site-header .tlp-site-brand img { display: block; width: 48px; height: 48px; object-fit: contain; border-radius: 50%; }
.tlp-site-header .tlp-site-navigation ul { margin: 0; padding: 0; list-style: none; }
.tlp-site-header .tlp-site-navigation a {
    display: flex;
    align-items: center;
    min-height: 44px;
    color: inherit;
    text-decoration: none;
}
.tlp-site-header .tlp-site-navigation a:is(:hover, :focus-visible) { color: var(--header-accent); }
.tlp-site-header :is(.tlp-site-control, .tlp-site-brand, .tlp-site-navigation a):focus-visible {
    outline: 2px solid var(--header-accent);
    outline-offset: 3px;
}
.tlp-site-header .tlp-site-cart-icon { position: relative; }
.tlp-site-header .tlp-site-cart-count {
    position: absolute;
    inset: -5px -7px auto auto;
    min-width: 14px;
    padding-inline: 2px;
    border-radius: 999px;
    background: #53352f;
    color: #f5f3f3;
    text-align: center;
    font-size: 9px;
    font-weight: 750;
    line-height: 14px;
}

.tlp-site-header .tlp-site-cart .tlp-cart-drawer-close {
    border-radius: 50%;
    background: var(--drawer-action-fill);
    color: var(--drawer-action-ink);
}
.tlp-site-header .tlp-site-cart .tlp-cart-drawer-close:hover { background: var(--drawer-action-hover); }

@media (min-width: 601px) {
    body.admin-bar:has(> .tlp-site-header) { --tlp-site-header-top: var(--wp-admin--admin-bar--height, 32px); }
}
@media (min-width: 601px) and (max-width: 782px) {
    body.admin-bar:has(> .tlp-site-header) { --tlp-site-header-top: var(--wp-admin--admin-bar--height, 46px); }
}

@media (width < 768px) {
    body.admin-bar:has(.tlp-site-header) #wpadminbar :is(#wp-admin-bar-wpseo-menu, #wp-admin-bar-redis-cache, #wp-admin-bar-wp-rocket) {
        display: none;
    }

    .tlp-site-header {
        grid-template-columns: repeat(5, minmax(0, 1fr));
        grid-template-rows: 3.75rem;
        justify-items: center;
        padding: .25rem 0;
    }
    .tlp-site-header[data-menu-ready] .tlp-site-menu-toggle { display: grid; grid-area: 1 / 1; }
    .tlp-site-header .tlp-site-theme { grid-area: 1 / 2; }
    .tlp-site-header .tlp-site-brand { grid-area: 1 / 3; }
    .tlp-site-header .tlp-site-actions { display: contents; }
    .tlp-site-header .tlp-site-account { grid-area: 1 / 4; }
    .tlp-site-header .tlp-site-cart-link { grid-area: 1 / 5; }
    .tlp-site-header .tlp-site-cart-total { display: none; }

    .tlp-site-header .tlp-site-navigation {
        grid-column: 1 / -1;
        justify-self: stretch;
        padding: .25rem clamp(.5rem, 2vw, 1rem);
        background: var(--header-surface);
    }
    .tlp-site-header[data-menu-ready] .tlp-site-navigation {
        display: none;
        position: absolute;
        inset: 100% 0 auto;
        max-height: 70vh;
        max-height: 70dvh;
        overflow: auto;
        overscroll-behavior: contain;
        border-block-end: 1px solid var(--header-line);
        box-shadow: 0 10px 24px #46373522;
    }
    .tlp-site-header[data-menu-ready] .tlp-site-navigation[data-open] { display: block; }
    .tlp-site-header .tlp-site-navigation ul.sub-menu { padding-inline-start: .8rem; }
    .tlp-site-header .tlp-site-navigation a { padding: .65rem .6rem; font-size: .95rem; }
}

@media (min-width: 768px) {
    .tlp-site-header {
        grid-template-columns: auto minmax(0, 1fr) auto auto;
        column-gap: clamp(.25rem, .75vw, 1rem);
        padding: .4rem max(clamp(.75rem, 1.5vw, 2rem), calc((100% - 1230px) / 2));
    }
    .tlp-site-header .tlp-site-brand { grid-area: 1 / 1; }
    .tlp-site-header .tlp-site-brand img { width: 62px; height: 62px; }
    .tlp-site-header .tlp-site-navigation { grid-area: 1 / 2; }
    .tlp-site-header .tlp-site-theme { grid-area: 1 / 3; }
    .tlp-site-header .tlp-site-navigation > ul {
        display: flex;
        align-items: center;
        justify-content: center;
        column-gap: clamp(.35rem, .85vw, 1.1rem);
    }
    .tlp-site-header .tlp-site-navigation li { position: relative; }
    .tlp-site-header .tlp-site-navigation a { font-size: .875rem; font-weight: 540; line-height: 1.25; }
    .tlp-site-header .tlp-site-navigation > ul > li > a {
        font-size: clamp(.8125rem, 1.65vw, .875rem);
        text-align: center;
    }
    .tlp-site-header .tlp-site-support { display: none; }
    .tlp-site-header .tlp-site-navigation .sub-menu {
        display: none;
        position: absolute;
        inset: 100% auto auto 0;
        padding-inline: .5rem;
        border: 1px solid var(--header-line);
        border-radius: .65rem;
        background: var(--header-surface);
        white-space: nowrap;
    }
    .tlp-site-header .tlp-site-navigation li:is(:hover, :focus-within) > .sub-menu { display: block; }
    .tlp-site-header .tlp-site-actions { grid-area: 1 / 4; display: flex; align-items: center; }
    .tlp-site-header .tlp-site-cart-link {
        display: flex;
        justify-content: center;
        position: relative;
        isolation: isolate;
        inline-size: auto;
        gap: .5rem;
        padding-inline: .8rem;
        font-variant-numeric: tabular-nums;
        font-weight: 690;
        white-space: nowrap;
    }
    .tlp-site-header .tlp-site-cart-link::before {
        content: "";
        position: absolute;
        inset: 0;
        z-index: -1;
        background: light-dark(#f6b9b6, #754744);
        -webkit-mask: url("pincelada-logo.png") center / 100% 95% no-repeat;
        mask: url("pincelada-logo.png") center / 100% 95% no-repeat;
    }
}
