/* ============================================================
   MarketShare · 美股复盘卡片站
   设计语言：深蓝夜间金融 + 玻璃质感 + 金色强调
   ============================================================ */

:root {
  --bg: #070d1a;
  --bg-soft: #0d1526;
  --panel: rgba(21, 32, 52, 0.72);
  --panel-solid: #131d31;
  --border: rgba(120, 155, 210, 0.16);
  --border-strong: rgba(120, 155, 210, 0.32);
  --text: #eaf0fa;
  --text-dim: #93a4c0;
  --text-faint: #64748b;
  --accent: #4d8dff;
  --accent-soft: rgba(77, 141, 255, 0.14);
  --gold: #f5b544;
  --gold-soft: rgba(245, 181, 68, 0.14);
  --up: #2fbf71;
  --down: #ef5b6b;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.42);
  --wrap: 1200px;
}

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

/* 关键修正：组件用了显式 display（如 .note-card 的 flex），
   会压过浏览器默认的 [hidden]{display:none}，导致搜索/筛选无法隐藏元素。
   这里统一用 !important 兜底，保证 JS 的 hidden 切换始终生效。 */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI',
               'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* 背景氛围光 */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(900px 520px at 12% -8%, rgba(77, 141, 255, 0.20), transparent 62%),
    radial-gradient(760px 460px at 88% 4%, rgba(245, 181, 68, 0.12), transparent 58%),
    radial-gradient(700px 500px at 50% 110%, rgba(120, 92, 255, 0.12), transparent 60%);
}

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
  z-index: 1;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ---------------- 顶栏 ---------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  backdrop-filter: blur(18px) saturate(160%);
  background: rgba(7, 13, 26, 0.78);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  gap: 20px;
}

.brand { display: flex; align-items: center; gap: 12px; }

.brand-mark {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 11px;
  font-size: 19px;
  color: #06101f;
  background: linear-gradient(135deg, var(--gold) 0%, #ffd98a 100%);
  box-shadow: 0 6px 18px rgba(245, 181, 68, 0.32);
}

.brand-text { display: flex; flex-direction: column; line-height: 1.24; }
.brand-text strong { font-size: 17px; font-weight: 900; letter-spacing: .3px; }
.brand-text small { font-size: 11.5px; color: var(--text-dim); }

.header-nav { display: flex; gap: 22px; font-size: 14px; color: var(--text-dim); }
.header-nav a { transition: color .18s; }
.header-nav a:hover { color: var(--gold); }

/* ---------------- Hero ---------------- */
.hero { position: relative; padding: 78px 0 54px; overflow: hidden; }

.hero-title {
  font-size: clamp(30px, 5vw, 54px);
  font-weight: 900;
  line-height: 1.24;
  letter-spacing: -.5px;
}

.hero-title em {
  font-style: normal;
  background: linear-gradient(100deg, var(--gold) 12%, #ff9d6c 60%, var(--accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-desc {
  margin-top: 20px;
  max-width: 640px;
  color: var(--text-dim);
  font-size: 16px;
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 34px;
  margin-top: 38px;
}

.stat { display: flex; flex-direction: column; }
.stat strong {
  font-size: 26px;
  font-weight: 900;
  color: var(--gold);
  letter-spacing: -.4px;
}
.stat span { font-size: 12.5px; color: var(--text-faint); letter-spacing: .4px; }

/* ---------------- 区块标题 ---------------- */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.section-head h2 {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -.2px;
  position: relative;
  padding-left: 14px;
}

.section-head h2::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 4px; height: 20px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--gold), var(--accent));
}

.tags-section { padding: 26px 0 8px; }

.tag-bar { display: flex; flex-wrap: wrap; gap: 10px; }

