/*
 * buddy-theme.css — BUDDY 站群基础主题变量
 * 皮肤：data-theme="red" | "blue" | "orange"
 * v1.1  2025  — 导航对齐修订
 */

/* ── 全局重置 ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

/* ── CSS 变量 · 默认红站 ───────────────────────────── */
:root {
  --bud-primary:      #c0392b;
  --bud-primary-dk:   #96281b;
  --bud-primary-lt:   #e74c3c;
  --bud-accent:       #e8a838;
  --bud-bg:           #ffffff;
  --bud-bg-alt:       #f5f5f5;
  --bud-text:         #222222;
  --bud-text-muted:   #666666;
  --bud-border:       #dddddd;
  --bud-nav-bg:       #1a0000;
  --bud-nav-text:     #f0d9b5;
  --bud-hero-overlay: rgba(26,0,0,0.55);
  --bud-btn:          #c0392b;
  --bud-btn-text:     #ffffff;
  --bud-ribbon:       #c0392b;
}

[data-theme="red"] {
  --bud-primary:      #c0392b;
  --bud-primary-dk:   #96281b;
  --bud-primary-lt:   #e74c3c;
  --bud-accent:       #e8a838;
  --bud-bg:           #ffffff;
  --bud-bg-alt:       #fdf2f2;
  --bud-text:         #222222;
  --bud-text-muted:   #666666;
  --bud-border:       #e0c8c8;
  --bud-nav-bg:       #1a0000;
  --bud-nav-text:     #f0d9b5;
  --bud-hero-overlay: rgba(26,0,0,0.50);
  --bud-btn:          #c0392b;
  --bud-btn-text:     #ffffff;
  --bud-ribbon:       #c0392b;
}

[data-theme="blue"] {
  --bud-primary:      #3d7ec8;
  --bud-primary-dk:   #2c5f9e;
  --bud-primary-lt:   #5b9bd5;
  --bud-accent:       #d4a94a;
  --bud-bg:           #ffffff;
  --bud-bg-alt:       #e8f4fc;
  --bud-text:         #1a2a3a;
  --bud-text-muted:   #4a6278;
  --bud-border:       #b8d4ec;
  --bud-nav-bg:       #0d1f3c;
  --bud-nav-text:     #c8dff5;
  --bud-hero-overlay: rgba(13,31,60,0.52);
  --bud-btn:          #3d7ec8;
  --bud-btn-text:     #ffffff;
  --bud-ribbon:       #3d7ec8;
}

[data-theme="orange"] {
  --bud-primary:      #b87333;
  --bud-primary-dk:   #8b5e2a;
  --bud-primary-lt:   #d4924a;
  --bud-accent:       #e8c96a;
  --bud-bg:           #faf6ee;
  --bud-bg-alt:       #f0e8d8;
  --bud-text:         #2a1f0e;
  --bud-text-muted:   #6b5540;
  --bud-border:       #d4b896;
  --bud-nav-bg:       #2a1506;
  --bud-nav-text:     #f5e4c0;
  --bud-hero-overlay: rgba(42,21,6,0.50);
  --bud-btn:          #b87333;
  --bud-btn-text:     #ffffff;
  --bud-ribbon:       #b87333;
}

/* ── 页面基础 ─────────────────────────────────────── */
body {
  margin: 0;
  font-family: "Microsoft YaHei", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  background: var(--bud-bg);
  color: var(--bud-text);
  line-height: 1.6;
}

a { color: var(--bud-primary); text-decoration: none; }
a:hover { color: var(--bud-primary-lt); text-decoration: underline; }

img { max-width: 100%; height: auto; display: block; }

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ══════════════════════════════════════════════════
   导航栏  ——  7 项图标 + 文字，严格对齐，无空 <li>
   ══════════════════════════════════════════════════ */
.buddy-nav {
  background: var(--bud-nav-bg);
  border-bottom: 2px solid var(--bud-primary);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.buddy-nav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  gap: 0;
}

/* Logo */
.buddy-nav__logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--bud-nav-text);
  text-decoration: none;
  flex: 0 0 auto;
  white-space: nowrap;
}

