/*
Theme Name: Chelech Store
Theme URI: https://chelech.cl/
Author: Empresas Chelech
Description: Tienda CHELECH con WooCommerce y plantillas de productos editables mediante Elementor y PRO Elements.
Version: 0.1.33
Requires at least: 6.7
Requires PHP: 8.0
Text Domain: chelech-store
Tags: full-site-editing, block-patterns, custom-logo, e-commerce, accessibility-ready
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
*/

/* Header: full-width shell, centered compact search, pinned edge actions. */
.chelech-site-header {
    width: 100%;
    max-width: none;
    box-sizing: border-box;
    margin-inline: 0;
    border-bottom: 1px solid var(--wp--preset--color--line);
    background: #ffe51b;
}
.chelech-site-header .chelech-header-inner {
    width: 100%;
    max-width: none;
    box-sizing: border-box;
    margin-inline: 0;
    padding: 12px clamp(16px, 2.5vw, 44px);
}
.chelech-header-top {
    display: grid;
    grid-template-columns: 128px minmax(0, 1fr) auto;
    align-items: center;
    gap: clamp(12px, 2vw, 28px);
    width: 100%;
    min-width: 0;
    margin: 0;
}
/* Neutralize WordPress flow spacing between items inside our CSS grid. */
.chelech-header-top > * {
    margin-block: 0;
}
.chelech-header-top > .wp-block-site-logo {
    justify-self: start;
    margin: 0;
    line-height: 0;
}
.chelech-header-top .wp-block-site-logo img {
    display: block;
    max-width: 100%;
    height: auto;
}
.chelech-header-top > .chelech-product-search {
    justify-self: center;
    width: 100%;
    max-width: 520px;
    min-width: 0;
    margin: 0;
}
.chelech-header-top .chelech-product-search .wp-block-search__inside-wrapper {
    display: flex;
    align-items: center;
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    min-height: 52px;
    padding: 3px 7px 3px 22px;
    background: #fafafa;
    border: 0;
    border-radius: 999px;
    box-shadow: none;
}
.chelech-header-top .chelech-product-search .wp-block-search__inside-wrapper:focus-within {
    outline: none;
    box-shadow: 0 0 0 2px rgb(23 33 43 / 10%);
}
.chelech-header-top .chelech-product-search .wp-block-search__input {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    min-height: 40px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #17212b;
    box-shadow: none;
    outline: 0;
    font-size: 16px;
}
.chelech-header-top .chelech-product-search .wp-block-search__input::placeholder {
    color: #747474;
    opacity: 1;
}
.chelech-header-top .chelech-product-search .wp-block-search__button {
    flex: 0 0 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    width: 44px;
    height: 44px;
    margin: 0 0 0 6px;
    padding: 8px;
    background: transparent;
    color: #111;
    border: 0;
    border-radius: 50%;
    box-shadow: none;
    cursor: pointer;
}
.chelech-header-top .chelech-product-search .wp-block-search__button:hover {
    background: #ededed;
    color: #111;
}
.chelech-header-top .chelech-product-search .wp-block-search__button:focus-visible {
    outline: 2px solid #17212b;
    outline-offset: -2px;
}
.chelech-header-top .chelech-product-search .wp-block-search__button svg {
    width: 26px;
    height: 26px;
    fill: currentColor;
}
/* Autocomplete is an enhancement around WordPress's native Search block. */
.chelech-product-search {
    position: relative;
}
.chelech-live-search[hidden] {
    display: none !important;
}
.chelech-live-search {
    position: absolute;
    z-index: 100;
    top: calc(100% + 8px);
    right: 0;
    left: 0;
    box-sizing: border-box;
    max-height: min(65vh, 475px);
    overflow-y: auto;
    background: #fff;
    color: #17212b;
    border: 1px solid #d5dce3;
    border-radius: 8px;
    box-shadow: 0 12px 32px rgb(16 28 40 / 16%);
    font-size: 14px;
}
.chelech-live-search__list {
    list-style: none;
    padding: 6px 0;
    margin: 0;
}
.chelech-live-search__item {
    padding: 0;
    margin: 0;
}
.chelech-live-search__product {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    color: inherit;
    text-decoration: none;
}
.chelech-live-search__product:hover,
.chelech-live-search__product:focus-visible {
    background: #f1f5f9;
    color: #17212b;
}
.chelech-live-search__product:focus-visible,
.chelech-live-search__all:focus-visible {
    outline: 2px solid #17212b;
    outline-offset: -2px;
}
.chelech-live-search__image {
    display: flex;
    flex: 0 0 54px;
    width: 54px;
    height: 54px;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #f6f8fa;
    border-radius: 4px;
}
.chelech-live-search__image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.chelech-live-search__placeholder {
    color: #84909d;
    font-size: 22px;
}
.chelech-live-search__info {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 4px;
}
.chelech-live-search__name {
    line-height: 1.35;
    font-weight: 500;
    overflow-wrap: anywhere;
}
.chelech-live-search__price {
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}
.chelech-live-search__footer {
    border-top: 1px solid #e4e9ee;
}
.chelech-live-search__all {
    display: block;
    padding: 12px;
    text-align: center;
    color: #17212b;
    font-weight: 600;
    text-decoration: none;
}
.chelech-live-search__all:hover,
.chelech-live-search__all:focus-visible {
    background: #f1f5f9;
}
.chelech-live-search__message {
    margin: 0;
    padding: 14px 12px;
    color: #536271;
}
.chelech-search-announcer {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    white-space: nowrap;
    clip-path: inset(50%);
}
.chelech-header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    justify-self: end;
    flex-wrap: nowrap;
    gap: 12px;
    min-width: 0;
    margin: 0;
}
.chelech-header-actions .wp-block-woocommerce-mini-cart,
.chelech-header-actions .wp-block-woocommerce-customer-account {
    margin: 0;
}
.chelech-header-actions .wc-block-customer-account__link,
.chelech-header-actions .wc-block-mini-cart__button {
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    min-width: 44px;
    min-height: 44px;
    padding: 7px;
}
.chelech-header-actions .wc-block-customer-account__visual > svg,
.chelech-header-actions .wc-block-mini-cart__button .wc-block-mini-cart__icon {
    display: block;
    width: 30px;
    height: 30px;
}
.chelech-main {
    padding-top: clamp(28px, 4vw, 52px);
    padding-bottom: 72px;
}
/* La portada se diseña en Elementor. No heredar los 900px del layout
 * constrained de Gutenberg: permitir secciones amplias y editables, siempre
 * con márgenes laterales simétricos. Las páginas interiores no cambian. */
