/* =============================================================================
 * 墨趣文具 · 首页专属样式
 * 区块：Hero 轮播 / 核心特色 / 分类矩阵 / 优选推荐 / 商品墙
 * 依赖：style.css 中的设计令牌（--primary / --accent / --glass / --border ...）
 * ========================================================================== */

/* ---------------------------------------------------------------------------
 * 1. Hero 轮播
 * ------------------------------------------------------------------------ */
.hero {
  position: relative;
  width: 100%;
  background: #04060d;
  margin-top: 0;
  overflow: hidden;
}
/* 轮播区上下霓虹描边 */
.hero::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(34,211,238,.7), rgba(139,92,246,.7), transparent);
  z-index: 6;
}

.hero-viewport {
  position: relative;
  width: 100%;
  max-width: 1680px;
  margin: 0 auto;
  height: 520px;
  overflow: hidden;
  background: #04060d;
}
.hero-track { position: relative; width: 100%; height: 100%; }

.hero-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity .9s ease;
  pointer-events: none;
}
.hero-slide.is-active { opacity: 1; pointer-events: auto; z-index: 2; }

.hero-img {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  transform: scale(1.06);
  transition: transform 7s ease;
  filter: saturate(1.06);
}
.hero-slide.is-active .hero-img { transform: scale(1); }

/* 深色遮罩：左侧压暗保证文字可读，右侧保留画面 */
.hero-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  /* 左侧压暗到 60%，保证标题/副标题压在图上仍清晰可读 */
  background:
    linear-gradient(90deg, rgba(4,6,13,.96) 0%, rgba(4,6,13,.90) 30%, rgba(4,6,13,.66) 54%, rgba(4,6,13,.18) 80%, rgba(4,6,13,.42) 100%);
}

/* 科技网格 + 扫描线叠加 */
.hero-overlay::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(34, 211, 238, .055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(34, 211, 238, .055) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: linear-gradient(90deg, #000 0%, rgba(0,0,0,.25) 62%, transparent 88%);
  -webkit-mask-image: linear-gradient(90deg, #000 0%, rgba(0,0,0,.25) 62%, transparent 88%);
}
/* 底部霓虹光带 */
.hero-overlay::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 190px;
  pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(4,6,13,.92));
}

.hero-inner {
  position: relative;
  z-index: 3;
  max-width: 1240px;
  width: 100%;
  margin: 0 auto;
  padding: 0 40px;
  color: #fff;
}

/* 角标 */
.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1.2px;
  color: #a5f3fc;
  background: rgba(34, 211, 238, .10);
  border: 1px solid rgba(34, 211, 238, .38);
  border-radius: 999px;
  padding: 6px 16px;
  margin: 0 0 20px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 0 22px rgba(34, 211, 238, .18);
}
.hero-tag::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 10px var(--primary);
  animation: xph-pulse 2s ease-in-out infinite;
}

.hero-title {
  font-size: 50px;
  font-weight: 800;
  line-height: 1.18;
  margin: 0 0 16px;
  letter-spacing: 1px;
  background: linear-gradient(96deg, #ffffff 0%, #cffafe 44%, #c4b5fd 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 60px rgba(34, 211, 238, .22);
  max-width: 15em;
}
.hero-sub {
  font-size: 16px;
  line-height: 1.8;
  margin: 0 0 30px;
  color: rgba(226, 240, 255, .82);
  max-width: 560px;
}
.hero-actions { display: flex; gap: 13px; flex-wrap: wrap; }

/* 深色底上的幽灵按钮 */
.btn-ghost-light {
  background: rgba(255, 255, 255, .07);
  border-color: rgba(255, 255, 255, .26);
  color: #fff;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.btn-ghost-light:hover {
  background: rgba(255, 255, 255, .16);
  border-color: rgba(34, 211, 238, .6);
  color: #fff;
  text-decoration: none;
}
.btn-lg { padding: 13px 28px; font-size: 15px; border-radius: 12px; }

/* 左右箭头 */
.hero-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 50px; height: 50px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .2);
  background: rgba(7, 11, 21, .5);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 5;
  transition: all .2s ease;
  user-select: none;
}
.hero-nav:hover {
  background: rgba(34, 211, 238, .22);
  border-color: var(--primary);
  box-shadow: var(--glow);
}
.hero-prev { left: 26px; }
.hero-next { right: 26px; }

