/**
 * Product page, cart, and checkout flow (Oct 2026).
 * Layout pattern: variant line under the title, - qty + stepper, one
 * full-width primary button, cart lines with line totals and bundle
 * "Show N items" expanders, one summary card with subtotal, shipping,
 * total, and a single Checkout button.
 * Dark theme, site.css tokens only (--black, --white, --gold, --rule).
 * Every control is at least 44px tall. Fixed sizes on thumbs and the
 * summary keep the page from shifting while the cart loads.
 * Version: SHOP_FLOW_VERSION in functions/_lib/asset-version.js.
 */

/* ---------- Quantity stepper ---------- */
.qty-stepper {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 10px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.35);
  height: 44px;
  flex: none;
}
.qty-stepper button {
  width: 44px;
  min-width: 44px;
  min-height: 44px;
  border: 0;
  background: transparent;
  color: var(--white);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  touch-action: manipulation;
}
.qty-stepper button:hover,
.qty-stepper button:focus-visible { color: var(--gold); background: rgba(255, 255, 255, 0.05); }
.qty-stepper button:disabled { opacity: 0.35; cursor: default; }
.qty-stepper input,
.qty-stepper .cart-line-qty {
  width: 44px;
  max-width: 44px;
  min-height: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--white);
  text-align: center;
  font-size: 16px; /* 16px stops iOS zoom on focus */
  -moz-appearance: textfield;
  appearance: textfield;
}
.qty-stepper input::-webkit-outer-spin-button,
.qty-stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* ---------- Product page ---------- */
.pdp-variant {
  margin: -4px 0 6px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 14px;
}
.pdp-buy {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 14px 0 6px;
}
.pdp-qty-row { display: flex; align-items: center; gap: 12px; }
.pdp-qty-label { font-size: 14px; color: rgba(255, 255, 255, 0.68); }
.pdp-buy .add-cart-btn {
  width: 100%;
  min-height: 48px;
  margin: 0;
  justify-content: center;
}
.pdp-specs {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 8px 18px;
  margin: 0 0 20px;
  font-size: 15px;
}
.pdp-specs dt { color: rgba(255, 255, 255, 0.6); }
.pdp-specs dd { margin: 0; overflow-wrap: anywhere; }

/* Bundle / kit contents (product page and cart) */
.bundle-items { margin: 8px 0 0; }
.bundle-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--gold);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.bundle-toggle::-webkit-details-marker { display: none; }
.bundle-toggle::after {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform .2s var(--ease);
}
.bundle-items[open] > .bundle-toggle::after,
.bundle-toggle[aria-expanded="true"]::after { transform: rotate(-135deg) translateY(-2px); }
.bundle-list {
  list-style: none;
  margin: 2px 0 4px;
  padding: 0 0 0 12px;
  border-left: 2px solid rgba(201, 151, 44, 0.45);
  font-size: 14px;
  color: rgba(255, 255, 255, 0.82);
}
.bundle-list li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 0;
}
.bundle-list li + li { border-top: 1px solid var(--rule); }
.bundle-qty { color: rgba(255, 255, 255, 0.6); white-space: nowrap; }

/* Added-to-cart sheet: fixed, so it never pushes the page. */
.cart-added {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(56px + env(safe-area-inset-bottom));
  z-index: 260;
  max-width: 440px;
  margin: 0 auto;
  background: #161616;
  border: 1px solid rgba(201, 151, 44, 0.55);
  border-radius: 10px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  padding: 14px 14px 12px;
  transform: translateY(16px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s var(--ease), transform .2s var(--ease);
}
.cart-added.is-open { opacity: 1; transform: none; pointer-events: auto; }
.cart-added-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-weight: 600;
  color: var(--white);
}
.cart-added-head .cart-added-close {
  min-width: 44px;
  min-height: 44px;
  border: 0;
  background: none;
  color: rgba(255, 255, 255, 0.7);
  font-size: 22px;
  cursor: pointer;
}
.cart-added-item { display: flex; gap: 12px; align-items: center; margin: 4px 0 12px; font-size: 14px; }
.cart-added-item .cart-line-thumb { width: 48px; height: 48px; }
.cart-added-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cart-added-actions .btn { min-height: 44px; justify-content: center; width: 100%; }
@media (min-width: 900px) {
  .cart-added { left: auto; right: 24px; bottom: 24px; top: auto; }
}

