/* ============================================================
   吃糖心線上看站点共享样式
   颜色通过 CSS 变量控制（每个站点由 theme.css 覆盖）
   卡片为横版新闻式，详情页为文章式
   ============================================================ */

/* ---------- 基础重置 ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --brand: #4a6670;
  --brand-deep: #2f4a52;
  --brand-soft: #8fa8a0;
  --accent: #b8895c;
  --bg: #f6f4ee;
  --surface: #ffffff;
  --text: #2a3033;
  --text-muted: #66747a;
  --nav-text: #ffffff;
  --footer-bg: #26363c;
  --footer-text: #dbe4e6;
  --border: #e6e2d8;
  --shadow: 0 4px 18px rgba(0, 0, 0, .08);
  --radius: 12px;
  --card-ratio: 16 / 9;
  --maxw: 1200px;
  --header-h: 68px;
  --brand-mark-radius: 9px;
}

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "Noto Sans SC", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: 15px;
}

img { max-width: 100%; display: block; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; cursor: pointer; }
ul { list-style: none; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* 无障碍：跳转链接 */
.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--brand-deep); color: #fff; padding: 10px 16px; z-index: 2000; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- 头部（实色背景，与页脚风格统一） ---------- */
.site-header {
  position: sticky; top: 0; z-index: 1000;
  background: var(--brand-deep);
  color: var(--nav-text);
  box-shadow: 0 2px 12px rgba(0, 0, 0, .18);
}
.header-inner { display: flex; align-items: center; gap: 20px; min-height: var(--header-h); }
.brand { display: flex; align-items: center; flex-shrink: 0; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 34px; height: 34px; border-radius: var(--brand-mark-radius); margin-right: 10px;
  background: linear-gradient(135deg, var(--brand-soft), var(--brand));
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700; color: #fff;
}
.brand-name {
  font-size: 20px; font-weight: 800; letter-spacing: .5px;
  color: var(--nav-text); white-space: nowrap;
}

.main-nav { display: flex; align-items: center; flex: 1; }
.nav-toggle { display: none; background: none; border: 0; padding: 8px; color: var(--nav-text); }
.hamburger, .hamburger::before, .hamburger::after {
  display: block; width: 22px; height: 2px; background: var(--nav-text); border-radius: 2px; transition: .25s;
}
.hamburger { position: relative; }
.hamburger::before, .hamburger::after { content: ""; position: absolute; left: 0; }
.hamburger::before { top: -7px; }
.hamburger::after { top: 7px; }
.nav-toggle.open .hamburger { background: transparent; }
.nav-toggle.open .hamburger::before { top: 0; transform: rotate(45deg); }
.nav-toggle.open .hamburger::after { top: 0; transform: rotate(-45deg); }

.nav-menu { display: flex; gap: 4px; }
.nav-menu a {
  display: block; padding: 10px 14px; color: var(--nav-text);
  font-weight: 600; font-size: 15px; border-radius: 8px; transition: background .2s, color .2s;
}
.nav-menu a:hover { background: rgba(255, 255, 255, .14); text-decoration: none; }
.nav-menu a.active, .nav-menu a[aria-current="page"] {
  background: rgba(255, 255, 255, .22); color: #fff;
}

.search-form { display: flex; margin-left: auto; flex-shrink: 0; }
.search-form input {
  border: 1px solid rgba(255, 255, 255, .35); background: rgba(255, 255, 255, .14);
  color: #fff; padding: 8px 12px; border-radius: 8px 0 0 8px; width: 170px; font-size: 14px;
}
.search-form input::placeholder { color: rgba(255, 255, 255, .65); }
.search-form input:focus { outline: none; background: rgba(255, 255, 255, .25); border-color: #fff; }
.search-btn {
  border: 0; background: var(--accent); color: #fff; padding: 8px 16px;
  border-radius: 0 8px 8px 0; font-weight: 700; font-size: 14px;
}
.search-btn:hover { filter: brightness(1.08); }

/* ---------- 面包屑 ---------- */
.breadcrumb { padding: 16px 0 0; font-size: 14px; color: var(--text-muted); }
.breadcrumb ol { display: flex; flex-wrap: wrap; gap: 6px; }
.breadcrumb li + li::before { content: "›"; margin-right: 6px; color: var(--text-muted); }
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--brand); }
.breadcrumb .crumb-current { color: var(--text); }

/* ---------- 页面标题区 ---------- */
.page-head { padding: 24px 0 12px; }
.page-head h2 { font-size: 28px; font-weight: 800; letter-spacing: .5px; }
.page-head .page-sub { color: var(--text-muted); margin-top: 6px; }

