/* 海角社区信息站 — 全局样式（复刻自源站浅色论坛版式） */
:root {
  --bg: #f8f8f8;
  --surface: #ffffff;
  --surface-2: #f2f2f2;
  --ink: #333333;
  --ink-2: #666666;
  --ink-3: #888888;
  --line: #e6e6e6;
  --line-2: #c7c7c7;
  --link: #2965b1;
  --title-ink: #0b4793;
  --hot: #d70000;
  --sea: #44749c;
  --sea-deep: #2f5a80;
  --sea-line: #6699cc;
  --sea-wash: #eaf3fb;
  --sea-ink: #ffffff;
  --gold: #ffeb3b;
  --pink-bg: #fff4f4;
  --pink-line: #ec8181;
  --rank-front: #c2452c;
  --cta-bg: #16405f;
  --cta-deep: #0e2f47;
  --cta-ink: #ffffff;
  --seal: #e0492e;
  --wave: #7fb3d5;
  --shadow-card: 0 1px 2px rgba(17, 38, 58, 0.06);
  --shadow-cta: 0 10px 24px rgba(10, 30, 48, 0.28);
  --ease-out: cubic-bezier(0.2, 0.7, 0.3, 1);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.7;
  padding-bottom: 112px;
}

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--hot); text-decoration: underline; }

a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 3px solid var(--link);
  outline-offset: 2px;
}

h1 { font-size: 26px; line-height: 1.3; color: var(--title-ink); }
h2 { font-size: 21px; line-height: 1.35; color: var(--title-ink); }
h3 { font-size: 18px; line-height: 1.4; color: var(--title-ink); }

p, li, dd, dt { overflow-wrap: break-word; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- 顶栏 ---------- */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1008;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1130px;
  margin: 0 auto;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 56px;
}
.brand img { display: block; width: 87px; height: 40px; }
.topbar-label { color: var(--ink-2); font-size: 15px; }
.topbar-divider { width: 1px; height: 15px; background: var(--line-2); }
.topbar-search { flex: 1 1 auto; max-width: 320px; }
.search-input {
  width: 100%;
  height: 32px;
  border: 1px solid var(--line-2);
  border-radius: 4px;
  padding: 0 10px;
  font-size: 15px;
  color: var(--ink);
  background: var(--surface);
}
.search-input::placeholder { color: var(--ink-3); }
.topbar-auth { margin-left: auto; display: flex; gap: 8px; }
.btn-sea {
  display: inline-block;
  background: var(--sea);
  color: var(--sea-ink);
  font-size: 14px;
  line-height: 1;
  padding: 8px 14px;
  border-radius: 4px;
}
.btn-sea:hover { background: var(--sea-deep); color: var(--sea-ink); text-decoration: none; }
.btn-ghost {
  display: inline-block;
  border: 1px solid var(--line-2);
  color: var(--ink);
  font-size: 14px;
  line-height: 1;
  padding: 8px 14px;
  border-radius: 4px;
  background: var(--surface);
}
.btn-ghost:hover { color: var(--link); border-color: var(--sea-line); text-decoration: none; }

/* ---------- 三栏骨架 ---------- */
.page-inner {
  max-width: 1130px;
  margin: 0 auto;
  padding: 72px 16px 0;
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) 208px;
  gap: 20px;
  align-items: start;
}

/* 左侧海蓝色导航栏 */
.rail {
  position: sticky;
  top: 72px;
  background: var(--sea);
  color: var(--sea-ink);
  border-radius: 4px;
  padding: 12px 0 16px;
}
.rail-list { list-style: none; }
.rail-list a {
  display: block;
  color: var(--sea-ink);
  font-size: 15px;
  padding: 7px 16px;
}
.rail-list a:hover { background: var(--sea-deep); color: var(--gold); text-decoration: none; }
.rail-list a[aria-current="page"] { background: var(--sea-deep); color: var(--gold); }
.rail-group-title {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--gold);
  font-size: 14px;
  font-weight: 600;
  padding: 14px 16px 4px;
}
.rail-group-title::before, .rail-group-title::after {
  content: "";
  flex: 1;
  border-bottom: 1px dashed var(--gold);
}

