/* =========================================================
 * 全站样式（首页 + 详情页共用）
 * 配色：深色主题，橙色点缀
 * 2026-10-24 改版：像素风横幅、居中搜索、统一响应式页头
 * ========================================================= */

:root {
  color-scheme: dark;       /* 让滚动条、下拉框等原生控件跟随深色 */

  --bg: #24252a;            /* 页面背景 */
  --surface: #303136;       /* 卡片表面 */
  --surface-2: #2c2d32;     /* 顶部导航条 */
  --sunken: #38393e;        /* 内嵌面（搜索框、占位） */
  --border: #414247;        /* 分隔线 / 卡片描边 */
  --border-strong: #4d4e54; /* 悬停时的描边 */
  --text: #f2f3f5;          /* 主文字 */
  --text-2: #a8a9af;        /* 次要文字 */
  --text-3: #7c7e85;        /* 更弱的辅助文字 */
  --accent: #ff7a2f;        /* 主题色（按钮、选中态） */
  --accent-hover: #ff9350;  /* 主题色（悬停变亮） */
  --accent-2: #2dd4bf;      /* 辅助强调（分类圆点） */
  --accent-soft: rgba(255, 122, 47, 0.14);  /* 橙色浅底 */
  --header-solid: #37383a;  /* 顶部状态栏实底（首页下滑与详情页统一） */
  --radius: 10px;
  --header-h: 64px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-hover: 0 12px 28px rgba(0, 0, 0, 0.5);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

/* hidden 属性必须能压住后面的 display:flex 等设置 */
[hidden] { display: none !important; }

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

main { flex: 1; }

/* ---------------- 滚动条 / 选区 / 焦点 ---------------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: #45464b;
  border-radius: 6px;
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: #56575d; }

::selection { background: rgba(255, 122, 47, 0.32); color: #fff; }

a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ---------------- 顶部导航与图片横幅 ---------------- */
.site-header {
  background: var(--header-solid);
  backdrop-filter: saturate(150%) blur(14px);
  -webkit-backdrop-filter: saturate(150%) blur(14px);
  border-bottom: 1px solid rgba(133, 181, 194, 0.16);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.16);
  position: sticky;
  top: 0;
  z-index: 20;
}

/* 首页导航覆盖在横幅顶部：初始透明，滚动后恢复实底 */
body#page-home .site-header {
  position: fixed;
  left: 0;
  right: 0;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-bottom-color: transparent;
  box-shadow: none;
  transition: background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

body#page-home .site-header.is-solid {
  background: var(--header-solid);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-bottom-color: rgba(133, 181, 194, 0.16);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.16);
}

/* 透明状态下仅增强文字阴影，文字本身始终保持不透明 */
body#page-home .site-header:not(.is-solid) .logo,
body#page-home .site-header:not(.is-solid) .cat-nav a {
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.72);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 30px;
  height: var(--header-h);
}

.logo {
  display: inline-flex;
  align-items: center;
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: 0.2px;
  flex-shrink: 0;
}

.logo img {
  display: block;
  width: auto;
  height: 30px;
}

.logo:hover { opacity: 0.88; }

/* 桌面端分类靠右，移动端自动换到第二行 */
.cat-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.cat-nav::-webkit-scrollbar { display: none; }

.cat-nav a {
  font-size: 14.5px;
  color: var(--text-2);
  text-decoration: none;
  padding: 7px 13px;
  border-radius: 8px;
  white-space: nowrap;
  transition: color 0.15s, background 0.15s;
}

.cat-nav a:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }

.cat-nav a.active {
  color: var(--accent-hover);
  background: var(--accent-soft);
  font-weight: 600;
}

/* 仅桌面端：四个导航项以页头中心线为准整体居中，移动端布局保持不变 */
@media (min-width: 861px) {
  .header-inner {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 0;
  }

  .header-inner .logo {
    grid-column: 1;
    justify-self: start;
  }

  .header-inner .cat-nav {
    grid-column: 2;
    flex: none;
    justify-content: center;
    justify-self: center;
  }

  /* 仅桌面端放大品牌标识与四个导航文字 */
  .header-inner .logo { font-size: 20px; }
  .header-inner .logo img { height: 34px; }
  .header-inner .cat-nav a { font-size: 16px; padding: 8px 15px; }
}