body.home .wp-site-blocks > main.chelech-home-main {
    width: 100%;
    max-width: none;
    margin-block-start: 0;
    margin-inline: 0;
    padding-block-start: 8px;
    padding-inline: clamp(16px, 4vw, 80px);
}
body.home .chelech-home-main > .wp-block-post-content {
    box-sizing: border-box;
    width: 100%;
    max-width: none;
    margin-inline: auto;
}
.chelech-site-footer {
    border-top: 1px solid var(--wp--preset--color--line);
    padding-block: 25px;
    color: var(--wp--preset--color--muted);
    font-size: 0.87rem;
}
@media (max-width: 900px) {
    .chelech-header-top {
        grid-template-columns: 112px minmax(0, 1fr) auto;
        gap: 12px;
    }
    .chelech-header-top > .chelech-product-search {
        max-width: 340px;
    }
}
@media (max-width: 680px) {
    .chelech-site-header .chelech-header-inner {
        padding: 12px 16px;
    }
    .chelech-header-top {
        grid-template-columns: minmax(0, 1fr) auto;
        column-gap: 12px;
        row-gap: 12px;
    }
    .chelech-header-top > .wp-block-site-logo {
        grid-column: 1;
        grid-row: 1;
    }
    .chelech-header-top .wp-block-site-logo img {
        max-width: 112px;
    }
    .chelech-header-actions {
        grid-column: 2;
        grid-row: 1;
        gap: 8px;
    }
    .chelech-header-top > .chelech-product-search {
        grid-column: 1 / -1;
        grid-row: 2;
        justify-self: stretch;
        max-width: none;
    }
    .chelech-header-top .chelech-product-search .wp-block-search__input {
        font-size: 16px;
    }
}