/* ---------- 主列 ---------- */
.feed { min-width: 0; }
.page-head { padding: 18px 0 6px; }
.lede { color: var(--ink); padding: 8px 0 4px; }
.section { padding: 18px 0 6px; }
.section h2 { margin-bottom: 8px; }
.section p { margin-bottom: 10px; }
.section ul, .section ol { padding-left: 22px; margin-bottom: 10px; }
.section li { margin-bottom: 6px; }
.section dl { margin: 6px 0 12px; }
.section dt { font-weight: 700; color: var(--title-ink); margin-top: 10px; }
.section dd { margin-left: 0; color: var(--ink-2); }
.more-link { display: inline-block; margin: 2px 0 10px; }

/* 横幅 */
.banner-wrap { position: relative; padding: 16px 0 10px; }
.banner-wrap img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 4px;
  box-shadow: var(--shadow-card);
}
.banner-dots {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 20px;
  display: flex;
  justify-content: center;
  gap: 7px;
}
.banner-dots i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--sea-ink);
  opacity: 0.55;
}
.banner-dots i.on { opacity: 1; background: var(--sea-line); }

/* 栏目卡列表（复刻帖子卡版式） */
.news-list { margin: 12px 0 6px; }
.news-card {
  background: var(--surface);
  border-radius: 4px;
  border-bottom: 1px solid var(--line);
  padding: 18px 12px 14px;
}
.news-card:hover { background: var(--surface-2); }
.news-card h3 { margin-bottom: 8px; }
.news-card h3 a { color: var(--title-ink); }
.news-card h3 a:hover { color: var(--hot); }
.news-card .note { color: var(--ink-2); margin-bottom: 10px; }
.card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--ink-3);
  font-size: 14px;
}
.tag {
  display: inline-block;
  border: 1px solid var(--sea-line);
  border-radius: 4px;
  color: var(--link);
  font-size: 12px;
  padding: 2px 6px;
}
.card-meta a { font-size: 14px; }

/* 信息流 tab 条（复刻源站样式） */
.feed-tabs {
  display: flex;
  border-top: 2px solid var(--sea-line);
  margin-top: 14px;
  overflow-x: auto;
}
.feed-tabs .tab {
  flex: 1 0 auto;
  min-width: 64px;
  height: 40px;
  line-height: 38px;
  text-align: center;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 15px;
  border: 0;
  cursor: pointer;
  padding: 0 12px;
}
.feed-tabs .tab:hover { color: var(--sea-line); }
.feed-tabs .tab.is-on { background: var(--surface); color: var(--ink); font-weight: 600; }
.shuffle-btn {
  border: 0;
  background: none;
  color: var(--link);
  cursor: pointer;
  font-size: 14px;
  padding: 6px 0;
}
.shuffle-btn:hover { color: var(--hot); text-decoration: underline; }
.list-toolbar { display: flex; justify-content: flex-end; padding: 8px 2px 0; }

.search-empty { color: var(--ink-2); padding: 14px 2px; }

/* 排行榜 tab 组（复刻源站样式） */
.rank-tabs { display: flex; margin: 8px 0 12px; }
.rank-tabs .rtab {
  flex: 1;
  color: var(--ink-2);
  font-size: 14px;
  height: 30px;
  text-align: center;
  border: 1px solid var(--line);
  background: var(--surface);
  cursor: pointer;
  padding: 0;
}
.rank-tabs .rtab:first-child { border-radius: 4px 0 0 4px; }
.rank-tabs .rtab:last-child { border-radius: 0 4px 4px 0; }
.rank-tabs .rtab.is-on { background: var(--sea); border-color: var(--sea); color: var(--sea-ink); }
.rank-pane[hidden] { display: none; }