/* 指示点 */
.hero-dots {
  position: absolute;
  left: 0; right: 0; bottom: 26px;
  display: flex;
  justify-content: center;
  gap: 9px;
  z-index: 5;
}
.hero-dot {
  width: 26px; height: 5px;
  border: 0;
  border-radius: 4px;
  padding: 0;
  cursor: pointer;
  background: rgba(255, 255, 255, .3);
  transition: all .24s ease;
}
.hero-dot.is-active {
  background: linear-gradient(90deg, #22d3ee, #8b5cf6);
  width: 40px;
  box-shadow: 0 0 14px rgba(34, 211, 238, .7);
}

/* ---------------------------------------------------------------------------
 * 2. 核心特色
 * ------------------------------------------------------------------------ */
.features {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: 30px;
  margin-bottom: 16px;
}
.feature {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  overflow: hidden;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.feature::after {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(34,211,238,.5), transparent);
}
.feature:hover {
  transform: translateY(-3px);
  border-color: var(--border-hi);
  box-shadow: var(--glow-soft);
}
.feature-icn {
  width: 50px; height: 50px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #fff;
  position: relative;
}
.feature-icn svg { width: 25px; height: 25px; }
.feature-icn.icn-shield  { background: linear-gradient(135deg, #22d3ee, #0ea5b7); box-shadow: 0 0 22px rgba(34,211,238,.34); }
.feature-icn.icn-factory { background: linear-gradient(135deg, #34d399, #059669); box-shadow: 0 0 22px rgba(52,211,153,.30); }
.feature-icn.icn-truck   { background: linear-gradient(135deg, #ffc247, #f97316); box-shadow: 0 0 22px rgba(255,176,46,.30); }
.feature-icn.icn-service { background: linear-gradient(135deg, #a78bfa, #7c3aed); box-shadow: 0 0 22px rgba(139,92,246,.32); }
.feature h4 { margin: 0 0 3px; font-size: 15px; font-weight: 700; color: var(--text); }
.feature p  { margin: 0; color: var(--muted); font-size: 12.5px; }

/* ---------------------------------------------------------------------------
 * 3. 通用区块标题
 * ------------------------------------------------------------------------ */
.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin: 34px 0 18px;
  flex-wrap: wrap;
  gap: 12px;
}
.section-head h2 {
  font-size: 23px;
  font-weight: 800;
  margin: 0 0 5px;
  letter-spacing: .4px;
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--text);
}
.section-head h2::before {
  content: "";
  width: 4px; height: 21px;
  border-radius: 3px;
  background: var(--grad-primary);
  box-shadow: 0 0 14px rgba(34, 211, 238, .55);
  flex-shrink: 0;
}
.section-head p { margin: 0; font-size: 13px; color: var(--muted); }
.section-more {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: color .18s ease, gap .18s ease;
}
.section-more:hover { color: var(--primary); text-decoration: none; gap: 9px; }
.title-anchor { color: inherit; text-decoration: none; transition: color .16s ease; }
.title-anchor:hover { color: var(--primary); }

/* ---------------------------------------------------------------------------
 * 4. 分类矩阵
 * ------------------------------------------------------------------------ */
.cat-section { padding-top: 6px; }
.cat-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 15px;
}
.cat-card {
  --cat-color: #22d3ee;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px 20px;
  text-align: center;
  color: var(--text);
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}
/* 顶部色条：hover 时展开 */
.cat-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--cat-color);
  transform: scaleX(0);
  transition: transform .28s ease;
  box-shadow: 0 0 16px var(--cat-color);
}
/* 悬停时的同色辉光 */
.cat-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity .28s ease;
  background: radial-gradient(circle at 50% 0%, color-mix(in srgb, var(--cat-color) 22%, transparent), transparent 70%);
}
.cat-card:hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--cat-color) 60%, transparent);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .4), 0 0 24px color-mix(in srgb, var(--cat-color) 30%, transparent);
  text-decoration: none;
  color: var(--text);
}
.cat-card:hover::before { transform: scaleX(1); }
.cat-card:hover::after { opacity: 1; }

.cat-icon {
  position: relative;
  width: 62px; height: 62px;
  border-radius: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 13px;
  color: var(--cat-color);
  background: color-mix(in srgb, var(--cat-color) 13%, transparent);
  border: 1px solid color-mix(in srgb, var(--cat-color) 34%, transparent);
  box-shadow: inset 0 0 20px color-mix(in srgb, var(--cat-color) 14%, transparent);
  transition: transform .26s ease, box-shadow .26s ease;
}
.cat-card:hover .cat-icon {
  transform: scale(1.08) rotate(-4deg);
  box-shadow: 0 0 26px color-mix(in srgb, var(--cat-color) 46%, transparent);
}
.cat-icon svg { width: 31px; height: 31px; }
.cat-name { font-size: 15px; font-weight: 700; margin-bottom: 5px; }
.cat-count { font-size: 12px; color: var(--muted); }
.cat-arrow {
  position: absolute;
  right: 13px; top: 13px;
  font-size: 15px;
  color: var(--cat-color);
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity .22s ease, transform .22s ease;
}
.cat-card:hover .cat-arrow { opacity: 1; transform: translateX(0); }

