/*
 * PNIDesign — Responsive / Mobile Stylesheet
 * Applied after all other CSS. Fixes layout at every breakpoint.
 * v4.5.0
 */

/* ═══════════════════════════════════════════════
   0. GLOBAL OVERFLOW GUARD
   ═══════════════════════════════════════════════ */
html, body {
    overflow-x: hidden;
    max-width: 100%;
}
*,
*::before,
*::after {
    box-sizing: border-box;
}
img, video, iframe, embed, object {
    max-width: 100%;
    height: auto;
}

/* ═══════════════════════════════════════════════
   1. ANNOUNCEMENT BAR
   ═══════════════════════════════════════════════ */
.pni-announcement-bar {
    padding: 8px 3rem 8px 1rem; /* room for close btn */
    font-size: 0.78rem;
    line-height: 1.5;
    text-align: center;
}
.pni-announcement-bar .pni-container {
    padding-right: 0;
    max-width: 100%;
}
@media (max-width: 480px) {
    .pni-announcement-bar { font-size: 0.72rem; padding: 7px 2.5rem 7px 0.75rem; }
}

/* ═══════════════════════════════════════════════
   2. HEADER — mobile layout
   (breakpoint rules live in header.css to avoid conflicts)
   ═══════════════════════════════════════════════ */

/* Global: header overflow handled per-axis — do NOT set overflow-x here
   because overflow-x:hidden on a positioned ancestor implicitly creates a
   new overflow context that clips the absolute-positioned dropdown. */

/* ═══════════════════════════════════════════════
   3. MOBILE NAV
   ═══════════════════════════════════════════════ */

/* Ensure WP-generated <a> tags inside the mobile nav list are always visible */
.pni-mobile-nav__list li a,
.pni-mobile-nav__link {
    color: var(--pni-text-primary, #1C0F15) !important;
    display: flex !important;
    align-items: center !important;
    padding: 0.9rem 0 !important;
    font-size: 1rem !important;
    font-weight: 600 !important;
    border-bottom: 1px solid var(--pni-border, #E8D8E2) !important;
    text-decoration: none !important;
}
.pni-mobile-nav__list li a:hover,
.pni-mobile-nav__link:hover {
    color: var(--pni-gold, #C2578F) !important;
}
/* Sub-menu links */
.pni-mobile-nav__list li ul a,
.pni-mobile-nav__sublink {
    color: var(--pni-text-secondary, #5C3D4D) !important;
    font-size: 0.9rem !important;
    font-weight: 500 !important;
    padding: 0.5rem 0 0.5rem 1rem !important;
    border-bottom: none !important;
    display: block !important;
}

@media (max-width: 900px) {
    .pni-mobile-nav {
        width: min(320px, 85vw);
    }
    .pni-mobile-nav__header {
        padding: 1rem 1.25rem;
    }
    .pni-mobile-nav__body {
        padding: 0 1.25rem 2rem;
    }
}

/* ═══════════════════════════════════════════════
   4. SHOP / ARCHIVE PAGE
   ═══════════════════════════════════════════════ */

/* Prevent any child from causing horizontal scroll */
.pni-shop-page,
.pni-shop-wrap,
.pni-shop-layout,
.pni-shop-main,
.pni-products-grid {
    max-width: 100%;
    overflow-x: hidden;
}

/* Shop hero */
@media (max-width: 768px) {
    .pni-shop-hero { padding: 2.5rem 0 2rem; }
    .pni-shop-hero-inner,
    .pni-shop-hero .pni-container { padding: 0 1rem; }
    .pni-shop-hero h1 { font-size: clamp(1.6rem, 6vw, 2.2rem); }
    .pni-shop-hero p  { font-size: 0.85rem; margin-bottom: 1.2rem; }
    .pni-shop-hero-cats,
    .pni-shop-hero-cat-wrap { gap: 0.35rem; }
    .pni-shop-hero-cat,
    .pni-shero-cat { font-size: 0.72rem; padding: 0.35rem 0.9rem; }
}

/* Shop wrap padding */
@media (max-width: 1024px) {
    .pni-shop-wrap   { padding: 0 1.25rem; }
    .pni-shop-layout { grid-template-columns: 1fr !important; }
    .pni-shop-sidebar { position: static !important; }
}
@media (max-width: 768px) {
    .pni-shop-wrap   { padding: 0 1rem; }
}
@media (max-width: 480px) {
    .pni-shop-wrap   { padding: 0 0.75rem; }
}

/* Sidebar collapsible on mobile */
@media (max-width: 1024px) {
    .pni-shop-sidebar {
        display: none; /* hidden by default; toggled via JS */
        border-radius: 16px;
        overflow: hidden;
    }
    .pni-shop-sidebar.is-open { display: flex; flex-direction: column; gap: 0.75rem; }
    /* Show a filter toggle button */
    .pni-filter-toggle {
        display: inline-flex !important;
    }
}
@media (min-width: 1025px) {
    .pni-filter-toggle { display: none !important; }
}

/* Toolbar */
@media (max-width: 640px) {
    .pni-shop-toolbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        padding: 0.75rem;
    }
    .pni-shop-toolbar-right { width: 100%; display: flex; justify-content: space-between; }
    .pni-sort-select { width: 100%; }
}

/* Product grid — responsive columns */
.pni-products-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(230px, calc(50% - 0.7rem)), 1fr)) !important;
}
@media (max-width: 900px) {
    .pni-products-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem !important;
    }
}
/* ─── Product card button fixes: mobile (2-col grid, ~160-200px wide cards) ─── */
@media (max-width: 600px) {

    /* Homepage card footer: stack price above button instead of side-by-side */
    .pni-product-card__footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    .pni-product-card__buy-btn {
        width: 100%;
        text-align: center;
        padding: 6px 8px;
        font-size: 0.68rem;
        white-space: normal;
        flex-shrink: unset;
    }

}