/* 名次条目（说明型，无虚构数据） */
.rank-demo { list-style: none; margin: 4px 0 10px; }
.rank-demo li { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
.rank-no {
  flex: 0 0 auto;
  width: 22px;
  height: 20px;
  line-height: 20px;
  text-align: center;
  font-size: 13px;
  color: var(--ink-3);
}
.rank-no.front { background: var(--rank-front); color: var(--sea-ink); border-radius: 0 11px 11px 0; }

/* 提示卡 */
.callout {
  background: var(--pink-bg);
  border: 1px dashed var(--pink-line);
  border-radius: 4px;
  padding: 12px 14px;
  margin: 10px 0 14px;
}
.callout p { margin: 0; }

/* FAQ 问答 */
.faq-list dt { font-weight: 700; color: var(--title-ink); margin-top: 14px; }
.faq-list dd { margin: 4px 0 0; color: var(--ink); }

/* ---------- 右栏 ---------- */
.side { min-width: 0; }
.side-card {
  background: var(--surface);
  border-radius: 4px;
  border: 1px solid var(--line);
  padding: 14px;
  margin-bottom: 12px;
}
.side-card h2 { font-size: 16px; margin-bottom: 8px; }
.side-card ul { list-style: none; }
.side-card li { margin-bottom: 6px; font-size: 15px; }
.side-card p { color: var(--ink-2); font-size: 15px; }
.side-card .side-link { display: inline-block; margin-top: 6px; font-size: 14px; }

/* ---------- 页脚 ---------- */
.foot {
  background: var(--surface);
  border-top: 1px solid var(--line);
  margin-top: 26px;
}
.foot-inner {
  max-width: 1130px;
  margin: 0 auto;
  padding: 18px 16px 22px;
}
.foot-brand {
  font-size: 17px;
  font-weight: 700;
  color: var(--title-ink);
}
.foot-brand:hover { color: var(--hot); }
.foot-nav { margin: 8px 0 6px; display: flex; flex-wrap: wrap; gap: 6px 16px; }
.foot-nav a { font-size: 14px; }
.foot-note { color: var(--ink-3); font-size: 14px; }

/* ---------- 寻芳悬浮 CTA ---------- */
.site-cta {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  width: min(520px, calc(100vw - 32px));
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, var(--cta-bg) 0%, var(--cta-deep) 100%);
  color: var(--cta-ink);
  font-size: 17px;
  font-weight: 600;
  border-radius: 10px;
  box-shadow: var(--shadow-cta);
  z-index: 1200;
  overflow: hidden;
  padding: 0 46px;
  text-align: center;
}
.site-cta:hover { color: var(--cta-ink); text-decoration: none; filter: brightness(1.1); }
.site-cta:active { transform: translateX(-50%) translateY(1px); }
.site-cta::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, rgba(127, 179, 213, 0), var(--wave) 18%, var(--wave) 82%, rgba(127, 179, 213, 0));
  border-radius: 0 0 3px 3px;
  transform: scaleX(0);
  transform-origin: left center;
  animation: cta-wave-draw 2.8s var(--ease-out) infinite;
}
.site-cta::after {
  content: "";
  position: absolute;
  right: 16px;
  top: 50%;
  width: 10px;
  height: 10px;
  margin-top: -5px;
  border-radius: 50%;
  background: var(--seal);
  opacity: 0;
  animation: cta-seal-press 3.4s var(--ease-out) infinite;
}
@keyframes cta-wave-draw {
  0% { transform: scaleX(0); opacity: 1; }
  16% { transform: scaleX(1); opacity: 1; }
  74% { transform: scaleX(1); opacity: 1; }
  88% { transform: scaleX(1); opacity: 0; }
  100% { transform: scaleX(0); opacity: 0; }
}
@keyframes cta-seal-press {
  0% { opacity: 0; transform: scale(1); }
  10% { opacity: 0.9; transform: scale(1); }
  26% { opacity: 0.9; transform: scale(1.14); }
  40% { opacity: 0; transform: scale(1.14); }
  100% { opacity: 0; transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .site-cta::before { animation: none; transform: scaleX(1); }
  .site-cta::after { animation: none; opacity: 0.85; transform: scale(1); }
}

/* ---------- 断点 ---------- */
@media (max-width: 1023px) {
  .page-inner { grid-template-columns: minmax(0, 1fr) 200px; }
  .rail {
    position: static;
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px 4px;
    padding: 8px 10px;
    overflow-x: auto;
  }
  .rail-list { display: flex; flex-wrap: wrap; }
  .rail-list a { padding: 6px 10px; border-radius: 4px; }
  .rail-group-title { padding: 6px 10px; }
  .rail-group-title::before, .rail-group-title::after { min-width: 14px; }
}

@media (max-width: 720px) {
  body { padding-bottom: calc(116px + env(safe-area-inset-bottom)); }
  .topbar-inner { flex-wrap: wrap; gap: 8px; padding: 8px 12px; }
  .topbar-search { order: 3; flex-basis: 100%; max-width: none; }
  .page-inner { grid-template-columns: minmax(0, 1fr); padding-top: 84px; }
  .rail { grid-column: 1; }
  .feed-tabs .tab { min-width: 58px; font-size: 14px; }
  .card-meta { font-size: 13px; }
  .site-cta {
    left: 12px;
    right: 12px;
    transform: none;
    width: auto;
    min-height: 56px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    font-size: 16px;
    padding: 0 40px 0 14px;
  }
  .site-cta:active { transform: none; }
}
