/* ── Knowledge Page Layout ──────────────────────────────── */

.knowledge-hero {
  padding: 8rem 5% 3rem;
  background: linear-gradient(
    135deg,
    rgba(45, 74, 62, 0.05) 0%,
    transparent 60%
  );
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.knowledge-hero-inner {
  max-width: 1200px;
  margin: 0 auto;
}

.knowledge-hero-label {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--point-color);
  background: rgba(45, 74, 62, 0.08);
  padding: 0.3rem 0.85rem;
  border-radius: 20px;
  margin-bottom: 1rem;
}

.knowledge-hero h1 {
  font-size: 2.8rem;
  color: #1a1a1a;
  margin-bottom: 0.75rem;
  line-height: 1.2;
}

.knowledge-hero-desc {
  font-size: 1.05rem;
  color: #666;
  max-width: 620px;
  line-height: 1.75;
}

/* ── Two-column layout ─────────────────────── */
.knowledge-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 4rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 3.5rem 5% 6rem;
  align-items: start;
}

/* ── Sidebar TOC ──────────────────────────── */
.knowledge-toc-sidebar {
  position: sticky;
  top: 100px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(45, 74, 62, 0.2) transparent;
}

.knowledge-toc-sidebar::-webkit-scrollbar {
  width: 4px;
}
.knowledge-toc-sidebar::-webkit-scrollbar-thumb {
  background: rgba(45, 74, 62, 0.2);
  border-radius: 2px;
}

.toc-header {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #aaa;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.toc-nav {
  display: flex;
  flex-direction: column;
}

.toc-link {
  display: block;
  padding: 0.4rem 0.75rem;
  font-size: 0.875rem;
  color: #999;
  text-decoration: none;
  border-left: 2px solid transparent;
  border-radius: 0 6px 6px 0;
  transition:
    color 0.2s,
    background 0.2s,
    border-color 0.2s;
  line-height: 1.45;
}

.toc-link:hover {
  color: var(--point-color);
  background: rgba(45, 74, 62, 0.04);
}

.toc-link.active {
  color: var(--point-color);
  border-left-color: var(--point-color);
  background: rgba(45, 74, 62, 0.06);
  font-weight: 500;
}

.toc-link.toc-h3 {
  padding-left: 1.5rem;
  font-size: 0.82rem;
}

/* ── Main Content ─────────────────────────── */
.knowledge-content {
  min-width: 0;
}

.knowledge-content h2 {
  font-size: 1.65rem;
  color: #1a1a1a;
  margin: 3.5rem 0 1rem;
  padding-top: 0.5rem;
  scroll-margin-top: 110px;
}

.knowledge-content h2:first-child {
  margin-top: 0;
}

.knowledge-content h3 {
  font-size: 1.15rem;
  color: #2a2a2a;
  margin: 2.25rem 0 0.75rem;
  scroll-margin-top: 110px;
}

.knowledge-content p {
  font-size: 1rem;
  line-height: 1.9;
  color: #444;
  margin-bottom: 1rem;
}

.knowledge-content ul,
.knowledge-content ol {
  padding-left: 1.5rem;
  margin-bottom: 1.25rem;
}

.knowledge-content-image {
  display: block;
  width: 100%;
  max-width: 640px;
  margin: 0.5rem 0 1.5rem;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.knowledge-content .knowledge-table.knowledge-table-small ul {
  padding-left: 1rem;
  margin-bottom: 0;
}

.knowledge-content li {
  font-size: 1rem;
  line-height: 1.8;
  color: #444;
  margin-bottom: 0.3rem;
}

.knowledge-content .knowledge-table.knowledge-table-small li {
  font-size: 0.85rem;
  line-height: 1.6;
  color: #444;
}

.knowledge-content hr {
  border: none;
  border-top: 1px solid rgba(0, 0, 0, 0.07);
  margin: 3rem 0;
}

.knowledge-info-box {
  background: rgba(45, 74, 62, 0.05);
  border-left: 3px solid var(--point-color);
  border-radius: 0 10px 10px 0;
  padding: 1.25rem 1.5rem;
  margin: 1.75rem 0;
}

.knowledge-info-box p {
  margin-bottom: 0;
  font-size: 0.95rem;
  color: #555;
}

/* ── Reading Progress Bar ─────────────────── */
.reading-progress-bar {
  position: fixed;
  left: 0;
  height: 3px;
  width: 0%;
  background: var(--point-color);
  z-index: 1001;
  transition: width 0.08s linear;
  display: none;
}

/* ── Mobile TOC Drawer Button ──────────────── */
.toc-drawer-btn {
  display: none;
  position: fixed;
  bottom: 1.75rem;
  right: 1.5rem;
  background: var(--point-color);
  color: white;
  border: none;
  border-radius: 50px;
  padding: 0.7rem 1.25rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  z-index: 1100;
  box-shadow: 0 4px 18px rgba(45, 74, 62, 0.35);
  font-family: inherit;
  align-items: center;
  gap: 0.5rem;
}

/* ── Drawer Overlay ───────────────────────── */
.toc-drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 1200;
}

