/**
 * eBiz Woo Pro - top bar, header and menu drawer
 *
 * One home for everything above the page content (markup: header.php,
 * behaviour: assets/js/main.js, drawer sub-menus: inc/nav-menu.php).
 *
 *   1. Tokens
 *   2. Top bar          [socials]  < announcement >
 *   3. Header           [menu]  logo  [search · account · cart]
 *   4. Menu drawer      close · menu rows with "+" sub-menus · socials
 *
 * Mobile first: base rules are the phone layout, min-width queries add the
 * desktop refinements.
 */

/* ==========================================================================
   1. TOKENS
   ========================================================================== */
:root {
    --header-gutter: clamp(20px, 2.4vw, 48px);
    --header-height: 72px;

    --topbar-bg: #242833;
    --topbar-height: 40px;

    --drawer-soft: #f6f6f6;
    --drawer-footer-bg: #f8f8f8;
    --menu-highlight: #ff0000;   /* menu items with the "menu-highlight" CSS class */

    --font-nav: "Poppins", var(--font-body-family);
}

@media (min-width: 992px) {
    :root {
        --header-height: 100px;
        --topbar-height: 48px;
    }
}

/* Shared look for the icon-only buttons (menu, close, topbar arrows). */
.menu-toggle,
.nav-drawer-close,
.topbar-arrow,
.header-icon,
.drawer-toggle {
    background: none;
    border: 0;
    color: inherit;
    cursor: pointer;
    line-height: 1;
}

.menu-toggle:focus-visible,
.nav-drawer-close:focus-visible,
.topbar-arrow:focus-visible,
.header-icon:focus-visible,
.drawer-toggle:focus-visible,
.topbar-socials a:focus-visible,
.drawer-socials a:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

/* ==========================================================================
   2. TOP BAR
   Phone: announcement only. Tablet and up (768px): social icons on the left
   (on phones they live in the menu drawer instead, where there is room).
   ========================================================================== */
.topbar-slider {
    background: var(--topbar-bg);
    color: #fff;
    font-family: var(--font-nav);
    height: var(--topbar-height);
    position: relative;
    z-index: 999;
}

.topbar-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: center;
    height: 100%;
}

/* Same side gutter for top bar, header and drawer so everything lines up.
   Two classes deep on purpose: storefront.css (loaded later) sets a
   different gutter on the bare .container. */
.topbar-slider .container,
.site-header .container {
    padding-inline: var(--header-gutter);
}

.topbar-socials {
    display: none;
}

.topbar-carousel {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    column-gap: .25rem;
    height: 100%;
}

.topbar-arrow {
    padding: .5rem .45rem;
    font-size: .8rem;
    opacity: .75;
    transition: opacity .2s ease;
}

.topbar-arrow:hover { opacity: 1; }
.topbar-arrow:last-child { grid-column: 3; }

/* Messages stack on top of each other; only the active one is visible. */
.topbar-typing-wrap {
    position: relative;
    grid-column: 2;
    align-self: stretch;
}

.topbar-typing-item {
    position: absolute;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity .3s ease, transform .3s ease;
    pointer-events: none;      /* a hidden message must never block a link in the visible one */
}

.topbar-typing-item.active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.topbar-typing-item * { color: inherit; }
.topbar-typing-item a { text-underline-offset: 3px; }

/* Wipe-in reveal; text wraps to two lines on narrow phones. */
.typing-text {
    display: inline-block;
    font-size: .7rem;
    font-weight: 400;
    letter-spacing: .04em;
    line-height: 1.3;
    text-wrap: balance;
    clip-path: inset(0 100% 0 0);
}

.topbar-typing-item.active .typing-text {
    animation: revealText 1.4s cubic-bezier(.2, .8, .2, 1) forwards;
}

@keyframes revealText {
    from { clip-path: inset(0 100% 0 0); }
    to   { clip-path: inset(0 0 0 0); }
}

