/*
 * Astelar 3D — Ajustes responsivos (mobile)
 * ------------------------------------------------------------------
 * Carregado DEPOIS de style.css (dependência astelar-style), então
 * estas regras sobrescrevem o tema base apenas em telas pequenas.
 * Mantém o desktop intacto: tudo dentro de @media max-width.
 * ================================================================== */

/* ==================================================================
   1. Higiene global — evita overflow lateral e atritos de toque
   ================================================================== */
html { -webkit-text-size-adjust: 100%; }
body { overflow-x: clip; }                 /* corta qualquer estouro horizontal sem quebrar o sticky */
img, svg, video, iframe { max-width: 100%; }
* { -webkit-tap-highlight-color: rgba(184, 149, 106, .14); }

/* Logo (símbolo) — largura SEMPRE proporcional à altura.
   Corrige a distorção no iOS Safari, que não deriva a proporção dos
   atributos width/height da <img> e acabava esticando a imagem. */
.ast-logo__symbol {
    width: auto !important;
    max-width: none !important;
    aspect-ratio: 759 / 700;
}

/* Quebra textos/links longos para não esticarem o layout */
.tk-card-title,
.ast-section__lead,
.tk-page-content p,
.tk-footer-col a,
.woocommerce-error,
.woocommerce-message,
.tk-search-results__title { overflow-wrap: anywhere; }

/* iOS dá zoom ao focar inputs com fonte < 16px — forçamos 16px no mobile */
@media (max-width: 768px) {
    input[type="text"],
    input[type="search"],
    input[type="email"],
    input[type="tel"],
    input[type="number"],
    input[type="password"],
    select,
    textarea {
        font-size: 16px !important;
    }
}

/* ==================================================================
   2. Header — compacto e equilibrado com o novo logo (símbolo + texto)
   ================================================================== */
@media (max-width: 899px) {
    /* Colunas simétricas (1fr | auto | 1fr) → logo centralizado no viewport,
       independentemente das larguras do menu (esq.) e dos ícones (dir.). */
    .tk-header-inner {
        grid-template-columns: 1fr auto 1fr;
        padding: 9px 0;
        gap: 8px;
    }
    .tk-menu-btn { justify-self: start; }
    .tk-header-actions { justify-self: end; }
    .tk-logo { justify-content: center; min-width: 0; }
    .tk-logo .ast-logo { max-width: 100%; align-items: center; }
    .tk-logo .ast-logo__text { align-items: center; }
    .tk-logo .ast-logo__symbol { height: 34px !important; margin-inline: auto; }
    .tk-logo .ast-logo--stack { gap: 4px; }
    .tk-logo .ast-logo__word { font-size: 12.5px !important; letter-spacing: .12em; }
}
@media (max-width: 600px) {
    .tk-header-actions { gap: 0; }
}
@media (max-width: 374px) {
    .tk-container { padding: 0 14px; }
    .tk-logo .ast-logo__symbol { height: 30px !important; }
    .tk-logo .ast-logo__word { font-size: 11px !important; letter-spacing: .08em; }
    .tk-icon-btn { width: 40px; }
    .tk-menu-btn { width: 40px; padding: 11px 9px; }
}

/* ==================================================================
   3. Faixa de avisos (marquee) — mais discreta no mobile
   ================================================================== */
@media (max-width: 600px) {
    .tk-marquee { font-size: 10.5px; padding: 7px 0; letter-spacing: .1em; }
    .tk-marquee-track { gap: 40px; }
}

/* ==================================================================
   4. Espaçamento de seções — menos "vão" em telas pequenas
   ================================================================== */
@media (max-width: 600px) {
    .ast-section { padding: 44px 0; }
    .home .ast-section,
    .home .ast-section + .ast-section { padding-top: 30px; padding-bottom: 30px; }
    .ast-section__head { margin-bottom: 26px; }
    .ast-section__title { margin-bottom: 10px; }
}

/* ==================================================================
   5. Página de Lançamentos / Ofertas — filtros mais enxutos no mobile
   ================================================================== */