/* ---------------------------------------------------------------------------
 * 5. 优选推荐（横向卡片带）
 * ------------------------------------------------------------------------ */
.reco-band {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.reco-card {
  position: relative;
  display: flex;
  gap: 15px;
  padding: 16px;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.reco-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-hi);
  box-shadow: var(--glow-soft);
  text-decoration: none;
}
.reco-card .thumb {
  width: 96px; height: 96px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  background: rgba(6, 10, 20, .8) center/cover no-repeat;
  border: 1px solid var(--border);
}
/* 无封面时的占位（显示分类名），避免出现空白方块 */
.reco-card .thumb-ph {
  display: flex;
  align-items: center;
  justify-content: center;
  background-image: var(--grad-surface);
  background-size: auto;
}
.reco-card .thumb-ph::before {
  content: attr(data-cat);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2px;
  color: rgba(233, 238, 251, .32);
  text-align: center;
  padding: 0 6px;
  line-height: 1.5;
}
.reco-card .info { min-width: 0; flex: 1; }
.reco-card .info h4 {
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.reco-card .info .desc {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.reco-card .info .p {
  color: var(--accent);
  font-weight: 800;
  font-size: 17px;
  font-variant-numeric: tabular-nums;
}
.reco-card .info .p small { color: var(--muted); font-weight: 500; font-size: 12px; }

/* ---------------------------------------------------------------------------
 * 6. 商品墙
 * ------------------------------------------------------------------------ */
.goods-section { padding-top: 6px; }
.goods-search { display: flex; gap: 9px; }
.goods-search select,
.goods-search input[type="text"] {
  height: 40px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(6, 10, 20, .72);
  color: var(--text);
  font-size: 13.5px;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.goods-search select:focus,
.goods-search input[type="text"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, .13);
}
.goods-search select { width: 138px; }
.goods-search input[type="text"] { width: 220px; }
.goods-search .btn { height: 40px; }

/* 商品卡增强（.product 主体在 style.css） */
.product { position: relative; }
.product .badge-hot,
.product .badge-rec,
.product .badge-new {
  position: absolute;
  top: 11px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1px;
  padding: 4px 9px;
  border-radius: 6px;
  z-index: 2;
  color: #fff;
}
.product .badge-hot {
  left: 11px;
  background: linear-gradient(135deg, #fb7185, #e11d48);
  box-shadow: 0 3px 14px rgba(225, 29, 72, .48);
}
.product .badge-rec {
  left: 11px;
  background: var(--grad-primary);
  color: #04121b;
  box-shadow: 0 3px 14px rgba(34, 211, 238, .48);
}
.product .badge-new {
  right: 11px;
  background: linear-gradient(135deg, #34d399, #059669);
  box-shadow: 0 3px 14px rgba(5, 150, 105, .48);
}

/* ---------------------------------------------------------------------------
 * 7. 响应式
 * ------------------------------------------------------------------------ */
@media (max-width: 1180px) {
  .cat-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 1024px) {
  .hero-viewport { height: 440px; }
  .hero-title { font-size: 38px; }
  .features { grid-template-columns: repeat(2, 1fr); }
  .reco-band { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .hero-viewport { height: 400px; }
  .hero-title { font-size: 27px; }
  .hero-sub { font-size: 13.5px; margin-bottom: 22px; }
  .hero-inner { padding: 0 20px; }
  .hero-nav { width: 38px; height: 38px; font-size: 21px; }
  .hero-prev { left: 10px; }
  .hero-next { right: 10px; }
  .hero-dots { bottom: 16px; }
  .features { grid-template-columns: 1fr 1fr; gap: 12px; }
  .feature { padding: 14px; flex-direction: column; text-align: center; align-items: center; }
  .cat-grid { grid-template-columns: repeat(3, 1fr); gap: 12px; }
  .cat-card { padding: 18px 10px 16px; }
  .cat-icon { width: 52px; height: 52px; border-radius: 14px; }
  .cat-icon svg { width: 26px; height: 26px; }
  .reco-band { grid-template-columns: 1fr; }
  .section-head { flex-direction: column; align-items: flex-start; }
  .goods-search { width: 100%; flex-wrap: wrap; }
  .goods-search select { width: 122px; }
  .goods-search input[type="text"] { flex: 1; width: auto; min-width: 130px; }
}
@media (max-width: 480px) {
  .features { grid-template-columns: 1fr; }
  .cat-grid { grid-template-columns: repeat(2, 1fr); }
}
