/*
Theme Name:   BLD Construction
Author:       Good Creations
Author URI:   https://goodcreations.com/
Description:  A custom WordPress theme for BLD Construction - Southern Oregon's trusted construction partner with 25+ years of experience.
Version:      1.0.0
Tags:         construction, business, tailwind-css
Text Domain:  bldconstruction
*/

/* General Helper Styles */
#services {
  scroll-margin-top: 125px; 
}

/* Shop Sidebar Layout */
.shop-with-sidebar-container {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 3rem;
    align-items: start; /* Align sidebar with product grid */
}

.shop-sidebar {
    grid-column: 1;
    background: #f8f5f0; /* Light theme background */
    padding: 2rem;
    border-radius: 0.5rem; /* Match product cards */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1); /* Match product cards */
    position: sticky;
    top: 2rem;
    height: fit-content;
    margin-top: 3.5rem; /* Raised slightly to better match product image heights */
}

.shop-main-content {
    grid-column: 2;
}

/* Sidebar Widget Styling */
.shop-sidebar-widget {
    margin-bottom: 2rem;
}

.shop-sidebar-widget:last-child {
    margin-bottom: 0;
}

/* Sidebar Titles */
.shop-sidebar-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: #0d2b45;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #d4af37; /* Gold accent border */
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Search Form Styling */
.woocommerce-product-search {
    position: relative;
}

.woocommerce-product-search .search-field {
    width: 100%;
    padding: 0.75rem 3rem 0.75rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-family: 'Montserrat', sans-serif;
    transition: all 0.3s ease;
}

.woocommerce-product-search .search-field:focus {
    outline: none;
    border-color: #d4af37;
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
}

