:root {
  color-scheme: dark;
  --bg: #050712;
  --bg2: #0b1020;
  --card: rgba(15, 23, 42, .72);
  --card2: rgba(30, 41, 59, .64);
  --text: #edf6ff;
  --muted: #9aa9bd;
  --line: rgba(148, 163, 184, .2);
  --accent: #38bdf8;
  --accent2: #a78bfa;
  --accent3: #34d399;
  --hot: #f472b6;
  --shadow: 0 24px 80px rgba(0,0,0,.34);
  --radius: 24px;
}
@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #f6f9ff;
    --bg2: #eaf2ff;
    --card: rgba(255,255,255,.82);
    --card2: rgba(255,255,255,.68);
    --text: #101827;
    --muted: #5d6b7d;
    --line: rgba(15,23,42,.12);
    --shadow: 0 24px 80px rgba(15,23,42,.12);
  }
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.78;
  color: var(--text);
  background:
    radial-gradient(circle at 8% 8%, rgba(56,189,248,.24), transparent 30rem),
    radial-gradient(circle at 86% 10%, rgba(167,139,250,.22), transparent 34rem),
    radial-gradient(circle at 60% 96%, rgba(52,211,153,.14), transparent 34rem),
    linear-gradient(135deg, var(--bg), var(--bg2));
  background-attachment: fixed;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(148,163,184,.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148,163,184,.07) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,.8), transparent 76%);
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
.site-header, .site-footer, .site-main { width: min(1120px, calc(100% - 34px)); margin: 0 auto; }
.site-header {
  position: sticky;
  top: 12px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(15,23,42,.58);
  backdrop-filter: blur(20px);
  box-shadow: 0 18px 55px rgba(0,0,0,.18);
}
@media (prefers-color-scheme: light) { .site-header { background: rgba(255,255,255,.72); } }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 900; letter-spacing: -.02em; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 14px;
  color: white;
  background: linear-gradient(135deg, var(--accent), var(--accent2), var(--hot));
  box-shadow: 0 0 30px rgba(56,189,248,.35);
}
.nav { display: flex; align-items: center; justify-content: flex-end; gap: 4px; flex-wrap: wrap; }
.nav a { padding: 8px 12px; border-radius: 999px; color: var(--muted); font-weight: 750; font-size: 14px; }
.nav a:hover, .nav a.active { color: var(--text); background: rgba(148,163,184,.12); }
.site-main { padding: 28px 0 56px; }
.hero, .page-hero, .article, .comments, .post-card, .term-pill {
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}
.hero {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) 280px;
  gap: 28px;
  align-items: end;
  min-height: 420px;
  padding: clamp(28px, 5vw, 56px);
  border-radius: 34px;
}
.hero::after {
  content: "";
  position: absolute;
  inset: auto -18% -45% 30%;
  height: 300px;
  background: conic-gradient(from 90deg, rgba(56,189,248,.36), rgba(167,139,250,.35), rgba(244,114,182,.22), rgba(52,211,153,.22), rgba(56,189,248,.36));
  filter: blur(34px);
  opacity: .78;
}
.hero-glow { position: absolute; width: 220px; height: 220px; border-radius: 50%; filter: blur(6px); opacity: .4; }
.hero-glow-a { top: -90px; right: 12%; background: radial-gradient(circle, var(--accent2), transparent 70%); }
.hero-glow-b { bottom: -100px; left: 7%; background: radial-gradient(circle, var(--accent), transparent 70%); }
.hero-content, .hero-panel { position: relative; z-index: 1; }
.eyebrow { margin: 0 0 10px; color: var(--accent); font-weight: 850; letter-spacing: .08em; text-transform: uppercase; font-size: 12px; }
h1 { margin: 0; font-size: clamp(36px, 6vw, 74px); line-height: 1.02; letter-spacing: -.06em; }
.hero p:not(.eyebrow), .page-hero p, .article-summary { color: var(--muted); max-width: 760px; font-size: clamp(16px, 2vw, 20px); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 10px 16px; border: 1px solid var(--line); border-radius: 15px; background: var(--card2); font-weight: 850; }
.btn.primary { color: white; border-color: transparent; background: linear-gradient(135deg, var(--accent), var(--accent2)); }
.btn:hover { transform: translateY(-1px); text-decoration: none; }
.hero-panel { display: grid; grid-template-columns: 1fr auto; gap: 8px 18px; padding: 20px; border: 1px solid var(--line); border-radius: 24px; background: rgba(255,255,255,.06); }
.hero-panel span { color: var(--muted); }
.hero-panel strong { font-size: 30px; line-height: 1; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin: 34px 0 16px; }
.section-head h2 { margin: 0; font-size: clamp(26px, 4vw, 42px); letter-spacing: -.035em; }
.section-head > a { color: var(--muted); font-weight: 800; }
.post-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.featured-grid .post-card:first-child { grid-column: span 2; min-height: 260px; }
.post-card { position: relative; overflow: hidden; min-height: 220px; padding: 24px; border-radius: var(--radius); transition: transform .2s ease, border-color .2s ease, background .2s ease; }
.post-card::before { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 20% 0%, rgba(56,189,248,.18), transparent 34%), radial-gradient(circle at 100% 10%, rgba(167,139,250,.16), transparent 30%); opacity: .85; }
.post-card:hover { transform: translateY(-4px); border-color: rgba(56,189,248,.45); background: rgba(15,23,42,.86); }
@media (prefers-color-scheme: light) { .post-card:hover { background: rgba(255,255,255,.94); } }
.post-card > *:not(.post-card-link) { position: relative; z-index: 1; }
.post-card-link { position: absolute; inset: 0; z-index: 0; }
.post-card h2 { margin: 12px 0 8px; font-size: clamp(22px, 3vw, 32px); line-height: 1.16; letter-spacing: -.03em; }
.post-card p { margin: 0; color: var(--muted); }
.post-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; color: var(--muted); font-size: 13px; font-weight: 800; }
.post-meta span, .post-meta time { padding: 4px 9px; border: 1px solid var(--line); border-radius: 999px; background: rgba(148,163,184,.08); }
.post-meta.center { justify-content: center; }
.tag-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.tag-row span, .tag-row a { padding: 5px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: rgba(148,163,184,.08); font-size: 13px; font-weight: 800; }
.tag-row.categories a { color: var(--accent); }
.term-cloud { display: flex; flex-wrap: wrap; gap: 12px; }
.term-pill { display: inline-flex; align-items: center; gap: 14px; padding: 13px 16px; border-radius: 18px; transition: transform .2s ease, border-color .2s ease; }
.term-pill.big { font-size: 18px; font-weight: 850; }
.term-pill b { display: grid; place-items: center; min-width: 30px; height: 30px; border-radius: 999px; color: white; background: linear-gradient(135deg, var(--accent), var(--accent2)); }
.term-pill:hover { transform: translateY(-2px); border-color: rgba(56,189,248,.45); text-decoration: none; }
.terms-page { margin-top: 18px; }
.page-hero { margin-bottom: 20px; padding: clamp(24px, 4vw, 42px); border-radius: 30px; }
.page-hero.compact h1 { font-size: clamp(34px, 5vw, 56px); }
.article { overflow: hidden; border-radius: 32px; }
.article-hero { position: relative; overflow: hidden; padding: clamp(28px, 5vw, 58px); text-align: center; border-bottom: 1px solid var(--line); }
.article-hero::before { content: ""; position: absolute; inset: -50% -20% auto; height: 360px; background: radial-gradient(circle, rgba(56,189,248,.22), transparent 60%); }
.article-hero > * { position: relative; }
.article-hero h1 { max-width: 900px; margin: 14px auto; font-size: clamp(34px, 5vw, 62px); }
.article-summary { margin: 0 auto; }
.article-content { padding: clamp(22px, 4vw, 48px); }
.content { color: var(--text); }
.content h2 { margin-top: 38px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 30px; letter-spacing: -.03em; }
.content h3 { margin-top: 26px; font-size: 21px; }
.content p, .content li { color: color-mix(in srgb, var(--text) 88%, var(--muted)); }
.content a { color: var(--accent); }
.content img { max-width: 100%; border-radius: 18px; box-shadow: var(--shadow); }
.content pre { overflow: auto; margin: 16px 0; padding: 18px; border: 1px solid var(--line); border-radius: 18px; background: rgba(2,6,23,.88); color: #e2e8f0; }
.content code { padding: .15rem .42rem; border: 1px solid var(--line); border-radius: 8px; background: rgba(2,6,23,.62); color: #dff3ff; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
@media (prefers-color-scheme: light) { .content code { background: rgba(226,232,240,.72); color: #0f172a; } }
.content pre code { padding: 0; border: 0; background: transparent; color: inherit; }
.content table { width: 100%; margin: 18px 0; border-collapse: collapse; overflow: hidden; border-radius: 16px; display: block; overflow-x: auto; }
.content th, .content td { padding: 11px 13px; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.content th { background: rgba(148,163,184,.12); }
.content blockquote { margin: 18px 0; padding: 14px 18px; border-left: 4px solid var(--accent); border-radius: 14px; background: rgba(56,189,248,.08); color: var(--muted); }
.article-footer { padding: 0 clamp(22px, 4vw, 48px) 40px; }
.comments { margin: 22px 0 44px; padding: clamp(20px, 3vw, 30px); border-radius: 28px; }
.comments h2 { margin-top: 0; }
.pagination { display: flex; gap: 8px; list-style: none; padding-left: 0; margin: 24px 0; }
.pagination a { display: inline-flex; min-width: 38px; height: 38px; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.pagination .active a { color: white; background: linear-gradient(135deg, var(--accent), var(--accent2)); border-color: transparent; }
.site-footer { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 28px 0 44px; color: var(--muted); border-top: 1px solid var(--line); }
.muted { color: var(--muted); }
@media (max-width: 820px) {
  .site-header { position: static; align-items: flex-start; flex-direction: column; border-radius: 24px; }
  .nav { justify-content: flex-start; }
  .hero { grid-template-columns: 1fr; min-height: auto; }
  .post-grid { grid-template-columns: 1fr; }
  .featured-grid .post-card:first-child { grid-column: span 1; }
  .section-head { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 520px) {
  .site-header, .site-footer, .site-main { width: min(100% - 24px, 1120px); }
  h1 { letter-spacing: -.04em; }
  .hero, .page-hero, .article-hero, .article-content, .post-card { padding: 20px; }
}

/* Left article table of contents */
.reading-layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}
.toc-sidebar {
  position: sticky;
  top: 92px;
  max-height: calc(100vh - 112px);
  overflow: auto;
}
.toc-card {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  padding: 16px;
}
.toc-title {
  margin-bottom: 10px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.toc-card nav ul { list-style: none; margin: 0; padding: 0; }
.toc-card nav ul ul { margin: 4px 0 4px 12px; padding-left: 10px; border-left: 1px solid var(--line); }
.toc-card nav a {
  display: block;
  padding: 7px 9px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}
.toc-card nav a:hover {
  color: var(--text);
  background: rgba(56,189,248,.10);
  text-decoration: none;
}
.reading-main { min-width: 0; }
@media (max-width: 1080px) {
  .reading-layout { grid-template-columns: 1fr; }
  .toc-sidebar { position: static; max-height: none; order: -1; }
  .toc-card { padding: 14px; }
  .toc-card nav ul { display: flex; flex-wrap: wrap; gap: 6px; }
  .toc-card nav ul ul { display: none; }
  .toc-card nav a { border: 1px solid var(--line); background: rgba(148,163,184,.08); }
}
