/* Stabilizza il viewport mobile senza disattivare zoom o scorrimento verticale. */
html,body{width:100%;max-width:100%;overflow-x:hidden;overscroll-behavior-x:none}
body{position:relative}
img,svg,video,canvas{max-width:100%}
dialog{overscroll-behavior:contain}
.hero-logo{display:none}
.brand img,.hero-logo,.legal-footer img{filter:drop-shadow(1px 0 0 #fff) drop-shadow(-1px 0 0 #fff) drop-shadow(0 1px 0 #fff) drop-shadow(0 -1px 0 #fff)}
.brand{overflow:hidden}
/* Il file del logo è quadrato e contiene molto spazio trasparente: lo ritagliamo
   visivamente nel suo contenitore, senza ingrandire o troncare il marchio. */
.brand{width:150px;height:62px}
.brand img{width:150px;height:150px;object-fit:contain;transform:translateY(-44px)}
.legal-footer img{object-fit:contain}
main,.topbar,.category-strip,.legal-footer,.mobile-nav{max-width:100%}
.welcome,.catalog,.section-head,.actions,.product-grid,.card,.card-body,.search,.search input{min-width:0}
.search{overflow:visible}
.search>button{border-radius:0 13px 13px 0}
.search input{background:#fff;color:var(--ink)!important;-webkit-text-fill-color:var(--ink)!important;caret-color:var(--blue);color-scheme:light}
.search input::placeholder{color:#767487!important;-webkit-text-fill-color:#767487!important;opacity:1}
.suggestions{z-index:110;max-height:min(68vh,620px);overflow-y:auto;overscroll-behavior:contain}
.suggestions,.suggestions button,.suggestions b{color:var(--ink)!important}
.suggestions button{cursor:pointer;color-scheme:light}
.suggestions span{color:var(--blue)!important}
.card h3,.card .price,.empty{color:var(--ink)}
.suggestions button:hover,.suggestions button:focus-visible{background:#f1efff;outline:2px solid var(--blue);outline-offset:-2px}
.category-strip button.active,.quick button.active{border-color:var(--blue);background:var(--lime);color:var(--blue);box-shadow:0 5px 14px rgba(36,22,154,.14)}
.category-strip,.quick,.recent-row,.detail-thumbs{overscroll-behavior-inline:contain;-webkit-overflow-scrolling:touch;touch-action:auto}

@media(min-width:641px) and (max-width:900px){
  .brand{width:125px;height:54px}
  .brand img{width:125px;height:125px;transform:translateY(-37px)}
}

@media(max-width:640px){
  html,body{min-width:0}
  body{overscroll-behavior-y:auto}
  html:has(dialog[open]),body:has(dialog[open]){overflow:hidden;overscroll-behavior:none}
  .topbar,.mobile-nav{left:0;right:0;width:100%}
  .topbar{grid-template-columns:minmax(0,1fr);gap:0;padding:8px 10px 10px;padding-top:max(8px,env(safe-area-inset-top))}
  .brand{display:none}
  .search{width:100%;height:58px;min-width:0;border-width:2px;border-radius:18px;box-shadow:0 7px 22px rgba(36,22,154,.15)}
  .search input{width:0;max-width:100%;font-size:16px}
  .search button{display:block;min-width:70px;padding:0 13px;font-size:.88rem}
  .category-strip{top:calc(76px + env(safe-area-inset-top));width:100%;touch-action:auto}
  .suggestions{top:calc(74px + env(safe-area-inset-top))}
  .suggestions{left:50%;right:auto;width:calc(100% - 24px);max-width:440px;transform:translateX(-50%);border-radius:18px}
  .suggestions button{grid-template-columns:68px minmax(0,1fr);grid-template-rows:auto auto;gap:4px 14px;min-height:82px;padding:9px 14px}
  .suggestions img{grid-row:1/3;justify-self:center;width:62px;height:62px;border-radius:12px}
  .suggestions b{align-self:end;font-size:.94rem;line-height:1.25}
  .suggestions span{align-self:start;font-size:.9rem}
  .welcome{min-height:475px;padding-top:88px;cursor:pointer}
  .welcome .eyebrow,.welcome p{display:none}
  .hero-logo{position:absolute;z-index:3;top:12px;left:50%;display:block;width:174px;height:76px;transform:translateX(-50%);object-fit:cover;filter:drop-shadow(1px 0 0 #fff) drop-shadow(-1px 0 0 #fff) drop-shadow(0 1px 0 #fff) drop-shadow(0 -1px 0 #fff) drop-shadow(0 5px 12px rgba(12,8,68,.35))}
  .trust{display:grid;grid-template-columns:max-content;gap:7px}
  .trust span:nth-child(1){display:inline-flex}
  main{width:100%;min-width:0}
  .welcome,.catalog,.product-grid,.card{width:100%;max-width:100%}
  .quick,.recent-row,.detail-thumbs{max-width:100%;touch-action:auto}
  main,.welcome,.catalog,.product-grid,.card,.card-media,.card-body{touch-action:pan-y pinch-zoom}
  .welcome img,.card-media img{pointer-events:none;-webkit-user-drag:none;user-select:none}
  .actions{width:100%;max-width:100%}
  .actions select,.actions button{max-width:100%}
  .product-dialog,.cart-dialog,.legal-dialog{max-width:100%}
  .product-dialog{inset:0;width:100%;height:100dvh;max-height:100dvh;margin:0;padding:0;border-radius:0;overflow-x:hidden;overflow-y:auto}
  .product-dialog .product-view{display:block;width:100%;min-height:100%}
  .product-dialog .detail-media{min-height:38dvh;padding:calc(14px + env(safe-area-inset-top)) 16px 12px}
  .product-dialog .detail-main-image{display:block;width:100%;height:30dvh;max-height:310px;margin:auto;object-fit:contain}
  .product-dialog .detail-thumbs{justify-content:flex-start;padding:3px 0}
  .product-dialog .detail-copy{padding:20px 18px calc(24px + env(safe-area-inset-bottom))}
  .product-dialog .detail-copy h2{margin-right:42px;font-size:1.45rem;line-height:1.15}
  .product-dialog .detail-description{max-height:none;overflow:visible;font-size:.94rem;line-height:1.55}
  .product-dialog .detail-price{font-size:1.65rem}
  .product-dialog .buy-row{grid-template-columns:minmax(0,1fr) 82px}
  .product-dialog .buy-row select,.product-dialog .buy-row input{min-width:0;min-height:50px;font-size:16px}
  .product-dialog .add-cart{position:sticky;bottom:max(10px,env(safe-area-inset-bottom));z-index:2;min-height:52px;font-size:1rem;box-shadow:0 10px 28px rgba(36,22,154,.3)}
  .product-dialog .dialog-close{top:max(12px,env(safe-area-inset-top));right:12px}
  .cart-dialog,.legal-dialog,#iosDialog{overflow-x:hidden;overscroll-behavior:contain}
  button,a,input,select{touch-action:manipulation}
  .category-strip button,.actions button,.actions select{min-height:44px}
  .cookie-banner,.install-banner{max-width:calc(100% - 20px)}
  .whatsapp{max-width:54px}
  body{padding-bottom:82px}
  .mobile-nav{z-index:70;grid-template-columns:repeat(5,minmax(0,1fr));min-height:74px;padding:7px 8px calc(7px + env(safe-area-inset-bottom));border-top:1px solid rgba(36,22,154,.12);border-radius:22px 22px 0 0;background:rgba(255,255,255,.96);box-shadow:0 -10px 30px rgba(28,20,92,.14);backdrop-filter:blur(18px)}
  .mobile-nav a,.mobile-nav button{position:relative;display:grid;grid-template-rows:27px auto;gap:3px;place-items:center;min-width:0;min-height:58px;padding:5px 2px;border-radius:15px;color:var(--blue);font-size:.72rem;font-weight:850;line-height:1;background:transparent}
  .mobile-nav .nav-home{background:#f0edff}
  .mobile-nav a:active,.mobile-nav button:active{background:var(--lime);transform:scale(.96)}
  .mobile-nav svg{width:25px;height:25px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
  .mobile-nav span{display:block;white-space:nowrap}
  .mobile-nav i{position:absolute;top:1px;left:calc(50% + 8px);display:grid;place-items:center;min-width:21px;height:21px;padding:0 5px;border:2px solid #fff;background:var(--lime);box-shadow:0 2px 6px rgba(36,22,154,.2);font-size:.67rem}
  .whatsapp{bottom:calc(88px + env(safe-area-inset-bottom))}
  .install-banner,.cookie-banner{bottom:calc(86px + env(safe-area-inset-bottom))}
}

@media(max-width:380px){
  .welcome{min-height:450px;padding-top:82px}
}

/* iPhone PWA: keep the product sheet above the safe area and fixed mobile controls. */
@media(max-width:640px){
  body.product-dialog-open{padding-bottom:0!important}
  body.product-dialog-open .mobile-nav,
  body.product-dialog-open .whatsapp,
  body.product-dialog-open .footer-jump,
  body.product-dialog-open .install-banner,
  body.product-dialog-open .cookie-banner,
  body.product-dialog-open .android-install-fixed{display:none!important}
  .product-dialog[open]{position:fixed!important;inset:0!important;width:100vw!important;height:var(--le3c-dialog-height,100dvh)!important;min-height:var(--le3c-dialog-height,100dvh)!important;max-height:none!important;margin:0!important;padding:0!important;border-radius:0!important;background:#fff!important;overflow-x:hidden!important;overflow-y:auto!important;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;touch-action:pan-y}
  .product-dialog[open] .product-view{width:100%;min-height:100%}
  .product-dialog[open] .detail-copy{padding-bottom:calc(52px + env(safe-area-inset-bottom))!important}
}
