:root {
  --bg: #F5F2EA;
  --surface: #FFFFFF;
  --line: #E5DDCB;
  --text: #2A2622;
  --muted: #787068;
  --accent: #C96442;
  --radius: 10px;
  --radius-pill: 999px;
  --content-width: min(760px, calc(100vw - 32px));
  --wide-content-width: min(1120px, calc(100vw - 32px));
  --reading-width: min(760px, 100%);
  --font-sans: "Avenir Next", "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC",
    "Microsoft YaHei", sans-serif;
  --font-serif: "Iowan Old Style", "Palatino Linotype", "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 180ms ease, opacity 180ms ease;
}

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

pre,
code {
  font-family: "SFMono-Regular", "JetBrains Mono", "Fira Code", Consolas, monospace;
}

.page-shell {
  width: var(--content-width);
  margin: 0 auto;
  padding: 58px 0 76px;
}

.page-shell-wide {
  width: var(--wide-content-width);
}

.site-header {
  margin-bottom: 42px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--line);
}

.site-header-compact {
  margin-bottom: 24px;
  padding-bottom: 0;
  border-bottom: none;
}

.page-shell-wide > .site-header-compact {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 14px 0;
  border-bottom: 1px solid transparent;
  background: rgba(245, 242, 234, 0.96);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  transition: border-color 160ms ease;
}

.page-shell-wide > .site-header-compact.is-stuck {
  border-bottom-color: var(--line);
}

.page-shell-wide .post-page [id] {
  scroll-margin-top: 88px;
}

.site-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.site-header-row-compact {
  align-items: center;
}

.site-title,
.site-title-link {
  display: inline-block;
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(2.8rem, 6.8vw, 4.5rem);
  line-height: 0.98;
  letter-spacing: -0.055em;
  color: var(--text);
}

.site-contact {
  margin: 14px 0 0;
  color: #857B71;
  font-size: 0.9rem;
  line-height: 1.7;
  letter-spacing: 0.01em;
}

.site-description {
  max-width: 640px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.75;
}

.site-focus {
  margin: 0 0 18px;
  padding: 0 0 26px;
  border-bottom: 1px solid var(--line);
}

.site-focus p {
  display: grid;
  grid-template-columns: 6em minmax(0, 1fr);
  gap: 14px;
  margin: 0;
  padding: 5px 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.65;
}

.site-focus strong {
  color: var(--text);
  font-weight: 600;
}

.site-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
}

.site-primary-nav {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

.site-primary-nav a,
.site-primary-nav span {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1;
  text-decoration: none;
  transition: color 180ms ease;
}

.site-primary-nav span {
  color: #B8AC98;
}

.site-primary-nav a:hover,
.site-primary-nav a[aria-current="page"] {
  color: var(--accent);
}

.site-search-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1;
  white-space: nowrap;
}

.site-search-link:hover {
  border-color: #B8AC98;
  background: #EBE4D1;
}

.site-search-link-current {
  border-color: var(--text);
  background: var(--text);
  color: #ffffff;
}

.site-logo-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}

.site-logo-back {
  flex: 0 0 auto;
  color: var(--muted);
  transition: transform 200ms cubic-bezier(0.22, 1, 0.36, 1), color 200ms ease;
}

.site-logo-name {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  line-height: 1.1;
  letter-spacing: -0.02em;
  transition: color 180ms ease;
}

.site-logo-link:hover .site-logo-back {
  transform: translateX(-3px);
  color: var(--accent);
}

.site-logo-link:hover .site-logo-name {
  color: var(--accent);
}

.site-logo-link:focus-visible,
.post-item-title a:focus-visible,
.prose a:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 4px;
}

.post-list {
  border-top: none;
}

.post-list .post-item:first-child {
  padding-top: 28px;
}

.home-main,
.search-page {
  width: var(--reading-width);
  max-width: 100%;
}

.post-item {
  padding: 38px 0 42px;
  border-bottom: 1px solid var(--line);
}

.post-list .post-item:last-child {
  border-bottom: none;
}

