/* ==========================================================================
   Mercury Lamp — minimal black & white material
   ========================================================================== */

:root {
  --ink: #111111;
  --ink-soft: #333333;
  --muted: #666666;
  --faint: #8a8a8a;
  --line: #e6e6e6;
  --line-strong: #cfcfcf;
  --surface: #f7f7f7;
  --surface-soft: #fafafa;
  --paper: #ffffff;
  --app-bar-height: 64px;
  --reading-width: 780px;
  --page-width: 1120px;
  --drawer-left-width: 328px;
  --drawer-right-width: 304px;
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC",
    "Noto Sans CJK SC", "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  --mono: "SFMono-Regular", "Cascadia Code", "Roboto Mono", Consolas,
    "Liberation Mono", Menlo, monospace;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--app-bar-height) + 28px);
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body.is-drawer-open {
  overflow: hidden;
}

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

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

button {
  font: inherit;
  color: inherit;
}

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

.mono {
  font-family: var(--mono);
}

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

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 200;
  padding: 10px 16px;
  background: var(--ink);
  color: var(--paper);
  font-size: 13px;
  transform: translateY(-160%);
  transition: transform 0.2s var(--ease);
}

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

/* --------------------------------------------------------------------------
   App bar
   -------------------------------------------------------------------------- */

.app-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--app-bar-height);
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid transparent;
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.app-bar.is-scrolled {
  border-bottom-color: var(--line);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.035);
}

.app-bar-static {
  position: relative;
}

.app-bar-inner {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  max-width: 1280px;
  height: 100%;
  margin: 0 auto;
  padding: 0 24px;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: background-color 0.18s var(--ease), transform 0.18s var(--ease);
}

.icon-button:hover {
  background: #f1f1f1;
}

.icon-button:active {
  transform: scale(0.94);
}

.icon-button svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  padding: 6px 2px;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.035em;
  white-space: nowrap;
}

.brand-name::after {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-left: 6px;
  border-radius: 50%;
  background: var(--ink);
  vertical-align: 0.35em;
}

.app-nav {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-left: auto;
  padding-left: 24px;
  font-size: 13px;
  letter-spacing: 0.02em;
}

.app-nav a {
  position: relative;
  padding: 6px 1px;
  color: var(--muted);
  transition: color 0.18s var(--ease);
}

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

.app-nav a[aria-current="page"] {
  color: var(--ink);
}

.app-nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 1px;
  background: var(--ink);
}

.app-actions {
  display: flex;
  align-items: center;
  margin-left: 10px;
}

.toc-trigger {
  border: 1px solid transparent;
}

.toc-trigger:hover {
  border-color: var(--line);
}

/* --------------------------------------------------------------------------
   Page shell
   -------------------------------------------------------------------------- */

.page-main {
  min-height: calc(100vh - var(--app-bar-height) - 150px);
}

.home-wrap,
.index-wrap {
  width: 100%;
  max-width: var(--page-width);
  margin: 0 auto;
  padding: 0 32px;
}

.eyebrow {
  margin: 0 0 18px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--line-strong);
}

/* --------------------------------------------------------------------------
   Home
   -------------------------------------------------------------------------- */

.hero {
  padding: 104px 0 76px;
  border-bottom: 1px solid var(--line);
}

.hero-title {
  max-width: 900px;
  margin: 0 0 30px;
  font-size: clamp(52px, 8.4vw, 104px);
  font-weight: 600;
  letter-spacing: -0.068em;
  line-height: 0.93;
  text-wrap: balance;
}

.hero-intro {
  max-width: 620px;
  margin: 0 0 30px;
  color: #444;
  font-size: 18px;
  line-height: 1.8;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 13px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.01em;
}

.hero-meta strong {
  color: var(--ink);
  font-weight: 600;
}

.hero-meta a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  text-decoration-color: var(--line-strong);
  transition: text-decoration-color 0.18s var(--ease);
}

.hero-meta a:hover {
  text-decoration-color: var(--ink);
}

.content-section {
  padding: 56px 0;
  border-bottom: 1px solid var(--line);
}

