/*
Theme Name: Home Supplies
Theme URI: https://homesupplies.pk
Author: Home Supplies Team
Description: A lightweight, custom Block Theme for Home Supplies e-commerce store built on WordPress Full Site Editing (FSE) and WooCommerce.
Version: 1.2.0
Requires at least: 6.4
Tested up to: 6.7
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: home-supplies
Tags: e-commerce, full-site-editing, block-patterns, custom-colors, custom-logo, editor-style, featured-images, wide-blocks
*/

/* ============================================================
   GLOBAL RESETS & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

img { max-width: 100%; height: auto; }

a { transition: color 0.2s ease, opacity 0.2s ease; }

/* ============================================================
   FULL-WIDTH LAYOUT (bleed sections)
   ============================================================ */
.alignfull {
    width: 100vw;
    margin-left: calc(50% - 50vw);
}

/* ============================================================
   HEADER / NAVIGATION
   ============================================================ */
.wp-block-navigation__responsive-container-open,
.wp-block-navigation__responsive-container-close {
    border: none !important;
}

.wp-block-navigation__responsive-container {
    background: #fff !important;
    z-index: 1000;
}

/* Trust bar in header */
.hs-trust-bar {
    background: #111111;
    color: #fff;
    text-align: center;
    padding: 8px 16px;
    font-size: 0.75rem;
    letter-spacing: 0.04em;
}

/* ============================================================
   HERO SECTION
   ============================================================ */
.hs-hero {
    position: relative;
    min-height: 75vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #111111 0%, #1a1a2e 50%, #16213e 100%);
    overflow: hidden;
}

.hs-hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(255,255,255,0.05) 0%, transparent 70%);
    border-radius: 50%;
}

.hs-hero-content {
    text-align: center;
    color: #fff;
    padding: 2rem;
    max-width: 800px;
    position: relative;
    z-index: 2;
}

.hs-hero h1 {
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: clamp(2.5rem, 5vw, 4rem);
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin: 0 0 1rem;
}

.hs-hero p {
    font-size: clamp(1rem, 2vw, 1.25rem);
    opacity: 0.9;
    margin: 0 0 2rem;
    line-height: 1.6;
}

.hs-hero-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.hs-hero .wp-block-button__link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 2rem !important;
    border-radius: 8px !important;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-decoration: none !important;
    transition: all 0.3s ease;
}

/* Social proof badges under hero */
.hs-social-proof {
    display: flex;
    gap: 2rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.15);
}

.hs-social-proof-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: rgba(255,255,255,0.7);
}

.hs-social-proof-item strong {
    color: #fff;
    font-size: 1rem;
}

/* ============================================================
   PRODUCT GRID — Force 4-column grid
   ============================================================ */
