/* CODEX — app-like mobile layer. Loaded after store.css / store-pages.css.
   Desktop is unchanged; everything below 621px behaves like a native shopping app. */

:root{--tabbar-h:60px;--safe-b:env(safe-area-inset-bottom,0px)}
html{-webkit-text-size-adjust:100%;text-size-adjust:100%}
body{overflow-x:clip}
a,button,input,select,textarea,label{-webkit-tap-highlight-color:transparent}
button,a,.size-btn,.filter-btn{touch-action:manipulation}
.skip-link{position:absolute;left:-999px;top:8px;z-index:100;background:#e7e7e3;color:#111;padding:10px 14px;font-size:11px}
.skip-link:focus{left:8px}
:focus-visible{outline:2px solid #d7d7d4;outline-offset:2px}
.drawer,.cart-list,.mobile-nav,.modal-card{overscroll-behavior:contain}
img{height:auto}
.product-image img,.category-card img,.social-tile img,.story-image img,.feature-photo img,.pdp-image img,.modal-image img{height:100%}

/* Close button on the quick-view card (all sizes) */
.sheet-close{position:absolute;z-index:2;top:10px;right:10px;width:40px;height:40px;border-radius:50%;border:1px solid rgba(255,255,255,.25);background:rgba(8,8,8,.7);color:#eee;font-size:22px;line-height:1;cursor:pointer;backdrop-filter:blur(6px)}

/* Bottom tab bar + fixed action bars: phones only */
.tabbar,.checkout-bar{display:none}

@media (max-width:620px){
  /* ---------- Tab bar ---------- */
  .mobile-dock{display:none!important}
  .tabbar{display:grid;grid-template-columns:repeat(5,1fr);position:fixed;z-index:25;left:0;right:0;bottom:0;
    height:calc(var(--tabbar-h) + var(--safe-b));padding-bottom:var(--safe-b);
    background:rgba(8,8,8,.96);border-top:1px solid rgba(255,255,255,.12);backdrop-filter:blur(18px);-webkit-backdrop-filter:blur(18px)}
  .tabbar a,.tabbar button{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;
    background:none;border:0;padding:0;color:#8a8a86;font:500 9px/1 var(--sans);letter-spacing:.1em;text-transform:uppercase;cursor:pointer}
  .tabbar svg{width:23px;height:23px;fill:none;stroke:currentColor;stroke-width:1.4;stroke-linejoin:round}
  .tabbar .active,.tabbar a:active,.tabbar button:active{color:#fff}
  .tabbar .active::before{content:"";position:absolute;top:0;left:30%;right:30%;height:2px;background:#e7e7e3;border-radius:0 0 2px 2px}
  .tab-count{position:absolute;top:7px;left:calc(50% + 5px);min-width:17px;height:17px;padding:0 4px;border-radius:9px;background:#e7e7e3;color:#111;font:700 9px/17px var(--sans);letter-spacing:0;text-align:center}
  .tab-count:empty,.tab-count[data-zero]{display:none}

  /* Space so the footer and content are never hidden behind fixed bars */
  .footer{padding-bottom:calc(var(--tabbar-h) + var(--safe-b) + 10px)!important}
  .toast{bottom:calc(var(--tabbar-h) + var(--safe-b) + 14px)!important}
  .wa-float{bottom:calc(var(--tabbar-h) + var(--safe-b) + 14px)!important;right:14px;width:52px;height:52px;padding:0;justify-content:center}
  .wa-float .wa-icon{width:26px;height:26px}

  /* ---------- Product page: sticky buy bar replaces the tab bar ---------- */
  body.has-buybar .tabbar,body.has-checkoutbar .tabbar{display:none}
  body.has-buybar .wa-float,body.has-checkoutbar .wa-float{display:none}
  body.has-buybar .pdp-actions{position:fixed;z-index:25;left:0;right:0;bottom:0;margin:0;gap:10px;
    padding:10px 14px calc(10px + var(--safe-b));background:rgba(8,8,8,.97);border-top:1px solid rgba(255,255,255,.12);backdrop-filter:blur(18px)}
  body.has-buybar .pdp-actions .button{height:48px}
  body.has-buybar .pdp-qty{height:48px;flex:none}
  body.has-buybar .footer{padding-bottom:calc(80px + var(--safe-b))!important}
  body.has-buybar .toast{bottom:calc(84px + var(--safe-b))!important}

  /* ---------- Checkout: total + place order always in reach ---------- */
  .checkout-bar{display:flex;align-items:center;justify-content:space-between;gap:14px;position:fixed;z-index:25;left:0;right:0;bottom:0;
    padding:10px 14px calc(10px + var(--safe-b));background:rgba(8,8,8,.97);border-top:1px solid rgba(255,255,255,.12);backdrop-filter:blur(18px)}
  .checkout-bar small{display:block;font-size:8px;letter-spacing:.2em;text-transform:uppercase;color:#8a8a86}
  .checkout-bar b{font-size:15px;font-weight:600;letter-spacing:.02em}
  .checkout-bar .button{height:48px;flex:1;max-width:60%}
  body.has-checkoutbar .footer{padding-bottom:calc(80px + var(--safe-b))!important}
  .checkout-summary #placeBtn{display:none}

  /* ---------- Touch targets (44px) and no iOS input zoom (16px) ---------- */
  .icon-btn{min-width:44px;min-height:44px}
  .size-btn{width:46px;height:46px;font-size:11px}
  .sizes{flex-wrap:wrap;gap:8px}
  .qty-control button{width:36px;height:36px;font-size:16px}
  .remove-line{padding:8px 0;font-size:10px}
  .drawer-close{min-width:44px;min-height:44px}
  .filter-btn{min-height:40px;display:inline-flex;align-items:center}
  .field input,.field textarea,.field-select,.search-inner input{font-size:16px}
  .field input{padding:14px 13px}
  .pay-option{padding:14px 12px}
  .button{min-height:46px}
  .text-link{padding:12px 0 7px;display:inline-block}
  .quick-add{min-height:40px}
  .product-name a{display:block;padding:6px 0 4px}
  .pdp-copy .kicker a{display:inline-block;padding:10px 0}
  .wa-inline{padding:10px 0}

  /* ---------- Quick view as a bottom sheet ---------- */
  .modal{align-items:end;padding:0}
  .modal-card{max-width:none;width:100%;max-height:90dvh;border-radius:16px 16px 0 0;border-bottom:0;
    transform:translateY(100%);transition:transform .32s cubic-bezier(.2,.7,.2,1);padding-bottom:var(--safe-b)}
  .modal.open .modal-card{transform:none}
  .modal-card::before{content:"";position:absolute;z-index:2;top:8px;left:50%;width:40px;height:4px;margin-left:-20px;border-radius:2px;background:rgba(255,255,255,.35)}
  .modal-image{aspect-ratio:1.25}
  .modal-copy .button{height:50px}

  /* ---------- Drawers ---------- */
  .drawer{width:100%;padding-bottom:var(--safe-b)}
  .cart-foot{padding-bottom:calc(14px + var(--safe-b))}
  .mobile-nav{padding-bottom:var(--safe-b)}

  /* ---------- Content polish ---------- */
  .section-head{gap:14px}
  .checkout-summary{padding:18px}
  .track-grid,.pdp{gap:26px}
  .search-pop{z-index:36}
}

/* Installed app (home-screen): no browser chrome, so give the header some breathing room */
@media (display-mode: standalone){
  .announcement{display:none}
  .site-header{padding-top:env(safe-area-inset-top,0px)}
}