/* ── Drawer Panel ─────────────────────────── */
.toc-drawer {
  position: fixed;
  top: 0;
  left: 0;
  width: 280px;
  height: 100%;
  background: #fff;
  z-index: 1300;
  transform: translateX(-100%);
  transition: transform 0.28s ease;
  display: flex;
  flex-direction: column;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.12);
}

.toc-drawer.open {
  transform: translateX(0);
}

.toc-drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  font-weight: 600;
  font-size: 1rem;
  color: #1a1a1a;
  flex-shrink: 0;
}

.toc-drawer-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: #888;
  padding: 0;
  line-height: 1;
  transition: color 0.2s;
}

.toc-drawer-close:hover {
  color: #333;
}

.toc-drawer-body {
  padding: 1.25rem 1rem;
  overflow-y: auto;
  flex: 1;
}

.toc-drawer-body .toc-link {
  font-size: 0.95rem;
  padding: 0.55rem 0.75rem;
}

.toc-drawer-body .toc-link.toc-h3 {
  font-size: 0.88rem;
  padding-left: 1.5rem;
}

/* ── Citation ─────────────────────────────── */
.knowledge-content p.knowledge-cite {
  font-size: 0.75rem;
  color: #c0c0c0;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  padding-top: 0.75rem;
  margin-top: 2rem;
  line-height: 1.6;
}

.knowledge-cite {
  font-size: 0.75rem;
  color: #c0c0c0;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  padding-top: 0.75rem;
  margin-top: 2rem;
  line-height: 1.6;
}

/* ── Table ─────────────────────────────────── */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1.5rem 0;
}

.table-scroll .knowledge-table {
  margin: 0;
}

.knowledge-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.95rem;
}

.knowledge-table-small {
  font-size: 0.85rem;
}

.knowledge-table.knowledge-table-small th,
.knowledge-table.knowledge-table-small td {
  font-size: 0.85rem;
  padding: 0.5rem 0.75rem;
}

.knowledge-table th,
.knowledge-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border: 1px solid rgba(0, 0, 0, 0.08);
  line-height: 1.6;
  color: #444;
}

.knowledge-table th.center,
.knowledge-table td.center {
  text-align: center;
}

.knowledge-table th {
  background: rgba(45, 74, 62, 0.06);
  font-weight: 600;
  color: #2d2d2d;
}

.knowledge-table tr:nth-child(even) td {
  background: rgba(0, 0, 0, 0.015);
}

/* ── Responsive ───────────────────────────── */
@media (max-width: 1024px) {
  .knowledge-layout {
    grid-template-columns: 1fr;
    padding: 2.5rem 5% 4rem;
  }

  .knowledge-toc-sidebar {
    display: none;
  }

  .reading-progress-bar {
    display: block;
  }

  .toc-drawer-btn {
    display: flex;
  }
}

@media (max-width: 768px) {
  .knowledge-hero {
    padding: 7rem 5% 2.5rem;
  }

  .knowledge-hero h1 {
    font-size: 2rem;
  }

  .knowledge-content h2 {
    font-size: 1.35rem;
    scroll-margin-top: 90px;
  }

  .knowledge-content h3 {
    font-size: 1.05rem;
    scroll-margin-top: 90px;
  }

  .knowledge-table.knowledge-table-small th,
  .knowledge-table.knowledge-table-small td {
    font-size: 0.85rem;
    padding: 0.25rem 0.5rem;
  }
}