.post-item-header {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.post-item .post-item-date {
  display: block;
  margin-top: 12px;
}

.post-item-title {
  margin: 0;
}

.post-item-title,
.post-item-title a {
  font-family: var(--font-serif);
  font-size: clamp(1.82rem, 4vw, 2.18rem);
  line-height: 1.14;
  letter-spacing: -0.038em;
  color: inherit;
}

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

.draft-marker {
  color: var(--accent);
  font-weight: 500;
  margin-right: 0.25em;
  opacity: 0.75;
}

.post-item-date,
.post-date {
  color: var(--muted);
  font-size: 0.92rem;
}

.post-item-summary {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.82;
}

.post-summary-label {
  display: inline-block;
  padding: 2px 10px;
  margin-right: 4px;
  background: rgba(201, 100, 66, 0.08);
  border-radius: var(--radius-pill);
  font-size: 0.78em;
  color: var(--accent);
  letter-spacing: 0.02em;
  vertical-align: 1px;
}

.empty-state {
  padding: 28px 0 0;
  color: var(--muted);
}

.not-found-page {
  max-width: 560px;
  margin: 10vh auto 16vh;
  text-align: center;
}

.not-found-page h1 {
  margin: 8px 0 16px;
  color: var(--text);
  font-family: var(--font-serif);
  font-size: clamp(2rem, 6vw, 3.2rem);
  line-height: 1.12;
}

.not-found-page p {
  line-height: 1.8;
}

.not-found-code {
  margin: 0;
  color: var(--accent);
  font-size: 0.82rem;
  letter-spacing: 0.16em;
}

.search-panel {
  margin-bottom: 24px;
}

.search-results-list {
  border-top: 0;
}

.search-label {
  display: block;
  margin-bottom: 12px;
  font-size: 0.92rem;
  font-family: var(--font-serif);
  color: var(--text);
  letter-spacing: 0.01em;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-input {
  width: 100%;
  min-width: 0;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 1.02rem;
  line-height: 1.4;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  transition: border-color 200ms ease, box-shadow 200ms ease;
}

.search-input::placeholder {
  color: #A89E90;
}

.search-input:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(201, 100, 66, 0.1);
}

.search-clear {
  flex: 0 0 auto;
  padding: 12px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  line-height: 1;
  cursor: pointer;
}

.search-clear:hover {
  border-color: #B8AC98;
  background: #EBE4D1;
}

.search-status {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.7;
}

.search-empty {
  padding-top: 8px;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding-top: 24px;
}

.pagination-summary {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  white-space: nowrap;
}

.pagination-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.pagination-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  padding: 9px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text);
  font-size: 0.94rem;
  line-height: 1;
}

.pagination-link:hover {
  border-color: #B8AC98;
  background: #EBE4D1;
}

.pagination-link-current {
  border-color: var(--text);
  background: var(--text);
  color: #ffffff;
}

.pagination-link-disabled {
  color: #B3A794;
  background: #EEE7D4;
}

.pagination-link-direction {
  padding-inline: 16px;
}

.post-layout {
  display: block;
}

.post-page {
  padding-top: 30px;
  animation: article-enter 520ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.post-toc {
  display: none;
}

.post-toc-compact {
  margin: 0 0 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.45);
}

.post-toc-compact summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 16px;
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.4;
  cursor: pointer;
  list-style: none;
}

.post-toc-compact summary::-webkit-details-marker {
  display: none;
}

.post-toc-compact summary::after {
  content: "+";
  margin-left: auto;
  color: var(--accent);
  font-size: 1.1rem;
  font-weight: 400;
}

.post-toc-compact[open] summary::after {
  content: "−";
}

.post-toc-compact-count {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 400;
}

.post-toc-compact ol {
  margin: 0;
  padding: 0 16px 14px;
  list-style: none;
  columns: 2;
  column-gap: 28px;
}

.post-toc-compact-item {
  break-inside: avoid;
  margin: 0 0 6px;
}

.post-toc-compact-item a {
  display: block;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.55;
}

.post-toc-compact-item a:hover {
  color: var(--accent);
}

.post-toc-compact.post-toc-nested .post-toc-compact-level-2 a {
  font-weight: 600;
}

.post-toc-compact-level-3 a,
.post-toc-compact-level-4 a {
  padding-left: 14px;
  font-size: 0.8rem;
}

.post-toc-inner {
  padding: 0;
  max-height: calc(100vh - 56px);
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.post-toc-inner::-webkit-scrollbar {
  display: none;
}

.post-toc-title {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.2;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.7;
}

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

.post-toc-list li + li {
  margin-top: 4px;
}

.toc-item a {
  position: relative;
  display: block;
  padding: 2px 0 2px 14px;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.55;
  transition: color 180ms ease;
}

.toc-item a::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 2px;
  height: 0;
  background: var(--accent);
  transition: height 180ms ease;
}

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

