/* ============================================
   客信新材料 KeXinMaterials — Products Page Enhancements
   Sticky series nav · Rich product cards · Detail modal
   ============================================ */

/* ── Sticky Series Navigation ── */
.series-nav {
  position: sticky;
  top: var(--header-height);
  /* Keep below the fixed header so it can never cover the hamburger toggle,
     and avoid backdrop-filter (blur) which on a sticky element makes Chrome
     eat clicks in the fixed header region after the page is scrolled. */
  z-index: var(--z-dropdown);
  background-color: rgba(13, 13, 13, 0.96);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: var(--space-3) 0;
}

/* Right-edge fade to signal horizontal scroll on desktop/tablet */
.series-nav .container {
  position: relative;
}

.series-nav .container::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 40px;
  height: 100%;
  pointer-events: none;
  background: linear-gradient(to right, rgba(13, 13, 13, 0), rgba(13, 13, 13, 0.96));
}

.series-nav__inner {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.series-nav__inner::-webkit-scrollbar {
  display: none;
}

.series-nav__inner a {
  flex: 0 0 auto;
  scroll-snap-align: start;
  padding: 9px 20px;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-full);
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.series-nav__inner a:hover,
.series-nav__inner a.active {
  color: var(--color-black);
  background-color: var(--color-accent);
  border-color: var(--color-accent);
}

/* Long/short label swap: full on desktop, short on mobile */
.series-nav__inner a .sn-short {
  display: none;
}

/* ── Mobile / tablet: wrap short chips so ALL series show at once ── */
@media (max-width: 1024px) {
  .series-nav {
    padding: var(--space-3) 0;
  }
  .series-nav .container::after {
    display: none; /* no scroll cue needed — everything is visible */
  }
  .series-nav__inner {
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    overflow-x: visible;
  }
  .series-nav__inner a {
    flex: 0 0 auto;
    padding: 7px 14px;
    font-size: var(--text-xs);
    letter-spacing: 0.02em;
  }
  .series-nav__inner a .sn-full {
    display: none;
  }
  .series-nav__inner a .sn-short {
    display: inline;
  }
}

/* ── Rich Product Card ── */
.pcard {
  position: relative;
  display: flex;
  flex-direction: column;
  background-color: var(--color-white);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.06);
  transition: all var(--transition-slow);
}

.pcard:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-xl);
  border-color: var(--color-accent);
}

.pcard__media {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: linear-gradient(135deg, #f2efea 0%, #e6e1d9 100%);
}

.pcard__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}

.pcard:hover .pcard__media img {
  transform: scale(1.07);
}

/* CSS fallback visual when no photo available */
.pcard__media--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1a1a1a 0%, #333 100%);
}

.pcard__media--placeholder .ph-model {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: var(--weight-extrabold);
  color: rgba(255, 255, 255, 0.14);
  letter-spacing: var(--tracking-wider);
  text-align: center;
  padding: var(--space-4);
  line-height: 1.1;
}

.pcard__badge {
  position: absolute;
  top: var(--space-3);
  left: var(--space-3);
  padding: 4px 12px;
  background-color: var(--color-primary);
  color: var(--color-white);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  border-radius: var(--radius-sm);
  z-index: 2;
}

.pcard__body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: var(--space-5);
}

.pcard__cat {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: var(--space-2);
}

.pcard__title {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  color: var(--color-dark);
  margin-bottom: var(--space-1);
  line-height: var(--leading-snug);
}

.pcard__model {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-gray-500);
  margin-bottom: var(--space-3);
}

