:root {
  --accent: #0868d7;
  --site-width: 1160px;
  --ink: #111315;
  --muted: #66717c;
  --line: #e7e9ec;
  --paper: #ffffff;
  --soft: #f7f8fa;
  --reading-width: 760px;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.75;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

img,
video {
  max-width: 100%;
  height: auto;
}

button,
input,
textarea {
  font: inherit;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  padding: 8px 12px;
  background: var(--ink);
  color: #fff;
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.utility-bar {
  min-height: 40px;
  background: #151719;
  color: #fff;
}

.utility-inner {
  width: min(var(--site-width), calc(100% - 48px));
  margin: 0 auto;
}

.utility-inner ul,
.primary-nav ul {
  display: flex;
  align-items: center;
  gap: 24px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.utility-inner a {
  display: block;
  padding: 8px 0;
  font-size: 14px;
  font-weight: 650;
  letter-spacing: 0.02em;
}

.utility-inner a:hover,
.utility-inner a:focus-visible {
  color: #b9d9ff;
}

.site-header {
  width: min(var(--site-width), calc(100% - 48px));
  margin: 0 auto;
}

.brand-block {
  padding: 42px 0 50px;
  text-align: center;
}

.site-title {
  display: inline-block;
  font-size: clamp(24px, 3vw, 34px);
  font-weight: 750;
  line-height: 1.25;
  letter-spacing: -0.035em;
}

.site-tagline {
  margin: 12px 0 0;
  color: #3f4851;
  font-size: 14px;
}

.primary-row {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 64px;
  border-bottom: 1px solid transparent;
}

.primary-nav {
  margin: 0 auto;
}

.primary-nav a {
  position: relative;
  display: block;
  padding: 17px 0;
  font-size: 15px;
  font-weight: 600;
}

.primary-nav a::after {
  content: "";
  position: absolute;
  right: 50%;
  bottom: 9px;
  left: 50%;
  height: 2px;
  background: var(--ink);
  transition: right 180ms ease, left 180ms ease;
}

.primary-nav a:hover::after,
.primary-nav a:focus-visible::after {
  right: 0;
  left: 0;
}

.search-button {
  position: absolute;
  right: 0;
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
}

.search-button svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.search-button:hover,
.search-button:focus-visible {
  color: var(--accent);
}

.menu-toggle {
  display: none;
  width: 42px;
  height: 42px;
  padding: 10px;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.menu-toggle > span:not(.sr-only) {
  display: block;
  height: 2px;
  margin: 4px 0;
  background: currentColor;
  transition: transform 180ms ease, opacity 180ms ease;
}

.site-main {
  width: min(var(--site-width), calc(100% - 48px));
  min-height: 50vh;
  margin: 0 auto;
}

.home-list {
  padding: 92px 0 64px;
}

.post-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 78px 64px;
}

.post-card {
  min-width: 0;
}

.post-card--featured {
  grid-column: 1 / -1;
  max-width: 860px;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 22px;
  color: var(--accent);
  font-size: 13px;
  letter-spacing: 0.035em;
}

.post-meta a:hover,
.post-meta a:focus-visible {
  text-decoration: underline;
}

.post-meta i {
  width: 38px;
  height: 1px;
  background: currentColor;
}

.post-title {
  margin: 12px 0 10px;
  max-width: 100%;
  font-size: clamp(20px, 2vw, 25px);
  line-height: 1.42;
  letter-spacing: -0.025em;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.post-card--featured .post-title {
  font-size: clamp(23px, 2.6vw, 31px);
}

.post-title a:hover,
.post-title a:focus-visible {
  color: var(--accent);
}

.post-excerpt {
  display: -webkit-box;
  min-height: 3.5em;
  margin: 0;
  overflow: hidden;
  color: #353c43;
  line-height: 1.82;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.post-card--featured .post-excerpt {
  -webkit-line-clamp: 2;
}

.read-more {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-top: 27px;
  font-size: 14px;
  font-weight: 700;
}

.read-more > span {
  width: 30px;
  height: 1px;
  background: currentColor;
  transition: width 180ms ease;
}

.read-more:hover,
.read-more:focus-visible {
  color: var(--accent);
}

.read-more:hover > span,
.read-more:focus-visible > span {
  width: 42px;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  margin-top: 84px;
  color: var(--muted);
  font-size: 14px;
}

.pagination a {
  color: var(--ink);
  font-weight: 650;
}

.pagination a:hover {
  color: var(--accent);
}

.empty-state {
  padding: 80px 0;
  color: var(--muted);
  text-align: center;
}

.listing-page,
.archive-page,
.term-page {
  padding: 62px 0 82px;
}

.listing-header {
  margin-bottom: 62px;
  text-align: center;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.listing-header h1 {
  margin: 0;
  font-size: clamp(30px, 5vw, 48px);
  letter-spacing: -0.045em;
}

.article-shell {
  width: min(var(--reading-width), 100%);
  margin: 0 auto;
  padding: 66px 0 88px;
}

.article-header {
  margin-bottom: 54px;
  text-align: center;
}

.article-header h1 {
  margin: 18px 0 0;
  font-size: clamp(34px, 6vw, 58px);
  line-height: 1.2;
  letter-spacing: -0.05em;
}

.article-header--page h1 {
  margin-top: 6px;
}

.post-meta--center {
  justify-content: center;
}

.article-excerpt {
  max-width: 620px;
  margin: 24px auto 0;
  color: var(--muted);
  font-size: 17px;
}

.article-content {
  font-size: 17px;
  line-height: 1.95;
  overflow-wrap: anywhere;
}

.article-content > *:first-child {
  margin-top: 0;
}

.article-content h2,
.article-content h3,
.article-content h4 {
  margin-top: 2.2em;
  margin-bottom: 0.7em;
  line-height: 1.4;
  letter-spacing: -0.025em;
}

.article-content h2 {
  font-size: 1.65em;
}

.article-content h3 {
  font-size: 1.3em;
}

.article-content a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.article-content blockquote {
  margin: 2em 0;
  padding: 4px 0 4px 22px;
  border-left: 3px solid var(--accent);
  color: #4a535d;
}

.article-content pre {
  overflow-x: auto;
  padding: 20px;
  border-radius: 4px;
  background: #16191d;
  color: #f4f6f8;
  font-size: 14px;
  line-height: 1.7;
}

.article-content code:not(pre code) {
  padding: 0.15em 0.38em;
  border-radius: 3px;
  background: #eef1f4;
  font-size: 0.9em;
}

.article-content img {
  display: block;
  margin: 2.2em auto;
}

.article-content table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
}

.article-content th,
.article-content td {
  padding: 10px 14px;
  border: 1px solid var(--line);
}

.article-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 54px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}

.article-footer a {
  color: var(--accent);
}

.comments {
  margin-top: 64px;
  padding-top: 34px;
  border-top: 1px solid var(--line);
}

.comments h2 {
  margin: 0 0 22px;
  font-size: 22px;
}

.archive-page {
  width: min(820px, 100%);
  margin: 0 auto;
}

.archive-year {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 20px;
  padding: 30px 0;
  border-top: 1px solid var(--line);
}

.archive-year h2 {
  margin: 0;
  font-size: 28px;
}

.archive-item {
  display: grid;
  grid-template-columns: 62px 1fr;
  gap: 14px;
  padding: 8px 0;
}

.archive-item time {
  color: var(--muted);
  font-size: 13px;
}

.archive-item a:hover {
  color: var(--accent);
}

.term-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.term-grid > a {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 24px;
  border: 1px solid var(--line);
  transition: border-color 180ms ease, transform 180ms ease;
}

.term-grid > a:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.term-grid span {
  color: var(--muted);
  font-size: 13px;
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.tag-cloud a {
  padding: 7px 13px;
  border: 1px solid var(--line);
  font-size: 14px;
}

.tag-cloud a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.error-page {
  width: min(620px, 100%);
  margin: 0 auto;
  padding: 100px 0;
  text-align: center;
}

.error-code {
  margin: 0;
  color: var(--accent);
  font-size: 70px;
  font-weight: 800;
  line-height: 1;
}

.error-page h1 {
  margin: 24px 0 10px;
}

.site-footer {
  margin-top: 42px;
  border-top: 1px solid var(--line);
}

.footer-inner {
  width: min(var(--site-width), calc(100% - 48px));
  margin: 0 auto;
  padding: 34px 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.footer-inner p {
  margin: 0;
}

@media (max-width: 900px) {
  .post-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 62px 42px;
  }

  .term-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  body {
    font-size: 15px;
  }

  .utility-bar {
    display: none;
  }

  .site-header,
  .site-main,
  .footer-inner {
    width: min(100% - 38px, var(--site-width));
  }

  .brand-block {
    padding: 38px 0 42px;
  }

  .site-title {
    font-size: 25px;
  }

  .site-tagline {
    max-width: 270px;
    margin-right: auto;
    margin-left: auto;
    line-height: 1.7;
  }

  .primary-row {
    min-height: 56px;
  }

  .menu-toggle {
    display: block;
    margin-left: -10px;
  }

  .menu-toggle.is-open > span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
  }

  .menu-toggle.is-open > span:nth-child(2) {
    opacity: 0;
  }

  .menu-toggle.is-open > span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
  }

  .primary-nav {
    position: absolute;
    top: 52px;
    right: 0;
    left: 0;
    z-index: 20;
    display: none;
    padding: 10px 0 18px;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    background: #fff;
  }

  .primary-nav.is-open {
    display: block;
  }

  .primary-nav ul {
    flex-direction: column;
    gap: 0;
  }

  .primary-nav a {
    padding: 9px 0;
  }

  .primary-nav a::after {
    display: none;
  }

  .home-list {
    padding: 62px 0 36px;
  }

  .post-grid {
    grid-template-columns: 1fr;
    gap: 52px;
  }

  .post-card--featured {
    grid-column: auto;
  }

  .post-card--featured .post-title,
  .post-title {
    font-size: 22px;
  }

  .post-card--featured .post-excerpt,
  .post-excerpt {
    -webkit-line-clamp: 4;
  }

  .listing-page,
  .archive-page,
  .term-page {
    padding: 44px 0 58px;
  }

  .listing-header {
    margin-bottom: 44px;
  }

  .article-shell {
    padding: 45px 0 62px;
  }

  .article-header {
    margin-bottom: 40px;
  }

  .article-header h1 {
    font-size: 34px;
  }

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

  .archive-year {
    grid-template-columns: 1fr;
  }

  .term-grid {
    grid-template-columns: 1fr;
  }
}

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