@media (max-width: 400px) {
    .pni-products-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.6rem !important;
    }
    .pni-product-card__body { padding: 0.75rem 0.65rem; }
    .pni-product-card__name { font-size: 0.78rem; }
    .pni-product-card__price { font-size: 0.8rem; }
    .pni-product-card__buy-btn { font-size: 0.65rem; padding: 5px 6px; }
    .pni-pcard-btn { font-size: 0.65rem; padding: 5px 6px; }
}

/* ═══════════════════════════════════════════════
   5. SINGLE PRODUCT PAGE
   ═══════════════════════════════════════════════ */
@media (max-width: 768px) {
    .woocommerce div.product {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
    }
    .woocommerce div.product div.images {
        position: static !important;
    }
    .woocommerce div.product .woocommerce-tabs ul.tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
    }
    .woocommerce div.product .woocommerce-tabs ul.tabs li a {
        white-space: nowrap;
        padding: 0.75rem 1rem;
    }
}
@media (max-width: 480px) {
    .pni-wc-wrapper { padding: 1rem 0 2rem; }
}

/* ═══════════════════════════════════════════════
   6. HOMEPAGE / FRONT-PAGE SECTIONS
   ═══════════════════════════════════════════════ */
.pni-fp-container,
.pni-fp-section .pni-container,
.wrap,
.pni-wrap {
    padding-left:  clamp(0.75rem, 4vw, 2.5rem);
    padding-right: clamp(0.75rem, 4vw, 2.5rem);
}

/* 2-col → 1-col */
@media (max-width: 768px) {
    .pni-fp-grid-2 { grid-template-columns: 1fr !important; gap: 1.5rem !important; }
}
/* 3-col → 2-col → 1-col */
@media (max-width: 900px) {
    .pni-fp-grid-3 { grid-template-columns: repeat(2, 1fr) !important; }
}
@media (max-width: 560px) {
    .pni-fp-grid-3 { grid-template-columns: 1fr !important; }
}
/* 4-col → 2-col */
@media (max-width: 900px) {
    .pni-fp-grid-4 { grid-template-columns: repeat(2, 1fr) !important; }
}
@media (max-width: 480px) {
    .pni-fp-grid-4 { grid-template-columns: repeat(2, 1fr) !important; gap: 0.75rem !important; }
}

/* Hero section */
@media (max-width: 768px) {
    .pni-hero { min-height: auto !important; padding: 3rem 0 2.5rem !important; }
    .pni-hero__title { font-size: clamp(1.8rem, 7vw, 2.8rem) !important; }
    .pni-hero__subtitle { font-size: 0.9rem !important; }
    .pni-hero__actions { flex-direction: column; align-items: center; gap: 0.75rem; }
    .pni-hero__actions .pni-btn { width: 100%; max-width: 280px; justify-content: center; }
}

/* Section headings */
@media (max-width: 768px) {
    .pni-section-header h2,
    .pni-fp-section h2 { font-size: clamp(1.4rem, 5vw, 2rem) !important; }
    .pni-section { padding: 2.5rem 0 !important; }
    .pni-section--lg { padding: 3rem 0 !important; }
}

/* ═══════════════════════════════════════════════
   7. CART DRAWER
   ═══════════════════════════════════════════════ */
@media (max-width: 480px) {
    .pni-cart-drawer { width: 100vw !important; }
    .pni-cart-drawer__header { padding: 1rem; }
    .pni-cart-item { padding: 0.85rem 1rem; }
    .pni-cart-item__img { width: 60px !important; height: 60px !important; }
    .pni-cart-drawer__footer { padding: 1rem; }
}

/* ═══════════════════════════════════════════════
   8. WISHLIST PAGE
   ═══════════════════════════════════════════════ */
@media (max-width: 640px) {
    .pni-wl-hero { padding: 2rem 0 1.75rem; }
    .pni-wl-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 0.85rem !important; }
    .pni-wl-card__body { padding: 0.75rem; }
    .pni-wl-card__name { font-size: 0.78rem; }
    .pni-wl-card__price { font-size: 0.82rem; }
    .pni-wl-atc { font-size: 0.7rem; padding: 0.4rem 0.65rem; }
}
@media (max-width: 380px) {
    .pni-wl-grid { grid-template-columns: 1fr !important; }
}

