:root {
  --bg: #f4f4ef;
  --surface: #fffdf6;
  --surface-2: #ece9df;
  --ink: #151515;
  --ink-soft: #34342f;
  --muted: #6d6b63;
  --line: #d8d2c2;
  --line-strong: #25251f;
  --accent: #0b6b58;
  --accent-2: #b54724;
  --accent-3: #344b7a;
  --shadow: 0 8px 18px rgb(20 20 16 / 8%);
  --mono: ui-monospace, "SFMono-Regular", "Menlo", "Consolas", monospace;
  --sans: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", "Inter", system-ui, sans-serif;
  --serif: "Songti SC", "Noto Serif SC", "STSong", Georgia, serif;
  --shell: min(1120px, calc(100vw - 32px));
  --narrow: min(760px, calc(100vw - 32px));
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background: var(--bg);
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgb(21 21 21 / 4%) 1px, transparent 1px) 0 0 / 80px 80px,
    linear-gradient(180deg, #f8f7f1 0, var(--bg) 420px);
  font-family: var(--sans);
  line-height: 1.72;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

img {
  display: block;
  max-width: 100%;
}

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

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

p,
li,
dd {
  font-size: 1rem;
}

h1,
h2,
h3 {
  margin: 0;
  color: var(--ink);
  font-weight: 760;
  line-height: 1.08;
  letter-spacing: 0;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.25rem, 6.4vw, 5.4rem);
}

h2 {
  font-size: clamp(1.5rem, 3vw, 2.55rem);
}

h3 {
  font-size: clamp(1.12rem, 1.8vw, 1.45rem);
}

main {
  flex: 1;
}

.shell {
  width: var(--shell);
  margin-inline: auto;
}

.shell--narrow {
  width: var(--narrow);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line-strong);
  background: rgb(244 244 239 / 92%);
  backdrop-filter: blur(12px);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 68px;
}

.site-mark {
  display: inline-flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
}

.site-mark__badge {
  font-family: var(--mono);
  font-size: 0.95rem;
  font-weight: 760;
  letter-spacing: 0.02em;
}

.site-mark__text {
  color: var(--muted);
  font-size: 0.95rem;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.site-nav__link {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border: 1px solid transparent;
  color: var(--muted);
  font-size: 0.96rem;
}

.site-nav__link:hover,
.site-nav__link.is-active {
  color: var(--ink);
  border-color: var(--line-strong);
  background: var(--surface);
}

.site-footer {
  margin-top: clamp(48px, 8vw, 96px);
  border-top: 1px solid var(--line-strong);
  background: #ece9df;
}

.site-footer__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 0 32px;
}

.site-footer__title {
  margin: 0;
  font-family: var(--mono);
  font-weight: 760;
}

.site-footer__meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.95rem;
}

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

.section {
  padding: clamp(48px, 8vw, 88px) 0;
}

.section--tight,
.section--compact {
  padding-top: clamp(28px, 5vw, 52px);
  padding-bottom: clamp(28px, 5vw, 52px);
}

.section--pagehead {
  padding-bottom: 24px;
}

.section--article {
  padding-top: clamp(34px, 6vw, 64px);
}

.kicker,
.home-hero__kicker,
.home-note__label,
.home-section-head__label,
.section-heading__eyebrow,
.taxonomy-card__eyebrow,
.topic-strip__label,
.category-directory__label,
.featured-project__status,
.project-card__status,
.article-related__head p {
  margin: 0 0 10px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.82rem;
  font-weight: 700;
}

.lede {
  max-width: 36rem;
  margin: 18px 0 0;
  color: var(--ink-soft);
  font-size: clamp(1.12rem, 2vw, 1.35rem);
  line-height: 1.55;
}

.quiet {
  max-width: 34rem;
  margin: 12px 0 0;
  color: var(--muted);
}

.button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink);
  font-weight: 700;
  transition: transform 180ms ease, background 180ms ease, color 180ms ease;
}

.button:hover {
  transform: translateY(-1px);
  background: var(--ink);
  color: var(--surface);
}

