/* ============================================================
   Wigmorean Theme v2 — Header & Footer (Structural)
   All colour/font values use CSS custom properties defined by
   wigt_dynamic_css() in customizer.php. This file is layout only.
   ============================================================ */

/* ── Site wrapper ────────────────────────────────────────── */
#page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

#content {
    flex: 1 0 auto;
}

.wig-container {
    width: 100%;
    max-width: var(--wig-container-width, 1200px);
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--wig-space-md);
    padding-right: var(--wig-space-md);
}

.wig-container--wide {
    max-width: var(--wig-content-wide, 1400px);
}

.wig-container--narrow {
    max-width: var(--wig-content-width, 780px);
}

/* ── Header shell ────────────────────────────────────────── */
.wig-header {
    position: relative;
    z-index: 200;
    background: var(--wig-color-header-bg, var(--wig-color-bg));
    border-bottom: 1px solid var(--wig-color-border);
    height: var(--wig-header-height, 72px);
}

.wig-header__inner {
    display: flex;
    align-items: center;
    height: 100%;
    gap: var(--wig-space-lg);
}

/* Logo */
.wig-header__logo {
    flex-shrink: 0;
    line-height: 1;
}

.wig-header__logo a {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: var(--wig-color-heading);
}

.wig-header__logo img,
.wig-header__logo .custom-logo {
    max-width: var(--wig-logo-width, 180px);
    height: auto;
    display: block;
}

.wig-header__logo .site-title {
    font-family: var(--wig-font-display);
    font-size: clamp(16px, 2vw, 22px);
    font-weight: 700;
    color: var(--wig-color-heading);
    letter-spacing: -0.02em;
}

/* Primary nav region */
.wig-header__nav {
    flex: 1;
    display: flex;
    justify-content: center;
}

/* Header utility strip (search, auth, cart) */
.wig-header__utils {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: var(--wig-space-sm);
}

/* Auth / CTA buttons */
.wig-header__auth {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Search toggle */
.wig-search-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: var(--wig-color-text-muted);
    border-radius: var(--wig-radius-sm);
    transition: color var(--wig-dur) var(--wig-ease), background var(--wig-dur) var(--wig-ease);
    display: flex;
    align-items: center;
    justify-content: center;
}

.wig-search-toggle:hover {
    color: var(--wig-color-primary);
    background: var(--wig-color-primary-dim);
}

/* Cart icon */
.wig-cart-btn {
    position: relative;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: var(--wig-color-text-muted);
    border-radius: var(--wig-radius-sm);
    transition: color var(--wig-dur) var(--wig-ease);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.wig-cart-btn:hover { color: var(--wig-color-primary); }

.wig-cart-count {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--wig-color-primary);
    color: var(--wig-color-bg);
    font-size: 10px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0 3px;
}

/* Hamburger (hidden desktop) */
.wig-header__hamburger {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 24px;
    height: 18px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    color: var(--wig-color-text);
}

.wig-header__hamburger span {
    display: block;
    width: 100%;
    height: 2px;
    background: currentColor;
    border-radius: 1px;
    transition: transform 0.25s ease, opacity 0.25s ease;
    transform-origin: center;
}

.wig-header--open .wig-header__hamburger span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.wig-header--open .wig-header__hamburger span:nth-child(2) { opacity: 0; }
.wig-header--open .wig-header__hamburger span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

/* ── Topbar ──────────────────────────────────────────────── */
.wig-topbar {
    background: var(--wig-color-bg-alt);
    border-bottom: 1px solid var(--wig-color-border);
    font-size: 12px;
    height: 36px;
    display: flex;
    align-items: center;
}

.wig-topbar__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.wig-topbar__text { color: var(--wig-color-text-muted); }