/* ---------- 首屏轮播 ---------- */
.hero { margin-top: 20px; margin-bottom: 8px; }
.carousel { position: relative; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); background: var(--brand-deep); }
.slides { position: relative; height: 380px; }
.slide { position: absolute; inset: 0; opacity: 0; transition: opacity .6s ease; }
.slide.active { opacity: 1; }
.slide img { width: 100%; height: 100%; object-fit: cover; }
.slide-caption {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 56px 28px 24px;
  background: linear-gradient(transparent, rgba(0, 0, 0, .72)); color: #fff;
}
.slide-caption h3 { font-size: 24px; font-weight: 800; }
.slide-caption p { margin-top: 4px; color: rgba(255, 255, 255, .9); }
.carousel-btn {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 5;
  width: 40px; height: 40px; border-radius: 50%; border: 0;
  background: rgba(0, 0, 0, .4); color: #fff; font-size: 20px; line-height: 1;
  transition: background .2s;
}
.carousel-btn:hover { background: rgba(0, 0, 0, .65); }
.carousel-btn.prev { left: 14px; }
.carousel-btn.next { right: 14px; }
.dots { position: absolute; bottom: 12px; right: 20px; display: flex; gap: 6px; z-index: 5; }
.dot { width: 10px; height: 10px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .5); padding: 0; }
.dot.active { background: var(--accent); }

/* ---------- 区块 ---------- */
.section { padding: 26px 0 8px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 16px; }
.section-head h2 { font-size: 22px; font-weight: 800; }
.section-head .more { font-size: 14px; color: var(--text-muted); }
.section-head .more:hover { color: var(--brand); }

