/* The site's layout and palette live here; the theme supplies content widgets. */
:root {
  --site-accent: #946474;
  --site-accent-soft: #f1e9ec;
  --site-background: #fafaf9;
  --site-text: #34363b;
  --site-muted: #697078;
  --site-border: #e4e3e1;
  --site-surface: #ffffff;
  --site-shadow: 0 12px 36px rgba(40, 34, 38, 0.1);
  --site-font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --site-reading-width: 760px;
  --site-nav-height: 60px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --site-accent: #c89baa;
  --site-accent-soft: #382d34;
  --site-background: #202124;
  --site-text: #e2e1df;
  --site-muted: #a8adb4;
  --site-border: #3a3b40;
  --site-surface: #28292d;
  --site-shadow: 0 12px 36px rgba(0, 0, 0, 0.25);
  color-scheme: dark;
}

/* Map the theme's red tokens to the same restrained palette. */
:root,
:root[data-theme="dark"] {
  --red-0: var(--site-accent);
  --red-1: var(--site-accent);
  --red-2: var(--site-accent);
  --red-3: var(--site-border);
  --red-4: var(--site-border);
  --red-5: var(--site-accent-soft);
  --red-5-5: var(--site-accent-soft);
  --red-6: var(--site-accent-soft);
  --grey-9: var(--site-muted);
  --grey-7: var(--site-text);
  --color-default: var(--site-text);
  --color-archive-year: var(--site-text);
  --color-link: var(--site-accent);
  --color-border: var(--site-border);
  --color-background: var(--site-background);
  --color-code-background: var(--site-accent-soft);
  --color-wrap: var(--site-surface);
  --color-sticky: var(--site-surface);
  --color-header-background: var(--site-background);
  --color-footer-background: var(--site-background);
  --color-mobile-nav-background: var(--site-surface);
  --color-h2-border: var(--site-border);
  --color-h2-after: var(--site-accent);
  --color-red-6-shadow: transparent;
  --color-red-3-shadow: transparent;
  --shadow-meta: none;
  --shadow-meta-hover: none;
  --shadow-card: none;
  --shadow-card-hover: none;
  --shadow-red-6-shadow: none;
}

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

html {
  scroll-padding-top: calc(var(--site-nav-height) + 24px);
}

body {
  margin: 0;
  font-family: var(--site-font);
  font-size: 16px;
  line-height: 1.65;
  letter-spacing: 0;
  transition: background-color 160ms ease, color 160ms ease;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  text-underline-offset: 0.18em;
}

:focus-visible {
  outline: 2px solid var(--site-accent);
  outline-offset: 4px;
}

#wrap {
  position: relative;
  height: auto;
  min-height: 100%;
  transition: none;
}

#content,
#content.sidebar-left,
#content.sidebar-right {
  display: block;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 40px 32px 20px;
}

#main,
#content.sidebar-left #main,
#content.sidebar-right #main {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  margin: 0;
  padding: 0;
}

#sidebar {
  display: none !important;
}

/* Header and navigation */
#header {
  position: relative;
  height: min(var(--site-banner-height, 300px), 300px);
  min-height: 0;
  overflow: hidden;
  isolation: isolate;
}

#header::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  background: rgba(0, 0, 0, var(--site-banner-overlay, 0.2));
  content: "";
  pointer-events: none;
}

#header > img,
#header > picture > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--site-banner-position, center);
  -webkit-mask: none;
  mask: none;
}

#header-title {
  top: calc(50% + 18px);
  margin-top: 0;
  opacity: 1;
  filter: none;
  transform: translateY(-50%);
  animation: none;
  will-change: auto;
}

#logo {
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 600;
  letter-spacing: 0.025em;
  transform: none;
}

#logo h1 {
  font-weight: inherit;
}

#subtitle-wrap {
  margin-top: 12px;
}

#subtitle {
  font-size: 15px;
  letter-spacing: 0.04em;
}

body.is-post-page #header,
body.is-list-page #header {
  height: var(--site-nav-height);
  min-height: 0;
}