.content-section:last-child {
  border-bottom: 0;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.section-heading h2 {
  margin: 0;
  font-size: 27px;
  font-weight: 600;
  letter-spacing: -0.04em;
}

.section-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.section-count {
  color: var(--faint);
  font-size: 10px;
  letter-spacing: 0.08em;
}

.sort-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.03em;
  transition: background-color 0.18s var(--ease), border-color 0.18s var(--ease),
    color 0.18s var(--ease);
}

.sort-toggle svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sort-toggle:hover {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}

.section-more {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.section-more svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.18s var(--ease);
}

.section-more:hover {
  color: var(--ink);
}

.section-more:hover svg {
  transform: translateX(3px);
}

/* Post list ---------------------------------------------------------------- */

.post-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

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

.post-row-link {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr) minmax(0, 190px) 22px;
  gap: 22px;
  align-items: center;
  padding: 21px 8px;
  transition: background-color 0.18s var(--ease), padding 0.2s var(--ease);
}

.post-row-link:hover {
  padding-right: 14px;
  padding-left: 16px;
  background: var(--surface-soft);
}

.post-date {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.02em;
}

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

.post-title {
  margin: 0;
  font-size: 19px;
  font-weight: 560;
  letter-spacing: -0.025em;
  line-height: 1.4;
  transition: transform 0.2s var(--ease);
}

.post-row-link:hover .post-title {
  transform: translateX(2px);
}

.post-summary {
  display: -webkit-box;
  margin: 5px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.post-path {
  overflow: hidden;
  color: var(--faint);
  font-size: 10px;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.post-arrow {
  display: grid;
  place-items: center;
  color: var(--ink);
  opacity: 0;
  transform: translateX(-5px);
  transition: opacity 0.18s var(--ease), transform 0.18s var(--ease);
}

.post-arrow svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.post-row-link:hover .post-arrow {
  opacity: 1;
  transform: translateX(0);
}

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

/* Pagination --------------------------------------------------------------- */

.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.pagination-steps,
.page-numbers {
  display: flex;
  align-items: center;
  gap: 5px;
}

.page-step {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 2px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.02em;
  transition: background-color 0.18s var(--ease), border-color 0.18s var(--ease),
    color 0.18s var(--ease);
}

.page-step:hover {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--ink);
}

.page-step.is-disabled {
  border-color: #eeeeee;
  color: #c3c3c3;
  cursor: default;
}

.page-step.is-disabled:hover {
  border-color: #eeeeee;
  background: transparent;
  color: #c3c3c3;
}

.page-number {
  display: inline-grid;
  place-items: center;
  min-width: 32px;
  height: 32px;
  padding: 0 6px;
  border: 1px solid transparent;
  border-radius: 2px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  transition: background-color 0.18s var(--ease), border-color 0.18s var(--ease),
    color 0.18s var(--ease);
}

.page-number:hover {
  border-color: var(--line);
  background: var(--surface-soft);
  color: var(--ink);
}

.page-number.is-current {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}

.page-ellipsis {
  padding: 0 2px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 10px;
}

.page-status {
  margin: 0;
  color: var(--faint);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.list-page-header {
  padding-bottom: 40px;
}

/* Category chips ----------------------------------------------------------- */

.category-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 2px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  padding: 9px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 13px;
  line-height: 1;
  transition: background-color 0.18s var(--ease), border-color 0.18s var(--ease),
    color 0.18s var(--ease);
}

.chip:hover {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}

.chip-count {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 10px;
}

.chip:hover .chip-count {
  color: rgba(255, 255, 255, 0.65);
}

/* --------------------------------------------------------------------------
   Index / categories
   -------------------------------------------------------------------------- */

.index-header {
  padding: 88px 0 50px;
  border-bottom: 1px solid var(--line);
}

.index-header h1 {
  margin: 0 0 18px;
  font-size: clamp(48px, 7vw, 82px);
  font-weight: 600;
  letter-spacing: -0.06em;
  line-height: 1;
}

.index-lead {
  max-width: 560px;
  margin: 0 0 28px;
  color: #4a4a4a;
  font-size: 16px;
  line-height: 1.8;
}

.index-meta {
  margin: 0;
  color: var(--faint);
  font-size: 10px;
  letter-spacing: 0.09em;
}

.category-header {
  padding-top: 44px;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding-top: 34px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 11px;
}

.breadcrumb a {
  color: var(--muted);
  transition: color 0.18s var(--ease);
}

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

.breadcrumb [aria-current="page"] {
  color: var(--ink);
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding: 40px 0 72px;
}

.category-card {
  position: relative;
  display: flex;
  min-height: 190px;
  padding: 26px 28px;
  border: 1px solid var(--line);
  background: var(--paper);
  flex-direction: column;
  overflow: hidden;
  transition: background-color 0.22s var(--ease), border-color 0.22s var(--ease),
    color 0.22s var(--ease);
}

.category-card::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 2px;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s var(--ease);
}

