/**
 * ZhiMo Theme - main stylesheet
 * Paper-and-ink editorial palette.
 */

/* ========== 1. Design Tokens ========== */

:root {
  color-scheme: light;

  --color-bg: #fefdfb;
  --color-bg-soft: #f8f4ed;
  --color-bg-elevated: #fffdf8;
  --color-surface: #eee8de;
  --color-surface-strong: #e5dccf;
  --color-ruling: rgba(123, 96, 65, 0.055);
  --color-panel-mark: rgba(196, 58, 16, 0.32);

  --color-text: #2a2621;
  --color-text-soft: #574f47;
  --color-text-muted: #746a61;
  --color-text-faint: #a89d92;

  --color-border: #d2c9bc;
  --color-border-soft: #e8dfd2;
  --color-border-strong: #b8aa9b;

  --color-primary: #c43a10;
  --color-primary-hover: #b73710;
  --color-primary-soft: #f1b09a;
  --color-primary-ink: #7f250e;

  --color-code-bg: #ede6da;
  --color-code-gutter: #e1d7ca;
  --color-code-inline: #a83718;

  --font-serif: "Source Serif 4", "Noto Serif SC", "Noto Serif CJK SC", "Source Han Serif SC", "Songti SC", STSong, serif;
  --font-sans: "Geist Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", Monaco, Consolas, "Liberation Mono", monospace;

  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;

  --space-2xs: 0.25rem;
  --space-xs: 0.5rem;
  --space-sm: 0.75rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;
  --space-4xl: 6rem;

  --radius-tech: 0;
  --radius-sm: 3px;
  --radius-md: 5px;
  --radius-lg: 6px;

  --shadow-hair: 0 1px 0 rgba(42, 38, 33, 0.04);
  --shadow-panel: 0 20px 60px rgba(70, 54, 35, 0.05);
  --shadow-float: 0 18px 40px rgba(70, 54, 35, 0.08);
  --shadow-nav: 0 14px 44px rgba(70, 54, 35, 0.09);

  --ease-standard: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-soft: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-press: cubic-bezier(0.34, 1.56, 0.64, 1);

  --duration-fast: 160ms;
  --duration-base: 280ms;
  --duration-slow: 700ms;

  --line-height-tight: 1.18;
  --line-height-base: 1.72;
  --line-height-loose: 1.9;

  --measure-reading: 42rem;
  --measure-wide: 76rem;
  --measure-full: 88rem;
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --color-bg: #1a1915;
  --color-bg-soft: #211f1a;
  --color-bg-elevated: #28241e;
  --color-surface: #332f28;
  --color-surface-strong: #40392f;
  --color-ruling: rgba(232, 227, 218, 0.045);
  --color-panel-mark: rgba(255, 112, 67, 0.34);

  --color-text: #e8e3da;
  --color-text-soft: #c7bfb3;
  --color-text-muted: #958a7e;
  --color-text-faint: #6f665e;

  --color-border: #484138;
  --color-border-soft: #38332c;
  --color-border-strong: #5e554a;

  --color-primary: #ff7043;
  --color-primary-hover: #ff8a65;
  --color-primary-soft: #8b321c;
  --color-primary-ink: #ffd3c2;

  --color-code-bg: #241f1a;
  --color-code-gutter: #302a23;
  --color-code-inline: #ff9a77;

  --shadow-hair: 0 1px 0 rgba(255, 255, 255, 0.03);
  --shadow-panel: 0 22px 70px rgba(0, 0, 0, 0.18);
  --shadow-float: 0 18px 44px rgba(0, 0, 0, 0.26);
  --shadow-nav: 0 16px 48px rgba(0, 0, 0, 0.24);
}

:root[data-motion="reduced"] *,
:root[data-motion="reduced"] *::before,
:root[data-motion="reduced"] *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  scroll-behavior: auto !important;
  transition-duration: 0.01ms !important;
}

/* ========== 2. Reset & Base ========== */

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

* {
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100vh;
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-base);
  color: var(--color-text);
  background:
    linear-gradient(90deg, var(--color-ruling) 1px, transparent 1px) 0 0 / 5.75rem 5.75rem,
    linear-gradient(180deg, var(--color-ruling) 1px, transparent 1px) 0 0 / 5.75rem 5.75rem,
    var(--color-bg);
  isolation: isolate;
  transition:
    background-color var(--duration-base) var(--ease-standard),
    color var(--duration-base) var(--ease-standard);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.28;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140' viewBox='0 0 140 140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.22'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

[data-theme="dark"] body::before {
  opacity: 0.08;
  mix-blend-mode: screen;
}

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

button,
input,
textarea,
select {
  font: inherit;
}

button {
  color: inherit;
}

::selection {
  color: var(--color-bg);
  background: var(--color-primary);
}

:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
}

/* ========== 3. Typography ========== */

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-sans);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  color: var(--color-text);
}

h1 {
  font-size: 2.5rem;
}

h2 {
  font-size: 1.75rem;
}

h3 {
  font-size: 1.25rem;
}

h4,
h5,
h6 {
  font-size: 1rem;
}

p {
  margin-bottom: var(--space-md);
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition:
    color var(--duration-fast) var(--ease-standard),
    border-color var(--duration-fast) var(--ease-standard),
    background-color var(--duration-fast) var(--ease-standard),
    transform var(--duration-fast) var(--ease-press);
}

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

strong,
b {
  font-weight: var(--font-weight-bold);
}

em,
i {
  font-style: italic;
}

code,
kbd,
samp {
  font-family: var(--font-mono);
}

code {
  padding: 0.1rem 0.35rem;
  color: var(--color-code-inline);
  background: var(--color-code-bg);
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-tech);
  font-size: 0.86em;
}

pre {
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.65;
}

blockquote {
  margin: var(--space-lg) 0;
  padding: 0.82rem var(--space-lg);
  color: var(--color-text-soft);
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--color-bg-soft) 82%, transparent), transparent),
    var(--color-bg-soft);
  border-left: 3px solid var(--color-primary);
  box-shadow:
    inset 0 0 0 1px var(--color-border-soft),
    var(--shadow-hair);
}

blockquote > :last-child {
  margin-bottom: 0;
}

hr {
  height: 1px;
  margin: var(--space-2xl) 0;
  border: 0;
  background: var(--color-border-soft);
}

/* ========== 4. Layout Shell ========== */

.skip-link {
  position: absolute;
  top: var(--space-sm);
  left: var(--space-sm);
  z-index: 100;
  padding: var(--space-xs) var(--space-sm);
  color: var(--color-bg);
  background: var(--color-primary);
  border-radius: var(--radius-sm);
  transform: translateY(-150%);
}

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

.site-main {
  width: min(var(--measure-full), calc(100% - 2rem));
  min-height: calc(100vh - 16rem);
  margin: 0 auto;
  padding: var(--space-4xl) 0 var(--space-4xl);
}

.site-main-home {
  padding-top: 0;
}

.section-kicker,
.post-kicker,
.card-topline,
.post-meta,
.archive-meta,
.archive-date,
.reading-time,
.friend-main span,
.friend-tags,
.tag,
.category,
.toc-title,
.issue-meta,
.issue-reading,
.cover-ledger {
  font-family: var(--font-mono);
}

.section-kicker {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  margin-bottom: var(--space-xs);
  color: var(--color-primary);
  font-size: 0.75rem;
  line-height: 1.4;
}

.section-kicker::before {
  content: "";
  width: 1.4rem;
  height: 1px;
  background: currentColor;
  opacity: 0.55;
}

.section-title {
  font-size: 1.5rem;
  margin: 0;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--color-border-soft);
  position: relative;
}

.section-heading::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -1px;
  width: 4.5rem;
  height: 1px;
  background: var(--color-primary);
}

.section-heading.compact {
  margin-bottom: var(--space-lg);
}

.section-action {
  flex: 0 0 auto;
  min-height: 2.35rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.42rem;
  padding: 0 var(--space-sm);
  color: var(--color-text-soft);
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  text-align: center;
  text-decoration: none;
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--color-bg-elevated) 70%, white 30%);
  transition:
    color var(--duration-fast) var(--ease-standard),
    background-color var(--duration-fast) var(--ease-standard),
    border-color var(--duration-fast) var(--ease-standard),
    box-shadow var(--duration-fast) var(--ease-standard),
    transform var(--duration-fast) var(--ease-press);
}

.section-action::after {
  content: "+";
  color: var(--color-primary);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  line-height: 1;
}

.section-action:hover,
.search-close:hover {
  color: var(--color-primary);
  background: var(--color-surface);
  border-color: var(--color-border);
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, var(--color-bg-elevated) 64%, white 36%),
    0 3px 0 color-mix(in srgb, var(--color-border-soft) 82%, transparent);
  transform: translateY(-1px);
}

.js .reveal-item {
  opacity: 0;
  transform: translateY(12px);
  transition:
    opacity 820ms var(--ease-soft),
    transform 820ms var(--ease-soft);
  transition-delay: calc(var(--reveal-index, 0) * 55ms);
}

.js .reveal-item.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ========== 5. Header ========== */

.site-header {
  position: sticky;
  top: var(--space-sm);
  z-index: 30;
  padding: 0 var(--space-md);
  pointer-events: none;
}

.header-inner {
  position: relative;
  width: min(var(--measure-wide), 100%);
  margin: 0 auto;
  padding: 0.42rem;
  display: grid;
  grid-template-columns: minmax(10rem, 0.8fr) auto minmax(10rem, 0.8fr);
  align-items: center;
  gap: var(--space-md);
  pointer-events: auto;
  color: var(--color-text);
  background: var(--color-bg-elevated);
  background: color-mix(in srgb, var(--color-bg-elevated) 88%, transparent);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  box-shadow: var(--shadow-nav);
  backdrop-filter: blur(20px) saturate(1.05);
}

.header-inner::before {
  content: "";
  position: absolute;
  inset: 2px;
  pointer-events: none;
  border: 1px solid color-mix(in srgb, var(--color-border-soft) 68%, transparent);
  border-radius: 5px;
}

.site-brand {
  min-width: 0;
  display: flex;
  align-items: center;
}

.site-title {
  display: inline-flex;
  align-items: center;
  min-height: 2.5rem;
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: var(--font-weight-bold);
  line-height: 1.2;
  text-decoration: none;
}

.site-title::before {
  content: "";
  width: 0.72rem;
  height: 1.65rem;
  margin-right: var(--space-xs);
  background: var(--color-primary);
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--color-bg) 24%, transparent),
    0 0 0 1px var(--color-primary);
}

.site-nav {
  justify-self: center;
}

.nav-menu {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.16rem;
  padding: 0.22rem;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--color-bg-soft) 80%, var(--color-bg-elevated) 20%), var(--color-bg-soft));
  border: 1px solid var(--color-border-soft);
  border-radius: 6px;
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, var(--color-bg-elevated) 78%, white 22%),
    inset 0 -1px 0 color-mix(in srgb, var(--color-border-soft) 82%, black 18%);
}

.nav-item {
  display: flex;
}

.nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 2.35rem;
  padding: 0 0.82rem;
  color: var(--color-text-soft);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  text-decoration: none;
  transform: translateY(0);
  transition:
    color var(--duration-fast) var(--ease-standard),
    background-color var(--duration-fast) var(--ease-standard),
    border-color var(--duration-fast) var(--ease-standard),
    box-shadow var(--duration-fast) var(--ease-standard),
    transform var(--duration-fast) var(--ease-press);
}