body.is-post-page #header > img,
body.is-post-page #header > picture,
body.is-post-page #header::before,
body.is-post-page #header::after,
body.is-post-page #header-outer,
body.is-list-page #header > img,
body.is-list-page #header > picture,
body.is-list-page #header::before,
body.is-list-page #header::after,
body.is-list-page #header-outer {
  display: none;
}

#header-nav {
  min-height: var(--site-nav-height);
  padding: 0 max(20px, calc((100vw - 1056px) / 2));
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--site-border);
  background: var(--site-background);
  box-shadow: none;
  transition: top 180ms ease;
}

#header-nav:hover,
[data-theme="dark"] #header-nav:hover {
  background: var(--site-background);
}

#main-nav,
#sub-nav {
  min-height: var(--site-nav-height);
  gap: 4px;
}

#header-nav .main-nav-link-wrap {
  padding: 0;
  opacity: 1;
  color: var(--site-text);
  transition: none;
}

#header-nav .main-nav-icon {
  display: none;
}

#header-nav .main-nav-link {
  display: block;
  padding: 18px 12px;
  font-size: 14px;
  font-weight: 500;
  line-height: 24px;
  letter-spacing: 0;
  color: var(--site-muted);
  opacity: 1;
}

#header-nav .main-nav-link-wrap:hover .main-nav-link,
#header-nav .main-nav-link-wrap[aria-current="page"] .main-nav-link,
#header-nav .main-nav-link-wrap.is-current .main-nav-link {
  color: var(--site-accent);
}

#header-nav .main-nav-link-wrap[aria-current="page"] {
  box-shadow: inset 0 -2px var(--site-accent);
}

#main-nav-toggle,
.local-search-open,
#nav-sun-btn,
#nav-moon-btn,
#nav-circle-half-stroke-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--site-text);
  opacity: 1;
  appearance: none;
}

#main-nav-toggle {
  display: none;
}

#main-nav-toggle::before {
  content: "☰";
  font: 20px/1 var(--site-font);
}

.local-search-open::before {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 14px;
  height: 14px;
  border: 1.7px solid currentColor;
  border-radius: 50%;
  content: "";
}

.local-search-open::after {
  position: absolute;
  top: 26px;
  left: 25px;
  width: 8px;
  height: 1.7px;
  background: currentColor;
  content: "";
  transform: rotate(45deg);
  transform-origin: left center;
}

#nav-sun-btn::before,
#nav-moon-btn::before,
#nav-circle-half-stroke-btn::before {
  font: 20px/1 var(--site-font);
}

#nav-sun-btn::before { content: "☀"; }
#nav-moon-btn::before { content: "☾"; }
#nav-circle-half-stroke-btn::before { content: "◐"; }
#nav-rss-link { display: none !important; }

#main-nav-toggle:hover,
.local-search-open:hover,
#nav-sun-btn:hover,
#nav-moon-btn:hover,
#nav-circle-half-stroke-btn:hover {
  background: var(--site-accent-soft);
  transform: none;
}

/* Lists: title and description remain together at every width. */
.content-switcher {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  margin: 0 0 20px;
  border-bottom: 1px solid var(--site-border);
}

.content-switcher a {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  color: var(--site-muted);
  font-size: 15px;
  text-decoration: none;
}

.content-switcher a[aria-current="page"] {
  color: var(--site-text);
  box-shadow: inset 0 -2px var(--site-accent);
}

.series-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 52px;
  margin: 0 0 24px;
  padding: 12px 16px;
  border: 1px solid var(--site-border);
  border-radius: 8px;
  color: var(--site-text);
  font-size: 14px;
  text-decoration: none;
}

.series-entry:hover {
  border-color: var(--site-accent);
}

.blog-list {
  display: grid;
  gap: 0;
}

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

.post-row:first-child {
  border-top: 1px solid var(--site-border);
}

.post-row-link {
  display: grid;
  grid-template-columns: 92px 152px minmax(0, 1fr) 80px;
  gap: 20px;
  align-items: start;
  padding: 26px 0;
  color: var(--site-text);
  text-decoration: none;
}

.post-row:not(.has-thumbnail) .post-row-link {
  grid-template-columns: 92px minmax(0, 1fr) 80px;
}

