:root {
  color-scheme: light;
  --bg: #f7f7f5;
  --paper: #ffffff;
  --paper-soft: #f1f1ee;
  --ink: #151515;
  --muted: #5f625e;
  --faint: #8f938d;
  --line: rgba(20, 20, 18, 0.1);
  --line-strong: rgba(20, 20, 18, 0.18);
  --accent: #2f5f58;
  --accent-soft: rgba(47, 95, 88, 0.1);
  --signal: #8b3d33;
  --shadow: 0 24px 70px rgba(29, 31, 28, 0.08);
  --serif: Georgia, "Times New Roman", "Songti SC", "SimSun", serif;
  --sans: "Inter", "Avenir Next", "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #10110f;
  --paper: #171815;
  --paper-soft: #20211d;
  --ink: #edeee8;
  --muted: #a4a79d;
  --faint: #73776d;
  --line: rgba(237, 238, 232, 0.1);
  --line-strong: rgba(237, 238, 232, 0.18);
  --accent: #9fbeb7;
  --accent-soft: rgba(159, 190, 183, 0.12);
  --signal: #d59b86;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 75% 8%, var(--accent-soft), transparent 25rem),
    linear-gradient(180deg, var(--paper-soft), var(--bg) 22rem);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.site {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
}

.rail {
  position: sticky;
  top: 0;
  z-index: 10;
  height: 100vh;
  padding: 28px 0;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(20px);
}

.rail-mark {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 20px;
  transition: border-color 160ms ease, transform 160ms ease;
}

.rail-mark:hover,
.rail-mark:focus-visible {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.rail-nav {
  margin-top: 42px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rail-nav a,
.rail-action {
  position: relative;
  width: 42px;
  height: 42px;
  border: 1px solid transparent;
  display: grid;
  place-items: center;
  background: transparent;
  color: var(--faint);
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease;
}

.rail-nav a:hover,
.rail-nav a:focus-visible,
.rail-action:hover,
.rail-action:focus-visible {
  color: var(--ink);
  background: var(--paper);
  border-color: var(--line);
}

.rail-nav svg,
.rail-action svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.rail-nav span,
.rail-action span {
  position: absolute;
  left: 50px;
  top: 50%;
  transform: translateY(-50%);
  padding: 6px 10px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  box-shadow: var(--shadow);
  transition: opacity 160ms ease;
}

.rail-nav a:hover span,
.rail-nav a:focus-visible span,
.rail-action:hover span,
.rail-action:focus-visible span {
  opacity: 1;
}

.theme-button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--paper);
}

.theme-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ink);
}

.theme-pull {
  position: fixed;
  top: 0;
  right: 12px;
  z-index: 30;
  width: 42px;
  height: 92px;
  border: 0;
  padding: 0;
  display: grid;
  justify-items: center;
  align-content: start;
  background: transparent;
  color: var(--ink);
}

.pull-cord {
  width: 1px;
  height: 62px;
  background: color-mix(in srgb, var(--ink) 42%, transparent);
}

.pull-knob {
  width: 22px;
  height: 22px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--paper);
  box-shadow: 0 8px 22px rgba(29, 31, 28, 0.08);
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease;
}

.theme-pull:hover .pull-knob,
.theme-pull:focus-visible .pull-knob {
  transform: translateY(4px);
  border-color: var(--accent);
  background: var(--paper-soft);
}

.mobile-top {
  display: none;
}

.content {
  --content-pad-left: clamp(28px, 3.4vw, 56px);
  min-width: 0;
  padding: 0 clamp(12px, 1vw, 16px) clamp(28px, 4vw, 64px) var(--content-pad-left);
}

.blog-layout {
  min-width: 0;
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(300px, 24vw, 360px);
  gap: clamp(20px, 2.4vw, 32px);
  align-items: start;
}

.primary-flow {
  min-width: 0;
}

.hero {
  position: relative;
  min-width: 0;
  width: calc(100% + var(--content-pad-left));
  min-height: clamp(420px, 45vw, 470px);
  margin-left: calc(var(--content-pad-left) * -1);
  margin-bottom: clamp(6px, 0.8vw, 10px);
  overflow: hidden;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 90%, transparent);
  box-shadow: var(--shadow);
}

