:root {
  --bg: #ffffff;
  --text: #111111;
  --text-secondary: #4a4a4a;
  --text-muted: #8a8a8a;
  --accent: #111111;
  --accent-hover: #000000;
  --border: #ececec;
  --pill-bg: #f0f0f0;
  --code-bg: #f6f6f6;
  --header-h: 74px;
  --content-w: 1080px;
  --font-display: "Plus Jakarta Sans", "Noto Sans SC", sans-serif;
  --font-sans: "Inter", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: "JetBrains Mono", "Cascadia Code", "Consolas", monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  overflow-x: clip;
  overflow-y: scroll;
  scrollbar-gutter: stable;
}

body {
  overflow-x: clip;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s, opacity 0.2s;
}

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

.site-frame {
  display: flex;
  flex-direction: column;
  flex: 1 0 auto;
  width: 100%;
  max-width: var(--content-w);
  margin: 0 auto;
  padding: 0 40px;
  min-width: 0;
}

.site-frame--article {
  max-width: var(--content-w);
  padding: 0 40px;
}

.footer-inner {
  width: 100%;
  margin: 0;
  padding: 0;
}

.page-shell {
  flex: 1 0 auto;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 40px 0 96px;
  min-width: 0;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 28px;
  position: relative;
  width: 100%;
  max-width: var(--content-w);
  margin: 0 auto;
  padding: 22px 40px;
}

.header-inner::after {
  content: "";
  position: absolute;
  left: 40px;
  right: 40px;
  bottom: 0;
  height: 1px;
  background: var(--border);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.site-header.is-scrolled .header-inner::after {
  opacity: 1;
}

.brand {
  display: block;
  flex-shrink: 0;
  line-height: 0;
}

.brand-logo {
  display: block;
  height: 29px;
  width: auto;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.header-nav-link {
  display: block;
  padding: 11px 10px;
  border-radius: 6px;
  color: #282624;
  font-size: 15px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.02em;
  transition: background 0.2s ease, color 0.2s ease;
}

.header-nav-link:hover,
.page-home .header-nav-link[data-nav="blog"],
.page-article .header-nav-link[data-nav="blog"],
.page-about .header-nav-link[data-nav="about"] {
  color: var(--text);
  background: #f6f5f3;
}

.feed-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px 32px;
  width: 100%;
  min-width: 0;
  margin-bottom: 72px;
  animation: page-enter 0.7s cubic-bezier(0.19, 1, 0.22, 1) 0.08s both;
}

.feed-hero-copy h1 {
  font-family: var(--font-display);
  font-size: clamp(40px, 6vw, 42px);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.05;
  color: var(--text);
}

.feed-hero-copy p {
  margin-top: 10px;
  font-size: 15px;
  color: var(--text-muted);
}

.feed-hero-brand {
  color: var(--text-secondary);
}

.feed-hero-brand:hover {
  color: var(--text);
}

.about-body {
  animation: page-enter 0.7s cubic-bezier(0.19, 1, 0.22, 1) 0.22s both;
}

.about-name {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
}

.about-tagline {
  margin-top: 10px;
  font-size: 17px;
  color: var(--text-secondary);
}

.about-contact {
  margin-top: 28px;
  padding-left: 1.15em;
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.9;
  list-style: disc;
}

.about-contact li {
  margin-bottom: 4px;
}

.about-contact a {
  color: var(--text-secondary);
}

.about-contact strong {
  color: var(--text);
  font-weight: 600;
}

.about-contact a:hover {
  color: var(--text);
}

.filter-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}

.filter-pill {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  height: 36px;
  padding: 0 16px;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  line-height: 36px;
  outline: none;
}

.filter-pill:hover {
  color: var(--text);
  background: var(--pill-bg);
}

.filter-pill.active,
.filter-pill:focus-visible {
  background: var(--pill-bg);
  color: var(--text);
}

.feed {
  display: flex;
  flex-direction: column;
  min-width: 0;
  animation: page-enter 0.7s cubic-bezier(0.19, 1, 0.22, 1) 0.28s both;
  transition: opacity 0.22s cubic-bezier(0.25, 0.1, 0.5, 1);
}

.feed.is-swapping {
  opacity: 0;
  pointer-events: none;
}

.article-item {
  display: grid;
  grid-template-columns: 160px minmax(0, 1.05fr) minmax(0, 1.2fr);
  gap: 32px 40px;
  align-items: start;
  min-width: 0;
  padding: 40px 0;
  border-top: 1px solid var(--border);
  color: inherit;
  cursor: pointer;
}

.article-item:hover,
.article-item:focus-visible {
  color: inherit;
  opacity: 0.7;
}

.article-item.hidden {
  display: none;
}

.article-item-date {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
  padding-top: 4px;
}

.article-item-main,
.article-item-excerpt {
  min-width: 0;
}

.article-item-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.3;
  margin-bottom: 10px;
  max-width: 100%;
  color: var(--text);
  overflow-wrap: anywhere;
}

.article-item-tags {
  font-size: 14px;
  color: var(--text-muted);
}