.post-row-date,
.post-row-reading {
  padding-top: 3px;
  color: var(--site-muted);
  font-size: 12px;
  line-height: 24px;
  white-space: nowrap;
}

.post-row-reading { text-align: right; }
.post-row-main { min-width: 0; }

.post-row-thumbnail {
  display: block;
  width: 152px;
  height: 100px;
  overflow: hidden;
  border-radius: 8px;
  background: var(--site-accent-soft);
}

.post-row-thumbnail img,
.post-row-thumbnail picture {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.post-row-main h2 {
  margin: 0 0 7px;
  color: var(--site-text);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.post-row-link:hover h2 {
  color: var(--site-accent);
}

.post-row-main p {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--site-muted);
  font-size: 14px;
  line-height: 1.8;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.post-row-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin-top: 8px;
  color: var(--site-muted);
  font-size: 12px;
}

#page-nav.blog-pagination {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  margin: 28px 0 0;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

#page-nav.blog-pagination a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  width: fit-content;
  padding: 8px 12px;
  border: 1px solid var(--site-border);
  border-radius: 6px;
  color: var(--site-text);
  font-size: 14px;
  line-height: 1.4;
  text-decoration: none;
  float: none;
}

#page-nav.blog-pagination a:hover {
  border-color: var(--site-accent);
  background: var(--site-accent-soft);
  color: var(--site-text);
  box-shadow: none;
}

#page-nav.blog-pagination .prev { justify-self: start; }
#page-nav.blog-pagination .next { justify-self: end; }
#page-nav.blog-pagination .pagination-status {
  padding: 0 4px;
  color: var(--site-muted);
  font-size: 13px;
}

/* Article: one reading column for heading, body, navigation and comments. */
body.is-post-page #content { padding-top: 28px; }
.post-page { width: 100%; }

body.is-post-page .page-context,
.post-page-header,
.post-page-content,
#article-nav.article-neighbors,
body.is-post-page .comment {
  width: min(var(--site-reading-width), 100%);
  margin-right: auto;
  margin-left: auto;
}

.page-context { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 20px; margin-bottom: 20px; }
.page-context a,
.post-back-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--site-muted);
  font-size: 14px;
  text-decoration: none;
}
.post-back-link:hover { color: var(--site-accent); }

.post-hero {
  width: min(880px, 100%);
  height: clamp(240px, 35vw, 360px);
  margin: 0 auto 32px;
  overflow: hidden;
  border: 0;
  border-radius: 10px;
  background: var(--site-accent-soft);
  box-shadow: none;
}

.post-hero-blur { display: none; }
.post-hero picture { display: contents; }
.post-hero img {
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  border: 0;
  border-radius: inherit;
  box-shadow: none;
  object-fit: contain;
}

.post-page-header { margin-bottom: 30px; }
.post-page-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  margin-bottom: 12px;
  color: var(--site-muted);
  font-size: 12px;
  line-height: 1.8;
}

.post-page-meta > * { white-space: nowrap; }
.post-page-header h1 {
  margin: 0;
  color: var(--site-text);
  font-size: clamp(28px, 3.4vw, 40px);
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.post-page-taxonomy {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin-top: 12px;
}

.post-page-taxonomy a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  color: var(--site-muted);
  font-size: 13px;
  text-decoration: none;
}
.post-page-taxonomy a:hover { color: var(--site-accent); }

.article-inner {
  overflow: hidden;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.post-page-content.article-entry {
  padding: 0;
  overflow: visible;
  font-family: var(--site-font);
  font-size: 17px;
  line-height: 1.9;
}

.post-page-content.article-entry p,
.post-page-content.article-entry li,
.post-page-content.article-entry blockquote {
  line-height: inherit;
}

.post-page-content > p { margin: 1.25em 0; }
.post-page-content.article-entry h1,
.post-page-content.article-entry h2,
.post-page-content.article-entry h3,
.post-page-content.article-entry h4 {
  margin: 2em 0 0.8em;
  font-family: var(--site-font);
  font-weight: 600;
  line-height: 1.5;
  color: var(--site-text);
  letter-spacing: 0;
}
.post-page-content.article-entry h1 { font-size: 1.7em; }
.post-page-content.article-entry h2 { font-size: 1.45em; }
.post-page-content.article-entry h3 { font-size: 1.2em; }
.post-page-content.article-entry h4 { font-size: 1.05em; }
.post-page-content.article-entry h2::before,
.post-page-content.article-entry h2::after { display: none; }
.post-page-content.article-entry strong { font-weight: 600; }

.post-page-content.article-entry a {
  color: var(--site-accent);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--site-accent) 45%, transparent);
}

