/* =====================================================================
   全球资本市场分析站 — App Styles (layout · components · pages)
   ===================================================================== */

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background-color .35s var(--ease-out), color .35s var(--ease-out);
}

/* Aurora / mesh background */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(60% 55% at 12% 8%,  var(--bg-grad-a) 0%, transparent 60%),
    radial-gradient(55% 50% at 90% 0%,  var(--bg-grad-b) 0%, transparent 55%),
    radial-gradient(60% 60% at 75% 95%, var(--bg-grad-c) 0%, transparent 60%),
    var(--bg);
  opacity: .9;
}
/* subtle grain to avoid banding */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.025'/%3E%3C/svg%3E");
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }

:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: clamp(1.1rem, 4vw, 2.25rem);
}
.container-read { max-width: var(--maxw-read); }

.section { padding-block: clamp(3.5rem, 8vw, 6.5rem); }

/* ---------- Header / Nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  background: var(--glass-bg);
  border-bottom: 1px solid var(--border);
  transition: background-color .35s var(--ease-out), border-color .35s var(--ease-out);
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
  gap: 1rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.brand .brand-mark {
  width: 34px; height: 34px;
  border-radius: 10px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--gold));
  color: #fff;
  font-weight: 800;
  font-size: .95rem;
  box-shadow: var(--shadow-sm);
}
.brand .brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand .brand-text small { font-size: var(--fs-xs); color: var(--text-muted); font-weight: 500; letter-spacing: .02em; }

.nav-links { display: flex; align-items: center; gap: .35rem; }
.nav-link {
  padding: .5rem .9rem;
  border-radius: 999px;
  color: var(--text-muted);
  font-weight: 500;
  font-size: var(--fs-sm);
  transition: color .2s, background-color .2s;
}
.nav-link:hover { color: var(--text); background: var(--surface); }
.nav-link.active { color: var(--text); background: var(--surface-strong); }

.nav-actions { display: flex; align-items: center; gap: .6rem; }

/* Theme segmented control */
.theme-toggle {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  gap: 2px;
}
.theme-toggle button {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  width: 34px; height: 30px;
  border-radius: 999px;
  display: grid; place-items: center;
  transition: color .2s, background-color .25s var(--ease-out), transform .2s;
}
.theme-toggle button svg { width: 16px; height: 16px; }
.theme-toggle button:hover { color: var(--text); }
.theme-toggle button.active {
  background: var(--surface-solid);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

/* Mobile menu button */
.menu-btn { display: none; background: var(--surface); border: 1px solid var(--border); color: var(--text); width: 40px; height: 40px; border-radius: 10px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .7rem 1.25rem;
  border-radius: 999px;
  font-weight: 600; font-size: var(--fs-sm);
  border: 1px solid transparent;
  transition: transform .25s var(--ease-out), box-shadow .25s, background-color .2s, border-color .2s;
}
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-strong)); color: #fff; box-shadow: var(--shadow-md); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--surface-strong); transform: translateY(-2px); }

/* ---------- Glass card ---------- */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

/* ---------- Eyebrow / labels ---------- */
.eyebrow {
  display: inline-flex; align-items: center; gap: .5rem;
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: .14em;
  font-weight: 600;
  color: var(--accent);
}
.eyebrow::before { content: ""; width: 22px; height: 2px; border-radius: 2px; background: linear-gradient(90deg, var(--accent), var(--gold)); }

/* ---------- Hero ---------- */
.hero { padding-block: clamp(3.5rem, 9vw, 7rem) clamp(2.5rem, 6vw, 4rem); }
.hero h1 {
  font-family: var(--font-serif);
  font-size: clamp(var(--fs-2xl), 6vw, var(--fs-4xl));
  line-height: var(--lh-tight);
  letter-spacing: -0.02em;
  margin: 1rem 0 1.1rem;
  max-width: 16ch;
}
.hero h1 .accent {
  background: linear-gradient(120deg, var(--accent), var(--gold));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p.lead { font-size: var(--fs-md); color: var(--text-muted); max-width: 52ch; }
.hero .hero-cta { margin-top: 1.75rem; display: flex; gap: .75rem; flex-wrap: wrap; }

.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 3rem;
}
.stat {
  padding: 1.25rem 1.4rem;
  border-radius: var(--radius);
}
.stat .num { font-size: var(--fs-xl); font-weight: 700; letter-spacing: -.02em; }
.stat .lbl { color: var(--text-muted); font-size: var(--fs-sm); margin-top: .15rem; }