.category-card:hover {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}

.category-card:hover::after {
  transform: scaleX(1);
  background: var(--paper);
}

.category-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.category-index {
  color: var(--faint);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.category-count {
  display: grid;
  place-items: center;
  min-width: 31px;
  height: 23px;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
}

.category-card:hover .category-index,
.category-card:hover .category-count {
  border-color: rgba(255, 255, 255, 0.3);
  color: rgba(255, 255, 255, 0.72);
}

.category-card h2 {
  margin: 22px 0 4px;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.04em;
}

.category-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.category-card:hover p {
  color: rgba(255, 255, 255, 0.66);
}

.category-arrow {
  position: absolute;
  right: 26px;
  bottom: 22px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: var(--ink);
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
}

.category-card:hover .category-arrow {
  color: var(--paper);
  opacity: 1;
  transform: translateX(0);
}

.category-arrow svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* --------------------------------------------------------------------------
   Article
   -------------------------------------------------------------------------- */

.article-wrap {
  width: 100%;
  max-width: var(--reading-width);
  margin: 0 auto;
  padding: 0 30px 100px;
}

.article-header {
  padding: 86px 0 48px;
  margin-bottom: 48px;
  border-bottom: 1px solid var(--line);
  text-align: center;
}

.article-path {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 0 0 22px;
  color: var(--faint);
  font-size: 10px;
  letter-spacing: 0.02em;
}

.article-path .path-sep {
  color: var(--line-strong);
}

.article-title {
  max-width: 720px;
  margin: 0 auto 24px;
  font-size: clamp(36px, 5.2vw, 58px);
  font-weight: 600;
  letter-spacing: -0.052em;
  line-height: 1.1;
  overflow-wrap: anywhere;
  text-wrap: balance;
}

.article-updated {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.01em;
}

.article-updated svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.article-categories {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 5px 13px;
  margin: 16px 0 0;
  color: var(--faint);
  font-size: 11px;
}

.article-categories > span {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.article-categories a {
  padding-bottom: 1px;
  border-bottom: 1px solid var(--line-strong);
  color: var(--ink-soft);
  transition: border-color 0.18s var(--ease);
}

.article-categories a:hover {
  border-color: var(--ink);
}

/* Prose -------------------------------------------------------------------- */

.prose {
  color: #1c1c1c;
  font-size: 17px;
  line-height: 1.9;
  overflow-wrap: anywhere;
}

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

.prose > :last-child {
  margin-bottom: 0;
}

.prose h1,
.prose h2,
.prose h3,
.prose h4,
.prose h5,
.prose h6 {
  margin: 2.2em 0 0.75em;
  color: var(--ink);
  font-weight: 600;
  line-height: 1.32;
  letter-spacing: -0.028em;
  scroll-margin-top: calc(var(--app-bar-height) + 26px);
}

.prose h1 {
  font-size: 2em;
}

.prose h2 {
  padding-bottom: 0.38em;
  border-bottom: 1px solid var(--line);
  font-size: 1.55em;
}

.prose h3 {
  font-size: 1.26em;
}

.prose h4 {
  font-size: 1.08em;
}

.prose h5,
.prose h6 {
  color: var(--ink-soft);
  font-size: 0.98em;
}

.prose p {
  margin: 0 0 1.25em;
}

.prose a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 4px;
  transition: text-decoration-color 0.18s var(--ease);
}

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

.prose strong,
.prose b {
  font-weight: 650;
}

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

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

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

.prose li > ul,
.prose li > ol {
  margin-top: 0.35em;
  margin-bottom: 0.35em;
}

.prose blockquote {
  margin: 2em 0;
  padding: 3px 0 3px 24px;
  border-left: 3px solid var(--ink);
  color: #555;
}

.prose blockquote p:last-child {
  margin-bottom: 0;
}

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

.prose img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 2em auto;
  border: 1px solid var(--line);
}

