/* ============================================================
   home-desk.css — 墨阶 P1 · 首页开本
   仅作用于 index.html，排在 responsive.css 之前
   视觉只深不浓，不改背景图与遮罩 alpha
   ============================================================ */

/* ---- 首屏网格（今日翻到的移至下方后，hero 区单列） ---- */
.hero-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
  align-items: start;
  margin-top: 24px;
}

.hero-left {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.hero-right {
  min-width: 0;
}

/* ---- 搜索框外框：高 56px / 圆角 12px / hairline 内描边 ---- */
.hero-search {
  position: relative;
  height: 56px;
  border-radius: 12px;
  border: 1px solid var(--color-hairline, var(--color-border));
  background: var(--color-surface);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  transition: border-color 0.24s ease-out, box-shadow 0.24s ease-out;
}

.hero-search:focus-within {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(176, 42, 53, 0.12);
}

.hero-search .hero-search-input {
  height: 54px;
  padding: 0 110px 0 48px !important;
  font-size: 15px !important;
  border: none !important;
  background: transparent !important;
  outline: none;
  width: 100%;
  border-radius: 12px;
  line-height: 1.5;
}

.hero-search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  opacity: 0.6;
}

.hero-search-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  height: 44px;
  padding: 0 20px;
  border-radius: 8px;
  border: none;
  background: var(--color-primary);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.24s ease-out;
}

.hero-search-btn:hover {
  opacity: 0.92;
  transform: translateY(-50%); /* 保持垂直居中，禁止 hover 位移 */
  filter: brightness(1.06);
}

/* 搜索结果下拉：统一向下弹出，固定在搜索框正下方 */
.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-hairline, var(--color-border));
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  max-height: 280px;
  overflow-y: auto;
  z-index: 100;
  display: none;
  opacity: 0;
  transition: opacity 0.24s ease-out;
}

.search-results.visible {
  display: block;
  opacity: 1;
}

.search-result-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-hairline, var(--color-border));
  cursor: pointer;
  transition: background 0.1s ease-out;
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover {
  background: var(--color-surface-2, var(--color-surface-hover));
}

.search-result-type {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  margin-right: 6px;
  vertical-align: middle;
}

.search-result-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
  vertical-align: middle;
}

.search-result-desc {
  font-size: 13px;
  color: var(--color-text-muted);
  margin-top: 4px;
  line-height: 1.5;
}

/* 搜索历史下拉：固定向下弹出（文档流模式，撑开占位不悬浮覆盖） */
.search-history-dropdown {
  position: relative;
  left: 0;
  right: 0;
  width: 100%;
  margin-top: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-hairline, var(--color-border));
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  visibility: hidden;
  z-index: 100;
  transition: max-height 0.24s ease-out, opacity 0.24s ease-out, margin-top 0.24s ease-out, visibility 0s linear 0.24s !important;
}

.search-history-dropdown.visible {
  max-height: 260px;
  opacity: 1;
  margin-top: 6px;
  overflow-y: auto;
  overscroll-behavior: contain;
  visibility: visible;
  transition: max-height 0.24s ease-out, opacity 0.24s ease-out, margin-top 0.24s ease-out, visibility 0s !important;
}

/* ---- 一行导语 ---- */
.hero-lead {
  font-size: 15px;
  color: var(--color-text-secondary);
  line-height: 1.7;
  margin: 0;
}

/* ---- 今日翻到的（roam） ---- */
.roam-box {
  background: var(--color-surface-2, var(--color-surface));
  border: 1px solid var(--color-hairline, var(--color-border));
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.roam-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.roam-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text);
  margin: 0;
}

.roam-cards {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.roam-card {
  padding: 14px 0;
  border-bottom: 1px solid var(--color-hairline, var(--color-border));
  text-decoration: none;
  color: inherit;
  display: block;
  transition: opacity 0.24s ease-out;
}

.roam-card:last-of-type {
  border-bottom: none;
}

.roam-card:hover {
  opacity: 0.8;
}

.roam-card-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  color: var(--color-primary);
  background: rgba(176, 42, 53, 0.1);
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 8px;
}