.hero-cover {
  position: absolute;
  inset: 0;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background:
    linear-gradient(130deg, rgba(47, 95, 88, 0.22), transparent 38%),
    linear-gradient(0deg, rgba(20, 20, 18, 0.08), transparent 28%),
    var(--paper-soft);
}

.cover-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 34px 34px;
  opacity: 0.58;
}

.cover-line {
  position: absolute;
  height: 1px;
  background: color-mix(in srgb, var(--ink) 34%, transparent);
  transform-origin: left;
}

.cover-line-a {
  left: 8%;
  top: 26%;
  width: 64%;
  transform: rotate(-8deg);
}

.cover-line-b {
  left: 42%;
  bottom: 18%;
  width: 58%;
  transform: rotate(14deg);
}

.cover-stamp,
.cover-coordinates {
  position: absolute;
  left: 24px;
  padding: 7px 10px;
  border: 1px solid var(--line-strong);
  background: color-mix(in srgb, var(--paper) 78%, transparent);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
}

.cover-stamp {
  top: 24px;
}

.cover-coordinates {
  bottom: 24px;
}

.cover-signal {
  position: absolute;
  left: 42%;
  top: 29%;
  width: 118px;
  height: 118px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
}

.cover-signal::before,
.cover-signal::after {
  content: "";
  position: absolute;
  inset: 28px;
  border: 1px solid var(--line);
  border-radius: 50%;
}

.cover-signal::after {
  inset: 50px;
  background: color-mix(in srgb, var(--ink) 34%, transparent);
}

.hero-body {
  position: absolute;
  inset: 0;
  min-width: 0;
  padding: 0;
}

.hero-body::before {
  content: none;
}

.hero-identity-card {
  position: absolute;
  left: clamp(32px, 2.8vw, 48px);
  right: clamp(32px, 4vw, 58px);
  bottom: clamp(32px, 3.2vw, 46px);
  display: grid;
  grid-template-columns: clamp(132px, 12vw, 174px) minmax(0, 1fr);
  column-gap: clamp(24px, 2.4vw, 32px);
  align-items: end;
}

.identity-visual {
  grid-row: 1 / span 2;
  display: grid;
  justify-items: center;
  align-self: end;
}

.avatar-wrap {
  width: clamp(132px, 12vw, 174px);
  height: clamp(132px, 12vw, 174px);
  border: 1px solid var(--line-strong);
  display: grid;
  place-items: center;
  background: var(--paper);
  margin: 0;
}

.avatar-mark {
  width: calc(100% - 48px);
  height: calc(100% - 48px);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-size: clamp(24px, 2.2vw, 32px);
}

.identity-kicker,
.section-code {
  margin: 0 0 10px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.4;
  text-transform: uppercase;
}

.identity h1 {
  margin: 0;
  max-width: none;
  font-family: var(--serif);
  font-size: clamp(38px, 4vw, 56px);
  font-weight: 400;
  line-height: 1.02;
}

.identity-copy {
  max-width: min(62rem, 100%);
  margin: 12px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 17px;
  line-height: 1.8;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.section {
  margin-top: clamp(24px, 3vw, 40px);
}

.hero + .section {
  margin-top: 0;
}

.index-section {
  --article-list-width: min(100%, 720px);
  margin-top: 0;
}

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

.section-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(25px, 3vw, 38px);
  font-weight: 400;
}

.section-head.compact {
  display: block;
}

.article-meta,
.sidebar-date,
.reply-row span,
.topic-row span,
.archive-row span {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 12px;
}

.article-list {
  width: var(--article-list-width);
  border-top: 1px solid var(--line-strong);
}

.article-row {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) 88px;
  gap: clamp(14px, 2vw, 24px);
  align-items: baseline;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
  transition: color 160ms ease, transform 160ms ease;
}

.article-row:hover,
.article-row:focus-visible {
  color: var(--accent);
  transform: translateX(2px);
}