.prose figure {
  margin: 2em 0;
}

.prose figcaption {
  margin-top: 0.7em;
  color: var(--faint);
  font-size: 12px;
  text-align: center;
}

.prose code {
  padding: 0.14em 0.36em;
  border-radius: 2px;
  background: #f2f2f2;
  font-family: var(--mono);
  font-size: 0.86em;
}

.prose pre code {
  padding: 0;
  background: transparent;
  font-size: 0.84em;
  line-height: 1.68;
}

.prose .table-wrap {
  margin: 2em 0;
  overflow-x: auto;
  border: 1px solid var(--line);
}

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

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

.prose th {
  background: var(--surface-soft);
  font-weight: 600;
}

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

.prose .katex {
  font-size: 1.02em;
}

.prose .katex-display {
  max-width: 100%;
  margin: 1.7em 0;
  padding: 0.35em 0;
  overflow-x: auto;
  overflow-y: hidden;
}

.prose .katex-block {
  margin: 1.7em 0;
}

.prose .katex-block .katex-display {
  margin: 0;
}

/* Code blocks -------------------------------------------------------------- */

.code-block {
  margin: 1.9em 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--paper);
}

.code-block pre.hljs,
.prose .code-block pre.hljs {
  margin: 0;
  padding: 18px 20px;
  overflow-x: auto;
  border: 0;
  background: #ffffff;
  font-size: 13px;
  line-height: 1.68;
}

.code-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 32px;
  padding: 5px 8px 5px 13px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.code-language {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.code-copy {
  padding: 5px 8px;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: background-color 0.18s var(--ease), color 0.18s var(--ease);
}

.code-copy:hover {
  background: #ededed;
  color: var(--ink);
}

.code-copy.is-copied {
  color: var(--ink);
}

/* Keep the googlecode theme's token colours, but make the container match. */
.hljs {
  display: block;
  overflow-x: auto;
  padding: 0.5em;
  background: #ffffff;
  color: #000000;
}

/* --------------------------------------------------------------------------
   Drawers
   -------------------------------------------------------------------------- */

.drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  z-index: 80;
  display: flex;
  width: min(88vw, var(--drawer-left-width));
  background: var(--paper);
  flex-direction: column;
  box-shadow: 24px 0 60px rgba(0, 0, 0, 0.12);
  transition: transform 0.3s var(--ease);
  will-change: transform;
}

.drawer-left {
  left: 0;
  border-right: 1px solid var(--line);
  transform: translateX(-102%);
}

.drawer-right {
  right: 0;
  width: min(88vw, var(--drawer-right-width));
  border-left: 1px solid var(--line);
  transform: translateX(102%);
  box-shadow: -24px 0 60px rgba(0, 0, 0, 0.1);
}

body.drawer-left-open .drawer-left,
body.drawer-right-open .drawer-right {
  transform: translateX(0);
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex: 0 0 auto;
  padding: 22px 16px 16px 24px;
  border-bottom: 1px solid var(--line);
}

.drawer-eyebrow {
  margin: 0 0 3px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.14em;
}

.drawer-head h2 {
  margin: 0;
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.035em;
}

.drawer-close {
  width: 38px;
  height: 38px;
}

.drawer-scroll {
  flex: 1 1 auto;
  padding: 14px 10px 30px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.drawer-quick {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin: 0 6px 18px;
}

.drawer-quick.has-three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.drawer-quick a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 2px;
  color: var(--ink-soft);
  font-size: 12px;
  transition: background-color 0.18s var(--ease), border-color 0.18s var(--ease);
}

.drawer-quick a:hover {
  border-color: var(--line-strong);
  background: var(--surface-soft);
}

.drawer-quick svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.drawer-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex: 0 0 auto;
  padding: 13px 20px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 9px;
  letter-spacing: 0.03em;
}

/* Tree -------------------------------------------------------------------- */

.tree-root,
.tree-children {
  margin: 0;
  padding: 0;
  list-style: none;
}

