@import url('https://fonts.googleapis.com/css2?family=Inter:wght@100..900&display=swap');

* {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
  font-family: "Inter", sans-serif;
}

:link {
  color: #EF3340;
}

:visited {
  color: #66f;
}

/* ─── Theme Variables ─── */
:root,
[data-theme="light"] {
  --brand: #ffffff;
  --brand-mid: #f0f0f0;
  --brand-dark: #4a6a8a;
  --brand-text: #1a3a5a;
  --bg: #ffffff;
  --bg-alt: #f5f5f5;
  --surface: rgba(255, 255, 255, 0.6);
  --surface-hover: rgba(245, 245, 245, 0.8);
  --surface-active: rgba(235, 235, 235, 0.95);
  --border: rgba(180, 190, 200, 0.4);
  --border-strong: rgba(140, 155, 170, 0.6);
  --text: #1a1a2e;
  --text-muted: #4a5568;
  --text-light: #6b7280;
  --shadow: rgba(100, 120, 140, 0.12);
  --glass-blur: 16px;
  --radius: 14px;
  --radius-sm: 8px;
  --font: 'Inter', sans-serif;
}


[data-theme="hello"] {
  --brand: #fedc00;
  --brand-mid: #f5d000;
  --brand-dark: #9e8800;
  --brand-text: #3a3000;
  --bg: #fffde0;
  --bg-alt: #fff9c4;
  --surface: rgba(254, 220, 0, 0.35);
  --surface-hover: rgba(254, 220, 0, 0.55);
  --surface-active: rgba(254, 220, 0, 0.7);
  --border: rgba(200, 170, 0, 0.3);
  --border-strong: rgba(160, 130, 0, 0.5);
  --text: #2e2800;
  --text-muted: #5a4e00;
  --text-light: #7a6c00;
  --shadow: rgba(160, 130, 0, 0.15);
}

/* ─── Reset & Base ─── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background-color: var(--bg);
  color: var(--text);
  min-height: 100vh;
  transition: background-color 0.3s, color 0.3s;
}

a {
  color: var(--brand-dark);
  text-decoration: none;
  transition: opacity 0.2s;
}

a:hover {
  opacity: 0.75;
}

img,
svg {
  display: block;
}

/* ─── Glassmorphism Card ─── */
.glass-card {
  background: var(--surface);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 24px var(--shadow), 0 1px 0 rgba(255, 255, 255, 0.6) inset;
  transition: background 0.3s, border-color 0.3s, box-shadow 0.3s;
}

.glass-card:hover {
  border-color: var(--border-strong);
}

/* ─── Header ─── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 16px var(--shadow);
  transition: background 0.3s, border-color 0.3s;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 1rem;
}

.logo-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  color: var(--text);
  text-decoration: none;
}

.logo-text {
  font-family: var(--font);
  font-size: 1.2rem;
  font-weight: 400;
  color: var(--text);
}

.logo-sub {
  font-size: 0.7rem;
  background: var(--brand-dark);
  color: white;
  padding: 1px 6px;
  border-radius: 4px;
  font-family: var(--font);
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex: 1;
  margin-left: 1rem;
}

@media (max-width: 1060px) {
  .header-nav {
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    flex-shrink: 1;
  }

  .header-nav::-webkit-scrollbar {
    display: none;
  }

  .nav-link {
    flex-shrink: 0;
  }
}

.nav-link {
  font-family: var(--font);
  font-size: 0.9rem;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: background 0.2s, color 0.2s;
  cursor: pointer;
}

.nav-link:hover,
.nav-link.active {
  background: var(--surface-hover);
  color: var(--text);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

/* ─── Buttons ─── */
.btn {
  font-family: var(--font);
  font-size: 0.9rem;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  transition: all 0.2s;
  white-space: nowrap;
  background: none;
}

.btn-primary {
  background: var(--brand-dark);
  color: white;
  border-color: var(--brand-dark);
}