.nav-link:hover {
  color: var(--color-text);
  background: var(--color-bg-elevated);
  border-color: var(--color-border-soft);
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, var(--color-bg-elevated) 68%, white 32%),
    0 3px 0 color-mix(in srgb, var(--color-border-soft) 72%, transparent);
}

.nav-link.active {
  color: var(--color-text);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--color-bg-elevated) 90%, white 10%), var(--color-bg-elevated));
  border-color: var(--color-border);
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, var(--color-bg-elevated) 62%, white 38%),
    inset 0 -2px 0 var(--color-primary),
    0 3px 0 color-mix(in srgb, var(--color-border-soft) 82%, transparent);
}

.nav-link:active {
  transform: translateY(1px);
  box-shadow:
    inset 0 2px 6px color-mix(in srgb, var(--color-border) 34%, transparent),
    inset 0 -1px 0 var(--color-primary);
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
}

.search-trigger,
.theme-toggle,
.lang-trigger,
.nav-toggle,
.search-close,
.back-to-top,
.copy-code-btn {
  border: 1px solid var(--color-border-soft);
  background: var(--color-bg-elevated);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transform: translateY(0);
}

.search-trigger,
.theme-toggle,
.lang-trigger,
.nav-toggle,
.search-close,
.social-link {
  align-items: center;
  justify-content: center;
  color: var(--color-text-soft);
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--color-bg-elevated) 70%, white 30%);
  transition:
    color var(--duration-fast) var(--ease-standard),
    background-color var(--duration-fast) var(--ease-standard),
    border-color var(--duration-fast) var(--ease-standard),
    box-shadow var(--duration-fast) var(--ease-standard),
    transform var(--duration-fast) var(--ease-press);
}

.search-trigger,
.theme-toggle,
.nav-toggle {
  width: 2.75rem;
  height: 2.75rem;
  display: inline-flex;
}

.search-trigger:hover,
.theme-toggle:hover,
.lang-trigger:hover,
.nav-toggle:hover {
  color: var(--color-primary);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--color-bg-elevated) 80%, white 20%), var(--color-surface));
  border-color: var(--color-border);
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, var(--color-bg-elevated) 68%, white 32%),
    0 3px 0 color-mix(in srgb, var(--color-border-soft) 82%, transparent),
    0 10px 22px color-mix(in srgb, var(--color-border-soft) 34%, transparent);
  transform: translateY(-1px);
}

.search-trigger:active,
.theme-toggle:active,
.lang-trigger:active,
.nav-toggle:active,
.search-close:active,
.section-action:active,
.back-to-top:active,
.social-link:active,
.text-button:active,
.post-card:active,
.friend-card:active {
  transform: scale(0.98);
}

.icon {
  width: 1.15rem;
  height: 1.15rem;
}

.theme-toggle .icon-light,
.theme-toggle .icon-dark,
.theme-toggle .icon-auto {
  display: none;
}

[data-theme-preference="auto"] .theme-toggle .icon-auto,
[data-theme-preference="light"] .theme-toggle .icon-light,
[data-theme-preference="dark"] .theme-toggle .icon-dark {
  display: block;
}

.theme-mode-label {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: var(--font-weight-bold);
  line-height: 1;
  letter-spacing: 0;
}

.lang-switch {
  position: relative;
}

.lang-trigger {
  min-width: 3.6rem;
  height: 2.75rem;
  display: inline-flex;
  gap: 0.35rem;
  padding: 0 0.62rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: var(--font-weight-bold);
  letter-spacing: 0;
}

.lang-trigger::after {
  content: "";
  width: 0.38rem;
  height: 0.38rem;
  margin-top: -0.12rem;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  transform: rotate(45deg);
  opacity: 0.72;
  transition: transform var(--duration-fast) var(--ease-standard);
}

.lang-trigger[aria-expanded="true"]::after {
  transform: translateY(0.12rem) rotate(225deg);
}

.lang-menu {
  position: absolute;
  top: calc(100% + var(--space-xs));
  right: 0;
  z-index: 35;
  min-width: 9rem;
  padding: var(--space-xs);
  list-style: none;
  background: color-mix(in srgb, var(--color-bg-elevated) 94%, transparent);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  box-shadow: var(--shadow-float);
  backdrop-filter: blur(18px) saturate(1.05);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-0.5rem);
  transition:
    opacity var(--duration-fast) var(--ease-standard),
    transform var(--duration-fast) var(--ease-standard),
    visibility var(--duration-fast) var(--ease-standard);
}

.lang-menu.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.lang-menu a,
.lang-menu span {
  min-height: 2.35rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-xs) var(--space-sm);
  color: var(--color-text-soft);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  text-decoration: none;
}

.lang-menu a:hover {
  color: var(--color-primary);
  background: var(--color-surface);
}

.lang-menu span.active {
  color: var(--color-text);
  background: var(--color-bg-soft);
}

.lang-menu span.active::after {
  content: "";
  width: 0.42rem;
  height: 0.42rem;
  background: var(--color-primary);
}

.lang-menu span.disabled {
  color: var(--color-text-faint);
  cursor: not-allowed;
}

.nav-toggle {
  display: none;
}

.nav-toggle-icon,
.nav-toggle-icon::before,
.nav-toggle-icon::after {
  display: block;
  width: 1rem;
  height: 2px;
  background: currentColor;
  transition:
    transform var(--duration-base) var(--ease-standard),
    opacity var(--duration-base) var(--ease-standard),
    background-color var(--duration-base) var(--ease-standard);
}

.nav-toggle-icon {
  position: relative;
}

.nav-toggle-icon::before,
.nav-toggle-icon::after {
  content: "";
  position: absolute;
  left: 0;
}

.nav-toggle-icon::before {
  transform: translateY(-0.35rem);
}

.nav-toggle-icon::after {
  transform: translateY(0.35rem);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-icon {
  background: transparent;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-icon::before {
  transform: rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-icon::after {
  transform: rotate(-45deg);
}

/* ========== 6. Footer ========== */

.site-footer {
  width: min(var(--measure-wide), calc(100% - 2rem));
  margin: 0 auto var(--space-xl);
  color: var(--color-text-soft);
  background:
    linear-gradient(90deg, var(--color-ruling) 1px, transparent 1px) 0 0 / 4rem 4rem,
    var(--color-bg-elevated);
  border: 1px solid var(--color-border-soft);
  border-radius: 8px;
  box-shadow: var(--shadow-hair);
}

.footer-inner {
  padding: var(--space-lg);
}

.footer-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-xl);
}

.footer-brand {
  max-width: 40rem;
}

.footer-brand h2 {
  margin: 0;
  font-size: 1rem;
}

.footer-brand p,
.footer-legal,
.footer-credit {
  margin: 0;
  color: var(--color-text-muted);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  line-height: 1.7;
}

.footer-credit a {
  color: var(--color-text);
  text-decoration-color: var(--color-border);
}

.footer-legal {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.08rem 0.55rem;
}

.footer-record-item {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.footer-record,
.footer-record:visited {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--color-text-soft);
  text-decoration-color: var(--color-border);
}

.footer-record-icon {
  width: 1.05rem;
  height: 1.05rem;
  flex: 0 0 auto;
  object-fit: contain;
}

.footer-separator {
  color: var(--color-border-strong);
}

.footer-credit a:hover,
.footer-record:hover {
  color: var(--color-primary);
  text-decoration-color: var(--color-primary);
}

.footer-brand p {
  margin-top: var(--space-xs);
}

.footer-social {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: var(--space-xs);
  flex: 0 0 auto;
}

.social-link {
  width: 2.75rem;
  height: 2.75rem;
  display: inline-flex;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-sm);
  text-decoration: none;
}

.social-link:hover {
  color: var(--color-primary);
  border-color: var(--color-border);
  background: var(--color-surface);
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, var(--color-bg-elevated) 64%, white 36%),
    0 3px 0 color-mix(in srgb, var(--color-border-soft) 82%, transparent);
  transform: translateY(-2px);
}

.social-text {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: var(--font-weight-bold);
}

.footer-bottom {
  display: flex;
  align-items: center;
  flex-direction: column;
  gap: var(--space-xs);
  margin-top: var(--space-lg);
  padding-top: var(--space-md);
  border-top: 1px solid var(--color-border-soft);
  text-align: center;
}

.footer-bottom .copyright {
  color: var(--color-text);
}

/* ========== 7. Home Page ========== */

.home-page {
  max-width: var(--measure-wide);
  margin: 0 auto;
}

.home-cover-frame {
  min-height: max(36rem, calc(100vh - 4.75rem));
  display: grid;
  align-items: center;
  margin-bottom: var(--space-4xl);
}

@supports (height: 100dvh) {
  .home-cover-frame {
    min-height: max(36rem, calc(100dvh - 4.75rem));
  }
}

.home-cover {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(18rem, 0.65fr);
  gap: var(--space-3xl);
  align-items: center;
  min-height: 34rem;
  padding: clamp(2rem, 4vw, 4.75rem);
  background:
    linear-gradient(90deg, transparent 0, transparent calc(62% - 1px), var(--color-border-soft) calc(62% - 1px), var(--color-border-soft) 62%, transparent 62%),
    linear-gradient(180deg, color-mix(in srgb, var(--color-bg-soft) 58%, transparent), transparent 42%),
    var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  box-shadow:
    var(--shadow-panel),
    inset 0 1px 0 color-mix(in srgb, var(--color-bg-elevated) 72%, white 28%);
  overflow: hidden;
}

.home-cover::before,
.home-cover::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.home-cover::before {
  inset: var(--space-md);
  border: 1px solid var(--color-border-soft);
  border-radius: 4px;
}

.home-cover::after {
  inset: var(--space-md);
  background:
    linear-gradient(var(--color-panel-mark), var(--color-panel-mark)) left top / 4.25rem 1px no-repeat,
    linear-gradient(var(--color-panel-mark), var(--color-panel-mark)) right top / 4.25rem 1px no-repeat,
    linear-gradient(var(--color-panel-mark), var(--color-panel-mark)) left bottom / 4.25rem 1px no-repeat,
    linear-gradient(var(--color-panel-mark), var(--color-panel-mark)) right bottom / 4.25rem 1px no-repeat;
}

.home-cover-copy {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--space-2xl);
  min-height: 22rem;
}

.cover-kicker {
  margin: 0;
  color: var(--color-primary);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
}

.cover-title {
  max-width: 11ch;
  margin: 0;
  font-size: clamp(3.2rem, 8vw, 6.2rem);
  line-height: 0.92;
  text-wrap: balance;
}

.cover-subtitle {
  max-width: 34rem;
  margin: var(--space-lg) 0 0;
  color: var(--color-text-soft);
  font-family: var(--font-serif);
  font-size: clamp(1.08rem, 1.6vw, 1.36rem);
  line-height: 1.75;
}

.cover-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.text-button {
  display: inline-grid;
  grid-template-columns: auto 1.8rem;
  align-items: center;
  min-height: 3rem;
  appearance: none;
  color: var(--color-bg);
  background: var(--color-text);
  border: 1px solid var(--color-text);
  border-radius: 6px;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: var(--font-weight-semibold);
  text-decoration: none;
  transition:
    color var(--duration-fast) var(--ease-standard),
    background-color var(--duration-fast) var(--ease-standard),
    border-color var(--duration-fast) var(--ease-standard),
    box-shadow var(--duration-fast) var(--ease-standard),
    transform var(--duration-fast) var(--ease-press);
  overflow: hidden;
}