.wig-topbar__links {
    display: flex;
    align-items: center;
    gap: 16px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.wig-topbar__links a {
    color: var(--wig-color-text-muted);
    text-decoration: none;
    transition: color var(--wig-dur) var(--wig-ease);
}

.wig-topbar__links a:hover { color: var(--wig-color-primary); }

/* ── Primary navigation ─────────────────────────────────── */
.wig-nav {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 4px;
}

.wig-nav__item {
    position: relative;
}

.wig-nav__link {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    font-family: var(--wig-font-ui);
    font-size: 14px;
    font-weight: 500;
    color: var(--wig-color-text);
    text-decoration: none;
    border-radius: var(--wig-radius-sm);
    transition: color var(--wig-dur) var(--wig-ease), background var(--wig-dur) var(--wig-ease);
    white-space: nowrap;
}

.wig-nav__link:hover,
.wig-nav__item.current-menu-item > .wig-nav__link,
.wig-nav__item.current-menu-ancestor > .wig-nav__link {
    color: var(--wig-color-primary);
}

/* Dropdown caret */
.wig-nav__item.menu-item-has-children > .wig-nav__link::after {
    content: "";
    display: inline-block;
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid currentColor;
    margin-left: 2px;
    transition: transform var(--wig-dur) var(--wig-ease);
}

.wig-nav__item.menu-item-has-children:hover > .wig-nav__link::after {
    transform: rotate(180deg);
}

/* Standard dropdown */
.wig-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 200px;
    background: var(--wig-color-bg-card);
    border: 1px solid var(--wig-color-border);
    border-radius: var(--wig-radius);
    box-shadow: var(--wig-shadow);
    list-style: none;
    margin: 0;
    padding: 8px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity var(--wig-dur) var(--wig-ease), visibility var(--wig-dur), transform var(--wig-dur) var(--wig-ease);
    z-index: 300;
}

.wig-nav__item:hover > .wig-dropdown,
.wig-nav__item:focus-within > .wig-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.wig-dropdown li {
    list-style: none;
}

.wig-dropdown a {
    display: block;
    padding: 8px 16px;
    font-size: 13px;
    color: var(--wig-color-text);
    text-decoration: none;
    transition: color var(--wig-dur) var(--wig-ease), background var(--wig-dur) var(--wig-ease);
}

.wig-dropdown a:hover {
    color: var(--wig-color-primary);
    background: var(--wig-color-bg-alt);
}

/* ── Mobile navigation ───────────────────────────────────── */
.wig-mobile-nav {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(320px, 90vw);
    background: var(--wig-color-bg-card);
    border-left: 1px solid var(--wig-color-border);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 500;
    overflow-y: auto;
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
}

.wig-mobile-nav.is-open {
    transform: translateX(0);
}

.wig-mobile-nav__close {
    align-self: flex-end;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--wig-color-text);
    padding: 4px;
    margin-bottom: 20px;
}

.wig-mobile-nav__list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.wig-mobile-nav__list li {
    border-bottom: 1px solid var(--wig-color-border);
}

.wig-mobile-nav__list a {
    display: block;
    padding: 12px 4px;
    font-size: 15px;
    font-weight: 500;
    color: var(--wig-color-text);
    text-decoration: none;
    transition: color var(--wig-dur) var(--wig-ease);
}

.wig-mobile-nav__list a:hover { color: var(--wig-color-primary); }

.wig-mobile-nav__list .sub-menu {
    list-style: none;
    padding-left: 16px;
    margin: 0;
}

.wig-mobile-nav__list .sub-menu a {
    font-size: 13px;
    padding: 8px 4px;
    color: var(--wig-color-text-muted);
}

/* Mobile nav backdrop */
.wig-nav-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 499;
}

.wig-nav-backdrop.is-open { display: block; }

/* ── Inline search bar (header) ──────────────────────────── */
.wig-header-search {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--wig-color-bg-card);
    border-bottom: 1px solid var(--wig-color-border);
    padding: 16px;
    transform: scaleY(0);
    transform-origin: top;
    opacity: 0;
    transition: transform 0.2s ease, opacity 0.2s ease;
    z-index: 199;
}

.wig-header-search.is-open {
    transform: scaleY(1);
    opacity: 1;
}

.wig-header-search input[type="search"] {
    width: 100%;
    padding: 10px 16px;
    font-size: 16px;
    background: var(--wig-color-bg);
    border: 1px solid var(--wig-color-border);
    border-radius: var(--wig-radius);
    color: var(--wig-color-text);
    outline: none;
}

.wig-header-search input[type="search"]:focus {
    border-color: var(--wig-color-primary);
}

