/**
 * GUN CLUB HQ: phone layout (2026-11-22)
 * =============================================================================
 * Tenant-owned, release-excluded (brand-*.css). Loaded by the header glob after
 * brand-30, before brand-90/95. Every rule sits inside a max-width query, so the
 * desktop page (1366) is untouched; the only all-width rules are the two broken
 * product thumbnails in the cart and checkout summary (they were broken on
 * desktop too).
 *
 * Why the specificity: professional-fixes.min.css loads AFTER the brand sheets
 * (async), and cart.php / checkout.php / product.php / search.php carry inline
 * <style> blocks in the body, so several platform rules win at equal weight.
 * Selectors below are made heavier on purpose; no platform file is edited.
 *
 * Measured offline (php-cli render + headless Chrome, 390x844) before this file:
 *   - cart: quantity box 36px wide with theme.css input padding 12px 16px, so
 *     the number was not visible; a tall product photo made a cart row 550px
 *   - checkout summary: the same photo ran 496px down over Shipping Method
 *   - category/search at 360px: one product per row (professional-fixes
 *     max-width:380px rule), a 25,000px page
 *   - product cards 469px tall for a 167px wide card; 11px buttons, 11.5px text
 *   - footer 2,726px tall (one column of links, trust badges 125px apart)
 *   - home: a second logo and wordmark under the header logo, value cards
 *     1,053px in one column
 *   - menu button fixed to the screen in TheGunDock red, floating over products
 * =============================================================================
 */

/* --------------------------------------------------------------------------
   0. ALL WIDTHS: product thumbnails in the cart and checkout summary.
   checkout.php asks for an 80x80 contained box and cart.php for a contained
   image, but professional-fixes forces img { height:auto !important }, so a
   tall photo (a pen, a rifle stood upright) ran the full height of the image.
   -------------------------------------------------------------------------- */
.order-summary .cart-item-summary .item-image { overflow: hidden; }
html body .order-summary .cart-item-summary .item-image img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain;
}
.cart-page .cart-items .cart-item .cart-item-image img {
    height: 80px !important;
    width: 100% !important;
    object-fit: contain;
}

/* ==========================================================================
   1. HEADER (phones and tablets, the same range the header's own rules use)
   ========================================================================== */
@media (max-width: 900px) {
    /* The menu button sat position:fixed in TheGunDock red (#c41e3a, inline in
       header.php) and floated over every product card while scrolling. It now
       sits in the header row beside the account and cart buttons, same size and
       shape, in the logo charcoal. */
    .site-header { position: relative; }
    html body .site-header #mobileMenuBtn.mobile-menu-toggle {
        position: absolute !important;
        top: 10px !important;
        top: calc(10px + env(safe-area-inset-top, 0px)) !important;
        right: 10px !important;
        right: calc(10px + env(safe-area-inset-right, 0px)) !important;
        z-index: 1002 !important;
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
        min-height: 44px !important;
        padding: 0 !important;
        border-radius: 8px !important;
        background: var(--gc-ink) !important;
        box-shadow: none !important;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        transform: none !important;
    }
    html body .site-header #mobileMenuBtn .hamburger-line {
        width: 20px !important;
        margin: 2px 0 !important;
    }
    html body .site-header #mobileMenuBtn .menu-label { display: none !important; }
    /* Open drawer: the close (X) state stays reachable on top of the drawer. */
    html body.tgd-menu-open .site-header #mobileMenuBtn.mobile-menu-toggle {
        position: fixed !important;
        background: var(--gc-orange-deep) !important;
    }
}

/* ==========================================================================
   2. PRODUCT GRIDS: category, search, brand, caliber pages (phones)
   ========================================================================== */