.text-button span:first-child {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 var(--space-md);
  text-align: center;
}

.text-button .button-mark {
  height: 100%;
  min-height: 3rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text);
  background: var(--color-bg);
  border-left: 1px solid var(--color-border);
  font-family: var(--font-mono);
}

.text-button .button-mark .icon {
  width: 0.95rem;
  height: 0.95rem;
}

.text-button.secondary {
  color: var(--color-text);
  background: var(--color-bg-elevated);
  border-color: var(--color-border);
}

.text-button.secondary .button-mark {
  color: var(--color-bg);
  background: var(--color-primary);
}

.text-button:hover {
  color: var(--color-bg);
  background: var(--color-primary);
  border-color: var(--color-primary);
  box-shadow:
    0 3px 0 color-mix(in srgb, var(--color-primary-hover) 70%, transparent),
    0 14px 28px color-mix(in srgb, var(--color-primary) 18%, transparent);
  transform: translateY(-1px);
}

.text-button.secondary:hover {
  color: var(--color-bg);
}

.cover-ledger {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-sm);
  padding: var(--space-sm);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--color-bg-elevated) 55%, transparent), transparent),
    var(--color-bg-soft);
  border: 1px solid var(--color-border);
  border-radius: 6px;
}

.ledger-feature {
  min-height: 10rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--space-md);
  padding: var(--space-lg);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--color-bg-elevated) 88%, transparent), transparent),
    var(--color-bg-elevated);
  border: 1px solid var(--color-border-soft);
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--color-bg-elevated) 72%, white 28%);
}

.ledger-label,
.ledger-note {
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  line-height: 1.5;
}

.ledger-title {
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: clamp(1.05rem, 1.7vw, 1.35rem);
  font-weight: var(--font-weight-bold);
  line-height: 1.22;
  text-decoration: none;
  text-wrap: balance;
}

.ledger-title:hover {
  color: var(--color-primary);
}

.cover-ledger dl {
  width: 100%;
  flex: 1;
  display: grid;
  grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: var(--color-border-soft);
}

.cover-ledger dl > div {
  display: grid;
  grid-template-columns: minmax(7rem, 0.9fr) 1fr;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--color-bg-elevated);
  transition:
    background-color var(--duration-fast) var(--ease-standard),
    transform var(--duration-fast) var(--ease-press);
}

.cover-ledger dl > div:hover {
  background: var(--color-bg-soft);
  transform: translateX(2px);
}

.cover-ledger dt {
  color: var(--color-text-muted);
  font-size: 0.72rem;
}

.cover-ledger dd {
  color: var(--color-text);
  font-size: 0.9rem;
  font-weight: var(--font-weight-medium);
}

.home-section {
  margin-bottom: var(--space-4xl);
}

.issue-list {
  border-top: 1px solid var(--color-border);
}

.issue-item {
  position: relative;
  display: grid;
  grid-template-columns: 11.25rem minmax(0, 1fr) minmax(5.75rem, auto);
  gap: clamp(var(--space-md), 2.8vw, var(--space-2xl));
  align-items: start;
  padding: var(--space-xl) clamp(var(--space-lg), 2.4vw, var(--space-2xl));
  border-bottom: 1px solid var(--color-border-soft);
  transition:
    background-color var(--duration-fast) var(--ease-standard),
    border-color var(--duration-fast) var(--ease-standard),
    transform var(--duration-fast) var(--ease-press);
}

.issue-item:hover {
  border-color: var(--color-border);
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--color-bg-soft) 72%, transparent), transparent 48%);
  transform: translateX(2px);
}

.issue-meta {
  display: grid;
  gap: var(--space-xs);
  color: var(--color-text-muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

.issue-number {
  width: 2.25rem;
  min-height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
  background: var(--color-bg-soft);
  border: 1px solid var(--color-border-soft);
  font-size: 0.95rem;
  font-weight: var(--font-weight-bold);
}

.category,
.archive-category,
.post-category a,
.tag {
  display: inline-flex;
  align-items: baseline;
  color: var(--color-primary-ink);
  text-decoration-line: underline;
  text-decoration-color: transparent;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  transition:
    color var(--duration-fast) var(--ease-standard),
    text-decoration-color var(--duration-fast) var(--ease-standard);
}

.category,
.archive-category,
.post-category a {
  font-size: 0.74rem;
  line-height: 1.4;
}

.category:hover,
.archive-category:hover,
.post-category a:hover,
.tag:hover {
  color: var(--color-primary);
  text-decoration-color: currentColor;
}

.post-title {
  margin: 0;
}

.post-title a {
  color: var(--color-text);
  text-decoration: none;
}

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

.issue-item .post-title {
  max-width: 34rem;
  font-size: clamp(1.18rem, 1.9vw, 1.35rem);
}

.post-excerpt {
  margin: var(--space-sm) 0 0;
  color: var(--color-text-soft);
  line-height: 1.75;
}

.issue-reading {
  justify-self: end;
  padding-top: 0.14rem;
  color: var(--color-text-muted);
  font-size: 0.78rem;
  text-align: right;
  white-space: nowrap;
}

.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-2xl);
  align-items: start;
}

.featured-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 24rem));
  gap: var(--space-md);
  justify-content: start;
}

.post-card {
  position: relative;
  min-height: 16rem;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  padding: var(--space-lg);
  color: var(--color-text);
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border-soft);
  border-radius: 6px;
  box-shadow:
    var(--shadow-hair),
    inset 0 1px 0 color-mix(in srgb, var(--color-bg-elevated) 70%, white 30%);
  overflow: hidden;
  transition:
    border-color var(--duration-fast) var(--ease-standard),
    box-shadow var(--duration-fast) var(--ease-standard),
    transform var(--duration-fast) var(--ease-press);
}

.post-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(var(--color-panel-mark), var(--color-panel-mark)) left top / 2.4rem 1px no-repeat,
    linear-gradient(var(--color-panel-mark), var(--color-panel-mark)) right bottom / 2.4rem 1px no-repeat;
  opacity: 0;
  transition: opacity var(--duration-fast) var(--ease-standard);
}

.post-card:hover {
  border-color: var(--color-border);
  box-shadow: var(--shadow-float);
  transform: translateY(-3px);
}

.post-card:hover::before {
  opacity: 1;
}

.post-card:first-child:nth-last-child(n + 2) {
  min-height: 20rem;
}

.post-card .post-title {
  font-size: 1.05rem;
}

.post-card .post-excerpt {
  flex: 1;
  font-size: 0.95rem;
}

.card-topline {
  display: flex;
  justify-content: space-between;
  gap: var(--space-md);
  color: var(--color-text-muted);
  font-size: 0.72rem;
}

.reading-time {
  color: var(--color-text-muted);
  font-size: 0.78rem;
}

/* ========== 8. Post Page ========== */

.post-page {
  max-width: var(--measure-wide);
  margin: 0 auto;
}

.post-header {
  max-width: min(56rem, 100%);
  margin: 0 auto var(--space-3xl);
  padding: 0 0 var(--space-2xl);
  border-bottom: 1px solid var(--color-border-soft);
}

.post-kicker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.42rem;
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-md);
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border-soft);
  font-size: 0.78rem;
}

.meta-divider {
  width: 0.22rem;
  height: 0.22rem;
  color: transparent;
  background: var(--color-border-strong);
  border-radius: 50%;
}

.post-header .post-title {
  max-width: 20ch;
  font-size: clamp(2.3rem, 4.7vw, 3.9rem);
  line-height: 1.06;
  text-wrap: balance;
}

.post-description {
  margin: var(--space-lg) 0 0;
  max-width: 42rem;
  color: var(--color-text-soft);
  font-size: 1.1rem;
  line-height: 1.8;
}

.post-body-grid {
  display: grid;
  grid-template-columns: minmax(0, var(--measure-reading));
  justify-content: center;
}

.post-body-grid.has-toc {
  --toc-offset: clamp(1.5rem, 3vw, 2.5rem);

  align-items: start;
}

.post-body-grid.has-toc .post-content {
  grid-column: 1;
  grid-row: 1;
}

.post-body-grid.has-toc .post-toc {
  width: 15rem;
  grid-column: 1;
  grid-row: 1;
  justify-self: end;
  transform: translateX(calc(100% + var(--toc-offset)));
}

.post-toc {
  position: sticky;
  top: 6.5rem;
  max-height: calc(100vh - 8rem);
  overflow: auto;
  padding: 0.15rem 0 0.15rem var(--space-md);
  border-left: 1px solid var(--color-border-soft);
  scrollbar-gutter: stable;
  scrollbar-width: thin;
}

.toc-title {
  margin: 0 0 var(--space-sm);
  color: var(--color-text-muted);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.toc-title::before {
  content: "";
  width: 1.15rem;
  height: 1px;
  display: inline-block;
  margin-right: 0.5rem;
  vertical-align: middle;
  background: var(--color-border-strong);
}

.post-toc ol {
  list-style: none;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  line-height: 1.48;
}

.post-toc ol ol {
  margin: 0.18rem 0 0.3rem 0.2rem;
  padding-left: 0.72rem;
  border-left: 1px solid var(--color-border-soft);
}

.post-toc li + li {
  margin-top: 0.12rem;
}

.post-toc li {
  position: relative;
}

.post-toc a {
  position: relative;
  display: block;
  padding: 0.34rem 0.5rem 0.34rem 0.75rem;
  color: var(--color-text-muted);
  text-decoration: none;
  transition:
    color var(--duration-fast) var(--ease-standard),
    background-color var(--duration-fast) var(--ease-standard),
    box-shadow var(--duration-fast) var(--ease-standard);
}

.post-toc li.has-children > a {
  padding-left: 1.75rem;
}

.toc-toggle {
  position: absolute;
  top: 0.22rem;
  left: 0.1rem;
  z-index: 1;
  width: 1.35rem;
  height: 1.35rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-faint);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition:
    color var(--duration-fast) var(--ease-standard),
    background-color var(--duration-fast) var(--ease-standard),
    border-color var(--duration-fast) var(--ease-standard);
}

.toc-toggle span {
  width: 0.38rem;
  height: 0.38rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
  transition: transform var(--duration-fast) var(--ease-standard);
}

.post-toc li.is-open > .toc-toggle span {
  transform: rotate(45deg);
}

.toc-toggle:hover,
.toc-toggle:focus-visible {
  color: var(--color-primary);
  background: color-mix(in srgb, var(--color-bg-soft) 70%, transparent);
}

.post-toc a:hover {
  color: var(--color-text);
  background: color-mix(in srgb, var(--color-bg-soft) 66%, transparent);
}

.post-toc a.active {
  color: var(--color-text);
  background: transparent;
  box-shadow: inset 2px 0 0 var(--color-primary);
  font-weight: var(--font-weight-semibold);
}

.post-toc .toc-number {
  color: var(--color-text-faint);
  font-family: var(--font-mono);
  font-size: 0.72em;
}

.post-toc a.active .toc-number {
  color: var(--color-text-muted);
}

.post-toc li.is-current-branch > a:not(.active) {
  color: var(--color-text-soft);
}

