/*
Theme Name: The Knitting Lady Child Theme
Theme URI: http://theknittinglady.co.uk/
Description: A child theme of Storefront matching the classic styling, colors, and fonts of the original Knitting Lady site.
Author: Antigravity
Author URI: https://gemini.google.com/
Template: storefront
Version: 1.0.0
Text Domain: knittinglady
*/

/* Custom variables reflecting original design system */
:root {
    --kl-bg-color: #FFFFFF;
    --kl-text-color: #000000;
    --kl-heading-color: #000099;
    --kl-link-color: #0033aa;
    --kl-link-hover: #0d55ff;
    --kl-sidebar-bg: #d1e8fe;
    --kl-footer-bg: #003399;
    --kl-footer-border: #0052ee;
    --kl-footer-text: #FFFFFF;
    --kl-footer-link: #adc5f1;
    --kl-footer-link-hover: #457adf;
    --kl-button-bg: #1b7fbf;
    --kl-button-text: #FFFFFF;
    --kl-border-color: #003399;
}

/* Base Body Styles */
body {
    background-color: #e8f0fe !important; /* Pale blue outside page container wrapper */
    color: var(--kl-text-color) !important;
    font-family: Arial, Helvetica, sans-serif !important;
    margin: 0;
    padding: 0;
}

/* Site Page Container Border + Centering */
#page {
    max-width: 1050px;
    margin: 20px auto;
    border: 2px solid var(--kl-border-color);
    background-color: #FFFFFF !important;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.15);
}

/* Content Area Spacing */
.site-content {
    padding: 0 !important;
}

/* --- Flexbox Layout for Main Content & Sidebar --- */
.site-content > .col-full {
    display: flex !important;
    flex-direction: row !important;
    gap: 0 !important; /* Flush layout, no gap between sidebar and content border */
    padding: 0 !important; /* Flush outer edges */
    max-width: 100% !important;
}

/* Neutralize Storefront's sidebar and primary floats and widths */
#primary {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    float: none !important;
    width: auto !important;
    margin: 0 !important;
    padding: 24px 30px !important; /* comfortable content padding */
}

#secondary {
    flex: 0 0 250px !important; /* explicit flex sidebar width */
    order: -1 !important; /* Renders sidebar on the LEFT */
    float: none !important;
    width: auto !important;
    margin: 0 !important;
    padding: 20px 15px !important;
    background-color: var(--kl-sidebar-bg) !important;
    box-sizing: border-box;
    border-radius: 0 !important;
    min-height: 700px;
}

/* Headings Typography */
h1, h2, h3, h4, h5, h6,
.site-title a,
.entry-title a {
    color: var(--kl-heading-color) !important;
    font-family: Arial, Helvetica, sans-serif !important;
    font-weight: bold !important;
}

/* Links */
a {
    color: var(--kl-link-color);
    text-decoration: none;
    font-weight: bold;
}
a:hover:not(.button):not(.wc-block-components-button) {
    color: var(--kl-link-hover) !important;
}

/* --- Header Banner & Logo Background Match --- */
.site-header {
    background-color: #99CCFF !important; /* matches opaque PNG background color exactly */
    padding: 0 !important;
    border-bottom: none !important;
    margin-bottom: 0 !important;
}

/* Neutralize pseudo-elements breaking flex layout */
.site-header .col-full::before,
.site-header .col-full::after {
    display: none !important;
}

.site-header .col-full {
    display: flex !important;
    justify-content: flex-end !important; /* aligns to the right */
    align-items: center !important;
    max-width: 100% !important;
    padding: 0 20px !important;
    height: 110px; /* banner height */
}

/* Hide default site elements in header */
.site-header .site-description,
.site-header .site-search,
.site-header .site-header-cart {
    display: none !important;
}
.kl-header-branding {
    display: flex !important;
    width: 100% !important;
    justify-content: flex-end !important;
    align-items: center !important;
}
.kl-header-logo {
    display: flex !important;
    justify-content: flex-end !important;
    width: 100% !important;
    float: none !important;
}
.kl-header-logo a {
    display: inline-block !important;
    float: none !important;
}
.kl-header-logo-img {
    max-height: 90px;
    vertical-align: middle;
    display: inline-block !important;
    float: none !important;
    margin-left: auto !important;
    margin-right: 0 !important;
}

