:root {
  --bg: #ffffff;
  --bg-soft: #f7fafd;
  --line: #e3ecf5;
  --ink: #1f2937;
  --ink-2: #5b6b7f;
  --blue: #2b6cb0;
  --blue-soft: #eaf2fb;
  --amber: #d9772f;
  --green: #3f8f6b;
  --sans: -apple-system, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --measure: 700px;
  --wrap: 1080px;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}

/* Short pages keep the footer on the floor: main takes the leftover height. */
body > main {
  flex: 1 0 auto;
  width: 100%;
}

a {
  color: var(--blue);
}

a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
  border-radius: 2px;
}

::selection {
  background: var(--blue-soft);
  color: var(--ink);
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 10;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--blue);
  border-radius: 4px;
  color: var(--blue);
  font-size: 14px;
  text-decoration: none;
}

.skip-link:focus {
  top: 12px;
}

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

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding-left: 24px;
  padding-right: 24px;
}

/* Header: one 2px color bar, compact enough that posts start above the fold. */
.site-header {
  border-top: 2px solid var(--blue);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 32px;
  padding-top: 20px;
  padding-bottom: 18px;
}

.identity {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 14px;
  min-width: 0;
}

.brand {
  color: var(--ink);
  font-size: 20px;
  font-weight: 650;
  line-height: 1.4;
  text-decoration: none;
}

.brand:hover {
  color: var(--blue);
}

.tagline {
  margin: 0;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.6;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
  margin-left: auto;
  padding-top: 2px;
}

.nav a {
  padding: 2px 0;
  border-bottom: 2px solid transparent;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.6;
  text-decoration: none;
}

.nav a:hover {
  color: var(--blue);
}

.nav a[aria-current="page"] {
  border-bottom-color: var(--blue);
  color: var(--blue);
}

/* Post index: a thin year label instead of repeating the nav's "文章". */
.post-index {
  padding-top: 22px;
}

.year-group + .year-group {
  margin-top: 32px;
}

.year-label {
  margin: 0 0 2px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
}

.post-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.post-row {
  border-bottom: 1px solid var(--line);
}

.post-link {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 0 24px;
  padding: 20px 0 20px 16px;
  border-left: 2px solid var(--blue);
  color: inherit;
  text-decoration: none;
  transition: transform 160ms ease, border-color 160ms ease;
}

/* Same feedback for pointer and keyboard: the rail turns amber, the row steps right. */
.post-link:hover,
.post-link:focus-visible {
  border-left-color: var(--amber);
  transform: translateX(2px);
}