.tag-btn {
  font: inherit;
  font-size: 13.5px;
  color: var(--text-dim);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 15px;
  cursor: pointer;
  transition: all .18s ease;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.tag-btn:hover {
  color: var(--text);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.tag-btn.active {
  color: #06101f;
  background: linear-gradient(135deg, var(--gold), #ffd98a);
  border-color: transparent;
  font-weight: 700;
}

.tag-count {
  font-size: 11px;
  opacity: .75;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 1px 7px;
}

.tag-btn.active .tag-count { background: rgba(6, 16, 31, 0.16); }

.reset-btn {
  font: inherit;
  font-size: 13px;
  color: var(--text-faint);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color .18s;
}
.reset-btn:hover { color: var(--gold); }

/* ---------------- 搜索 ---------------- */
.search-box { position: relative; }

.search-box input {
  font: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 9px 18px;
  width: min(300px, 62vw);
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}

.search-box input::placeholder { color: var(--text-faint); }

.search-box input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ---------------- 笔记网格 ---------------- */
.notes-section { padding: 34px 0 60px; }

.note-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
  gap: 22px;
}

.note-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform .22s ease, border-color .22s ease, box-shadow .22s ease;
}

.note-card:hover {
  transform: translateY(-5px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}

.note-cover { position: relative; aspect-ratio: 3 / 4; overflow: hidden; background: #0b1220; }

.note-cover img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .5s ease;
}

.note-card:hover .note-cover img { transform: scale(1.045); }

.note-emoji {
  position: absolute;
  top: 12px; left: 12px;
  font-size: 20px;
  background: rgba(7, 13, 26, 0.74);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 3px 9px;
  line-height: 1.4;
}

.note-date {
  position: absolute;
  bottom: 12px; right: 12px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .4px;
  color: #06101f;
  background: linear-gradient(135deg, var(--gold), #ffd98a);
  border-radius: 999px;
  padding: 3px 11px;
}

.note-body {
  padding: 16px 17px 18px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  flex: 1;
}

.note-body h3 {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.45;
  letter-spacing: -.1px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.note-body p {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.6em;
}

.note-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  color: var(--text-faint);
  margin-top: auto;
}

.note-tags { display: flex; flex-wrap: wrap; gap: 6px; }

.chip {
  font-size: 11px;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 6px;
  padding: 2px 8px;
  white-space: nowrap;
}

.empty-state {
  text-align: center;
  color: var(--text-dim);
  padding: 56px 20px;
  font-size: 15px;
}

.load-more {
  display: block;
  margin: 34px auto 0;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 11px 34px;
  cursor: pointer;
  transition: all .18s;
}
.load-more:hover { border-color: var(--gold); color: var(--gold); }

/* ---------------- 详情页 ---------------- */
.note-wrap { padding-top: 40px; padding-bottom: 70px; }

.article { max-width: 800px; margin: 0 auto; }

.article-head { text-align: center; margin-bottom: 32px; }

.article-emoji { font-size: 40px; line-height: 1.2; margin-bottom: 12px; }

.article-title {
  font-size: clamp(24px, 4vw, 38px);
  font-weight: 900;
  line-height: 1.32;
  letter-spacing: -.5px;
}

.article-subtitle {
  margin-top: 14px;
  color: var(--text-dim);
  font-size: 15.5px;
}

.article-meta {
  display: flex;
  justify-content: center;
  gap: 9px;
  margin-top: 18px;
  font-size: 12.5px;
  color: var(--text-faint);
}

.article-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 18px;
}

.article-cover {
  margin: 0 0 40px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.article-body { font-size: 16px; }

.article-section { margin-bottom: 34px; }

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 19px;
  font-weight: 800;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  letter-spacing: -.1px;
}

.section-emoji { font-size: 21px; }

.article-section p { margin-bottom: 12px; color: #d3dcec; }

.article-section strong { color: var(--gold); font-weight: 700; }

.article-section ul { margin: 10px 0 14px; padding-left: 22px; }

.article-section li { margin-bottom: 8px; color: #d3dcec; }

.article-section code {
  font-family: 'SF Mono', Consolas, monospace;
  font-size: 14px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 5px;
  padding: 1px 6px;
}

/* ---------------- 图片画廊 ---------------- */
.gallery { max-width: 800px; margin: 56px auto 0; }

.gallery-title {
  font-size: 19px;
  font-weight: 800;
  margin-bottom: 18px;
  padding-left: 14px;
  position: relative;
}

.gallery-title::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 4px; height: 18px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--gold), var(--accent));
}

.gallery-grid { display: grid; gap: 18px; }

.gallery-grid img {
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  transition: transform .22s ease, border-color .22s ease;
}

.gallery-grid img:hover { transform: translateY(-3px); border-color: var(--border-strong); }

/* ---------------- 上下篇导航 ---------------- */
.note-nav {
  max-width: 800px;
  margin: 54px auto 0;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  flex-wrap: wrap;
}

.nav-link {
  flex: 1 1 240px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  font-size: 14px;
  transition: all .18s;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.nav-link:hover { border-color: var(--gold); color: var(--gold); transform: translateY(-2px); }

.nav-link small { color: var(--text-faint); font-size: 12px; }
.nav-link.disabled { opacity: .34; pointer-events: none; }

/* ---------------- 页脚 ---------------- */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 40px;
  padding: 34px 0 44px;
  text-align: center;
  color: var(--text-dim);
  font-size: 13.5px;
  position: relative;
  z-index: 1;
}

.site-footer strong { color: var(--text); }
.footer-meta { margin-top: 7px; font-size: 12px; color: var(--text-faint); }

/* ---------------- 响应式 ---------------- */
@media (max-width: 720px) {
  .wrap { padding: 0 16px; }
  .hero { padding: 52px 0 38px; }
  .hero-stats { gap: 22px; }
  .stat strong { font-size: 21px; }
  .header-nav { display: none; }
  .note-grid { grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 14px; }
  .note-body { padding: 12px 12px 14px; gap: 6px; }
  .note-body h3 { font-size: 13.5px; }
  .note-body p { font-size: 11.5px; }
  .note-tags, .note-meta { font-size: 10.5px; }
  .chip { font-size: 10px; padding: 1px 6px; }
  .article-body { font-size: 15px; }
  .section-title { font-size: 17px; }
  .search-box input { width: 100%; }
  .section-head .search-box { flex: 1 1 100%; }
}