.button--primary {
  background: var(--ink);
  color: var(--surface);
}

.button--primary:hover {
  background: var(--accent);
}

.button--secondary,
.button--ghost {
  background: transparent;
  color: var(--ink);
}

.action-row,
.home-intro__actions,
.about-summary__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 28px;
}

.home-hero {
  border-bottom: 1px solid var(--line-strong);
}

.home-hero__inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: clamp(32px, 7vw, 88px);
  align-items: end;
  padding: clamp(54px, 10vw, 116px) 0 clamp(42px, 7vw, 72px);
}

.home-hero__main h1 {
  max-width: 8ch;
  font-family: var(--serif);
  font-weight: 800;
}

.profile-panel,
.plain-panel,
.about-page,
.about-summary,
.archive-overview,
.taxonomy-card,
.category-directory__card,
.category-hero,
.topic-strip,
.project-card,
.article-taxonomy__block,
.article__pager-link,
.article-toc,
.home-note,
.archive-empty {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  box-shadow: none;
  border-radius: 0;
}

.profile-panel {
  padding: 18px;
}

.profile-panel img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border: 1px solid var(--line-strong);
  margin-bottom: 16px;
}

.profile-panel strong {
  display: block;
  font-size: 1.1rem;
}

.profile-panel a {
  display: inline-flex;
  margin-top: 3px;
  color: var(--muted);
}

.profile-panel dl {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  margin: 18px -18px -18px;
  border-top: 1px solid var(--line-strong);
}

.profile-panel dl div {
  padding: 12px;
  border-right: 1px solid var(--line-strong);
}

.profile-panel dl div:last-child {
  border-right: 0;
}

.profile-panel dt {
  color: var(--muted);
  font-size: 0.82rem;
}

.profile-panel dd {
  margin: 2px 0 0;
  font-family: var(--mono);
  font-weight: 740;
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: clamp(28px, 5vw, 56px);
  align-items: start;
}

.section-head,
.home-section-head,
.archive-group__head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.section-head {
  display: block;
}

.record-list,
.post-list,
.archive-list,
.archive-stack {
  display: grid;
}

.record-row,
.post-row,
.archive-row {
  display: grid;
  grid-template-columns: minmax(150px, 210px) minmax(0, 1fr);
  gap: 22px;
  padding: 20px 0;
  border-top: 1px solid var(--line);
}

.record-row:last-child,
.post-row:last-child,
.archive-row:last-child {
  border-bottom: 1px solid var(--line);
}

.record-row__meta,
.post-row__meta,
.archive-row__meta,
.article__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  color: var(--muted);
  font-size: 0.88rem;
}

.archive-row__meta {
  flex-wrap: wrap;
}

.record-row h3,
.post-row__content h3,
.archive-row__content h3 {
  max-width: 30ch;
}

.record-row h3 a:hover,
.post-row__content h3 a:hover,
.archive-row__content h3 a:hover,
.article__pager-link:hover strong {
  color: var(--accent);
}

.record-row p,
.post-row__content p,
.archive-row__content p,
.project-card__body p,
.featured-project__body p,
.taxonomy-card p,
.category-directory__card p,
.category-hero__description,
.section-heading__description,
.archive-overview__stats span,
.article-taxonomy__block p {
  max-width: 58ch;
  margin: 8px 0 0;
  color: var(--muted);
}

.side-stack {
  display: grid;
  gap: 16px;
}

.plain-panel {
  padding: 18px;
}

.plain-panel h2 {
  font-size: 1.35rem;
}

.plain-panel p {
  color: var(--muted);
}