.post-content,
.page-body {
  color: var(--color-text);
  font-size: 1.075rem;
  line-height: 1.86;
}

.post-content > * + *,
.page-body > * + * {
  margin-top: 1.05rem;
}

.post-content > blockquote,
.page-body > blockquote {
  margin-block: var(--space-lg);
}

.post-content p,
.page-body p {
  margin-bottom: 0;
}

.post-content a,
.page-body a {
  color: var(--color-text);
  text-decoration-line: underline;
  text-decoration-color: var(--color-primary);
}

.post-content a:hover,
.page-body a:hover {
  color: var(--color-primary);
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4,
.page-body h1,
.page-body h2,
.page-body h3,
.page-body h4 {
  margin-top: var(--space-3xl);
  scroll-margin-top: 7rem;
  font-family: var(--font-sans);
  line-height: 1.28;
}

.post-content h1,
.page-body h1 {
  font-size: clamp(2.15rem, 5vw, 3.2rem);
  line-height: 1.08;
}

.post-content > h1:first-child,
.page-body > h1:first-child {
  margin-top: 0;
}

.post-content h2,
.page-body h2 {
  position: relative;
  padding: 0 0 var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--color-border-soft);
  font-size: 1.72rem;
}

.post-content h2::before,
.page-body h2::before {
  content: "";
  position: absolute;
  top: 0.18em;
  bottom: var(--space-sm);
  left: 0;
  width: 3px;
  background: var(--color-primary);
}

.post-content h3,
.page-body h3 {
  color: var(--color-text-soft);
  font-size: 1.28rem;
}

.post-content > blockquote + *,
.page-body > blockquote + * {
  margin-top: var(--space-lg);
}

.post-content ul,
.post-content ol,
.page-body ul,
.page-body ol {
  padding-left: var(--space-xl);
}

.post-content li + li,
.page-body li + li {
  margin-top: var(--space-xs);
}

.post-content img,
.page-body img {
  height: auto;
  margin: var(--space-xl) 0;
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-md);
}

.post-content table,
.page-body table {
  display: block;
  width: 100%;
  margin: var(--space-xl) 0;
  overflow-x: auto;
  border-collapse: collapse;
  font-family: var(--font-sans);
  font-size: 0.92rem;
}

.post-content th,
.post-content td,
.page-body th,
.page-body td {
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--color-border);
  text-align: left;
}

.post-content th,
.page-body th {
  background: var(--color-surface);
  font-weight: var(--font-weight-semibold);
}

.post-content figure.highlight,
.post-content > pre {
  --code-bar-height: 2.75rem;
  --code-copy-width: 4.45rem;
  --code-gutter-width: 3.35rem;
  --code-content-gap: 0.82rem;
  --code-dot-size: 0.42rem;
  --code-dot-step: 0.76rem;
  --code-dot-group-width: 1.94rem;
  --code-scrollbar-rest: color-mix(in srgb, var(--color-border-strong) 34%, transparent);
  --code-scrollbar-ready: color-mix(in srgb, var(--color-border-strong) 38%, transparent);
  --code-scrollbar-thumb-rest: color-mix(in srgb, var(--color-border-strong) 32%, transparent);
  --code-scrollbar-hover: color-mix(in srgb, var(--color-border-strong) 46%, transparent);
  --code-scrollbar-active: color-mix(in srgb, var(--color-text-muted) 58%, transparent);
  --code-scrollbar-touch-active: color-mix(in srgb, var(--color-text-muted) 52%, transparent);

  position: relative;
  max-width: 100%;
  margin: var(--space-xl) 0;
  color: var(--color-text);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--color-code-gutter) 94%, var(--color-bg-elevated)) 0 var(--code-bar-height), var(--color-code-bg) var(--code-bar-height));
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  box-shadow:
    0 18px 42px color-mix(in srgb, var(--color-border-soft) 38%, transparent),
    inset 0 1px 0 color-mix(in srgb, var(--color-code-gutter) 72%, white 28%);
  overflow: hidden;
  color-scheme: light;
}

[data-theme="dark"] .post-content figure.highlight,
[data-theme="dark"] .post-content > pre {
  color-scheme: dark;
}

.post-content figure.highlight::before,
.post-content > pre::before {
  content: "";
  position: absolute;
  top: calc((var(--code-bar-height) - var(--code-dot-size)) / 2);
  left: calc((var(--code-gutter-width) - var(--code-dot-group-width)) / 2);
  z-index: 1;
  width: var(--code-dot-size);
  height: var(--code-dot-size);
  background: var(--color-primary);
  border-radius: 50%;
  box-shadow:
    var(--code-dot-step) 0 0 var(--color-border-strong),
    calc(var(--code-dot-step) + var(--code-dot-step)) 0 0 var(--color-text-faint);
}

.post-content figure.highlight::after,
.post-content > pre::after {
  content: "";
  position: absolute;
  top: var(--code-bar-height);
  right: 0;
  left: 0;
  height: 1px;
  pointer-events: none;
  background: var(--color-border);
}

.post-content figure.highlight table {
  display: block;
  width: 100%;
  margin: 0;
  border-collapse: collapse;
  font-size: 0.875rem;
  line-height: 1.68;
}

.post-content figure.highlight table > tbody {
  display: block;
  width: 100%;
  min-width: 0;
}

.post-content figure.highlight table > tbody > tr {
  display: grid;
  width: 100%;
  min-width: 0;
  grid-template-columns: var(--code-gutter-width) minmax(0, 1fr);
}

.post-content figure.highlight td {
  display: block;
  padding: 0;
  border: 0;
}

.post-content figure.highlight .gutter {
  width: var(--code-gutter-width);
  min-width: var(--code-gutter-width);
  color: var(--color-text-faint);
  text-align: center;
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
  pointer-events: none;
  background: color-mix(in srgb, var(--color-code-gutter) 82%, transparent);
  border-right: 1px solid var(--color-border);
  font-variant-numeric: tabular-nums;
}

.post-content figure.highlight .code {
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-inline: contain;
  scrollbar-color: var(--code-scrollbar-rest) transparent;
  scrollbar-width: thin;
}

.post-content figure.highlight .gutter pre,
.post-content figure.highlight .code pre {
  position: static;
  max-width: none;
  margin: 0;
  padding: calc(var(--code-bar-height) + var(--code-content-gap)) var(--space-lg) var(--code-content-gap);
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  overflow: visible;
  tab-size: 2;
  color-scheme: inherit;
}

.post-content > pre {
  padding: 0;
}

.post-content figure.highlight .gutter pre {
  padding-right: 0;
  padding-left: 0;
  color: inherit;
}

.post-content figure.highlight .code pre {
  width: max-content;
  min-width: 100%;
}

.post-content figure.highlight pre br:last-child {
  display: none;
}

.post-content figure.highlight .gutter .line {
  display: inline-block;
  min-width: var(--code-gutter-width);
  padding: 0 0.68rem;
  text-align: center;
}

.post-content figure.highlight .code .line {
  display: inline;
  min-height: 0;
}

.post-content pre code {
  padding: 0;
  color: inherit;
  background: transparent;
  border: 0;
}

.post-content > pre code {
  display: block;
  width: max-content;
  min-width: 100%;
  padding: calc(var(--code-bar-height) + var(--code-content-gap)) var(--space-lg) var(--code-content-gap);
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-inline: contain;
  scrollbar-color: var(--code-scrollbar-rest) transparent;
  scrollbar-width: thin;
}

.post-content figure.highlight .code.has-scroll-x,
.post-content > pre code.has-scroll-x {
  scrollbar-color: var(--code-scrollbar-ready) transparent;
}

.post-content figure.highlight .code:hover,
.post-content > pre code:hover,
.post-content figure.highlight .code:focus-visible,
.post-content > pre code:focus-visible {
  scrollbar-color: var(--code-scrollbar-hover) transparent;
}

.post-content figure.highlight .code.is-scrolling-x,
.post-content > pre code.is-scrolling-x {
  scrollbar-color: var(--code-scrollbar-active) transparent;
}

.post-content figure.highlight .code::-webkit-scrollbar,
.post-content > pre code::-webkit-scrollbar {
  height: 0.48rem;
}

.post-content figure.highlight .code::-webkit-scrollbar-track,
.post-content > pre code::-webkit-scrollbar-track {
  background: transparent;
}

.post-content figure.highlight .code::-webkit-scrollbar-thumb,
.post-content > pre code::-webkit-scrollbar-thumb {
  background: var(--code-scrollbar-thumb-rest);
  border: 2px solid transparent;
  border-radius: 999px;
  background-clip: content-box;
}

.post-content figure.highlight .code:hover::-webkit-scrollbar-thumb,
.post-content figure.highlight .code:focus-visible::-webkit-scrollbar-thumb,
.post-content > pre code:hover::-webkit-scrollbar-thumb,
.post-content > pre code:focus-visible::-webkit-scrollbar-thumb {
  background-color: var(--code-scrollbar-hover);
}

.post-content figure.highlight .code.is-scrolling-x::-webkit-scrollbar-thumb,
.post-content > pre code.is-scrolling-x::-webkit-scrollbar-thumb {
  background-color: var(--code-scrollbar-active);
}

.code-lang {
  position: absolute;
  top: 0;
  right: var(--code-copy-width);
  z-index: 1;
  height: var(--code-bar-height);
  display: inline-flex;
  align-items: center;
  padding: 0 0.72rem;
  color: var(--color-primary);
  background: color-mix(in srgb, var(--color-code-gutter) 82%, transparent);
  border-left: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  line-height: 1;
}

.copy-code-btn {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 2;
  width: var(--code-copy-width);
  height: var(--code-bar-height);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0 0.72rem;
  color: var(--color-text-muted);
  background: color-mix(in srgb, var(--color-code-gutter) 88%, transparent);
  border-top: 0;
  border-right: 0;
  border-bottom: 1px solid var(--color-border);
  border-left: 1px solid var(--color-border);
  opacity: 0.72;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  line-height: 1;
  white-space: nowrap;
  overflow: visible;
  transition:
    opacity var(--duration-fast) var(--ease-standard),
    color var(--duration-fast) var(--ease-standard),
    background-color var(--duration-fast) var(--ease-standard),
    transform var(--duration-fast) var(--ease-press);
}

.copy-code-btn .icon {
  width: 0.9rem;
  height: 0.9rem;
  flex: 0 0 auto;
}

.copy-code-status {
  --copy-status-border: color-mix(in srgb, var(--color-primary) 18%, var(--color-border-soft));

  position: absolute;
  top: var(--copy-status-top, 0);
  left: var(--copy-status-left, 0);
  z-index: 20;
  width: max-content;
  max-width: min(12rem, calc(100vw - 2rem));
  padding: 0.26rem 0.42rem;
  color: var(--color-primary-ink);
  background: var(--color-bg-elevated);
  border: 1px solid var(--copy-status-border);
  border-radius: var(--radius-sm);
  box-shadow:
    0 8px 22px color-mix(in srgb, var(--color-border-strong) 28%, transparent),
    var(--shadow-hair);
  opacity: 0;
  pointer-events: none;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  line-height: 1.15;
  transform: translate(-50%, calc(-100% + 0.35rem));
  transition:
    opacity var(--duration-fast) var(--ease-standard),
    visibility var(--duration-fast) var(--ease-standard),
    transform var(--duration-fast) var(--ease-standard);
  visibility: hidden;
  white-space: nowrap;
}