/* Hide redundant empty navy strip */
.kl-navy-strip {
    display: none !important;
}

/* --- Dark Blue Full-Width Utility Bar --- */
.kl-utility-bar {
    background-color: #003399 !important; /* dark blue */
    color: #FFFFFF !important;
    border-top: 4px solid #0052ee !important; /* thin light-blue rule */
    border-bottom: 1px solid #002288 !important;
    padding: 12px 30px 12px 15px !important; /* aligns with sidebar menu links (15px) and content edge (30px) */
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

/* Single line search layout */
.kl-utility-search {
    flex: 0 1 450px;
    margin: 0 !important;
    padding: 0 !important;
}
.kl-utility-search .widget_product_search,
.kl-utility-search .woocommerce-product-search {
    margin: 0 !important;
    padding: 0 !important;
}
.kl-utility-search form {
    display: flex !important;
    align-items: stretch !important;
    margin: 0 !important;
    width: 100%;
}
.kl-utility-search input[type="search"] {
    flex: 1 1 auto;
    min-width: 0;
    height: 32px !important;
    border: 1px solid #0052ee !important;
    border-top-left-radius: 4px !important;
    border-bottom-left-radius: 4px !important;
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
    padding: 0 10px !important;
    background-color: #FFFFFF !important;
    color: #000000 !important;
    font-size: 13px !important;
    box-sizing: border-box;
    margin: 0 !important;
}
.kl-utility-search button[type="submit"] {
    height: 32px !important;
    border: 1px solid #0052ee !important;
    border-left: none !important;
    border-top-right-radius: 4px !important;
    border-bottom-right-radius: 4px !important;
    border-top-left-radius: 0 !important;
    border-bottom-left-radius: 0 !important;
    background-color: #eeeeee !important;
    color: #333333 !important;
    padding: 0 15px !important;
    cursor: pointer !important;
    font-size: 13px !important;
    font-weight: bold !important;
    box-sizing: border-box;
    margin: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Cart & account text color overrides for dark blue background */
.kl-utility-cart-account {
    display: flex;
    align-items: center;
    gap: 20px;
}
.kl-utility-cart #site-header-cart {
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
}
.kl-utility-cart #site-header-cart > li {
    display: inline-block !important;
}
.kl-utility-cart #site-header-cart .widget_shopping_cart {
    display: none !important;
}
.kl-utility-cart a.cart-contents {
    padding: 0 !important;
    background-color: transparent !important;
    border: none !important;
    font-size: 13px;
    color: #FFFFFF !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 5px !important;
}
.kl-utility-cart a.cart-contents:hover {
    color: var(--kl-footer-link) !important;
}

/* Center cart icon vertically with text */
.kl-utility-cart a.cart-contents::before,
.kl-utility-cart a.cart-contents::after {
    float: none !important;
    margin: 0 !important;
    line-height: 1 !important;
    align-self: center !important;
    display: inline-block !important;
    vertical-align: middle !important;
}

.kl-utility-account a.my-account-link {
    font-size: 13px;
    color: #FFFFFF !important;
    text-transform: none;
    text-decoration: underline;
}
.kl-utility-account a.my-account-link:hover {
    color: var(--kl-footer-link) !important;
}

/* --- Left Sidebar Navigation Styling (Sized up for Older Demographic) --- */
.sidebar-navigation-menu {
    list-style: none !important;
    margin: 0 0 30px 0 !important;
    padding: 0 !important;
}
.sidebar-navigation-menu li {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
}
.sidebar-navigation-menu > li > a {
    font-weight: bold !important;
    text-transform: uppercase !important;
    color: var(--kl-heading-color) !important;
    display: block;
    padding: 10px 4px !important;
    font-size: 15px !important; /* Sized up from 11px */
    border-bottom: 1px solid #c0d8fe;
}
.sidebar-navigation-menu > li > a:hover {
    background-color: #FFFFFF !important;
    color: var(--kl-link-hover) !important;
}
.sidebar-navigation-menu .sub-menu {
    list-style: none !important;
    margin: 4px 0 8px 0 !important;
    padding-left: 12px !important;
}
.sidebar-navigation-menu .sub-menu a {
    font-weight: normal !important;
    text-transform: none !important;
    font-size: 14px !important; /* Sized up from 11px */
    color: var(--kl-link-color) !important;
    display: block;
    padding: 4px 0 !important;
}
.sidebar-navigation-menu .sub-menu a:hover {
    color: var(--kl-link-hover) !important;
    text-decoration: underline;
}
.sidebar-navigation-menu .sub-menu .sub-menu {
    padding-left: 10px !important;
    margin-bottom: 0 !important;
}
.sidebar-navigation-menu .sub-menu .sub-menu a {
    font-size: 13px !important; /* Sized up from 10px - easily legible gray */
    color: #727272 !important;
}