.toc-item.active a {
  color: var(--text);
}

.toc-item.active a::before {
  height: 1em;
}

.post-toc-nested .toc-item-level-2 a {
  font-weight: 600;
}

.toc-item-level-3 a {
  padding-left: 28px;
  font-size: 0.8rem;
}

.toc-item-level-4 a {
  padding-left: 42px;
  font-size: 0.78rem;
}

.post-hero {
  position: relative;
  padding: 48px 0 40px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}

.post-hero-art {
  position: absolute;
  inset: 0;
  opacity: 0.16;
  pointer-events: none;
  mix-blend-mode: multiply;
  animation: hero-art-fade 1.2s ease-out both;
}

@keyframes hero-art-fade {
  0% { opacity: 0; }
  50% { opacity: 0.32; }
  100% { opacity: 0.16; }
}

.post-hero-art svg {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.post-hero::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 80px;
  background: linear-gradient(to bottom, transparent, var(--bg));
  z-index: 1;
  pointer-events: none;
}

.post-hero-content {
  position: relative;
  z-index: 2;
}

/* Line grow animation (topo, wave outlines, flow) */
.post-hero-art .art-line {
  stroke-dasharray: var(--line-len);
  stroke-dashoffset: var(--line-len);
  animation: line-grow 0.9s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: var(--delay, 0s);
}

@keyframes line-grow {
  to { stroke-dashoffset: 0; }
}

/* Dot fade-in animation */
.post-hero-art .art-dot {
  transform-box: fill-box;
  transform-origin: center;
  transform: scale(0);
  opacity: 0;
  animation: dot-pop 0.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: var(--delay, 0s);
}

@keyframes dot-pop {
  to { transform: scale(1); opacity: var(--target-opacity, 0.06); }
}

/* Ripple expand animation */
.post-hero-art .art-ripple {
  transform-box: fill-box;
  transform-origin: center;
  transform: scale(0);
  opacity: 0;
  animation: ripple-expand 0.8s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: var(--delay, 0s);
}

@keyframes ripple-expand {
  to { transform: scale(1); opacity: 1; }
}

/* Mesh / crosshatch / constellation line animation */
.post-hero-art .art-mesh-line {
  stroke-dasharray: var(--line-len);
  stroke-dashoffset: var(--line-len);
  animation: line-grow 0.8s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: var(--delay, 0s);
}

/* Arc sweep animation */
.post-hero-art .art-arc {
  stroke-dasharray: var(--line-len);
  stroke-dashoffset: var(--line-len);
  animation: line-grow 1.1s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: var(--delay, 0s);
}

/* Constellation star pop */
.post-hero-art .art-star {
  transform-box: fill-box;
  transform-origin: center;
  transform: scale(0);
  opacity: 0;
  animation: dot-pop 0.4s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: var(--delay, 0s);
}

/* Noise terrain fade */
.post-hero-art .art-terrain {
  opacity: 0;
  animation: terrain-fade 1.2s ease-out forwards;
  animation-delay: var(--delay, 0s);
}

@keyframes terrain-fade {
  to { opacity: 1; }
}

/* Wave fill grow */
.post-hero-art .art-wave {
  clip-path: inset(0 100% 0 0);
  animation: wave-reveal 1s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: var(--delay, 0s);
}

@keyframes wave-reveal {
  to { clip-path: inset(0 0 0 0); }
}