/* ---------- Cart ---------- */
.cart-head-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 8px;
  margin-bottom: 4px;
  font-size: 14px;
  letter-spacing: normal;
  text-transform: none;
  color: rgba(255, 255, 255, 0.55);
}
.cart-item {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  grid-template-areas:
    "thumb info  total"
    "thumb ctrl  ctrl";
  gap: 6px 14px;
  padding: 16px 0;
  border-bottom: 1px solid var(--rule);
  min-width: 0;
}
.cart-item .cart-line-thumb { grid-area: thumb; width: 72px; height: 72px; }
.cart-item-info { grid-area: info; min-width: 0; }
.cart-item-brand {
  font-size: 14px;
  letter-spacing: normal;
  text-transform: none;
  color: rgba(255, 255, 255, 0.5);
}
.cart-item-info .cart-line-title a { min-height: 44px; display: inline-flex; align-items: center; padding: 2px 0; font-weight: 600; line-height: 1.3; }
.cart-item-variant { font-size: 14px; color: rgba(255, 255, 255, 0.65); margin-top: 2px; }
.cart-item-unit { font-size: 14px; color: rgba(255, 255, 255, 0.55); margin-top: 2px; }
.cart-item-total {
  grid-area: total;
  font-weight: 600;
  color: var(--white);
  white-space: nowrap;
  text-align: right;
}
.cart-item-ctrl { grid-area: ctrl; display: flex; align-items: center; gap: 8px; }
.cart-item .cart-line-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.6);
  font-size: 14px;
  min-height: 44px;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 0 8px;
}
.cart-item-skeleton { height: 105px; border-bottom: 1px solid var(--rule); position: relative; }
.cart-item-skeleton::before,
.cart-item-skeleton::after {
  content: "";
  position: absolute;
  top: 16px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}
.cart-item-skeleton::before { left: 0; width: 72px; height: 72px; }
.cart-item-skeleton::after { left: 86px; right: 30%; height: 16px; top: 22px; }

.cart-summary {
  margin: 18px 0 0;
  padding: 18px 16px;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: #141414;
}
.cart-summary-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0;
  font-size: 15px;
  color: rgba(255, 255, 255, 0.85);
}
/* display:flex above beats the hidden attribute; without this the empty
   "Total USD$0.00" row showed on quote carts and while the cart loaded. */
.cart-summary-row[hidden],
.cart-summary [hidden] { display: none; }
.cart-summary-row.is-total {
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--rule);
  font-size: 18px;
  font-weight: 700;
  color: var(--white);
  align-items: baseline;
}
.cart-summary-row.is-total .cart-currency {
  font-size: 14px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.55);
  margin-right: 6px;
}
.cart-summary-note { font-size: 14px; color: rgba(255, 255, 255, 0.6); margin: 10px 0 0; }
.cart-summary .btn-checkout {
  display: flex;
  width: 100%;
  min-height: 50px;
  justify-content: center;
  align-items: center;
  margin-top: 14px;
  font-size: 16px;
}
.cart-continue { display: inline-flex; align-items: center; min-height: 44px; margin-top: 6px; }

@media (min-width: 900px) {
  .cart-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 32px;
    align-items: start;
  }
  .cart-layout .cart-summary { margin-top: 0; position: sticky; top: 96px; }
}

/* Phone: tighter product title so price and Add to Cart sit higher. */
@media (max-width: 640px) {
  .product-hero-grid h1 { font-size: clamp(26px, 7.2vw, 34px); line-height: 1.15; margin-bottom: 6px; }
  .product-hero-grid .price-tag { font-size: 1.6em; margin: 6px 0; }
  .product-hero-img { max-width: 200px; }
}
.cart-added-actions .btn { padding-inline: 16px; white-space: nowrap; }
@media (max-width: 640px) {
  .page-hero:has(+ .shop-cart-band) { padding: 28px 0 4px; }
  .page-hero:has(+ .shop-cart-band) h1 { margin-bottom: 4px; }
}

/* ---------- Checkout ---------- */
.co-band { padding: 12px 0 calc(var(--space) * 10); }
.co-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "toggle" "summary" "main";
  gap: 0;
}
.co-main { grid-area: main; min-width: 0; padding-top: 8px; }
.co-title { font-size: 26px; margin: 10px 0 4px; }
.co-steps ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0;
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.55);
}
.co-steps li { display: inline-flex; align-items: center; min-height: 44px; }
.co-steps li + li::before {
  content: "";
  width: 6px;
  height: 6px;
  margin: 0 10px;
  border-right: 1.5px solid rgba(255, 255, 255, 0.45);
  border-top: 1.5px solid rgba(255, 255, 255, 0.45);
  transform: rotate(45deg);
}
.co-steps a { color: var(--gold); text-decoration: none; display: inline-flex; align-items: center; min-height: 44px; }
.co-steps li.is-current { color: var(--white); font-weight: 600; }

