/* Cross-document view transitions: product card -> product detail */
@view-transition { navigation: auto; }

::view-transition-old(root),
::view-transition-new(root) { animation-duration: .12s; }
::view-transition-group(product-image) {
  animation-duration: .28s;
  animation-timing-function: cubic-bezier(.2, .9, .25, 1.05);
}
::view-transition-old(product-image),
::view-transition-new(product-image) {
  animation-duration: .28s;
}
.pdp .plate img { view-transition-name: product-image; }

/* Cart badge pop */
.cart-count.pop { animation: mf-cart-pop .45s cubic-bezier(.2,.9,.25,1.4); }
@keyframes mf-cart-pop {
  0% { transform: scale(1); }
  35% { transform: scale(1.5); }
  100% { transform: scale(1); }
}

/* Add-to-cart button feedback */
#addCartBtn.added {
  background: rgba(106,216,192,.18);
  border-color: var(--mint);
  color: var(--mint);
}
#addCartBtn.added svg { display: none; }

@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  ::view-transition-group(product-image) { animation: none !important; }
  .cart-count.pop { animation: none !important; }
}

/* Mobile spec bottom sheet */
.mf-spec-btn { display: none; }
@media (max-width: 900px) {
  .pdp .specs.mf-hide-inline { display: none; }
  .mf-spec-btn {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    width: 100%; height: 44px; margin-top: 8px; padding: 0 12px;
    border: 1px solid #2b3b51; border-radius: 10px;
    background: #0f1a2a; color: #edf2fa; font-size: 12.5px; cursor: pointer;
  }
  .mf-spec-btn b { font-family: var(--mono); color: #6ad8c0; font-weight: 600; }
}
.mf-sheet { position: fixed; inset: 0; z-index: 130; visibility: hidden; }
.mf-sheet.open { visibility: visible; }
.mf-sheet-backdrop { position: absolute; inset: 0; background: rgba(3,7,14,.66); opacity: 0; transition: opacity .25s; }
.mf-sheet.open .mf-sheet-backdrop { opacity: 1; }
.mf-sheet-panel {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: #121e30; border-top: 1px solid #2b3b51;
  border-radius: 20px 20px 0 0; padding: 10px 18px calc(18px + env(safe-area-inset-bottom));
  transform: translateY(102%); transition: transform .3s cubic-bezier(.2,.9,.25,1.05);
  max-height: 80vh; overflow: auto;
}
.mf-sheet.open .mf-sheet-panel { transform: none; }
.mf-sheet-panel.dragging { transition: none; }
.mf-sheet-handle { height: 20px; display: grid; place-items: center; touch-action: none; }
.mf-sheet-handle::after { content: ""; width: 40px; height: 4px; border-radius: 2px; background: #3c506d; }
.mf-sheet-panel h3 { font-size: 15px; margin: 2px 0 12px; }
.mf-sheet-body .specs { grid-template-columns: 1fr 1fr; }
.mf-sheet-panel .btn { width: 100%; margin-top: 10px; }


/* instant press feedback for product links (all browsers) */
.pcard:active, .spec-strip:active { transform: scale(.985); }

/* mobile cart tab */
.tabbar a { position: relative; }
.tab-badge {
  position: absolute; top: 2px; right: calc(50% - 21px);
  min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
  background: #6ad8c0; color: #06221a; font-size: 9px; font-weight: 700;
  display: grid; place-items: center; line-height: 1;
}
.tab-badge[hidden] { display: none; }
@media (max-width: 900px) { .tabbar { grid-template-columns: repeat(6, 1fr); } }