.copy-code-status::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -0.21rem;
  width: 0.34rem;
  height: 0.34rem;
  background: inherit;
  border-right: 1px solid var(--copy-status-border);
  border-bottom: 1px solid var(--copy-status-border);
  transform: translateX(-50%) rotate(45deg);
}

.copy-code-status[data-placement="bottom"] {
  transform: translate(-50%, -0.35rem);
}

.copy-code-status[data-placement="bottom"]::after {
  top: -0.21rem;
  bottom: auto;
  border-top: 1px solid var(--copy-status-border);
  border-right: 0;
  border-bottom: 0;
  border-left: 1px solid var(--copy-status-border);
}

.copy-code-status.visible {
  opacity: 1;
  transform: translate(-50%, -100%);
  visibility: visible;
}

.copy-code-status.visible[data-placement="bottom"] {
  transform: translate(-50%, 0);
}

.post-content > pre:hover .copy-code-btn,
.post-content figure.highlight:hover .copy-code-btn,
.post-content > pre:focus-within .copy-code-btn,
.post-content figure.highlight:focus-within .copy-code-btn,
.copy-code-btn:focus-visible {
  opacity: 1;
}

.copy-code-btn:hover {
  color: var(--color-primary);
  background: var(--color-surface-strong);
  opacity: 1;
}

.copy-code-btn[data-state="copied"] {
  color: var(--color-primary-ink);
  background: color-mix(in srgb, var(--color-primary) 18%, var(--color-bg-elevated));
}

.copy-code-btn[data-state="failed"] {
  color: var(--color-text);
  background: var(--color-surface-strong);
}

.copy-code-btn:active {
  transform: translateY(1px);
}

.post-content figure.highlight:focus-within,
.post-content > pre:focus-within {
  border-color: var(--color-primary);
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--color-primary) 16%, transparent),
    0 18px 42px color-mix(in srgb, var(--color-border-soft) 38%, transparent),
    inset 0 1px 0 color-mix(in srgb, var(--color-code-gutter) 72%, white 28%);
}

@media (hover: none) {
  .copy-code-btn {
    opacity: 1;
  }

  .post-content figure.highlight .code,
  .post-content > pre code {
    scrollbar-color: transparent transparent;
    scrollbar-width: none;
  }

  .post-content figure.highlight .code.is-scrolling-x,
  .post-content figure.highlight .code:focus-visible,
  .post-content > pre code.is-scrolling-x,
  .post-content > pre code:focus-visible {
    scrollbar-color: var(--code-scrollbar-touch-active) transparent;
    scrollbar-width: thin;
  }

  .post-content figure.highlight .code::-webkit-scrollbar,
  .post-content > pre code::-webkit-scrollbar {
    height: 0;
  }

  .post-content figure.highlight .code.is-scrolling-x::-webkit-scrollbar,
  .post-content figure.highlight .code:focus-visible::-webkit-scrollbar,
  .post-content > pre code.is-scrolling-x::-webkit-scrollbar,
  .post-content > pre code:focus-visible::-webkit-scrollbar {
    height: 0.42rem;
  }

  .post-content figure.highlight .code::-webkit-scrollbar-thumb,
  .post-content > pre code::-webkit-scrollbar-thumb {
    background: transparent;
  }
}

@media (max-width: 640px) {
  .post-content figure.highlight,
  .post-content > pre {
    --code-bar-height: 2.55rem;
    --code-copy-width: 3rem;
    --code-gutter-width: 2.45rem;
    --code-content-gap: 0.72rem;
    --code-dot-size: 0.36rem;
    --code-dot-step: 0.66rem;
    --code-dot-group-width: 1.68rem;

    margin: var(--space-lg) 0;
    border-radius: var(--radius-md);
  }

  .post-content figure.highlight .code pre,
  .post-content > pre code {
    padding-right: var(--space-md);
    padding-left: var(--space-md);
  }

  .code-lang {
    max-width: calc(100% - 7.1rem);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .copy-code-status {
    max-width: min(9rem, calc(100vw - 2rem));
  }

  .copy-code-btn {
    padding: 0;
  }

  .copy-code-btn .copy-code-text {
    display: none;
  }

  .footer-legal {
    gap: 0.14rem 0.7rem;
  }

  .footer-record-item.is-secondary {
    flex-basis: 100%;
    justify-content: center;
  }

  .footer-record-item.is-secondary .footer-separator {
    display: none;
  }
}

.post-content .comment,
.post-content .quote {
  color: var(--color-text-muted);
}

.post-content .keyword,
.post-content .selector-tag,
.post-content .subst {
  color: var(--color-primary);
}

.post-content .number,
.post-content .literal,
.post-content .variable,
.post-content .template-variable,
.post-content .tag .attr {
  color: #8c5a16;
}

[data-theme="dark"] .post-content .number,
[data-theme="dark"] .post-content .literal,
[data-theme="dark"] .post-content .variable,
[data-theme="dark"] .post-content .template-variable,
[data-theme="dark"] .post-content .tag .attr {
  color: #e0b46a;
}

.post-content .string,
.post-content .doctag {
  color: #52733e;
}

[data-theme="dark"] .post-content .string,
[data-theme="dark"] .post-content .doctag {
  color: #a7c984;
}

.post-content .title,
.post-content .section,
.post-content .selector-id {
  color: #7b4a8f;
}

[data-theme="dark"] .post-content .title,
[data-theme="dark"] .post-content .section,
[data-theme="dark"] .post-content .selector-id {
  color: #d6a6e4;
}

.post-tags {
  max-width: var(--measure-reading);
  margin: var(--space-xl) auto 0;
  padding: var(--space-lg) 0 0;
  border-top: 1px solid var(--color-border-soft);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-xs) var(--space-md);
}

.post-tags-label {
  margin-right: 0.18rem;
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
}

.tag {
  font-size: 0.82rem;
  line-height: 1.45;
}

.related-posts,
.post-nav {
  max-width: var(--measure-reading);
  margin: var(--space-3xl) auto 0;
}

.related-posts {
  padding: var(--space-lg) 0 0;
  border-top: 1px solid var(--color-border-soft);
}

.related-list {
  list-style: none;
}

.related-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-md);
  align-items: baseline;
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--color-border-soft);
}

.related-item:first-child {
  padding-top: 0;
}

.related-item:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.related-item a {
  color: var(--color-text);
  font-family: var(--font-sans);
  text-decoration: none;
}

.related-item time {
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.post-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-md);
}

.post-nav-item {
  min-height: 6.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: var(--space-md) 0;
  color: var(--color-text);
  border-top: 1px solid var(--color-border-soft);
  border-bottom: 1px solid var(--color-border-soft);
  transition:
    color var(--duration-fast) var(--ease-standard),
    border-color var(--duration-fast) var(--ease-standard);
  text-decoration: none;
}

.post-nav-item:hover {
  border-color: var(--color-border);
  color: var(--color-primary);
}

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

.nav-label {
  color: var(--color-primary);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: var(--font-weight-semibold);
  letter-spacing: 0.01em;
}

.nav-title {
  color: var(--color-text);
  font-family: var(--font-sans);
  font-weight: var(--font-weight-semibold);
  line-height: 1.36;
}

/* ========== 9. Archive & Taxonomy ========== */

.archive-page {
  max-width: min(var(--measure-wide), 100%);
  margin: 0 auto;
}

.category-page,
.tag-page,
.page-content {
  max-width: var(--measure-reading);
  margin: 0 auto;
}

.tag-index-page {
  max-width: min(72rem, 100%);
  margin: 0 auto;
}

.page-header {
  margin-bottom: var(--space-2xl);
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--color-border);
}

.category-page .page-header,
.tag-page .page-header,
.tag-index-header {
  padding: 0 0 var(--space-lg);
  border-bottom: 1px solid var(--color-border-soft);
}

.page-title {
  margin: 0;
  font-size: 2.25rem;
}

.archive-total,
.category-total,
.tag-total {
  margin: var(--space-sm) 0 0;
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.archive-taxonomy {
  margin: var(--space-xl) 0 var(--space-2xl);
  padding-bottom: var(--space-xl);
  border-bottom: 1px solid var(--color-border);
}

.archive-taxonomy .section-heading {
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
}

.archive-taxonomy .section-title {
  font-size: 1.35rem;
}

.taxonomy-panels {
  display: grid;
  grid-template-columns: minmax(0, 0.46fr) minmax(0, 0.54fr);
  gap: 0;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border-soft);
  box-shadow: var(--shadow-hair);
}

.taxonomy-panel {
  display: grid;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
}

.taxonomy-panel + .taxonomy-panel {
  border-left: 1px solid var(--color-border-soft);
}

.taxonomy-panel-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-md);
}

.taxonomy-panel h3,
.taxonomy-panel-header a {
  margin: 0;
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  text-transform: uppercase;
}

.taxonomy-panel-header a {
  color: var(--color-primary);
  text-decoration: none;
}

.taxonomy-panel-header a:hover {
  color: var(--color-primary-hover);
}

.taxonomy-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm) var(--space-md);
}

.taxonomy-link,
.taxonomy-empty {
  display: inline-flex;
  align-items: baseline;
  gap: 0.3rem;
  font-size: 0.82rem;
  line-height: 1.45;
}

.taxonomy-link {
  min-height: 1.8rem;
  color: var(--color-text-soft);
  text-decoration-line: underline;
  text-decoration-color: transparent;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  transition:
    color var(--duration-fast) var(--ease-standard),
    text-decoration-color var(--duration-fast) var(--ease-standard);
}

.taxonomy-link span:last-child {
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

.taxonomy-link span:last-child::before {
  content: "(";
}

.taxonomy-link span:last-child::after {
  content: ")";
}

.taxonomy-link:hover {
  color: var(--color-primary);
  text-decoration-color: currentColor;
}

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

.tag-index-header {
  display: grid;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
  border-bottom: 0;
}

.tag-index-description {
  max-width: 38rem;
  margin: 0;
  color: var(--color-text-soft);
  line-height: 1.75;
}

.tag-index-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 13.5rem), 1fr));
  gap: 1px;
  padding: 1px;
  background: var(--color-border-soft);
  border: 1px solid var(--color-border-soft);
}

.tag-index-card {
  --tag-cloud-size: 0.94rem;

  min-height: 4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding: var(--space-md);
  color: var(--color-text);
  background: var(--color-bg-elevated);
  text-decoration: none;
  transition:
    color var(--duration-fast) var(--ease-standard),
    background-color var(--duration-fast) var(--ease-standard),
    box-shadow var(--duration-fast) var(--ease-standard);
}

.tag-index-card.weight-2 {
  --tag-cloud-size: 0.97rem;
}

.tag-index-card.weight-3 {
  --tag-cloud-size: 1rem;
}

.tag-index-card.weight-4 {
  --tag-cloud-size: 1.04rem;
}

.tag-index-card.weight-5 {
  --tag-cloud-size: 1.08rem;
  color: var(--color-primary-ink);
}

.tag-index-card:hover {
  color: var(--color-primary);
  background: var(--color-bg-soft);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--color-primary) 28%, transparent);
}

.tag-index-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
  color: currentColor;
  font-family: var(--font-sans);
  font-size: var(--tag-cloud-size);
  font-weight: var(--font-weight-semibold);
  line-height: 1.3;
}