/* ═══════════════════════════════════════════════
   9. MY ACCOUNT PAGE
   ═══════════════════════════════════════════════ */
@media (max-width: 900px) {
    .pni-account-wrap {
        grid-template-columns: 1fr !important;
        gap: 1.25rem !important;
        padding: 1.5rem 1rem !important;
    }
    .pni-account-sidebar { position: static !important; }
    /* Account nav: horizontal scroll row on mobile */
    .pni-account-nav { overflow-x: auto; white-space: nowrap; display: flex; padding: 0.5rem; }
    .pni-account-nav-item { display: inline-flex; border-left: none; border-bottom: 3px solid transparent; padding: 0.6rem 1rem; font-size: 0.78rem; }
    .pni-account-nav-item.active { border-left: none; border-bottom-color: #C35791; background: #F9EFF4; border-radius: 10px; }
}
@media (max-width: 640px) {
    .pni-orders-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .pni-address-grid { grid-template-columns: 1fr !important; }
    .pni-stats-grid   { grid-template-columns: repeat(2, 1fr) !important; }
}

/* ═══════════════════════════════════════════════
   10. LOGIN / AUTH FORM
   ═══════════════════════════════════════════════ */
@media (max-width: 480px) {
    .pni-auth-shell { padding: 1rem; }
    .pni-auth-card  { border-radius: 20px; }
    .pni-auth-perks { grid-template-columns: 1fr 1fr !important; gap: 0.5rem !important; }
}

/* ═══════════════════════════════════════════════
   11. FOOTER
   ═══════════════════════════════════════════════ */
@media (max-width: 768px) {
    .pni-footer__grid,
    .pni-footer .pni-grid,
    .pni-footer .pni-grid--4,
    .pni-footer .pni-grid--3 {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1.5rem !important;
    }
    .pni-footer { padding: 2.5rem 0 1.5rem; }
}
@media (max-width: 480px) {
    .pni-footer__grid,
    .pni-footer .pni-grid,
    .pni-footer .pni-grid--4,
    .pni-footer .pni-grid--3 {
        grid-template-columns: 1fr !important;
        gap: 1.25rem !important;
    }
    .pni-footer__brand { text-align: center; }
    .pni-footer__social { justify-content: center; }
}

/* ═══════════════════════════════════════════════
   12. WooCommerce GENERIC
   ═══════════════════════════════════════════════ */
@media (max-width: 768px) {
    /* Checkout */
    .woocommerce-checkout .col2-set { display: block !important; }
    .woocommerce-checkout .col2-set .col-1,
    .woocommerce-checkout .col2-set .col-2 { width: 100% !important; }
    /* Cart table */
    .woocommerce table.shop_table { font-size: 0.78rem; }
    .woocommerce table.shop_table td,
    .woocommerce table.shop_table th { padding: 0.6rem 0.5rem; }
    /* My account layout */
    .woocommerce-MyAccount-navigation { border-right: none; border-bottom: 1px solid var(--pni-border); padding-right: 0; padding-bottom: 1rem; margin-bottom: 1.5rem; }
    .woocommerce-MyAccount-navigation ul { flex-direction: row; flex-wrap: wrap; gap: 0.25rem; }
    .woocommerce-MyAccount-navigation ul a { padding: 0.4rem 0.75rem; font-size: 0.78rem; }
    .woocommerce-MyAccount-content { width: 100% !important; }
}

/* ═══════════════════════════════════════════════
   13. MISC UTILITIES
   ═══════════════════════════════════════════════ */

/* Toasts: full-width on small phones */
@media (max-width: 480px) {
    .pni-toast-container { bottom: 0; right: 0; left: 0; padding: 0; }
    .pni-toast { border-radius: 0; max-width: 100%; min-width: 100%; }
    .pni-order-toast { left: 0.75rem; right: 0.75rem; max-width: calc(100vw - 1.5rem); }
}

/* Back to top */
@media (max-width: 480px) {
    .pni-back-to-top { bottom: 1rem; right: 1rem; width: 36px; height: 36px; }
}

/* Sticky buy bar clears mobile nav bar */
@media (max-width: 768px) {
    .pni-sticky-buy-bar { padding-bottom: calc(0.9rem + env(safe-area-inset-bottom, 0px)); }
    body.single-product { padding-bottom: 74px; }
}

/* Recently viewed strip */
@media (max-width: 640px) {
    .pni-recently-viewed__strip { gap: 0.75rem; }
    .pni-mini-card { flex: 0 0 140px; }
}

/* Gift quiz */
@media (max-width: 480px) {
    .pni-gift-quiz { padding: 1.5rem 1rem; }
    .pni-quiz__options { grid-template-columns: 1fr 1fr !important; gap: 0.6rem; }
    .pni-quiz__results-grid { grid-template-columns: 1fr 1fr !important; gap: 0.75rem; }
}

/* Search overlay */
@media (max-width: 480px) {
    
    
}

/* Inline search dropdown: never overflow on small screens */
@media (max-width: 900px) {
    .pni-search-results { min-width: 0; width: 100%; }
}