.pcard__desc {
  font-size: var(--text-sm);
  color: var(--color-gray-700);
  line-height: var(--leading-relaxed);
  margin-bottom: var(--space-4);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pcard__specs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.pcard__spec {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: var(--text-xs);
  color: var(--color-gray-700);
  background-color: var(--color-off-white);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
}

.pcard__spec svg {
  width: 13px;
  height: 13px;
  color: var(--color-accent);
  flex-shrink: 0;
}

.pcard__colors {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: var(--space-5);
}

.pcard__colors .label {
  font-size: var(--text-xs);
  color: var(--color-gray-500);
  margin-right: 2px;
}

.pcard__color {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 2px solid var(--color-white);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.pcard__footer {
  margin-top: auto;
  display: flex;
  gap: var(--space-2);
  align-items: center;
}

.pcard__footer .btn {
  flex: 1;
  justify-content: center;
  padding: 11px 14px;
}

/* ── Product Detail Modal ── */
.product-modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}

.product-modal.active {
  display: flex;
}

.product-modal__overlay {
  position: absolute;
  inset: 0;
  background-color: rgba(13, 13, 13, 0.82);
  backdrop-filter: blur(4px);
}

.product-modal__dialog {
  position: relative;
  z-index: 2;
  background-color: var(--color-white);
  border-radius: var(--radius-xl);
  max-width: 860px;
  width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xl);
  animation: modalIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.product-modal__media {
  position: relative;
  background: linear-gradient(135deg, #f2efea 0%, #e6e1d9 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 320px;
}

.product-modal__media img {
  width: 100%;
  height: 100%;
  max-height: 420px;
  object-fit: cover;
}

/* ── Product Gallery (multi-image) ── */
.product-modal__gallery {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4);
  background: linear-gradient(135deg, #1a1a1a 0%, #2c2c2c 100%);
  min-height: auto;
}

.pg-main {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #f4f1ec;
  border-radius: var(--radius-md);
  overflow: hidden;
  min-height: 300px;
}

.pg-main img {
  width: 100%;
  height: auto;
  max-height: 440px;
  object-fit: contain;
}

.pg-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 50%;
  background-color: rgba(13, 13, 13, 0.55);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
  transition: background-color var(--transition-fast);
}

.pg-nav:hover {
  background-color: var(--color-accent);
}

.pg-prev { left: 12px; }
.pg-next { right: 12px; }

.pg-counter {
  position: absolute;
  bottom: 12px;
  right: 12px;
  z-index: 2;
  padding: 3px 10px;
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  color: #fff;
  background-color: rgba(13, 13, 13, 0.6);
  border-radius: var(--radius-full);
}

.pg-thumbs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  max-height: 90px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.pg-thumb {
  width: 64px;
  height: 64px;
  flex: 0 0 auto;
  padding: 0;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: none;
  cursor: pointer;
  transition: border-color var(--transition-fast), transform var(--transition-fast);
}

.pg-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.pg-thumb:hover { transform: translateY(-2px); }

.pg-thumb.active {
  border-color: var(--color-accent);
}

.product-modal__body {
  padding: var(--space-8);
  display: flex;
  flex-direction: column;
}

.product-modal__cat {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: var(--space-2);
}

.product-modal__title {
  font-family: var(--font-heading);
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  color: var(--color-dark);
  margin-bottom: var(--space-1);
  line-height: var(--leading-snug);
}

.product-modal__model {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-gray-500);
  margin-bottom: var(--space-4);
}

.product-modal__desc {
  font-size: var(--text-sm);
  color: var(--color-gray-700);
  line-height: var(--leading-relaxed);
  margin-bottom: var(--space-5);
}

.product-modal__specs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.product-modal__spec {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--space-3) var(--space-4);
  background-color: var(--color-off-white);
  border-radius: var(--radius-md);
}

.product-modal__spec .k {
  font-size: var(--text-xs);
  color: var(--color-gray-500);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
}

.product-modal__spec .v {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--color-dark);
}

.product-modal__colors {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: var(--space-6);
}

.product-modal__colors .label {
  font-size: var(--text-sm);
  color: var(--color-gray-500);
  margin-right: var(--space-2);
}

.product-modal__color {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  border: 2px solid var(--color-white);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  padding: 0;
  font: inherit;
  position: relative;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.product-modal__color:hover {
  transform: scale(1.12);
}

.product-modal__color.is-selected {
  box-shadow: 0 0 0 2px var(--color-white), 0 0 0 4px var(--color-accent);
}

.product-modal__color.is-selected::after {
  content: "\2713";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
}

/* Cart row selected color */
.cart-row__color {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: var(--text-xs);
  color: var(--color-gray-500);
}
.cart-row__color .sw {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  display: inline-block;
}

.product-modal__actions {
  margin-top: auto;
  display: flex;
  gap: var(--space-3);
}

.product-modal__actions .btn {
  flex: 1;
  justify-content: center;
}

.product-modal__close {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  z-index: 3;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: rgba(13, 13, 13, 0.5);
  color: var(--color-white);
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.product-modal__close:hover {
  background-color: var(--color-primary);
  transform: rotate(90deg);
}

/* ── Series count badge in header ── */
.series-count {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-gray-500);
  margin-top: var(--space-4);
}

.series-count strong {
  color: var(--color-accent);
  font-size: var(--text-lg);
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .product-modal__dialog {
    max-height: 92vh;
  }
  .product-modal__media {
    min-height: 200px;
  }
  .product-modal__body {
    padding: var(--space-5);
  }
  .product-modal__specs {
    grid-template-columns: 1fr;
  }
}

/* ── Card price (store) ── */
.pcard__price {
  font-family: var(--font-mono);
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
  color: var(--color-primary);
  margin-bottom: var(--space-3);
}

/* ── Modal e-commerce block ── */
.pm-price-row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: var(--space-2) 0 var(--space-3);
}

.pm-price {
  font-family: var(--font-mono);
  font-size: var(--text-2xl);
  font-weight: var(--weight-extrabold);
  color: var(--color-primary);
}

.pm-price-note {
  font-size: var(--text-xs);
  color: var(--color-gray-500);
}

.pm-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: var(--space-5);
}

.pm-tag {
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--color-accent);
  background-color: rgba(252, 63, 30, 0.1);
  border: 1px solid rgba(252, 63, 30, 0.25);
  padding: 3px 10px;
  border-radius: var(--radius-full);
}

.pm-section {
  margin-bottom: var(--space-5);
}

.pm-section__title {
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--color-dark);
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 2px solid rgba(0, 0, 0, 0.06);
}

.pm-features {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.pm-features li {
  position: relative;
  padding-left: 22px;
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
  color: var(--color-gray-700);
}

.pm-features li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 7px;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background-color: var(--color-accent);
  transform: rotate(45deg);
}

