/* ==========================================================================
   home.css — 首页样式（巨幕 Hero / 栏目区块 / 工具卡片 / 投稿 CTA）
   ========================================================================== */

/* ---------- 1. 页面容器 ---------- */
.page-wrap { max-width: var(--max-width); margin: 0 auto; padding: 32px var(--page-gutter) 80px; }

/* 注：巨幕 Hero / 图片轮播位已抽到 base.css 第 9 节，三个页面共用同一套。 */

/* ---------- 2. 首屏横幅（首页已不需要 .hero 外壳，只留轮播位本身） ---------- */
.page-wrap > .banner-viewport.hero-banner {
  padding: 0;                 /* base 里 .hero-banner 给轮播留的 15px 内缩不要 */
  border: 0;                  /* 去掉外边框 */
  box-shadow: none;
  margin-bottom: 48px;
}

/* ---------- 3. 栏目区块 ---------- */
.section { position: relative; margin-bottom: 64px; }
.section::before {
  content: ''; position: absolute; z-index: -1; width: 420px; height: 260px;
  right: 0; top: -70px; border-radius: 50%; pointer-events: none;
  background: var(--section-ambient);
}
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; gap: 12px; }
.section-title { position: relative; font-size: 27px; font-weight: 750; letter-spacing: -.035em; display: flex; align-items: center; gap: 12px; }
.section-title .st-icon {
  width: 42px; height: 42px; border-radius: 13px;
  display: flex; align-items: center; justify-content: center; font-size: 18px;
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-md), inset 0 1px 0 var(--surface-glow);
}
.section-more { font-size: 14px; color: var(--blue-700); font-weight: 600; white-space: nowrap; transition: color .2s ease, transform .2s ease; }
.section-more:hover { color: var(--blue-500); transform: translateX(2px); }

