/*
Theme Name: BarkShop
Theme URI: https://barkshop.pl
Description: Child theme of Astra for the BarkShop pet store. Brand styling is version-controlled here (no customizer click-ops).
Author: BarkShop
Template: astra
Version: 0.1.0
Text Domain: barkshop
*/

:root {
    --bark-primary: #8a5e30;      /* warm wood brown — primary CTA / links / prices */
    --bark-primary-dark: #6d4a26; /* darker wood for hover / prices */
    --bark-accent: #d9933f;       /* warm wood/amber accent */
    --bark-ink: #3a2c1c;          /* warm dark brown ink */
    --bark-soft: #f6efe2;         /* soft warm cream background */
    --bark-radius: 10px;

    /* Light-wood palette — matched to the shop's blonde pine/birch IKEA shelves */
    --bark-wood-light: #ecdcc0;
    --bark-wood: #d4b485;
    --bark-wood-dark: #9c7748;
    --bark-cream: #f7f1e6;
}

/* Buttons */
.ast-button, button, input[type="submit"],
.woocommerce a.button, .woocommerce button.button,
.woocommerce .button, .wc-block-components-button {
    background-color: var(--bark-primary) !important;
    border-color: var(--bark-primary) !important;
    color: #fff !important;
    border-radius: var(--bark-radius) !important;
}
.woocommerce a.button:hover, .woocommerce button.button:hover,
.ast-button:hover, .wc-block-components-button:hover {
    background-color: var(--bark-primary-dark) !important;
}

/* Secondary / add-to-cart accent */
.woocommerce ul.products li.product .button.add_to_cart_button {
    background-color: var(--bark-accent) !important;
    border-color: var(--bark-accent) !important;
    color: var(--bark-ink) !important;
}

/* Links & prices */
a { color: var(--bark-primary); }
.woocommerce .price, .woocommerce ul.products li.product .price {
    color: var(--bark-primary-dark);
    font-weight: 700;
}

/* Shop/category thumbnails: show the WHOLE product image, centred, on a white
   tile — never square-cropped. (Pair with woocommerce_thumbnail_cropping=uncropped.) */
.woocommerce ul.products li.product a img,
.woocommerce ul.products li.product img,
.woocommerce-page ul.products li.product img {
    aspect-ratio: 1 / 1;
    object-fit: contain !important;
    background-color: #fff;
    width: 100%;
    height: auto;
}

/* Homepage / block product grids (best-sellers, new, categories) — same square,
   contained, white tiles as the shop loop (block markup differs from the loop). */
.wc-block-grid__product-image img,
.wc-block-grid__product-image .attachment-woocommerce_thumbnail,
.wp-block-woocommerce-product-categories img,
.wc-block-grid__product img {
    aspect-ratio: 1 / 1;
    object-fit: contain !important;
    background-color: #fff;
    width: 100%;
    height: auto;
}

/* Product cards: gentle rounding + lift */
.woocommerce ul.products li.product {
    border-radius: var(--bark-radius);
    transition: transform .15s ease, box-shadow .15s ease;
}
.woocommerce ul.products li.product:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(32,48,58,.10);
}

/* Trust bar (home page) */
.bark-trustbar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    background: var(--bark-soft);
    border-radius: var(--bark-radius);
    padding: 1.25rem;
}
.bark-trustbar .item { text-align: center; font-weight: 600; color: var(--bark-ink); }

/* Sale badge */
.woocommerce span.onsale {
    background: var(--bark-accent);
    color: var(--bark-ink);
    border-radius: 999px;
}

/* Product description grid imported from BaseLinker (.section > .item-6/.item-12).
   The CSV ships clean, semantic markup but no CSS — recreate the 2-column,
   image/text layout responsively. Scoped to single product pages. */