.buddy-nav__logo img {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

/* 菜单列表 */
.buddy-nav__menu {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: stretch;   /* 让所有 li 等高 */
  height: 56px;           /* 与 .container 高度一致 */
  gap: 0;
}

/* 每一项 li：消除空隙来源 */
.buddy-nav__menu li {
  display: flex;
  align-items: stretch;
  margin: 0;
  padding: 0;
}

/* 链接：图标在上，文字在下，垂直居中 */
.buddy-nav__menu li a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 0 11px;
  color: var(--bud-nav-text);
  font-size: 0.70rem;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color 0.18s, background 0.18s, border-color 0.18s;
}

/* 图标 */
.buddy-nav__menu li a img {
  width: 20px;
  height: 20px;
  object-fit: contain;
  flex: 0 0 20px;
  display: block;
  /* 图片加载失败时不占高度 */
}

/* 图标加载失败降级：隐藏 broken image */
.buddy-nav__menu li a img[src=""],
.buddy-nav__menu li a img:not([src]) {
  display: none;
}

/* 悬停 */
.buddy-nav__menu li a:hover {
  color: #ffffff;
  background: rgba(255,255,255,0.07);
  text-decoration: none;
  border-bottom-color: rgba(255,255,255,0.25);
}

/* 当前页高亮 */
.buddy-nav__menu li a.active,
.buddy-nav__menu li a[aria-current="page"] {
  color: var(--bud-accent);
  border-bottom-color: var(--bud-accent);
}

/* ── 公告栏 ────────────────────────────────────────── */
.buddy-notice-bar {
  background: var(--bud-accent);
  color: #1a0f00;
  font-size: 0.82rem;
  font-weight: 600;
  text-align: center;
  padding: 7px 16px;
}

.buddy-notice-bar a {
  color: var(--bud-primary-dk);
  font-weight: 700;
  text-decoration: underline;
}

/* ── Hero 区 ────────────────────────────────────────── */
.buddy-hero {
  background: var(--bud-nav-bg);
  padding: 56px 0 44px;
  position: relative;
  overflow: hidden;
}

.buddy-hero__inner {
  display: flex;
  align-items: center;
  gap: 48px;
}

.buddy-hero__copy {
  flex: 1;
  min-width: 0;
  z-index: 2;
}

.buddy-hero__title {
  font-size: 2.5rem;
  font-weight: 900;
  color: #ffffff;
  line-height: 1.2;
  margin: 0 0 16px;
  text-shadow: 0 2px 10px rgba(0,0,0,0.55);
}

.buddy-hero__subtitle {
  font-size: 1.05rem;
  color: var(--bud-nav-text);
  margin: 0 0 26px;
  opacity: 0.92;
  line-height: 1.65;
}

.buddy-hero__badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.buddy-hero__badge {
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.22);
  color: #fff;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.78rem;
}

.buddy-hero__cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bud-btn);
  color: var(--bud-btn-text);
  padding: 13px 28px;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: 700;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: opacity 0.18s, transform 0.18s;
}

.buddy-hero__cta:hover {
  opacity: 0.87;
  transform: translateY(-1px);
  text-decoration: none;
  color: var(--bud-btn-text);
}

/* 右侧产品图：强制可见 450×450 */
.buddy-hero__img-wrap {
  flex: 0 0 450px;
  width: 450px;
  height: 450px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  /* 强制 opacity:1，覆盖任何 Revolution/jQuery 动画残留 */
  opacity: 1 !important;
  visibility: visible !important;
}

.buddy-hero__img-wrap img {
  width: 450px;
  height: 450px;
  object-fit: contain;
  display: block;
  opacity: 1 !important;
  visibility: visible !important;
}

/* ── 区块通用 ─────────────────────────────────────── */
.buddy-section {
  padding: 60px 0;
}

.buddy-section--alt {
  background: var(--bud-bg-alt);
}

.buddy-section__title {
  text-align: center;
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--bud-primary);
  margin: 0 0 8px;
}

.buddy-section__sub {
  text-align: center;
  color: var(--bud-text-muted);
  margin: 0 0 40px;
  font-size: 0.95rem;
}

.buddy-divider {
  width: 56px;
  height: 3px;
  background: var(--bud-primary);
  margin: 10px auto 32px;
  border-radius: 2px;
}

/* ── 特性卡片网格 ─────────────────────────────────── */
.buddy-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-top: 8px;
}