@media (min-width: 768px) {
    .topbar-inner {
        grid-template-columns: minmax(5rem, 1fr) minmax(0, 46rem) minmax(5rem, 1fr);
    }

    .topbar-socials {
        display: flex;
        grid-column: 1;
        justify-self: start;
        align-items: center;
        gap: 1.1rem;
    }

    .topbar-socials a {
        color: inherit;
        font-size: 1rem;
        line-height: 1;
        opacity: .9;
        transition: opacity .2s ease;
    }

    .topbar-socials a:hover { opacity: 1; }

    .topbar-carousel { grid-column: 2; }

    .typing-text {
        font-size: .875rem;
        letter-spacing: .08em;
        white-space: nowrap;
    }
}

/* ==========================================================================
   3. HEADER
   Three-column grid at every size, so the logo is always dead centre:
   [menu button]  [logo]  [search · account · cart]
   The side columns never shrink below their content, so on a very narrow
   screen a wide logo gives way instead of colliding with the icons.
   ========================================================================== */
.site-header {
    background: #fff;
}

.header-inner {
    display: grid;
    grid-template-columns: minmax(max-content, 1fr) auto minmax(max-content, 1fr);
    align-items: center;
    column-gap: .5rem;
    min-height: var(--header-height);
}

/* Menu button + the drawer's close button share one box, so the "X" opens
   exactly where the hamburger was. */
.menu-toggle,
.nav-drawer-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    margin-left: -.7rem;      /* pull the padded button box left so the glyph's strokes sit on the page gutter */
    color: var(--color-black);
}

.menu-toggle {
    grid-column: 1;
    justify-self: start;
    font-size: 1.75rem;
}

.nav-drawer-close {
    font-size: 1.35rem;
}

.site-logo {
    grid-column: 2;
    text-align: center;
}

.site-logo a {
    display: inline-block;
    color: var(--color-black);
    line-height: 0;
    text-decoration: none;
}

.site-logo img {
    display: block;
    width: auto;
    max-width: 100%;
    max-height: 42px;
}

.site-logo-text {
    font-family: var(--font-nav);
    font-size: 1.1rem;
    font-weight: 400;
    letter-spacing: .14em;
    line-height: 1.2;
    text-transform: uppercase;
}

.header-icons {
    grid-column: 3;
    justify-self: end;
    display: flex;
    align-items: center;
}

.header-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: .4rem;
    font-size: 1.2rem;
    color: var(--color-black);
    text-decoration: none;
    transition: opacity .2s ease;
}

.header-icon:hover { opacity: .6; }

.cart-count {
    position: absolute;
    top: 1px;
    right: -1px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 16px;
    height: 16px;
    padding: 0 3px;
    border-radius: 8px;
    background: var(--color-black);
    color: #fff;
    font-family: var(--font-nav);
    font-size: 10px;
    font-weight: 400;
    letter-spacing: 0;
    line-height: 1;
    transition: transform .25s ease;
}

@media (min-width: 576px) {
    .header-inner { column-gap: 1rem; }
    .header-icon  { padding: .5rem; }
}

@media (min-width: 992px) {
    .site-logo img { max-height: 62px; }
    .site-logo-text { font-size: 1.45rem; }
    .header-icons  { gap: .5rem; }
    .header-icon   { font-size: 1.35rem; }
    .menu-toggle   { font-size: 2rem; }
    .nav-drawer-close { font-size: 1.5rem; }
}

/* Small phones: keep the three icons clear of the logo. */
@media (max-width: 389px) {
    .site-logo img { max-height: 36px; }
}

@media (max-width: 359px) {
    .site-logo img { max-height: 32px; }
    .header-icon   { padding: .3rem; }
}

/* ==========================================================================
   4. MENU DRAWER
   Bootstrap offcanvas, left side, all screen sizes. It opens *below* the top
   bar (offset set from JS as --drawer-top) so the social icons stay visible,
   and its header row is as tall as the site header so the close button sits
   where the menu button was.
   ========================================================================== */
.nav-drawer {
    --bs-offcanvas-width: 100%;
    --bs-offcanvas-bg: #fff;
    --bs-offcanvas-border-width: 0;
    --bs-offcanvas-padding-x: 0;
    --bs-offcanvas-padding-y: 0;

    top: var(--drawer-top, 0);
    font-family: var(--font-nav);
    color: var(--color-black);
}

