/*
 * Mobile-first responsive styles are at the bottom of this file.
 * Search for: MOBILE RESPONSIVE
 */

/*
Theme Name: Republics Of Earth
Theme URI: https://republicofearth.com
Description: Child theme for People's Republics Of Earth print-on-demand store. Built on Twenty Twenty-Four.
Author: Republics Of Earth
Template: twentytwentyfour
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: roe-child
Tags: e-commerce, woocommerce, print-on-demand
*/

/* =============================================================================
   RESET & HIDE UNUSED WORDPRESS ELEMENTS
============================================================================= */

/* Hide WooCommerce mini-cart and My Account block (not used in this store) */
.wp-block-woocommerce-mini-cart,
.wp-block-woocommerce-customer-account,
.site-header .mini-cart,
.header-cart-link {
    display: none !important;
}

/* Mobile-only cart icon — hidden on desktop, shown via mobile media query below */
.roe-mobile-cart {
    display: none;
}

/* Hide the flex container that holds those blocks in the header */
.wp-block-group.is-nowrap.is-layout-flex.wp-container-core-group-is-layout-2 {
    display: none !important;
}

/* Hide comments / pingbacks (not relevant to a store) */
.wp-block-comments,
#comments {
    display: none !important;
}

/* Hide post navigation links on product pages */
.wp-block-post-navigation-link {
    display: none !important;
}

/* =============================================================================
   PRODUCT PAGE — MOCKUP PREVIEW
============================================================================= */

/* Preview now lives in the WC product gallery image — this div is hidden */
#roe-mockup-preview {
    display: none;
}

/* Hint text injected between the republic name input and the Create button */
.roe-republic-hint {
    margin: 0.4rem 0 0.75rem;
    font-size: 0.85rem;
    color: #888;
}

/* Spinner shown while new preview loads */
.roe-mockup-spinner {
    display: inline-block;
    width: 28px;
    height: 28px;
    border: 3px solid rgba(0,0,0,0.12);
    border-top-color: #333;
    border-radius: 50%;
    animation: roe-spin 0.7s linear infinite;
    margin-right: 0.5rem;
    vertical-align: middle;
}

@keyframes roe-spin {
    to { transform: rotate(360deg); }
}

/* =============================================================================
   WAPF FIELD STYLING
============================================================================= */

/* Style the republic name input to match store identity */
.wapf .wapf-input[name*="republic"],
.wapf input[data-field-id] {
    width: 100%;
    padding: 0.6rem 0.8rem;
    font-size: 1rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    transition: border-color 0.2s;
}

.wapf .wapf-input[name*="republic"]:focus,
.wapf input[data-field-id]:focus {
    border-color: #333;
    outline: none;
    box-shadow: 0 0 0 2px rgba(0,0,0,0.08);
}

/* =============================================================================
   RELATED PRODUCTS — LIVE PREVIEW THUMBNAILS
============================================================================= */

/* Mark related product thumbnails that should mirror the live preview */
.related .roe-related-preview-img,
.upsells .roe-related-preview-img {
    transition: opacity 0.3s ease;
}

.related .roe-related-preview-img.is-updating,
.upsells .roe-related-preview-img.is-updating {
    opacity: 0.4;
}

/* =============================================================================
   CREATIVE GALLERY PAGE
============================================================================= */

.roe-gallery-wrap {
    padding: 0 2rem;
}

.roe-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.25rem;
    padding: 2rem 0;
}

.roe-gallery-item {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.roe-gallery-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.13);
}

.roe-gallery-item img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    display: block;
}

.roe-gallery-item-meta {
    padding: 1rem 1.2rem;
}

.roe-gallery-item-meta h3 {
    margin: 0 0 0.3rem;
    font-size: 1rem;
    font-weight: 600;
}

.roe-gallery-item-meta .roe-gallery-date {
    font-size: 0.82rem;
    color: #888;
}

.roe-gallery-like {
    display: inline-block;
    margin-top: 0.6rem;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: #cc0000;
    text-decoration: none;
    text-transform: uppercase;
}

.roe-gallery-like:hover {
    text-decoration: underline;
}

.roe-gallery-empty {
    text-align: center;
    padding: 4rem 2rem;
    color: #888;
    font-size: 1.1rem;
}

/* Pagination */
.roe-gallery-pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 2rem;
}

.roe-gallery-pagination a,
.roe-gallery-pagination span {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-decoration: none;
    color: #333;
    font-size: 0.9rem;
}

.roe-gallery-pagination .current {
    background: #111;
    color: #fff;
    border-color: #111;
}

/* =============================================================================
   MOBILE RESPONSIVE — max-width: 768px
============================================================================= */

