/*
Theme Name: Storefront Child SLB
Theme URI: https://storylinebooks.com/
Description: Custom Storefront child theme for Story Line Books.
Author: Story Line Books
Template: storefront
Version: 1.0.4
Text Domain: storefront-child-slb
*/

:root {
    --slb-green: #00802c;
    --slb-navy: #220157;
    --slb-text: #000000;
    --slb-bg: #ffffff;
    --slb-book-cover-grid-height: 260px;
}

body {
    background: var(--slb-bg);
    color: var(--slb-text);
}

a {
    color: var(--slb-green);
}

a:visited {
    color: var(--slb-navy);
}

button,
.button,
.single_add_to_cart_button,
.cwgstock_button {
    border-radius: 999px !important;
    background: var(--slb-green) !important;
    color: #000000 !important;
    border: none !important;
    padding: 0.8rem 1.4rem !important;
    transition: all 0.2s ease;
}

button:hover,
.button:hover,
.single_add_to_cart_button:hover,
.cwgstock_button:hover {
    background: var(--slb-navy) !important;
    color: #ffffff !important;
}

/* ---------------------------------
   SLB Store/Grid Product Cards
   - Equal cover area height
   - No cover cropping
   - Titles limited to 2 lines
   - Prices aligned across grid
---------------------------------- */

.woocommerce ul.products {
    align-items: stretch;
}

.woocommerce ul.products li.product,
.wc-block-grid__product,
.wc-block-product {
    display: flex !important;
    flex-direction: column;
    height: 100%;
}

/* Equal-height image frame */
.woocommerce ul.products li.product a.woocommerce-LoopProduct-link,
.woocommerce ul.products li.product .woocommerce-loop-product__link,
.wc-block-grid__product-link,
.wc-block-components-product-image,
.wc-block-grid__product-image {
    display: flex;
    flex-direction: column;
}

/* Fixed visual cover area; contain prevents cropping */
.woocommerce ul.products li.product img,
.wc-block-grid__product-image img,
.wc-block-components-product-image img,
.wp-block-woocommerce-product-image img {
    width: 100%;
    height: var(--slb-book-cover-grid-height);
    object-fit: contain;
    object-position: center center;
    background: transparent;
}

/* Give non-Woo block image wrappers a consistent frame when possible */
.wc-block-grid__product-image,
.wc-block-components-product-image,
.wp-block-woocommerce-product-image {
    min-height: var(--slb-book-cover-grid-height);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Two-line title clamp */
.woocommerce ul.products li.product .woocommerce-loop-product__title,
.wc-block-grid__product-title,
.wc-block-components-product-name,
.wp-block-post-title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.8em;
    line-height: 1.4;
}

/* Push price/action area down so prices line up */
.woocommerce ul.products li.product .price,
.wc-block-grid__product-price,
.wc-block-components-product-price {
    margin-top: auto;
    min-height: 1.6em;
}

/* Keep product buttons below aligned prices */
.woocommerce ul.products li.product .button,
.wc-block-grid__product-add-to-cart,
.wc-block-components-product-button {
    margin-top: 0.75rem;
}

/* SLB book layout wrapper */
.single-product .slb-book-layout {
    display: grid;
    grid-template-columns: minmax(180px, 260px) minmax(320px, 1fr);
    gap: 72px;
    align-items: center;
    margin-bottom: 2.5rem;
}

.single-product .slb-book-image {
    max-width: 260px;
}

.single-product .slb-book-image img {
    width: 100%;
    max-height: 390px;
    object-fit: contain;
    object-position: top center;
}

.single-product .slb-book-info {
    color: #000000;
}

.single-product .slb-book-title {
    font-size: clamp(2rem, 3vw, 3rem);
    line-height: 1.08;
    margin: 0 0 0.25rem 0;
}

.single-product .slb-book-author {
    font-size: clamp(1.45rem, 2.25vw, 2.25rem);
    line-height: 1.15;
    margin: 0 0 0.25rem 0;
}

.single-product .slb-book-series,
.single-product .slb-book-edition {
    font-size: 1rem;
    margin: 0.2rem 0;
}

.single-product .slb-book-purchase {
    margin: 2rem 0;
}

.single-product .slb-book-price {
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 0.6rem;
}

.single-product .slb-book-actions,
.single-product .slb-format-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.single-product .slb-format-actions {
    margin-top: 2rem;
}

.single-product .slb-libro-button img,
.single-product .slb-bookshop-button img {
    display: block;
    max-height: 44px;
    width: auto;
}

.single-product .slb-format-label {
    font-weight: 700;
    width: 100%;
    margin-bottom: 0.25rem;
}

/* CWG back-in-stock form cleanup */
.single-product .cwginstock-subscribe-form {
    max-width: 360px;
}

.single-product .cwginstock-subscribe-form .panel,
.single-product .cwginstock-subscribe-form .panel-heading,
.single-product .cwginstock-subscribe-form .panel-body {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
}

.single-product .cwginstock-subscribe-form h4 {
    text-align: left !important;
    margin: 0 0 0.75rem 0;
}

.single-product .cwginstock-subscribe-form input[type="text"],
.single-product .cwginstock-subscribe-form input[type="email"],
.single-product .cwginstock-subscribe-form input[type="number"] {
    margin-bottom: 0.5rem;
}

/* Minimal underline-style tabs */
.woocommerce-tabs {
    clear: both;
}

.woocommerce-tabs ul.tabs {
    border: none !important;
    padding: 0 !important;
    margin-bottom: 2rem !important;
}

.woocommerce-tabs ul.tabs li {
    border: none !important;
    background: transparent !important;
    margin-right: 2rem !important;
    padding: 0 !important;
}

.woocommerce-tabs ul.tabs li a {
    text-decoration: underline;
    font-weight: 400;
}

.woocommerce-tabs ul.tabs li.active a {
    text-decoration: none;
    font-weight: 700;
}

@media (max-width: 768px) {
    :root {
        --slb-book-cover-grid-height: 220px;
    }

    .single-product .slb-book-layout {
        display: block;
    }

    .single-product .slb-book-image {
        max-width: 100%;
        margin-bottom: 1.5rem;
    }

    .single-product .slb-book-image img {
        max-height: none;
    }
}


/* ---------------------------------
   Static product images
   Prevent hover zoom/scale effects
---------------------------------- */

.single-product div.product .woocommerce-product-gallery img,
.single-product div.product .woocommerce-product-gallery .woocommerce-product-gallery__image,
.single-product div.product .woocommerce-product-gallery .woocommerce-product-gallery__image a,
.woocommerce ul.products li.product img,
.wc-block-grid__product-image img,
.wc-block-components-product-image img,
.wp-block-woocommerce-product-image img {
    transform: none !important;
    transition: none !important;
    animation: none !important;
}

.single-product div.product .woocommerce-product-gallery img:hover,
.single-product div.product .woocommerce-product-gallery .woocommerce-product-gallery__image:hover,
.single-product div.product .woocommerce-product-gallery .woocommerce-product-gallery__image a:hover,
.woocommerce ul.products li.product img:hover,
.wc-block-grid__product-image img:hover,
.wc-block-components-product-image img:hover,
.wp-block-woocommerce-product-image img:hover {
    transform: none !important;
    scale: 1 !important;
    filter: none !important;
}

/* Disable WooCommerce/Storefront lightbox zoom cursor styling where possible */
.single-product div.product .woocommerce-product-gallery .woocommerce-product-gallery__trigger {
    display: none !important;
}

.single-product div.product .woocommerce-product-gallery {
    cursor: default !important;
}