.tree-children {
  margin-left: 15px;
  padding-left: 6px;
  border-left: 1px solid #ededed;
}

.tree-folder-toggle {
  display: flex;
  align-items: center;
  gap: 5px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.16s var(--ease);
}

.tree-folder-toggle:hover {
  background: var(--surface);
}

.tree-chevron {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 15px;
  height: 15px;
  color: var(--faint);
  transition: transform 0.18s var(--ease);
}

.tree-chevron svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tree-folder.is-open > .tree-folder-toggle .tree-chevron {
  transform: rotate(90deg);
}

.tree-folder.is-collapsed > .tree-children {
  display: none;
}

.tree-count {
  margin-left: auto;
  padding: 1px 5px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--faint);
  font-family: var(--mono);
  font-size: 8px;
}

.tree-file a {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 7px 10px;
  border-radius: 2px;
  color: var(--muted);
  font-size: 12.5px;
  transition: background-color 0.16s var(--ease), color 0.16s var(--ease);
}

.tree-file a:hover {
  background: var(--surface);
  color: var(--ink);
}

.tree-file.is-active a {
  background: var(--ink);
  color: var(--paper);
}

.tree-file-icon {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 15px;
  height: 15px;
  color: var(--faint);
}

.tree-file.is-active .tree-file-icon {
  color: rgba(255, 255, 255, 0.6);
}

.tree-file-icon svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tree-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-empty {
  margin: 18px 12px;
  color: var(--faint);
  font-size: 12px;
}

/* Table of contents ------------------------------------------------------- */

.toc-list {
  margin: 0;
  padding: 6px 4px;
  list-style: none;
}

.toc-item a {
  display: block;
  padding: 7px 12px 7px 14px;
  border-left: 2px solid transparent;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.55;
  transition: color 0.16s var(--ease), background-color 0.16s var(--ease),
    border-color 0.16s var(--ease);
}

.toc-level-2 > a {
  color: var(--ink-soft);
  font-weight: 500;
}

.toc-level-3 > a {
  padding-left: 27px;
}

.toc-level-4 > a,
.toc-level-5 > a,
.toc-level-6 > a {
  padding-left: 40px;
  font-size: 11.5px;
}

.toc-item a:hover {
  background: var(--surface-soft);
  color: var(--ink);
}

.toc-item a.is-active {
  border-left-color: var(--ink);
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
}

.toc-empty {
  margin: 16px 14px;
  color: var(--faint);
  font-size: 12px;
}

/* Scrim ------------------------------------------------------------------- */

.scrim {
  position: fixed;
  inset: 0;
  z-index: 70;
  visibility: hidden;
  background: rgba(0, 0, 0, 0.34);
  opacity: 0;
  transition: opacity 0.28s var(--ease), visibility 0.28s var(--ease);
}

body.drawer-left-open .scrim,
body.drawer-right-open .scrim {
  visibility: visible;
  opacity: 1;
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.site-footer {
  padding: 30px 32px;
  border-top: 1px solid var(--line);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: 100%;
  max-width: var(--page-width);
  margin: 0 auto;
}

.copyright {
  margin: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.02em;
}

.footer-nav {
  display: flex;
  align-items: center;
  gap: 18px;
  color: var(--faint);
  font-size: 10px;
}

.footer-nav a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color 0.18s var(--ease);
}

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

.footer-nav svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.18s var(--ease);
}

.footer-top-link:hover svg {
  transform: translateY(-2px);
}

.footer-note {
  margin: 0;
  color: var(--faint);
  font-size: 9px;
  letter-spacing: 0.08em;
}

/* --------------------------------------------------------------------------
   404
   -------------------------------------------------------------------------- */

.not-found-main {
  display: grid;
  min-height: calc(100vh - var(--app-bar-height) - 110px);
  place-items: center;
}

.not-found {
  width: 100%;
  max-width: 680px;
  padding: 70px 28px 90px;
  text-align: center;
}

.not-found-code {
  margin: 0 0 5px;
  color: var(--ink);
  font-size: clamp(120px, 23vw, 250px);
  font-weight: 600;
  letter-spacing: -0.1em;
  line-height: 0.74;
}

.not-found .eyebrow {
  margin-top: 30px;
}