/* Hide Mobile Toggle on Desktop */
.kl-mobile-sidebar-toggle {
    display: none !important;
}

/* --- Relocated Breadcrumbs Styling inside #primary Content Area --- */
.storefront-breadcrumb {
    padding: 0 !important;
    margin: 0 0 15px 0 !important;
    width: 100% !important;
    clear: both !important;
}
.woocommerce-breadcrumb {
    padding: 0 !important;
    margin: 0 !important;
    font-size: 13px !important;
    color: #727272 !important;
}
.woocommerce-breadcrumb a {
    font-weight: normal !important;
    color: var(--kl-link-color) !important;
}
.woocommerce-breadcrumb a:hover {
    text-decoration: underline !important;
}

/* --- WooCommerce Product Grid using CSS Grid --- */
ul.products {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 24px !important;
    margin: 0 0 30px 0 !important;
    padding: 0 !important;
}
ul.products::before,
ul.products::after {
    display: none !important; /* remove default float clears */
}
ul.products li.product {
    background-color: #FFFFFF;
    border: 1px solid #e2e8f0;
    padding: 15px !important;
    box-sizing: border-box;
    text-align: center;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    float: none !important;
    width: auto !important;
    margin: 0 !important;
    clear: none !important;
}

/* Force details area to stack vertically and align buttons */
ul.products li.product .kl-loop-thumbnail img {
    max-height: 150px;
    width: auto !important;
    margin: 0 auto 10px auto;
    object-fit: contain;
}
ul.products li.product .kl-loop-title {
    font-size: 14px !important;
    margin: 5px 0 10px 0 !important;
    height: 40px;
    overflow: hidden;
}
ul.products li.product .kl-loop-title a {
    color: var(--kl-link-color) !important;
    font-weight: bold;
}

/* Align Loop Card Buttons & Price to bottom across rows */
ul.products li.product .kl-loop-price-container {
    margin-top: auto !important;
    font-size: 13px;
    margin-bottom: 12px;
    color: #333333;
}
.kl-loop-price-label {
    font-weight: bold;
}
.kl-loop-price-amount ins,
.kl-loop-price-amount .woocommerce-Price-amount {
    font-weight: normal !important;
    text-decoration: none !important;
    color: #333333 !important;
}
.kl-loop-price-amount del {
    display: none;
}

.kl-loop-add-to-cart-wrapper {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 8px !important;
    margin-bottom: 8px !important;
    flex-wrap: wrap !important;
}

/* Style the auto-appended WooCommerce "View cart" link in the loop */
ul.products li.product a.added_to_cart {
    width: 100% !important;
    text-align: center !important;
    display: block !important;
    margin: 5px auto 0 auto !important;
    background: transparent !important;
    border: none !important;
    color: var(--kl-link-color) !important;
    text-decoration: underline !important;
    font-weight: bold !important;
    font-size: 13px !important;
    padding: 0 !important;
}

ul.products li.product a.added_to_cart:hover {
    color: var(--kl-link-hover) !important;
    background: transparent !important;
    text-decoration: underline !important;
}

