:root {
  color-scheme: light;
  --bg: #f7f7f4;
  --surface: rgba(255, 255, 255, 0.76);
  --surface-solid: #ffffff;
  --text: #171821;
  --muted: #686a75;
  --line: rgba(23, 24, 33, 0.11);
  --primary: #6558d3;
  --primary-soft: #ece9ff;
  --accent: #11866f;
  --accent-soft: #ddf5ee;
  --code: #171821;
  --code-text: #f5f4ef;
  --shadow: 0 24px 70px rgba(32, 29, 62, 0.09);
  --radius: 22px;
  --max: 1120px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1117;
  --surface: rgba(25, 27, 36, 0.78);
  --surface-solid: #191b24;
  --text: #f2f1ec;
  --muted: #a8a9b3;
  --line: rgba(255, 255, 255, 0.1);
  --primary: #a79cf5;
  --primary-soft: #2b2848;
  --accent: #62cdb5;
  --accent-soft: #153a34;
  --code: #090a0e;
  --code-text: #f5f4ef;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 10% -10%, rgba(101, 88, 211, 0.16), transparent 34rem),
    radial-gradient(circle at 95% 8%, rgba(17, 134, 111, 0.12), transparent 28rem),
    var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
img { max-width: 100%; }
.skip-link { position: fixed; left: 1rem; top: -4rem; z-index: 100; padding: .7rem 1rem; background: var(--text); color: var(--bg); border-radius: 10px; }
.skip-link:focus { top: 1rem; }
.shell { width: min(calc(100% - 2.2rem), var(--max)); margin-inline: auto; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid transparent;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(18px);
}
.nav-wrap { min-height: 74px; display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; }
.brand { display: inline-flex; align-items: center; gap: .75rem; font-weight: 760; letter-spacing: -.02em; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; color: white; background: linear-gradient(135deg, #6558d3, #11866f); box-shadow: 0 8px 18px rgba(101, 88, 211, .22); }
.nav-links { display: flex; align-items: center; gap: 1.7rem; color: var(--muted); font-size: .95rem; }
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--text); }
.nav-actions { display: flex; align-items: center; gap: .55rem; }
.icon-button { width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 50%; color: var(--text); background: var(--surface); cursor: pointer; }
.menu-button { display: none; }

main { min-height: calc(100vh - 160px); }
.hero { padding: 7.2rem 0 5rem; display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, .65fr); gap: 4rem; align-items: end; }
.eyebrow { display: flex; align-items: center; gap: .65rem; margin: 0 0 1.2rem; color: var(--accent); font-size: .78rem; font-weight: 760; letter-spacing: .16em; text-transform: uppercase; }
.eyebrow::before { content: ""; width: 32px; height: 1px; background: currentColor; }
h1, h2, h3 { line-height: 1.14; letter-spacing: -.035em; }
.hero h1 { margin: 0; max-width: 820px; font-size: clamp(3rem, 7vw, 6.35rem); font-weight: 760; }
.hero h1 em { color: var(--primary); font-style: normal; }
.hero-copy { margin: 1.7rem 0 0; max-width: 680px; color: var(--muted); font-size: clamp(1.05rem, 2vw, 1.25rem); }
.hero-actions { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 2rem; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: .7rem 1.15rem; border: 1px solid var(--line); border-radius: 999px; font-weight: 690; background: var(--surface); transition: transform .2s ease, border-color .2s ease; }
.button:hover { transform: translateY(-2px); border-color: var(--primary); }
.button.primary { border-color: var(--primary); color: white; background: var(--primary); }
.edge-card { padding: 1.35rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.edge-card-top { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: .82rem; }
.pulse { width: 9px; height: 9px; border-radius: 50%; background: #e4a73d; box-shadow: 0 0 0 5px color-mix(in srgb, #e4a73d 17%, transparent); }
.edge-card.is-ready .pulse { background: #2cb67d; box-shadow: 0 0 0 5px color-mix(in srgb, #2cb67d 17%, transparent); }
.edge-card strong { display: block; margin-top: 1rem; font-size: 1.1rem; }
.edge-card p { margin: .4rem 0 0; color: var(--muted); font-size: .9rem; }

.section { padding: 4rem 0; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 1.5rem; margin-bottom: 2rem; }
.section-head h2 { margin: 0; font-size: clamp(2rem, 4vw, 3.1rem); }
.section-head p { margin: .5rem 0 0; color: var(--muted); }
.text-link { color: var(--primary); font-weight: 680; }
.post-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 1.15rem; }
.post-card { grid-column: span 6; min-height: 330px; display: flex; flex-direction: column; padding: 1.65rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 12px 40px rgba(32, 29, 62, .035); transition: transform .2s ease, box-shadow .2s ease; }
.post-card:first-child { grid-column: span 7; }
.post-card:nth-child(2) { grid-column: span 5; }
.post-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.post-meta { display: flex; align-items: center; gap: .65rem; color: var(--muted); font-size: .82rem; }
.post-card h3 { margin: 2.6rem 0 .8rem; font-size: clamp(1.45rem, 3vw, 2rem); }
.post-card p { margin: 0; color: var(--muted); }
.post-card-footer { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-top: auto; padding-top: 1.8rem; }
.tags { display: flex; flex-wrap: wrap; gap: .45rem; }
.tag { display: inline-flex; padding: .3rem .62rem; border-radius: 999px; color: var(--primary); background: var(--primary-soft); font-size: .74rem; font-weight: 680; }
.arrow { color: var(--primary); font-size: 1.35rem; }

.topic-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.topic { padding: 1.5rem; border-top: 1px solid var(--line); }
.topic-index { color: var(--accent); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .8rem; }
.topic h3 { margin: 1rem 0 .5rem; }
.topic p { margin: 0; color: var(--muted); font-size: .93rem; }

.page-hero { max-width: 810px; padding: 6rem 0 3rem; }
.page-hero h1 { margin: 0; font-size: clamp(2.8rem, 7vw, 5.4rem); }
.page-hero p { max-width: 680px; margin: 1.2rem 0 0; color: var(--muted); font-size: 1.15rem; }
.search-bar { display: flex; align-items: center; gap: 1rem; margin: 1.5rem 0 2rem; }
.search-input { width: min(100%, 520px); padding: .95rem 1.1rem; border: 1px solid var(--line); border-radius: 14px; color: var(--text); background: var(--surface-solid); outline: none; }
.search-input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 15%, transparent); }
.result-count { color: var(--muted); font-size: .88rem; white-space: nowrap; }
.archive-list { display: grid; gap: .6rem; padding-bottom: 5rem; }
.archive-item { display: grid; grid-template-columns: 130px 1fr auto; gap: 1.2rem; align-items: center; padding: 1.2rem .3rem; border-bottom: 1px solid var(--line); }
.archive-item time, .archive-item p { color: var(--muted); }
.archive-item h2 { margin: 0; font-size: 1.25rem; }
.archive-item p { margin: .35rem 0 0; font-size: .92rem; }
.archive-item[hidden] { display: none; }