@media (max-width: 600px) {
    /* Two per row down to 320px. professional-fixes drops to ONE column below
       381px (body .products-grid { 1fr !important }), which made a 360px Android
       phone scroll past 48 full-width cards. */
    html body .products-grid,
    html body .products-grid-4col {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 10px !important;
    }

    html body .product-card { padding: 0 !important; }
    html body .product-card .product-image {
        aspect-ratio: 1 / 1;
        height: auto !important;
        min-height: 0 !important;
        padding: 8px !important;
    }
    html body .product-card .product-info { padding: 10px 10px 8px !important; }
    html body .product-card .product-title {
        font-size: 14px !important;
        line-height: 1.3 !important;
        margin-bottom: 4px !important;
    }
    html body .product-card .product-brand {
        font-size: 12px !important;
        margin-bottom: 4px !important;
    }
    html body .product-card .product-caliber {
        font-size: 13px !important;
        margin-bottom: 4px !important;
    }
    html body .product-card .product-price {
        margin: 6px 0 0 !important;
        padding-top: 8px !important;
        font-size: 18px !important;
    }
    html body .product-card .btn,
    html body .product-card .add-to-cart,
    html body .product-card a.btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: calc(100% - 16px) !important;
        margin: 0 8px 8px !important;
        min-height: 44px !important;
        padding: 6px 8px !important;
        font-size: 14px !important;
        line-height: 1.15 !important;
        white-space: normal;
    }
    html body .product-card .map-badge { font-size: 11px !important; }

    /* Search page: the header already holds the query, so the second, larger
       search form above the results only pushed them 110px down. The category
       page's "Search within Handguns" stays. */
    html body .content-page .search-form-large:not(.search-within) { display: none !important; }

    /* Type / narrow-to chips: one swipeable row each instead of 4-6 wrapped rows. */
    html body .search-cat-chips {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        gap: 8px;
        padding-bottom: 4px;
        margin-right: -12px;
    }
    html body .search-cat-chips::-webkit-scrollbar { display: none; }
    html body .search-cat-chips > * { flex: 0 0 auto; }
    html body .search-cat-chips .cat-chip {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        white-space: nowrap;
        font-size: 14px !important;
    }

    /* Filters button: brand charcoal instead of TheGunDock red (search.php inline). */
    html body .sr-mobilebar .sr-filter-btn { background: var(--gc-ink) !important; }

    html body .pagination-btn { min-width: 44px !important; min-height: 44px !important; }
}

/* ==========================================================================
   3. PRODUCT PAGE (phones)
   ========================================================================== */
@media (max-width: 600px) {
    /* Photos: one swipeable row of thumbnails, then videos in one row, so the
       title and price are not 780px down the page. */
    html body .product-images-section .thumbnail-gallery {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto;
        gap: 8px !important;
        scrollbar-width: none;
    }
    html body .product-images-section .thumbnail-gallery::-webkit-scrollbar { display: none; }
    html body .product-images-section .thumbnail-gallery .thumbnail {
        flex: 0 0 64px !important;
        width: 64px !important;
        height: 64px !important;
    }
    html body .product-images-section .video-thumbnails-grid {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto;
        gap: 8px !important;
        scrollbar-width: none;
    }
    html body .product-images-section .video-thumbnails-grid::-webkit-scrollbar { display: none; }
    html body .product-images-section .video-thumbnails-grid > * { flex: 0 0 120px !important; }

    html body .product-info-section .product-title {
        font-size: 24px !important;
        line-height: 1.2 !important;
    }
    /* Price and Add to Cart before the share buttons. */
    html body .product-info-section .product-share { order: 20; }
    html body .product-info-section .action-link {
        min-height: 44px;
        align-items: center;
    }

    /* Docked bar: the page's own Add to Cart colour, not TheGunDock red. */
    html body .pdp-stickybar .psb-btn { background: var(--gc-orange-deep) !important; }
}

/* ==========================================================================
   4. CART (phones): the quantity box and the Remove button
   ========================================================================== */
