:root {
  color-scheme: light;
  --bg: #f6f2ea;
  --surface: rgba(255, 255, 255, 0.78);
  --surface-strong: #fffaf1;
  --text: #211c18;
  --muted: #746b62;
  --line: rgba(33, 28, 24, 0.12);
  --accent: #d95f2e;
  --accent-2: #244f78;
  --shadow: 0 24px 80px rgba(40, 30, 20, 0.14);
  --radius: 28px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111318;
  --surface: rgba(28, 31, 39, 0.78);
  --surface-strong: #191c23;
  --text: #f5efe6;
  --muted: #b6afa7;
  --line: rgba(255, 255, 255, 0.12);
  --accent: #ff8b5d;
  --accent-2: #8ec5ff;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.32);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(217, 95, 46, 0.22), transparent 34rem),
    radial-gradient(circle at right 20%, rgba(36, 79, 120, 0.18), transparent 28rem),
    var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  line-height: 1.75;
}

a { color: inherit; text-decoration: none; }
p { margin: 0 0 1rem; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem clamp(1rem, 4vw, 4rem);
  backdrop-filter: blur(18px);
  background: color-mix(in srgb, var(--bg), transparent 18%);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: .85rem; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 16px;
  color: white;
  font-weight: 900;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: var(--shadow);
}
.brand small { display: block; color: var(--muted); font-size: .78rem; line-height: 1.1; }

.nav { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; justify-content: flex-end; }
.nav a, .icon-button, .filter, .button {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .55rem .9rem;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: transform .2s ease, border-color .2s ease, background .2s ease;
}
.nav a:hover, .icon-button:hover, .filter:hover, .button:hover { transform: translateY(-1px); border-color: color-mix(in srgb, var(--accent), var(--line)); }
.icon-button { width: 42px; height: 42px; padding: 0; }

main { width: min(1120px, calc(100% - 2rem)); margin: 0 auto; }
.hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  align-items: stretch;
  padding: clamp(3rem, 8vw, 7rem) 0 3rem;
}
.hero-content, .hero-card, .section, .contact-card, .about-card, .post-reader {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.hero-content { padding: clamp(1.5rem, 4vw, 3.5rem); }
.eyebrow {
  margin: 0 0 .6rem;
  color: var(--accent);
  font-size: .82rem;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
}
.hero h1 {
  margin: 0 0 1rem;
  max-width: 100%;
  font-size: clamp(2.4rem, 8vw, 5.8rem);
  line-height: .98;
  letter-spacing: -0.07em;
  text-wrap: balance;
}
.title-nowrap { white-space: nowrap; }
.hero-text { max-width: 680px; color: var(--muted); font-size: 1.08rem; }
.hero-actions { display: flex; gap: .8rem; flex-wrap: wrap; margin-top: 1.6rem; }
.button { display: inline-flex; align-items: center; justify-content: center; font-weight: 800; }
.button.primary { background: var(--text); color: var(--bg); }
.button.ghost { color: var(--text); }
.hero-card { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-content: center; gap: 1rem; padding: 1.4rem; }
.metric {
  padding: 1.2rem;
  border-radius: 22px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
}
.metric strong { display: block; font-size: 2.2rem; line-height: 1; }
.metric span { color: var(--muted); }

.section { padding: clamp(1.1rem, 3vw, 2rem); margin: 1.25rem 0; }
.section-heading { display: flex; justify-content: space-between; gap: 1rem; align-items: end; margin-bottom: 1rem; }
.section h2 { margin: 0 0 .5rem; font-size: clamp(1.8rem, 4vw, 3rem); letter-spacing: -0.04em; line-height: 1.1; }
.search-box { display: grid; gap: .35rem; min-width: min(100%, 300px); color: var(--muted); font-size: .86rem; }
.search-box input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .8rem 1rem;
  background: var(--surface-strong);
  color: var(--text);
  outline: none;
}
.search-box input:focus { border-color: var(--accent); }
.filters { display: flex; gap: .6rem; flex-wrap: wrap; margin-bottom: 1rem; }
.filter.active { background: var(--accent); color: white; border-color: transparent; }