/* ── Footer shell ────────────────────────────────────────── */
#wig-footer,
.wig-footer {
    flex-shrink: 0;
    background: var(--wig-color-footer-bg, var(--wig-color-bg));
    border-top: 1px solid var(--wig-color-border);
    color: var(--wig-color-footer-text, var(--wig-color-text-muted));
    font-size: 13px;
}

.wig-footer__widgets {
    padding: var(--wig-footer-pt, 60px) 0 var(--wig-footer-pb, 40px);
}

.wig-footer__widget-row {
    display: grid;
    grid-template-columns: repeat(var(--wig-footer-cols, 4), 1fr);
    gap: var(--wig-space-lg);
}

.wig-footer__widget-area .widget-title {
    font-family: var(--wig-font-ui);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--wig-color-text-dim);
    margin: 0 0 14px;
}

.wig-footer__widget-area .widget ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.wig-footer__widget-area .widget ul li {
    margin-bottom: 6px;
}

.wig-footer__widget-area .widget a {
    color: var(--wig-color-footer-text, var(--wig-color-text-muted));
    text-decoration: none;
    transition: color var(--wig-dur) var(--wig-ease);
}

.wig-footer__widget-area .widget a:hover { color: var(--wig-color-primary); }

/* Bottom bar */
.wig-footer__bar {
    border-top: 1px solid var(--wig-color-border);
    padding: 16px 0;
}

.wig-footer__bar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.wig-footer__copyright { color: var(--wig-color-text-dim); }

.wig-footer__bar-nav {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 16px;
}

.wig-footer__bar-nav a {
    color: var(--wig-color-text-dim);
    text-decoration: none;
    transition: color var(--wig-dur) var(--wig-ease);
}

.wig-footer__bar-nav a:hover { color: var(--wig-color-primary); }

/* Social icons row */
.wig-social-links {
    display: flex;
    align-items: center;
    gap: 10px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.wig-social-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--wig-color-bg-alt);
    border: 1px solid var(--wig-color-border);
    border-radius: 50%;
    color: var(--wig-color-text-muted);
    text-decoration: none;
    font-size: 14px;
    transition: background var(--wig-dur) var(--wig-ease), color var(--wig-dur) var(--wig-ease), border-color var(--wig-dur) var(--wig-ease);
}

.wig-social-links a:hover {
    background: var(--wig-color-primary);
    border-color: var(--wig-color-primary);
    color: var(--wig-color-bg);
}

/* ── Pre-footer CTA strip ────────────────────────────────── */
.wig-footer-cta {
    background: var(--wig-color-primary);
    padding: 40px 0;
    text-align: center;
}

.wig-footer-cta__title {
    font-family: var(--wig-font-display);
    font-size: clamp(20px, 3vw, 32px);
    font-weight: 700;
    color: var(--wig-color-bg);
    margin: 0 0 12px;
}

.wig-footer-cta__subtitle {
    font-size: 15px;
    color: rgba(0,0,0,0.65);
    margin: 0 0 24px;
}

/* ── Breadcrumbs ─────────────────────────────────────────── */
.wig-breadcrumbs {
    font-size: 12px;
    padding: 10px 0;
    color: var(--wig-color-text-dim);
}

.wig-breadcrumbs__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
}

.wig-breadcrumbs__sep {
    color: var(--wig-color-text-dim);
    margin: 0 2px;
}

.wig-breadcrumbs a {
    color: var(--wig-color-text-muted);
    text-decoration: none;
    transition: color var(--wig-dur) var(--wig-ease);
}

.wig-breadcrumbs a:hover { color: var(--wig-color-primary); }

/* ── Skip link ───────────────────────────────────────────── */
.skip-link {
    position: absolute;
    top: -40px;
    left: 16px;
    background: var(--wig-color-primary);
    color: var(--wig-color-bg);
    padding: 8px 16px;
    border-radius: 0 0 var(--wig-radius-sm) var(--wig-radius-sm);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    z-index: 9999;
    transition: top 0.1s;
}

.skip-link:focus { top: 0; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
    .wig-header__nav { display: none; }
    .wig-header__hamburger { display: flex; }

    .wig-footer__widget-row {
        grid-template-columns: repeat(min(var(--wig-footer-cols, 4), 2), 1fr);
    }

    .wig-footer__bar-inner {
        flex-direction: column;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .wig-footer__widget-row {
        grid-template-columns: 1fr;
    }
}