/* ---------- Section heading ---------- */
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 2rem; flex-wrap: wrap; }
.section-head h2 {
  font-family: var(--font-serif);
  font-size: var(--fs-2xl);
  letter-spacing: -.02em;
  margin: .5rem 0 0;
}

/* ---------- Tag chips ---------- */
.tag-row { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .4rem .85rem;
  border-radius: 999px;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: color .2s, background-color .2s, border-color .2s, transform .2s var(--ease-out);
}
.chip:hover { color: var(--text); border-color: var(--border-strong); transform: translateY(-2px); }
.chip.active { color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-strong)); border-color: transparent; }
.chip .count { font-size: var(--fs-xs); opacity: .7; }

/* ---------- Article grid & cards ---------- */
.article-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}
.article-card {
  position: relative;
  display: flex; flex-direction: column;
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform .4s var(--ease-out), box-shadow .4s, border-color .3s;
  will-change: transform;
}
.article-card::after {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 0%), var(--accent-soft), transparent 45%);
  opacity: 0; transition: opacity .4s; pointer-events: none;
}
.article-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); border-color: var(--border-strong); }
.article-card:hover::after { opacity: 1; }
.article-card .meta { display: flex; align-items: center; gap: .6rem; font-size: var(--fs-xs); color: var(--text-faint); margin-bottom: .9rem; }
.article-card .meta .dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; }
.article-card h3 {
  font-size: var(--fs-lg);
  line-height: var(--lh-snug);
  letter-spacing: -.01em;
  margin: 0 0 .6rem;
}
.article-card h3 a { background-image: linear-gradient(var(--accent), var(--accent)); background-size: 0% 1px; background-repeat: no-repeat; background-position: 0 100%; transition: background-size .35s var(--ease-out); }
.article-card:hover h3 a { background-size: 100% 1px; }
.article-card p.excerpt { color: var(--text-muted); font-size: var(--fs-sm); margin: 0 0 1.1rem; flex: 1; }
.article-card .foot { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-top: auto; }
.article-card .read-time { font-size: var(--fs-xs); color: var(--text-faint); }