@media (max-width: 600px) {
    /* theme.css gives every input padding 12px 16px; in a 36px box that left
       4px for the digit, so the quantity could not be read. */
    .cart-page .cart-item .quantity-control button {
        width: 44px !important;
        height: 44px !important;
        font-size: 18px !important;
    }
    .cart-page .cart-item .quantity-control input {
        width: 44px !important;
        height: 44px !important;
        padding: 0 !important;
        font-size: 16px !important;
        border-top: 0 !important;
        border-bottom: 0 !important;
    }
    .cart-page .cart-item .cart-item-actions {
        flex-wrap: wrap;
        gap: 10px;
    }
    .cart-page .cart-item .qty-label { display: none; }
    .cart-page .cart-item .btn-remove {
        width: auto !important;
        padding: 0 10px !important;
        font-size: 14px !important;
    }
    .cart-page .cart-item .cart-item-brand,
    .cart-page .cart-item .cart-item-sku,
    .cart-page .cart-item .cart-item-unit-price { font-size: 13px !important; }
}

/* ==========================================================================
   5. HOMEPAGE (phones)
   ========================================================================== */
@media (max-width: 600px) {
    /* Hero: a bigger photo and no second logo (the header shows it 100px above). */
    .gc-hero4 { padding: 0 0 8px !important; }
    .gc-hero4 .gc-hero4__photo { height: auto !important; aspect-ratio: 16 / 10; }
    .gc-hero4 .gc-hero4__mark { display: none !important; }
    .gc-hero4 .gc-hero4__copy { padding: 16px 12px 18px !important; }

    .gc-trustrow { padding: 12px 12px !important; }
    .gc-trustrow .gc-trustrow__grid { padding: 6px 0 !important; }

    /* Licensed FFL Dealer / Secure Checkout / Name Brands / Expert Support:
       a 2 x 2 block instead of four full-width cards (1,053px). */
    .features-section { padding: 28px 12px !important; }
    .features-section .features-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 10px !important;
    }
    .features-section .features-grid .feature {
        padding: 14px 10px !important;
        min-height: 0 !important;
    }
    .features-section .features-grid .feature h3 { font-size: 16px !important; margin: 8px 0 4px !important; }
    .features-section .features-grid .feature p { font-size: 14px !important; line-height: 1.4 !important; margin: 0 !important; }
    .features-section .features-grid .feature svg,
    .features-section .features-grid .feature .feature-icon { margin-bottom: 0 !important; }
}

/* ==========================================================================
   6. FOOTER (phones): 2,726px of single-column links
   ========================================================================== */
@media (max-width: 600px) {
    html body .site-footer { padding-top: 32px !important; margin-top: 32px !important; }
    html body .site-footer .footer-row {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        column-gap: 16px !important;
        row-gap: 24px !important;
        margin-bottom: 16px !important;
    }
    html body .site-footer .footer-row > .footer-col-about { grid-column: 1 / -1; }
    html body .site-footer .footer-heading,
    html body .site-footer h2.footer-heading,
    html body .site-footer h3.footer-heading {
        font-size: 12px !important;
        margin-bottom: 8px !important;
    }
    html body .site-footer .footer-col ul li { margin: 0 !important; }
    html body .site-footer .footer-col ul li a {
        display: flex !important;
        align-items: center;
        min-height: 44px;
        padding: 0 !important;
        font-size: 14px !important;
        line-height: 1.25 !important;
    }
    html body .site-footer .footer-trust-row {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px !important;
        padding: 12px 0 !important;
        margin: 8px 0 !important;
    }
    html body .site-footer .footer-trust-row .trust-badge {
        padding: 10px 6px !important;
        margin: 0 !important;
        min-height: 0 !important;
    }
    html body .site-footer .legal-notice,
    html body .site-footer .payment-label { font-size: 13px !important; }
}

/* ==========================================================================
   7. SLIM TOP BAR (phones and tablets): assets/js/gc-stickybar.js
   The header and its menu button scroll away (section 1). Once the header is
   out of view this 56px bar slides in with the logo mark, search, cart (with
   its count) and the menu, all 44px targets. position:fixed + transform, so
   it never moves the page. The category/search Filters bar and any sticky
   sidebar move down below it; the product page's docked Add to Cart is at
   the bottom of the screen and does not meet it. Desktop (901px+) never
   shows it: there the header has its own full navigation.
   ========================================================================== */