.not-found h1 {
  margin: 0 0 18px;
  font-size: clamp(32px, 4.6vw, 52px);
  font-weight: 600;
  letter-spacing: -0.05em;
  line-height: 1.15;
  text-wrap: balance;
}

.not-found-lead {
  max-width: 440px;
  margin: 0 auto 34px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.8;
}

.not-found-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 19px;
  border: 1px solid var(--ink);
  border-radius: 2px;
  font-size: 12px;
  letter-spacing: 0.02em;
  transition: background-color 0.18s var(--ease), color 0.18s var(--ease);
}

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

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

.button-ghost {
  background: var(--paper);
  color: var(--ink);
}

.button-ghost:hover {
  background: var(--ink);
  color: var(--paper);
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 900px) {
  .home-wrap,
  .index-wrap {
    padding: 0 24px;
  }

  .hero {
    padding: 76px 0 58px;
  }

  .post-row-link {
    grid-template-columns: 74px minmax(0, 1fr) 20px;
    gap: 16px;
  }

  .post-path {
    display: none;
  }

  .article-wrap {
    padding: 0 24px 80px;
  }

  .article-header {
    padding-top: 66px;
  }
}

@media (max-width: 720px) {
  .app-bar-inner {
    padding: 0 10px;
  }

  .app-nav {
    display: none;
  }

  .app-actions {
    margin-left: auto;
  }

  .brand {
    font-size: 16px;
  }

  .hero-title {
    letter-spacing: -0.06em;
  }

  .hero-intro {
    font-size: 16px;
  }

  .content-section {
    padding: 42px 0;
  }

  .section-heading {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 10px;
  }

  .section-heading h2 {
    font-size: 24px;
  }

  .section-tools {
    justify-content: flex-start;
  }

  .pagination {
    justify-content: center;
    gap: 12px;
  }

  .pagination-steps,
  .page-numbers {
    justify-content: center;
  }

  .page-status {
    width: 100%;
    order: 3;
    text-align: center;
  }

  .post-row-link {
    grid-template-columns: 68px minmax(0, 1fr);
    gap: 12px;
    padding: 18px 4px;
  }

  .post-date {
    font-size: 9px;
  }

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

  .post-summary {
    font-size: 12px;
    -webkit-line-clamp: 2;
  }

  .post-arrow {
    display: none;
  }

  .category-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    padding-bottom: 52px;
  }

  .category-card {
    min-height: 160px;
  }

  .index-header {
    padding-top: 62px;
  }

  .breadcrumb {
    padding-top: 26px;
  }

  .category-header {
    padding-top: 34px;
  }

  .article-wrap {
    padding: 0 20px 64px;
  }

  .article-header {
    padding: 52px 0 36px;
    margin-bottom: 36px;
  }

  .article-title {
    margin-bottom: 20px;
  }

  .prose {
    font-size: 16px;
    line-height: 1.85;
  }

  .prose h2 {
    font-size: 1.4em;
  }

  .prose h3 {
    font-size: 1.2em;
  }

  .site-footer {
    padding: 24px 20px;
  }

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

  .not-found {
    padding: 58px 22px 72px;
  }
}

@media (max-width: 420px) {
  .hero-title {
    font-size: 48px;
  }

  .hero-meta {
    gap: 9px;
  }

  .post-row-link {
    grid-template-columns: 58px minmax(0, 1fr);
  }

  .chip {
    padding: 8px 12px;
  }

  .article-title {
    font-size: 34px;
  }

  .article-path {
    font-size: 9px;
  }
}

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

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

/* --------------------------------------------------------------------------
   Print
   -------------------------------------------------------------------------- */

@media print {
  .app-bar,
  .drawer,
  .scrim,
  .site-footer,
  .skip-link,
  .code-toolbar,
  .article-categories {
    display: none !important;
  }

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

  .article-wrap {
    max-width: none;
    padding: 0;
  }

  .article-header {
    padding-top: 0;
    text-align: left;
  }

  .article-path,
  .article-updated {
    justify-content: flex-start;
  }

  .prose a {
    text-decoration: none;
  }

  .prose pre {
    white-space: pre-wrap;
    border: 1px solid #ccc;
  }

  .code-block {
    border-color: #ccc;
  }
}