.btn-primary:hover {
  filter: brightness(1.1);
}

.btn-ghost {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

.btn-ghost:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

.btn-danger {
  background: #c0392b;
  color: white;
  border-color: #c0392b;
}

.btn-danger:hover {
  background: #a93226;
  border-color: #a93226;
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.82rem;
}

.btn.w-full {
  width: 100%;
  justify-content: center;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.2s;
}

.icon-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
  border-color: var(--border-strong);
}

.link-btn {
  background: none;
  border: none;
  color: var(--brand-dark);
  cursor: pointer;
  font-family: var(--font);
  font-size: inherit;
}

.link-btn:hover {
  text-decoration: underline;
}

/* ─── Sidebar ─── */
.sidebar {
  position: fixed;
  left: 0;
  top: 60px;
  bottom: 0;
  width: 280px;
  z-index: 90;
  background: var(--surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 1rem 0;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 4px 0 20px var(--shadow);
}

.sidebar.open {
  transform: translateX(0);
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  z-index: 89;
  background: rgba(0, 0, 0, 0.2);
  display: none;
}

.sidebar-overlay.show {
  display: block;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem 0.75rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.5rem;
}

.sidebar-title {
  font-family: var(--font);
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 400;
}

.sidebar-close {
  width: 28px;
  height: 28px;
}

.sidebar-user-area {
  display: none;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}

@media (max-width: 640px) {
  .sidebar-user-area {
    display: flex;
  }
}

.sidebar-nav {
  padding: 0 0.5rem;
}

.sidebar-loading {
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.sidebar-add-btn {
  width: calc(100% - 1rem);
  margin: 0.5rem 0.5rem 0;
  justify-content: center;
  font-size: 0.82rem;
  opacity: 0.75;
}

.sidebar-add-btn:hover {
  opacity: 1;
}

.add-subsection-btn {
  display: block;
  margin: 1rem 0;
  opacity: 0.7;
}

.add-subsection-btn:hover {
  opacity: 1;
}

.nav-article {
  margin-bottom: 0.25rem;
}

.nav-article-btn {
  width: 100%;
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  justify-content: flex-start;
  transition: background 0.15s;
}

.nav-article-btn:hover {
  background: var(--surface-hover);
}

.nav-article-btn.active {
  background: var(--surface-active);
  color: var(--brand-dark);
}

.nav-chevron {
  transition: transform 0.2s;
  flex-shrink: 0;
  opacity: 0.5;
}

.nav-article.expanded .nav-chevron {
  transform: rotate(90deg);
}

.nav-subsections {
  padding-left: 0.75rem;
  overflow: hidden;
}

.nav-sub-btn {
  width: 100%;
  text-align: left;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.8rem;
  cursor: pointer;
  display: block;
  transition: background 0.15s, color 0.15s;
  border-left: 2px solid transparent;
}

.nav-sub-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.nav-sub-btn.active {
  color: var(--brand-dark);
  border-left-color: var(--brand-dark);
  background: var(--surface-hover);
}

.nav-number {
  opacity: 0.6;
  margin-right: 0.15rem;
}

/* ─── Main Content ─── */
.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  min-height: calc(100vh - 60px);
}

.page {
  display: none;
}

.page.active {
  display: block;
}

/* ─── Hero ─── */
.hero {
  padding: 3rem 2.5rem;
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.hero-body {
  max-width: 600px;
}

.hero-badge {
  display: inline-block;
  font-size: 0.75rem;
  background: var(--brand-dark);
  color: white;
  padding: 3px 10px;
  border-radius: 20px;
  margin-bottom: 1rem;
}

.hero-title {
  font-family: var(--font);
  font-size: 2rem;
  line-height: 1.2;
  margin-bottom: 0.75rem;
  color: var(--text);
  font-weight: 800;
}

.hero-sub {
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.hero-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.hero-graphic {
  flex-shrink: 0;
  opacity: 0.8;
}

/* ─── Sections ─── */
.section-title {
  font-family: var(--font);
  font-size: 1.2rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  font-weight: 400;
}

.section-grid {
  margin-bottom: 2rem;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

.article-card {
  padding: 1.25rem;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s;
  display: flex;
  flex-direction: column;
}

.article-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
}

.article-card .card-num {
  font-size: 0.75rem;
  color: var(--brand-dark);
  margin-bottom: 0.4rem;
  font-family: var(--font);
}

.article-card .card-title {
  font-family: var(--font);
  font-size: 0.95rem;
  color: var(--text);
}

.article-card .card-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
  line-height: 1.5;
}

.article-card .card-views {
  margin-top: auto;
  padding-top: 0.6rem;
  text-align: right;
  font-size: 0.72rem;
  font-family: var(--font);
  color: var(--brand-dark);
  opacity: 0.7;
}

/* ─── Values ─── */
.values-section {
  margin-bottom: 2rem;
}

.values-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.value-card {
  padding: 1.5rem 1.25rem;
  text-align: center;
}

.value-icon {
  margin: 0 auto 0.75rem;
  display: flex;
  justify-content: center;
}

.value-zh {
  font-family: var(--font);
  font-size: 2rem;
  color: var(--brand-dark);
  line-height: 1;
}

.value-en {
  font-family: var(--font);
  font-size: 1rem;
  margin: 0.25rem 0 0.5rem;
  color: var(--text);
}

.value-card p {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ─── Charter Layout ─── */
.charter-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

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

/* ─── Doc Toolbar ─── */
.doc-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.doc-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.doc-breadcrumb a {
  color: var(--brand-dark);
}

.doc-breadcrumb span {
  color: var(--text);
}

.doc-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  position: relative;
}

.copy-dropdown-btn {
  position: relative;
}

.copy-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--bg-alt);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 0.4rem;
  min-width: 220px;
  z-index: 50;
  box-shadow: 0 8px 32px var(--shadow);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  text-align: left;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.84rem;
  cursor: pointer;
  transition: background 0.15s;
}