/* Quantity Stepper Styles */
.kl-quantity-stepper,
.single-product div.quantity {
    display: inline-flex !important;
    align-items: center;
    border: 1px solid #cccccc;
    border-radius: 4px;
    overflow: hidden;
    height: 36px;
    box-sizing: border-box;
    background-color: #fbfbfb;
    width: auto !important; /* Prevent parent fixed-width overrides squishing the input */
}
.kl-quantity-stepper button,
.single-product div.quantity button {
    background-color: #eeeeee;
    border: none !important;
    width: 25px;
    height: 100%;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    color: #333333;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.kl-quantity-stepper button:hover,
.single-product div.quantity button:hover {
    background-color: #dddddd;
}
.kl-quantity-stepper input.kl-qty-input,
.single-product div.quantity input.qty {
    width: 40px !important; /* bumped from 32px for optimal visibility of numbers */
    height: 100% !important;
    border: none !important;
    text-align: center;
    font-size: 13px !important;
    font-weight: bold !important;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
    -moz-appearance: textfield;
}

/* Single Product Add to Cart Form Alignment & Button Styling */
.single-product form.cart {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    margin-bottom: 20px !important;
}
.single-product form.cart .quantity {
    float: none !important;
    margin: 0 !important;
}
.single-product button.single_add_to_cart_button {
    background-color: var(--kl-button-bg) !important;
    color: var(--kl-button-text) !important;
    border: 1px solid var(--kl-button-bg) !important;
    height: 36px !important;
    line-height: 34px !important;
    padding: 0 20px !important;
    font-size: 13px !important;
    font-weight: bold !important;
    border-radius: 4px !important;
    display: inline-block !important;
    box-sizing: border-box !important;
    float: none !important;
    margin: 0 !important;
}
.single-product button.single_add_to_cart_button:hover {
    background-color: var(--kl-link-hover) !important;
    border-color: var(--kl-link-hover) !important;
    color: #FFFFFF !important;
}
.kl-quantity-stepper input.kl-qty-input::-webkit-outer-spin-button,
.kl-quantity-stepper input.kl-qty-input::-webkit-inner-spin-button,
.single-product div.quantity input.qty::-webkit-outer-spin-button,
.single-product div.quantity input.qty::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.kl-add-to-cart-btn {
    background-color: var(--kl-button-bg) !important;
    color: var(--kl-button-text) !important;
    border-color: var(--kl-button-bg) !important;
    height: 36px;
    line-height: 36px !important;
    padding: 0 12px !important;
    font-size: 12px !important;
    font-weight: bold !important;
    border-radius: 4px;
    display: inline-block;
    box-sizing: border-box;
}
.kl-add-to-cart-btn:hover {
    background-color: var(--kl-link-hover) !important;
    border-color: var(--kl-link-hover) !important;
    color: #FFFFFF !important;
}

.kl-loop-details-container {
    width: 100%;
}
.kl-loop-details-btn {
    display: block !important;
    width: 100%;
    box-sizing: border-box;
    background-color: #f0f0f0 !important;
    color: #444444 !important;
    border: 1px solid #cccccc !important;
    font-size: 12px !important;
    font-weight: bold !important;
    padding: 8px 0 !important;
    text-align: center;
    border-radius: 4px;
}
.kl-loop-details-btn:hover {
    background-color: #e5e5e5 !important;
    color: #222222 !important;
}

.single-product .quantity {
    margin-right: 15px;
}
.single-product .quantity label {
    display: none !important;
}

/* Footer styling and credits cleanup */
.site-footer {
    background-color: var(--kl-footer-bg) !important;
    color: var(--kl-footer-text) !important;
    border-top: 4px solid var(--kl-footer-border) !important;
    padding: 20px 0 !important;
}
.site-footer a {
    color: var(--kl-footer-link) !important;
}
.site-footer a:hover {
    color: var(--kl-footer-link-hover) !important;
}

/* --- RESPONSIVE LAYOUTS & MOBILE ~380px RULES --- */
@media (max-width: 991px) {
    ul.products {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 20px !important;
    }
}

@media (max-width: 767px) {
    #page {
        margin: 0;
        border: none;
    }
    
    .site-header .col-full {
        flex-direction: column;
        height: auto;
        padding: 15px !important;
        gap: 10px;
    }
    .kl-header-branding {
        justify-content: center !important;
    }
    .kl-header-logo-img {
        max-height: 60px;
    }

    /* Stack & center search above cart/account on mobile */
    .kl-utility-bar {
        flex-direction: column !important;
        flex-wrap: nowrap !important;
        justify-content: center !important;
        align-items: center !important;
        gap: 10px !important;
        padding: 10px 15px !important;
    }
    .kl-utility-search {
        flex: 0 1 auto !important;
        width: 100% !important;
        max-width: 260px !important;
    }
    .kl-utility-cart-account {
        flex: 0 0 auto !important;
        justify-content: center !important;
        gap: 16px !important;
    }

    .site-content > .col-full {
        flex-direction: column !important;
    }
    #primary {
        padding: 15px !important;
    }
    #secondary {
        width: 100% !important;
        flex: none !important;
        min-height: auto;
        padding: 15px !important;
    }

    .kl-mobile-sidebar-toggle {
        display: block !important;
        width: 100%;
        background-color: var(--kl-footer-bg);
        color: #FFFFFF;
        border: 1px solid var(--kl-footer-border);
        padding: 10px;
        font-weight: bold;
        text-transform: uppercase;
        margin-bottom: 15px;
        text-align: center;
        cursor: pointer;
        border-radius: 4px;
    }

    .kl-sidebar-footer {
        display: none !important;
    }
    
    .sidebar-nav-container {
        display: none;
    }
    .sidebar-nav-container.kl-active {
        display: block;
    }

    ul.products {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }
}