.posts-section {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}
.blog-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}
.left-sidebar {
  order: 1;
  position: sticky;
  top: 96px;
  display: grid;
  gap: 1rem;
}
.sidebar-card,
.post-main {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.sidebar-card { padding: 1.2rem; }
.profile-card {
  padding: 1.55rem 1.25rem 1.25rem;
  text-align: center;
}
.author-avatar {
  display: block;
  width: 92px;
  height: 92px;
  margin: 0 auto .85rem;
  border-radius: 50%;
  object-fit: cover;
  object-position: center;
  box-shadow: 0 12px 30px rgba(36, 79, 120, .22);
  border: 4px solid color-mix(in srgb, var(--surface-strong), white 42%);
}
.profile-card h3 {
  justify-content: center;
  margin: .2rem 0 .35rem;
  color: var(--accent-2);
  font-size: 1.45rem;
  font-weight: 500;
  letter-spacing: -0.03em;
}
.profile-card p {
  margin-bottom: 1rem;
  color: var(--text);
  font-size: .93rem;
}
.author-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .2rem;
  margin-top: .7rem;
}
.author-stats span {
  display: grid;
  gap: .1rem;
  padding: .2rem .1rem;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.author-stats strong {
  color: var(--accent-2);
  font-size: 1.35rem;
  font-weight: 500;
  line-height: 1.1;
}
.author-stats small {
  color: var(--text);
  font-size: .82rem;
}
.sidebar-card h3,
.sidebar-title h3 {
  display: flex;
  align-items: center;
  gap: .45rem;
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}
.notice-card p { margin: .75rem 0 0; color: var(--muted); }
.sidebar-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.sidebar-title strong {
  color: var(--muted);
  font-size: 1.65rem;
  font-style: italic;
  line-height: 1;
  opacity: .7;
}
.toc-list {
  display: grid;
  gap: .55rem;
  margin-top: 1rem;
}
.toc-list a {
  padding: .5rem .7rem;
  border-left: 3px solid var(--line);
  color: var(--muted);
  transition: color .2s ease, border-color .2s ease, background .2s ease;
}
.toc-list a:hover {
  color: var(--accent);
  border-left-color: var(--accent);
  background: var(--surface-strong);
  border-radius: 0 12px 12px 0;
}
.sidebar-filters {
  display: grid;
  gap: .5rem;
  margin: 1rem 0 0;
}
.sidebar-filters .filter {
  width: 100%;
  border-radius: 14px;
  text-align: left;
  background: var(--surface-strong);
}
.sidebar-filters .filter.active {
  background: var(--accent);
  color: white;
  border-color: transparent;
}
.latest-list {
  display: grid;
  gap: .7rem;
  margin-top: 1rem;
}
.latest-item {
  display: grid;
  gap: .2rem;
  padding: .75rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-strong);
  transition: transform .2s ease, border-color .2s ease;
}
.latest-item:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--accent), var(--line));
}
.latest-tag { color: var(--accent); font-size: .75rem; font-weight: 900; }
.latest-item strong { line-height: 1.35; }
.latest-item small { color: var(--muted); }
.post-main { order: 2; padding: clamp(1.1rem, 3vw, 2rem); }

.post-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
.post-card {
  display: flex;
  min-height: 210px;
  flex-direction: column;
  gap: .8rem;
  padding: 1.2rem;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface-strong);
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.post-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent), var(--line));
  box-shadow: 0 18px 48px rgba(40, 30, 20, .12);
}
.post-card .tag { align-self: flex-start; color: var(--accent-2); font-weight: 800; font-size: .82rem; }
.post-card h3 { margin: 0; font-size: 1.35rem; line-height: 1.25; }
.post-card p { color: var(--muted); }
.post-meta { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: auto; color: var(--muted); font-size: .88rem; }
.read-more { color: var(--accent); font-weight: 900; margin-top: .4rem; }
.empty { grid-column: 1 / -1; color: var(--muted); padding: 2rem; text-align: center; }

.post-reader { margin-top: 1rem; padding: clamp(1.2rem, 4vw, 3rem); background: var(--surface-strong); }
.post-reader h2 { max-width: 820px; }
.post-reader .close-reader { margin-bottom: 1.2rem; }
.post-reader .article-body { max-width: 760px; }
.post-reader .article-body h3 { margin-top: 2rem; }
.post-reader .article-body blockquote {
  margin: 1.2rem 0;
  padding: .8rem 1rem;
  border-left: 4px solid var(--accent);
  background: var(--surface);
  color: var(--muted);
  border-radius: 12px;
}

.about-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 1rem; align-items: start; }
.about-card { padding: 1.2rem; box-shadow: none; background: var(--surface-strong); }
.about-card h3 { margin-top: 0; }
.about-card li { margin: .4rem 0; }
.contact-card { text-align: center; }
.link-row { display: flex; justify-content: center; gap: .7rem; flex-wrap: wrap; }
.link-row a { color: var(--accent); font-weight: 900; }
.site-footer { width: min(1120px, calc(100% - 2rem)); margin: 2rem auto; color: var(--muted); text-align: center; }

@media (max-width: 960px) {
  .blog-layout { grid-template-columns: 1fr; }
  .left-sidebar { position: static; grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; padding-top: 2rem; }
  .hero-card { grid-template-columns: 1fr; }
  .section-heading, .about-grid { grid-template-columns: 1fr; display: grid; }
  .left-sidebar { grid-template-columns: 1fr; }
  .post-grid { grid-template-columns: 1fr; }
  .site-header { align-items: flex-start; flex-direction: column; }
  .nav { justify-content: flex-start; }
}