.tag-index-count {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  padding: 0.14rem 0.4rem;
  color: var(--color-primary);
  background: color-mix(in srgb, var(--color-primary) 10%, var(--color-bg-soft));
  border: 1px solid color-mix(in srgb, var(--color-primary) 22%, var(--color-border-soft));
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  white-space: nowrap;
}

.tag-index-empty {
  padding: var(--space-xl);
  background: var(--color-bg-soft);
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-lg);
}

.tag-index-empty h2 {
  margin: 0 0 var(--space-sm);
  font-size: 1.1rem;
}

.tag-index-empty p {
  margin: 0;
  color: var(--color-text-soft);
}

.archive-timeline {
  display: grid;
  gap: var(--space-3xl);
}

.year-group {
  display: grid;
  grid-template-columns: 7rem minmax(0, 1fr);
  gap: var(--space-xl);
}

.year-title {
  position: sticky;
  top: 6.5rem;
  align-self: start;
  margin: 0;
  color: var(--color-primary);
  font-family: var(--font-mono);
  font-size: 1.2rem;
}

.year-posts {
  display: grid;
  gap: 1px;
  background: var(--color-border-soft);
  border: 1px solid var(--color-border-soft);
}

.archive-item {
  position: relative;
  display: grid;
  grid-template-columns: 1.25rem 4.25rem minmax(0, 1fr);
  gap: var(--space-lg);
  align-items: start;
  padding: clamp(var(--space-lg), 2.4vw, var(--space-xl));
  background: var(--color-bg-elevated);
}

.archive-marker {
  color: var(--color-primary);
  font-family: var(--font-mono);
  line-height: 1.4;
}

.archive-date {
  color: var(--color-text-muted);
  font-size: 0.78rem;
}

.archive-title {
  margin: 0 0 var(--space-xs);
  font-size: 1.05rem;
}

.archive-title a {
  text-decoration: none;
}

.archive-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  align-items: center;
  color: var(--color-text-muted);
  font-size: 0.76rem;
}

.archive-meta .meta-divider {
  flex: 0 0 auto;
  align-self: center;
  transform: translateY(0.01rem);
}

.archive-main {
  min-width: 0;
}

.archive-excerpt {
  max-width: 38rem;
  margin: var(--space-xs) 0 var(--space-sm);
  color: var(--color-text-soft);
  font-size: 0.92rem;
  line-height: 1.7;
}

.post-category {
  display: inline-flex;
}

.post-list {
  display: grid;
  gap: 1px;
  background: var(--color-border-soft);
  border: 1px solid var(--color-border-soft);
}

.post-item {
  display: grid;
  grid-template-columns: 6rem minmax(0, 1fr);
  gap: var(--space-lg);
  padding: clamp(var(--space-lg), 2.4vw, var(--space-xl));
  background: var(--color-bg-elevated);
}

.post-date {
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.post-item .post-title {
  font-size: 1.05rem;
}

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

.post-item .post-excerpt {
  max-width: 36rem;
  font-size: 0.92rem;
}

/* ========== 10. Page Content ========== */

.page-body {
  max-width: var(--measure-reading);
}

.page-content-about {
  max-width: var(--measure-wide);
}

.about-article {
  display: grid;
  grid-template-columns: minmax(16rem, 0.32fr) minmax(0, 0.68fr);
  gap: var(--space-3xl);
  align-items: start;
}

.page-content-about .page-body {
  max-width: none;
}

.about-profile-card {
  position: sticky;
  top: calc(var(--space-4xl) + 1rem);
  display: grid;
  gap: var(--space-xl);
  padding: var(--space-xl);
  background: var(--color-bg-soft);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-hair);
}

.about-avatar {
  width: clamp(6.5rem, 12vw, 9rem);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--color-primary);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--color-bg-elevated) 70%, transparent), transparent),
    var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, var(--color-bg-elevated) 70%, white 30%),
    var(--shadow-panel);
}

.about-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.about-avatar span {
  font-family: var(--font-sans);
  font-size: clamp(2.6rem, 7vw, 4.25rem);
  font-weight: var(--font-weight-bold);
  line-height: 1;
}

.about-profile-copy {
  display: grid;
  gap: var(--space-sm);
}

.about-profile-copy .section-kicker {
  margin-bottom: 0;
}

.about-profile-copy .page-title {
  max-width: 8ch;
  font-size: clamp(2.4rem, 6vw, 4.6rem);
  line-height: 0.98;
}

.about-profile-note {
  margin: 0;
  color: var(--color-text-soft);
  font-family: var(--font-sans);
  font-size: 0.96rem;
  line-height: 1.7;
}

.about-profile-links {
  display: grid;
  gap: 1px;
  background: var(--color-border-soft);
  border: 1px solid var(--color-border-soft);
}

.about-profile-links a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  min-height: 2.75rem;
  padding: 0 var(--space-sm);
  color: var(--color-text);
  background: var(--color-bg-elevated);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: var(--font-weight-semibold);
  text-decoration: none;
  transition:
    color var(--duration-fast) var(--ease-standard),
    background-color var(--duration-fast) var(--ease-standard);
}

.about-profile-links a:hover {
  color: var(--color-primary);
  background: var(--color-bg-soft);
}

.about-profile-links a span:last-child {
  color: var(--color-primary);
}

.about-section-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: var(--color-border-soft);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-hair);
}

.about-section {
  min-height: 18rem;
  display: flex;
  flex-direction: column;
  padding: var(--space-xl);
  background: var(--color-bg-elevated);
}

.about-section-label {
  margin: 0 0 var(--space-lg);
  color: var(--color-primary);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  line-height: 1;
}

.page-content-about .about-section h2 {
  margin: 0 0 var(--space-md);
  padding: 0;
  border-bottom: 0;
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 1.25rem;
  line-height: 1.25;
  letter-spacing: 0;
  text-transform: none;
}

.page-content-about .about-section h2::before {
  content: none;
}

.about-section p {
  margin: 0;
  color: var(--color-text-soft);
  font-family: var(--font-sans);
  font-size: 0.96rem;
  line-height: 1.75;
}

.about-section p + p {
  margin-top: var(--space-sm);
}

.page-content-about .about-section ul {
  display: grid;
  gap: var(--space-xs);
  margin: var(--space-lg) 0 0;
  padding-left: 0;
  list-style: none;
}

.page-content-about .about-section li {
  position: relative;
  margin: 0;
  padding: 0 0 0 1.35rem;
  color: var(--color-text-soft);
  font-family: var(--font-sans);
  font-size: 0.92rem;
  line-height: 1.65;
}

.page-content-about .about-section li::before {
  content: "";
  position: absolute;
  top: 0.82em;
  left: 0;
  width: 0.42rem;
  height: 1px;
  background: var(--color-primary);
}

/* ========== 11. Friends Page ========== */

.friends-page {
  max-width: var(--measure-wide);
  margin: 0 auto;
}

.friends-hero {
  display: grid;
  gap: var(--space-xl);
  margin-bottom: var(--space-3xl);
  padding-bottom: var(--space-xl);
  border-bottom: 1px solid var(--color-border);
}

.friends-hero-copy {
  display: grid;
  grid-template-columns: minmax(9rem, max-content) minmax(0, 38rem);
  gap: clamp(var(--space-lg), 3vw, var(--space-2xl));
  align-items: end;
  justify-content: start;
}

.friends-intro {
  max-width: 40rem;
  margin: 0;
  color: var(--color-text-soft);
  font-size: 1.1rem;
  line-height: 1.8;
}

.friends-groups {
  display: grid;
  gap: var(--space-3xl);
}

.friends-group .section-heading {
  align-items: start;
}

.group-description {
  max-width: 34rem;
  margin: 0;
  color: var(--color-text-muted);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  line-height: 1.7;
}

.friend-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-sm);
}

.friend-card {
  min-width: 0;
  min-height: 10rem;
  display: grid;
  grid-template-columns: 3.25rem minmax(0, 1fr);
  gap: var(--space-md);
  align-content: start;
  padding: var(--space-lg);
  color: var(--color-text);
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  text-decoration: none;
  box-shadow:
    var(--shadow-hair),
    inset 0 1px 0 color-mix(in srgb, var(--color-bg-elevated) 70%, white 30%);
  transition:
    color var(--duration-fast) var(--ease-standard),
    background-color var(--duration-fast) var(--ease-standard),
    box-shadow var(--duration-fast) var(--ease-standard),
    transform var(--duration-fast) var(--ease-press);
}

.friend-card:hover {
  color: var(--color-text);
  background: var(--color-bg-soft);
  transform: translateY(-2px);
  box-shadow: var(--shadow-float);
}

.friend-avatar {
  width: 3.25rem;
  height: 3.25rem;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--color-primary);
  background: var(--color-bg-soft);
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-weight: var(--font-weight-bold);
}

.friend-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.friend-main {
  min-width: 0;
}

.friend-main h3 {
  margin: 0;
  font-size: 1.05rem;
}

.friend-main p {
  margin: var(--space-xs) 0 0;
  color: var(--color-text-soft);
  font-family: var(--font-serif);
  font-size: 0.95rem;
  line-height: 1.7;
}

.friend-main span {
  display: block;
  margin-top: var(--space-sm);
  overflow: hidden;
  color: var(--color-text-muted);
  font-size: 0.72rem;
  line-height: 1.5;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.friend-tags {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  padding-top: var(--space-sm);
  color: var(--color-text-muted);
  font-size: 0.72rem;
}

.friend-tags span {
  padding: 0.12rem 0.4rem;
  background: var(--color-bg-soft);
  border: 1px solid var(--color-border-soft);
}

.friends-empty,
.friends-apply {
  padding: var(--space-xl);
  background: var(--color-bg-soft);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  box-shadow: var(--shadow-hair);
}

.friends-empty h2,
.friends-apply h2 {
  margin: 0;
}

.friends-empty p {
  margin: var(--space-sm) 0 0;
  color: var(--color-text-soft);
  font-family: var(--font-sans);
  line-height: 1.7;
}

.friends-apply {
  display: grid;
  grid-template-columns: minmax(8rem, max-content) minmax(0, 1fr);
  gap: clamp(var(--space-xl), 4vw, var(--space-3xl));
  align-items: center;
}

.friends-apply > div:first-child {
  display: grid;
  gap: var(--space-sm);
  align-content: start;
}

.friends-apply .section-kicker {
  margin-bottom: 0;
}

.friends-apply-body {
  display: grid;
  grid-template-columns: minmax(0, 44rem) auto;
  gap: clamp(var(--space-lg), 4vw, var(--space-3xl));
  align-items: center;
}

.friends-apply p {
  margin: 0;
  color: var(--color-text-soft);
  font-family: var(--font-sans);
  line-height: 1.7;
}

.friends-apply .text-button {
  justify-self: end;
}

/* ========== 12. Search ========== */

.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: var(--space-4xl) var(--space-md);
  background: rgba(254, 253, 251, 0.82);
  background: color-mix(in srgb, var(--color-bg) 70%, transparent);
  backdrop-filter: blur(18px);
  opacity: 0;
  visibility: hidden;
  transition:
    opacity var(--duration-base) var(--ease-standard),
    visibility var(--duration-base) var(--ease-standard);
}

.search-overlay.active {
  opacity: 1;
  visibility: visible;
}

[data-theme="dark"] .search-overlay {
  background: rgba(26, 25, 21, 0.82);
  background: color-mix(in srgb, var(--color-bg) 70%, transparent);
}