.roam-card-text {
  font-size: 13px;
  color: var(--color-text-secondary);
  line-height: 1.65;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.roam-card.seen .roam-card-text {
  color: var(--color-text-muted);
}

.roam-shuffle {
  margin-top: 14px;
  width: 100%;
  padding: 10px;
  border: 1px solid var(--color-hairline, var(--color-border));
  border-radius: 8px;
  background: var(--color-surface);
  color: var(--color-text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.24s ease-out;
}

.roam-shuffle:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.roam-empty {
  font-size: 13px;
  color: var(--color-text-muted);
  text-align: center;
  padding: 20px 0;
}

/* ---- 9 分类卡：紧凑版 ----
   2026-09-06 P1 收尾修正：原来写 `height:150px` + `.wiki-desc` 两行 clamp，
   而双语层遇到「行截断 + 父级是 flex」会整条跳过（怕插进去被 clamp 吃掉），
   结果 9 张卡的英文副行全部消失。改成 min-height + 不 clamp，
   英文行照旧跟在中文下面，卡不够高就自己长。 */
.wiki-card {
  min-height: 150px;
  padding: 18px 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-sizing: border-box;
  overflow: hidden;
}

.wiki-icon {
  font-size: 24px;
  line-height: 1;
  margin-bottom: 0;
}

.wiki-title {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
}

.wiki-desc {
  font-size: 13px;
  color: var(--color-text-secondary);
  line-height: 1.5;
  margin: 0;
}

.wiki-count {
  font-size: 11px;
  color: var(--color-text-muted);
  font-weight: 500;
  margin-top: 0;
}

/* ---- 最新收录：密集行 ---- */
.latest-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-hairline, var(--color-border));
  border-radius: 16px;
  overflow: hidden;
}

.latest-row {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr) 140px;
  gap: 16px;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-hairline, var(--color-border));
  text-decoration: none;
  color: inherit;
  transition: background 0.1s ease-out;
  position: relative;
}

.latest-row:last-child {
  border-bottom: none;
}

.latest-row:hover {
  background: var(--color-surface-2, var(--color-surface-hover));
}

.latest-row-date {
  font-size: 12px;
  color: var(--color-text-muted);
  font-weight: 500;
  white-space: nowrap;
}

.latest-row-main {
  min-width: 0;
}

.latest-row-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text);
  margin: 0 0 4px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.latest-row-desc {
  font-size: 13px;
  color: var(--color-text-secondary);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.latest-row-side {
  text-align: right;
  white-space: nowrap;
}

.latest-row-cat {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--color-surface-2, var(--color-surface-hover));
  color: var(--color-text-secondary);
}

