/* APC Outdoor — custom header
   Inspired by Crate&Barrel layout, adapted for mono-niche tables.
   Color tokens follow the brand palette (forest green #2D4A3A). */

:root {
    --apc-fg: #1a1a1a;
    --apc-fg-muted: #555;
    --apc-bg: #ffffff;
    --apc-border: #e6e6e6;
    --apc-brand: #2D4A3A;
    --apc-topbar-bg: #111;
    --apc-topbar-fg: #f4f4f4;
    --apc-hover: #2D4A3A;
}

/* Reset Kadence header that might still ghost-render */
body.apc-header-active .site-header { display: none !important; }

.apc-header {
    background: var(--apc-bg);
    color: var(--apc-fg);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    border-bottom: 1px solid var(--apc-border);
    position: relative;
    z-index: 100;
}

/* === Top utility bar === */
.apc-topbar {
    background: var(--apc-topbar-bg);
    color: var(--apc-topbar-fg);
    font-size: 12px;
    letter-spacing: 0.02em;
}
.apc-topbar__inner {
    max-width: 1440px;
    margin: 0 auto;
    padding: 8px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
}
.apc-topbar__msg { margin: 0; font-weight: 500; }
.apc-topbar__contact {
    display: flex;
    align-items: center;
    gap: 12px;
}
.apc-topbar__link {
    color: var(--apc-topbar-fg);
    text-decoration: none;
    transition: opacity .15s;
}
.apc-topbar__link:hover { opacity: .75; }
.apc-topbar__sep { opacity: .4; }

/* === Main header === */
.apc-header__main {
    border-bottom: 1px solid var(--apc-border);
}
.apc-header__main-inner {
    max-width: 1440px;
    margin: 0 auto;
    padding: 22px 32px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 24px;
}

/* Search (left) */
.apc-header__search {
    display: flex;
    align-items: center;
    border: 1px solid var(--apc-border);
    border-radius: 2px;
    background: #fff;
    width: 100%;
    max-width: 360px;
    transition: border-color .15s;
}
.apc-header__search:focus-within { border-color: var(--apc-fg); }
.apc-header__search input[type="search"] {
    flex: 1;
    border: 0;
    background: transparent;
    padding: 11px 14px;
    font-size: 14px;
    color: var(--apc-fg);
    outline: none;
}
.apc-header__search input[type="search"]::placeholder { color: var(--apc-fg-muted); }
.apc-header__search button {
    border: 0;
    background: transparent;
    padding: 0 14px;
    color: var(--apc-fg-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
}
.apc-header__search button:hover { color: var(--apc-fg); }

/* Logo (center) — high specificity + !important to defeat WooCommerce's
   `.woocommerce img { height:auto; max-width:100% }` override on store pages. */
.apc-header .apc-header__logo {
    justify-self: center;
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    color: var(--apc-fg);
    max-width: 280px;
}
.apc-header .apc-header__logo img,
body.woocommerce .apc-header .apc-header__logo img,
body.woocommerce-page .apc-header .apc-header__logo img {
    height: 56px !important;
    max-height: 56px !important;
    width: auto !important;
    max-width: 100% !important;
    display: block !important;
}
.apc-header__logo-text {
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -0.01em;
}

/* Icons (right) */
.apc-header__actions {
    justify-self: end;
    display: flex;
    align-items: center;
    gap: 18px;
}
.apc-header__icon {
    color: var(--apc-fg);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    padding: 8px;
    position: relative;
    transition: color .15s;
}
.apc-header__icon:hover { color: var(--apc-hover); }
.apc-header__cart-count {
    position: absolute;
    top: 0;
    right: -2px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--apc-brand);
    color: #fff;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    line-height: 18px;
    text-align: center;
    display: none;
}
.apc-header__cart-count.is-active { display: inline-block; }

/* Hamburger (mobile only) */
.apc-header__burger {
    display: none;
    background: none;
    border: 0;
    width: 40px;
    height: 40px;
    padding: 0;
    cursor: pointer;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
}
.apc-header__burger span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--apc-fg);
    transition: transform .2s, opacity .2s;
}
.apc-header__burger.is-active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.apc-header__burger.is-active span:nth-child(2) { opacity: 0; }
.apc-header__burger.is-active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* === Menu bar === */
.apc-header__nav {
    background: #fff;
}
.apc-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 32px;
    display: flex;
    justify-content: center;
    gap: 36px;
}
.apc-menu__item {
    position: static; /* mega menu is full-width, anchored to nav */
}
.apc-menu__link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--apc-fg);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 18px 4px;
    border-bottom: 2px solid transparent;
    transition: border-color .15s, color .15s;
}
.apc-menu__link:hover,
.apc-menu__item:focus-within > .apc-menu__link,
.apc-menu__item.is-current > .apc-menu__link {
    border-bottom-color: var(--apc-fg);
    color: var(--apc-fg);
}
.apc-menu__caret {
    transition: transform .2s;
    opacity: .65;
}
.apc-menu__item.has-mega:hover .apc-menu__caret,
.apc-menu__item.has-mega:focus-within .apc-menu__caret {
    transform: rotate(180deg);
}