/* No blank area filler */
.blog-layout {
  align-items: stretch;
}
.post-main {
  min-height: 100%;
}
.post-filler {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  grid-column: 1 / -1;
  margin-top: .2rem;
}
.post-filler-card {
  display: flex;
  min-height: 170px;
  flex-direction: column;
  gap: .65rem;
  border: 1px dashed color-mix(in srgb, var(--accent), var(--line) 65%);
  border-radius: 24px;
  padding: 1.2rem;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent), transparent 92%), transparent 55%),
    var(--surface-strong);
}
.post-filler-card h3 {
  margin: 0;
  font-size: 1.18rem;
  line-height: 1.35;
}
.post-filler-card p {
  color: var(--muted);
}
.filler-links {
  display: grid;
  gap: .45rem;
  margin-top: auto;
}
.filler-links a {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .45rem .7rem;
  background: var(--surface);
  color: var(--accent-2);
  font-weight: 800;
  font-size: .9rem;
}
.filler-links a:hover {
  border-color: var(--accent);
  color: var(--accent);
}
@media (max-width: 860px) {
  .post-filler {
    grid-template-columns: 1fr;
  }
}
/* Compact sidebar while reading */
.left-sidebar {
  gap: .75rem;
}
.profile-card {
  min-height: auto;
  padding: 1.15rem 1rem 1rem;
}
.author-avatar {
  width: 76px;
  height: 76px;
  margin-bottom: .55rem;
  border-width: 3px;
}
.profile-card h3 {
  margin: .1rem 0 .2rem;
  font-size: 1.18rem;
}
.profile-card p {
  margin-bottom: .7rem;
  font-size: .84rem;
  line-height: 1.45;
}
.author-stats {
  margin-top: .35rem;
}
.author-stats strong {
  font-size: 1.08rem;
}
.author-stats small {
  font-size: .72rem;
}
.sidebar-card {
  padding: 1rem;
}
.toc-card .toc-list {
  gap: .35rem;
}
.toc-list a {
  padding: .48rem .55rem;
}
body.is-reading .left-sidebar {
  top: 76px;
  gap: .6rem;
}
body.is-reading .profile-card {
  padding: 1rem .9rem .85rem;
}
body.is-reading .author-avatar {
  width: 68px;
  height: 68px;
  margin-bottom: .45rem;
}
body.is-reading .profile-card h3 {
  font-size: 1.05rem;
}
body.is-reading .profile-card p {
  margin-bottom: .55rem;
  font-size: .78rem;
}
body.is-reading .author-stats strong {
  font-size: 1rem;
}
body.is-reading .author-stats small {
  font-size: .68rem;
}
body.is-reading .category-card,
body.is-reading .latest-card {
  display: none;
}
body.is-reading .toc-card {
  padding: .95rem;
}
body.is-reading .toc-list a {
  padding: .45rem .55rem;
  font-size: .9rem;
}
@media (max-width: 960px) {
  body.is-reading .category-card,
  body.is-reading .latest-card {
    display: block;
  }
}
/* Reading TOC stays near top */
body.is-reading .left-sidebar {
  position: sticky;
  top: 76px;
  align-self: start;
  max-height: calc(100vh - 92px);
  overflow: visible;
}
body.is-reading .profile-card {
  min-height: 0;
  max-height: 210px;
  overflow: hidden;
}
body.is-reading .author-avatar {
  width: 58px;
  height: 58px;
}
body.is-reading .profile-card p {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
body.is-reading .author-stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
body.is-reading .toc-card {
  max-height: calc(100vh - 320px);
  overflow: hidden;
}
body.is-reading .toc-card .toc-list {
  max-height: calc(100vh - 390px);
  overflow-y: auto;
  padding-right: .25rem;
  scrollbar-width: thin;
}
body.is-reading .toc-list a {
  display: block;
  line-height: 1.45;
  max-height: 3.1em;
  overflow: hidden;
}
@media (max-width: 960px) {
  body.is-reading .left-sidebar {
    position: static;
    max-height: none;
  }
  body.is-reading .profile-card,
  body.is-reading .toc-card,
  body.is-reading .toc-card .toc-list {
    max-height: none;
    overflow: visible;
  }
}
/* Article return link */
.toc-list .toc-back {
  border-left-color: var(--accent);
  color: var(--accent);
  background: color-mix(in srgb, var(--accent), transparent 92%);
  border-radius: 0 12px 12px 0;
  font-weight: 900;
}
.toc-list .toc-back:hover {
  background: color-mix(in srgb, var(--accent), transparent 86%);
}
.close-reader {
  margin-bottom: 1rem;
}