.woocommerce-product-search .search-submit {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 3rem;
    background: #d4af37; /* Gold background */
    border: none;
    border-radius: 0 0.375rem 0.375rem 0;
    color: white;
    cursor: pointer;
    transition: background 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.woocommerce-product-search .search-submit:hover {
    background: #b89a31; /* Darker gold on hover */
}

.woocommerce-product-search .search-submit .screen-reader-text {
    position: absolute;
    left: -9999px;
}

/* Category List Styling */
.widget-categories ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.widget-categories li {
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
}

.widget-categories li:last-child {
    margin-bottom: 0;
}

.widget-categories li a {
    color: #374151;
    text-decoration: none;
    font-size: 0.938rem;
    font-family: 'Montserrat', sans-serif;
    transition: all 0.3s ease;
    display: inline-block;
    padding: 0.5rem 0.75rem;
    border-radius: 0.25rem;
}

.widget-categories li a:hover {
    color: #d4af37; /* Gold on hover */
    background: rgba(212, 175, 55, 0.1);
    padding-left: 1rem;
}

.widget-categories li.current-cat > a,
.widget-categories li.current-cat-parent > a {
    color: #d4af37;
    font-weight: 600;
    background: rgba(212, 175, 55, 0.15);
}

.widget-categories .count {
    color: #6b7280;
    font-size: 0.813rem;
    margin-left: 0.5rem;
    display: inline !important; /* Force inline display */
}

/* Nested categories */
.widget-categories ul ul {
    margin-top: 0.5rem;
    margin-left: 1rem;
    padding-left: 1rem;
    border-left: 2px solid #e5e7eb;
}

.widget-categories ul ul li a {
    font-size: 0.875rem;
    padding: 0.375rem 0.5rem;
}

@media (max-width: 1023px) {
    .shop-with-sidebar-container {
        grid-template-columns: 1fr;
    }
    
    .shop-sidebar {
        grid-column: 1;
        margin-bottom: 2rem;
        position: static; /* Remove sticky on mobile */
    }
    
    .shop-main-content {
        grid-column: 1;
    }
    
    /* Show categories in columns on tablet */
    @media (min-width: 640px) {
        .widget-categories > ul {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 0 1.5rem;
        }
    }
}

.hero-slide {
    transition: opacity 1s ease-in-out;
    position: relative; /* Needed for the ::before pseudo-element */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* This adds the dark overlay to the hero images */
.hero-slide::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background-color: rgba(51, 51, 51, 0); /* Corresponds to gold with 50% opacity */
    z-index: 1;
}

.process-step::before {
    content: attr(data-step);
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 40px;
    background-color: #d4af37; /* Corresponds to primary color */
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-family: 'Montserrat', sans-serif;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

/* Basic WooCommerce breadcrumb styling to match the theme */
.woocommerce-breadcrumb {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 1rem;
}

.woocommerce-breadcrumb a {
    color: #d4af37; /* Corresponds to primary color */
    text-decoration: none;
}

.woocommerce-breadcrumb a:hover {
    text-decoration: underline;
}

/* Custom Menu Styles */
header nav .menu-item {
    list-style: none; /* This removes the dots from the menu items */
    padding: 0; /* This removes any default browser indentation */
}

/* Logo Styles */
header .custom-logo {
    max-width: 400px;
    height: auto;
    object-fit: contain;
}

footer .custom-logo {
    max-width: 300px;
    height: auto;
    object-fit: contain;
}

/* Ensure logos don't overflow their containers */
header a img.custom-logo,
footer a img.custom-logo {
    max-width: 100%;
    height: auto;
    display: block;
}

/*
 * FINAL WOOCOMMERCE PRODUCT GRID FIX
 * --------------------------------------------------
 * This block manually implements the theme's intended Tailwind CSS grid.
 * It is the definitive fix for the shop page layout.
*/

/* 1. Define the grid container */
.woocommerce ul.products {
    display: grid;
    grid-template-columns: repeat(1, minmax(0, 1fr)); /* Default: 1 column */
    gap: 2rem; /* Corresponds to Tailwind's gap-8 */
    list-style: none;
    padding: 0;
    margin: 0;
}

/* 2. Responsive grid columns using media queries */
@media (min-width: 640px) { /* Corresponds to Tailwind's 'sm' breakpoint */
    .woocommerce ul.products {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) { /* Corresponds to Tailwind's 'lg' breakpoint */
    .woocommerce ul.products {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 1280px) { /* Corresponds to Tailwind's 'xl' breakpoint */
    .woocommerce ul.products {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

/* 3. Style the product card itself */
.woocommerce ul.products li.product {
    background-color: #fff;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    transition: all 300ms cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    /* Reset WooCommerce defaults to prevent conflicts with the grid */
    float: none;
    margin: 0 !important;
    width: 100% !important;
    padding: 0;
    position: relative;
}

/*
 * NEW RULE: Force the first product into the first column.
 * This is the definitive fix for the "empty first column" issue.
*/
.woocommerce ul.products li.product:first-of-type {
    grid-column-start: 1;
}

/* 4. Override legacy float-clearing classes from default WC styles */
.woocommerce ul.products li.product.first,
.woocommerce ul.products li.product.last {
    clear: none !important;
}


/* 5. Style the card's internal elements */
.woocommerce ul.products li.product a {
    text-decoration: none;
    color: #0d2b45;
}

.woocommerce ul.products li.product .woocommerce-loop-product__link {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    padding: 1.5rem;
    padding-bottom: 0;
}

.woocommerce ul.products li.product img {
    width: 100%;
    height: 16rem; /* h-64 */
    object-fit: cover;
    margin-bottom: 1rem;
    border-radius: 0.25rem;
}

.woocommerce ul.products li.product .woocommerce-loop-product__title {
    font-size: 1.25rem;
    font-family: 'Cormorant Garamond', serif;
    font-weight: 700;
    margin-bottom: 0.5rem;
    flex-grow: 1;
}

.woocommerce ul.products li.product .price {
    font-size: 1.125rem;
    font-weight: 700;
    color: #0d2b45;
}

.woocommerce ul.products li.product .button,
.woocommerce ul.products li.product .add_to_cart_button {
    background-color: #e5e7eb !important;
    color: #374151 !important;
    border-radius: 0.375rem !important;
    padding: 0.5rem 1rem !important;
    line-height: 1.5;
    transition: background-color 300ms;
    margin-top: 0;
    text-decoration: none !important;
    display: inline-block;
    font-weight: 500;
}

.woocommerce ul.products li.product .button:hover,
.woocommerce ul.products li.product .add_to_cart_button:hover {
    background-color: #d1d5db !important;
}

.woocommerce ul.products li.product .price-add-to-cart-wrap {
    padding: 1.5rem;
    padding-top: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

/*
 * Single Product Page Styling
 * --------------------------------------------------
 * Adds spacing and improves typography for the single product page summary.
*/

 /* Short Descriptionb Paragraph Spacing */
.woocommerce-product-details__short-description p {
  margin-bottom: 1em; 
  line-height: 1.6;  
}

/* Add space below the product title and style it like an H1 */
.woocommerce div.product .product_title {
    font-size: 2.25rem; /* 36px */
    font-family: 'Cormorant Garamond', 'serif';
    font-weight: 700; /* bold */
    line-height: 1.2;
    margin-bottom: 0.5rem; /* 8px */
}

/* Style the price and add space below it */
.woocommerce div.product p.price {
    font-size: 1.5rem; /* 24px */
    color: #0d2b45; /* Corresponds to secondary color */
    margin-bottom: 1.5rem; /* 24px */
}

/* Add space below the short description */
.woocommerce div.product .woocommerce-product-details__short-description {
    margin-bottom: 1.5rem; /* 24px */
    font-size: 1.125rem; /* 18px */
    line-height: 1.75;
}

/*
 * Related Products Section Fix
 * --------------------------------------------------
 * Ensures related products appear below the product grid, not inside it
*/
.woocommerce div.product .related.products,
section.related.products {
    clear: both;
    width: 100%;
    display: block;
    grid-column: 1 / -1; /* Span all grid columns if inside a grid */
}

/* Ensure related products section appears after the product summary */
.woocommerce div.product ~ section.related.products,
.woocommerce div.product ~ .related.products {
    margin-top: 3rem;
}

/*
 * Shop Loop Card Fixes
 * --------------------------------------------------
*/

/* Fix for the image container link */
.woocommerce ul.products li.product > a:first-child {
    display: block; /* Make the link a block to contain its height */
    flex-shrink: 0; /* Prevent flexbox from shrinking the image container */
}

/*
 * Product Gallery Enhancements
 * --------------------------------------------------
 * Adds spacing, improves layout, and styles the gallery thumbnails
*/

/* Main gallery wrapper */
.woocommerce div.product div.images {
    margin-bottom: 2rem;
}

/* Space between main image and thumbnail gallery */
.woocommerce div.product div.images .flex-control-thumbs {
    margin-top: 1.5rem; /* 24px spacing between main image and thumbnails */
    display: flex;
    gap: 0.75rem; /* 12px gap between thumbnails */
    flex-wrap: wrap;
}

/* Individual thumbnail styling */
.woocommerce div.product div.images .flex-control-thumbs li {
    list-style: none;
    margin: 0;
    padding: 0;
    width: calc(25% - 0.5625rem); /* 4 thumbnails per row with gap */
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 0.25rem;
    overflow: hidden;
    transition: all 0.3s ease;
}

/* Thumbnail hover state */
.woocommerce div.product div.images .flex-control-thumbs li:hover {
    border-color: #d4af37; /* primary color */
}

/* Active thumbnail styling */
.woocommerce div.product div.images .flex-control-thumbs li.flex-active {
    border-color: #d4af37; /* primary color */
}

/* Thumbnail images */
.woocommerce div.product div.images .flex-control-thumbs li img {
    width: 100%;
    height: auto;
    display: block;
    opacity: 0.85;
    transition: opacity 0.3s ease;
    -webkit-backface-visibility: hidden;
    -moz-backface-visibility: hidden;
    -webkit-transform: translateZ(0) scale(1.0, 1.0);
    transform: translateZ(0);
    image-rendering: auto;
}

/* Active and hover thumbnail images */
.woocommerce div.product div.images .flex-control-thumbs li.flex-active img,
.woocommerce div.product div.images .flex-control-thumbs li:hover img {
    opacity: 1;
}

/* Main product image container */
.woocommerce div.product div.images .woocommerce-product-gallery__wrapper {
    margin: 0;
    position: relative;
}

/* Ensure the main image is responsive */
.woocommerce div.product div.images .woocommerce-product-gallery__image {
    position: relative;
}

/* Zoom and lightbox cursor hints */
.woocommerce div.product div.images .woocommerce-product-gallery__trigger {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 10;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.woocommerce div.product div.images .woocommerce-product-gallery__trigger:hover {
    background: #d4af37;
    color: white;
}

/* PhotoSwipe lightbox customizations */
.pswp__bg {
    background: rgba(0, 0, 0, 0.9);
}

/* Responsive adjustments for thumbnails */
@media (max-width: 640px) {
    .woocommerce div.product div.images .flex-control-thumbs li {
        width: calc(33.333% - 0.5rem); /* 3 thumbnails per row on mobile */
    }
}

/*
 * WordPress Content Styling - Override Tailwind Reset
 * --------------------------------------------------
 * Restores proper styling for WordPress editor content (posts, pages, WooCommerce)
 * This fixes issues caused by Tailwind's CSS reset removing default HTML styling
*/

/* Target all WordPress content areas */
.entry-content,
.woocommerce-product-details__short-description,
.woocommerce-Tabs-panel,
.comment-content,
.page-content,
.post-content {
    font-family: 'Montserrat', sans-serif;
    font-size: 1rem;
    line-height: 1.75;
    color: #374151;
}

/* Headings */
.entry-content h1,
.woocommerce-Tabs-panel h1,
.comment-content h1 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 2.25rem;
    font-weight: 700;
    line-height: 1.2;
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: #0d2b45;
}

.entry-content h2,
.woocommerce-Tabs-panel h2,
.comment-content h2 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.875rem;
    font-weight: 700;
    line-height: 1.3;
    margin-top: 1.75rem;
    margin-bottom: 0.875rem;
    color: #0d2b45;
}

.entry-content h3,
.woocommerce-Tabs-panel h3,
.comment-content h3 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.4;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: #0d2b45;
}

.entry-content h4,
.woocommerce-Tabs-panel h4,
.comment-content h4 {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.5;
    margin-top: 1.25rem;
    margin-bottom: 0.625rem;
    color: #0d2b45;
}

.entry-content h5,
.woocommerce-Tabs-panel h5,
.comment-content h5 {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.5;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    color: #0d2b45;
}

.entry-content h6,
.woocommerce-Tabs-panel h6,
.comment-content h6 {
    font-family: 'Montserrat', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.5;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    color: #0d2b45;
}

/* Paragraphs */
.entry-content p,
.woocommerce-product-details__short-description p,
.woocommerce-Tabs-panel p,
.comment-content p {
    margin-bottom: 1rem;
    line-height: 1.75;
}

/* Links */
.entry-content a,
.woocommerce-product-details__short-description a,
.woocommerce-Tabs-panel a,
.comment-content a {
    color: #d4af37;
    text-decoration: underline;
    transition: color 0.3s ease;
}

.entry-content a:hover,
.woocommerce-product-details__short-description a:hover,
.woocommerce-Tabs-panel a:hover,
.comment-content a:hover {
    color: #b89a31;
}

/* Unordered Lists */
.entry-content ul,
.woocommerce-product-details__short-description ul,
.woocommerce-Tabs-panel ul,
.comment-content ul {
    list-style-type: disc;
    list-style-position: outside;
    padding-left: 2rem;
    margin-bottom: 1rem;
    margin-top: 0.5rem;
}

.entry-content ul li,
.woocommerce-product-details__short-description ul li,
.woocommerce-Tabs-panel ul li,
.comment-content ul li {
    margin-bottom: 0.5rem;
    padding-left: 0.25rem;
}

/* Nested lists */
.entry-content ul ul,
.woocommerce-product-details__short-description ul ul,
.woocommerce-Tabs-panel ul ul,
.comment-content ul ul {
    list-style-type: circle;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}

/* Ordered Lists */
.entry-content ol,
.woocommerce-product-details__short-description ol,
.woocommerce-Tabs-panel ol,
.comment-content ol {
    list-style-type: decimal;
    list-style-position: outside;
    padding-left: 2rem;
    margin-bottom: 1rem;
    margin-top: 0.5rem;
}

.entry-content ol li,
.woocommerce-product-details__short-description ol li,
.woocommerce-Tabs-panel ol li,
.comment-content ol li {
    margin-bottom: 0.5rem;
    padding-left: 0.25rem;
}

/* Nested ordered lists */
.entry-content ol ol,
.woocommerce-product-details__short-description ol ol,
.woocommerce-Tabs-panel ol ol,
.comment-content ol ol {
    list-style-type: lower-alpha;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}

/* Strong and Bold */
.entry-content strong,
.entry-content b,
.woocommerce-product-details__short-description strong,
.woocommerce-product-details__short-description b,
.woocommerce-Tabs-panel strong,
.woocommerce-Tabs-panel b,
.comment-content strong,
.comment-content b {
    font-weight: 700;
    color: #0d2b45;
}

/* Emphasis and Italic */
.entry-content em,
.entry-content i,
.woocommerce-product-details__short-description em,
.woocommerce-product-details__short-description i,
.woocommerce-Tabs-panel em,
.woocommerce-Tabs-panel i,
.comment-content em,
.comment-content i {
    font-style: italic;
}

/* Blockquotes */
.entry-content blockquote,
.woocommerce-Tabs-panel blockquote,
.comment-content blockquote {
    border-left: 4px solid #d4af37;
    padding-left: 1.5rem;
    margin: 1.5rem 0;
    font-style: italic;
    color: #6b7280;
}

/* Code blocks */
.entry-content code,
.woocommerce-Tabs-panel code,
.comment-content code {
    background-color: #f3f4f6;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
}

.entry-content pre,
.woocommerce-Tabs-panel pre,
.comment-content pre {
    background-color: #f3f4f6;
    padding: 1rem;
    border-radius: 0.375rem;
    overflow-x: auto;
    margin: 1rem 0;
}

.entry-content pre code,
.woocommerce-Tabs-panel pre code,
.comment-content pre code {
    background-color: transparent;
    padding: 0;
}

/* Tables */
.entry-content table,
.woocommerce-Tabs-panel table,
.comment-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
}

.entry-content table th,
.woocommerce-Tabs-panel table th,
.comment-content table th {
    background-color: #f8f5f0;
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    border: 1px solid #e5e7eb;
    color: #0d2b45;
}

.entry-content table td,
.woocommerce-Tabs-panel table td,
.comment-content table td {
    padding: 0.75rem;
    border: 1px solid #e5e7eb;
}

.entry-content table tr:nth-child(even),
.woocommerce-Tabs-panel table tr:nth-child(even),
.comment-content table tr:nth-child(even) {
    background-color: #fafafa;
}

/* Horizontal Rule */
.entry-content hr,
.woocommerce-Tabs-panel hr,
.comment-content hr {
    border: none;
    border-top: 1px solid #e5e7eb;
    margin: 2rem 0;
}

/* Images */
.entry-content img,
.woocommerce-Tabs-panel img,
.comment-content img {
    max-width: 100%;
    height: auto;
    border-radius: 0.375rem;
    margin: 1rem 0;
}

/* Image alignment */
.entry-content img.alignleft,
.woocommerce-Tabs-panel img.alignleft {
    float: left;
    margin-right: 1.5rem;
    margin-bottom: 1rem;
}

.entry-content img.alignright,
.woocommerce-Tabs-panel img.alignright {
    float: right;
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.entry-content img.aligncenter,
.woocommerce-Tabs-panel img.aligncenter {
    display: block;
    margin-left: auto;
    margin-right: auto;
}

/* Image captions */
.entry-content .wp-caption,
.woocommerce-Tabs-panel .wp-caption {
    max-width: 100%;
}

.entry-content .wp-caption-text,
.woocommerce-Tabs-panel .wp-caption-text {
    font-size: 0.875rem;
    color: #6b7280;
    font-style: italic;
    margin-top: 0.5rem;
    text-align: center;
}