.single-product .section {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.5rem;
    margin: 1.5rem 0;
}
.single-product .section > .item { box-sizing: border-box; }
.single-product .section > .item-6 { flex: 1 1 calc(50% - 0.75rem); min-width: 260px; }
.single-product .section > .item-12 { flex: 1 1 100%; }
.single-product .section .image-item img {
    max-width: 100%;       /* never overflow the column / upscale originals */
    max-height: 480px;     /* and never run mega-tall: cap height too (tall CSV photos) */
    width: auto;           /* scale down to whichever limit hits first... */
    height: auto;          /* ...keeping the aspect ratio (no distortion) */
    display: block;
    margin: 0 auto;        /* centre (e.g. full-width header/banner images) */
    border-radius: var(--bark-radius);
}
/* Full-width standalone images (item-12, e.g. the auction header) stay centred. */
.single-product .section > .item-12 .image-item { text-align: center; }
.single-product .section .text-item h1,
.single-product .section .text-item h2 { font-size: 1.4rem; line-height: 1.25; margin: 0 0 .6rem; }
.single-product .section .text-item p,
.single-product .section .text-item li { line-height: 1.6; }
.single-product .section .text-item ul { padding-left: 1.2rem; }
@media (max-width: 600px) {
    .single-product .section > .item-6 { flex-basis: 100%; }
}

/* FiboSearch bar placed at the top of the content */
.bark-search-bar {
    max-width: 680px;
    margin: 1rem auto 0;
    padding: 0 1rem;
}
.bark-search-bar .dgwt-wcas-search-wrapp { width: 100%; }
/* FiboSearch submit button — match the wood palette (ships green by default). */
.dgwt-wcas-search-submit,
.dgwt-wcas-search-wrapp .dgwt-wcas-search-submit,
.dgwt-wcas-sf-wrapp .dgwt-wcas-search-submit {
    background-color: var(--bark-primary) !important;
    border-color: var(--bark-primary) !important;
}
.dgwt-wcas-search-submit:hover { background-color: var(--bark-primary-dark) !important; }
.dgwt-wcas-search-submit svg,
.dgwt-wcas-search-submit svg path { fill: #fff !important; }

/* ============================================================
   Shop filter sidebar (WOOF) — Allegro-style faceted filter
   ============================================================ */

/* --- Layout: filters in a fixed left column, products in a centred main column.
   #secondary and #primary are correct siblings inside .ast-container, but Astra's
   desktop flex-row is unreliable here, so assert it explicitly. --- */
.ast-left-sidebar #content > .ast-container,
.site-content .ast-container {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: flex-start;
    gap: 32px;
    max-width: 1240px;
    margin-left: auto;
    margin-right: auto;
}
.ast-left-sidebar #secondary {
    flex: 0 0 270px;
    width: 270px;
    max-width: 270px;
    margin: 0;
    padding: 0;
    border: 0;
}
.ast-left-sidebar #primary {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    padding-left: 0;
    border: 0;
}
@media (max-width: 921px) {
    .ast-left-sidebar #content > .ast-container,
    .site-content .ast-container {
        flex-direction: column;
        gap: 0;
    }
    .ast-left-sidebar #secondary {
        flex-basis: auto;
        width: 100%;
        max-width: 100%;
    }
}