/* Diseño adaptable transversal para contenido de Gutenberg y WooCommerce. */
.chelech-main,
.chelech-main > .wp-block-post-content,
.chelech-main .wp-block-group,
.chelech-main .wp-block-column,
.chelech-main .woocommerce,
.chelech-main [class*="wc-block-"] {
    box-sizing: border-box;
    min-width: 0;
}
.chelech-main {
    padding-inline: clamp(16px, 3vw, 44px);
}
.chelech-main :is(img, video, svg, canvas, iframe) {
    max-width: 100%;
}
.chelech-main :is(input, textarea, select) {
    max-width: 100%;
    box-sizing: border-box;
}
.chelech-main :is(.wp-block-table, .woocommerce .shop_table_responsive, .woocommerce .woocommerce-orders-table) {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.chelech-main :is(h1, h2, h3, .wp-block-post-title, .woocommerce-product-details__short-description) {
    overflow-wrap: anywhere;
}
@media (max-width: 781px) {
    .chelech-main .wp-block-columns:not(.is-not-stacked-on-mobile) {
        flex-wrap: wrap;
    }
    .chelech-main .wp-block-columns:not(.is-not-stacked-on-mobile) > .wp-block-column {
        flex-basis: 100% !important;
        min-width: 0;
    }
    .chelech-main .wp-block-media-text:not(.has-media-on-the-right) {
        grid-template-columns: minmax(0, 1fr);
    }
}
@media (max-width: 480px) {
    .chelech-main {
        padding-inline: 16px;
        padding-top: 24px;
        padding-bottom: 42px;
    }
    .chelech-site-header .chelech-header-inner {
        padding-inline: 12px;
    }
    .chelech-header-top {
        column-gap: 8px;
    }
    .chelech-header-top .wp-block-site-logo img {
        max-width: min(112px, 30vw);
    }
    .chelech-header-top .chelech-product-search .wp-block-search__inside-wrapper {
        min-height: 48px;
        padding-left: 16px;
    }
    .chelech-header-actions {
        gap: 2px;
    }
    .chelech-header-actions .wc-block-customer-account__link,
    .chelech-header-actions .wc-block-mini-cart__button {
        min-width: 44px;
        min-height: 44px;
    }
}

/* Header: persistent favorites entry beside account/cart, not a new menu row. */
.chelech-header-actions > .wp-block-shortcode {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 !important;
    line-height: 0;
}
.chelech-header-actions .ch-favorites-access {
    display: inline-flex;
    position: relative;
    box-sizing: border-box;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    color: #17212b;
    border-radius: 50%;
    text-decoration: none;
}
.chelech-header-actions .ch-favorites-access:hover,
.chelech-header-actions .ch-favorites-access:focus-visible {
    background: rgb(0 0 0 / 7%);
}
.chelech-header-actions .ch-favorites-access:focus-visible {
    outline: 2px solid #182e43;
    outline-offset: 2px;
}
.chelech-header-actions .ch-favorites-access svg {
    width: 26px;
    height: 26px;
}
.chelech-header-actions .ch-favorites-access__count {
    position: absolute;
    top: 1px;
    right: 0;
    display: grid;
    place-items: center;
    min-width: 17px;
    height: 17px;
    padding: 0 3px;
    border: 2px solid #ffe51b;
    border-radius: 12px;
    background: #172e41;
    color: #fff;
    font-size: 9px;
    line-height: 1;
    font-weight: 750;
}
.chelech-header-actions .ch-favorites-access__count[hidden] {display:none!important;}
@media (max-width: 480px) {
    .chelech-header-actions .ch-favorites-access {width:40px;height:40px;}
    .chelech-header-actions .ch-favorites-access svg {width:24px;height:24px;}
}

/* The WordPress core shortcode block renders its content as a <p> wrapper;
 * keep that paragraph aligned with existing account and mini-cart icons. */
.chelech-header-actions > p:has(> .ch-favorites-access) {
    display:flex;
    align-items:center;
    margin:0 !important;
    padding:0 !important;
    line-height:0;
}

/* Keep counters consistent on all customer routes, including Woo's cart fallback. */
.chelech-header-actions .ch-header-cart-link {position:relative;color:#17212b;text-decoration:none; border-radius:50%;}
.chelech-header-actions .ch-header-cart-link:hover {background:rgb(0 0 0 / 7%);}
.chelech-header-actions .ch-header-cart-link:focus-visible {outline:2px solid #182e43;outline-offset:2px;}
.chelech-header-actions .wc-block-mini-cart__quantity-badge {position:relative;overflow:visible;}
.chelech-header-actions .wc-block-mini-cart__badge:not([hidden]),
.chelech-header-actions .ch-favorites-access__count:not([hidden]) {position:absolute;top:-4px;right:-5px;display:grid;place-items:center;min-width:17px;height:17px;padding:0 3px;border:2px solid #ffe51b;border-radius:12px;background:#172e41!important;color:#fff!important;font-size:9px;line-height:1;font-weight:750;box-sizing:border-box;}