.post-date {
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.9;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.post-main {
  display: block;
  min-width: 0;
}

.post-title {
  margin: 0 0 3px;
  color: var(--ink);
  font-size: 21px;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: normal;
}

.post-title {
  text-wrap: balance;
}

.post-summary {
  display: block;
  margin: 0 0 9px;
  color: var(--ink-2);
  font-size: 14.5px;
  line-height: 1.7;
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  padding: 1px 7px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 12px;
  line-height: 1.65;
}

.post-link:hover .post-title,
.post-link:focus-visible .post-title {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

/* Article */
.post,
.page {
  max-width: var(--measure);
  margin: 0 auto;
}

.post-header {
  margin-bottom: 28px;
  padding: 34px 0 24px;
  border-bottom: 1px solid var(--line);
}

.article-title {
  margin: 0 0 12px;
  color: var(--ink);
  font-size: clamp(1.65rem, 4vw, 2.25rem);
  font-weight: 650;
  line-height: 1.35;
  letter-spacing: normal;
  text-wrap: balance;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin: 0;
  color: var(--ink-2);
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
}

.meta-sep {
  color: var(--line);
}

.prose {
  color: var(--ink);
  font-size: 17px;
  line-height: 1.75;
}

.prose > :first-child {
  margin-top: 0;
}

.prose p {
  margin: 0 0 1.15em;
  text-wrap: pretty;
}

.prose h2 {
  margin: 2.1em 0 0.75em;
  padding-left: 12px;
  border-left: 2px solid var(--blue);
  color: var(--ink);
  font-size: clamp(1.25rem, 2.4vw, 1.45rem);
  font-weight: 650;
  line-height: 1.45;
  letter-spacing: normal;
}

.prose h3 {
  margin: 1.7em 0 0.55em;
  color: var(--ink);
  font-size: 1.08rem;
  font-weight: 650;
  line-height: 1.5;
  letter-spacing: normal;
}

.prose ul,
.prose ol {
  margin: 0 0 1.15em;
  padding-left: 1.5em;
}

.prose li {
  margin: 0.3em 0;
  padding-left: 0.15em;
}

.prose li::marker {
  color: var(--blue);
}

.prose blockquote {
  margin: 1.5em 0;
  padding: 14px 18px;
  border-left: 2px solid var(--blue);
  background: var(--bg-soft);
  color: var(--ink-2);
}

.prose blockquote p {
  margin: 0;
}

.prose code {
  padding: 0.12em 0.38em;
  border-radius: 4px;
  background: var(--blue-soft);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.885em;
  overflow-wrap: anywhere;
}

.prose pre {
  margin: 0 0 1.3em;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg-soft);
  line-height: 1.65;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.prose pre code {
  display: block;
  padding: 0;
  border-radius: 0;
  background: none;
  color: var(--ink);
  font-size: 13.5px;
  overflow-wrap: normal;
  white-space: pre;
}

.prose a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.prose a:hover {
  color: var(--ink);
}

.prose strong {
  font-weight: 650;
}

.table-wrap {
  margin: 0 0 1.4em;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
  line-height: 1.6;
}

.prose th,
.prose td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.prose th {
  background: var(--bg-soft);
  color: var(--ink);
  font-weight: 600;
  white-space: nowrap;
}

.prose tr:last-child td {
  border-bottom: 0;
}

/* Previous / next */
.post-nav {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  margin-top: 56px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.post-nav-link {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  color: var(--ink);
  text-decoration: none;
}

.post-nav-next {
  text-align: right;
}

.post-nav-label {
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1.6;
}

.post-nav-title {
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.55;
}

.post-nav-link:hover .post-nav-title {
  color: var(--blue);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.post-nav-link.is-empty,
.post-nav-link.is-empty .post-nav-title {
  color: var(--ink-2);
}

/* About and 404 */
.page {
  padding-top: 40px;
}

.page h1 {
  margin: 0 0 18px;
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  font-weight: 650;
  line-height: 1.3;
  letter-spacing: normal;
}

.page .lede {
  max-width: 640px;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.75;
}

.page .about-note {
  margin-top: 30px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 14.5px;
}

.service-table td:first-child {
  color: var(--ink);
  font-weight: 600;
  white-space: nowrap;
}

.status {
  color: var(--green);
  font-size: 13px;
  white-space: nowrap;
}

.notfound {
  padding: 56px 0 0;
}

.notfound .kicker {
  margin: 0 0 10px;
  color: var(--amber);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
}

.notfound p {
  color: var(--ink-2);
}

.text-link {
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

/* Footer: one line, no icon wall. */
.site-footer {
  margin-top: 72px;
  border-top: 1px solid var(--line);
  background: var(--bg);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 24px;
  padding-top: 18px;
  padding-bottom: 24px;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.6;
}

.footer-inner a {
  color: var(--ink-2);
  text-decoration: none;
}

.footer-inner a:hover {
  color: var(--blue);
  text-decoration: underline;
  text-underline-offset: 3px;
}

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

  .wrap {
    padding-left: 16px;
    padding-right: 16px;
  }

  .header-inner {
    gap: 8px 18px;
    padding-top: 16px;
    padding-bottom: 14px;
  }

  .identity {
    gap: 2px 12px;
  }

  .brand {
    font-size: 18px;
  }

  .tagline {
    width: 100%;
    font-size: 13px;
  }

  .nav {
    width: 100%;
    margin-left: 0;
    padding-top: 0;
    gap: 4px 18px;
  }

  .post-index {
    padding-top: 18px;
  }

  .post-link {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
    padding: 16px 0 16px 12px;
  }

  .post-date {
    font-size: 12px;
    line-height: 1.6;
  }

  .post-title {
    font-size: 18px;
  }

  .post-summary {
    font-size: 14px;
  }

  .post-header {
    padding-top: 26px;
    padding-bottom: 20px;
    margin-bottom: 24px;
  }

  .prose {
    font-size: 16px;
  }

  .prose pre {
    padding: 12px 13px;
  }

  .prose th,
  .prose td {
    padding: 8px 10px;
  }

  .post-nav {
    grid-template-columns: minmax(0, 1fr);
    margin-top: 44px;
  }

  .post-nav-next {
    text-align: left;
  }

  .page {
    padding-top: 30px;
  }

  .page .lede {
    font-size: 17px;
  }

  .notfound {
    padding-top: 40px;
  }

  .site-footer {
    margin-top: 56px;
  }
}

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