/* =========================================================
   Product Hotspot Gallery
   结构：页面基础 / 顶部区域 / 画廊 / 热点 / 控件 / 响应式
   ========================================================= */

:root {
  --page-bg: #f7f7f5;
  --surface: #ffffff;
  --text: #171717;
  --muted: #5f635f;
  --green: #008a44;
  --green-dark: #006f36;
  --line: #23372c;
  --soft-gray: #dfdfdc;
  --radius-card: 4px;
  --page-max: 1320px;
  --page-padding: clamp(20px, 4vw, 64px);
  --gallery-gap: clamp(16px, 1.8vw, 24px);
  --card-width: clamp(300px, 27vw, 410px);
  --card-height: clamp(430px, 42vw, 520px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--page-bg);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    "Microsoft YaHei",
    sans-serif;
}

a {
  color: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

img {
  display: block;
  max-width: 100%;
}

.product-showcase {
  padding: clamp(56px, 7vw, 100px) 0 clamp(42px, 6vw, 82px);
  overflow: hidden;
}

.section-container {
  width: min(calc(100% - (var(--page-padding) * 2)), var(--page-max));
  margin: 0 auto;
}

.showcase-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 430px);
  gap: clamp(40px, 8vw, 120px);
  align-items: start;
  margin-bottom: clamp(52px, 7vw, 94px);
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.showcase-header h1 {
  margin: 0;
  max-width: 700px;
  font-size: clamp(40px, 4.3vw, 68px);
  line-height: 0.98;
  letter-spacing: -0.045em;
}

.showcase-intro {
  padding-top: 4px;
}

.showcase-intro p {
  margin: 0 0 28px;
  color: #3e413e;
  font-size: 16px;
  line-height: 1.55;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 48px;
  padding: 0 26px;
  border-radius: 999px;
  color: #fff;
  background: var(--green);
  text-decoration: none;
  font-size: 15px;
  font-weight: 750;
  transition:
    background-color 180ms ease,
    transform 180ms ease,
    box-shadow 180ms ease;
}

.primary-button:hover {
  background: var(--green-dark);
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(0, 138, 68, 0.2);
}

.primary-button:focus-visible,
.gallery-arrow:focus-visible,
.hotspot-button:focus-visible,
.product-card a:focus-visible,
.gallery-viewport:focus-visible {
  outline: 3px solid rgba(0, 138, 68, 0.35);
  outline-offset: 4px;
}

.gallery-bleed {
  width: calc(100vw - max(var(--page-padding), (100vw - var(--page-max)) / 2));
}

.gallery-viewport {
  position: relative;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-inline: contain;
  scrollbar-width: none;
  cursor: grab;
  user-select: none;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  touch-action: pan-y;
}

.gallery-viewport::-webkit-scrollbar {
  display: none;
}

.gallery-viewport.is-dragging {
  cursor: grabbing;
  scroll-behavior: auto;
  scroll-snap-type: none;
}

.gallery-track {
  display: flex;
  gap: var(--gallery-gap);
  width: max-content;
  padding-right: var(--page-padding);
}

.gallery-card {
  position: relative;
  flex: 0 0 var(--card-width);
  width: var(--card-width);
  height: var(--card-height);
  overflow: hidden;
  border-radius: var(--radius-card);
  background: #d8d8d5;
  scroll-snap-align: start;
  isolation: isolate;
}

.gallery-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.08), transparent 24%, transparent 70%, rgba(0, 0, 0, 0.08));
  z-index: 1;
}

.gallery-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 700ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.gallery-card:hover .gallery-image {
  transform: scale(1.025);
}

/* 产品热点 */
.product-hotspot {
  position: absolute;
  left: var(--x);
  top: var(--y);
  z-index: 3;
}

.hotspot-button {
  position: relative;
  z-index: 2;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.95);
  border-radius: 50%;
  color: #fff;
  background: rgba(46, 52, 49, 0.38);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  backdrop-filter: blur(4px);
  transform: translate(-50%, -50%);
  transition:
    background-color 180ms ease,
    border-color 180ms ease,
    transform 180ms ease;
}

.hotspot-button:hover {
  transform: translate(-50%, -50%) scale(1.08);
}

.hotspot-button[aria-expanded="true"] {
  border-color: #34c879;
  background: rgba(0, 120, 59, 0.78);
}