/* === Mega menu === */
.apc-megamenu {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    background: #fafafa;
    border-top: 1px solid var(--apc-border);
    border-bottom: 1px solid var(--apc-border);
    box-shadow: 0 14px 30px -16px rgba(0,0,0,.12);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity .18s, transform .18s, visibility .18s;
    z-index: 90;
}
.apc-menu__item.has-mega:hover > .apc-megamenu,
.apc-menu__item.has-mega:focus-within > .apc-megamenu,
.apc-menu__item.is-open > .apc-megamenu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.apc-megamenu__inner {
    max-width: 1440px;
    margin: 0 auto;
    padding: 36px 32px;
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 48px;
    align-items: start;
}
.apc-megamenu__list {
    list-style: none;
    margin: 0;
    padding: 0;
    columns: 2;
    column-gap: 48px;
}
.apc-megamenu__list li { break-inside: avoid; margin: 0 0 14px; }
.apc-megamenu__list a {
    display: block;
    color: var(--apc-fg);
    text-decoration: none;
    font-size: 14px;
    line-height: 1.5;
    padding: 4px 0;
    transition: color .15s;
}
.apc-megamenu__list a:hover { color: var(--apc-brand); }

.apc-megamenu__feature {
    display: block;
    text-decoration: none;
    color: inherit;
    background: #fff;
    border: 1px solid var(--apc-border);
}
.apc-megamenu__feature-img {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 10;
    background-size: cover;
    background-position: center;
}
.apc-megamenu__feature-body {
    display: block;
    padding: 16px 18px 18px;
}
.apc-megamenu__feature-caption {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--apc-fg);
    margin-bottom: 6px;
    line-height: 1.4;
}
.apc-megamenu__feature-cta {
    display: block;
    font-size: 13px;
    color: var(--apc-brand);
    font-weight: 600;
}
.apc-megamenu__feature:hover .apc-megamenu__feature-cta { text-decoration: underline; }

/* === Mobile drawer === */
.apc-mobile-drawer {
    position: fixed;
    top: 0;
    left: 0;
    width: min(86vw, 360px);
    height: 100vh;
    background: #fff;
    transform: translateX(-100%);
    transition: transform .25s ease;
    z-index: 200;
    box-shadow: 4px 0 30px -10px rgba(0,0,0,.2);
    overflow-y: auto;
}
.apc-mobile-drawer.is-open { transform: translateX(0); }
.apc-mobile-drawer__inner { padding: 24px 8px 40px; }
.apc-mobile-menu, .apc-mobile-submenu {
    list-style: none;
    margin: 0;
    padding: 0;
}
.apc-mobile-menu__item {
    border-bottom: 1px solid var(--apc-border);
    position: relative;
}
.apc-mobile-menu__item > a {
    display: block;
    padding: 16px 56px 16px 20px;
    color: var(--apc-fg);
    text-decoration: none;
    font-size: 16px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
.apc-mobile-menu__toggle {
    position: absolute;
    top: 0;
    right: 0;
    width: 56px;
    height: 56px;
    background: none;
    border: 0;
    cursor: pointer;
    color: var(--apc-fg);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .2s;
}
.apc-mobile-menu__item.is-open > .apc-mobile-menu__toggle { transform: rotate(180deg); }
.apc-mobile-submenu { display: none; padding: 0 0 12px 20px; }
.apc-mobile-menu__item.is-open > .apc-mobile-submenu { display: block; }
.apc-mobile-submenu li a {
    display: block;
    padding: 10px 20px;
    color: var(--apc-fg-muted);
    text-decoration: none;
    font-size: 15px;
}
.apc-mobile-submenu li a:hover { color: var(--apc-brand); }

.apc-mobile-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    opacity: 0;
    visibility: hidden;
    transition: opacity .2s, visibility .2s;
    z-index: 150;
}
.apc-mobile-overlay.is-open { opacity: 1; visibility: visible; }

/* === Responsive === */
@media (max-width: 991px) {
    .apc-topbar__contact { display: none; }
    .apc-topbar__inner { justify-content: center; }
    .apc-header__nav { display: none; }
    .apc-header__main-inner {
        grid-template-columns: auto 1fr auto;
        padding: 14px 16px;
    }
    .apc-header__burger { display: flex; }
    .apc-header__search { display: none; }
    .apc-header__logo img { height: 40px; }
    .apc-header__logo-text { font-size: 22px; }
    .apc-header__actions { gap: 8px; }
}
@media (max-width: 575px) {
    .apc-topbar { font-size: 11px; }
    .apc-topbar__inner { padding: 6px 16px; }
}
