:root {
  --bg: #eef6fb;
  --surface: #ffffff;
  --surface-soft: #f4f9fd;
  --text: #102437;
  --muted: #5b7083;
  --line: rgba(16, 36, 55, 0.1);
  --line-strong: rgba(16, 36, 55, 0.16);
  --accent: #0f4c81;
  --accent-soft: rgba(15, 76, 129, 0.1);
  --accent-text: #0f4c81;
  --shadow: 0 20px 50px rgba(15, 76, 129, 0.09);
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 12px;
}

html[data-theme="sand"] {
  --bg: #f4f3ef;
  --surface: #ffffff;
  --surface-soft: #fbfaf7;
  --text: #171717;
  --muted: #6b7280;
  --line: rgba(15, 23, 42, 0.1);
  --line-strong: rgba(15, 23, 42, 0.16);
  --accent: #111827;
  --accent-soft: #eff4ff;
  --accent-text: #1d4ed8;
  --shadow: 0 20px 50px rgba(15, 23, 42, 0.07);
}

html[data-theme="ocean"] {
  --bg: #eef6fb;
  --surface: #ffffff;
  --surface-soft: #f4f9fd;
  --text: #102437;
  --muted: #5b7083;
  --line: rgba(16, 36, 55, 0.1);
  --line-strong: rgba(16, 36, 55, 0.16);
  --accent: #0f4c81;
  --accent-soft: rgba(15, 76, 129, 0.1);
  --accent-text: #0f4c81;
  --shadow: 0 20px 50px rgba(15, 76, 129, 0.09);
}

html[data-theme="ink"] {
  --bg: #10151d;
  --surface: #171d27;
  --surface-soft: #202837;
  --text: #eef3fb;
  --muted: #a7b2c5;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --accent: #e7edf8;
  --accent-soft: rgba(113, 169, 255, 0.14);
  --accent-text: #9bc2ff;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, color-mix(in srgb, var(--accent-text) 14%, transparent), transparent 32%),
    linear-gradient(180deg, color-mix(in srgb, var(--bg) 84%, white) 0%, var(--bg) 100%);
  line-height: 1.75;
}

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

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

button,
input,
textarea {
  font: inherit;
}

.container {
  width: min(1680px, calc(100vw - 24px));
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(16px);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 76px;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.brand strong {
  font-size: 1.2rem;
  letter-spacing: 0.01em;
}

.brand span,
.eyebrow,
.breadcrumbs,
.article-row-meta,
.meta-row,
.section-head p,
.muted,
.search-empty {
  color: var(--muted);
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.header-nav a,
.header-search-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  color: var(--muted);
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  transition: 0.2s ease;
}

.header-nav a:hover,
.header-search-button:hover {
  color: var(--text);
  border-color: var(--line);
  background: color-mix(in srgb, var(--surface) 80%, transparent);
}

.page-shell {
  padding: 24px 0 60px;
}

.shell-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.global-sidebar {
  position: sticky;
  top: 98px;
}

.sidebar-panel,
.hero-card,
.section-card,
.column-card,
.compact-article-row,
.article-row,
.article-panel,
.article-actions-panel,
.drawer-panel,
.search-panel,
.empty-panel {
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.sidebar-panel,
.hero-card,
.section-card,
.column-card,
.compact-article-row,
.article-row,
.article-panel,
.article-actions-panel,
.drawer-panel,
.empty-panel {
  padding: 24px;
}

.content-area > * + * {
  margin-top: 18px;
}

.sidebar-title,
.filter-title,
.search-block-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}

.sidebar-nav {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  transition: 0.2s ease;
}

.sidebar-link:hover,
.sidebar-link.active {
  border-color: rgba(37, 99, 235, 0.16);
  background: var(--accent-soft);
}

.sidebar-link-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.sidebar-link-main strong {
  line-height: 1.3;
}

.sidebar-link-meta {
  color: var(--muted);
  font-size: 0.92rem;
}

.sidebar-note {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.sidebar-note p {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.6;
}

.hero-card {
  min-height: 260px;
  display: flex;
  align-items: center;
}

.hero-copy {
  max-width: 980px;
}

.hero-eyebrow,
.eyebrow {
  margin: 0 0 10px;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.hero-copy h1,
.column-hero h1,
.article-header h1,
.empty-panel h1 {
  margin: 0 0 12px;
  font-size: clamp(2.3rem, 5vw, 4.4rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.hero-copy p,
.column-hero p,
.article-row p,
.compact-article-row p,
.article-excerpt,
.article-body p {
  margin: 0 0 14px;
}

.hero-actions,
.card-actions,
.meta-row,
.article-row-meta,
.compact-article-meta,
.breadcrumbs,
.action-row,
.action-stack,
.editor-grid,
.column-card-top {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
}

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

.section-head h2 {
  margin: 0;
  font-size: 1.55rem;
}

.section-head p {
  margin: 0;
}

.column-grid,
.column-rail,
.compact-article-list,
.article-list {
  display: grid;
  gap: 16px;
}

.column-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.rail-shell {
  position: relative;
  padding: 0 56px;
}

.rail-button {
  position: absolute;
  top: 50%;
  z-index: 2;
  width: 42px;
  min-width: 42px;
  min-height: 42px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  color: var(--text);
  cursor: pointer;
  transform: translateY(-50%);
  backdrop-filter: blur(8px);
}

.rail-button span {
  display: none;
}

#columns-prev {
  left: 0;
}

#columns-next {
  right: 0;
}

.rail-button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.column-rail {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(320px, 360px);
  gap: 16px;
  overflow-x: auto;
  padding: 4px 4px 10px;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
}

.column-rail::-webkit-scrollbar {
  height: 8px;
}

.column-rail::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 999px;
}

.rail-card {
  scroll-snap-align: start;
}

.column-card-top {
  justify-content: space-between;
  align-items: center;
}

.column-card-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.meta-chip-text {
  color: var(--muted);
  font-size: 0.94rem;
}

.meta-chip,
.compact-article-meta span,
.article-row-meta span,
.meta-row span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.94rem;
}

.title-link h3 {
  margin: 10px 0 8px;
  font-size: clamp(1.25rem, 2vw, 1.7rem);
  line-height: 1.35;
}

.title-link:hover h3 {
  color: var(--accent-text);
}

.mini-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.mini-list a {
  color: var(--accent-text);
}

.breadcrumbs {
  margin-bottom: 12px;
  font-size: 0.95rem;
}

.column-content-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 24px;
}

