/* portal/home.css：首页（templates/user/home.html）结构样式。只用 app.css 令牌，不写死颜色；主题文件在其后加载可覆盖。
   桌面（≥1024px）网格：
     ┌ 分类 ┬────── 轮播 ──────┬ 超值推荐 ┬ 用户面板 ┐
     │ 分类 ├──── 新品上线 ────┼───── 动态 ─────────┤
     └──────┴──────────────────┴────────────────────┘
     ├──────────── 5 张优势 / 服务卡 ──────────────┤
   平板（≤1023px）：轮播 → 分类 chip → 推荐 | 面板 → 新品 → 动态 → 服务卡（3 列）
   手机（≤768px）：单栏 轮播 → 分类横向 chip → 推荐 → 面板 → 新品（横向可滚）→ 动态 → 服务卡（2 列） */
.home {
  margin-top: 48px;   /* 整体上半部分下移，与导航栏拉开距离 */
  --home-gap: 12px;
  /* 横幅叠字：横幅是固定配色的图片（自制 SVG / 后台上传），叠加文字用白字 + 左侧暗色渐变底，与主题无关 */
  --hero-fg: #ffffff;
  --hero-shade: rgba(4, 10, 24, .62);
}
.home-top {
  display: grid; gap: 15px; align-items: stretch;
  /* 比例列（fr）随容器/显示器大小自适应缩放：侧栏定宽区间，横幅取大，右侧两卡等宽（对标 xqh9999 的 vw 缩放版式）
     列宽比例照抄参考站实测值 —— 轮播 800 : 超值推荐 270 : 用户面板 240，卡片间距 15px */
  grid-template-columns: clamp(192px, 12.5vw, 232px) 2.67fr 0.9fr 0.8fr;
  grid-template-areas: "cats hero featured user" "cats new feed feed";
}
@media (max-width: 1180px) {
  .home-top { grid-template-columns: clamp(176px, 16vw, 208px) 1.8fr 1fr 1fr; }
}
.home-cats { grid-area: cats; position: relative; z-index: 5; }   /* 悬浮层要压过轮播（主题若给面板加 backdrop-filter 也不受影响） */
.home-hero { grid-area: hero; }
.home-featured { grid-area: featured; display: flex; flex-direction: column; }
.home-featured .hf-grid { flex: 1; align-content: center; }
.home-user { grid-area: user; }
.home-new { grid-area: new; }
.home-feed { grid-area: feed; }

/* 首页里的链接一律不下划线（极简黑白主题给正文链接加了下划线，商品卡/分类项不适用） */
.home :is(.hc-link, .hc-foot, .hc-more, .hc-subs a, .hc-prods a, .hf-card, .hn-card, .hd-title, .hs-card, .hu-tiles a, .hu-q, .hbox-more, .hero-slide, .hc-head a) { text-decoration: none; }

/* ---------- 通用小面板 ---------- */
/* 卡片内边距对标参考站（20px 系）：首页四卡统一 20px，头部标题 16px/600 与参考站一致 */
.home-top > .hbox { padding: 20px 20px 22px; }
.home-top .hbox-head { margin-bottom: 14px; }
.home-top .hbox-head h3 { font-size: 16px; font-weight: 600; }
.hbox { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 10px 12px; min-width: 0; }
.hbox-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 7px; }
.hbox-head h3 { margin: 0; font-size: 17px; font-weight: 700; color: var(--heading); display: flex; align-items: center; }
.hbox-more { font-size: 12px; color: var(--muted); white-space: nowrap; }
.hbox-more:hover { color: var(--primary-ink); }
.tag-new { display: inline-block; margin-left: 6px; padding: 0 5px; border-radius: 3px; background: var(--accent); color: var(--primary-contrast); font-size: 10px; font-weight: 700; line-height: 16px; letter-spacing: .04em; }