.wp-block-post-template,
ul.wp-block-post-template {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 1.25rem !important;
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

.wp-block-post-template > li,
ul.wp-block-post-template > li {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    min-width: 0 !important;
    overflow: hidden !important;
    border-radius: 12px !important;
    border: 1px solid var(--wp--preset--color--border, #e5e5e5) !important;
    background: var(--wp--preset--color--surface, #fff) !important;
    transition: transform 0.3s ease, box-shadow 0.3s ease !important;
}

.wp-block-post-template > li:hover,
ul.wp-block-post-template > li:hover {
    transform: translateY(-6px) !important;
    box-shadow: 0 24px 48px rgba(0,0,0,0.08) !important;
}

/* ============================================================
   PRODUCT CARD FIXES
   ============================================================ */
.wp-block-post-template > li .wp-block-group,
.wp-block-post-template li .wp-block-group {
    word-wrap: break-word;
    overflow-wrap: break-word;
    overflow: hidden;
}

.wp-block-post-template .wp-block-post-title,
.wp-block-post-template li .wp-block-post-title {
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    font-size: 0.875rem !important;
    font-family: 'Poppins', sans-serif !important;
    font-weight: 600 !important;
    line-height: 1.4 !important;
    margin: 0 !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    white-space: normal !important;
}

.wp-block-post-template .wp-block-post-title a {
    text-decoration: none;
    color: var(--wp--preset--color--text, #111111);
    transition: color 0.2s;
}

.wp-block-post-template .wp-block-post-title a:hover {
    color: var(--wp--preset--color--primary, #111111);
}

.wp-block-post-template .wp-block-post-featured-image {
    margin: 0 !important;
    overflow: hidden !important;
}

.wp-block-post-template .wp-block-post-featured-image img {
    display: block !important;
    width: 100% !important;
    aspect-ratio: 1 !important;
    object-fit: cover !important;
    border-radius: 12px 12px 0 0 !important;
    transition: transform 0.4s ease !important;
}

.wp-block-post-template > li:hover .wp-block-post-featured-image img {
    transform: scale(1.05) !important;
}

/* Product Price */
.wp-block-post-template .woocommerce-Price-amount {
    font-weight: 700;
    font-size: 0.95rem;
    font-family: 'Poppins', sans-serif;
    color: var(--wp--preset--color--text, #111111);
}

.wp-block-post-template .woocommerce-Price-amount ins {
    text-decoration: none;
    color: var(--wp--preset--color--sale, #c41e3a);
}

.wp-block-post-template .woocommerce-Price-amount del {
    color: var(--wp--preset--color--text-muted, #999);
    font-size: 0.8rem;
    font-weight: 400;
}

/* Product category badges on cards */
.hs-product-cats {
    font-size: 0.7rem !important;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

/* ============================================================
   WOOCOMMERCE OVERRIDES
   ============================================================ */
.woocommerce ul.products li.product,
.woocommerce ul.products {
    width: 100% !important;
}

.woocommerce .woocommerce-ordering {
    margin-bottom: 0 !important;
}

.woocommerce nav.woocommerce-pagination ul {
    border: none !important;
    display: flex;
    justify-content: center;
    gap: 0.5rem;
}

.woocommerce nav.woocommerce-pagination ul li {
    border: none !important;
}

.woocommerce nav.woocommerce-pagination ul li a,
.woocommerce nav.woocommerce-pagination ul li span {
    padding: 0.5rem 1rem !important;
    border: 1px solid #e5e5e5 !important;
    border-radius: 8px !important;
    font-size: 0.875rem;
    font-weight: 600;
    transition: all 0.2s;
}

.woocommerce nav.woocommerce-pagination ul li span.current {
    background: #111 !important;
    color: #fff !important;
    border-color: #111 !important;
}

/* Result count */
.woocommerce .woocommerce-result-count {
    font-size: 0.875rem;
    color: #777;
}

/* Orderby */
.woocommerce .woocommerce-ordering select {
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-family: 'Inter', sans-serif;
    background: #fff;
    cursor: pointer;
}

/* ============================================================
   SEARCH WIDGET
   ============================================================ */
.wp-block-search__inside-wrapper {
    display: flex !important;
}

.wp-block-search__input {
    border: 1px solid var(--wp--preset--color--border, #e5e5e5) !important;
    border-right: none !important;
    border-radius: 8px 0 0 8px !important;
    padding: 0.5rem 0.75rem !important;
    font-size: 0.875rem !important;
    min-width: 160px !important;
    font-family: 'Inter', sans-serif;
}

.wp-block-search__button {
    border-radius: 0 8px 8px 0 !important;
    padding: 0.5rem 0.75rem !important;
    background: var(--wp--preset--color--primary, #111111) !important;
    color: #fff !important;
    border: 1px solid var(--wp--preset--color--primary, #111111) !important;
    transition: background 0.2s;
}

.wp-block-search__button:hover {
    background: #333 !important;
}

.wp-block-search__label {
    display: none !important;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.wp-block-button__link {
    transition: all 0.3s ease !important;
}

.wp-block-button__link:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15) !important;
}

/* ============================================================
   COVER BLOCK HERO
   ============================================================ */
.wp-block-cover__inner-container {
    max-width: 800px;
    margin: 0 auto;
}

/* ============================================================
   SEPARATOR
   ============================================================ */
hr.wp-block-separator {
    border: none !important;
    border-top: 1px solid var(--wp--preset--color--border, #e5e5e5) !important;
}

/* ============================================================
   CATEGORY GRID (Homepage)
   ============================================================ */
.hs-category-grid .wp-block-post-template {
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 1.25rem !important;
}

/* ============================================================
   WHY SHOP WITH US SECTION
   ============================================================ */
.hs-features-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}

/* ============================================================
   NEWSLETTER SECTION
   ============================================================ */
.hs-newsletter {
    background: #111;
    color: #fff;
    text-align: center;
    padding: 4rem 2rem;
}

.hs-newsletter h2 {
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 2rem;
    letter-spacing: -0.02em;
    margin: 0 0 0.5rem;
}

.hs-newsletter p {
    opacity: 0.7;
    margin: 0 0 2rem;
}

.hs-newsletter-form {
    display: flex;
    max-width: 480px;
    margin: 0 auto;
    gap: 0;
}

.hs-newsletter-form input[type="email"] {
    flex: 1;
    padding: 0.875rem 1.25rem;
    border: 2px solid rgba(255,255,255,0.2);
    border-right: none;
    border-radius: 8px 0 0 8px;
    background: rgba(255,255,255,0.1);
    color: #fff;
    font-size: 0.9rem;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: border-color 0.2s;
}

.hs-newsletter-form input[type="email"]::placeholder {
    color: rgba(255,255,255,0.5);
}

.hs-newsletter-form input[type="email"]:focus {
    border-color: rgba(255,255,255,0.5);
}

.hs-newsletter-form button {
    padding: 0.875rem 1.5rem;
    background: #fff;
    color: #111;
    border: 2px solid #fff;
    border-radius: 0 8px 8px 0;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.hs-newsletter-form button:hover {
    background: transparent;
    color: #fff;
}

/* ============================================================
   SINGLE PRODUCT PAGE
   ============================================================ */
.woo-single-gallery {
    position: sticky;
    top: 100px;
    border: 1px solid var(--wp--preset--color--border, #e5e5e5);
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
}

.woo-main-image {
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fafafa;
}

.woo-main-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.woo-main-image img:hover {
    transform: scale(1.05);
}

.woo-thumb-list {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem;
    overflow-x: auto;
    border-top: 1px solid var(--wp--preset--color--border, #e5e5e5);
}

.woo-thumb-list img {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.2s, opacity 0.2s;
    opacity: 0.6;
    flex-shrink: 0;
}

.woo-thumb-list img:hover,
.woo-thumb-list img.active {
    border-color: var(--wp--preset--color--text, #111);
    opacity: 1;
}

.woo-product-title {
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 1.75rem;
    line-height: 1.3;
    margin: 0;
    color: var(--wp--preset--color--text, #111);
}

.woo-product-rating {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.5rem 0;
}

.woo-tabs-nav {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--wp--preset--color--border, #e5e5e5);
    margin-bottom: 1.5rem;
    overflow-x: auto;
}

.woo-tab-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    background: none;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    color: var(--wp--preset--color--text-muted, #999);
    white-space: nowrap;
    transition: color 0.2s, border-color 0.2s;
}

.woo-tab-btn:hover {
    color: var(--wp--preset--color--text, #111);
}

.woo-tab-btn.active {
    border-bottom-color: var(--wp--preset--color--text, #111);
    color: var(--wp--preset--color--text, #111);
}

.woo-tab-panel {
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--wp--preset--color--text, #111);
}

.woo-tab-panel ul {
    padding-left: 1.25rem;
}

.woo-tab-panel li {
    margin-bottom: 0.5rem;
}

/* ============================================================
   MOBILE STICKY ADD TO CART BAR
   ============================================================ */
.hs-sticky-atc {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-top: 1px solid #e5e5e5;
    padding: 0.75rem 1rem;
    z-index: 999;
    box-shadow: 0 -4px 16px rgba(0,0,0,0.1);
}

.hs-sticky-atc-inner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    max-width: 1200px;
    margin: 0 auto;
}

.hs-sticky-atc .price {
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
    white-space: nowrap;
}

.hs-sticky-atc button {
    flex: 1;
    height: 44px;
    background: #111;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s;
}

.hs-sticky-atc button:hover {
    background: #333;
}

/* ============================================================
   RESPONSIVE — Tablet (768px - 1024px)
   ============================================================ */
@media (max-width: 1024px) {
    .wp-block-post-template,
    ul.wp-block-post-template {
        grid-template-columns: repeat(3, 1fr) !important;
    }

    .hs-category-grid .wp-block-post-template {
        grid-template-columns: repeat(3, 1fr) !important;
    }

    .hs-hero h1 {
        font-size: 2.5rem;
    }

    .hs-social-proof {
        gap: 1.5rem;
    }

    .hs-features-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================================================
   RESPONSIVE — Mobile (max-width: 768px)
   ============================================================ */
@media (max-width: 768px) {
    .wp-block-post-template,
    ul.wp-block-post-template {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
    }

    .hs-category-grid .wp-block-post-template {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
    }

    .wp-block-columns {
        flex-wrap: wrap;
    }

    .wp-block-column {
        flex-basis: 100% !important;
    }

    /* Hero mobile */
    .hs-hero {
        min-height: 60vh;
    }

    .hs-hero h1 {
        font-size: 2rem;
    }

    .hs-hero p {
        font-size: 0.95rem;
    }

    .hs-hero-buttons {
        flex-direction: column;
        align-items: center;
    }

    .hs-hero .wp-block-button__link {
        width: 100%;
        max-width: 280px;
        justify-content: center;
    }

    .hs-social-proof {
        flex-direction: column;
        gap: 0.75rem;
        align-items: center;
    }

    /* Features grid mobile */
    .hs-features-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    /* Newsletter mobile */
    .hs-newsletter {
        padding: 3rem 1.5rem;
    }

    .hs-newsletter-form {
        flex-direction: column;
        gap: 0.75rem;
    }

    .hs-newsletter-form input[type="email"] {
        border-right: 2px solid rgba(255,255,255,0.2);
        border-radius: 8px;
    }

    .hs-newsletter-form button {
        border-radius: 8px;
    }

    /* Section padding mobile */
    .wp-block-group[style*="padding-top:4rem"] {
        padding-top: 2.5rem !important;
    }
    .wp-block-group[style*="padding-bottom:4rem"] {
        padding-bottom: 2.5rem !important;
    }

    /* Reviews grid mobile */
    .hs-reviews-grid .wp-block-column {
        flex-basis: 100% !important;
    }

    /* Single product */
    .woo-single-gallery {
        position: static;
    }
    .woo-product-title {
        font-size: 1.35rem;
    }
    .woo-tab-btn {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
    }

    /* Sticky ATC visible on mobile */
    .hs-sticky-atc {
        display: block;
    }

    /* Product card text tighter */
    .wp-block-post-template .wp-block-post-title {
        font-size: 0.8rem !important;
    }

    .wp-block-post-template .woocommerce-Price-amount {
        font-size: 0.85rem;
    }

    /* Footer columns stack */
    .wp-block-columns .wp-block-column {
        flex-basis: 100% !important;
    }
}

/* ============================================================
   RESPONSIVE — Small Mobile (max-width: 480px)
   ============================================================ */
@media (max-width: 480px) {
    .wp-block-post-template,
    ul.wp-block-post-template {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.5rem !important;
    }

    .hs-category-grid .wp-block-post-template {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.5rem !important;
    }

    .wp-block-post-template .wp-block-post-title {
        font-size: 0.75rem !important;
    }

    .wp-block-post-template .woocommerce-Price-amount {
        font-size: 0.8rem;
    }

    .hs-features-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }
}

/* ============================================================
   UTILITY CLASSES
   ============================================================ */
.hs-section-title {
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.hs-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.hs-badge-sale {
    background: var(--wp--preset--color--sale, #c41e3a);
    color: #fff;
}

.hs-badge-new {
    background: #111;
    color: #fff;
}

/* Card skeleton loading */
.hs-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: hs-shimmer 1.5s infinite;
    border-radius: 8px;
}

@keyframes hs-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Smooth scroll */
html {
    scroll-behavior: smooth;
}

/* Focus states for accessibility */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 2px solid #111;
    outline-offset: 2px;
}

/* WooCommerce notices */
.woocommerce .woocommerce-info,
.woocommerce .woocommerce-message,
.woocommerce .woocommerce-error {
    border-radius: 8px !important;
    font-size: 0.9rem;
}

/* ============================================================
   PRODUCT CARD — missing image placeholder
   ============================================================ */
.wp-block-post-template .wp-block-post-featured-image img[src*="woocommerce-placeholder"] {
    opacity: 0.3;
}

.wp-block-post-template .wp-block-post-featured-image:not([src]) {
    background: #f5f5f5;
}

/* Ensure card images always fill */
.wp-block-post-template .wp-block-post-featured-image a {
    display: block;
    overflow: hidden;
    background: #fafafa;
}

/* ============================================================
   HEADER NAV LINKS — hover states
   ============================================================ */
.wp-block-navigation__responsive-container-content .wp-block-navigation-item a {
    transition: color 0.2s;
}

/* ============================================================
   FOOTER — improved contrast
   ============================================================ */
footer .wp-block-column p,
footer .wp-block-column a {
    color: #e0e0e0 !important;
}

footer .wp-block-column h4,
footer .wp-block-heading {
    color: #fff !important;
}

footer hr {
    border-color: #333 !important;
    background-color: #333 !important;
}

/* ============================================================
   PRODUCT PAGE — polished look
   ============================================================ */
.hs-atc-wrapper {
    margin-bottom: 1rem;
}

.hs-add-to-cart:active,
.hs-buy-now:active {
    transform: translateY(0) !important;
    box-shadow: none !important;
}

/* ============================================================
   CLEAN UP — remove empty blocks
   ============================================================ */
.wp-block-group:empty,
.wp-block-column:empty,
p:empty {
    display: none;
}

/* Remove placeholder text from empty WooCommerce blocks */
.woocommerce-product-details__short-description:empty + .woocommerce-notices-wrapper:empty {
    display: none;
}

/* ============================================================
   SCROLLBAR STYLING
   ============================================================ */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f5f5f5;
}

::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #999;
}