.compact-list {
  display: grid;
  gap: 10px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.compact-list li {
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.text-link,
.home-note__link,
.home-section-head__link,
.category-hero__back {
  display: inline-flex;
  margin-top: 10px;
  color: var(--accent);
  font-weight: 760;
}

.text-link:hover,
.home-note__link:hover,
.home-section-head__link:hover,
.category-hero__back:hover {
  color: var(--accent-2);
}

.index-grid,
.taxonomy-grid,
.category-directory,
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.index-card,
.taxonomy-card,
.category-directory__card {
  display: grid;
  gap: 8px;
  padding: 18px;
  min-height: 150px;
}

.index-card {
  border: 1px solid var(--line-strong);
  background: var(--surface);
}

.index-card span,
.taxonomy-card span,
.category-directory__latest span,
.archive-group__head span,
.article-taxonomy__block span,
.article__pager-link span,
.article-toc__meta span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.82rem;
}

.index-card strong,
.taxonomy-card h3,
.category-directory__card h2 {
  font-size: 1.2rem;
}

.index-card:hover,
.taxonomy-card:hover,
.category-directory__card:hover {
  border-color: var(--accent);
}

.archive-overview {
  padding: 18px;
}

.archive-overview__stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  width: 100%;
}

.archive-overview__stats strong {
  display: block;
  font-family: var(--mono);
  font-size: 1.45rem;
}

.topic-strip {
  padding: 18px;
}

.topic-strip h2 {
  max-width: 42rem;
}

.topic-strip__tags,
.tag-inline-list,
.stack-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.topic-strip__tags a,
.tag-inline-list a,
.stack-list li,
.category-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  background: #f7f5ed;
  color: var(--ink-soft);
  font-size: 0.84rem;
}

.category-badge {
  margin: 0;
  font-weight: 700;
}

.topic-strip__tags a:hover,
.tag-inline-list a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.post-row__footer,
.archive-row__footer {
  margin-top: 10px;
}

.section-heading {
  display: grid;
  gap: 10px;
  max-width: 760px;
}

.section-heading--center {
  text-align: left;
}

.section-heading h1,
.category-hero h1 {
  font-family: var(--serif);
}

.project-card {
  overflow: hidden;
}

.project-card__image,
.featured-project__visual img,
.article__cover {
  width: 100%;
  object-fit: cover;
  filter: grayscale(0.15) contrast(1.05);
}

.project-card__image {
  aspect-ratio: 16 / 9;
  border-bottom: 1px solid var(--line-strong);
}

.project-card__body {
  padding: 18px;
}

.project-card__body h2,
.featured-project__body h3 {
  font-size: 1.6rem;
}

.featured-project {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(0, 1fr);
  border: 1px solid var(--line-strong);
  background: var(--ink);
  color: var(--surface);
}

.featured-project h3,
.featured-project p,
.featured-project li {
  color: inherit;
}

.featured-project__body {
  padding: clamp(22px, 4vw, 36px);
}

.featured-project__visual {
  border-right: 1px solid rgb(255 255 255 / 24%);
}

.about-page,
.about-summary {
  padding: clamp(20px, 4vw, 34px);
}

.about-page__avatar,
.home-author__avatar {
  width: 76px;
  height: 76px;
  object-fit: cover;
  border: 1px solid var(--line-strong);
  margin-bottom: 18px;
}

.about-page h2 {
  margin-top: 28px;
  font-size: 1.35rem;
}

.about-page p,
.about-page li {
  max-width: 68ch;
  color: var(--ink-soft);
}

.about-page a {
  color: var(--accent);
  font-weight: 760;
}

.about-page ul {
  padding-left: 1.2rem;
}

.article-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: clamp(28px, 5vw, 56px);
  align-items: start;
}

.article {
  min-width: 0;
}

.article__header {
  padding-bottom: 26px;
  border-bottom: 1px solid var(--line-strong);
}

.article__header h1 {
  max-width: 13ch;
  margin-top: 18px;
  font-family: var(--serif);
  font-size: clamp(2rem, 5vw, 4.5rem);
  line-height: 1.1;
}

.article__meta {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
}

.article__summary {
  max-width: 48rem;
  margin: 18px 0 0;
  color: var(--ink-soft);
  font-size: 1.12rem;
}

.article__cover {
  margin-top: 24px;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line-strong);
}

.article__prose {
  max-width: 72ch;
  margin-top: 30px;
  color: var(--ink);
  font-family: var(--sans);
}

.article__prose h2 {
  margin-top: 42px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: clamp(1.45rem, 3vw, 2rem);
}

.article__prose h3 {
  margin-top: 28px;
  font-size: 1.25rem;
}