/* 横幅保留图片主体，以轻遮罩确保搜索框清晰可读 */
.hero {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: clamp(250px, 25vw, 340px);
  padding: 44px 20px;
  overflow: hidden;
  background-color: #0b1625;
  background-image:
    linear-gradient(180deg, rgba(4, 10, 18, 0.12), rgba(4, 10, 18, 0.38)),
    url("images/header-banner.webp");
  background-position: center center;
  background-size: cover;
  background-repeat: no-repeat;
  border-bottom: 1px solid rgba(133, 181, 194, 0.12);
}

.hero::before {
  content: "";
  position: absolute;
  z-index: 0;
  left: 0;
  right: 0;
  top: 0;
  height: 120px;
  background: linear-gradient(180deg, rgba(3, 8, 15, 0.5), transparent);
  pointer-events: none;
}

.hero::after {
  content: "";
  position: absolute;
  z-index: 0;
  left: 0;
  right: 0;
  bottom: 0;
  height: 54px;
  background: linear-gradient(180deg, transparent, rgba(36, 37, 42, 0.7));
  pointer-events: none;
}

/* 横幅搜索框：始终水平、垂直居中 */
.search-box {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(680px, 100%);
  height: 56px;
  flex-shrink: 0;
  margin: 0;
  padding: 0 6px 0 18px;
  background: rgba(22, 29, 38, 0.88);
  border: 1px solid rgba(174, 211, 220, 0.3);
  border-radius: 14px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
}

.search-box:focus-within {
  background: rgba(25, 32, 41, 0.96);
  border-color: var(--accent-hover);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.34), 0 0 0 3px rgba(255, 122, 47, 0.16);
}

.search-icon { color: #b7c6cd; flex-shrink: 0; }

.search-input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  background: transparent;
  padding: 0 8px;
}

.search-input::placeholder { color: #9aaab2; }

/* 焦点提示交给外层，避免出现双层描边 */
.search-input:focus-visible { outline: none; }

.search-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.15s;
}

.search-btn:hover { background: var(--accent-hover); transform: translateY(-1px); }

/* ---------------- 内容区头部（分类名 + 数量） ---------------- */
.page-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 26px 0 4px;
}

.page-title {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.page-meta {
  color: var(--text-3);
  font-size: 13px;
}

/* 搜索结果提示条 */
.search-result-tip {
  margin: 8px 0 -8px;
  color: var(--text-2);
  font-size: 13.5px;
}

.search-result-tip b { color: var(--accent-hover); font-weight: 600; }

/* ---------------- 卡片网格 ---------------- */
.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  padding: 18px 0 44px;
}

@media (max-width: 960px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 640px) {
  .grid { grid-template-columns: repeat(2, 1fr); gap: 13px; padding: 14px 0 32px; }
  .card-badge { top: 7px; left: 7px; padding: 2px 8px; font-size: 11px; }
}

.card {
  display: block;
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--text);
  transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}

.card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: var(--shadow-hover);
}

/* 封面容器：负责裁剪放大效果 */
.card-cover-wrap {
  position: relative;
  overflow: hidden;
  background: var(--sunken);
}

.card-cover {
  display: block;
  width: 100%;
  aspect-ratio: 2 / 1;  /* 在当前 3:2 基础上再将封面高度降低 1/4，其余卡片结构不变 */
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.35s ease, transform 0.4s ease;
}

.card-cover.is-loaded { opacity: 1; }

.card:hover .card-cover { transform: scale(1.04); }

/* 首页推荐区的「推荐」角标（左上角，压在封面上） */
.card-badge {
  position: absolute;
  top: 9px;
  left: 9px;
  z-index: 1;
  padding: 3px 9px;
  border-radius: 99px;
  background: rgba(255, 122, 47, 0.94);
  color: #fff;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

/* 悬停时右上角浮出的箭头 */
.card-arrow {
  position: absolute;
  top: 9px;
  right: 9px;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 122, 47, 0.92);
  color: #fff;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}

.card:hover .card-arrow { opacity: 1; transform: translateY(0); }

.card-body {
  padding: 10px 13px 13px;
}

/* 分类标签：青色小圆点 + 楷体分类名 */
.card-tag {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 5px;
  font-family: "KaiTi", "STKaiti", "楷体", serif;
  font-size: 12.5px;
  color: var(--text-2);
}

.card-tag-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-2);
  flex-shrink: 0;
}

