/*
Theme Name: P&J26
Author: PEDRO\RIVERA
Author URI: https://pedrorivera.me
Description: Block theme for Pedro & João Editores 2026. Built for WooCommerce and Full Site Editing.
Version: 1.0.0
Stable tag: 1.0.0
Tested up to: 6.7
Requires at least: 6.6
Requires PHP: 8.1
Requires Plugins: woocommerce
License: GPL v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: pj26
Tags: full-site-editing, custom-colors, custom-logo, custom-menu, editor-style, featured-images, flexible-header, translation-ready, e-commerce

P&J26 WordPress Theme, (C) 2026 PEDRO\RIVERA.
P&J26 is distributed under the terms of the GNU GPL v2 or later.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
*/

* {
    box-sizing: border-box;
    padding: 0;
    margin: 0;
}

.wp-site-blocks {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - var(--wp-admin--admin-bar--height, 0px));
    main {
        flex: 1;
    }
}

.sticky {
    position: sticky;
    top: var(--wp-admin--admin-bar--height, 0);
    z-index: 1000;
}

:is(.wp-block-heading, .meta-organizacao, .meta-autoria) {
    text-wrap: balance;
    text-wrap: pretty;
}

/* Stretched-link pattern: the host establishes a positioning context for the
   anchor injected by the `bind-post-url` filter in functions.php, which fills
   the host and carries the click + a11y semantics. Visible markup is
   unchanged; the link sits above everything but stays transparent. */
.pj26-stretched-host {
    position: relative;
}
.pj26-stretched-host > .pj26-stretched-link {
    position: absolute;
    inset: 0;
    z-index: 1;
    overflow: hidden;
    text-indent: -9999px;
    color: transparent;
}
/* Re-raise interactive children (real anchors, buttons) above the stretched link
   so their own click targets keep working. */
.pj26-stretched-host :is(a, button, input, select, textarea) {
    position: relative;
    z-index: 2;
}

/* Global focus indicator. Keyboard users get a high-contrast outline on every
   focusable element; mouse users keep the default styles. */
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
    outline: 2px solid var(--wp--preset--color--brick-500);
    outline-offset: 2px;
}

ul[data-block-name="woocommerce/product-template"] {
    &.wc-block-product-template__responsive.columns-4 {
        display: grid;
        gap: var(--wp--preset--spacing--lg);

        grid-template-columns: minmax(0, 1fr);

        @media (width > 30rem) {
            grid-template-columns: repeat(2, minmax(0, 1fr))
        }

        @media (width > 60rem) {
            grid-template-columns: repeat(4, minmax(0, 1fr))
        }

        li {
            a {
                &:link {
                    /* display: initial;
                    padding: 0; */
                }
            }
        }
    }
}

.gutenberghub-tabs-container {
    .gutenberghub-tab-buttons-container {
        @media (width < 60rem) {
            gap: 0;
        }

        .gutenberghub-tab-button {
            flex: 100%;

            @media (width > 60rem) {
                flex: 1;
            }

            /* border: unset; */
        }
    }
}

.meta-autoria {
    &:before {
        content: 'Autoria: ';
        display: inline;
    }
}

.meta-organizacao {
    &:before {
        content: 'Organização: ';
        display: inline;
    }
}