.local-sidebar {
  display: grid;
  gap: 16px;
  align-content: start;
}

.filter-group {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
}

.filter-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.filter-button,
.pagination-button {
  display: inline-flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  cursor: pointer;
  transition: 0.2s ease;
}

.filter-button.active,
.pagination-button.active,
.filter-button:hover,
.pagination-button:hover {
  border-color: rgba(37, 99, 235, 0.2);
  background: var(--accent-soft);
  color: var(--accent-text);
}

.list-area {
  min-width: 0;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.pagination-button {
  width: auto;
  min-width: 44px;
}

.article-main-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 20px;
  align-items: start;
}

.article-actions-panel {
  position: sticky;
  top: 98px;
}

.action-stack {
  flex-direction: column;
}

.article-filter-stack {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.article-filter-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
}

.article-filter-copy {
  margin: 10px 0 12px;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.65;
}

.article-filter-list {
  margin-top: 14px;
}

.article-neighbor-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.article-neighbor-card {
  display: grid;
  gap: 8px;
  min-height: 124px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  transition: 0.2s ease;
}

.article-neighbor-card:hover {
  border-color: rgba(37, 99, 235, 0.2);
  background: var(--accent-soft);
}

.article-neighbor-card.disabled {
  opacity: 0.58;
}

.article-neighbor-label,
.article-neighbor-meta {
  color: var(--muted);
  font-size: 0.92rem;
}

.article-neighbor-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.article-neighbor-title {
  font-size: 1rem;
  line-height: 1.55;
}