.buddy-feature-card {
  background: var(--bud-bg);
  border: 1px solid var(--bud-border);
  border-radius: 8px;
  padding: 24px 20px;
  text-align: center;
  transition: box-shadow 0.2s, transform 0.2s;
}

.buddy-feature-card:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,0.09);
  transform: translateY(-2px);
}

.buddy-feature-card__icon {
  font-size: 1.8rem;
  margin-bottom: 10px;
  line-height: 1;
}

.buddy-feature-card__title {
  font-size: 0.97rem;
  font-weight: 700;
  color: var(--bud-primary);
  margin-bottom: 8px;
}

.buddy-feature-card__desc {
  font-size: 0.83rem;
  color: var(--bud-text-muted);
  line-height: 1.6;
}

/* 蓝站：WoW 金边 */
[data-theme="blue"] .buddy-feature-card {
  border-color: rgba(212,169,74,0.35);
  box-shadow: inset 0 0 0 1px rgba(212,169,74,0.10);
}
[data-theme="blue"] .buddy-feature-card:hover {
  box-shadow: 0 4px 20px rgba(61,126,200,0.18),
              inset 0 0 0 1px rgba(212,169,74,0.28);
}

/* 蓝站 Hero 渐变背景 */
[data-theme="blue"] .buddy-hero {
  background: linear-gradient(135deg, #0d1f3c 0%, #0e2d5a 60%, #0d1f3c 100%);
  border-bottom: 2px solid #d4a94a;
}

/* 橙站 Hero 渐变背景 */
[data-theme="orange"] .buddy-hero {
  background: linear-gradient(135deg, #2a1506 0%, #4a2e10 100%);
}

/* ── 截图画廊 ─────────────────────────────────────── */
.buddy-screenshots {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.buddy-screenshots img {
  width: 100%;
  border-radius: 6px;
  border: 1px solid var(--bud-border);
}

/* ══════════════════════════════════════════════════
   互链站群区  .buddy-site-links-wrap
   table 结构保持不变；CSS 层面覆盖为 flex 布局，
   统一图片容器尺寸，消除行高不齐 / 图文对位混乱
   ══════════════════════════════════════════════════ */
.buddy-site-links-wrap {
  margin: 28px 0 8px;
  padding: 20px 12px 16px;
  background: var(--bud-bg-alt);
  border: 1px solid var(--bud-border);
  border-radius: 8px;
}

.buddy-site-links-title {
  text-align: center;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--bud-text-muted);
  letter-spacing: 0.04em;
  margin: 0 0 14px;
}

/* 把原 table 变成 flex 换行网格 */
table.buddy-site-links,
table.buddy-site-links tbody {
  display: block;
  width: 100%;
}

table.buddy-site-links tr {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-bottom: 6px;
}

table.buddy-site-links tr:last-child {
  margin-bottom: 0;
}

/* 每个单元格统一宽度，不再依赖 td[height] / td[colspan] */
table.buddy-site-links td {
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  width: 88px;
  min-height: 80px;
  padding: 8px 4px 6px;
  border-radius: 6px;
  background: var(--bud-bg);
  border: 1px solid var(--bud-border);
  transition: box-shadow 0.18s, border-color 0.18s;
  /* 最后一行的提示 td 铺满 */
  vertical-align: middle;
}

table.buddy-site-links td[colspan] {
  width: auto;
  flex: 1 1 100%;
  background: transparent;
  border: none;
  min-height: auto;
  padding: 6px 0 0;
}

table.buddy-site-links td:not([colspan]):hover {
  box-shadow: 0 3px 12px rgba(0,0,0,0.10);
  border-color: var(--bud-primary-lt);
}

/* 链接：块级，图文垂直居中 */
table.buddy-site-links td a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  text-decoration: none;
  color: var(--bud-text);
  width: 100%;
  height: 100%;
}

table.buddy-site-links td a:hover {
  text-decoration: none;
  color: var(--bud-primary);
}

/* 统一图片容器：固定 48×48，覆盖 logo100/logo120/turbohud 等不一致属性 */
table.buddy-site-links td a img {
  display: block !important;
  width: 48px !important;
  height: 48px !important;
  max-width: 48px !important;
  max-height: 48px !important;
  min-width: 48px !important;
  min-height: 48px !important;
  object-fit: contain !important;
  flex: 0 0 48px !important;
  /* 覆盖全局 img { height: auto } */
  aspect-ratio: 1 / 1;
}

table.buddy-site-links td a img[src=""],
table.buddy-site-links td a img:not([src]) {
  display: none !important;
}

/* 隐藏图片和文字之间多余的 <br> 换行 */
table.buddy-site-links td a br {
  display: none !important;
}

/* 文字标签 */
table.buddy-site-links td a strong {
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
  color: inherit;
  white-space: nowrap;
}

/* 当前站高亮：is-current-site 由 buddy-site-nav.js 注入 */
table.buddy-site-links td a.is-current-site {
  color: var(--bud-primary);
}

table.buddy-site-links td a.is-current-site strong {
  color: var(--bud-primary);
}

table.buddy-site-links td:has(a.is-current-site) {
  border-color: var(--bud-primary);
  background: color-mix(in srgb, var(--bud-primary) 6%, var(--bud-bg));
}

/* 提示文字 */
.buddy-site-links-hint {
  display: block;
  text-align: center;
  font-size: 0.72rem;
  color: var(--bud-text-muted);
  line-height: 1.5;
}

/* 响应式：小屏下每格略窄 */
@media (max-width: 600px) {
  table.buddy-site-links td:not([colspan]) {
    width: 72px;
    min-height: 72px;
    padding: 6px 2px 4px;
  }

  table.buddy-site-links td a img {
    width: 36px !important;
    height: 36px !important;
    flex: 0 0 36px;
  }

  table.buddy-site-links td a strong {
    font-size: 0.65rem;
  }

  .buddy-site-links-wrap {
    padding: 14px 6px 12px;
  }
}

/* ── 页脚 ─────────────────────────────────────────── */
.buddy-footer {
  background: var(--bud-nav-bg);
  color: var(--bud-nav-text);
  padding: 40px 0 20px;
  font-size: 0.85rem;
}

.buddy-footer__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 32px;
  margin-bottom: 28px;
}