/* --- Category drill-down navigation (Allegro "Podkategorie" style) --- */
.bark-catnav {
    margin: 0 0 1.2rem;
    padding: 0 0.2rem 1rem;
    border-bottom: 1px solid #e8e8e8;
}
.bark-catnav-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1d2327;
    padding: 0.4rem 0;
}
.bark-catnav-back {
    display: block;
    font-size: 0.85rem;
    color: #888;
    text-decoration: none;
    margin: 0.2rem 0;
}
.bark-catnav-back:hover { color: var(--bark-primary); }
.bark-catnav-current {
    font-size: 1rem;
    font-weight: 700;
    color: var(--bark-primary);
    margin: 0.2rem 0 0.5rem;
}
a.bark-catnav-current.bark-catnav-root {
    display: block;
    text-decoration: none;
}
.bark-catnav-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.bark-catnav-list li { margin: 0; }
.bark-catnav-list a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 0.42rem 0;
    font-size: 0.92rem;
    color: #333;
    text-decoration: none;
    border-bottom: 1px solid #f2f2f2;
}
.bark-catnav-list a:hover { color: var(--bark-primary); }
.bark-catnav-count { color: #999; font-size: 0.82em; }

/* --- Availability ("Dostępność") filter --- */
.bark-stock-filter {
    padding: 0 0.2rem 0.8rem;
    border-bottom: 1px solid #e8e8e8;
}
.bark-stock-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1d2327;
    padding: 0.8rem 0;
}
.bark-stock-list { list-style: none; margin: 0; padding: 0; }
.bark-stock-row { margin: 0 0 4px; font-size: 0.9rem; }
.bark-stock-row label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    cursor: pointer;
}
.bark-stock-row input { flex: 0 0 auto; margin: 0; }
.bark-stock-name { flex: 1 1 auto; }
.bark-stock-count { color: #999; font-size: 0.82em; }

/* Hide WOOF's built-in product-category and product-tag facets — categories are
   handled by the [bark_category_nav] drill-down, and we don't filter by tags.
   (These are default WP taxonomies WOOF keeps on with no config switch to remove.) */
.woof_container_product_cat,
.woof_container_product_tag { display: none !important; }

/* --- Facet container + collapsible accordion title bar --- */
.woof .woof_container { margin: 0; border-bottom: 1px solid #e8e8e8; }
.woof .woof_container_inner { padding: 0; }
.woof .woof_container_inner > h4 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 0;
    padding: 0.8rem 0.2rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: #1d2327;
    cursor: pointer;
    user-select: none;
}
.woof .woof_front_toggle {
    margin-left: auto;
    color: #888;
    font-size: 0.8rem;
    line-height: 1;
    text-decoration: none;
}
.woof .woof_block_html_items { padding: 0 0.2rem 0.8rem; }

/* --- One-line checkbox rows: checkbox left, label + count right (Allegro-style).
   WOOF injects literal <br> between li/input/label — hide them, then flex the row. --- */
.woof_list.woof_list_checkbox,
.woof_childs_list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.woof_list.woof_list_checkbox li br,
.woof_childs_list br { display: none; }
.woof_list.woof_list_checkbox li {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 8px;
    margin: 0 0 4px;
    line-height: 1.3;
    font-size: 0.9rem;
}
.woof_list.woof_list_checkbox .woof_childs_list {
    flex: 0 0 100%;
    margin: 4px 0 4px 22px;
}
.woof_list.woof_list_checkbox li > input.woof_checkbox_term[type="checkbox"] {
    flex: 0 0 auto;
    margin: 0;
}
.woof_list.woof_list_checkbox li > label.woof_checkbox_label {
    flex: 1 1 auto;
    margin: 0;
    cursor: pointer;
}

/* Greyed-out options when no products match the current selection, and sink them
   below the still-available ones (count recalculates via the stock/cross-facet
   filters; WOOF disables zero-count inputs). */
.woof_list.woof_list_checkbox { display: flex; flex-direction: column; }
.woof_list.woof_list_checkbox > li { order: 0; }
.woof_list.woof_list_checkbox > li:has(input.woof_checkbox_term:disabled) { order: 1; opacity: .5; }
.woof_list.woof_list_checkbox > li.woof_open_hidden_li { order: 2; }
.woof_list.woof_list_checkbox li > input.woof_checkbox_term:disabled + label.woof_checkbox_label {
    color: #bbb;
    cursor: default;
}

/* The (NN) product count. */
.woof_checkbox_count,
.woof_count {
    color: #999;
    font-size: 0.82em;
    margin-left: 4px;
}

/* "Pokaż więcej / mniej" toggle. */
a.woof_open_hidden_li_btn {
    display: inline-block;
    margin-top: 4px;
    font-size: 0.85rem;
    color: var(--bark-primary);
    text-decoration: none;
    cursor: pointer;
}

/* Header logo — keep it proportional to the menu bar */
.custom-logo,
.custom-logo-link img,
.ast-site-identity .site-logo-img img {
    max-height: 56px !important;
    width: auto !important;
    height: auto !important;
}

/* ============================================================
   Homepage — light-wood look + 3D showcase carousels
   ============================================================ */

/* Hero: constrained to the content width (not full-bleed) + warm wood gradient. */
.bark-hero {
    border-radius: 18px;
    overflow: hidden;
    margin-top: 1.2rem;
}
.bark-hero .wp-block-cover__background,
.wp-block-cover.bark-hero > .wp-block-cover__background {
    background: linear-gradient(135deg, #c79a63 0%, #b07d44 55%, #8a5e30 100%) !important;
    opacity: 1 !important;
}
.bark-hero h1 {
    font-size: clamp(2rem, 5vw, 3.2rem);
    letter-spacing: 0.5px;
    text-shadow: 0 2px 14px rgba(0,0,0,.25);
    margin-bottom: .4rem;
}

/* Trust bar: warm cream panel with light-wood divider. */
.bark-trustbar {
    background: var(--bark-cream);
    border-top: 3px solid var(--bark-wood);
    border-bottom: 3px solid var(--bark-wood);
}
.bark-trustbar .item { color: var(--bark-ink); }

/* Homepage section headings in warm brown. */
.home .wp-block-heading,
.bark-deck-label { color: var(--bark-wood-dark); }

/* --- 3D showcase: two decks side by side, cards swapping in 3D --- */
.bark-showcase {
    display: flex;
    gap: 2.5rem;
    justify-content: center;
    align-items: flex-start;
    flex-wrap: wrap;
    max-width: 1080px;
    margin: 2.5rem auto 1rem;
    padding: 0 1rem;
}
.bark-deck { flex: 1 1 380px; max-width: 520px; }
.bark-deck-label {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 1.2rem;
}
.bark-deck-stage {
    position: relative;
    height: 440px;
    perspective: 1300px;
    transform-style: preserve-3d;
}
.bark-card {
    position: absolute;
    top: 0;
    left: 50%;
    width: 70%;
    aspect-ratio: 4 / 5;
    margin-left: -35%;               /* centre horizontally */
    border-radius: 16px;
    overflow: hidden;
    background: var(--bark-wood-light);
    box-shadow: 0 18px 45px rgba(58, 44, 28, .28);
    transition: transform .9s cubic-bezier(.22,.68,.24,1), opacity .9s ease;
    transform-style: preserve-3d;
    will-change: transform, opacity;
}
.bark-card img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Stack positions (JS sets data-pos 0..2). 0 = front. */
.bark-card[data-pos="0"] { transform: translateX(0)     translateZ(60px)  rotateY(0deg)   scale(1);    z-index: 3; opacity: 1; }
.bark-card[data-pos="1"] { transform: translateX(26%)   translateZ(-70px) rotateY(-26deg) scale(.86);  z-index: 2; opacity: .78; }
.bark-card[data-pos="2"] { transform: translateX(-26%)  translateZ(-130px) rotateY(26deg) scale(.78);  z-index: 1; opacity: .55; }

@media (max-width: 600px) {
    .bark-deck-stage { height: 360px; }
    .bark-card { width: 78%; margin-left: -39%; }
}

/* Authentic shop photo in the "about" section. */
.bark-shop-photo { margin: 1.4rem auto 1.6rem; max-width: 560px; }
.bark-shop-photo img {
    border-radius: 16px;
    box-shadow: 0 14px 36px rgba(58, 44, 28, .25);
    border: 4px solid #fff;
}

/* --- Single product: main gallery image fixed box ---------------------------
   BaseLinker photos are a mix of tall portraits (e.g. 600x1147) and wide shots,
   so the default gallery let a tall image run nearly full-screen height. Cap the
   main image to a fixed box roughly matched to the summary column on the right and
   contain it on a white field: tall products get thin side bars, wide products get
   thin top/bottom bars, and every product reads as the same stable tile. */
.single-product .woocommerce-product-gallery { background: #fff; }
.single-product .woocommerce-product-gallery .flex-viewport,
.single-product .woocommerce-product-gallery__wrapper { max-height: 480px !important; }
.single-product .woocommerce-product-gallery__image img,
.single-product .woocommerce-product-gallery__wrapper > a > img {
    height: 480px !important;
    max-height: 62vh !important;
    width: 100% !important;
    object-fit: contain !important;
    background: #fff;
}
@media (max-width: 600px) {
    .single-product .woocommerce-product-gallery .flex-viewport,
    .single-product .woocommerce-product-gallery__wrapper { max-height: 360px !important; }
    .single-product .woocommerce-product-gallery__image img,
    .single-product .woocommerce-product-gallery__wrapper > a > img {
        height: 360px !important;
        max-height: 56vh !important;
    }
}