.hotspot-icon {
  display: block;
  margin-top: -2px;
  font-size: 27px;
  font-weight: 300;
  line-height: 1;
}

/* 产品信息卡 */
.product-card {
  position: absolute;
  z-index: 3;
  width: min(220px, calc(100vw - 48px));
  padding: 18px 18px 17px;
  border-radius: 4px;
  background: var(--surface);
  box-shadow: 0 16px 38px rgba(11, 22, 16, 0.18);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(12px) scale(0.98);
  transform-origin: center;
  transition:
    opacity 220ms ease,
    visibility 220ms ease,
    transform 220ms ease;
}

.product-card.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.product-card h2 {
  margin: 0 0 8px;
  font-size: 20px;
  line-height: 1.2;
}

.product-card p {
  margin: 0 0 21px;
  color: var(--muted);
  font-size: 15px;
}

.product-card a {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #1f2521;
  text-decoration: none;
  font-size: 14px;
  font-weight: 650;
}

.product-card a span {
  color: var(--green);
  font-size: 22px;
  line-height: 1;
  transition: transform 180ms ease;
}

.product-card a:hover span {
  transform: translateX(4px);
}

/* 信息卡展开方向
   所有信息卡统一显示在热点按钮上方，并与圆形按钮保持清晰间距。
   center：卡片相对热点居中；
   right：热点靠图片左侧，卡片主要向右展开；
   left：热点靠图片右侧，卡片主要向左展开。 */
.card-above-center .product-card {
  left: 0;
  bottom: 54px;
  translate: -50% 0;
}

.card-above-right .product-card {
  left: -10px;
  bottom: 54px;
}

.card-above-left .product-card {
  right: -10px;
  bottom: 54px;
}

/* 底部控制 */
.gallery-controls {
  display: grid;
  grid-template-columns: minmax(120px, 0.75fr) minmax(360px, 1fr);
  gap: clamp(30px, 8vw, 120px);
  align-items: center;
  margin-top: 24px;
  padding-right: var(--page-padding);
}

.gallery-arrows {
  display: flex;
  gap: 16px;
}

.gallery-arrow {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  font-size: 25px;
  line-height: 1;
  transition:
    transform 180ms ease,
    opacity 180ms ease,
    background-color 180ms ease;
}

.gallery-arrow:hover:not(:disabled) {
  transform: scale(1.08);
}

.gallery-prev {
  color: #5f625f;
  background: var(--soft-gray);
}

.gallery-next {
  color: #fff;
  background: var(--green);
}

.gallery-arrow:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.gallery-progress {
  width: 100%;
}

.gallery-progress-track {
  position: relative;
  height: 2px;
  background: rgba(35, 55, 44, 0.62);
}

.gallery-progress-thumb {
  position: absolute;
  left: 0;
  top: -1px;
  width: 20%;
  height: 4px;
  border-radius: 999px;
  background: var(--green);
  will-change: left, width;
}

.noscript-note {
  margin-top: 20px;
  color: #8b2e2e;
}

@media (max-width: 980px) {
  .showcase-header {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .showcase-intro {
    max-width: 620px;
  }

  .gallery-controls {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 28px;
  }
}

@media (max-width: 680px) {
  :root {
    --card-width: 82vw;
    --card-height: min(520px, 112vw);
  }

  .product-showcase {
    padding-top: 44px;
  }

  .showcase-header {
    margin-bottom: 38px;
  }

  .showcase-header h1 {
    font-size: clamp(38px, 12vw, 54px);
  }

  .primary-button {
    width: 100%;
  }

  .gallery-controls {
    grid-template-columns: 1fr;
    gap: 20px;
    margin-top: 18px;
  }

  .gallery-progress {
    grid-row: 1;
  }

  .gallery-arrows {
    grid-row: 2;
  }

  .product-card {
    width: min(206px, calc(var(--card-width) - 62px));
    padding: 16px;
  }

  .product-card h2 {
    font-size: 18px;
  }

  .product-card p {
    margin-bottom: 17px;
    font-size: 14px;
  }

  .card-above-center .product-card {
    left: 0;
    bottom: 52px;
    translate: -50% 0;
  }

  .card-above-right .product-card {
    left: -8px;
    bottom: 52px;
  }

  .card-above-left .product-card {
    right: -8px;
    bottom: 52px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