.dropdown-item:hover {
  background: var(--surface-hover);
}

.dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 0.3rem 0;
}

/* ─── Section Content ─── */
.section-content {
  padding: 1.5rem 0;
}

.section-content-inner {
  max-width: 800px;
}

.section-header {
  margin-bottom: 2rem;
}

.section-type-badge {
  display: inline-block;
  font-size: 0.72rem;
  background: var(--surface-active);
  border: 1px solid var(--border);
  color: var(--brand-dark);
  padding: 2px 8px;
  border-radius: 20px;
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.section-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

.section-slug-display {
  font-size: 0.78rem;
  color: var(--text-light);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 4px;
  font-family: monospace;
}

.edit-slug-btn {
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--brand-dark);
  cursor: pointer;
  font-family: var(--font);
  transition: background 0.15s;
}

.edit-slug-btn:hover {
  background: var(--surface-hover);
}

.edit-content-btn {
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid var(--brand-dark);
  background: var(--brand);
  color: var(--brand-dark);
  cursor: pointer;
  font-family: var(--font);
  transition: background 0.15s;
}

.edit-content-btn:hover {
  background: var(--brand-dark);
  color: #fff;
}

.content-edit-modal {
  max-width: 680px;
  width: 95vw;
}

.section-body .section-img,
.section-body .section-img-figure img {
  cursor: pointer;
}

/* ─── Image Picker Modal ─── */
.image-picker-modal {
  max-width: 780px;
  width: 95vw;
}

.image-picker-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
  gap: 0;
}

.img-tab-btn {
  padding: 0.5rem 1.25rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 0.875rem;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.img-tab-btn.active {
  color: var(--brand-dark);
  border-bottom-color: var(--brand-dark);
}

.img-tab-pane { min-height: 220px; }

.img-drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2.25rem 1rem;
  text-align: center;
  color: var(--text-muted);
  transition: border-color 0.15s, background 0.15s;
  cursor: default;
}