.pm-spec-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.pm-spec-table th,
.pm-spec-table td {
  text-align: left;
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  vertical-align: top;
}

.pm-spec-table th {
  width: 38%;
  font-weight: var(--weight-semibold);
  color: var(--color-gray-500);
  white-space: nowrap;
}

.pm-spec-table td {
  color: var(--color-dark);
  font-weight: var(--weight-medium);
}

.pm-buy {
  margin-top: var(--space-5);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.pm-qty {
  display: flex;
  align-items: center;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.pm-qty__btn {
  width: 38px;
  height: 42px;
  border: none;
  background-color: var(--color-off-white);
  color: var(--color-dark);
  font-size: 20px;
  cursor: pointer;
  transition: background-color var(--transition-fast);
}

.pm-qty__btn:hover {
  background-color: var(--color-accent);
  color: #fff;
}

.pm-qty__input {
  width: 48px;
  height: 42px;
  border: none;
  border-left: 1px solid rgba(0, 0, 0, 0.15);
  border-right: 1px solid rgba(0, 0, 0, 0.15);
  text-align: center;
  font-family: var(--font-mono);
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
  color: var(--color-dark);
}

.pm-buy__actions {
  display: flex;
  gap: var(--space-3);
  flex: 1;
}

.pm-buy__actions .btn {
  flex: 1;
  justify-content: center;
}

.pm-buy__note {
  margin-top: var(--space-3);
  font-size: var(--text-xs);
  color: var(--color-gray-500);
}

/* ── Header cart badge ── */
.cart-link {
  position: relative;
  display: flex;
  align-items: center;
  margin-left: var(--space-2);
  color: var(--color-white);
  text-decoration: none;
}

.cart-ico {
  font-size: 20px;
  line-height: 1;
}

.cart-count {
  position: absolute;
  top: -8px;
  right: -10px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 9px;
  background-color: var(--color-accent);
  color: #fff;
  font-size: 11px;
  font-weight: var(--weight-bold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
}

/* ── Toast ── */
.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translate(-50%, 20px);
  background-color: var(--color-dark);
  color: #fff;
  padding: 12px 22px;
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: var(--z-modal);
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ===== JDT: 商品介绍 / 规格参数（1688 式，独立命名空间，不影响其它样式） ===== */
.jdt{background:#fff;border:1px solid #ECE7DF;border-radius:10px;box-shadow:0 1px 3px rgba(0,0,0,.06),0 6px 18px rgba(0,0,0,.04);overflow:hidden}
.jdt__tabs{display:flex;border-bottom:2px solid #ECE7DF;background:#FBFAF8}
.jdt__tab{padding:14px 26px;font-size:16px;font-weight:700;color:#8A8378;cursor:pointer;position:relative;user-select:none}
.jdt__tab.is-active{color:#FF8C00}
.jdt__tab.is-active::after{content:"";position:absolute;left:0;right:0;bottom:-2px;height:3px;background:#FF8C00}
.jdt__panel{padding:26px 28px;display:none}
.jdt__panel.is-active{display:block}
.jdt__panel h2{font-size:16px;font-weight:800;margin:18px 0 8px;color:#1A1A1A}
.jdt__panel h2:first-child{margin-top:0}
.jdt__panel p{font-size:14px;color:#444;line-height:1.7;margin-bottom:6px}
.jdt__panel ul{margin:6px 0 12px 20px;font-size:14px;color:#444}
.jdt__panel li{margin-bottom:6px}
.jdt__panel strong{color:#E67E00}
.jdt__spec-h{font-size:17px;font-weight:800;margin-bottom:16px;padding-left:11px;border-left:4px solid #FF8C00}
.jdt__spec-grid{display:grid;grid-template-columns:1fr 1fr;border:1px solid #ECE7DF;border-radius:8px;overflow:hidden}
.jdt__spec-cell{display:flex;border-bottom:1px solid #ECE7DF}
.jdt__spec-cell:nth-child(odd){border-right:1px solid #ECE7DF}
.jdt__spec-cell .k{width:130px;flex:none;background:#FBFAF8;color:#666;font-size:14px;padding:12px 14px;border-right:1px solid #ECE7DF}
.jdt__spec-cell .v{font-size:14px;padding:12px 14px;color:#222}
.jdt__imgs{display:grid;grid-template-columns:repeat(2,1fr);gap:12px;margin:6px 0 8px}
.jdt__imgs figure{margin:0;background:#FBFAF8;border:1px solid #ECE7DF;border-radius:8px;overflow:hidden}
.jdt__imgs img{width:100%;aspect-ratio:4 / 3;height:auto;object-fit:cover;display:block}
.jdt__imgs figcaption{padding:8px 10px;font-size:13px;color:#666;text-align:center}
@media(max-width:860px){
  .jdt__panel{padding:18px 16px}
  .jdt__tab{padding:12px 16px;font-size:15px}
  .jdt__spec-grid{grid-template-columns:1fr}
  .jdt__spec-cell:nth-child(odd){border-right:none}
}