.post-header {
  margin-bottom: 0;
  animation: article-enter 620ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.post-header h1 {
  margin: 0 0 12px;
  font-family: var(--font-serif);
  font-size: clamp(2.25rem, 4.8vw, 3.1rem);
  line-height: 1.08;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.post-date {
  margin: 0;
}

.post-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.post-meta-sep {
  color: #C4B8A2;
}

.post-meta a {
  color: inherit;
  text-decoration: none;
}

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

.post-summary {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.99rem;
  line-height: 1.82;
}

.prose {
  font-size: 1.08rem;
  line-height: 1.94;
  overflow-wrap: anywhere;
}

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

.prose > * {
  animation: article-enter 680ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.prose > *:nth-child(2) {
  animation-delay: 40ms;
}

.prose > *:nth-child(3) {
  animation-delay: 80ms;
}

.prose > *:nth-child(4) {
  animation-delay: 120ms;
}

.prose > *:nth-child(5) {
  animation-delay: 160ms;
}

.prose > *:nth-child(6) {
  animation-delay: 200ms;
}

.prose > *:nth-child(7) {
  animation-delay: 240ms;
}

.prose > *:nth-child(8) {
  animation-delay: 280ms;
}

.prose > *:nth-child(9) {
  animation-delay: 320ms;
}

.prose > *:nth-child(10) {
  animation-delay: 360ms;
}

.prose p,
.prose ul,
.prose ol,
.prose blockquote,
.prose pre,
.prose .table-wrap {
  margin: 1.4em 0;
}

.prose > p:first-of-type {
  color: var(--text);
  font-size: 1.1em;
  line-height: 1.9;
}

.prose h2,
.prose h3,
.prose h4,
.prose h5,
.prose h6 {
  margin-top: 2.05em;
  margin-bottom: 0.62em;
  font-family: var(--font-serif);
  line-height: 1.12;
  letter-spacing: -0.03em;
}

.prose h2 {
  font-size: 2.02rem;
}

.prose h3 {
  font-size: 1.48rem;
}

.prose a {
  text-decoration: underline;
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
  text-decoration-color: rgba(201, 100, 66, 0.38);
  transition: text-decoration-color 200ms ease;
}

.prose a:hover {
  text-decoration-color: var(--accent);
}

.prose blockquote {
  margin-left: 0;
  padding: 12px 18px 12px 18px;
  border-left: 3px solid var(--accent);
  background: rgba(201, 100, 66, 0.04);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--muted);
}

.prose ul,
.prose ol {
  padding-left: 1.35em;
}

.prose code {
  padding: 0.1em 0.35em;
  background: #E9E2D1;
  border: 1px solid #D6CDB8;
  border-radius: var(--radius);
  font-size: 0.94em;
}

.prose pre {
  overflow-x: auto;
  padding: 18px 20px;
  background: #161616;
  border: 1px solid #2c2c2c;
  border-radius: var(--radius);
  border-top: 2px solid var(--accent);
}

.prose pre code {
  padding: 0;
  background: transparent;
  border: 0;
  color: #e6e6e6;
}

.hljs-keyword,
.hljs-selector-tag,
.hljs-built_in,
.hljs-name {
  color: #ff7b72;
}

.hljs-string,
.hljs-attr,
.hljs-template-tag,
.hljs-template-variable {
  color: #a5d6ff;
}

.hljs-number,
.hljs-literal {
  color: #79c0ff;
}

.hljs-comment,
.hljs-doctag {
  color: #8b949e;
  font-style: italic;
}

.hljs-type,
.hljs-class .hljs-title,
.hljs-title.class_,
.hljs-title.function_ {
  color: #d2a8ff;
}

.hljs-variable,
.hljs-params {
  color: #e6e6e6;
}

.hljs-meta {
  color: #79c0ff;
}

.hljs-attribute {
  color: #ffa657;
}

.hljs-regexp,
.hljs-link {
  color: #7ee787;
}

.hljs-symbol,
.hljs-bullet {
  color: #ffa657;
}

.hljs-section {
  color: #ff7b72;
  font-weight: bold;
}

.hljs-addition {
  color: #aff5b4;
  background-color: rgba(46, 160, 67, 0.15);
}

.hljs-deletion {
  color: #ffdcd7;
  background-color: rgba(248, 81, 73, 0.15);
}

.hljs-property {
  color: #79c0ff;
}

.hljs-punctuation {
  color: #c9d1d9;
}

.hljs-tag {
  color: #7ee787;
}

.hljs-tag .hljs-attr {
  color: #79c0ff;
}

.hljs-tag .hljs-name {
  color: #7ee787;
}

.hljs-selector-class,
.hljs-selector-id {
  color: #d2a8ff;
}

/* Site footer */
.site-footer {
  margin-top: 56px;
  padding: 24px 0 0;
  color: #948A7E;
  font-size: 0.82rem;
  line-height: 1.8;
  text-align: center;
}

.site-footer-inner {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.site-footer a {
  color: #948A7E;
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--muted);
}

.site-footer-sep {
  color: #C4B8A2;
}


/* Reading progress bar */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent);
  z-index: 1000;
  transition: width 80ms linear;
}

