/*
 * VEXAR — camada responsiva complementar.
 * Apenas layout para celular/tablet/PC. Não altera catálogo, checkout,
 * pagamento, conta, banco, frete ou demais regras do projeto.
 */

:root{
  --vexar-safe-left: env(safe-area-inset-left, 0px);
  --vexar-safe-right: env(safe-area-inset-right, 0px);
  --vexar-safe-bottom: env(safe-area-inset-bottom, 0px);
}

html{
  -webkit-text-size-adjust:100%;
  text-size-adjust:100%;
}

body{
  min-width:0;
}

button,
.button,
.icon-button,
.cart-button,
.product-card__button,
.link-button,
.option-list button,
.thumbnail-row button{
  min-height:44px;
}

img{
  max-width:100%;
  height:auto;
}

.product-card,
.category-card,
.contact-box,
.modal__panel,
.drawer__panel{
  min-width:0;
}

.products-grid{
  grid-template-columns:repeat(4,minmax(0,1fr));
}

.category-grid{
  grid-template-columns:repeat(3,minmax(0,1fr));
}

.product-card__body,
.product-card__bottom,
.product-detail > *,
.about-grid > *{
  min-width:0;
}

.product-card h3,
.product-card__description,
.product-card__category,
.product-detail h2,
.product-detail p{
  overflow-wrap:anywhere;
}

.drawer__panel{
  padding-bottom:calc(22px + var(--vexar-safe-bottom));
}

.modal__panel{
  overscroll-behavior:contain;
}

.thumbnail-row{
  scrollbar-width:thin;
  -webkit-overflow-scrolling:touch;
}

@media (max-width:1180px){
  .products-grid{
    grid-template-columns:repeat(3,minmax(0,1fr));
  }
  .desktop-nav{
    gap:16px;
  }
}

@media (max-width:1000px){
  .container{
    width:min(100% - 28px, 1180px);
  }

  .products-grid{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }

  .category-grid{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }

  .hero{
    min-height:clamp(500px,72vh,620px);
  }

  .hero__content{
    padding:64px 0;
  }

  .product-detail{
    grid-template-columns:minmax(0,1fr);
  }

  .product-detail__image{
    max-height:560px;
  }

  .about-grid{
    gap:34px;
  }
}

@media (max-width:700px){
  .container{
    width:calc(100% - 24px);
  }

  .topbar__inner{
    gap:8px;
  }

  .brand{
    min-width:0;
    gap:8px;
  }

  .brand span{
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
  }

  .topbar__actions{
    gap:6px;
  }

  .cart-button{
    padding:0 10px;
  }

  .hero{
    min-height:520px;
    align-items:flex-end;
  }

  .hero__image{
    object-position:center center;
  }

  .hero__overlay{
    background:
      linear-gradient(180deg,rgba(11,11,12,.18) 0%,rgba(11,11,12,.55) 45%,rgba(11,11,12,.97) 100%);
  }

  .hero__content{
    padding:48px 0 42px;
  }

  .hero h1{
    font-size:clamp(3.5rem,20vw,5.1rem);
    margin-bottom:22px;
  }

  .hero__text{
    font-size:1rem;
    max-width:100%;
  }

  .hero__actions,
  .contact-actions{
    display:grid;
    grid-template-columns:1fr;
    width:100%;
  }

  .hero__actions .button,
  .contact-actions .button{
    width:100%;
  }

  .section{
    padding:50px 0;
  }

  .section-heading{
    gap:10px;
    margin-bottom:22px;
  }

  .section-heading h2{
    font-size:clamp(1.9rem,10vw,2.6rem);
  }

  .category-grid,
  .products-grid{
    grid-template-columns:minmax(0,1fr);
    gap:14px;
  }

  .category-card{
    min-height:200px;
  }

  .product-card__media{
    height:auto;
    aspect-ratio:1.15/1;
  }

  .product-card__body{
    padding:16px;
  }

  .product-card__description{
    min-height:0;
  }

  .product-card__bottom{
    align-items:flex-end;
  }

  .product-card__button{
    padding-inline:14px;
  }

  .about-grid{
    gap:26px;
  }

  .contact-box{
    padding:22px 18px;
  }

  .modal{
    padding:0;
    place-items:end center;
  }

  .modal__panel,
  .modal__panel--wide{
    width:100%;
    max-height:94dvh;
    border-radius:22px 22px 0 0;
    border-bottom:0;
    padding:22px 16px calc(20px + var(--vexar-safe-bottom));
  }

  .product-detail{
    gap:20px;
  }

  .product-detail__image{
    aspect-ratio:1/1;
    max-height:min(52dvh,480px);
  }

  .thumbnail-row button{
    flex-basis:64px;
    height:64px;
  }

  .option-list{
    gap:9px;
  }

  .option-list button{
    min-width:48px;
    min-height:44px;
  }

  .drawer__panel{
    width:100%;
    border-left:0;
    padding:18px 14px calc(18px + var(--vexar-safe-bottom));
  }

  .cart-item{
    grid-template-columns:64px minmax(0,1fr);
  }

  .cart-item img{
    width:64px;
    height:64px;
  }

  .cart-item > :last-child{
    grid-column:2;
  }

  .checkout-form{
    grid-template-columns:minmax(0,1fr);
  }

  .field--full{
    grid-column:1;
  }

  .field input,
  .field select,
  .field textarea,
  .search-row input{
    font-size:16px;
  }

  .footer__inner{
    gap:8px;
  }

  .toast{
    left:12px;
    right:12px;
    bottom:calc(12px + var(--vexar-safe-bottom));
    max-width:none;
  }
}

