/* ═══════════════════════════════════════════════════════════════
 * wangpanwang 前台 布局优化层 layout.css  (UI v1.2 · 2026-09-03)
 * 独立于 theme.css：只新增布局/导航/节奏/组件观感，不删改既有规则。
 * 令牌复用车 theme.css 的 --wpw-*（靛蓝/语义/中性）。
 * 回滚 = 从 layout.html 移除本文件引用即可。
 * ═══════════════════════════════════════════════════════════════ */

/* ─── 内容宽度收敛（桌面 ≤1140 舒适阅读宽） ─── */
@media (min-width: 1200px) {
  .container { max-width: 1140px; }
}

/* ─── 顶栏：sticky + 滚动阴影 ─── */
.wpw-topbar {
  position: sticky;
  top: 0;
  z-index: 1030;
  background: linear-gradient(135deg, #1E2A5E 0%, #312E81 45%, #4338CA 100%);
  transition: box-shadow .2s ease;
}
.wpw-topbar.is-scrolled { box-shadow: 0 2px 12px rgba(30, 42, 94, .28); }
.wpw-topbar-in { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; padding-top: 10px; padding-bottom: 10px; }

/* ─── 品牌字标（靛蓝方块 logo 点，纯 CSS 无图） ─── */
.wpw-brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: #fff !important;
  font-size: 19px;
  font-weight: 500;
  letter-spacing: .2px;
  text-decoration: none !important;
  white-space: nowrap;
}
.wpw-brand::before {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: linear-gradient(135deg, #818CF8, #4F46E5);
  box-shadow: 0 0 0 3px rgba(129, 140, 248, .25);
}

/* ─── 主导航（桌面行内；≤991 抽屉） ─── */
.wpw-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px 4px;
  margin-left: auto;
}
.wpw-nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 4px 12px;
  border-radius: 999px;
  color: rgba(255, 255, 255, .86);
  font-size: 14px;
  text-decoration: none !important;
  transition: background .15s ease, color .15s ease;
}
.wpw-nav-link:hover { color: #fff; background: rgba(255, 255, 255, .12); }
.wpw-nav-link.active { color: #fff; background: #4F46E5; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18); }
.wpw-nav-cta {
  background: #fff;
  color: #4338CA !important;
  font-weight: 500;
}
.wpw-nav-cta:hover { background: #EEF2FF; }

/* ─── 汉堡 ─── */
.wpw-nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 42px;
  height: 42px;
  padding: 10px;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, .1);
  cursor: pointer;
}
.wpw-nav-toggle span {
  display: block;
  width: 100%;
  height: 2px;
  border-radius: 2px;
  background: #fff;
  transition: transform .2s ease, opacity .2s ease;
}
.wpw-nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.wpw-nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.wpw-nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ─── 搜索框（顶栏内；桌面限宽右置） ─── */
.wpw-search { flex: 1 1 220px; max-width: 420px; margin-left: auto; }
.wpw-search .form-control { border-radius: 999px 0 0 999px; }
.wpw-search .btn { border-radius: 0 999px 999px 0; }

/* ─── hero 主搜索（页面头，居中且更宽） ─── */
.wpw-hero-search { max-width: 700px; margin: 0 auto; }
.wpw-hero-search .form-select {
  flex: 0 0 auto;
  width: auto;
  max-width: 150px;
  border-radius: 999px 0 0 999px;
  border-right: 0;
  font-size: 0.95rem;
}
.wpw-hero-search.with-drive .form-control { border-radius: 0; }
.wpw-hero-search:not(.with-drive) .form-control { border-radius: 999px 0 0 999px; }
.wpw-hero-search .btn { border-radius: 0 999px 999px 0; }
@media (max-width: 575.98px) {
  .wpw-hero-search .form-select { max-width: none; width: 100%; border-radius: 999px; border-right: 1px solid #ced4da; margin-bottom: 8px; }
  .wpw-hero-search.with-drive .form-control,
  .wpw-hero-search:not(.with-drive) .form-control { border-radius: 999px 0 0 999px; }
}

/* ─── 响应式顶栏重组（≤991 折叠） ─── */
@media (max-width: 991.98px) {
  .wpw-nav-toggle { display: flex; }
  .wpw-nav {
    display: none;
    order: 4;
    flex-basis: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    margin-left: 0;
    padding: 10px 4px 4px;
    border-top: 1px solid rgba(255, 255, 255, .12);
  }
  .wpw-nav.open { display: flex; }
  .wpw-nav-link { justify-content: center; min-height: 42px; }
  .wpw-search { order: 3; flex-basis: 100%; max-width: none; margin-left: 0; }
  .wpw-topbar-in { gap: 10px 12px; }
}

/* ─── 分区标题组件（全站统一签名：左竖条 + 计数；v1.2 · 2026-09-04 微调：16→15.5 / 500→600） ─── */
.wpw-section {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.wpw-section h2,
.wpw-section h3 {
  margin: 0;
  font-size: 15.5px;
  font-weight: 600;
  color: #3730A3;
  display: inline-flex;
  align-items: center;
}
.wpw-section h2::before,
.wpw-section h3::before,
h2.wpw-section::before,
h3.wpw-section::before {
  content: "";
  width: 4px;
  height: 16px;
  border-radius: 2px;
  background: #4F46E5;
  margin-right: 10px;
}
.wpw-section .ms-auto { margin-left: auto; }

/* ─── 页面头（type/tag 页定位层）：白卡背景 + 圆角 + 内边距（与整体卡片语言一致） ─── */
.wpw-pagehead {
  background: #fff;
  border: 1px solid #E7E9F0;
  border-radius: 12px;
  padding: 18px 22px;
  margin-bottom: 22px;
}
.wpw-pagehead h1 { color: #3730A3; }
.wpw-pagehead p { margin: 6px 0 0; }

/* ─── 页面头标题徽章（type/tag 页）：网盘/标签品牌色块 + 「资源」整句，字号与旧版标题一致 24px ─── */
.wpw-type-badge {
  font-size: 24px;
  line-height: 1.35;
  font-weight: 500;
  padding: 7px 18px;
  border-radius: 10px;
  letter-spacing: .3px;
  vertical-align: middle;
}
@media (max-width: 575.98px) {
  .wpw-type-badge { font-size: 19px; padding: 6px 14px; }
}

/* ─── flash 条（圆角语义化） ─── */
.wpw-flash .alert { border-radius: 10px; box-shadow: none; }

/* ─── 侧栏 sticky（≥992 常驻） ─── */
@media (min-width: 992px) {
  .wpw-side-sticky { position: sticky; top: 88px; }
}
/* 768-991：侧栏卡 2 列排布（降低突跳感） */
@media (min-width: 768px) and (max-width: 991.98px) {
  .wpw-side-sticky { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 16px; }
  .wpw-side-sticky > .card { margin-bottom: 0 !important; }
}

/* ─── 侧栏卡头：浅靛点缀行 ─── */
.card-header { border-radius: 0 !important; }
.wpw-side-sticky .card-header,
aside .card-header {
  background: #F9FAFB;
  color: #3730A3;
  font-weight: 500;
  border-bottom: 1px solid #F1F3F9;
  padding: 12px 16px;
}

/* ─── 详情操作卡：独立浅底 + 强调按钮（v1.2 · 2026-09-04 微调：18/20→20/22 与放大后的标题同步） ─── */
.wpw-act-card {
  background: #F6F7FB;
  border: 1px solid #E7E9F0;
  border-radius: 12px;
  padding: 20px 22px;
}
.wpw-act-primary .btn { min-height: 46px; padding: 8px 26px; font-size: 15px; border-radius: 8px; }
.wpw-act-hint { font-size: 13px; color: #6B7280; margin-top: 10px; }
.wpw-act-hint a { word-break: break-all; }

/* ─── 详情元信息行：· 分隔（纯 CSS） ─── */
.wpw-meta-line > * + *::before {
  content: "·";
  margin: 0 10px;
  color: #C3C8D4;
}

/* ─── 标签胶囊（品牌浅靛） ─── */
.wpw-tag {
  display: inline-block;
  padding: 4px 12px;
  margin: 2px 6px 2px 0;
  border-radius: 999px;
  background: #EEF2FF;
  border: 1px solid #E0E7FF;
  color: #4338CA;
  font-size: 12px;
  text-decoration: none;
  transition: all .15s ease;
}
.wpw-tag:hover { background: #4F46E5; border-color: #4F46E5; color: #fff; text-decoration: none; }

/* ─── 列表行迭代：hover 下划线（颜色非唯一指示） ─── */
.wpw-res-row:hover .wpw-res-title {
  text-decoration: underline;
  text-underline-offset: 3px;
}
/* 576-767 与 ≤575：时间列隐藏（徽章全留，密度适配） */
@media (max-width: 767.98px) {
  .wpw-res-meta { display: none; }
}

/* ─── 移动端详情主操作：吸底代理浮层（JS 渲染，转存事件仍由原按钮触发） ─── */
.wpw-act-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1040;
  display: none;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
  background: rgba(255, 255, 255, .96);
  border-top: 1px solid #E7E9F0;
  box-shadow: 0 -4px 14px rgba(30, 42, 94, .08);
}
.wpw-act-bar .btn { display: block; width: 100%; min-height: 50px; font-size: 16px; border-radius: 10px; }
body.has-act-bar { padding-bottom: 76px; }
@media (max-width: 575.98px) {
  .wpw-act-bar.show { display: block; }
}

/* ─── 返回顶部 ─── */
.wpw-backtop {
  position: fixed;
  right: 18px;
  bottom: 84px;
  z-index: 1020;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: #4F46E5;
  color: #fff;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity .2s ease, transform .2s ease, background .15s ease;
  box-shadow: 0 4px 12px rgba(79, 70, 229, .35);
}
.wpw-backtop.show { opacity: 1; pointer-events: auto; transform: none; }
.wpw-backtop:hover { background: #4338CA; }
@media (max-width: 575.98px) { .wpw-backtop { bottom: 84px; } }

/* ─── 页脚三层 ─── */
.wpw-footer { background: #111827; color: #CBD5E1; }
.wpw-footer .wpw-footer-top { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 26px; padding: 30px 0 26px; }
.wpw-footer .wpw-foot-brand { color: #fff; font-size: 16px; font-weight: 500; display: inline-flex; align-items: center; gap: 8px; }
.wpw-footer .wpw-foot-brand::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: #818CF8; }
.wpw-footer h4 { color: #F1F5F9; font-size: 13px; font-weight: 500; margin: 0 0 10px; }
.wpw-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.wpw-footer a { color: #94A3B8; text-decoration: none; font-size: 13px; }
.wpw-footer a:hover { color: #fff; }
.wpw-foot-desc { color: #94A3B8; font-size: 13px; margin-top: 8px; line-height: 1.7; }
.wpw-footer .wpw-foot-bar { border-top: 1px solid rgba(255, 255, 255, .08); padding: 14px 0; text-align: center; font-size: 12px; color: #64748B; }
@media (max-width: 767.98px) {
  .wpw-footer .wpw-footer-top { grid-template-columns: 1fr; gap: 18px; padding: 24px 0 20px; }
}

/* ─── 动效克制：尊重减弱动态偏好 ─── */
@media (prefers-reduced-motion: reduce) {
  .wpw-topbar, .wpw-nav-toggle span, .wpw-nav-link, .wpw-act-bar .btn, .wpw-backtop {
    transition: none !important;
  }
}

/* ─── 2026-09-04 页脚 QQ 群列 / 首页热词整行 / 友链栏 ─── */
/* 页脚右侧 QQ 交流群：有图显真图（浅底白边适配深色页脚），无图灰虚占位框 */
.wpw-footer .wpw-foot-qq { text-align: left; }
.wpw-qq-img {
  display: block;
  max-width: 132px;
  padding: 4px;
  border-radius: 8px;
  background: #fff;
}
.wpw-qq-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 132px;
  height: 132px;
  border: 1px dashed rgba(148, 163, 184, .45);
  border-radius: 8px;
  color: #64748B;
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
}

/* 首页热门搜索词：占满内容整行，无标题/无卡片背景/无边框（胶囊样式继承 .tag-cloud a） */
.wpw-hot-cloud {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 12px;
  padding: 8px 0 30px;
}
.wpw-hot-cloud a {
  margin: 0;
  padding: 0.32rem 0.9rem;
  font-size: 0.92rem;
}

/* 首页友链栏（页脚上方；图标可选，hover 浮层显示简介，favicon 加载失败不显示不影响布局） */
.wpw-friend-strip {
  margin-top: 34px;
  padding: 16px 0 6px;
  border-top: 1px dashed #CBD5E1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 22px;
  row-gap: 10px;
}
.wpw-friend-label { color: #64748B; font-size: 13px; }
.wpw-friend-item { position: relative; display: inline-flex; }
.wpw-friend-item > a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #475569;
  font-size: 14px;
  text-decoration: none;
  transition: color .15s;
}
.wpw-friend-item > a:hover { color: #4338CA; }
.wpw-friend-logo { width: 16px; height: 16px; border-radius: 3px; object-fit: contain; flex: none; }
.wpw-friend-tip {
  display: none;
  position: absolute;
  bottom: calc(100% + 12px);
  left: 0;
  z-index: 30;
  width: 300px;
  max-width: 74vw;
  padding: 10px 13px;
  border-radius: 8px;
  background: #111827;
  color: #E2E8F0;
  font-size: 12px;
  line-height: 1.7;
  text-align: left;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .18);
  pointer-events: none;
}
.wpw-friend-item:hover .wpw-friend-tip { display: block; }
.wpw-friend-tip::before {
  content: "";
  position: absolute;
  top: 100%;
  left: 18px;
  border: 6px solid transparent;
  border-top-color: #111827;
}
@media (max-width: 575.98px) {
  .wpw-friend-strip { column-gap: 14px; }
}