.card-title {
  font-size: 13.5px;
  line-height: 1.5;
  transition: color 0.18s;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card:hover .card-title { color: var(--accent-hover); }

/* ---------------- 空态 ---------------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 80px 20px 90px;
  text-align: center;
  color: var(--text-2);
}

.empty-state svg { color: var(--border-strong); }

.empty-title { font-size: 15px; color: var(--text); }

.empty-desc { font-size: 13.5px; color: var(--text-3); }

.empty-btn {
  margin-top: 4px;
  display: inline-block;
  padding: 9px 22px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-hover);
  font-size: 13.5px;
  text-decoration: none;
  border: 1px solid rgba(255, 122, 47, 0.3);
  transition: background 0.15s;
}

.empty-btn:hover { background: rgba(255, 122, 47, 0.22); }

/* ---------------- 滚动到底提示 ---------------- */
.load-end {
  text-align: center;
  color: var(--text-3);
  font-size: 12.5px;
  padding: 6px 0 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.load-end::before, .load-end::after {
  content: "";
  width: 48px;
  height: 1px;
  background: var(--border);
}

/* ---------------- 回到顶部 ---------------- */
.back-top {
  position: fixed;
  right: 28px;
  bottom: 32px;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: rgba(44, 45, 50, 0.92);
  backdrop-filter: blur(8px);
  color: var(--text-2);
  cursor: pointer;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.22s, transform 0.22s, color 0.15s, border-color 0.15s;
  z-index: 30;
}

.back-top.show { opacity: 1; transform: translateY(0); pointer-events: auto; }

.back-top:hover { color: var(--accent-hover); border-color: var(--accent); }

/* ---------------- 详情页 ---------------- */
.detail-wrap { padding: 0 0 40px; }

.crumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 20px 0 16px;
  font-size: 13px;
  color: var(--text-3);
  flex-wrap: wrap;
}

.crumbs a { color: var(--text-2); text-decoration: none; }

.crumbs a:hover { color: var(--accent-hover); }

.crumbs .sep { color: var(--border-strong); }

.crumbs .here { color: var(--text); }

.detail-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 26px;
  display: flex;
  gap: 30px;
}

@media (max-width: 640px) {
  .detail-card { flex-direction: column; padding: 16px; gap: 18px; }
}

.detail-cover {
  width: 320px;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 10px;
  background: var(--sunken);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

@media (max-width: 640px) {
  .detail-cover { width: 100%; }
}

.detail-info { flex: 1; min-width: 0; }

.detail-info h1 {
  font-size: 22px;
  line-height: 1.45;
  margin: 12px 0 6px;
}

.cat-tag {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-hover);
  font-size: 12px;
  border: 1px solid rgba(255, 122, 47, 0.28);
}

.detail-section { margin-top: 22px; }

.section-title {
  font-size: 15px;
  padding-left: 10px;
  border-left: 3px solid var(--accent);
  line-height: 1.3;
  margin-bottom: 11px;
  font-weight: 600;
}

.detail-desc {
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.85;
  white-space: pre-line;
}

/* 网盘链接按钮 */
.link-list {
  display: flex;
  flex-wrap: wrap;
  gap: 11px;
}

.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--sunken);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  text-decoration: none;
  font-size: 14px;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}

.link-btn:hover {
  background: #414247;
  border-color: var(--accent);
  transform: translateY(-2px);
}

/* 第一个链接作为主按钮 */
.link-btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.link-btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

/* 同类推荐 */
.related-block { margin-top: 34px; }

.related-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.related-title::before {
  content: "";
  width: 3px;
  height: 15px;
  background: var(--accent);
  border-radius: 2px;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}

@media (max-width: 960px) { .related-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 640px) { .related-grid { grid-template-columns: repeat(2, 1fr); gap: 13px; } }