.nav-drawer.show {
    box-shadow: 0 0 40px rgba(0, 0, 0, .12);
}

@media (min-width: 576px) {
    .nav-drawer { --bs-offcanvas-width: 27rem; }
}

.nav-drawer-header {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    height: var(--header-height);
    padding-inline: var(--header-gutter);
}

.nav-drawer-body {
    padding: 0;
}

/* --- menu rows --------------------------------------------------------- */
.drawer-menu,
.drawer-menu .sub-menu {
    margin: 0;
    padding: 0;
    list-style: none;
}

.drawer-menu a {
    display: block;
    padding: 1rem var(--header-gutter);
    color: inherit;
    font-size: 1.125rem;
    font-weight: 300;
    letter-spacing: .04em;
    line-height: 1.4;
    text-decoration: none;
    transition: background-color .2s ease;
}

/* Parent item: link + "+" toggle on one row. */
.drawer-row {
    display: flex;
    align-items: stretch;
    transition: background-color .2s ease;
}

.drawer-row > a {
    flex: 1 1 auto;
    min-width: 0;
}

/* Current page, and hover/keyboard focus (hover only on devices that have it). */
.drawer-menu .current-menu-item > a,
.drawer-menu .current-menu-item > .drawer-row,
.drawer-menu li > a:focus-visible,
.drawer-row:focus-within {
    background: var(--drawer-soft);
}

@media (hover: hover) {
    .drawer-menu li > a:hover,
    .drawer-row:hover {
        background: var(--drawer-soft);
    }
}

/* Optional emphasis: give a menu item the CSS class "menu-highlight"
   (Appearance > Menus > Screen Options > CSS Classes), e.g. a sale link. */
.drawer-menu .menu-highlight > a,
.drawer-menu .menu-highlight > .drawer-row > a {
    color: var(--menu-highlight);
    font-weight: 600;
}

/* --- "+" toggle: hairline divider on the left, plus drawn in CSS ---------- */
.drawer-toggle {
    position: relative;
    flex: 0 0 auto;
    width: 3.25rem;
    margin-right: var(--header-gutter);
    color: var(--color-black);
    background: linear-gradient(currentColor, currentColor) left center / 1px 1.6rem no-repeat;
}

.drawer-toggle::before,
.drawer-toggle::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: .75rem;
    height: 1px;
    background: currentColor;
    transform: translate(-50%, -50%);
    transition: transform .25s ease;
}

/* The vertical stroke turns horizontal when open: "+" becomes "−". */
.drawer-toggle::after {
    transform: translate(-50%, -50%) rotate(90deg);
}

.drawer-toggle[aria-expanded="true"]::after {
    transform: translate(-50%, -50%) rotate(0deg);
}

/* --- sub-menu ------------------------------------------------------------ */
.drawer-menu .sub-menu {
    padding-bottom: .4rem;
}

.drawer-menu .sub-menu a {
    padding-block: .65rem;
    padding-left: calc(var(--header-gutter) + 1rem);
    color: #555;
    font-size: 1rem;
}

/* --- footer: social icons -------------------------------------------------- */
.nav-drawer-footer {
    flex: 0 0 auto;
    padding: 1.75rem var(--header-gutter);
    padding-bottom: calc(1.75rem + env(safe-area-inset-bottom, 0px));
    background: var(--drawer-footer-bg);
}

.drawer-socials {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.5rem;
}

.drawer-socials a {
    color: #000;
    font-size: 1.5rem;
    line-height: 1;
    transition: opacity .2s ease;
}

.drawer-socials a:hover { opacity: .6; }

/* ==========================================================================
   REDUCED MOTION
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    .typing-text,
    .topbar-typing-item.active .typing-text {
        animation: none;
        clip-path: none;
    }

    .topbar-typing-item,
    .drawer-toggle::before,
    .drawer-toggle::after {
        transition: none;
    }
}