.search-modal {
  width: min(42rem, 100%);
  max-height: calc(100vh - 8rem);
  display: flex;
  flex-direction: column;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  box-shadow: var(--shadow-float);
  transform: translateY(-1rem);
  transition: transform var(--duration-base) var(--ease-standard);
  overflow: hidden;
}

.search-overlay.active .search-modal {
  transform: translateY(0);
}

.search-header {
  display: grid;
  grid-template-columns: 1fr 2.35rem;
  gap: var(--space-sm);
  align-items: center;
  padding: var(--space-md);
  border-bottom: 1px solid var(--color-border-soft);
}

.search-input {
  width: 100%;
  min-height: 3.1rem;
  color: var(--color-text);
  background: var(--color-bg-soft);
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-sm);
  outline: 0;
  padding: 0 var(--space-md);
  font-family: var(--font-sans);
}

.search-input:focus {
  border-color: var(--color-primary);
}

.search-input::placeholder {
  color: var(--color-text-muted);
}

.search-close {
  width: 2.75rem;
  height: 2.75rem;
  display: flex;
  color: var(--color-text-muted);
}

.search-results {
  overflow-y: auto;
  padding: var(--space-md);
}

.search-result-item {
  display: block;
  padding: var(--space-md);
  color: var(--color-text);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  text-decoration: none;
}

.search-result-item:hover {
  background: var(--color-bg-soft);
  border-color: var(--color-border-soft);
}

.search-result-item + .search-result-item {
  margin-top: var(--space-xs);
}

.result-title {
  margin: 0 0 var(--space-xs);
  font-size: 1rem;
}

.result-excerpt {
  margin: 0;
  color: var(--color-text-soft);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  line-height: 1.65;
}

.result-excerpt mark,
.result-title mark {
  color: var(--color-primary-ink);
  background: var(--color-primary-soft);
  padding: 0 0.15rem;
}

.search-no-results,
.search-error {
  padding: var(--space-2xl);
  color: var(--color-text-muted);
  font-family: var(--font-sans);
  text-align: center;
}

.search-no-results span,
.search-error span {
  display: block;
  margin-top: var(--space-xs);
  color: var(--color-text-soft);
  font-size: 0.88rem;
}

.search-results-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  margin-top: var(--space-md);
  padding: var(--space-sm) var(--space-md) 0;
  border-top: 1px solid var(--color-border-soft);
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  font-size: 0.74rem;
}

.search-more-button {
  min-height: 2.25rem;
  padding: 0 var(--space-sm);
  color: var(--color-text);
  background: var(--color-bg-soft);
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: var(--font-weight-semibold);
  transition:
    color var(--duration-fast) var(--ease-standard),
    background-color var(--duration-fast) var(--ease-standard),
    border-color var(--duration-fast) var(--ease-standard),
    transform var(--duration-fast) var(--ease-press);
}

.search-more-button:hover {
  color: var(--color-bg);
  background: var(--color-primary);
  border-color: var(--color-primary);
}

.search-more-button:active {
  transform: translateY(1px);
}

/* ========== 13. Not Found ========== */

.notfound-page {
  max-width: min(64rem, 100%);
  min-height: clamp(30rem, 62vh, 42rem);
  display: grid;
  align-items: center;
  margin: 0 auto;
}

.notfound-panel {
  position: relative;
  display: grid;
  grid-template-columns: minmax(8rem, 0.42fr) minmax(0, 1fr);
  gap: var(--space-2xl);
  align-items: center;
  padding: clamp(var(--space-xl), 5vw, var(--space-4xl));
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--color-bg-soft) 72%, transparent), transparent 58%),
    var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  box-shadow: var(--shadow-hair);
  overflow: hidden;
}

.notfound-panel::before,
.notfound-panel::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.notfound-panel::before {
  inset: var(--space-sm);
  border: 1px solid var(--color-border-soft);
}

.notfound-panel::after {
  top: 0;
  bottom: 0;
  left: clamp(7rem, 28vw, 22rem);
  width: 1px;
  background: var(--color-border-soft);
}

.notfound-code,
.notfound-copy {
  position: relative;
  z-index: 1;
}

.notfound-code {
  color: color-mix(in srgb, var(--color-primary) 78%, var(--color-text));
  font-family: var(--font-mono);
  font-size: clamp(3.8rem, 11vw, 8rem);
  font-weight: var(--font-weight-bold);
  line-height: 0.88;
  letter-spacing: -0.04em;
}

.notfound-copy {
  max-width: 32rem;
}

.notfound-copy .section-kicker {
  margin-bottom: var(--space-sm);
}

.notfound-copy p:not(.section-kicker) {
  margin: var(--space-md) 0 0;
  color: var(--color-text-soft);
  font-family: var(--font-serif);
  font-size: 1.05rem;
  line-height: 1.75;
}

.notfound-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-top: var(--space-xl);
}

/* ========== 14. Back to Top & Utilities ========== */

.back-to-top {
  position: fixed;
  right: var(--space-xl);
  bottom: var(--space-xl);
  z-index: 25;
  width: 3rem;
  height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-bg);
  background: var(--color-primary);
  border-color: var(--color-primary);
  box-shadow: var(--shadow-float);
  opacity: 0;
  visibility: hidden;
  transform: translateY(0.75rem);
  transition:
    opacity var(--duration-base) var(--ease-standard),
    visibility var(--duration-base) var(--ease-standard),
    transform var(--duration-base) var(--ease-standard),
    background-color var(--duration-fast) var(--ease-standard),
    border-color var(--duration-fast) var(--ease-standard),
    box-shadow var(--duration-fast) var(--ease-standard);
}

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

.mobile-toc {
  display: none;
}

.mobile-toc-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.42rem;
  min-width: 3.8rem;
  min-height: 2.65rem;
  padding: 0 var(--space-sm);
  color: var(--color-text);
  background: color-mix(in srgb, var(--color-bg-elevated) 92%, transparent);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-float);
  backdrop-filter: blur(16px);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  line-height: 1;
  opacity: 0;
  transform: translateY(0.65rem);
  transition:
    opacity var(--duration-base) var(--ease-standard),
    visibility var(--duration-base) var(--ease-standard),
    transform var(--duration-base) var(--ease-standard),
    border-color var(--duration-fast) var(--ease-standard);
  visibility: hidden;
}

.mobile-toc-mark {
  position: relative;
  width: 0.95rem;
  height: 0.78rem;
  flex: 0 0 auto;
  display: inline-block;
  opacity: 0.78;
}

.mobile-toc-mark::before,
.mobile-toc-mark::after {
  content: "";
  position: absolute;
  top: 0.05rem;
}

.mobile-toc-mark::before {
  left: 0;
  width: 0.18rem;
  height: 0.18rem;
  background: currentColor;
  border-radius: 50%;
  box-shadow:
    0 0.3rem 0 currentColor,
    0 0.6rem 0 currentColor;
}

.mobile-toc-mark::after {
  left: 0.34rem;
  right: 0;
  height: 1px;
  background: currentColor;
  box-shadow:
    0 0.3rem 0 currentColor,
    0 0.6rem 0 currentColor;
}

.mobile-toc-panel {
  position: absolute;
  left: 0;
  bottom: calc(100% + var(--space-xs));
  width: min(22rem, calc(100vw - 2rem));
  max-height: min(52vh, 24rem);
  overflow: auto;
  padding: var(--space-md);
  color: var(--color-text);
  background: color-mix(in srgb, var(--color-bg-elevated) 94%, transparent);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-float);
  backdrop-filter: blur(18px);
  opacity: 0;
  pointer-events: none;
  transform: translateY(0.45rem);
  transition:
    opacity var(--duration-base) var(--ease-standard),
    visibility var(--duration-base) var(--ease-standard),
    transform var(--duration-base) var(--ease-standard);
  visibility: hidden;
}

.mobile-toc-title {
  display: block;
  margin-bottom: var(--space-xs);
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.mobile-toc-list {
  list-style: none;
}

.mobile-toc-branch {
  margin: 0.08rem 0 0.18rem 0.42rem;
  padding-left: 0.62rem;
  border-left: 1px solid var(--color-border-soft);
  list-style: none;
}

.mobile-toc-item {
  position: relative;
}

.mobile-toc-item + .mobile-toc-item {
  margin-top: 1px;
}

.mobile-toc-link {
  display: block;
  padding: 0.58rem 0.55rem;
  color: var(--color-text-soft);
  border-left: 2px solid transparent;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  line-height: 1.35;
  text-decoration: none;
}

.mobile-toc-item.has-children > .mobile-toc-link {
  padding-left: 1.7rem;
}

.mobile-toc-item.toc-level-2 > .mobile-toc-link {
  padding-left: 1.35rem;
}

.mobile-toc-item.toc-level-3 > .mobile-toc-link {
  padding-left: 2.1rem;
  color: var(--color-text-muted);
  font-size: 0.82rem;
}

.mobile-toc-item.has-children.toc-level-2 > .mobile-toc-link {
  padding-left: 2rem;
}

.mobile-toc-branch-toggle {
  position: absolute;
  top: 0.46rem;
  left: 0.18rem;
  z-index: 1;
  width: 1.25rem;
  height: 1.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-faint);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
}

.mobile-toc-branch-toggle span {
  width: 0.36rem;
  height: 0.36rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
  transition: transform var(--duration-fast) var(--ease-standard);
}

.mobile-toc-item.is-open > .mobile-toc-branch-toggle span {
  transform: rotate(45deg);
}

.mobile-toc-link:hover,
.mobile-toc-link:focus-visible,
.mobile-toc-link.active,
.mobile-toc-branch-toggle:hover,
.mobile-toc-branch-toggle:focus-visible {
  color: var(--color-text);
  background: color-mix(in srgb, var(--color-bg-soft) 70%, transparent);
}

.mobile-toc-link:hover,
.mobile-toc-link:focus-visible,
.mobile-toc-link.active {
  border-left-color: var(--color-primary);
}

.mobile-toc-item.is-current-branch > .mobile-toc-link:not(.active) {
  color: var(--color-text-soft);
}

.mobile-toc.is-visible .mobile-toc-toggle {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.mobile-toc.is-open .mobile-toc-toggle {
  border-color: var(--color-primary);
}

.mobile-toc.is-open .mobile-toc-panel {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
  visibility: visible;
}

.back-to-top:hover {
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
  box-shadow:
    0 3px 0 color-mix(in srgb, var(--color-primary-ink) 34%, transparent),
    var(--shadow-float);
  transform: translateY(-2px);
}

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

::-webkit-scrollbar {
  width: 0.55rem;
  height: 0.55rem;
}

::-webkit-scrollbar-track {
  background: var(--color-bg-soft);
}

::-webkit-scrollbar-thumb {
  background: var(--color-border);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-muted);
}

/* ========== 15. Responsive ========== */

@media (max-width: 1180px) {
  .post-body-grid.has-toc .post-content,
  .post-body-grid.has-toc .post-toc {
    grid-column: 1;
    grid-row: auto;
  }

  .post-body-grid.has-toc .post-toc {
    width: auto;
    margin-bottom: var(--space-xl);
    padding: var(--space-md) 0;
    justify-self: stretch;
    transform: none;
    border-left: 0;
    border-top: 1px solid var(--color-border-soft);
    border-bottom: 1px solid var(--color-border-soft);
  }

  .post-toc {
    position: static;
    max-height: none;
    overflow: visible;
    overflow-anchor: none;
  }

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

  .post-toc li.has-children > a {
    padding-left: 0.75rem;
  }
}