/* Block Styles */
.wp-block-post-terms.is-style-boxes {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.wp-block-post-terms.is-style-boxes .wp-block-post-terms__separator {
    display: none;
}

.wp-block-post-terms.is-style-boxes a {
    border: 1px solid currentColor;
    padding: 0.3rem 0.6rem;
    text-decoration: none;
    border-radius: 0;
    background: transparent;
}

.wp-block-navigation__responsive-container-close {
    top: var(--wp--preset--spacing--2-xl);
    right: var(--wp--preset--spacing--2-xl);
}

.grade {
    grid-template-columns: minmax(0, 1fr);

    @media (width > 40rem) {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    /* @media (width > 80rem) {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    } */
}

/* WOOCOMMERCE COLUMNS */

.wc-block-product-template__responsive {
    &.columns-6 {
        grid-template-columns: repeat(var(--repeat, 1), minmax(0, 1fr));

        @media (width > 20rem) {
            --repeat: 2;
        }

        @media (width > 40rem) {
            --repeat: 3;
        }

        @media (width > 50rem) {
            --repeat: 4;
        }

        @media (width > 60rem) {
            --repeat: 6;
        }
    }
}

/* FEATURED PRODUCT */

.card-featured_product {}

/* SLIDER */
.pj26-slider-container {
    .wp-block-woocommerce-product-collection {
        margin-bottom: 0;
    }
}
.pj26-slider-container__controls {
    display: grid;
    gap: 0;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: center;
    padding-bottom: 0rem;
    position: absolute;
    z-index: 10;
    bottom: 0;
    width: 100%;
    transform: unset;
    left: unset;
    > * {
        &:last-child {
            grid-column: 3;
            justify-self: end;
        }
    }
    @media (width > 767px) {
        > * {
            &:first-child {
                justify-self: end;
            }
            &:last-child {
                grid-column: 2;
                justify-self: start;
                translate: -1px 0;
                /* translate: calc(var(--wp--preset--spacing--4-xl) * -1 - 1px) 0; */
            }
        }
    }
}

/* FILTERS */
.wp-block-search-filter-control-sort {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--wp--preset--spacing--sm);
    :is(.search-filter-label, .search-filter-field__input) {
        width: unset;
    }
}

:where(.wc-block-add-to-cart-with-options-grouped-product-item-selector) .wc-block-components-quantity-selector.wc-block-components-quantity-selector, :where(.wc-block-add-to-cart-with-options__quantity-selector) .wc-block-components-quantity-selector.wc-block-components-quantity-selector {
    width: 100%;
    border: 1px solid var(--wp--preset--color--brick-500);
    border-radius: 0;
    font-size: var(--wp--preset--font-size--heading-5);
    > * {
        font-size: inherit;
    }
    input.qty {
        flex: 1;
        max-width: unset;
        width: unset;
    }

    button {
        aspect-ratio: 1;
        width: var(--wp--preset--spacing--4-xl);
        &:first-of-type {
            border-right: 1px solid var(--wp--preset--color--brick-500);
        }
        &:last-of-type {
            border-left: 1px solid var(--wp--preset--color--brick-500);
        }
    }
}

.woocommerce-account .wp-block-post-title, .woocommerce-account main .woocommerce, .woocommerce-cart .wp-block-post-title, .woocommerce-cart main .woocommerce, .woocommerce-checkout .wp-block-post-title, .woocommerce-checkout main .woocommerce {
    max-width: unset;
}

.woocommerce-account .addresses .title .edit {
    float: unset;
}

:is(.login-item, .create-account-item).wp-block-ollie-mega-menu {
    .wp-block-navigation-item__label {
        display: block;
        svg {
            width: 1.5em;
            height: 1.5em;
        }
    }
    .wp-block-ollie-mega-menu__toggle {
        .wp-block-ollie-mega-menu__toggle-icon {
            display: none;
        }
    }
}

/* My Account */
.woocommerce-account {
    .woocommerce-MyAccount-navigation {
        ul {
            display: flex;
            flex-wrap: wrap;
            li {
                margin: 0;
                padding: 0;
                @media (width > 40rem) {
                    flex: 100%;
                }
                a {
                    color: var(--wp--preset--color--brown-700);
                    display: block;
                    padding: var(--wp--preset--spacing--lg);

                    transition: background-color 0.3s ease, color 0.3s ease;

                    &:hover {
                        background-color: color-mix(in hsl, var(--wp--preset--color--grey-500), var(--wp--preset--color--white-500) 50%);
                        color: var(--wp--preset--color--brown-500);
                        text-decoration: none;
                    }
                }

                &.is-active {
                    a {
                        text-decoration: none;
                        background-color: var(--wp--preset--color--brown-700);
                        color: var(--wp--preset--color--white-500)
                    }
                }
            }
        }
        
    }
}

/* Mini-cart */

.wc-block-mini-cart__drawer {
    font-family: var(--wp--preset--font-family--bw-gradual);

    .wc-block-cart-items__row {
        grid-template-columns: minmax(0, 1fr) minmax(0, 4fr) minmax(0, 1fr) !important;
        gap: var(--wp--preset--spacing--md);

        .wc-block-cart-item__image {
            padding: 0 !important;
        }

    }

    .wc-block-mini-cart__footer {
        .wp-block-woocommerce-mini-cart-footer-block {
            flex: 100%;
            display: flex;
            flex-direction: column;
            gap: var(--wp--preset--spacing--md);
        }
        .wc-block-mini-cart__footer-actions {
            flex-wrap: wrap;
            gap: var(--wp--preset--spacing--md);
        }
        .wc-block-components-button {
            flex: 100%;
            width: 100%;
            font-size: var(--wp--preset--font-size--text-x-small);
        }
    }
}

/* Cart & Checkout */
:is(.wp-block-woocommerce-cart, .wp-block-woocommerce-checkout) {
    :has(> .wc-block-components-button) {
        flex-wrap: wrap;
    }
    .wc-block-components-button {
        font-size: var(--wp--preset--font-size--text-x-small);
        padding: var(--wp--preset--spacing--md);
        border-radius: 0;
        width: 100%;
        flex: 100%;
    }
}