@media (max-width:390px){
  .container{
    width:calc(100% - 18px);
  }

  .brand span{
    max-width:90px;
  }

  .icon-button{
    width:40px;
  }

  .cart-button{
    font-size:.9rem;
  }

  .product-card__bottom{
    display:grid;
    grid-template-columns:1fr;
  }

  .product-card__button{
    width:100%;
  }
}

@media (hover:none) and (pointer:coarse){
  .product-card:hover,
  .category-card:hover{
    transform:none;
  }
}


/* Centralização das fotos dos produtos sem alterar o restante do layout */
.product-card__media{
  display:grid;
  place-items:center;
  padding:10px;
}
.product-card__media img,
.product-detail__image,
.thumbnail-row img,
.cart-item img{
  object-fit:contain!important;
  object-position:center center!important;
  background:#090909;
}
.product-card__media img{width:100%;height:100%}


/* VEXAR estabilidade visual v4: fotos de produto centralizadas em PC e celular. */
.product-card__media{overflow:hidden!important;display:flex!important;align-items:center!important;justify-content:center!important;}
.product-card__media img{width:100%!important;height:100%!important;object-fit:contain!important;object-position:center center!important;}
.product-detail__image{display:block!important;width:100%!important;object-fit:contain!important;object-position:center center!important;margin-inline:auto!important;}
.thumbnail-row button{display:grid!important;place-items:center!important;overflow:hidden!important;}
.thumbnail-row img{width:100%!important;height:100%!important;object-fit:contain!important;object-position:center center!important;}
.cart-item img{object-fit:contain!important;object-position:center center!important;}


/* =========================================================
   VEXAR MOBILE V10 — CORREÇÃO TELA PRETA
   Mantém o modal normal e melhora o uso no celular sem
   transformar produto/checkout em tela preta de página inteira.
   ========================================================= */

.product-card{
  cursor:pointer;
}
.product-card:focus-visible{
  outline:2px solid var(--gold);
  outline-offset:3px;
}

/* Garantia: camadas fechadas nunca ocupam a tela */
.modal.hidden,
.drawer.hidden{
  display:none!important;
}