.img-drop-zone.drag-over {
  border-color: var(--brand-dark);
  background: var(--surface);
}

.img-drop-zone svg { margin-bottom: 0.5rem; opacity: 0.5; }

.img-drop-hint {
  font-size: 0.75rem;
  margin-top: 0.35rem;
  opacity: 0.7;
}

.link-btn {
  background: none;
  border: none;
  color: var(--brand-dark);
  cursor: pointer;
  font-size: inherit;
  padding: 0;
  text-decoration: underline;
}

.img-preview-wrap {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.img-preview-wrap > img {
  max-width: 180px;
  max-height: 150px;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.img-upload-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.img-compress-info {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.img-library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 0.5rem;
  max-height: 300px;
  overflow-y: auto;
  padding: 0.1rem;
}

.img-library-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.img-library-tile {
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s;
  display: flex;
  flex-direction: column;
}

.img-library-tile:hover  { border-color: var(--brand-dark); }
.img-library-tile.selected {
  border-color: var(--brand-dark);
  box-shadow: 0 0 0 2px var(--brand-dark);
}

.img-library-tile img {
  width: 100%;
  height: 80px;
  object-fit: cover;
  display: block;
}

.img-tile-name {
  font-size: 0.68rem;
  padding: 0.2rem 0.3rem 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-muted);
}

.img-tile-meta {
  font-size: 0.62rem;
  padding: 0 0.3rem 0.25rem;
  color: var(--text-muted);
  opacity: 0.7;
}

.img-alt-library-group {
  margin-top: 0.75rem;
}

.media-drop-compact {
  padding: 1.1rem 1rem;
}

.media-file-ready {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}

.media-ready-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.media-ready-size {
  color: var(--text-muted);
  font-size: 0.78rem;
  flex-shrink: 0;
}

.media-library-list {
  margin-top: 0.6rem;
  max-height: 180px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.media-library-empty {
  text-align: center;
  padding: 1.5rem;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.media-file-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.75rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.1s;
}

.media-file-row:last-child { border-bottom: none; }
.media-file-row:hover { background: var(--surface); }
.media-file-row.selected {
  background: var(--surface);
  outline: 2px solid var(--brand-dark);
  outline-offset: -2px;
}

.media-file-ext {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.3rem;
  border-radius: 3px;
  background: var(--border);
  color: var(--text-muted);
  flex-shrink: 0;
  min-width: 2.2rem;
  text-align: center;
}

.media-file-row-name {
  flex: 1;
  font-size: 0.82rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-file-row-size {
  font-size: 0.72rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.content-edit-textarea {
  width: 100%;
  min-height: 240px;
  resize: vertical;
  font-family: monospace;
  font-size: 0.85rem;
  line-height: 1.5;
  box-sizing: border-box;
}

.editor-shortcuts-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
  opacity: 0.7;
}

.section-heading {
  font-family: var(--font);
  font-size: 1.75rem;
  line-height: 1.2;
  color: var(--text);
  font-weight: 800;
}

.section-body {
  line-height: 1.75;
  color: var(--text);
}

.section-body h2 {
  font-family: var(--font);
  font-size: 1.2rem;
  margin: 1.75rem 0 0.6rem;
  color: var(--text);
  font-weight: 700;
}

.section-body h3 {
  font-family: var(--font);
  font-size: 1rem;
  margin: 1.25rem 0 0.5rem;
  color: var(--text-muted);
  font-weight: 600;
}

.section-body p {
  margin-bottom: 1rem;
}

.section-body ul,
.section-body ol {
  margin: 0.75rem 0 1rem 1.5rem;
}

.section-body li {
  margin-bottom: 0.4rem;
}

.section-body .decimal-list {
  list-style: none;
  margin-left: 0;
  padding-left: 0;
}

.section-body .decimal-list li {
  display: block;
}

.section-body .decimal-list .ol-depth-0 { padding-left: 0; }
.section-body .decimal-list .ol-depth-1 { padding-left: 1.5rem; }
.section-body .decimal-list .ol-depth-2 { padding-left: 3rem; }
.section-body .decimal-list .ol-depth-3 { padding-left: 4.5rem; }
.section-body .decimal-list .ol-depth-4 { padding-left: 6rem; }
.section-body .decimal-list .ol-depth-5 { padding-left: 7.5rem; }

.section-body u {
  text-decoration: underline;
}

.section-body .section-img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1rem 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.section-body .section-audio {
  display: block;
  width: 100%;
  margin: 1rem 0;
}

.section-body .section-embed {
  display: block;
  width: 100%;
  min-height: 420px;
  margin: 1rem 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.section-body .md-collapse {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin: 1rem 0;
  overflow: hidden;
}

.md-collapse-summary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1rem;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.md-collapse-summary::-webkit-details-marker { display: none; }

.md-collapse-summary::before {
  content: '';
  display: inline-block;
  flex-shrink: 0;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--brand-dark);
  transform: rotate(-90deg);
  transition: transform 0.2s ease;
}
details[open] > .md-collapse-summary::before {
  transform: rotate(0deg);
}

.md-collapse-title {
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--brand-dark);
}

.md-collapse-body {
  padding: 0.25rem 1.25rem 1rem;
  border-top: 1px solid var(--border);
}

mark {
  background: none;
  padding: 0;
}

.section-body .section-embed-pdf  { min-height: 520px; }
.section-body .section-embed-gslide { min-height: 460px; aspect-ratio: 16/9; }

.doc-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  margin: 1rem 0;
}

.doc-card-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  flex-shrink: 0;
}