/* Featured (large) card */
.article-card.featured {
  grid-column: 1 / -1;
  flex-direction: row;
  align-items: stretch;
  padding: 0;
  min-height: 260px;
}
.article-card.featured .featured-media {
  flex: 0 0 40%;
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
  background:
    radial-gradient(120% 120% at 0% 0%, var(--accent) 0%, transparent 55%),
    linear-gradient(135deg, var(--accent-strong), var(--gold));
  position: relative;
  overflow: hidden;
  display: grid; place-items: center;
}
.article-card.featured .featured-media .featured-mark {
  font-family: var(--font-serif);
  font-size: 4.5rem;
  font-weight: 800;
  color: rgba(255,255,255,0.92);
  letter-spacing: -.02em;
}
.article-card.featured .featured-body {
  flex: 1;
  padding: 2rem 2.25rem;
  display: flex; flex-direction: column;
}
.article-card.featured h3 { font-size: var(--fs-2xl); margin-bottom: .8rem; }
.article-card.featured p.excerpt { font-size: var(--fs-md); }
@media (max-width: 720px) {
  .article-card.featured { flex-direction: column; }
  .article-card.featured .featured-media { flex: none; height: 150px; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
}

/* ---------- Empty state ---------- */
.empty {
  text-align: center;
  padding: 4rem 1.5rem;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
.empty .empty-icon { font-size: 2.5rem; margin-bottom: .75rem; }
.empty h3 { margin: .25rem 0 .4rem; font-family: var(--font-serif); font-size: var(--fs-lg); }
.empty p { color: var(--text-muted); margin: 0; font-size: var(--fs-sm); }

/* ---------- Article detail (prose) ---------- */
.prose { font-size: var(--fs-md); line-height: 1.8; color: var(--text); }
.prose h1, .prose h2, .prose h3 { font-family: var(--font-serif); letter-spacing: -.01em; line-height: var(--lh-snug); margin: 2em 0 .6em; }
.prose h1 { font-size: var(--fs-2xl); }
.prose h2 { font-size: var(--fs-xl); }
.prose h3 { font-size: var(--fs-lg); }
.prose p { margin: 1.1em 0; }
.prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.prose ul, .prose ol { padding-left: 1.4em; margin: 1.1em 0; }
.prose li { margin: .4em 0; }
.prose blockquote {
  margin: 1.5em 0; padding: .9em 1.2em;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-muted);
}
.prose code {
  font-family: var(--font-mono);
  font-size: .88em;
  background: var(--surface-strong);
  padding: .15em .4em;
  border-radius: 6px;
}
.prose pre {
  background: var(--surface-solid);
  border: 1px solid var(--border);
  padding: 1.1rem 1.25rem;
  border-radius: var(--radius);
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
}
.prose pre code { background: none; padding: 0; }
.prose img { border-radius: var(--radius); margin: 1.5em 0; box-shadow: var(--shadow-md); }
.prose table { width: 100%; border-collapse: collapse; margin: 1.5em 0; font-size: var(--fs-sm); }
.prose th, .prose td { border: 1px solid var(--border); padding: .6em .8em; text-align: left; }
.prose th { background: var(--surface); }

.post-header { margin-bottom: 2.5rem; }
.post-header h1 { font-family: var(--font-serif); font-size: clamp(var(--fs-xl), 5vw, var(--fs-3xl)); line-height: var(--lh-tight); letter-spacing: -.02em; margin: .8rem 0; }
.post-header .meta { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; color: var(--text-muted); font-size: var(--fs-sm); }
.back-link { display: inline-flex; align-items: center; gap: .4rem; color: var(--text-muted); font-size: var(--fs-sm); font-weight: 500; transition: color .2s, gap .2s; }
.back-link:hover { color: var(--accent); gap: .6rem; }

/* ---------- Tags page ---------- */
.tag-cloud { display: flex; flex-wrap: wrap; gap: .75rem; }
.tag-cloud .tag-pill {
  display: inline-flex; flex-direction: column; gap: .15rem;
  padding: .9rem 1.2rem;
  border-radius: var(--radius);
  min-width: 130px;
  transition: transform .3s var(--ease-out), box-shadow .3s, border-color .3s;
}
.tag-cloud .tag-pill:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--border-strong); }
.tag-cloud .tag-pill .name { font-weight: 600; font-size: var(--fs-md); }
.tag-cloud .tag-pill .cnt { font-size: var(--fs-xs); color: var(--text-muted); }

/* ---------- About page ---------- */
.about-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 2.5rem; align-items: start; }
.about-lead { font-family: var(--font-serif); font-size: var(--fs-xl); line-height: var(--lh-snug); letter-spacing: -.01em; }
.feature-list { display: grid; gap: 1rem; margin-top: 1.5rem; }
.feature {
  display: flex; gap: 1rem; align-items: flex-start;
  padding: 1.1rem 1.25rem; border-radius: var(--radius);
}
.feature .ic { flex: none; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.feature h4 { margin: 0 0 .2rem; font-size: var(--fs-md); }
.feature p { margin: 0; color: var(--text-muted); font-size: var(--fs-sm); }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 4rem;
  padding-block: 2.5rem;
  color: var(--text-muted);
  font-size: var(--fs-sm);
}
.footer-grid { display: flex; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap; align-items: center; }
.footer-grid a:hover { color: var(--text); }

/* ---------- Reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity .7s var(--ease-out), transform .7s var(--ease-out); }
.reveal.in { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .nav-links { display: none; }
  .nav-links.open {
    display: flex; flex-direction: column; align-items: stretch;
    position: absolute; top: 68px; left: 0; right: 0;
    background: var(--surface-solid);
    border-bottom: 1px solid var(--border);
    padding: 1rem; gap: .25rem;
    box-shadow: var(--shadow-lg);
  }
  .menu-btn { display: grid; place-items: center; }
  .about-grid { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
}