@media (max-width:700px){
  html{scroll-padding-top:72px}

  button,
  a,
  .product-card{
    touch-action:manipulation;
    -webkit-tap-highlight-color:transparent;
  }

  .topbar__inner{
    min-height:64px;
    gap:8px;
  }

  .topbar__actions{
    gap:6px;
  }

  .cart-button{
    padding-inline:10px;
  }

  /* Categorias fáceis de arrastar */
  .category-grid{
    display:flex!important;
    gap:12px!important;
    overflow-x:auto;
    padding:2px 2px 10px;
    scroll-snap-type:x proximity;
    scrollbar-width:none;
  }
  .category-grid::-webkit-scrollbar{display:none}
  .category-card{
    flex:0 0 min(78vw,300px);
    min-height:175px!important;
    scroll-snap-align:start;
  }

  /* Produto no catálogo */
  .products-grid{
    gap:16px!important;
  }
  .product-card{
    border-radius:20px;
  }
  .product-card__media{
    min-height:250px;
    height:auto!important;
    aspect-ratio:1/1;
    padding:10px!important;
  }
  .product-card__media img{
    object-fit:contain!important;
    object-position:center!important;
  }
  .product-card__body{
    padding:16px!important;
  }
  .product-card__button{
    min-height:46px;
    padding-inline:14px;
  }

  /* Produto aberto: bottom sheet normal, com fundo do site visível atrás */
  #product-modal{
    padding:8px!important;
    place-items:end center!important;
    background:transparent!important;
  }

  #product-modal .modal__backdrop{
    display:block!important;
    background:rgba(0,0,0,.68)!important;
  }

  #product-modal .modal__panel,
  #product-modal .modal__panel--wide{
    width:100%!important;
    max-height:92dvh!important;
    height:auto!important;
    border:1px solid var(--line)!important;
    border-bottom:0!important;
    border-radius:22px 22px 0 0!important;
    padding:20px 16px calc(24px + var(--vexar-safe-bottom))!important;
    overflow-y:auto!important;
    background:#121214!important;
    box-shadow:0 -16px 45px rgba(0,0,0,.38)!important;
  }

  #product-modal .modal__panel>.modal__close{
    position:sticky!important;
    float:right;
    top:0!important;
    right:auto!important;
    z-index:12!important;
    width:42px!important;
    height:42px!important;
    margin:0 0 4px 8px;
    background:#1b1b1f!important;
    border:1px solid var(--line)!important;
  }

  #product-modal .product-detail{
    display:block!important;
    clear:both;
  }

  #product-modal .product-detail__image{
    width:100%!important;
    height:min(42dvh,390px)!important;
    max-height:390px!important;
    aspect-ratio:auto!important;
    object-fit:contain!important;
    object-position:center!important;
    margin:0 auto!important;
    border-radius:16px!important;
    background:#090909!important;
  }

  #product-modal .thumbnail-row{
    display:flex!important;
    gap:9px!important;
    overflow-x:auto!important;
    padding:2px 1px 6px!important;
    margin-top:10px!important;
    scrollbar-width:none;
  }
  #product-modal .thumbnail-row::-webkit-scrollbar{display:none}
  #product-modal .thumbnail-row button{
    flex:0 0 68px!important;
    width:68px!important;
    height:68px!important;
    border-radius:11px!important;
  }

  #product-modal .product-detail>div:last-child{
    padding-top:18px;
  }

  #product-modal h2{
    font-size:clamp(1.6rem,7.4vw,2rem);
    line-height:1.12;
    padding-right:2px;
  }

  #product-modal .product-detail__price{
    font-size:1.5rem;
  }

  #product-modal .option-block{
    margin-top:18px;
  }

  #product-modal .option-list{
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:9px!important;
  }

  #product-modal .option-list button{
    width:100%;
    min-height:50px!important;
    padding:10px 8px!important;
    font-weight:800;
  }

  #add-selected-product{
    min-height:54px;
    margin-top:18px;
  }

  /* Sacola ocupando a largura do celular, sem tela preta */
  #cart-drawer .drawer__panel{
    width:min(100%,430px)!important;
    padding:16px 14px calc(18px + var(--vexar-safe-bottom))!important;
  }

  .cart-item{
    grid-template-columns:72px minmax(0,1fr) 38px!important;
    gap:10px!important;
  }
  .cart-item img{
    width:72px!important;
    height:72px!important;
    object-fit:contain!important;
  }

  /* Checkout continua como modal normal e rolável */
  #checkout-modal{
    padding:8px!important;
    place-items:end center!important;
    background:transparent!important;
  }

  #checkout-modal .modal__backdrop{
    display:block!important;
  }

  #checkout-modal .modal__panel{
    width:100%!important;
    max-height:94dvh!important;
    height:auto!important;
    border-radius:22px 22px 0 0!important;
    padding:22px 16px calc(24px + var(--vexar-safe-bottom))!important;
    background:#121214!important;
  }

  #checkout-modal .field input,
  #checkout-modal .field select,
  #checkout-modal .field textarea{
    min-height:50px;
  }
}

@media (max-width:390px){
  #product-modal .option-list{
    grid-template-columns:1fr!important;
  }
}


/* =========================================================
   VEXAR MOBILE V11 — PRODUTO ABRE NA TELA ATUAL
   Corrige modais que podiam acompanhar o fim do documento.
   ========================================================= */

/* Evita que qualquer animação com transform no body vire o
   "referencial" dos elementos position:fixed em alguns celulares. */
body{
  transform:none!important;
}

/* Produto sempre preso à janela visível, não ao final da página. */
#product-modal{
  position:fixed!important;
  inset:0!important;
  z-index:1000!important;
}

#product-modal:not(.hidden){
  display:grid!important;
}

#product-modal.hidden{
  display:none!important;
}

@media (max-width:700px){
  #product-modal{
    place-items:center!important;
    padding:
      calc(10px + env(safe-area-inset-top,0px))
      10px
      calc(10px + env(safe-area-inset-bottom,0px))!important;
    overflow:hidden!important;
    background:transparent!important;
  }

  #product-modal .modal__backdrop{
    position:fixed!important;
    inset:0!important;
    display:block!important;
    background:rgba(0,0,0,.58)!important;
  }

  #product-modal .modal__panel,
  #product-modal .modal__panel--wide{
    position:relative!important;
    width:min(100%,560px)!important;
    max-height:88dvh!important;
    height:auto!important;
    margin:0!important;
    overflow-y:auto!important;
    overscroll-behavior:contain;
    -webkit-overflow-scrolling:touch;
    border:1px solid var(--line)!important;
    border-radius:20px!important;
    padding:18px 14px calc(22px + var(--vexar-safe-bottom))!important;
    background:#121214!important;
    box-shadow:0 22px 60px rgba(0,0,0,.48)!important;
  }

  #product-modal .modal__panel>.modal__close{
    position:sticky!important;
    top:0!important;
    float:right;
    z-index:20!important;
    width:42px!important;
    height:42px!important;
    margin:0 0 4px 8px!important;
    background:#1b1b1f!important;
    border:1px solid var(--line)!important;
  }

  #product-modal .product-detail{
    clear:both;
  }

  #product-modal .product-detail__image{
    height:min(38dvh,360px)!important;
  }
}