@media (max-width: 980px) {
  .header-inner {
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: var(--space-md);
    row-gap: 0;
  }

  .site-nav {
    grid-column: 1 / -1;
    justify-self: stretch;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition:
      max-height var(--duration-base) var(--ease-standard),
      opacity var(--duration-fast) var(--ease-standard);
  }

  .site-nav.active {
    max-height: 18rem;
    padding-top: var(--space-xs);
    opacity: 1;
  }

  .nav-menu {
    width: 100%;
    margin-top: 0;
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-xs);
  }

  .nav-link {
    width: 100%;
    justify-content: center;
    min-height: 2.7rem;
  }

  .header-actions {
    grid-column: 2;
    grid-row: 1;
  }

  .nav-toggle {
    display: inline-flex;
  }

  .home-cover,
  .post-body-grid.has-toc,
  .friends-hero,
  .friends-hero-copy,
  .friends-apply,
  .notfound-panel,
  .page-content-about .page-article {
    grid-template-columns: 1fr;
  }

  .home-cover {
    background:
      linear-gradient(180deg, color-mix(in srgb, var(--color-bg-soft) 58%, transparent), transparent 42%),
      var(--color-bg-elevated);
  }

  .home-cover::before,
  .home-cover::after {
    inset: var(--space-xs);
  }

  .home-cover-copy {
    min-height: 0;
  }

  .friends-hero-copy,
  .friends-apply {
    gap: var(--space-lg);
  }

  .about-article {
    gap: var(--space-2xl);
  }

  .about-profile-card {
    position: static;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: end;
  }

  .about-profile-links {
    grid-column: 1 / -1;
  }

  .friends-apply {
    align-items: start;
  }

  .notfound-panel {
    gap: var(--space-xl);
  }

  .notfound-panel::after {
    display: none;
  }

  .friends-apply-body {
    grid-template-columns: 1fr;
    gap: var(--space-lg);
    align-items: start;
  }

  .friends-apply .text-button {
    justify-self: start;
  }

  .year-title {
    position: static;
  }

  .post-body-grid.has-toc .post-content,
  .post-body-grid.has-toc .post-toc {
    grid-column: auto;
    grid-row: auto;
  }

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

  .footer-social {
    justify-content: flex-start;
  }
}

@media (max-width: 760px) {
  .site-main {
    width: min(100% - 2rem, var(--measure-full));
    padding-top: var(--space-xl);
    padding-bottom: var(--space-3xl);
  }

  .post-page,
  .related-posts,
  .post-nav {
    padding-right: clamp(0.25rem, 1.5vw, 0.5rem);
    padding-left: clamp(0.25rem, 1.5vw, 0.5rem);
  }

  .site-header {
    padding: var(--space-xs) var(--space-xs) 0;
  }

  .header-inner {
    padding: var(--space-xs);
  }

  .home-cover {
    gap: var(--space-sm);
    align-items: stretch;
    min-height: 0;
    padding: var(--space-sm);
  }

  .home-cover-frame {
    min-height: 0;
    display: block;
    margin-bottom: var(--space-3xl);
  }

  .home-cover-copy {
    gap: var(--space-xl);
    padding: var(--space-lg);
  }

  .cover-title {
    font-size: 2.75rem;
  }

  .cover-subtitle {
    font-size: 1.05rem;
  }

  .cover-ledger {
    padding: var(--space-xs);
  }

  .ledger-feature {
    min-height: 0;
    padding: var(--space-md);
  }

  .cover-ledger dl > div {
    grid-template-columns: 1fr;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-md);
  }

  .issue-item {
    grid-template-columns: 1fr;
    gap: var(--space-md);
    padding: var(--space-md);
  }

  .issue-reading {
    justify-self: start;
    text-align: left;
  }

  .friends-hero {
    gap: var(--space-lg);
    margin-bottom: var(--space-2xl);
    padding-bottom: var(--space-lg);
  }

  .section-heading {
    align-items: start;
    flex-direction: column;
    gap: var(--space-sm);
  }

  .latest-section .section-heading {
    align-items: end;
    flex-direction: row;
  }

  .latest-section .section-action {
    margin-left: auto;
    white-space: nowrap;
  }

  .post-header .post-title,
  .page-title {
    font-size: clamp(2rem, 10vw, 2.55rem);
    line-height: 1.1;
  }

  .post-header {
    margin-bottom: var(--space-xl);
    padding: 0 0 var(--space-lg);
  }

  .post-header .post-title {
    max-width: none;
  }

  .post-kicker {
    gap: 0.35rem 0.45rem;
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
    font-size: 0.72rem;
    line-height: 1.5;
  }

  .post-description {
    margin-top: var(--space-md);
    font-size: 0.98rem;
    line-height: 1.74;
  }

  .post-body-grid,
  .post-body-grid.has-toc {
    grid-template-columns: minmax(0, 1fr);
  }

  .post-body-grid.has-toc .post-toc {
    margin-bottom: var(--space-xl);
    padding: var(--space-sm) 0;
  }

  .toc-title {
    margin-bottom: var(--space-xs);
    font-size: 0.68rem;
  }

  .post-toc ol {
    font-size: 0.84rem;
    line-height: 1.5;
  }

  .post-toc ol ol {
    margin-top: 0.08rem;
    margin-bottom: 0.12rem;
    padding-left: 0.62rem;
  }

  .post-toc a {
    padding: 0.42rem 0.35rem 0.42rem 0.6rem;
  }

  .post-toc li.has-children > a {
    padding-left: 0.6rem;
  }

  .toc-toggle {
    top: 0.3rem;
  }

  .post-content,
  .page-body {
    font-size: 1rem;
    line-height: 1.82;
  }

  .post-content > * + *,
  .page-body > * + * {
    margin-top: 0.95rem;
  }

  .post-content h1,
  .page-body h1 {
    margin-top: var(--space-2xl);
    font-size: 2rem;
    line-height: 1.12;
  }

  .post-content h2,
  .page-body h2 {
    margin-top: var(--space-2xl);
    padding-left: 0.85rem;
    font-size: 1.42rem;
  }

  .post-content h3,
  .page-body h3 {
    margin-top: var(--space-xl);
    font-size: 1.12rem;
  }

  .post-content ul,
  .post-content ol,
  .page-body ul,
  .page-body ol {
    padding-left: 1.25rem;
  }

  .post-tags {
    margin-top: var(--space-xl);
    padding-top: var(--space-md);
  }

  .post-nav {
    margin-top: var(--space-2xl);
  }

  .post-nav-item {
    min-height: 0;
    gap: var(--space-md);
    padding: var(--space-md) 0;
  }

  .year-group {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }

  .taxonomy-panels {
    grid-template-columns: 1fr;
  }

  .post-item,
  .related-item,
  .post-nav {
    grid-template-columns: 1fr;
  }

  .taxonomy-panel + .taxonomy-panel {
    border-top: 1px solid var(--color-border-soft);
    border-left: 0;
  }

  .archive-item {
    grid-template-columns: 1.25rem minmax(0, 1fr);
    gap: var(--space-xs) var(--space-md);
  }

  .archive-marker {
    grid-row: 1 / span 2;
  }

  .archive-date,
  .archive-main {
    grid-column: 2;
  }

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

  .friend-card-grid {
    grid-template-columns: 1fr;
  }

  .tag-index-grid {
    grid-template-columns: 1fr;
  }

  .tag-index-card.weight-4,
  .tag-index-card.weight-5 {
    --tag-cloud-size: 1rem;
  }

  .about-section-grid {
    grid-template-columns: 1fr;
  }

  .about-section {
    min-height: 0;
  }

  .search-overlay {
    padding: var(--space-2xl) var(--space-xs);
  }

  .search-results-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: var(--space-sm);
  }

  .notfound-page {
    min-height: 0;
  }

  .notfound-panel {
    padding: var(--space-lg);
  }

  .notfound-code {
    font-size: clamp(3.5rem, 22vw, 5.5rem);
  }

  .back-to-top {
    right: var(--space-md);
    bottom: var(--space-md);
  }

  .mobile-toc {
    position: fixed;
    left: var(--space-md);
    bottom: calc(var(--space-md) + env(safe-area-inset-bottom, 0px));
    z-index: 26;
    display: block;
    pointer-events: none;
  }

  .mobile-toc.is-visible,
  .mobile-toc.is-open {
    pointer-events: auto;
  }
}

@media (max-width: 480px) {
  .header-actions {
    gap: 0.25rem;
  }

  .lang-trigger {
    min-width: 3.35rem;
    padding: 0 0.55rem;
  }

  .site-title {
    font-size: 0.92rem;
  }

  .post-card,
  .friends-empty,
  .friends-apply,
  .notfound-panel,
  .friend-card {
    padding: var(--space-md);
  }

  .home-cover {
    padding: var(--space-xs);
  }

  .home-cover-copy {
    padding: var(--space-md);
  }

  .post-kicker {
    font-size: 0.7rem;
  }

  .post-description {
    font-size: 0.96rem;
  }

  .post-content figure.highlight,
  .post-content > pre {
    --code-copy-width: 2.85rem;
    --code-gutter-width: 2.35rem;
  }

  .post-content figure.highlight table {
    font-size: 0.8rem;
    line-height: 1.62;
  }

  .post-content figure.highlight .gutter .line {
    padding: 0 0.42rem;
  }

  .code-lang {
    padding: 0 0.52rem;
    font-size: 0.64rem;
  }

  .mobile-toc-panel {
    width: min(20rem, calc(100vw - 2rem));
    max-height: 50vh;
  }

  .about-profile-card {
    grid-template-columns: 1fr;
    gap: var(--space-lg);
    padding: var(--space-lg);
  }

  .about-avatar {
    width: 6.25rem;
  }

  .about-section {
    padding: var(--space-lg);
  }

  .cover-actions,
  .notfound-actions,
  .text-button {
    width: 100%;
  }

  .text-button {
    grid-template-columns: minmax(0, 1fr) 1.8rem;
  }

  .friends-apply .text-button {
    width: fit-content;
    max-width: 100%;
    grid-template-columns: auto 1.8rem;
  }

  .friends-apply .text-button span:first-child {
    padding: 0 var(--space-sm);
    white-space: nowrap;
  }

  .friends-hero {
    margin-bottom: var(--space-xl);
  }

  .friends-hero-copy,
  .friends-apply {
    gap: var(--space-md);
  }

  .friends-apply-body {
    gap: var(--space-md);
  }

  .tag-index-card {
    min-height: 3.85rem;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
  }
}

/* ========== 16. Print ========== */

@media print {
  .site-header,
  .site-footer,
  .post-toc,
  .mobile-toc,
  .post-nav,
  .related-posts,
  .back-to-top,
  .search-trigger,
  .theme-toggle,
  .lang-switch,
  .copy-code-btn,
  .code-lang {
    display: none !important;
  }

  body {
    color: #000;
    background: #fff;
  }

  body::before {
    display: none;
  }

  a {
    color: #000;
    text-decoration: underline;
  }

  .site-main,
  .post-page,
  .post-header,
  .post-content,
  .page-body {
    width: auto;
    max-width: none;
    padding: 0;
    margin: 0;
  }
}
