/*
 * Buyer-facing storefront: product cards, product detail page and the
 * seller card. Loaded last, so it refines the matching rules in
 * site.css and pages.css.
 */

/* ============ PRODUCT CARDS (home page grid) ============ */
.product-card {
  border-radius: 14px;
  transition: border-color .2s ease, box-shadow .25s ease, transform .25s ease;
}
.product-card:hover {
  border-color: #c9d4e6;
  box-shadow: 0 16px 36px rgba(6, 25, 76, .12);
  transform: translateY(-3px);
}

.product-media {
  position: relative;
  height: auto;
  aspect-ratio: 4 / 3;
  padding: 0;
  background: linear-gradient(160deg, #eef3fa, #e2e9f4);
  overflow: hidden;
}
.product-media img {
  width: 100%;
  max-width: none;
  height: 100%;
  object-fit: cover;
  background: none;
  transition: transform .45s ease;
}
.product-card:hover .product-media img { transform: scale(1.05); }
.product-media .placeholder { width: 100%; max-width: none; height: 100%; background: none; }

.fav-btn { top: 12px; right: 12px; backdrop-filter: blur(6px); background: rgba(255, 255, 255, .92); }

.product-body { gap: 6px; padding: 16px 18px 18px; }
.product-seller {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.product-title {
  margin: 0 0 10px;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.product-foot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid #edf0f5;
}
.product-price { margin: 0; font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
.product-price small { color: var(--muted); font-size: 11px; font-weight: 600; }
.product-meta { margin: 0; gap: 6px; font-size: 13px; white-space: nowrap; }

.stock-dot {
  display: inline-block;
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22a35a;
  box-shadow: 0 0 0 3px rgba(34, 163, 90, .15);
}

/* ============ PRODUCT DETAIL ============ */
.detail-grid { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 44px; }

.detail-gallery { position: sticky; top: 20px; }
.gallery-main {
  position: relative;
  aspect-ratio: 4 / 3;
  max-height: none;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: radial-gradient(circle at 50% 40%, #ffffff, #eef2f8 75%);
}
.gallery-main img,
.gallery-main .placeholder {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: none;
}
.gallery-main { overflow: hidden; isolation: isolate; }
.gallery-main #galleryMain { position: relative; z-index: 1; }
.gallery-main .gallery-backdrop {
  position: absolute;
  inset: -40px;
  z-index: 0;
  width: calc(100% + 80px);
  height: calc(100% + 80px);
  object-fit: cover;
  filter: blur(28px) saturate(1.1);
  opacity: .55;
  pointer-events: none;
}
.gallery-count {
  position: absolute;
  right: 14px;
  bottom: 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(6, 25, 76, .72);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  backdrop-filter: blur(6px);
  z-index: 2;
}

.gallery-thumbs {
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.gallery-thumb {
  padding: 0;
  border: 2px solid transparent;
  border-radius: 12px;
  background: #eef2f8;
  overflow: hidden;
  opacity: .7;
  transition: opacity .2s ease, border-color .2s ease;
}
.gallery-thumb img { object-fit: cover; }
.gallery-thumb:hover { opacity: 1; }
.gallery-thumb[aria-current="true"] { border-color: var(--blue); opacity: 1; box-shadow: 0 4px 14px rgba(0, 119, 255, .25); }

.detail-company { margin-bottom: 6px; letter-spacing: .08em; }
.detail-title {
  margin: 0 0 18px;
  color: var(--ink);
  font-size: clamp(26px, 2.6vw, 34px);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -.015em;
  overflow-wrap: anywhere;
}

.buy-box {
  display: grid;
  gap: 14px;
  margin-bottom: 20px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(160deg, #f6f9ff, #fff 60%);
}
.buy-box .detail-price { margin: 0; font-size: 34px; letter-spacing: -.02em; }
.buy-box .detail-stock { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 14px; }
.out-of-stock { color: var(--heart); }
.out-of-stock .stock-dot { background: var(--heart); box-shadow: 0 0 0 3px rgba(229, 72, 77, .15); }
.buy-box .add-to-cart { margin: 0; flex-wrap: wrap; }
.buy-box .btn-outline { justify-self: start; }
.qty-field input {
  width: 84px;
  padding: 12px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  text-align: center;
}
.qty-field input:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 3px rgba(0, 119, 255, .15); }

.detail-card {
  margin-bottom: 20px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}
.detail-card h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 16px;
  font-weight: 800;
}
.detail-card h2 .icon { color: var(--blue); }
.detail-card .detail-subhead { margin-top: 20px; }
.detail-description p { margin: 0 0 10px; }
.detail-video { margin-top: 20px; }

.keyword-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 999px;
  background: #eef4ff;
  color: #1c4fae;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}
.keyword-chip:hover { background: #dfeaff; color: var(--blue); }

/* ============ SELLER CARD ============ */
.seller-profile {
  display: grid;
  gap: 16px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}
.seller-profile-head { display: flex; align-items: center; gap: 14px; }
.seller-profile-logo {
  flex: 0 0 60px;
  width: 60px;
  height: 60px;
  border: 1px solid var(--line);
  border-radius: 14px;
  object-fit: cover;
  background: #f6f8fb;
  font-size: 24px;
}
.seller-profile-title { flex: 1; min-width: 0; }
.seller-profile-title h3 {
  margin: 0;
  color: var(--ink);
  font-size: 18px;
  font-weight: 800;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.seller-profile-eyebrow { margin: 0 0 2px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.seller-profile-location { display: flex; align-items: center; gap: 4px; margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.seller-profile-badge { align-self: flex-start; }
.seller-profile-about { margin: 0; color: #3b4357; font-size: 14px; line-height: 1.6; overflow-wrap: anywhere; }

.seller-contact { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.seller-contact li { display: flex; align-items: center; gap: 10px; min-width: 0; font-size: 14px; }
.seller-contact a {
  min-width: 0;
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.seller-contact a:hover { color: var(--blue); }
.seller-contact-icon {
  display: grid;
  place-items: center;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: #eef4ff;
  color: var(--blue);
}
.seller-contact-icon .icon { width: 16px; height: 16px; }

.seller-social { display: flex; flex-wrap: wrap; gap: 6px; }
.seller-social a {
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #3b4357;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}
.seller-social a:hover { border-color: var(--blue); color: var(--blue); }
.seller-profile-cta { justify-self: stretch; }

/* Narrow version (dashboard preview column) */
.seller-profile.is-compact { margin-bottom: 10px; padding: 18px; gap: 14px;margin-top: 10px; }
.seller-profile.is-compact .seller-profile-head { flex-wrap: wrap; }
.seller-profile.is-compact .seller-profile-logo { flex-basis: 52px; width: 52px; height: 52px; }
.seller-profile.is-compact .seller-profile-title h3 { font-size: 16px; }

@media (max-width: 900px) {
  .detail-gallery { position: static; }
}

@media (max-width: 760px) {
  .detail-grid { grid-template-columns: 1fr; gap: 28px; }
  .product-media img,
  .product-media .placeholder { height: 100%; max-width: none; }
  .product-price { font-size: 17px; }
  .product-foot { flex-direction: column; align-items: flex-start; }
}

/* Show the whole product photo, never cropped: the viewer takes the image's own shape
   (very tall images are capped and centred on the blurred backdrop). */
.gallery-main { aspect-ratio: auto; display: grid; place-items: center; }
.gallery-main #galleryMain { width: 100%; height: auto; max-height: 640px; object-fit: contain; }
.gallery-main .placeholder { aspect-ratio: 4 / 3; }
.gallery-thumb { aspect-ratio: 1 / 1; background: #fff; }
.gallery-thumb img { width: 100%; height: 100%; object-fit: contain; }