.article-item-excerpt {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.7;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.page-shell--article {
  position: relative;
  max-width: none;
  padding: 48px 0 96px;
}

.article-panel {
  min-width: 0;
  animation: page-enter 0.7s cubic-bezier(0.19, 1, 0.22, 1) both;
}

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

.article-header .meta {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 20px;
}

.article-header .meta .category {
  color: var(--text-muted);
}

.article-header h1 {
  font-family: var(--font-display);
  font-size: clamp(32px, 5vw, 42px);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.15;
  color: var(--text);
}

.article-body h2,
.article-body h3 {
  scroll-margin-top: calc(var(--header-h) + 16px);
}

.article-body h2 {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 48px 0 16px;
  color: var(--text);
}

.article-body h3 {
  font-size: 18px;
  font-weight: 600;
  margin: 32px 0 12px;
}

.article-body p {
  margin-bottom: 20px;
  color: var(--text-secondary);
  font-size: 17px;
  line-height: 1.8;
  overflow-wrap: break-word;
}

.article-body ul,
.article-body ol {
  margin: 0 0 20px 22px;
  color: var(--text-secondary);
  font-size: 17px;
  line-height: 1.8;
}

.article-body li {
  margin-bottom: 8px;
}

.article-body a {
  text-decoration: underline;
  text-underline-offset: 3px;
  word-break: break-word;
}

.article-body strong {
  color: var(--text);
  font-weight: 600;
}

.article-body code {
  background: var(--code-bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.88em;
  color: var(--text);
  font-family: var(--font-mono);
}

.article-body pre {
  background: var(--code-bg);
  border-radius: 10px;
  padding: 16px;
  overflow-x: auto;
  max-width: 100%;
  margin: 16px 0 24px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
}

.article-body pre code {
  background: none;
  padding: 0;
}

.article-body blockquote {
  border-left: 2px solid var(--border);
  padding-left: 16px;
  margin: 20px 0;
  color: var(--text-muted);
}

.article-body img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}

.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0 24px;
  font-size: 14px;
}

.article-body th,
.article-body td {
  border-bottom: 1px solid var(--border);
  padding: 10px 8px;
  text-align: left;
  color: var(--text-secondary);
}

.article-body th {
  color: var(--text);
  font-weight: 600;
}

.loading-text {
  color: var(--text-muted);
}

.sidebar-toc {
  display: none;
}

.sidebar-toc[hidden] {
  display: none !important;
}

.toc-article {
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.toc-article-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.45;
  color: var(--text);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.toc-article-meta {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

.toc-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.toc {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.toc-empty {
  font-size: 13px;
  color: var(--text-muted);
}

.toc-link {
  display: block;
  padding: 4px 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.45;
  text-decoration: none;
  outline: none;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.toc-link:hover {
  color: var(--text);
}

.toc-link.active,
.toc-link:focus-visible {
  color: var(--text);
  font-weight: 500;
}

.toc-link.toc-h3 {
  padding-left: 12px;
  font-size: 12px;
}

.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding: 28px 0 40px;
}

.footer-inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px 40px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.6;
}

.footer-inner .footer-brand,
.footer-inner .footer-brand:hover {
  display: block;
  line-height: 0;
  flex-shrink: 0;
  color: inherit;
}

.footer-legal {
  text-align: right;
}

.footer-legal p {
  margin-bottom: 6px;
}

.footer-inner a {
  color: var(--text-muted);
}

.footer-inner a:hover {
  color: var(--text);
}

.footer-legal a {
  display: block;
}

.footer-legal img {
  height: 14px;
  width: auto;
  vertical-align: middle;
  margin-right: 4px;
}

@media (min-width: 1480px) {
  .sidebar-toc {
    display: block;
    position: fixed;
    top: calc(var(--header-h) + 48px);
    left: calc(50% + (var(--content-w) / 2) + 32px);
    width: min(240px, calc(50% - (var(--content-w) / 2) - 48px));
    max-width: 240px;
    min-width: 0;
    box-sizing: border-box;
    max-height: calc(100vh - var(--header-h) - 72px);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    transform: none;
  }

  .toc {
    position: static;
    max-height: none;
    overflow: visible;
    min-width: 0;
  }
}

@media (max-width: 900px) {
  .article-item {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    padding: 28px 0;
  }

  .article-item-date {
    padding-top: 0;
  }
}

@media (max-width: 768px) {
  .brand-logo {
    height: 24px;
  }

  .header-inner {
    padding: 16px 20px;
    gap: 12px;
  }

  .header-nav-link {
    padding: 8px 8px;
    font-size: 14px;
  }

  .header-inner::after {
    left: 20px;
    right: 20px;
  }

  .site-frame,
  .site-frame--article {
    padding-left: 20px;
    padding-right: 20px;
  }

  .page-shell {
    padding-top: 32px;
    padding-bottom: 64px;
  }

  .feed-hero {
    flex-direction: column;
    align-items: stretch;
    margin-bottom: 36px;
  }

  .filter-pills {
    justify-content: flex-start;
  }

  .filter-pill {
    height: 32px;
    padding: 0 12px;
    line-height: 32px;
  }

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

  .article-body p,
  .article-body ul,
  .article-body ol {
    font-size: 16px;
  }

  .article-item-title {
    font-size: 20px;
  }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .footer-legal {
    text-align: left;
  }
}

@keyframes page-enter {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .feed-hero,
  .feed,
  .article-panel,
  .about-body {
    animation: none;
  }

  .feed {
    transition: none;
  }
}