.post-page-content.article-entry img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1.8rem auto;
  border-radius: 6px;
}

.post-page-content.article-entry blockquote {
  margin: 1.6em 0;
  padding: 0 0 0 18px;
  border-left: 2px solid var(--site-accent);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--site-muted);
}

.post-page-content.article-entry hr {
  height: 1px;
  margin: 2em 0;
  border: 0;
  background: var(--site-border);
  filter: none;
  opacity: 1;
}

#article-nav.article-neighbors {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px;
  margin-top: 44px;
  margin-bottom: 36px;
  padding-top: 20px;
  overflow: visible;
  border-top: 1px solid var(--site-border);
  border-radius: 0;
  background: transparent;
}

.article-neighbor {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 68px;
  padding: 8px 0;
  color: var(--site-text);
  text-decoration: none;
}
.article-neighbor-older,
.article-neighbor-next { text-align: right; }
.article-neighbor span,
.article-neighbor time { color: var(--site-muted); font-size: 12px; }
.article-neighbor strong { margin: 5px 0; font-size: 16px; font-weight: 500; line-height: 1.5; overflow-wrap: anywhere; }
.article-neighbor:hover strong { color: var(--site-accent); }
body.is-post-page .comment { margin-top: 24px; margin-bottom: 32px; }

/* Categories and archive use the same quiet text hierarchy. */
.taxonomy-header { margin-bottom: 24px; }
.taxonomy-header h1 { margin: 4px 0 8px; color: var(--site-text); font-size: clamp(28px, 4vw, 36px); font-weight: 600; line-height: 1.4; }
.taxonomy-header p { margin: 0; color: var(--site-muted); font-size: 14px; }
.taxonomy-header .taxonomy-kicker { margin-bottom: 8px; color: var(--site-muted); font-size: 11px; font-weight: 500; letter-spacing: 0.1em; }
.taxonomy-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.taxonomy-card { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 68px; padding: 16px 20px; border: 1px solid var(--site-border); border-radius: 8px; background: transparent; color: var(--site-text); text-decoration: none; }
.taxonomy-card strong { font-weight: 500; }
.taxonomy-card span { color: var(--site-muted); font-size: 12px; white-space: nowrap; }
.taxonomy-card:hover { border-color: var(--site-accent); }
.archive-index { max-width: 900px; margin: 0 auto; }
.archive-year-group { margin-top: 32px; }
.archive-year-group h2 { margin: 0 0 12px; color: var(--site-text); font-size: 22px; font-weight: 600; }
.archive-list { margin: 0; padding: 0; list-style: none; }
.archive-list li { border-bottom: 1px solid var(--site-border); }
.archive-list a { display: grid; grid-template-columns: 96px minmax(0, 1fr); align-items: baseline; gap: 20px; min-height: 52px; padding: 14px 0; color: var(--site-text); text-decoration: none; }
.archive-date { color: var(--site-muted); font-size: 13px; white-space: nowrap; }
.archive-title { overflow-wrap: anywhere; font-size: 16px; line-height: 1.6; }
.archive-list a:hover .archive-title { color: var(--site-accent); }
.archives-outer-wrap { background: transparent; }
.archive-article-title { color: var(--site-text); opacity: 1; font-weight: 500; }
.archive-year-wrap::after { height: 2px; bottom: -16px; box-shadow: none; }
.archives-tag-list-item,
.archives-category-list-item { border: 1px solid var(--site-border); background: transparent; box-shadow: none; }
.archives-tag-list-link,
.archives-category-list-link { color: var(--site-text); }
.not-found-page { max-width: var(--site-reading-width); margin: 40px auto; }
.not-found-page .page-context { justify-content: flex-start; }