/* Smaller phones: tighten utility bar controls */
@media (max-width: 480px) {
    .kl-utility-bar {
        padding: 8px 12px !important;
        gap: 8px !important;
    }
    .kl-utility-search {
        max-width: 220px !important;
    }
    .kl-utility-search input[type="search"] {
        height: 28px !important;
        font-size: 11px !important;
        padding: 0 6px !important;
    }
    .kl-utility-search button[type="submit"] {
        height: 28px !important;
        font-size: 11px !important;
        padding: 0 8px !important;
    }
    .kl-utility-cart a.cart-contents,
    .kl-utility-account a.my-account-link {
        font-size: 11px !important;
    }
}

/* Collectors Warning CSS */
.collectors-warning {
    background-color: #FFF2CC;
    border: 1px solid #F1C232;
    color: #7F6000;
    padding: 12px;
    margin-top: 20px;
    font-weight: bold;
    border-radius: 4px;
}

/* Remove focus outlines globally on clicks of links and buttons */
a:focus,
a:active,
button:focus,
button:active,
input[type="submit"]:focus,
input[type="submit"]:active {
    outline: none !important;
    box-shadow: none !important;
}

/* Cart / checkout / primary WooCommerce button hover
   (includes WooCommerce Cart & Checkout blocks) */
.button.add_to_cart_button:hover,
.button.single_add_to_cart_button:hover,
.button.checkout-button:hover,
a.checkout-button:hover,
.button.alt:hover,
button.alt:hover,
input.button.alt:hover,
#place_order:hover,
.woocommerce-cart .button:hover,
.woocommerce-checkout .button:hover,
.kl-add-to-cart-btn:hover,
.wc-block-components-button:not(.is-link):hover,
.wc-block-components-button:not(.is-link):focus,
.wc-block-components-button:not(.is-link):active,
.wc-block-cart__submit-button:hover,
.wc-block-cart__submit-button:focus,
.wc-block-cart__submit-button:active,
.wp-block-woocommerce-proceed-to-checkout-block .wc-block-components-button:hover,
.wp-block-woocommerce-checkout .wc-block-components-button:not(.is-link):hover {
    background-color: var(--kl-link-hover) !important;
    background: var(--kl-link-hover) !important;
    border-color: var(--kl-link-hover) !important;
    color: #FFFFFF !important;
}
.wc-block-components-button:not(.is-link):hover .wc-block-components-button__text,
.wc-block-components-button:not(.is-link):focus .wc-block-components-button__text,
.wc-block-components-button:not(.is-link):active .wc-block-components-button__text {
    color: #FFFFFF !important;
}

/* WooCommerce notices/messages container inside #primary */
.storefront-notices-wrapper,
.woocommerce-notices-wrapper {
    width: 100% !important;
    margin-bottom: 20px !important;
    clear: both !important;
    display: block !important;
}

/* Cart/checkout: keep product description metadata as plain body text */
.wc-block-components-product-metadata__description,
.wc-block-components-product-metadata__description p,
.wc-block-components-product-metadata__description h1,
.wc-block-components-product-metadata__description h2,
.wc-block-components-product-metadata__description h3,
.wc-block-components-product-metadata__description h4,
.wc-block-components-product-metadata__description h5,
.wc-block-components-product-metadata__description h6,
.wc-block-components-product-metadata__description strong,
.wc-block-components-product-metadata__description b,
.wc-block-components-product-metadata__description em,
.wc-block-components-product-metadata__description span,
.wc-block-components-product-metadata__description a {
    font-size: 13px !important;
    font-weight: normal !important;
    line-height: 1.4 !important;
    color: #333333 !important;
    margin: 0 !important;
    padding: 0 !important;
    display: inline !important;
    background: none !important;
    border: none !important;
}