/* ---------- 卡片网格（横版新闻式） ---------- */
.card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.card { background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); transition: transform .25s ease, box-shadow .25s ease; }
.card:hover { transform: translateY(-5px); box-shadow: 0 10px 26px rgba(0, 0, 0, .14); }
.card-link { display: block; color: var(--text); }
.card-link:hover { text-decoration: none; }
.card-cover { position: relative; aspect-ratio: var(--card-ratio); background: var(--border); }
.card-cover img { width: 100%; height: 100%; object-fit: cover; }
.card-badge {
  position: absolute; left: 10px; top: 10px; background: rgba(0, 0, 0, .62); color: #fff;
  font-size: 12px; padding: 3px 10px; border-radius: 999px;
}
.card-body { padding: 14px 14px 16px; }
.card-title {
  font-size: 16px; font-weight: 700; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.9em;
}
.card-desc {
  font-size: 13px; color: var(--text-muted); margin-top: 8px; line-height: 1.6;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-meta { font-size: 12px; color: var(--text-muted); margin-top: 10px; opacity: .85; }

/* ---------- 榜单（带排名） ---------- */
.rank-list { display: grid; gap: 12px; }
.rank-item {
  display: flex; align-items: center; gap: 16px; background: var(--surface);
  border-radius: var(--radius); padding: 12px 16px; box-shadow: var(--shadow); transition: transform .2s;
}
.rank-item:hover { transform: translateX(4px); }
.rank-num {
  font-size: 26px; font-weight: 800; font-style: italic; min-width: 40px; text-align: center;
  color: var(--text-muted);
}
.rank-item:nth-child(1) .rank-num, .rank-item:nth-child(2) .rank-num, .rank-item:nth-child(3) .rank-num { color: var(--accent); }
.rank-cover { width: 96px; height: 54px; border-radius: 8px; object-fit: cover; flex-shrink: 0; }
.rank-info { flex: 1; min-width: 0; }
.rank-title { font-weight: 700; font-size: 16px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rank-meta { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* ---------- 分类 chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }
.chip {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: 7px 16px; border-radius: 999px; font-size: 14px; transition: all .2s;
}
.chip:hover { border-color: var(--brand); color: var(--brand); }
.chip.active, .chip[aria-pressed="true"] { background: var(--brand-deep); color: #fff; border-color: var(--brand-deep); }

/* ---------- 下载 APP 引导 ---------- */
.app-guide {
  margin: 34px 0; padding: 30px; border-radius: var(--radius);
  background: linear-gradient(120deg, var(--brand-deep), var(--brand));
  color: #fff; display: flex; align-items: center; gap: 26px; flex-wrap: wrap;
}
.app-guide h2 { font-size: 24px; font-weight: 800; }
.app-guide p { margin-top: 6px; color: rgba(255, 255, 255, .88); max-width: 560px; }
.app-guide .app-actions { display: flex; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.qr {
  width: 96px; height: 96px; flex-shrink: 0; border-radius: 10px; background: #fff; padding: 8px;
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 3px;
}
.qr span { background: var(--footer-bg); border-radius: 2px; }
.qr span.blank { background: transparent; }

/* ---------- 按钮 ---------- */
.btn { display: inline-block; padding: 10px 22px; border-radius: 8px; font-weight: 700; font-size: 15px; border: 0; transition: transform .15s, filter .15s; }
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-ghost { background: transparent; color: #fff; border: 1px solid rgba(255, 255, 255, .7); }
.btn-ghost:hover { background: rgba(255, 255, 255, .12); }

/* ---------- 详情页（新闻文章式） ---------- */
.detail { background: var(--surface); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); }
.detail-head { border-bottom: 1px solid var(--border); padding-bottom: 18px; margin-bottom: 20px; }
.meta-pill { background: var(--brand-soft); color: #fff; padding: 2px 12px; border-radius: 999px; font-size: 13px; display: inline-block; }
.detail-title { font-size: 28px; font-weight: 800; line-height: 1.4; margin: 12px 0; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 16px; color: var(--text-muted); font-size: 14px; }
.detail-hero { border-radius: var(--radius); overflow: hidden; margin-bottom: 22px; }
.detail-hero img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.detail-lead {
  font-size: 17px; font-weight: 600; color: var(--brand-deep); line-height: 1.8;
  border-left: 4px solid var(--accent); padding-left: 16px; margin-bottom: 18px;
}
.detail-body p { font-size: 15.5px; line-height: 1.9; color: var(--text); margin-bottom: 16px; text-indent: 2em; }
.detail-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.tag { border: 1px solid var(--border); color: var(--text-muted); padding: 3px 12px; border-radius: 999px; font-size: 13px; }
.detail-section { margin-top: 28px; }
.detail-section h3 { font-size: 18px; font-weight: 800; margin-bottom: 14px; }

/* ---------- 个人中心 ---------- */
.profile { display: flex; align-items: center; gap: 18px; background: var(--surface); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); margin-bottom: 20px; }
.avatar { width: 72px; height: 72px; border-radius: 50%; background: linear-gradient(135deg, var(--brand-soft), var(--brand)); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 28px; font-weight: 800; flex-shrink: 0; }
.profile-info h2 { font-size: 20px; font-weight: 800; }
.profile-info p { color: var(--text-muted); font-size: 14px; margin-top: 4px; }
.tabs { display: flex; gap: 8px; margin: 20px 0; border-bottom: 2px solid var(--border); }
.tab { border: 0; background: none; padding: 10px 18px; font-size: 15px; font-weight: 700; color: var(--text-muted); border-bottom: 3px solid transparent; margin-bottom: -2px; }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ---------- 关于/密度区（首页） ---------- */
.about { background: var(--surface); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow); }
.about h2 { font-size: 20px; font-weight: 800; margin-bottom: 12px; }
.about p { color: var(--text-muted); margin-bottom: 10px; }
.about p strong { color: var(--brand); }

/* ---------- 页脚 ---------- */
.site-footer { margin-top: 40px; background: var(--footer-bg); color: var(--footer-text); }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 28px; padding: 40px 0 24px; }
.footer-brand .footer-site-name { font-size: 22px; font-weight: 800; color: #fff; white-space: nowrap; }
.footer-brand .footer-site-title { font-size: 14px; color: var(--footer-text); margin-top: 8px; }
.footer-brand p.desc { font-size: 13px; color: var(--footer-text); margin-top: 12px; max-width: 300px; }
.footer-col h3 { color: #fff; font-size: 15px; font-weight: 700; margin-bottom: 12px; }
.footer-col li { margin-bottom: 8px; font-size: 14px; }
.footer-col a { color: var(--footer-text); }
.footer-col a:hover { color: #fff; text-decoration: underline; }
.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, .14); padding: 18px 0 26px;
  font-size: 13px; color: var(--footer-text); display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between;
}

/* ---------- 渐显动画 ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ---------- 响应式 ---------- */
@media (max-width: 960px) {
  .card-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .slides { height: 300px; }
}

@media (max-width: 720px) {
  .nav-toggle { display: block; }
  .main-nav { flex: 0 0 auto; }
  .nav-menu {
    position: absolute; top: var(--header-h); left: 0; right: 0;
    background: var(--brand-deep); flex-direction: column; padding: 8px 16px 16px;
    display: none; box-shadow: 0 12px 20px rgba(0, 0, 0, .2);
  }
  .nav-menu.open { display: flex; }
  .nav-menu a { padding: 12px 10px; }
  .search-form { margin-left: 0; }
  .search-form input { width: 120px; }
  .card-grid { grid-template-columns: 1fr; gap: 14px; }
  .slides { height: 220px; }
  .slide-caption h3 { font-size: 18px; }
  .footer-grid { grid-template-columns: 1fr; gap: 20px; }
  .app-guide { flex-direction: column; align-items: flex-start; }
  .rank-item { gap: 12px; padding: 10px 12px; }
  .rank-cover { width: 84px; height: 48px; }
  .detail { padding: 18px; }
  .detail-title { font-size: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