/* ---------- 左：分类列表 + 悬浮层 ---------- */
.home-cats {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm);
  position: relative; display: flex; flex-direction: column; min-width: 0;
}
.hc-head { padding: 9px 16px; font-weight: 700; font-size: 15px; color: var(--heading); border-bottom: 1px solid var(--border); background: var(--surface-2); border-radius: var(--radius) var(--radius) 0 0; }
.hc-head a { color: inherit; }
.hc-head a:hover { color: var(--primary-ink); }
.hc-list { list-style: none; margin: 0; padding: 3px 0; flex: 1; }
.hc-item { position: relative; }
/* 分组字号小于导航栏（导航 19px/700 为主，分类 16px/700 为次），主次分明；更黑更粗更大但不超过导航 */
.hc-link { display: flex; align-items: center; gap: 6px; padding: 8px 16px; color: var(--heading); font-size: 16.5px; font-weight: 800; line-height: 1.45; }
.hc-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hc-cnt { display: none; }   /* 去掉分类数量数字 */
.hc-arrow { color: var(--border-strong); font-size: 14px; line-height: 1; }
.hc-item:hover > .hc-link, .hc-item:focus-within > .hc-link { color: var(--primary-ink); background: var(--primary-soft); }
.hc-item:hover > .hc-link .hc-arrow, .hc-item:focus-within > .hc-link .hc-arrow { color: var(--primary-ink); }
.hc-flyout {
  display: none; position: absolute; left: 100%; top: -1px; width: 560px; max-width: 60vw; z-index: 60;
  background: var(--card); border: 1px solid var(--border); border-radius: 0 var(--radius) var(--radius) var(--radius);
  box-shadow: var(--shadow-lg); padding: 14px 16px;
}
.hc-item:hover > .hc-flyout, .hc-item:focus-within > .hc-flyout { display: block; animation: hw-pop .18s var(--ease); }
.hc-fly-title { font-weight: 700; color: var(--heading); margin-bottom: 8px; font-size: 14px; }
.hc-subs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.hc-subs a { padding: 3px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--fg); font-size: 12px; }
.hc-subs a:hover { color: var(--primary-ink); border-color: var(--primary); background: var(--primary-soft); }
.hc-prods { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.hc-prods a { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--fg); font-size: 12px; text-align: center; min-width: 0; }
.hc-prods a:hover { color: var(--primary-ink); }
.hc-prods img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius-sm); background: var(--surface-2); }
.hc-prods span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hc-more { display: block; margin-top: 10px; font-size: 12px; text-align: right; }
.hc-foot { display: block; margin-top: auto; padding: 7px 14px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); }
.hc-foot:hover { color: var(--primary-ink); background: var(--primary-soft); }

/* ---------- 中：轮播 ---------- */
.home-hero { position: relative; overflow: hidden; border-radius: var(--radius); background: var(--surface-2); min-height: 372px; box-shadow: var(--shadow-sm); }
.hero-track { display: flex; height: 100%; transition: transform .5s var(--ease); will-change: transform; touch-action: pan-y; }
.hero-track.no-anim { transition: none; }
.hero-slide { flex: 0 0 100%; width: 100%; height: 100%; display: block; position: relative; color: var(--hero-fg); }
.hero-slide img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center; }
.hero-cap {
  position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 8px;
  padding: 24px 30% 24px 28px; background: linear-gradient(90deg, var(--hero-shade) 0%, color-mix(in srgb, var(--hero-shade) 58%, transparent) 50%, transparent 78%);
}
.hero-title { font-family: var(--font-display); font-size: 30px; font-weight: 800; line-height: 1.2; letter-spacing: .02em; text-shadow: 0 2px 12px rgba(0, 0, 0, .35); }
.hero-sub { font-size: 14px; line-height: 1.55; opacity: .92; max-width: 34em; }
.hero-cta { margin-top: 6px; display: inline-block; padding: 6px 16px; border-radius: 999px; border: 1px solid currentColor; font-size: 13px; font-weight: 600; transition: background var(--dur) var(--ease); }
.hero-slide:hover .hero-cta { background: color-mix(in srgb, currentColor 18%, transparent); }
.hero-btn {
  position: absolute; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; border: 0; border-radius: 50%; cursor: pointer;
  background: color-mix(in srgb, var(--card) 82%, transparent); color: var(--fg); font-size: 22px; line-height: 1; padding: 0 0 3px;
  box-shadow: var(--shadow-md); opacity: 0; transition: opacity var(--dur) var(--ease), background var(--dur) var(--ease);
}
.hero-prev { left: 12px; }
.hero-next { right: 12px; }
.hero-btn:hover { background: var(--card); color: var(--primary-ink); }
.home-hero:hover .hero-btn, .home-hero:focus-within .hero-btn { opacity: 1; }
@media (hover: none) { .hero-btn { opacity: 1; } }
.hero-dots { position: absolute; left: 0; right: 0; bottom: 10px; display: flex; justify-content: center; gap: 6px; }
/* 指示点固定为白/中性色（横幅是任意配色的图片，不能用主色） */
.hero-dots button { background: color-mix(in srgb, var(--qr-quiet) 55%, transparent) !important; box-shadow: 0 0 0 1px rgba(0, 0, 0, .15); }
.hero-dots button.on, .hero-dots button[aria-current="true"] { background: var(--qr-quiet) !important; }
.hero-dots button { width: 8px; height: 8px; padding: 0; border: 0; border-radius: 999px; cursor: pointer; background: color-mix(in srgb, var(--card) 65%, transparent); transition: width var(--dur) var(--ease), background var(--dur) var(--ease); }
.hero-dots button[aria-selected="true"] { width: 22px; background: var(--primary); }