.co-summary-toggle {
  grid-area: toggle;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  /* Bleed only as far as the .wrap gutter (12px at <=560px) so a 390px
     phone never scrolls sideways; auto width stretches inside the grid. */
  width: auto;
  max-width: none;
  margin: 0 -12px;
  min-height: 56px;
  padding: 0 16px;
  border: 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  background: #141414;
  color: var(--gold);
  font: inherit;
  font-size: 15px;
  cursor: pointer;
}
.co-summary-toggle strong { color: var(--white); font-size: 17px; }
.co-summary-toggle-label { display: inline-flex; align-items: center; gap: 8px; }
.co-chevron {
  width: 7px;
  height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform .2s var(--ease);
}
.co-summary-toggle[aria-expanded="true"] .co-chevron { transform: rotate(-135deg); }

.co-summary {
  grid-area: summary;
  display: none;
  background: #141414;
  margin: 0 -12px;
  padding: 16px;
  border-bottom: 1px solid var(--rule);
}
.co-summary.is-open { display: block; }
.co-lines { margin-bottom: 12px; }
.co-line {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 8px 0;
}
.co-thumb {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 10px;
  background: var(--white);
  border: 1px solid var(--rule);
}
.co-thumb img { width: 100%; height: 100%; object-fit: contain; padding: 5px; border-radius: 10px; }
.co-thumb.is-fallback { background: linear-gradient(160deg, rgba(201, 151, 44, 0.18), rgba(255, 255, 255, 0.03)); }
.co-qty-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 11px;
  background: var(--gold);
  color: var(--black);
  font-size: 12px;
  font-weight: 700;
  line-height: 22px;
  text-align: center;
}
.co-line-title { font-size: 14px; font-weight: 600; line-height: 1.3; color: var(--white); overflow-wrap: anywhere; }
.co-line-variant { font-size: 14px; color: rgba(255, 255, 255, 0.6); margin-top: 2px; }
.co-line-price { font-size: 14px; color: var(--white); white-space: nowrap; }
.co-line-qty { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.co-line-qty .qty-stepper button { min-width: 44px; min-height: 44px; }
.co-line-qty .qty-stepper input { width: 44px; min-height: 44px; }
.co-line-remove { background: none; border: 0; padding: 0; min-height: 44px; color: rgba(255, 255, 255, 0.6); font-size: 14px; text-decoration: underline; cursor: pointer; }
.co-line-skeleton { height: 80px; border-radius: 10px; background: rgba(255, 255, 255, 0.04); margin: 0 0 8px; }
.co-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 0;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.85);
}
.co-row.is-total {
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--rule);
  align-items: baseline;
  font-size: 17px;
  font-weight: 600;
  color: var(--white);
}
.co-row.is-total strong { font-size: 24px; }
.co-currency { font-size: 14px; font-weight: 500; color: rgba(255, 255, 255, 0.55); margin-right: 8px; }
.co-tax-note { font-size: 14px; color: rgba(255, 255, 255, 0.55); margin: 8px 0 0; }