.button,
.icon-button {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 999px;
  min-height: 46px;
  padding: 0 18px;
  cursor: pointer;
  transition: 0.2s ease;
  font-weight: 600;
  gap: 8px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.button.primary {
  background: var(--accent);
  color: #fff;
}

.button.secondary,
.icon-button {
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border-color: var(--line-strong);
  color: var(--text);
}

.button:hover,
.icon-button:hover {
  transform: translateY(-1px);
}

.article-body {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.article-body h1,
.article-body h2,
.article-body h3,
.article-body h4,
.article-body h5,
.article-body h6 {
  margin: 28px 0 12px;
  line-height: 1.3;
}

.article-body h2 {
  font-size: clamp(1.65rem, 2.4vw, 2.1rem);
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.article-body h3 {
  font-size: clamp(1.3rem, 2vw, 1.55rem);
}

.article-body h4 {
  font-size: 1.08rem;
  color: var(--muted);
}

.article-body h5,
.article-body h6 {
  font-size: 1rem;
  color: var(--muted);
}

.article-body ul,
.article-body ol {
  padding-left: 22px;
}

.article-body blockquote {
  margin: 20px 0;
  padding: 4px 0 4px 16px;
  border-left: 3px solid rgba(37, 99, 235, 0.28);
  color: #374151;
}

.article-body hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 24px 0;
}

.article-body pre {
  overflow: auto;
  background: #0f172a;
  color: #f8fafc;
  padding: 16px;
  border-radius: var(--radius-md);
}

.article-image {
  margin: 26px 0;
}

.article-image img {
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
}

.article-image figcaption {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

.table-wrap {
  overflow: auto;
  margin: 20px 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
  background: var(--surface);
  border-radius: var(--radius-md);
  overflow: hidden;
}

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

th {
  background: var(--surface-soft);
}

.drawer {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 38px 18px;
  overflow: auto;
  background: rgba(15, 23, 42, 0.42);
}

.drawer.hidden,
.search-layer.hidden {
  display: none;
}

.drawer-panel,
.search-panel {
  width: min(980px, 100%);
}

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

.drawer-head h2,
.search-head h2 {
  margin: 0;
}

.editor-form {
  display: grid;
  gap: 16px;
}

.editor-form label {
  display: grid;
  gap: 8px;
}

.editor-form input,
.editor-form textarea,
.search-input-wrap input {
  width: 100%;
  padding: 13px 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  color: var(--text);
}

.editor-body {
  min-height: 420px;
}

.search-layer {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 36px 18px;
  overflow: auto;
  background: rgba(15, 23, 42, 0.42);
}

.search-panel {
  padding: 24px;
}

.search-results-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-top: 18px;
}

.search-results-list {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.search-result-card {
  display: grid;
  gap: 6px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
}

.search-result-card p {
  margin: 0;
  color: var(--muted);
}

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

.icon {
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.icon svg {
  width: 16px;
  height: 16px;
}

.topic-icon-badge {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: var(--topic-soft, var(--accent-soft));
  color: var(--topic-color, var(--accent-text));
  flex: 0 0 auto;
}

.topic-icon-symbol {
  width: 18px;
  height: 18px;
}

.topic-icon-symbol svg {
  width: 18px;
  height: 18px;
}

.column-hero-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 10px;
}

.column-hero-head .topic-icon-badge {
  width: 44px;
  height: 44px;
  border-radius: 14px;
}

.footer-inner {
  padding: 0 0 36px;
}

@media (max-width: 1240px) {
  .shell-layout {
    grid-template-columns: 240px minmax(0, 1fr);
  }

  .column-content-layout {
    grid-template-columns: 1fr;
  }

  .local-sidebar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 960px) {
  .shell-layout,
  .article-main-layout,
  .search-results-grid,
  .editor-grid,
  .local-sidebar {
    grid-template-columns: 1fr;
  }

  .global-sidebar,
  .article-actions-panel {
    position: static;
  }

  .rail-shell {
    padding: 0;
  }

  .column-rail {
    grid-auto-columns: minmax(280px, 84vw);
  }

  .rail-button {
    position: static;
    transform: none;
    width: 100%;
    min-width: 0;
  }

  .rail-button span {
    display: inline;
  }

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

@media (max-width: 720px) {
  .container {
    width: min(100vw - 16px, 1680px);
  }

  .topbar,
  .section-head,
  .drawer-head,
  .search-head {
    flex-direction: column;
    align-items: start;
  }

  .sidebar-panel,
  .hero-card,
  .section-card,
  .column-card,
  .compact-article-row,
  .article-row,
  .article-panel,
  .article-actions-panel,
  .drawer-panel,
  .search-panel,
  .empty-panel {
    padding: 18px;
  }

  .hero-copy h1,
  .column-hero h1,
  .article-header h1,
  .empty-panel h1 {
    font-size: clamp(2rem, 10vw, 3rem);
  }

  .header-nav {
    width: 100%;
  }

  .header-nav a,
  .header-search-button,
  .button,
  .icon-button,
  .rail-button {
    width: 100%;
    justify-content: center;
  }
}