.article-date {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 12px;
}

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

.article-main strong {
  display: block;
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(22px, 2.2vw, 30px);
  font-weight: 400;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.article-row:hover .article-main strong,
.article-row:focus-visible .article-main strong {
  color: var(--accent);
}

.article-main p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.article-tags {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.article-tags span {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 11px;
}

.index-section .section-head {
  width: var(--article-list-width);
  margin-bottom: 10px;
}

.index-section .section-code {
  margin-bottom: 6px;
  font-size: 11px;
}

.index-section .section-head h2 {
  font-size: clamp(22px, 2.15vw, 28px);
  line-height: 1.08;
}

.index-section .article-row {
  position: relative;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: clamp(10px, 1.2vw, 16px);
  padding: 12px 0;
}

.index-section .article-date {
  font-size: 11px;
}

.index-section .article-main strong {
  max-width: 30em;
  display: -webkit-box;
  overflow: hidden;
  font-size: clamp(18px, 1.72vw, 23px);
  line-height: 1.2;
  overflow-wrap: normal;
  word-break: keep-all;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
}

.index-section .article-main p {
  max-width: 42em;
  display: -webkit-box;
  overflow: hidden;
  margin-top: 5px;
  font-size: 13px;
  line-height: 1.45;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
}

.index-section .article-tags {
  margin-top: 7px;
  gap: 6px;
}

.pagination-controls {
  width: var(--article-list-width);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding-top: 10px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 12px;
}

.pagination-controls button {
  min-height: 30px;
  border: 1px solid var(--line);
  padding: 0 12px;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 12px;
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease;
}

.pagination-controls button:not(:disabled):hover,
.pagination-controls button:not(:disabled):focus-visible {
  border-color: var(--accent);
  background: var(--paper);
  color: var(--ink);
}

.pagination-controls button:disabled {
  opacity: 0.42;
  cursor: default;
}

.blog-aside {
  position: sticky;
  top: clamp(24px, 3vw, 48px);
  display: grid;
  gap: 14px;
  color: var(--muted);
  font-size: 14px;
}

.quick-search,
.aside-panel {
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  box-shadow: none;
}

.quick-search {
  padding: 14px 0 2px;
}

.quick-search label {
  display: grid;
  gap: 8px;
}

.quick-search label span,
.search-box span {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
}

.quick-search input,
.search-box input {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  border-radius: 0;
  padding: 10px 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.quick-search input:focus,
.search-box input:focus {
  border-color: var(--accent);
}

.quick-search-results,
.search-results {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.result-row {
  display: grid;
  gap: 4px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.result-row strong {
  font-family: var(--serif);
  font-weight: 400;
}

.result-row span,
.empty-state {
  color: var(--faint);
  font-size: 13px;
}

.aside-panel {
  padding: 14px 0 0;
}

.sidebar-list,
.archive-list {
  display: grid;
}

.topic-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sidebar-row,
.archive-row {
  display: grid;
  gap: 5px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  transition: color 160ms ease, transform 160ms ease;
}

.sidebar-row:hover,
.sidebar-row:focus-visible,
.archive-row:hover,
.archive-row:focus-visible {
  color: var(--accent);
  transform: translateX(2px);
}

.archive-row strong {
  color: var(--ink);
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.25;
}

.sidebar-row strong {
  color: var(--ink);
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.28;
}

.topic-row {
  display: inline-flex;
  min-height: 30px;
  border: 1px solid var(--line);
  padding: 0 12px;
  align-items: center;
  background: transparent;
  color: var(--muted);
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease;
}

.archive-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
}

.archive-row span {
  white-space: nowrap;
}

.topic-row:hover,
.topic-row:focus-visible {
  border-color: var(--accent);
  background: var(--paper);
  color: var(--ink);
}

.topic-row strong {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 400;
  line-height: 1;
}

.archive-row:hover strong,
.archive-row:focus-visible strong,
.sidebar-row:hover strong,
.sidebar-row:focus-visible strong {
  color: var(--accent);
}

.aside-panel h2 {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 400;
}

.page-switch {
  position: fixed;
  right: clamp(28px, 2.2vw, 42px);
  bottom: 28px;
  z-index: 30;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  color: var(--ink);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.page-switch span {
  width: 10px;
  height: 10px;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
}

.search-dialog[hidden] {
  display: none;
}

.search-dialog,
.article-dialog {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
}

.search-backdrop,
.article-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(10px);
}

.search-panel,
.article-panel {
  position: relative;
  z-index: 1;
  width: min(680px, 100%);
  max-height: min(760px, calc(100vh - 48px));
  overflow: auto;
  border: 1px solid var(--line-strong);
  padding: clamp(22px, 4vw, 34px);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.article-dialog[hidden] {
  display: none;
}

.article-panel {
  width: min(820px, 100%);
}

.search-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.search-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 34px;
  font-weight: 400;
}

.search-close,
.article-close {
  border: 1px solid var(--line);
  padding: 8px 12px;
  background: transparent;
  color: var(--muted);
}

.article-close {
  float: right;
}

.article-panel h2 {
  clear: both;
  margin: 0 0 18px;
  font-family: var(--serif);
  font-size: clamp(34px, 5vw, 58px);
  font-weight: 400;
  line-height: 1.08;
}

.article-content {
  border-top: 1px solid var(--line);
  padding-top: 18px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.9;
}

.article-content h3 {
  margin: 24px 0 10px;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 400;
}

.search-box {
  display: grid;
  gap: 8px;
}

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

@media (max-width: 980px) {
  .blog-layout {
    grid-template-columns: 1fr;
  }

  .blog-aside {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .quick-search {
    grid-column: 1 / -1;
  }

  .hero {
    min-height: 520px;
  }

  .hero-cover {
    border: 0;
  }

  .hero-identity-card {
    max-width: calc(100% - 44px);
  }
}

@media (max-width: 760px) {
  .site {
    display: block;
  }

  .rail,
  .theme-pull {
    display: none;
  }

  .mobile-top {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 16px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    backdrop-filter: blur(18px);
  }

  .mobile-top > a {
    min-width: 0;
    font-family: var(--serif);
    font-size: 18px;
    white-space: nowrap;
  }

  .mobile-actions {
    position: static;
    margin-left: 14px;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .mobile-search {
    width: 74px;
    max-width: 78px;
    min-height: 38px;
    border: 1px solid var(--line);
    padding: 0 12px;
    background: var(--paper);
    color: var(--muted);
    font-size: 13px;
  }

  .mobile-admin {
    min-height: 38px;
    border: 1px solid var(--line);
    padding: 0 10px;
    display: inline-flex;
    align-items: center;
    background: var(--paper);
    color: var(--muted);
    font-size: 13px;
  }

  .mobile-top .theme-button {
    display: none;
  }

  .content {
    --content-pad-left: 16px;
    overflow: hidden;
    padding: 18px 16px 72px;
  }

  .hero {
    width: 100%;
    margin-left: 0;
    max-width: 100%;
    overflow: hidden;
  }

  .cover-line-b,
  .cover-coordinates {
    display: none;
  }

  .hero-body {
    max-width: 100%;
    padding: 0;
  }

  .hero-identity-card {
    left: 22px;
    right: 22px;
    bottom: 28px;
    display: block;
    max-width: 292px;
  }

  .avatar-wrap {
    width: 106px;
    height: 106px;
    margin-bottom: 24px;
  }

  .avatar-mark {
    width: 68px;
    height: 68px;
    font-size: 25px;
  }

  .identity h1 {
    max-width: none;
    font-size: 42px;
  }

  .identity-copy {
    width: auto;
    max-width: 292px;
    font-size: 16px;
    line-height: 1.85;
  }

  .section-head.split {
    display: grid;
    align-items: start;
  }

  .section-head {
    display: grid;
    align-items: start;
  }

  .article-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .index-section .article-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .pagination-controls {
    justify-content: center;
  }

  .blog-aside {
    grid-template-columns: 1fr;
  }

  .page-switch {
    right: 16px;
    bottom: 16px;
  }
}