/* ---------- 右：超值推荐 2×2 与商品小卡 ---------- */
/* 照参考站实测：单品 2×2，方图 80px（按本容器等比 ≈84px），名称 14px，价格 14px 加粗 */
.hf-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 10px; }
.hf-card, .hn-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 3px; color: var(--fg); min-width: 0; }
.mini-img { width: 100%; max-width: 108px; aspect-ratio: 1 / 1; height: auto; object-fit: cover; border-radius: var(--radius-sm); background: var(--surface-2); transition: transform var(--dur) var(--ease); }
.hf-card .mini-img { width: 84px; max-width: 100%; }
.mini-img.placeholder { object-fit: contain; }
.hf-card:hover .mini-img, .hn-card:hover .mini-img { transform: scale(1.05); }
.hf-card:hover .mini-name, .hn-card:hover .mini-name { color: var(--primary-ink); }
.mini-name { max-width: 100%; font-size: 12px; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hf-card .mini-name { font-size: 14px; }
.mini-price { font-size: 11px; line-height: 1.2; color: #e4393c; white-space: nowrap; }
.hf-card .mini-price, .hf-card .mini-price b { font-size: 14px; }
.mini-price.muted { color: var(--muted); }
.mini-price b { color: #e4393c; font-size: 15px; font-weight: 800; }

/* ---------- 右：用户面板 ---------- */
/* 登录卡：四个区块（问候 / 优惠 / 登录 / 双功能块）等间距分布，其余为留白；顶部多留白让问候下移一点 */
.home-user { display: flex; flex-direction: column; justify-content: space-between; gap: 12px; padding: 24px 20px 20px; }
.hu-top { display: flex; align-items: center; gap: 12px; padding: 2px 0 2px; }
.hu-avatar { width: 50px; height: 50px; font-size: 20px; }
.hu-avatar.guest { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.hu-info { min-width: 0; }
.hu-name { font-weight: 700; font-size: 15px; color: var(--heading); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hu-sub { font-size: 12px; }
.hu-meta { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
/* 促销提示：无底框、居中（对标 xqh9999） */
.hu-promo { padding: 2px 4px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 3px; font-size: 13px; color: var(--heading); line-height: 1.5; }
.hu-promo b { font-size: 15px; }
.hu-btn { width: 100%; padding: 12px; font-size: 15px; }
/* 快捷入口 2×2，撑满卡片剩余高度，填满登录卡不留空 */
.hu-tiles, .hu-quick { flex: 1; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 8px; }
.hu-tiles a, .hu-q { display: flex; flex-direction: column; justify-content: center; gap: 3px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--primary-soft); color: var(--muted); font-size: 12px; line-height: 1.35; transition: transform var(--dur) var(--ease); }
.hu-tiles a b, .hu-q b { color: var(--primary-ink); font-size: 14px; }
.hu-q b .hu-dot { display: inline-block; min-width: 16px; padding: 0 5px; border-radius: 999px; background: var(--badge-red-bg); color: var(--badge-red-fg); font-size: 10px; font-style: normal; line-height: 16px; text-align: center; vertical-align: 1px; }
.hu-tiles a:hover, .hu-q:hover { transform: translateY(-2px); }
/* 登录卡底部两大功能块（对标 xqh9999：电商/素材，一蓝一橙 + 小按钮），撑满卡片底部 */
.hu-feats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hu-feat { display: flex; flex-direction: column; justify-content: center; gap: 6px; padding: 14px 12px; border-radius: var(--radius-sm); transition: transform var(--dur) var(--ease); }
.hu-feat:hover { transform: translateY(-2px); }
.hu-feat b { font-size: 15px; }
.hu-feat span { font-size: 12px; color: var(--muted); line-height: 1.4; margin-bottom: 2px; }
.hu-feat em { font-style: normal; align-self: flex-start; font-size: 12px; font-weight: 600; white-space: nowrap; }
.hu-feat.ecom { background: var(--primary-soft); }
.hu-feat.ecom b, .hu-feat.ecom em { color: var(--primary-ink); }
.hu-feat.tpl { background: color-mix(in srgb, #ff8a3d 15%, var(--card)); }
.hu-feat.tpl b, .hu-feat.tpl em { color: #c2691a; }

/* ---------- 第二行：新品横条 ---------- */
/* 照参考站实测：6 个方图（100×100）横排，名称 14px，条上不显示价格 */
.hn-strip { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.hn-card .mini-img { width: 100%; max-width: 105px; height: auto; aspect-ratio: 1 / 1; }
.hn-card .mini-name { font-size: 14px; }
.hn-card .mini-price { display: none; }

/* ---------- 第二行：动态 ---------- */
.hd-list { list-style: none; margin: 0; padding: 0; }
.hd-list li { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--border); font-size: 14px; }
.hd-list li:last-child { border-bottom: 0; }
.hd-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--fg); }
.hd-title::before { content: ""; display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--primary); margin-right: 8px; vertical-align: 2px; }
.hd-title:hover { color: var(--primary-ink); }
.hd-time { font-size: 12px; flex-shrink: 0; }

/* ---------- 第三行：设备 / 产能展示（图片优先，可在「首页装修」上传实拍图） ---------- */
.home-services { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--home-gap); margin-top: 28px; }
.hs-card {
  position: relative; overflow: hidden; display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); color: var(--fg); box-shadow: var(--shadow-sm);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.hs-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.hs-card:hover .hs-art img { transform: scale(1.05); }
/* 横向展示卡（对标 xqh9999 底部设备展示）：图区 16:8，可在「首页装修」上传设备实拍图替换 */
.hs-art { position: relative; width: 100%; aspect-ratio: 16 / 8; overflow: hidden; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary-soft), var(--surface-2)); color: var(--primary-ink); }
.hs-art img { width: 100%; height: 100%; object-fit: cover; transition: transform var(--dur) var(--ease); }
.hs-art svg { width: 56px; height: 56px; opacity: .82; }
.hs-text { padding: 12px 14px 14px; min-width: 0; }
.hs-title { font-weight: 700; color: var(--heading); font-size: 14px; margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hs-sub { font-size: 12px; color: var(--muted); line-height: 1.5; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 平板（≤1023px） ---------- */
@media (max-width: 1023px) {
  .home-top {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas: "hero hero" "cats cats" "featured user" "new new" "feed feed";
  }
  .home-hero { aspect-ratio: 2.5 / 1; min-height: 0; }
  .hero-cap { padding: 20px 36% 20px 24px; }
  .hero-title { font-size: 28px; }
  .home-cats { flex-direction: row; align-items: center; padding: 6px 8px; gap: 6px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
  .hc-head { border: 0; background: transparent; padding: 0 6px 0 2px; flex-shrink: 0; font-size: 13px; white-space: nowrap; }
  .hc-list { display: flex; gap: 6px; padding: 0; flex: none; }
  .hc-item { flex-shrink: 0; }
  .hc-link { padding: 0 12px; min-height: 36px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); white-space: nowrap; }
  .hc-cnt, .hc-arrow { display: none; }
  .hc-flyout { display: none !important; }
  .hc-foot { flex-shrink: 0; margin: 0; padding: 0 8px 0 10px; border: 0; white-space: nowrap; min-height: 36px; display: inline-flex; align-items: center; }
  .mini-img { width: 84px; height: 84px; }
  .home-services { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---------- 手机（≤768px）：单栏 ---------- */
@media (max-width: 768px) {
  .home-top { grid-template-columns: minmax(0, 1fr); grid-template-areas: "hero" "cats" "featured" "user" "new" "feed"; gap: 10px; }
  .home-hero { aspect-ratio: 2 / 1; }
  .hero-cap { padding: 14px 26% 22px 16px; gap: 5px; background: linear-gradient(90deg, var(--hero-shade) 0%, color-mix(in srgb, var(--hero-shade) 60%, transparent) 60%, transparent 92%); }
  .hero-title { font-size: 20px; }
  .hero-sub { font-size: 12px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .hero-cta { font-size: 12px; padding: 4px 12px; margin-top: 2px; }
  .hero-btn { display: none; }   /* 手机：左右箭头会压住叠字，改用滑动 + 指示点 */
  .hbox { padding: 12px; }
  .hf-grid { gap: 12px 10px; }
  .mini-img { width: 96px; height: 96px; }
  .mini-name { font-size: 13px; }
  .hn-strip { display: flex; overflow-x: auto; -webkit-overflow-scrolling: touch; gap: 10px; padding-bottom: 4px; scrollbar-width: thin; }
  .hn-card { flex: 0 0 104px; }
  .hn-card .mini-img { width: 96px; height: 80px; }
  .hu-tiles a, .hu-q { min-height: 44px; justify-content: center; }
  .home-services { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .hs-title { white-space: normal; }
}
@media (max-width: 400px) {
  .mini-img { width: 84px; height: 84px; }
}
@media (prefers-reduced-motion: reduce) {
  .hero-track, .mini-img, .hs-card, .hu-tiles a, .hu-q, .hero-btn, .hero-dots button { transition: none; }
  .hc-item:hover > .hc-flyout, .hc-item:focus-within > .hc-flyout { animation: none; }
}