@media (max-width: 899px) {
    .ast-lcm-wrap { gap: 18px; padding-top: 20px; }
    .ast-filter-group { padding-bottom: 16px; margin-bottom: 16px; }
    .ast-shop-bar { margin-bottom: 16px; }
    .ast-filter-list--colors { gap: 10px 16px; }
}

/* ==================================================================
   5.x Drawers laterais — Filtrar e Ordenar (mobile)
   ================================================================== */
@media (max-width: 899px) {

    /* Overlay escurecido */
    .ast-drawer-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, .45);
        z-index: 1000;
        opacity: 0;
        pointer-events: none;
        transition: opacity .28s ease;
    }
    .ast-drawer-overlay--visible {
        opacity: 1;
        pointer-events: auto;
    }

    /* Base: ambos os drawers deslizam pela direita */
    .ast-filter-sidebar,
    .ast-sort-drawer {
        position: fixed !important;
        top: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        left: auto !important;
        width: 86vw !important;
        max-width: 340px !important;
        background: #fff !important;
        z-index: 1001;
        transform: translateX(110%);
        transition: transform .3s ease;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        flex: unset !important;
        margin: 0 !important;
        padding: 0 !important;
        border: none !important;
        box-shadow: -4px 0 28px rgba(0, 0, 0, .2);
    }
    .ast-filter-sidebar.ast-drawer--open,
    .ast-sort-drawer.ast-drawer--open {
        transform: translateX(0);
    }

    /* Cabeçalho do drawer */
    .ast-drawer-header {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        padding: 17px 20px;
        background: var(--ast-terracotta, #b8956a);
        color: #fff;
        position: sticky;
        top: 0;
        z-index: 2;
    }
    .ast-drawer-title {
        font-size: 14.5px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: .09em;
    }
    .ast-drawer-close {
        background: none;
        border: none;
        padding: 5px;
        cursor: pointer;
        color: #fff;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 4px;
        transition: background .15s;
        line-height: 1;
    }
    .ast-drawer-close:hover,
    .ast-drawer-close:focus { background: rgba(255, 255, 255, .18); }

    /* Corpo dos filtros */
    .ast-drawer-body { padding: 20px; }

    /* Ordenação: lista estilo rádio */
    .ast-sort-drawer { display: block !important; }
    .ast-sort-list {
        list-style: none;
        margin: 0;
        padding: 0;
    }
    .ast-sort-item {
        border-bottom: 1px solid var(--tk-border, #e8e8e8);
    }
    .ast-sort-item:last-child { border-bottom: none; }
    .ast-sort-option {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        padding: 16px 20px;
        background: none;
        border: none;
        font-family: inherit;
        font-size: 14.5px;
        font-weight: 500;
        color: var(--ast-ink, #1a1a1a);
        cursor: pointer;
        text-align: left;
        gap: 10px;
    }
    .ast-sort-option:active { background: #f5f5f5; }
    .ast-sort-item--active .ast-sort-option {
        font-weight: 700;
        color: var(--ast-terracotta, #b8956a);
    }

    /* Barra de ações mobile (Ordenar | Filtrar) */
    .ast-mobile-actions {
        display: flex !important;
        align-items: stretch;
        border-top: 1px solid var(--tk-border, #e8e8e8);
        border-bottom: 1px solid var(--tk-border, #e8e8e8);
        margin-bottom: 16px;
        background: #fff;
    }
    .ast-mobile-action-btn {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 7px;
        padding: 13px 10px;
        background: none;
        border: none;
        font-family: inherit;
        font-size: 13.5px;
        font-weight: 600;
        color: var(--ast-ink, #1a1a1a);
        cursor: pointer;
        letter-spacing: .03em;
        transition: background .15s;
    }
    .ast-mobile-action-btn:active { background: #f5f5f5; }
    .ast-mobile-actions__div {
        width: 1px;
        background: var(--tk-border, #e8e8e8);
        flex-shrink: 0;
        align-self: stretch;
        margin: 8px 0;
    }

    /* Oculta o select de ordenação no mobile (usa o drawer) */
    .ast-sort-wrap { display: none !important; }

    /* Bloqueia scroll do body com drawer aberto */
    body.ast-drawer-active { overflow: hidden; }
}

/* ==================================================================
   6. Carrinho / Checkout — empilha colunas e ações de largura total
   (rede de segurança além do woocommerce-smallscreen)
   ================================================================== */
@media (max-width: 768px) {
    .woocommerce-cart .woocommerce,
    .woocommerce-checkout .woocommerce { padding: 24px 14px 56px; }

    .woocommerce table.shop_table { font-size: 14px; }

    /* duas colunas (dados + pedido) viram uma só */
    .woocommerce .col2-set,
    .woocommerce-page .col2-set,
    .woocommerce-checkout #customer_details.col2-set,
    .woocommerce .col2-set .col-1,
    .woocommerce .col2-set .col-2,
    .woocommerce-cart .cart-collaterals,
    .woocommerce-cart .cart-collaterals .cart_totals,
    .woocommerce-cart .cart-collaterals .cross-sells {
        width: 100% !important;
        float: none !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    /* botões de ação principais ocupam a linha toda (mais fáceis de tocar) */
    .woocommerce .wc-proceed-to-checkout .checkout-button,
    .woocommerce #place_order,
    .woocommerce button[name="update_cart"],
    .woocommerce-cart .actions .button {
        width: 100% !important;
        display: block;
        text-align: center;
    }

    /* cupom: input + botão empilhados */
    .woocommerce-cart .actions .coupon { display: flex; flex-wrap: wrap; gap: 8px; }
    .woocommerce-cart .actions .coupon .input-text { flex: 1 1 100%; width: 100% !important; }
    .woocommerce-cart .actions .coupon .button { flex: 1 1 100%; }

    .woocommerce form .form-row { width: 100% !important; }
}

/* ==================================================================
   7. Produto único — quantidade + comprar bem distribuídos
   ================================================================== */
@media (max-width: 480px) {
    .single-product form.cart .single_add_to_cart_button { flex: 1 1 100%; }
    .single-product .summary { margin-top: 8px; }
}

/* ==================================================================
   8. Rodapé — centralizado e respirando no single-column
   ================================================================== */
@media (max-width: 560px) {
    .tk-footer-grid { gap: 28px; text-align: center; }
    /* Lockup centralizado: o "A" fica alinhado sobre o texto (vence o flex-start base) */
    .tk-footer-brand__logo { display: inline-block; }
    .tk-footer-brand .ast-logo,
    .tk-footer-brand .ast-logo__text { align-items: center !important; }
    .tk-footer-brand .ast-logo__symbol { margin-inline: auto; }
    .tk-footer-brand p { margin-inline: auto; }
    .tk-footer-social { justify-content: center; }
    .tk-footer-copy .tk-container { justify-content: center; text-align: center; }
}

/* ==================================================================
   Banner de Categoria — ajustes responsivos
   ================================================================== */
@media (max-width: 1024px) {
    .ast-cat-banner .ast-carousel__slide img { height: 380px; }
}
@media (max-width: 767px) {
    .ast-cat-banner .ast-carousel__slide img { height: 50vh; }
    /* Mostra as setas no mobile (o swipe também funciona) */
    .ast-cat-banner .ast-carousel__nav {
        display: flex !important;
        width: 36px;
        height: 36px;
    }
    .ast-cat-banner .ast-carousel__nav--prev { left: 10px; }
    .ast-cat-banner .ast-carousel__nav--next { right: 10px; }
    /* Bullets menores */
    .ast-cat-banner .ast-carousel__dots { padding: 4px 8px; gap: 6px; }
    .ast-cat-banner .ast-carousel__dot { width: 6px; height: 6px; }
    .ast-cat-banner .ast-carousel__dot.is-active { width: 16px; }
}