.buddy-footer__col h4 {
  color: #fff;
  margin: 0 0 12px;
  font-size: 0.88rem;
  font-weight: 700;
}

.buddy-footer__col ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.buddy-footer__col ul li {
  margin-bottom: 6px;
}

.buddy-footer__col ul li a {
  color: var(--bud-nav-text);
  text-decoration: none;
  font-size: 0.80rem;
  transition: color 0.15s;
}

.buddy-footer__col ul li a:hover {
  color: #fff;
}

.buddy-footer__bottom {
  border-top: 1px solid rgba(255,255,255,0.10);
  padding-top: 16px;
  text-align: center;
  color: rgba(255,255,255,0.42);
  font-size: 0.76rem;
}

/* ══════════════════════════════════════════════════
   响应式
   ══════════════════════════════════════════════════ */
@media (max-width: 960px) {
  .buddy-hero__img-wrap {
    flex: 0 0 340px;
    width: 340px;
    height: 340px;
  }
  .buddy-hero__img-wrap img {
    width: 340px;
    height: 340px;
  }
}

@media (max-width: 768px) {
  /* 导航：logo 缩小，菜单项压缩 */
  .buddy-nav .container {
    height: auto;
    flex-wrap: wrap;
    padding: 0 10px;
    gap: 0;
  }

  .buddy-nav__logo {
    height: 48px;
    font-size: 1rem;
  }

  .buddy-nav__menu {
    width: 100%;
    height: auto;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
    border-top: 1px solid rgba(255,255,255,0.07);
  }

  .buddy-nav__menu::-webkit-scrollbar { display: none; }

  .buddy-nav__menu li a {
    padding: 6px 9px;
    font-size: 0.62rem;
    gap: 2px;
  }

  .buddy-nav__menu li a img {
    width: 16px;
    height: 16px;
  }

  /* Hero */
  .buddy-hero__inner {
    flex-direction: column-reverse;
    text-align: center;
    gap: 24px;
  }

  .buddy-hero__img-wrap {
    flex: none;
    width: 240px;
    height: 240px;
  }

  .buddy-hero__img-wrap img {
    width: 240px;
    height: 240px;
  }

  .buddy-hero__title { font-size: 1.7rem; }

  .buddy-hero__badges {
    justify-content: center;
  }
}