/* Theme toasts toggle inline opacity, not a class; hidden text must leave AX. */
#copy-tooltip,
#lang-tooltip {
  visibility: hidden;
  transition: opacity 160ms ease;
}

#copy-tooltip[style*="opacity: 1"],
#lang-tooltip[style*="opacity: 1"] {
  visibility: visible;
}

/* Search: only the results scroll; long excerpts cannot expand the grid. */
.local-search {
  position: fixed;
  z-index: 5000;
  inset: 0;
  display: grid;
  height: 100dvh;
  padding: 72px 20px 24px;
  visibility: hidden;
  opacity: 0;
  place-items: start center;
  transition: opacity 160ms ease;
}
.local-search.is-open { visibility: visible; opacity: 1; }
.local-search-backdrop { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: rgba(25, 24, 28, 0.36); }
.local-search-panel { position: relative; display: flex; flex-direction: column; width: min(680px, 100%); min-width: 0; max-height: 100%; padding: 24px; overflow: hidden; border: 1px solid var(--site-border); border-radius: 12px; background: var(--site-surface); box-shadow: var(--site-shadow); }
.local-search-header { display: flex; flex: 0 0 auto; align-items: flex-start; justify-content: space-between; gap: 16px; }
.local-search-header h2 { margin: 2px 0 18px; color: var(--site-text); font-size: 22px; font-weight: 600; }
.local-search-kicker { color: var(--site-muted); font-size: 11px; letter-spacing: 0.1em; }
.local-search-close,
.mobile-nav-close,
.kindred-toc-close { display: inline-flex; flex: 0 0 44px; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; border: 1px solid var(--site-border); border-radius: 8px; background: transparent; color: var(--site-text); font: 300 28px/1 var(--site-font); box-shadow: none; }
.local-search-close:hover,
.mobile-nav-close:hover,
.kindred-toc-close:hover { background: var(--site-accent-soft); }
.local-search-field { display: flex; flex: 0 0 auto; min-width: 0; }
.local-search-field input { width: 100%; min-width: 0; min-height: 48px; padding: 10px 14px; border: 1px solid var(--site-border); border-radius: 8px; background: var(--site-background); color: var(--site-text); font-size: 16px; }
.local-search-field input:focus { outline: 2px solid var(--site-accent); outline-offset: 1px; }
.local-search-status { flex: 0 0 auto; margin: 12px 0 8px; color: var(--site-muted); font-size: 12px; }
.local-search-results { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; min-width: 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.local-search-result { display: flex; flex-direction: column; min-width: 0; padding: 12px; border-radius: 8px; color: var(--site-text); text-decoration: none; }
.local-search-result:hover,
.local-search-result:focus-visible { background: var(--site-accent-soft); }
.local-search-result-meta,
.local-search-result-summary { color: var(--site-muted); font-size: 12px; }
.local-search-result strong { margin: 4px 0; font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
.local-search-result-summary { display: -webkit-box; max-width: 100%; overflow: hidden; white-space: normal; overflow-wrap: anywhere; line-height: 1.7; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.local-search-more { min-height: 44px; margin: 8px 0 0; padding: 10px 14px; border: 1px solid var(--site-border); border-radius: 8px; background: transparent; color: var(--site-text); font-size: 14px; }
.local-search-more:hover { border-color: var(--site-accent); background: var(--site-accent-soft); }
body.search-open,
body.kindred-toc-open { overflow: hidden; }

/* Mobile navigation */
#mobile-nav { display: none; }
.mobile-nav-kicker { display: none; }
.mobile-nav-title { font-size: 18px; font-weight: 600; }

/* Novel directory: compact side panel, with a bottom reading bar on phones. */
.kindred-toc-trigger { position: fixed; right: max(20px, env(safe-area-inset-right)); bottom: max(20px, env(safe-area-inset-bottom)); z-index: 210; display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 8px 14px; border: 1px solid var(--site-border); border-radius: 8px; background: var(--site-surface); color: var(--site-text); font: inherit; text-align: left; }
.kindred-toc-trigger:hover { border-color: var(--site-accent); }
.kindred-toc-trigger-icon { display: grid; flex: 0 0 22px; width: 22px; height: 22px; place-items: center; color: var(--site-accent); }
.kindred-toc-trigger-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.5; }
.kindred-toc-trigger-copy { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.kindred-toc-trigger-copy > span { color: var(--site-muted); font-size: 10px; letter-spacing: 0.08em; }
.kindred-toc-trigger-copy strong { font-size: 14px; font-weight: 500; white-space: nowrap; }
.kindred-toc-trigger-action { color: var(--site-muted); font-size: 20px; line-height: 1; }
.kindred-toc-backdrop { position: fixed; z-index: 4190; inset: 0; width: 100%; height: 100%; padding: 0; pointer-events: none; visibility: hidden; border: 0; background: rgba(25, 24, 28, 0.36); opacity: 0; transition: opacity 180ms ease, visibility 180ms ease; }
.kindred-toc-panel { position: fixed; z-index: 4200; top: 0; right: 0; display: flex; flex-direction: column; width: min(380px, calc(100vw - 28px)); height: 100dvh; overflow: hidden; color: var(--site-text); visibility: hidden; border-left: 1px solid var(--site-border); background: var(--site-surface); box-shadow: var(--site-shadow); opacity: 0; transform: translateX(100%); transition: transform 200ms ease, opacity 180ms ease; }
.kindred-toc-widget.is-open .kindred-toc-backdrop { pointer-events: auto; visibility: visible; opacity: 1; }
.kindred-toc-widget.is-open .kindred-toc-panel { visibility: visible; opacity: 1; transform: translate(0, 0); }
.kindred-toc-header { display: flex; flex: 0 0 auto; align-items: flex-start; justify-content: space-between; gap: 16px; padding: max(24px, env(safe-area-inset-top)) 24px 20px; border-bottom: 1px solid var(--site-border); }
.kindred-toc-kicker { color: var(--site-muted); font-size: 11px; letter-spacing: 0.1em; }
.kindred-toc-header h2 { margin: 4px 0; color: var(--site-text); font-family: var(--site-font); font-size: 24px; font-weight: 600; line-height: 1.4; }
.kindred-toc-header p { margin: 0; color: var(--site-muted); font-size: 12px; }
.kindred-toc-list { flex: 1; min-height: 0; padding: 12px 16px max(20px, env(safe-area-inset-bottom)); overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; }
.kindred-toc-link { display: grid; grid-template-columns: 62px minmax(0, 1fr) 16px; gap: 10px; align-items: center; min-height: 52px; margin: 2px 0; padding: 10px; border: 1px solid transparent; border-radius: 6px; color: var(--site-text) !important; text-decoration: none !important; }
.kindred-toc-link:hover { background: var(--site-accent-soft); }
.kindred-toc-link.is-current { border-color: var(--site-border); background: var(--site-accent-soft); }
.kindred-toc-chapter { color: var(--site-muted); font-size: 12px; white-space: nowrap; }
.kindred-toc-name { min-width: 0; font-family: var(--site-font); font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.kindred-toc-arrow { color: var(--site-muted); font-size: 16px; }
.kindred-toc-link.is-current .kindred-toc-chapter,
.kindred-toc-link.is-current .kindred-toc-arrow { color: var(--site-accent); }

.site-minimal-footer { padding: 32px 20px 40px !important; color: var(--site-muted); text-align: center; font-size: 12px; }
.site-minimal-footer::before { display: block; width: 32px; height: 1px; margin: 0 auto 16px; background: var(--site-border); content: ""; }

/* Reserve a footer zone when the viewport has no outside reading margin. */
@media (max-width: 1199px) {
  .kindred-toc-trigger { right: 0; bottom: 0; left: 0; justify-content: center; width: 100%; min-height: calc(52px + env(safe-area-inset-bottom)); padding: 8px 20px calc(8px + env(safe-area-inset-bottom)); border: 0; border-top: 1px solid var(--site-border); border-radius: 0; background: var(--site-background); box-shadow: none; }
  body.is-kindred-page #wrap { padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
  html:has(body.is-kindred-page) { scroll-padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
}

/* A compact list at tablet widths avoids squeezing text into a fourth column. */
@media (max-width: 1023px) {
  .post-row-link,
  .post-row:not(.has-thumbnail) .post-row-link {
    grid-template-columns: 128px minmax(0, 1fr);
    gap: 8px 20px;
  }
  .post-row-date { grid-column: 2; grid-row: 2; padding: 0; }
  .post-row-main { grid-column: 2; grid-row: 1; }
  .post-row-reading { grid-column: 2; grid-row: 3; padding: 0; text-align: left; }
  .post-row-thumbnail { grid-column: 1; grid-row: 1 / span 3; width: 128px; height: 96px; }
  .post-row:not(.has-thumbnail) .post-row-link { grid-template-columns: minmax(0, 1fr); }
  .post-row:not(.has-thumbnail) .post-row-date,
  .post-row:not(.has-thumbnail) .post-row-main,
  .post-row:not(.has-thumbnail) .post-row-reading { grid-column: 1; }
}

@media (max-width: 767px) {
  :root { --site-nav-height: 56px; }
  #header { height: 210px; }
  #header-title { top: calc(50% + 20px); }
  #logo { font-size: 28px; }
  #subtitle { font-size: 13px; }
  #header-nav { padding: 0 12px; }
  #main-nav-toggle { display: inline-flex; }
  #header-nav .main-nav-link-wrap { display: none; }
  #content,
  #content.sidebar-left,
  #content.sidebar-right,
  body.is-post-page #content { padding: 24px 20px 12px; }
  .content-switcher { gap: 8px 24px; margin-bottom: 16px; }
  .series-entry { align-items: flex-start; flex-wrap: wrap; gap: 4px 12px; padding: 12px; }
  .post-row-link,
  .post-row:not(.has-thumbnail) .post-row-link { grid-template-columns: 96px minmax(0, 1fr); gap: 6px 16px; padding: 22px 0; }
  .post-row-thumbnail { grid-row: 1 / span 2; width: 96px; height: 80px; }
  .post-row-main h2 { font-size: 18px; line-height: 1.55; }
  .post-row-main p { -webkit-line-clamp: 2; }
  .post-row-tags { display: none; }
  .post-row-reading { display: none; }
  .post-row:not(.has-thumbnail) .post-row-link { grid-template-columns: minmax(0, 1fr); }
  .post-hero { height: clamp(180px, 54vw, 300px); margin-bottom: 24px; border-radius: 8px; }
  .page-context { margin-bottom: 12px; }
  .post-page-header { margin-bottom: 24px; }
  .post-page-header h1 { font-size: 28px; line-height: 1.45; }
  .post-page-meta { gap: 4px 14px; }
  .post-page-taxonomy a { min-height: 44px; }
  .post-page-content.article-entry { font-size: 16px; line-height: 1.9; }
  #article-nav.article-neighbors { gap: 20px; margin-top: 36px; margin-bottom: 28px; }
  .article-neighbor strong { font-size: 14px; }
  .article-neighbor time { display: none; }
  .taxonomy-grid { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .taxonomy-card { min-height: 60px; padding: 14px 16px; }
  .archive-list a { grid-template-columns: 78px minmax(0, 1fr); gap: 14px; }
  .archive-date { font-size: 12px; }
  .archive-title { font-size: 15px; }
  .local-search { padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom)); }
  .local-search-panel { max-height: 100%; padding: 18px; border-radius: 10px; }
  #mobile-nav { position: fixed; z-index: 1001; top: 0; left: 0; display: flex; flex-direction: column; width: min(88vw, 340px); height: 100dvh; overflow-x: hidden; overflow-y: auto; border-right: 1px solid var(--site-border); border-radius: 0; background: var(--site-surface); box-shadow: var(--site-shadow); transform: translateX(-102%); transition: transform 200ms ease; }
  .mobile-nav-on #mobile-nav { left: 0; transform: translateX(0); }
  .mobile-nav-on #mask,
  .mobile-nav-on #mask.hide { position: fixed; inset: 0; z-index: 1000; display: block !important; visibility: visible !important; opacity: 1 !important; background: rgba(25, 24, 28, 0.36); backdrop-filter: none; }
  #mobile-nav .mobile-nav-toolbar { position: sticky; top: 0; z-index: 2; display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: 16px; padding: max(16px, env(safe-area-inset-top)) 20px 16px; border-bottom: 1px solid var(--site-border); background: var(--site-surface); }
  #mobile-nav .sidebar-wrap { display: flex; flex: 1 0 auto; align-items: stretch; justify-content: flex-start; gap: 20px; width: 100%; max-height: none; padding: 20px 20px calc(24px + env(safe-area-inset-bottom)); background: transparent; box-shadow: none; }
  #mobile-nav .sidebar-menu { order: -3; display: grid; gap: 4px; width: 100%; margin: 0; }
  #mobile-nav .sidebar-menu-link-wrap { justify-content: flex-start; width: 100%; max-width: none; min-height: 48px; margin: 0; border: 0; border-radius: 6px; background: transparent; box-shadow: none; }
  #mobile-nav .sidebar-menu-link-wrap:hover,
  #mobile-nav .sidebar-menu-link-wrap.link-active { border: 0; background: var(--site-accent-soft); opacity: 1; }
  #mobile-nav .sidebar-menu-link { display: flex; align-items: center; min-height: 48px; padding: 10px 12px; color: var(--site-text); font-size: 16px; font-weight: 500; opacity: 1; }
  #mobile-nav .sidebar-menu-icon { display: none; }
  #mobile-nav .sidebar-author { order: -2; display: grid; grid-template-columns: 48px minmax(0, 1fr); align-items: center; gap: 0 12px; width: 100%; padding-top: 20px; border-top: 1px solid var(--site-border); }
  #mobile-nav .sidebar-author img { grid-row: 1 / span 2; width: 48px; min-width: 48px; height: 48px; min-height: 48px; margin: 0; box-shadow: none; opacity: 1; }
  #mobile-nav .sidebar-author-name { margin: 0; color: var(--site-text); font-size: 16px; font-weight: 500; }
  #mobile-nav .sidebar-description { margin: 0; color: var(--site-muted); font-size: 12px; line-height: 1.6; }
  #mobile-nav .sidebar-stats { margin: -4px 0 0; color: var(--site-muted); font-size: 12px; line-height: 1.8; }
  #mobile-nav .sidebar-stats a { display: inline-flex; align-items: center; min-height: 44px; color: inherit; text-decoration: none; }
  #mobile-nav .sidebar-state { width: 100%; padding: 0; gap: 12px; opacity: 1; }
  #mobile-nav .sidebar-state > div,
  #mobile-nav .sidebar-state > a { flex: 1; padding: 0; border: 0; color: var(--site-muted); font-size: 12px; }
  #mobile-nav .sidebar-state-number { font-size: 14px; font-weight: 500; }
  #mobile-nav .sidebar-social { justify-content: flex-start; width: 100%; gap: 2px; margin: 0; }
  #mobile-nav .sidebar-social-icon { width: 44px; height: 44px; border: 0; border-radius: 6px; background: transparent; color: var(--site-muted); }
  #mobile-nav .sidebar-social-icon:hover { background: var(--site-accent-soft); transform: none; }
  .kindred-toc-panel { top: auto; right: 0; bottom: 0; left: 0; width: 100%; height: min(82dvh, 720px); border: 0; border-top: 1px solid var(--site-border); border-radius: 14px 14px 0 0; transform: translateY(100%); }
  .kindred-toc-header { padding: 20px; }
  .kindred-toc-list { padding: 10px 12px max(18px, env(safe-area-inset-bottom)); }
}

@media (max-width: 359px) {
  #content,
  #content.sidebar-left,
  #content.sidebar-right,
  body.is-post-page #content { padding-right: 16px; padding-left: 16px; }
  .post-row-link { grid-template-columns: minmax(0, 1fr); }
  .post-row-thumbnail { display: none; }
  .post-row-date,
  .post-row-main,
  .post-row-reading { grid-column: 1; }
  .post-row-main h2 { font-size: 19px; }
  .post-page-header h1 { font-size: 26px; }
  .archive-list a { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .local-search-panel { padding: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  html,
  body,
  #container { scroll-behavior: auto !important; }
  *,
  *::before,
  *::after { animation-duration: 0.01ms !important; animation-delay: 0ms !important; transition-duration: 0.01ms !important; }
}