/* 资源 id 不存在时的提示 */
.not-found {
  text-align: center;
  color: var(--text-2);
  padding: 70px 0 90px;
  font-size: 15px;
  line-height: 2;
}

.not-found a { color: var(--accent-hover); text-decoration: none; }

/* ---------------- 页脚 ---------------- */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  margin-top: 10px;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 28px;
  padding-top: 26px;
  padding-bottom: 26px;
}

.footer-brand { max-width: 300px; }

.footer-brand .name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.footer-brand .slogan {
  font-size: 12.5px;
  color: var(--text-3);
  line-height: 1.7;
}

.footer-col .col-title {
  font-size: 12.5px;
  color: var(--text-3);
  margin-bottom: 10px;
  letter-spacing: 0.4px;
}

.footer-col nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  max-width: 320px;
}

.footer-col a {
  font-size: 13px;
  color: var(--text-2);
  text-decoration: none;
}

.footer-col a:hover { color: var(--accent-hover); }

.footer-copy {
  border-top: 1px solid var(--border);
  padding: 14px 0 18px;
  text-align: center;
  font-size: 12px;
  color: var(--text-3);
}

/* ---------------- 响应式：窄屏导航换行，横幅搜索保持可见 ---------------- */
@media (max-width: 860px) {
  :root { --header-h: auto; }

  .header-inner {
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 20px;
    height: auto;
  }

  .logo { order: 1; flex: 1; }

  .cat-nav {
    order: 2;
    justify-content: flex-start;
    width: 100%;
    flex: none;
    gap: 1px;
    padding-bottom: 2px;
  }

  .cat-nav a { padding: 6px 11px; font-size: 15px; }

  /* 手机端顶部文字略微放大 */
  .header-inner .logo { font-size: 18px; }

  .hero {
    min-height: 230px;
    padding: 36px 18px;
  }

  /* 手机端横幅高度在原有基础上降低 25% */
  body#page-home .hero {
    min-height: 225px;
    padding: 92px 18px 12px;
  }

  /* 仅手机端：使用已裁掉顶部 1/4 的专用图片，横幅高度保持不变 */
  body#page-home .hero {
    background-image:
      linear-gradient(180deg, rgba(4, 10, 18, 0.12), rgba(4, 10, 18, 0.38)),
      url("images/header-banner-mobile.webp");
    background-size: cover;
    background-position: center center;
  }

  .search-box {
    width: min(640px, 100%);
    height: 52px;
    padding-left: 15px;
    border-radius: 12px;
  }

  .search-btn { width: 40px; height: 40px; }
  .page-head { padding-top: 18px; }
  .page-title { font-size: 18px; }

  .back-top { right: 14px; bottom: 18px; width: 38px; height: 38px; }

  .footer-inner { gap: 20px; padding-top: 20px; padding-bottom: 20px; }
  .footer-brand { max-width: none; }
}

@media (max-width: 480px) {
  .hero { min-height: 210px; padding: 30px 14px; }
  body#page-home .hero { min-height: 210px; padding: 92px 14px 10px; }
  .search-box { height: 50px; gap: 5px; padding: 0 5px 0 13px; }
  .search-input { font-size: 14px; padding: 0 5px; }
  .search-btn { width: 38px; height: 38px; border-radius: 9px; }
}

/* ---------------- 触摸设备：关闭悬停态，避免点击后粘住 ---------------- */
@media (hover: none) {
  .logo:hover { color: var(--text); }
  .cat-nav a:hover { color: var(--text-2); background: none; }
  .search-btn:hover { background: var(--accent); transform: none; }
  .card:hover {
    transform: none;
    border-color: var(--border);
    box-shadow: var(--shadow);
  }
  .card:hover .card-cover { transform: none; }
  .card:hover .card-title { color: var(--text); }
  .card:hover .card-arrow { opacity: 0; transform: translateY(-4px); }
  .link-btn:hover { background: var(--sunken); border-color: var(--border-strong); transform: none; }
  .link-btn.primary:hover { background: var(--accent); border-color: var(--accent); }
}

/* ---------------- 动效偏好 ---------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
  .card:hover { transform: none; }
  .card:hover .card-cover { transform: none; }
}