.gc-stickybar { display: none; }
@media (max-width: 900px) {
    :root { --gc-bar-h: calc(56px + env(safe-area-inset-top, 0px)); }
    .gc-stickybar {
        display: flex;
        align-items: center;
        gap: 8px;
        position: fixed;
        top: 0; left: 0; right: 0;
        z-index: 1001;                 /* under the menu drawer and the filter drawer, over page content */
        box-sizing: border-box;
        height: var(--gc-bar-h);
        padding: env(safe-area-inset-top, 0px) calc(10px + env(safe-area-inset-right, 0px)) 0 calc(10px + env(safe-area-inset-left, 0px));
        background: #fff;
        border-bottom: 1px solid var(--gc-line, #DCD8D0);
        box-shadow: 0 2px 10px rgba(34, 38, 42, .10);
        transform: translateY(-100%);
        visibility: hidden;
        transition: transform .18s ease-out, visibility 0s linear .18s;
    }
    html.gc-bar-on .gc-stickybar {
        transform: none;
        visibility: visible;
        transition: transform .18s ease-out;
    }
    /* the drawer covers the screen; the bar stays out of its way */
    body.tgd-menu-open .gc-stickybar { visibility: hidden; }

    .gc-stickybar__home {
        display: flex;
        align-items: center;
        gap: 8px;
        min-height: 44px;
        margin-right: auto;
        text-decoration: none;
        color: var(--gc-ink, #22262A);
    }
    .gc-stickybar__home img { width: 31px; height: 36px; display: block; max-width: none !important; }
    .gc-stickybar__name {
        font-family: var(--gc-display, 'Roboto Condensed', Arial, sans-serif);
        font-weight: 800;
        font-size: 18px;
        letter-spacing: .02em;
        line-height: 1;
        white-space: nowrap;
    }
    .gc-stickybar__btn {
        position: relative;
        display: inline-flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        flex: 0 0 44px;
        width: 44px;
        height: 44px;
        min-width: 44px !important;
        min-height: 44px !important;
        padding: 0 !important;
        margin: 0;
        border: 0;
        border-radius: 8px;
        cursor: pointer;
        text-decoration: none;
        -webkit-tap-highlight-color: transparent;
    }
    .gc-stickybar__search { background: var(--gc-bone, #F4F2ED); color: var(--gc-ink, #22262A); border: 1px solid var(--gc-line, #DCD8D0); }
    .gc-stickybar__cart { background: var(--gc-orange, #F26A1B); color: #fff; }
    .gc-stickybar__menu { background: var(--gc-ink, #22262A); }
    .gc-stickybar__menu span {
        display: block;
        width: 20px;
        height: 2.5px;
        margin: 2px 0;
        border-radius: 2px;
        background: #fff;
    }
    .gc-stickybar__count {
        position: absolute;
        top: -5px;
        right: -5px;
        min-width: 20px;
        height: 20px;
        padding: 0 5px;
        box-sizing: border-box;
        border-radius: 10px;
        border: 2px solid #fff;
        background: var(--gc-ink, #22262A);
        color: #fff;
        font: 700 11px/16px var(--gc-ui, Arial, sans-serif);
        text-align: center;
    }
    .gc-stickybar__count[hidden] { display: none; }
    .gc-stickybar__btn:focus-visible,
    .gc-stickybar__home:focus-visible { outline: 3px solid var(--gc-orange, #F26A1B); outline-offset: 2px; }

    /* Things that stick to the top move below the bar while it shows. */
    html.gc-bar-on .sr-mobilebar { top: var(--gc-bar-h) !important; }
    html.gc-bar-on .checkout-sidebar,
    html.gc-bar-on .cart-summary { top: calc(var(--gc-bar-h) + 8px) !important; }
    /* In-page jumps (product tabs, FAQ, form errors) land below the bar. */
    html { scroll-padding-top: calc(var(--gc-bar-h) + 8px); }
}
@media (max-width: 340px) {
    .gc-stickybar__name { display: none; }   /* 320-340px: mark only, so the three 44px buttons keep their room */
}
@media (prefers-reduced-motion: reduce) {
    .gc-stickybar, html.gc-bar-on .gc-stickybar { transition: none; }
}