/* ---------- 4. 工具卡片 ---------- */
.tools-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.tool-card {
  --card-accent: var(--primary); --card-soft: var(--surface-3);
  --card-icon-bg: var(--surface-3);
  background: var(--card-surface-bg);
  border-radius: var(--radius-md); border: 1px solid var(--gray-200);
  min-height: 118px; padding: 20px; transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease; cursor: pointer;
  position: relative; display: flex; gap: 14px; align-items: flex-start;
  box-shadow: var(--card-shadow);   /* 默认 none；「亚克力」模板用它把卡片抬起来 */
  isolation: isolate; overflow: hidden;
}
.tool-card::before { content: ''; position: absolute; z-index: -1; inset: 0 0 auto; height: 3px; background: transparent; opacity: var(--card-line-opacity); transition: opacity .2s ease, height .2s ease; }
.tool-card::after { content: '↗'; position: absolute; right: 16px; bottom: 14px; color: var(--card-accent); font-size: 14px; opacity: 0; transform: translate(-5px, 5px); transition: opacity .2s ease, transform .2s ease; }
.tool-card:hover { border-color: var(--gray-200); box-shadow: var(--shadow-lg); transform: translateY(-3px); }
.tool-card:hover::before { opacity: .9; height: 4px; }
.tool-card:hover::after { opacity: .8; transform: none; }
.tool-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 22px;
  background: var(--card-icon-bg);
  border: 1px solid var(--gray-200);
  box-shadow: 0 7px 16px rgba(0, 0, 0, 0.04), inset 0 1px 0 var(--surface-glow);
  transition: transform .24s cubic-bezier(.2,.8,.2,1), box-shadow .24s ease;
}
.tool-card:hover .tool-icon { transform: translateY(-2px) scale(1.035); box-shadow: 0 11px 22px rgba(0, 0, 0, 0.04), inset 0 1px 0 var(--surface-glow); }
.accent-blue { --card-accent: var(--primary); --card-soft: var(--surface-3); }
.accent-green, .accent-lime { --card-accent: var(--primary); --card-soft: var(--surface-3); }
.accent-yellow, .accent-amber { --card-accent: var(--primary); --card-soft: var(--surface-3); }
.accent-red { --card-accent: var(--primary); --card-soft: var(--surface-3); }
.accent-purple { --card-accent: var(--primary); --card-soft: var(--surface-3); }
.accent-cyan { --card-accent: var(--primary); --card-soft: var(--surface-3); }
.accent-orange { --card-accent: var(--primary); --card-soft: var(--surface-3); }
.tool-info { flex: 1; min-width: 0; }
.tool-name { font-size: 15px; font-weight: 600; line-height: 1.45; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tool-desc {
  font-size: 13px; color: var(--gray-600); line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.tool-meta { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 12px; color: var(--gray-500); }
.tool-meta .star { color: var(--gray-500); }

/* ---------- 5. 投稿 CTA 横条 ---------- */
.cta-strip {
  position: relative; overflow: hidden;
  background: var(--cta-surface-bg);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 42px 48px;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  margin-bottom: 58px;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.04), inset 0 1px 0 var(--surface-glow);
}
.cta-strip::after { content: ''; position: absolute; width: 170px; height: 170px; right: 11%; top: -118px; border-radius: 50%; border: 1px solid transparent; box-shadow: 0 0 0 28px rgba(0, 0, 0, 0), 0 0 0 55px rgba(0, 0, 0, 0); pointer-events: none; opacity: var(--cta-decoration-opacity); }
.cta-strip > * { position: relative; z-index: 1; }
.cta-strip h3 { font-size: 24px; font-weight: 700; letter-spacing: -.02em; margin-bottom: 6px; }
.cta-strip p { font-size: 15px; color: var(--gray-600); }
/* 按钮本体与外观全部来自控件库 .ui-btn，这里只补本横条需要的尺寸 */
.cta-strip .ui-btn { padding: 14px 32px; font-size: 15px; white-space: nowrap; }

/* ---------- 6. 响应式 ---------- */
@media (max-width: 1024px) {
  .tools-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
  .tools-grid { grid-template-columns: repeat(2, 1fr); }
  .cta-strip { flex-direction: column; text-align: center; padding: 28px 24px; }
  .section-title { font-size: 21px; }
}
@media (max-width: 480px) {
  .tools-grid { grid-template-columns: 1fr; }
  .section::before, .cta-strip::after { display: none; }
}
@media (hover: none) {
  .tool-card::after { display: none; }
  .tool-card:hover { transform: none; }
}
/* ==========================================================================
   7. 首页工具面板（A 方案 · 彩色底板小卡片）
   一行 5 个；图标放大置左，右侧上标题下短介绍；鼠标移到图标上弹出说明浮层。
   ========================================================================== */
.home-page .hm-grid { display: grid; grid-template-columns: repeat(5, 1fr); grid-auto-rows: 1fr; gap: 14px; }

.hm-card {
  --tone: #2f7e82;
  position: relative; display: flex; align-items: flex-start; gap: 11px;
  min-width: 0;                                   /* 允许缩到比内容更窄，否则窄屏会被 min-content 撑出横向滚动条 */
  padding: 12px; border: 1px solid var(--gray-200); border-radius: 4px;
  background: var(--card-surface-bg); box-shadow: 0 1px 3px rgba(15, 23, 42, .08);
  color: inherit; text-decoration: none;
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.hm-card:hover { transform: translateY(-2px); box-shadow: 0 10px 20px rgba(15, 23, 42, .14); z-index: 3; }

/* 图标块：与栏目页同一套满色底板 + 深色图标，颜色更实、更醒目，且没有白色底板 */
.hm-ico {
  position: relative; flex: 0 0 auto;
  width: 56px; height: 56px; border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  color: #191f27;
  background: var(--tone);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .06);
}
.hm-ico > svg { width: 32px; height: 32px; display: block; stroke-width: 1.5; }

.hm-body { display: block; flex: 1; min-width: 0; }
.hm-top { display: flex; align-items: center; gap: 5px; min-width: 0; }
.hm-name {
  min-width: 0; font-size: 13.5px; font-weight: 600; line-height: 1.4; color: var(--gray-900);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hm-desc {
  margin-top: 3px; font-size: 12px; line-height: 1.5; color: var(--gray-600);
  height: calc(1.5em * 2);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* ---------- 图标悬停浮层：仿 Bootstrap popover（白底 + 细边 + 标题栏 + 箭头） ----------
   由 home.js 建成 body 末尾的单个节点（position:fixed、坐标实时算），
   所以最后一列会自动翻到图标左侧；隐藏时不占布局，也不会把页面撑出横向滚动条。 */
.hm-tip {
  position: fixed; top: 0; left: 0; z-index: 1300;
  width: 232px; padding: 1px;
  border: 1px solid rgba(0, 0, 0, .2); border-radius: 6px;
  background: #fff; color: #333;
  box-shadow: 0 5px 10px rgba(0, 0, 0, .2);
  font-size: 14px; line-height: 1.43; font-weight: 400; text-align: left;
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .12s ease;
}
.hm-tip.in { opacity: 1; visibility: visible; }
/* 箭头：外圈 1px 细边 + 白色内芯，默认指向图标（气泡在图标右侧） */
.hm-tip::before, .hm-tip::after {
  content: ''; position: absolute; top: var(--ay, 50%); width: 0; height: 0;
  border-style: solid; border-color: transparent;
}
.hm-tip::before { left: -11px; margin-top: -11px; border-width: 11px 11px 11px 0; border-right-color: rgba(0, 0, 0, .2); }
.hm-tip::after { left: -10px; margin-top: -10px; border-width: 10px 10px 10px 0; border-right-color: #fff; }
.hm-tip.is-left::before { left: auto; right: -11px; border-width: 11px 0 11px 11px; border-right-color: transparent; border-left-color: rgba(0, 0, 0, .2); }
.hm-tip.is-left::after { left: auto; right: -10px; border-width: 10px 0 10px 10px; border-right-color: transparent; border-left-color: #fff; }

.hm-tip-title {
  display: block; padding: 8px 14px;
  font-size: 14px; font-weight: 500; line-height: 1.1; color: #333;
  background: #f7f7f7; border-bottom: 1px solid #ebebeb; border-radius: 5px 5px 0 0;
}
.hm-tip-body { display: block; padding: 9px 14px; font-size: 14px; line-height: 1.43; color: #333; }

/* ---------- 十八色调色板（与栏目页同一套色相 / 亮度） ---------- */
.hm-card.tone-0  { --tone: #db7a6f; }
.hm-card.tone-1  { --tone: #d38050; }
.hm-card.tone-2  { --tone: #cb9333; }
.hm-card.tone-3  { --tone: #b09e2c; }
.hm-card.tone-4  { --tone: #61b12c; }
.hm-card.tone-5  { --tone: #33ab2b; }
.hm-card.tone-6  { --tone: #2baa55; }
.hm-card.tone-7  { --tone: #2aa78e; }
.hm-card.tone-8  { --tone: #2ca3b1; }
.hm-card.tone-9  { --tone: #419dd2; }
.hm-card.tone-10 { --tone: #6896dc; }
.hm-card.tone-11 { --tone: #8090e1; }
.hm-card.tone-12 { --tone: #938ae4; }
.hm-card.tone-13 { --tone: #a983e2; }
.hm-card.tone-14 { --tone: #c078df; }
.hm-card.tone-15 { --tone: #db67db; }
.hm-card.tone-16 { --tone: #db70b4; }
.hm-card.tone-17 { --tone: #dc7494; }

/* ---------- 响应式：5 → 4 → 3 → 2 → 1 列 ---------- */
@media (max-width: 1365px) {
  .home-page .hm-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 1099px) {
  .home-page .hm-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 899px) {
  .home-page .hm-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
}
@media (max-width: 599px) {
  .home-page .hm-grid { grid-template-columns: 1fr; }
  .hm-ico { width: 52px; height: 52px; }
  .hm-ico > svg { width: 28px; height: 28px; }
}

/* 最后一个栏目直接收口：去掉问答块后，别让页面底部留一大段空白 */
.home-page > .section:last-of-type { margin-bottom: 8px; }
/* 首页容器底部不需要 80px 内距（页脚自己还有上内距），收一收避免尾部空白 */
.page-wrap.home-page { padding-bottom: 8px; }