.article-wrap { width: min(calc(100% - 2.2rem), 780px); margin-inline: auto; padding: 5rem 0; }
.breadcrumb { color: var(--muted); font-size: .9rem; }
.article-header { padding: 2rem 0 3rem; border-bottom: 1px solid var(--line); }
.article-header h1 { margin: .8rem 0 1.2rem; font-size: clamp(2.6rem, 7vw, 5.2rem); }
.article-lead { color: var(--muted); font-size: 1.15rem; }
.article-header .tags { margin-top: 1.4rem; }
.prose { padding-top: 2.6rem; font-size: 1.03rem; }
.prose h2 { margin: 3rem 0 1rem; font-size: 1.75rem; }
.prose h3 { margin: 2.2rem 0 .8rem; }
.prose p, .prose li { color: color-mix(in srgb, var(--text) 88%, var(--muted)); }
.prose a { color: var(--primary); text-decoration: underline; text-underline-offset: 3px; }
.prose blockquote { margin: 2rem 0; padding: .4rem 1.4rem; border-left: 3px solid var(--primary); color: var(--muted); background: var(--primary-soft); border-radius: 0 12px 12px 0; }
.prose pre { position: relative; overflow: auto; margin: 1.7rem 0; padding: 1.35rem; border-radius: 16px; color: var(--code-text); background: var(--code); font-size: .88rem; line-height: 1.7; }
.prose code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.prose :not(pre) > code { padding: .15rem .35rem; border-radius: 5px; color: var(--primary); background: var(--primary-soft); }
.code-copy { position: absolute; top: .65rem; right: .65rem; padding: .35rem .6rem; border: 1px solid rgba(255,255,255,.18); border-radius: 8px; color: #f5f4ef; background: rgba(255,255,255,.08); cursor: pointer; }
.article-actions { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-top: 3rem; padding-top: 2rem; border-top: 1px solid var(--line); }
.article-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1.4rem; }
.article-nav a { padding: 1.2rem; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.article-nav small { display: block; margin-bottom: .35rem; color: var(--muted); }

.about-grid { display: grid; grid-template-columns: .8fr 1.2fr; gap: 4rem; padding-bottom: 6rem; }
.portrait { aspect-ratio: 1; display: grid; place-items: center; border-radius: 36px; color: white; background: linear-gradient(135deg, #6558d3, #11866f); box-shadow: var(--shadow); font-size: clamp(4rem, 12vw, 8rem); font-weight: 760; }
.about-copy h2 { font-size: 2rem; }
.about-copy p { color: var(--muted); }
.principles { display: grid; gap: .8rem; margin-top: 2rem; }
.principle { padding: 1rem 1.15rem; border-left: 2px solid var(--accent); background: var(--surface); }

.site-footer { margin-top: 3rem; border-top: 1px solid var(--line); }
.footer-wrap { min-height: 130px; display: flex; justify-content: space-between; align-items: center; gap: 2rem; color: var(--muted); font-size: .9rem; }
.footer-links { display: flex; gap: 1.2rem; }

.not-found { min-height: 68vh; display: grid; place-items: center; text-align: center; }
.not-found strong { display: block; color: var(--primary); font-size: clamp(5rem, 18vw, 11rem); line-height: .8; }
.not-found h1 { font-size: 2rem; }

@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; padding-top: 5rem; gap: 2.5rem; }
  .post-card, .post-card:first-child, .post-card:nth-child(2) { grid-column: 1 / -1; min-height: 300px; }
  .topic-strip { grid-template-columns: 1fr; }
  .about-grid { grid-template-columns: 1fr; gap: 2rem; }
  .portrait { max-width: 420px; }
  .archive-item { grid-template-columns: 1fr auto; }
  .archive-item time { grid-column: 1 / -1; }
}

@media (max-width: 650px) {
  .menu-button { display: inline-grid; place-items: center; }
  .nav-links { position: absolute; top: 68px; left: 1rem; right: 1rem; display: none; flex-direction: column; align-items: stretch; gap: 0; padding: .6rem; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-solid); box-shadow: var(--shadow); }
  .nav-links.is-open { display: flex; }
  .nav-links a { padding: .8rem; }
  .hero h1 { font-size: clamp(2.8rem, 15vw, 4.6rem); }
  .section-head { align-items: start; flex-direction: column; }
  .search-bar { align-items: stretch; flex-direction: column; }
  .archive-item { grid-template-columns: 1fr; }
  .archive-item .arrow { display: none; }
  .article-nav { grid-template-columns: 1fr; }
  .footer-wrap { padding: 2rem 0; align-items: start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