.co-express { text-align: center; margin: 4px 0 18px; }
.co-express-label { font-size: 14px; color: rgba(255, 255, 255, 0.7); margin: 0 0 10px; }
.co-wallets { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.co-wallet { min-height: 48px; border-radius: 10px; overflow: hidden; }
.co-wallet[hidden] { display: none; }
.co-wallet-apple {
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: #000;
  color: #fff;
  font: inherit;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
}
.co-wallet-google { background: #000; }
.co-or {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0 0;
  font-size: 14px;
  letter-spacing: normal;
  color: rgba(255, 255, 255, 0.5);
}
.co-or::before, .co-or::after { content: ""; flex: 1; height: 1px; background: var(--rule); }

.co-section { border: 0; margin: 0 0 22px; padding: 0; min-width: 0; }
.co-h2, .co-section legend {
  display: block;
  font-size: 19px;
  font-weight: 600;
  color: var(--white);
  margin: 18px 0 12px;
  padding: 0;
}
.co-section .forum-input { min-height: 48px; font-size: 16px; }
.co-hint { font-size: 14px; color: rgba(255, 255, 255, 0.6); margin: 4px 0 12px; }
.co-ship-option {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 10px 14px;
  border: 1.5px solid var(--gold);
  border-radius: 10px;
  background: rgba(201, 151, 44, 0.08);
  cursor: pointer;
}
.co-ship-option input { width: 20px; height: 20px; flex: none; accent-color: var(--gold); margin: 0; }
.co-ship-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.co-ship-text strong { color: var(--white); }
.co-ship-text small { color: rgba(255, 255, 255, 0.6); font-size: 14px; }
.co-ship-price { font-weight: 600; color: var(--white); white-space: nowrap; }
.co-addr-grid { display: grid; grid-template-columns: minmax(0, 1fr) 84px 110px; gap: 10px; }
@media (max-width: 420px) {
  .co-addr-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .co-addr-grid .co-city { grid-column: 1 / -1; }
}
#card-container { min-height: 92px; margin: 4px 0 6px; }
.co-pay-btn { width: 100%; min-height: 52px; justify-content: center; font-size: 16px; margin-top: 6px; }
.co-done { margin-top: 16px; }

@media (min-width: 900px) {
  .co-band { padding-top: 24px; }
  .co-grid {
    grid-template-columns: minmax(0, 1fr) 400px;
    grid-template-areas: "main summary";
    gap: 48px;
    align-items: start;
  }
  .co-summary-toggle { display: none; }
  .co-summary {
    display: block;
    margin: 0;
    padding: 22px;
    border: 1px solid var(--rule);
    border-radius: 10px;
    position: sticky;
    top: 96px;
    max-height: calc(100vh - 120px);
    overflow: auto;
  }
}
.co-ship-option,
.co-ship-option strong,
.co-ship-option small,
.co-ship-option span { text-transform: none; letter-spacing: normal; }
.co-ship-option strong { font-size: 15px; }
.co-ship-price { font-size: 15px; }

/* Polish after the live check (Oct 4): Google Pay draws its own black
   button, so its slot stays transparent (no strip under the button). */
.co-wallet-google { background: transparent; border-radius: 10px; }
/* Phones: the crumb row already links Shop, so drop the second
   "Back to shop" row and shrink the image to bring price + Add to Cart up. */
@media (max-width: 640px) {
  .page-hero:has(.product-hero-grid) > .wrap > p.muted.mb-0 { display: none; }
  .product-hero-img { max-width: 168px; }
  .product-hero-grid { gap: 12px; }
}

/* 2026-10-05: quote path stays visible whenever the card form is not. */
.co-quote-alt { margin: 12px 0 0; font-size: 14px; color: rgba(255, 255, 255, 0.75); }
.co-quote-alt .btn { margin-bottom: 8px; }
.co-quote-alt[hidden] { display: none; }

/* 2026-10-09: belt and braces for the 390px sideways scroll (K-series). */
.co-band { overflow-x: clip; }

/* 2026-10-09: version picker on grouped product pages (pill links, 44px).
   Playbook §4: tokens only, 14px text floor, 8px grid, 10px radius. */
.pdp-versions { margin: 8px 0 16px; padding: 0; border: 0; min-width: 0; }
.pdp-versions-legend { padding: 0; margin: 0 0 8px; font-size: 14px; font-weight: 700; color: #FFFFFF; }
.pdp-versions-legend .muted { font-weight: 400; color: #D6D6D6; }
.pdp-version-list { display: flex; flex-wrap: wrap; gap: 8px; }
.pdp-version {
  display: inline-flex; flex-direction: column; justify-content: center; align-items: center;
  min-height: 44px; min-width: 44px; padding: 8px 16px;
  border: 1px solid #666666; border-radius: 10px;
  background: #1A1A1A; color: #FFFFFF; font-size: 16px; line-height: 1.2; text-align: center;
}
.pdp-version:link, .pdp-version:visited { color: #FFFFFF; }
.pdp-version:hover { border-color: #C9972C; color: #FFFFFF; }
.pdp-version.is-active, .pdp-version.is-active:visited { border-color: #C9972C; background: #C9972C; color: #1A1A1A; font-weight: 700; }
.pdp-version-price { font-size: 14px; color: #D6D6D6; margin-top: 4px; }
.pdp-version.is-active .pdp-version-price { color: #1A1A1A; }

/* Shop buttons (playbook §4, 2026-10-09): 16px/700, sentence case, no
   letter-spacing, 44px min, 10px radius, padding 12px 24px. Overrides the
   site.css .btn (12px/600 caps, 0.18em tracking) on product, cart and
   checkout pages; same block as shop-header.css for /shop/ and search. The
   header and phone Call/Text/Book bar sit outside <main> and keep theirs. */
main .btn {
  min-height: 44px; padding: 12px 24px; border-radius: 10px;
  font-size: 16px; font-weight: 700; line-height: 1.2;
  text-transform: none; letter-spacing: 0;
  display: inline-flex; align-items: center; justify-content: center; text-align: center;
}
main .btn-gold, main .btn-gold:hover { background: #C9972C; color: #1A1A1A; border-color: #C9972C; }
main .btn-ghost { background: transparent; color: #C9972C; border: 2px solid #C9972C; }
main .btn-ghost:hover { background: #1A1A1A; color: #FFFFFF; border-color: #C9972C; }
main .cart-added-actions .btn { padding-inline: 16px; }
