/* =============================================================
   product.css — MOBILE FIRST
   ============================================================= */

.p-wrap {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-4);
  padding-block: var(--sp-2);
  align-items: start;
}
/* Same grid min-width:auto trap as .layout — the nowrap bundle-rail cards
   inflated the column and pushed the document wide on 320px iPhones. */
.p-wrap > * { min-width: 0; }

/* Gallery bleeds to the screen edge on phones — the product is the hero */
.gallery {
  background: #f4f4f4;
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  min-height: 210px;
  display: grid; place-items: center;
  position: relative; overflow: hidden;
  border-bottom: 1.5px solid var(--line);
  margin-inline: calc(var(--gutter) * -1);
}
.gallery-mark {
  width: 118px; height: 118px;
  border-radius: 28px;
  border: 4px solid #111;
  box-shadow: 0 16px 40px rgba(0,0,0,.12);
  position: relative;
}
.gallery-mark::after {
  content: "";
  position: absolute;
  inset: 24px 18px auto 18px;
  height: 12px;
  background: rgba(0,0,0,.16);
  border-radius: 4px;
}

.buy { padding-bottom: var(--sp-2); }
.buy h1 {
  font-size: clamp(20px, 5vw, 26px);
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: -.03em;
  text-wrap: balance;
}
.rating-row {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: var(--t-sm);
}
.rating-row .stars { color: #f5b400; letter-spacing: 1px; }
.rating-row span { color: #777; }
.sku { color: #888; font-size: var(--t-sm); margin-top: var(--sp-1); }

.price-block {
  margin-block: var(--sp-3) var(--sp-4);
  padding-bottom: var(--sp-3);
  border-bottom: 1px solid var(--line);
}
.buy .price { font-size: 28px; letter-spacing: -.03em; }
.price-block .unit { color: #777; font-size: var(--t-sm); font-weight: 600; margin-inline-start: 6px; }
.urgency { margin-top: 6px; color: #1a6b3a; font-weight: 800; font-size: var(--t-sm); line-height: 1.35; }
.ship { margin-top: var(--sp-1); color: #555; font-size: var(--t-sm); }

/* Buy row: the CTA is the full-width primary, quantity sits under it
   so nothing competes with it for the thumb. */
.buy-box {
  display: flex; flex-direction: column;
  align-items: stretch;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}
.buy-box .btn-cart {
  order: 1;
  width: 100%;
  min-height: 52px;
  font-size: var(--t-md);
  border-radius: var(--r-md);
}
.buy-box .stepper {
  order: 2;
  width: 100%;
  justify-content: center;
}
.stepper {
  display: flex;
  border: 1.5px solid #ddd;
  border-radius: var(--r-md);
  overflow: hidden;
  height: 48px;
}
.stepper button, .stepper input {
  width: 52px; height: 100%;
  background: #fff;
  text-align: center;
  font-weight: 800; font-size: 18px;
  transition: background .15s var(--ease);
}
.stepper button:hover { background: var(--yellow-pale); }
.stepper input { width: 60px; border: 0; }

.wa-line {
  display: block;
  margin-bottom: var(--sp-4);
  font-size: var(--t-sm);
}
.wa-line a { font-weight: 700; border-bottom: 2px solid var(--yellow); }

.compat {
  display: flex; flex-wrap: wrap; gap: var(--sp-2) 18px; align-items: center;
  background: #eef7fb;
  border: 1px solid #d5ebf4;
  border-radius: var(--r-md);
  padding: var(--sp-3);
  margin-block: var(--sp-4);
  font-size: var(--t-sm); font-weight: 700;
}
.compat em { font-style: normal; color: #355; font-weight: 600; }

/* accordions */
.fold { border-top: 1px solid var(--line); }
.fold summary {
  cursor: pointer; list-style: none;
  font-weight: 800;
  padding-block: var(--sp-3);
  padding-inline: 0 var(--sp-8);
  min-height: var(--touch);
  display: flex; align-items: center;
  position: relative;
}
.fold summary::-webkit-details-marker { display: none; }
.fold summary::after {
  content: "+";
  position: absolute;
  inset-inline-end: 0;
  color: #888; font-size: 20px;
}
.fold[open] summary::after { content: "–"; }
.fold p { color: #555; padding-bottom: var(--sp-3); font-size: var(--t-sm); }

.bundle-rail { margin-block: var(--sp-3) var(--sp-4); }
.bundle-rail h3 { font-size: var(--h3); margin-bottom: var(--sp-2); }
.rail {
  display: flex; gap: var(--sp-2);
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  margin-inline: calc(var(--gutter) * -1);
  padding-inline: var(--gutter);
  scroll-padding-inline-start: var(--gutter);
}
.rail::-webkit-scrollbar { display: none; }
.rail-card {
  flex: 0 0 66%;
  scroll-snap-align: start;
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--sp-3);
  background: #fffdf2;
}
.rail-card b { display: block; font-size: var(--t-sm); margin-bottom: var(--sp-1); line-height: 1.3; }
.rail-card span { font-weight: 900; }

.xsell {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-3); flex-wrap: wrap;
  background: #fffdf2;
  border: 1.5px dashed #e6c200;
  border-radius: var(--r-md);
  padding: var(--sp-3);
  margin-bottom: var(--sp-5);
  font-size: var(--t-sm);
}
.xsell b { display: block; font-size: var(--t-base); }
.xsell span { color: #555; }
.xsell a { white-space: nowrap; font-weight: 800; border-bottom: 2px solid var(--yellow); }

.desc { color: #444; max-width: 54ch; margin-bottom: var(--sp-5); font-size: var(--t-sm); }

.ship-grid { display: grid; gap: var(--sp-2); margin-bottom: var(--sp-5); }
.ship-row {
  display: flex; gap: var(--sp-2); align-items: flex-start;
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: var(--t-sm);
}
.ship-row strong { display: block; }
.ship-row small { color: #666; }

.specs { width: 100%; border-collapse: collapse; margin-bottom: var(--sp-6); }
.specs td { padding: var(--sp-2) 0; border-bottom: 1px solid #eee; font-size: var(--t-sm); }
.specs td:first-child { color: #777; width: 38%; }

/* FAQ and related now show on phones too */
.faq { display: block; margin-block: var(--sp-2) var(--sp-6); }
.faq h2 { font-size: var(--h2); margin-bottom: var(--sp-3); letter-spacing: -.02em; }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary {
  cursor: pointer; list-style: none;
  font-weight: 800;
  padding-block: var(--sp-3);
  padding-inline: 0 var(--sp-8);
  min-height: var(--touch);
  display: flex; align-items: center;
  position: relative;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  position: absolute;
  inset-inline-end: 0;
  font-size: 20px; font-weight: 400; color: #888;
}
.faq details[open] summary::after { content: "–"; }
.faq details p { color: #555; padding-bottom: var(--sp-4); max-width: 62ch; font-size: var(--t-sm); }

.related { display: block; padding-block: var(--sp-2) var(--sp-6); }
.related h2 { font-size: var(--h2); margin-bottom: var(--sp-3); letter-spacing: -.02em; }
.rel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-2); }

.missing { padding: var(--sp-8) 0; text-align: center; }
.missing h1 { font-size: var(--h2); }
.missing p { color: #666; margin: var(--sp-2) 0 var(--sp-4); }

/* Sticky buy bar takes over once the real CTA scrolls off */
.sticky-cart {
  display: none;
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 85;
  background: rgba(255,255,255,.97);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  padding: var(--sp-2) var(--gutter) calc(var(--sp-2) + var(--safe-b));
  box-shadow: 0 -8px 24px rgba(0,0,0,.08);
  gap: var(--sp-3);
  align-items: center;
}
.sticky-cart.on { display: flex; }
.sticky-cart .meta { flex: 1; min-width: 0; }
.sticky-cart b {
  display: block; font-size: var(--t-sm);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sticky-cart .price { font-size: var(--t-md); }
.sticky-cart .btn { flex: 0 0 auto; min-width: 44%; }

body.has-sticky { --bottom-chrome: calc(64px + var(--safe-b)); }

@media (min-width: 600px) {
  .gallery { min-height: 280px; margin-inline: 0; border-radius: var(--r-lg); border: 1.5px solid var(--line); }
  .gallery-mark { width: 150px; height: 150px; }
  .rail-card { flex-basis: 46%; }
  .rel-grid { grid-template-columns: repeat(3, 1fr); gap: var(--sp-3); }
  .buy-box { flex-direction: row; align-items: stretch; }
  .buy-box .btn-cart { order: 2; flex: 1; width: auto; }
  .buy-box .stepper { order: 1; width: auto; }
}

@media (min-width: 768px) {
  .p-wrap { grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: var(--sp-6); }
  .gallery { min-height: 360px; position: sticky; top: calc(var(--header) + var(--sp-4)); }
  .gallery-mark { width: 175px; height: 175px; }
  .rel-grid { grid-template-columns: repeat(4, 1fr); }
  .rail { margin-inline: 0; padding-inline: 0; }
  .rail-card { flex-basis: 40%; }
}

/* =============================================================
   ≥992px — DESKTOP (original)
   ============================================================= */
@media (min-width: 992px) {
  .p-wrap { grid-template-columns: minmax(0, .88fr) minmax(0, 1.12fr); gap: 48px; padding: 8px 0; }
  .gallery { min-height: 440px; border-radius: 22px; top: 88px; }
  .gallery-mark { width: 200px; height: 200px; border-radius: 36px; }
  .gallery-mark::after { inset: 28px 22px auto 22px; height: 14px; }

  .buy h1 { font-size: clamp(26px, 3.2vw, 36px); line-height: 1.12; }
  .rating-row { gap: 8px; margin-top: 10px; font-size: 14px; }
  .sku { font-size: 13px; margin-top: 6px; }

  .price-block { margin: 0 0 22px; padding-bottom: 22px; }
  .buy .price { font-size: 34px; }
  .price-block .unit { font-size: 14px; }
  .urgency { font-size: 14px; margin-top: 8px; }
  .ship { font-size: 14px; }

  .buy-box { gap: 8px; margin: 0 0 12px; }
  .buy-box .btn-cart { min-height: 54px; font-size: 18px; border-radius: 16px; padding: 14px 22px; }
  .stepper { height: 54px; border-radius: 14px; }
  .stepper button, .stepper input { width: 44px; height: 54px; }
  .stepper input { width: 52px; }

  .wa-line { margin-bottom: 20px; font-size: 15px; }
  .compat { padding: 12px 14px; margin: 18px 0 22px; font-size: 14px; }

  .bundle-rail { display: none; }
  .fold { border: 0; }
  .fold summary { display: none; }
  .fold p { font-size: 15px; }

  .xsell { padding: 12px 14px; margin: 0 0 28px; font-size: 14px; }
  .xsell b { font-size: 14.5px; }
  .desc { margin: 0 0 28px; font-size: 16px; }
  .ship-grid { margin: 0 0 32px; gap: 8px; }
  .ship-row { padding: 10px 12px; font-size: 14px; }
  .specs { margin: 0 0 36px; }
  .specs td { padding: 10px 0; font-size: 14.5px; }
  .specs td:first-child { width: 34%; }

  .faq { margin: 8px 0 40px; }
  .faq summary { padding: 14px 28px 14px 0; }
  .faq details { padding: 4px 0; }
  .faq details p { padding: 0 0 16px; font-size: 15px; }

  .related { padding: 8px 0 88px; }
  .related h2 { margin-bottom: 16px; }
  .rel-grid { grid-template-columns: repeat(4, 1fr); gap: 14px; }

  .missing { padding: 72px 0; }
  .missing p { margin: 10px 0 18px; }

  .sticky-cart { display: none; }
  .sticky-cart.on { display: none; }
  body.has-sticky { --bottom-chrome: 0px; }
}

.gallery-img { width: 100%; height: 100%; object-fit: contain; object-position: center; display: block; }
.gallery { background: #f4f4f4; }

.gallery {
  aspect-ratio: 1 / 1;
  min-height: 0 !important;
  height: auto;
  background: #f4f4f4;
}
.gallery-img { max-height: none; }