/* Back to top */
.back-to-top {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 260ms ease, transform 260ms ease, border-color 180ms ease, color 180ms ease;
  pointer-events: none;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.back-to-top:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Prev / next post navigation */
.post-nav {
  display: flex;
  gap: 16px;
  margin-top: 48px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

.post-nav-item {
  flex: 1;
  min-width: 0;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.post-nav-item:hover {
  border-color: var(--accent);
  box-shadow: 0 1px 6px rgba(201, 100, 66, 0.08);
}

.post-nav-label {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.post-nav-title {
  display: block;
  font-family: var(--font-serif);
  font-size: 1rem;
  line-height: 1.3;
  color: var(--text);
  letter-spacing: -0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

@keyframes article-enter {
  from {
    opacity: 0;
    transform: translateY(14px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

  .site-logo-mark,
  .post-page,
  .post-header,
  .prose > * {
    animation: none;
    transition: none;
    transform: none;
  }
}

.prose hr {
  border: 0;
  border-top: 1px solid var(--line);
}

.prose .table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.prose table {
  width: 100%;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 0.96rem;
  line-height: 1.65;
}

.prose thead {
  background: #EBE4D1;
}

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

.prose th[data-align="center"],
.prose td[data-align="center"] {
  text-align: center;
}

.prose th[data-align="right"],
.prose td[data-align="right"] {
  text-align: right;
}

.prose tbody tr:nth-child(even) {
  background: #F2EDDF;
}

.prose .table-wrap table:first-child {
  margin: 0;
}

.prose .table-wrap th:first-child,
.prose .table-wrap td:first-child {
  border-left: 0;
}

.prose .table-wrap th:last-child,
.prose .table-wrap td:last-child {
  border-right: 0;
}

.prose .table-wrap thead tr:first-child th {
  border-top: 0;
}

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

.post-image {
  margin: 1.4em 0;
}

.post-image img {
  width: 100%;
  border-radius: var(--radius);
}

.post-image figcaption {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

/* Reusable interactive article lab */
.article-lab {
  margin: 2em 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-sans);
  box-shadow: 0 10px 30px rgba(42, 38, 34, 0.05);
}

.article-lab * {
  box-sizing: border-box;
}

.article-lab-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 20px 16px;
  border-bottom: 1px solid var(--line);
  background: #FAF8F2;
}

.article-lab-kicker {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.article-lab-title {
  margin: 0;
  color: var(--text);
  font-family: var(--font-serif);
  font-size: 1.18rem;
  line-height: 1.35;
}

.article-lab-note {
  max-width: 280px;
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.55;
  text-align: right;
}

.article-lab-body {
  padding: 20px;
}

.article-lab-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
}

.article-lab-button {
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #FAF8F2;
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: border-color 160ms ease, background-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.article-lab-button:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

.article-lab-button:disabled,
.article-lab-button:disabled:hover {
  border-color: var(--line);
  background: #EEE9DF;
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.62;
  transform: none;
}

.article-lab-button:focus-visible,
.article-lab input:focus-visible {
  outline: 2px solid rgba(201, 100, 66, 0.35);
  outline-offset: 2px;
}

.article-lab-button-primary {
  border-color: var(--text);
  background: var(--text);
  color: #FFFFFF;
}

.article-lab-button-primary:hover {
  border-color: var(--accent);
  background: var(--accent);
  color: #FFFFFF;
}

.article-lab-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.article-lab-panel {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #FCFBF7;
}

.article-lab-panel-title {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.article-lab-stat {
  color: var(--text);
  font-family: var(--font-serif);
  font-size: 1.65rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.article-lab-caption,
.article-lab-status {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.55;
}

.article-lab-status {
  min-height: 1.55em;
}

.article-lab-range {
  display: grid;
  grid-template-columns: minmax(100px, 1fr) minmax(0, 2fr) 72px;
  align-items: center;
  gap: 12px;
  margin: 10px 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.4;
}

.article-lab-range input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.article-lab-range output {
  color: var(--text);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.article-lab-canvas,
.article-lab-visual {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 7px;
  background: #F7F3E9;
}

.article-lab-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  color: var(--muted);
  background: #FAF8F2;
  font-size: 0.72rem;
  line-height: 1.2;
}

@media (max-width: 900px) {
  .page-shell {
    width: min(100vw - 36px, 100%);
    padding-top: 48px;
    padding-bottom: 64px;
  }

  .home-main,
  .search-page {
    width: 100%;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100vw - 32px, 100%);
    padding-top: 38px;
    padding-bottom: 52px;
  }

  .site-header {
    margin-bottom: 30px;
  }

  .site-header-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .site-title,
  .site-title-link {
    font-size: clamp(2.35rem, 12vw, 3.35rem);
  }

  .site-contact {
    margin-top: 10px;
    font-size: 0.84rem;
  }

  .site-logo-link {
    gap: 8px;
  }

  .site-header-row-compact {
    align-items: center;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: space-between;
  }

  .site-header-actions {
    width: 100%;
    justify-content: space-between;
    gap: 12px;
  }

  .site-header-row-compact .site-header-actions {
    margin-top: 8px;
  }

  .page-shell-wide > .site-header-compact {
    padding: 12px 0;
  }

  .page-shell-wide .site-header-row-compact {
    flex-wrap: nowrap;
  }

  .page-shell-wide .site-header-row-compact .site-header-actions {
    width: auto;
    margin-top: 0;
  }

  .site-primary-nav {
    gap: 8px;
  }

  .site-primary-nav a,
  .site-primary-nav span {
    font-size: 0.86rem;
  }

  .site-logo-name {
    font-size: 1.1rem;
  }

  .site-search-link {
    padding: 10px 13px;
  }

  .site-focus p {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .post-item {
    padding: 28px 0 32px;
  }

  .post-item-title,
  .post-item-title a {
    font-size: 1.56rem;
  }

  .post-item-summary {
    margin-top: 14px;
    font-size: 0.95rem;
  }

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

  .search-field {
    align-items: stretch;
    flex-direction: column;
  }

  .search-clear {
    width: 100%;
    justify-content: center;
  }

  .pagination-links {
    justify-content: flex-start;
  }

  .post-page {
    padding-top: 28px;
  }

  .post-hero {
    padding: 36px 16px 32px;
  }

  .post-header {
    margin-bottom: 0;
  }

  .post-header h1 {
    font-size: clamp(2.12rem, 10vw, 2.72rem);
  }

  .post-meta {
    flex-wrap: wrap;
    column-gap: 12px;
    row-gap: 5px;
  }

  .post-meta > :not(.post-meta-sep) {
    white-space: nowrap;
  }

  .post-meta-sep {
    display: none;
  }

  .post-summary {
    margin-top: 14px;
    font-size: 0.95rem;
  }

  .post-toc-compact ol {
    columns: 1;
  }

  .article-lab-head {
    display: block;
    padding: 16px;
  }

  .article-lab-note {
    max-width: none;
    margin-top: 8px;
    text-align: left;
  }

  .article-lab-body {
    padding: 16px;
  }

  .article-lab-grid {
    grid-template-columns: 1fr;
  }

  .article-lab-range {
    grid-template-columns: 1fr 66px;
  }

  .article-lab-range input[type="range"] {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .prose {
    font-size: 1.02rem;
    line-height: 1.86;
  }

  .prose > p:first-of-type {
    font-size: 1.06em;
  }

  .prose h2 {
    font-size: 1.78rem;
  }

  .prose h3 {
    font-size: 1.38rem;
  }

  .prose ul,
  .prose ol {
    padding-left: 1.2em;
  }

  .prose pre {
    padding: 14px 14px 16px;
    border-radius: var(--radius);
    font-size: 0.92rem;
  }

  .post-nav {
    flex-direction: column;
    gap: 10px;
    margin-top: 36px;
  }

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

  .back-to-top {
    bottom: 20px;
    right: 20px;
    width: 36px;
    height: 36px;
    font-size: 0.9rem;
  }
}

@media (min-width: 1180px) {
  .page-shell-wide .site-header-compact .site-header-row-compact {
    display: flex;
    margin-inline: 72px;
    align-items: center;
  }

  .post-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, var(--reading-width)) 220px;
    column-gap: 72px;
    align-items: start;
  }

  .post-layout:has(.static-page) {
    display: block;
  }

  .post-page {
    grid-column: 2;
  }

  .post-toc-compact {
    display: none;
  }

  .post-toc {
    display: block;
    grid-column: 3;
    position: sticky;
    top: 76px;
    align-self: start;
  }

  .post-toc-inner {
    max-height: calc(100vh - 100px);
  }
}