@media (max-width: 768px) {

    /* -------------------------------------------------------------------------
       HEADER — compact on mobile
    ------------------------------------------------------------------------- */

    /* The WC Essential Header block has inline padding:40px — override it */
    .wc-blocks-pattern-header-essential,
    .wc-blocks-header-pattern {
        padding: 8px 12px !important;
    }

    /* Footer also has inline padding:40px — compact on mobile */
    .wc-blocks-pattern-footer-with-3-menus,
    .wc-blocks-footer-pattern {
        padding: 16px 12px !important;
    }

    /* Reduce logo to a compact icon — the block has no inline size so CSS wins */
    .wp-block-site-logo {
        max-width: 36px !important;
        line-height: 0;
    }

    .wp-block-site-logo img,
    .wp-block-site-logo a {
        width: 36px !important;
        height: 36px !important;
        max-width: 36px !important;
        max-height: 36px !important;
        object-fit: contain;
    }

    /* -------------------------------------------------------------------------
       MOBILE CART ICON (injected via PHP into wp_footer)
       Positioned to sit to the left of the hamburger in the compact header.
    ------------------------------------------------------------------------- */

    .roe-mobile-cart {
        position: fixed;
        top: 8px;
        right: 3.5rem;   /* sits just left of the hamburger (~12px from edge) */
        z-index: 99999;
        display: flex;
        align-items: center;
        justify-content: center;
        color: #111;
        text-decoration: none;
    }

    .roe-mobile-cart svg {
        width: 24px;
        height: 24px;
        display: block;
    }

    .roe-mobile-cart-count {
        position: absolute;
        top: -5px;
        right: -7px;
        background: #cc0000;
        color: #fff;
        border-radius: 50%;
        width: 16px;
        height: 16px;
        font-size: 10px;
        font-weight: 700;
        display: flex;
        align-items: center;
        justify-content: center;
        line-height: 1;
    }

    /* -------------------------------------------------------------------------
       PRODUCT GALLERY
    ------------------------------------------------------------------------- */

    /* Cap the gallery height so the shirt image doesn't fill the entire screen */
    .woocommerce-product-gallery {
        margin-bottom: 0.5rem !important;
    }

    .woocommerce-product-gallery .flex-viewport {
        max-height: 52vw !important;
    }

    .woocommerce-product-gallery .woocommerce-product-gallery__image img {
        max-height: 52vw;
        width: auto;
        margin: 0 auto;
        object-fit: contain;
    }

    /* Hide thumbnail strip — saves vertical space */
    .woocommerce-product-gallery .flex-control-thumbs,
    .woocommerce-product-gallery .flex-control-nav {
        display: none !important;
    }

    /* -------------------------------------------------------------------------
       PRODUCT TITLE & CUSTOM FORM
    ------------------------------------------------------------------------- */

    /* Shrink the title — the template's inline <style> sets font-size:40px,
       so we need !important here to win the specificity battle */
    .wp-block-post-title,
    h1.product_title {
        font-size: 1.4rem !important;
        line-height: 1.15 !important;
        margin-bottom: 0.3rem !important;
    }

    /* Override inline style on #text input (template sets font-size:40px inline) */
    #text {
        font-size: 1rem !important;
        padding: 0.7rem 0.8rem !important;
    }

    /* Tighten the custom #textForm spacing */
    #textForm {
        margin-bottom: 0.5rem;
    }

    .roe-republic-hint {
        margin: 0.2rem 0 0.4rem;
        font-size: 0.78rem;
    }

    /* Reduce Create button vertical padding */
    #textForm [type="submit"],
    #textForm button {
        padding: 0.6rem 1.5rem;
    }

    /* -------------------------------------------------------------------------
       PRODUCT SUMMARY — PRICE, VARIATIONS, ATC
    ------------------------------------------------------------------------- */

    /* Compact price */
    .woocommerce div.product p.price,
    .woocommerce div.product span.price {
        font-size: 1.1rem !important;
        margin: 0.4rem 0 !important;
    }

    /* Hide short description and post excerpt block — shown below price */
    .woocommerce-product-details__short-description,
    .woocommerce-product-details__short-description p,
    .wp-block-post-excerpt,
    .wp-block-post-excerpt p,
    .wp-block-post-excerpt__excerpt {
        display: none !important;
    }

    /* Variations table: full width, stacked */
    .variations_form table.variations {
        width: 100%;
    }

    .variations_form .value select,
    .variations_form select {
        width: 100%;
        font-size: 1rem;
        padding: 0.6rem 0.5rem;
    }

    /* Hide quantity spinner — custom shirts always ship as qty 1 */
    .single-product .quantity,
    .single-product form.cart .quantity,
    .woocommerce div.product form.cart .quantity {
        display: none !important;
    }

    /* Cart form: collapse grid to single column */
    .woocommerce div.product form.cart {
        display: block !important;
    }

    .woocommerce-variation-add-to-cart,
    .variations_button {
        display: block !important;
        width: 100% !important;
    }

    /* Add to Cart: full width, large tap target */
    .woocommerce div.product form.cart .single_add_to_cart_button {
        width: 100% !important;
        padding: 0.9rem 1rem !important;
        font-size: 1rem !important;
        margin-top: 0.5rem !important;
        box-sizing: border-box !important;
    }

    /* Google Pay / express checkout: full width */
    .wc-block-components-express-payment,
    .wc-block-components-express-payment__event-buttons {
        width: 100%;
    }

    /* Reduce woo tabs top margin */
    .woocommerce-tabs {
        margin-top: 1rem;
    }

    /* -------------------------------------------------------------------------
       RELATED PRODUCTS — hide on mobile (same 3 products, redundant + huge)
    ------------------------------------------------------------------------- */

    .wp-block-woocommerce-related-products {
        display: none !important;
    }

    /* -------------------------------------------------------------------------
       CREATIVE GALLERY — 2 columns on mobile
    ------------------------------------------------------------------------- */

    .roe-gallery-wrap {
        padding: 0 0.75rem;
    }

    .roe-gallery {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .roe-gallery-item-meta {
        padding: 0.6rem 0.75rem;
    }

    .roe-gallery-item-meta h3 {
        font-size: 0.78rem;
    }

    .roe-gallery-like {
        font-size: 0.72rem;
        margin-top: 0.3rem;
    }
}