.article__prose p,
.article__prose li {
  color: var(--ink-soft);
  font-size: 1.05rem;
  line-height: 1.9;
  text-wrap: pretty;
}

.article__prose p {
  margin: 16px 0;
}

.article__prose ul,
.article__prose ol {
  padding-left: 1.35rem;
}

.article__prose a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.article__prose blockquote {
  margin: 26px 0;
  padding: 8px 0 8px 18px;
  border-left: 3px solid var(--accent);
  color: var(--muted);
}

.article__prose pre {
  max-width: 100%;
  overflow-x: auto;
  padding: 16px;
  border: 1px solid #2b2b24;
  background: #11110f;
  color: #f5f1e6;
}

.article__prose code {
  font-family: var(--mono);
  font-size: 0.94em;
}

.article__prose :not(pre) > code {
  padding: 2px 5px;
  border: 1px solid var(--line);
  background: #ece9df;
}

.article-taxonomy {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  max-width: 72ch;
  margin-top: 34px;
}

.article-taxonomy__block {
  padding: 16px;
}

.article-taxonomy__block strong {
  display: block;
  margin-top: 6px;
}

.article__pager {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  max-width: 72ch;
  margin-top: 34px;
}

.article__pager-link {
  display: grid;
  gap: 6px;
  padding: 16px;
}

.article__pager-link--empty {
  color: var(--muted);
  background: transparent;
}

.article-related {
  max-width: 72ch;
  margin-top: 46px;
}

.article-related__head {
  margin-bottom: 12px;
}

.article-toc {
  position: sticky;
  top: 92px;
  padding: 16px;
  max-height: calc(100vh - 120px);
  overflow: auto;
}

.article-toc__meta {
  display: grid;
  gap: 4px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.article-toc p {
  margin: 0 0 12px;
  font-family: var(--mono);
  font-size: 0.82rem;
  font-weight: 760;
}

.article-toc ul {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.article-toc li.depth-3 {
  padding-left: 12px;
}

.article-toc a {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

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

.category-hero {
  padding: 20px;
}

.category-hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
}

.archive-group {
  display: grid;
  gap: 0;
}

.archive-group__head {
  padding-top: 18px;
}

.archive-group__head p {
  margin: 0;
  font-family: var(--mono);
  font-size: 1.4rem;
  font-weight: 760;
}

.home-author,
.home-signal-row,
.home-rail,
.home-hero__background {
  display: none;
}

.home-hero__frame,
.home-hero__grid {
  all: unset;
}

@media (max-width: 980px) {
  .home-hero__inner,
  .split-layout,
  .article-shell,
  .featured-project {
    grid-template-columns: 1fr;
  }

  .article-toc {
    position: static;
    order: -1;
    max-height: none;
  }

  .featured-project__visual {
    border-right: 0;
    border-bottom: 1px solid rgb(255 255 255 / 24%);
  }
}

@media (max-width: 720px) {
  body {
    background-size: 56px 56px, auto;
  }

  .site-header__inner,
  .site-footer__inner,
  .section-head,
  .home-section-head,
  .archive-group__head {
    align-items: flex-start;
    flex-direction: column;
  }

  .site-nav {
    justify-content: flex-start;
    width: 100%;
  }

  .site-nav__link {
    padding-inline: 9px;
  }

  .site-mark {
    width: 100%;
    justify-content: space-between;
  }

  .home-hero__inner {
    padding-top: 42px;
  }

  .home-hero__main h1,
  .article__header h1 {
    max-width: 100%;
  }

  .profile-panel dl,
  .archive-overview__stats,
  .article-taxonomy,
  .article__pager {
    grid-template-columns: 1fr;
  }

  .profile-panel dl div {
    border-right: 0;
    border-bottom: 1px solid var(--line-strong);
  }

  .profile-panel dl div:last-child {
    border-bottom: 0;
  }

  .record-row,
  .post-row,
  .archive-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .record-row__meta,
  .post-row__meta,
  .archive-row__meta {
    flex-direction: row;
    flex-wrap: wrap;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