.doc-card-ext {
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.doc-card-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.doc-card-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.doc-card-type {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.doc-card-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.doc-card-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.embed-type-badge {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.section-body .section-img-figure {
  margin: 1rem 0;
}

.section-body .section-img-figure .section-img {
  margin: 0;
}

.section-body .section-img-caption {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-style: italic;
}

.section-body strong {
  color: var(--text);
}

.section-body em {
  color: var(--text-muted);
}

.section-body code {
  font-size: 0.85em;
  background: var(--surface-active);
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: 4px;
}

.section-body blockquote {
  border-left: 3px solid var(--brand-dark);
  padding: 0.75rem 1rem;
  background: var(--surface);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 1rem 0;
  color: var(--text-muted);
}

.section-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.9rem;
}

.section-body th {
  background: var(--surface-active);
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--border);
  text-align: left;
  color: var(--text);
}

.section-body td {
  padding: 0.55rem 0.9rem;
  border: 1px solid var(--border);
}

.section-body tr:nth-child(even) td {
  background: var(--surface);
}

.section-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 4rem 2rem;
  color: var(--text-muted);
}

/* ─── Site Footer Bar ─── */
.site-footer-bar {
  border-top: 1px solid var(--border);
  margin-top: 3rem;
  padding: 1.5rem 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
}
.site-footer-inner {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  align-items: center;
}
.site-footer-line {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.footer-heart {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

/* ─── Doc Nav Footer ─── */
.doc-nav-footer {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.doc-page-meta {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.doc-views {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.doc-views-icon {
  flex-shrink: 0;
  opacity: 0.7;
}

.doc-views-spinner {
  display: inline-block;
  width: 10px;
  height: 10px;
  border: 1.5px solid var(--border);
  border-top-color: var(--text-muted);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
}

.doc-nav-buttons {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.doc-nav-btn {
  display: flex;
  flex-direction: column;
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: all 0.2s;
  max-width: 240px;
  font-family: var(--font);
  text-align: left;
}

.doc-nav-btn:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

.doc-nav-btn.next {
  text-align: right;
  margin-left: auto;
}

.doc-nav-label {
  font-size: 0.72rem;
  color: var(--text-light);
  margin-bottom: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.doc-nav-title {
  font-size: 0.9rem;
  color: var(--text);
}

/* ─── About Page ─── */
.about-card {
  padding: 2.5rem;
  max-width: 720px;
  margin: 0 auto;
}

.about-card h1 {
  font-family: var(--font);
  font-size: 1.8rem;
  margin-bottom: 1rem;
  font-weight: 800;
}

.about-card h2 {
  font-family: var(--font);
  font-size: 1.15rem;
  margin: 1.5rem 0 0.6rem;
  font-weight: 700;
  color: var(--text-muted);
}

.about-card p {
  line-height: 1.7;
  margin-bottom: 0.75rem;
}

.about-links {
  margin-top: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* ─── Admin ─── */
.admin-layout {
  max-width: 900px;
}

.admin-layout h1 {
  font-family: var(--font);
  font-size: 1.8rem;
  margin-bottom: 1.5rem;
  font-weight: 400;
}

.admin-tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.tab-btn {
  padding: 0.5rem 1rem;
  border: none;
  background: none;
  font-family: var(--font);
  font-size: 0.9rem;
  cursor: pointer;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.2s;
}

.tab-btn.active {
  color: var(--brand-dark);
  border-bottom-color: var(--brand-dark);
}

.tab-content {
  padding: 0;
}

.tab-content.hidden {
  display: none;
}

.tab-content h2 {
  font-family: var(--font);
  font-size: 1.1rem;
  margin-bottom: 1rem;
  font-weight: 400;
}

.users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.users-table th,
.users-table td {
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  text-align: left;
}

.users-table th {
  background: var(--surface-active);
  font-weight: 400;
}

.badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 0.72rem;
}

.badge-green {
  background: rgba(60, 180, 60, 0.15);
  color: #2a7a2a;
}

.badge-red {
  background: rgba(200, 60, 60, 0.15);
  color: #7a2a2a;
}

.badge-grey {
  background: var(--surface-active);
  color: var(--text-muted);
}

.seed-output {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 1rem;
  border-radius: var(--radius-sm);
  margin-top: 1rem;
  font-size: 0.8rem;
  overflow-x: auto;
  white-space: pre-wrap;
}

.admin-images-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.admin-images-toolbar h2 {
  margin-bottom: 0;
}

.admin-images-wrap {
  overflow-x: auto;
}

.admin-images-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.admin-images-table th,
.admin-images-table td {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

.admin-images-table th {
  background: var(--surface-active);
  font-weight: 400;
}

.admin-img-thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  display: block;
}

.admin-img-filename {
  font-size: 0.8rem;
  word-break: break-all;
  max-width: 180px;
}

.admin-img-desc {
  cursor: pointer;
  display: block;
  min-width: 140px;
}

.admin-img-desc:hover {
  text-decoration: underline;
  text-decoration-style: dashed;
}

.admin-img-desc-input {
  width: 100%;
  font-family: var(--font);
  font-size: 0.85rem;
  border: 1px solid var(--brand-dark);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  box-sizing: border-box;
}

.admin-img-staging {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  margin-bottom: 1rem;
}

.admin-img-staging.hidden {
  display: none;
}

.admin-img-staging-thumb img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  display: block;
}

.admin-img-staging-thumb {
  width: 48px;
  height: 48px;
  background: var(--surface-active);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.admin-img-staging-info {
  flex: 1;
  min-width: 0;
}

.admin-img-staging-name {
  display: block;
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-img-staging-meta {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ─── Modals ─── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay[hidden] {
  display: none;
}

.modal {
  width: 100%;
  max-width: 480px;
  padding: 1.75rem;
  max-height: 90vh;
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.96) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  color: #1a1a2e;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.modal-title {
  font-family: var(--font);
  font-size: 1.15rem;
  font-weight: 400;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}

.theme-swatch {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.84rem;
  transition: all 0.15s;
  color: var(--text);
}

.theme-swatch:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

.theme-swatch.active {
  border-color: var(--brand-dark);
  background: var(--surface-active);
}

.swatch-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.swatch-hex {
  margin-left: auto;
  font-size: 0.72rem;
  color: var(--text-light);
  font-family: monospace;
}

/* ─── Auth Modal ─── */
.auth-modal {
  max-width: 420px;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.form-input {
  width: 100%;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-hover);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.9rem;
  transition: border-color 0.2s;
}

.form-input:focus {
  outline: none;
  border-color: var(--brand-dark);
}

.form-hint {
  font-size: 0.78rem;
  color: var(--text-light);
  margin-top: 0.3rem;
}

.auth-error {
  background: rgba(200, 60, 60, 0.1);
  border: 1px solid rgba(200, 60, 60, 0.25);
  color: #8a2a2a;
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.auth-error.hidden {
  display: none;
}

.auth-switch {
  font-size: 0.84rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 1rem;
}

.auth-note {
  font-size: 0.78rem;
  color: var(--text-light);
  text-align: center;
  margin-top: 0.5rem;
}

.hidden {
  display: none;
}

/* ─── User Area ─── */
.user-chip {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.75rem;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.82rem;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.15s;
  color: var(--text);
  position: relative;
}

.user-chip:hover {
  background: var(--surface-hover);
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--bg-alt);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 0.4rem;
  min-width: 160px;
  box-shadow: 0 8px 24px var(--shadow);
  z-index: 50;
}

.user-dropdown-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.84rem;
  cursor: pointer;
  transition: background 0.15s;
}

.user-dropdown-item:hover {
  background: var(--surface-hover);
}

.user-dropdown-item.danger {
  color: #c0392b;
}

/* ─── Toast ─── */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 300;
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--text);
  color: white;
  font-family: var(--font);
  font-size: 0.85rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  animation: slideIn 0.25s ease;
}

.toast.success {
  background: #2e7d32;
}

.toast.error {
  background: #c62828;
}

@keyframes slideIn {
  from {
    transform: translateX(120%);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }

  to {
    transform: translateX(120%);
    opacity: 0;
  }
}

.toast.out {
  animation: slideOut 0.25s ease forwards;
}

/* ─── Spinner ─── */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--brand-dark);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.spinner.large {
  width: 32px;
  height: 32px;
  border-width: 3px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ─── Skeleton ─── */
.skeleton {
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-hover) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  min-height: 100px;
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

/* ─── Subsection Blocks (inline within article pages) ─── */
.subsection-block {
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  scroll-margin-top: 80px;
  /* clearance below sticky header */
}

.subsection-header {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.subsection-heading {
  font-family: var(--font);
  font-size: 1.25rem;
  color: var(--text);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.subsection-num {
  font-size: 0.75rem;
  color: var(--text-light);
  background: var(--surface-active);
  border: 1px solid var(--border);
  padding: 2px 7px;
  border-radius: 10px;
}

.anchor-link {
  opacity: 0;
  transition: opacity 0.15s;
  color: var(--brand-dark);
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.subsection-block:hover .anchor-link {
  opacity: 1;
}

.article-intro {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
  color: var(--text-muted);
}

/* ─── Sidebar: split article title / chevron ─── */
.nav-article-row {
  display: flex;
  align-items: stretch;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.nav-article-row .nav-article-btn {
  flex: 1;
  border-radius: 0;
}

.nav-chevron-btn {
  flex-shrink: 0;
  width: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--text-muted);
  transition: background 0.15s;
  border-radius: 0;
}

.nav-chevron-btn:hover {
  background: var(--surface-hover);
}

.nav-article-row:hover {
  background: var(--surface);
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 3px;
}

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

/* ─── Responsive ─── */
@media (min-width: 900px) {
  .sidebar {
    position: fixed;
    top: 60px;
    transform: none;
    height: calc(100vh - 60px);
    box-shadow: none;
  }

  .sidebar.collapsed {
    transform: translateX(-100%);
  }

  .sidebar-overlay {
    display: none !important;
  }

  .sidebar-close {
    display: none;
  }

  .main-content {
    padding-left: 296px;
    transition: padding-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .main-content.sidebar-hidden {
    padding-left: 1.5rem;
  }
}

@media (max-width: 640px) {
  .hero {
    flex-direction: column;
    padding: 2rem 1.5rem;
  }

  .hero-graphic {
    display: none;
  }

  .hero-title {
    font-size: 1.5rem;
  }

  .header-nav {
    display: none;
  }

  .user-area {
    display: none;
  }

  .theme-grid {
    grid-template-columns: 1fr;
  }

  .doc-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ─── Search ─── */
.search-modal-overlay {
  align-items: flex-start;
  padding-top: 80px;
}

.search-modal-box {
  width: 100%;
  max-width: 560px;
  padding: 0;
  overflow: hidden;
  background: #ffffff;
  border-radius: var(--radius);
  border: 1px solid #e0e0e0;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
}

.search-input-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  border-bottom: 1px solid #e8e8e8;
}

.search-icon-inner {
  flex-shrink: 0;
  color: #888;
}

.search-input {
  flex: 1;
  border: none;
  background: none;
  font-family: var(--font);
  font-size: 1rem;
  color: #1a1a2e;
  outline: none;
}

.search-input::placeholder {
  color: #aaa;
}

.search-clear-btn {
  background: none;
  border: none;
  color: #888;
  flex-shrink: 0;
}

.search-clear-btn:hover {
  background: #f0f0f0;
  color: #333;
  border: none;
}

.search-results {
  max-height: 360px;
  overflow-y: auto;
}

.search-empty {
  padding: 1.5rem 1rem;
  text-align: center;
  color: #888;
  font-size: 0.9rem;
}

.search-result-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  cursor: pointer;
  transition: background 0.15s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  color: #1a1a2e;
  font-family: var(--font);
}

.search-result-item:hover,
.search-result-item.focused {
  background: #f5f5f5;
}

.search-result-icon {
  flex-shrink: 0;
  color: #4a6a8a;
  display: flex;
  align-items: center;
  padding-top: 2px;
}

.search-result-text {
  flex: 1;
  min-width: 0;
}

.search-result-title {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #1a1a2e;
}

.search-result-sub {
  display: block;
  font-size: 0.75rem;
  color: #777;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-snippet {
  display: block;
  font-size: 0.78rem;
  color: #555;
  margin-top: 2px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.4;
}

@media (max-width: 640px) {
  #search-btn {
    display: none;
  }

  .search-modal-overlay {
    padding-top: 60px;
  }
}

/* ─── Home Doc Cards ─── */
.home-doc-card {
  padding: 1.5rem;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.home-doc-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-strong);
}

.home-doc-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-active);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  margin-bottom: 0.35rem;
}

.home-doc-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.home-doc-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ─── Sidebar Site Navigation Section ─── */
.site-nav-section {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.site-nav-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.75rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background 0.15s, color 0.15s;
}

.site-nav-header:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.site-nav-header .nav-chevron {
  opacity: 0.5;
  transition: transform 0.2s;
  flex-shrink: 0;
}

.site-nav-list {
  padding: 0.25rem 0 0.25rem 0.25rem;
}

.site-nav-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  text-align: left;
}

/* ─── TOC Card Buttons ─── */
.toc-card-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 1rem 0 1.5rem;
}

.toc-card-btn {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
  text-decoration: none;
  color: var(--text);
  opacity: 1;
}

.toc-card-btn:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
  transform: translateX(4px);
  opacity: 1;
}

.toc-card-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.toc-card-title .card-num {
  font-size: 0.78rem;
  color: var(--brand-dark);
  font-weight: 500;
}

.toc-card-subs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.5rem;
}

.toc-sub-item {
  font-size: 0.72rem;
  color: var(--text-muted);
  background: var(--surface-active);
  border: 1px solid var(--border);
  padding: 1px 8px;
  border-radius: 10px;
}