.latest-row-new {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  background: linear-gradient(135deg, #ef4444, #f97316);
  color: #fff;
  margin-left: 6px;
  letter-spacing: 0.04em;
}

/* ---- 响应式：移动端单列 ---- */
@media (max-width: 900px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .hero-right {
    /* 窄屏不要把「今日翻到的」提到搜索框前面（P1 原来写了 order:-1，
       手机上会让 469px 高的卡片堆把搜索框顶到两屏之外）。搜索仍是第一入口。 */
    order: 0;
  }

  .latest-row {
    grid-template-columns: 80px minmax(0, 1fr);
    gap: 12px;
  }

  .latest-row-side {
    grid-column: 2;
    text-align: left;
    margin-top: 4px;
  }
}

@media (max-width: 480px) {
  .hero-search .hero-search-input {
    padding: 0 90px 0 40px !important;
    font-size: 14px !important;
  }

  .hero-search-btn {
    padding: 0 14px;
    font-size: 13px;
  }

  .wiki-card {
    height: auto;
    min-height: 130px;
    padding: 16px 18px;
  }

  .latest-row {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 14px 16px;
  }

  .latest-row-date {
    font-size: 11px;
  }

  .latest-row-side {
    grid-column: 1;
  }
}

/* COLA-HERO-COMPACT —— 首屏重心修正（2026-09-06，P1 收尾）
   原 .hero 是 120px 上下留白 + 64px 两行大标题，搜索框被顶到 634px（手机 584px），
   第一屏只剩标语；P1 的目标是「搜索为骨」，所以把标语区压掉一截。
   只影响首页（home-desk.css 只有 index.html 挂），深浅两主题通用。 */
.hero { padding: 16px 0 40px; }
.hero-title { font-size: clamp(30px, 4.2vw, 44px); line-height: 1.16; letter-spacing: -0.02em; }
.hero-subtitle { font-size: 15px; }
@media (max-width: 640px) {
  .hero { padding: 12px 0 26px; }
  .hero-title { font-size: clamp(26px, 7.4vw, 32px); }
}

/* ============================================================
   首页响应式修复（2026-09-06）
   修复：文字重叠、元素挤压、移动端排版错乱
   只改布局样式，不碰业务逻辑
   ============================================================ */

/* hero-search-helper 已移出 .hero-search 容器，作为 .hero-left flex 子元素
   去掉原 margin-top:14px，避免与 flex gap:20px 叠加导致间距过大 */
.hero-search-helper {
  margin-top: 0;
}

/* 统计数字：小屏幕允许换行，防止 3 项挤压重叠 */
@media (max-width: 768px) {
  .hero-stats {
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px 32px;
    margin-top: 32px;
  }
  .hero-stat {
    min-width: 80px;
    flex: 0 1 auto;
  }
  .hero-stat-num {
    font-size: clamp(24px, 7vw, 32px);
  }
  .hero-stat-label {
    font-size: 12px;
  }
}

@media (max-width: 480px) {
  .hero-stats {
    gap: 16px 24px;
    margin-top: 24px;
  }
  .hero-stat {
    min-width: 70px;
  }
  .hero-stat-num {
    font-size: clamp(22px, 8vw, 28px);
  }
  /* 热门搜索标签：小屏幕缩小，防止溢出 */
  .hot-tag {
    padding: 4px 10px;
    font-size: 12px;
  }
  .helper-hint {
    font-size: 12px;
    line-height: 1.5;
  }
}

@media (max-width: 360px) {
  .hero-stats {
    gap: 12px 16px;
  }
  .hero-stat {
    min-width: 60px;
  }
  .hero-stat-num {
    font-size: 20px;
  }
  .hero-stat-label {
    font-size: 11px;
  }
}

/* 今日精选 / 最新收录：确保小屏幕单列，卡片不挤压 */
@media (max-width: 600px) {
  .picks-grid,
  .latest-grid {
    grid-template-columns: 1fr !important;
    gap: 14px;
  }
  .pick-card,
  .latest-card {
    padding: 18px 16px;
  }
}

/* 百科分类卡：小屏幕 2 列，极小号单列 */
@media (max-width: 600px) {
  .wiki-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px;
  }
}
@media (max-width: 380px) {
  .wiki-grid {
    grid-template-columns: 1fr !important;
  }
}

/* 确保首页所有 section 内边距在小屏幕合理 */
@media (max-width: 768px) {
  .home-picks,
  .home-latest {
    padding-top: 16px !important;
    padding-bottom: 16px !important;
  }
  .section-header {
    margin-bottom: 24px;
  }
  .section-title {
    font-size: clamp(20px, 5.5vw, 26px);
  }
  .section-subtitle {
    font-size: 13px;
  }
}

/* ---- 今日翻到的：移至每日AI小知识下方后的布局（2026-09-06） ---- */
.roam-section {
  margin-top: 20px;
  margin-bottom: 0;
}

.roam-section .roam-box {
  max-width: 680px;
  margin: 0 auto;
}

@media (max-width: 768px) {
  .roam-section .roam-box {
    max-width: 100%;
  }
  .roam-section {
    margin-top: 16px;
  }
}

