/* ══════════════════════════════════════════════════════════════
   Knowledge Garden — Landing Page Styles
   ══════════════════════════════════════════════════════════════ */

html { background: #F4F2EF; }

body.kg-page {
  background: #F4F2EF;
  max-width: 1440px;
  margin: 0 auto;
}

/* Nav override: match warm parchment background */
.kg-page .nav {
  background: rgba(244, 242, 239, 0.92);
  border-bottom: 1px solid rgba(200, 180, 150, 0.2);
}


/* ── Typography helpers ── */

.kg-fig-label {
  display: block;
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-size: 11px;
  font-weight: 500;
  color: #C8B496;
  letter-spacing: 2px;
  text-transform: uppercase;
}

/* For use on dark backgrounds */
.kg-fig-label-light {
  display: block;
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-size: 11px;
  font-weight: 500;
  color: #C8B496;
  letter-spacing: 2.5px;
  text-transform: uppercase;
}

/* ── Hero Section ── */

.kg-hero {
  display: flex;
  align-items: center;
  gap: 64px;
  padding: 80px 64px;
  background: #F4F2EF;
  min-height: 580px;
}

.kg-hero-text {
  display: flex;
  flex-direction: column;
  gap: 32px;
  flex: 1;
  min-width: 0;
}

.kg-hero-headline {
  font-family: 'Newsreader', Georgia, serif;
  font-size: 72px;
  font-weight: 400;
  color: #1A1A1A;
  letter-spacing: -1px;
  line-height: 1.05;
}

.kg-hero-desc {
  font-family: 'Geist', 'Inter', system-ui, sans-serif;
  font-size: 17px;
  color: #4A4A4A;
  line-height: 1.6;
  max-width: 480px;
}

.kg-hero-desc-sub {
  font-family: 'Geist', 'Inter', system-ui, sans-serif;
  font-size: 15px;
  color: #777777;
  line-height: 1.5;
  max-width: 440px;
}

.kg-hero-visual {
  width: 480px;
  height: 420px;
  flex-shrink: 0;
  border-radius: 10px;
  overflow: hidden;
}

.kg-hero-visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ── Section Divider ── */

.kg-divider {
  height: 1px;
  margin: 0 64px;
  background: rgba(200, 180, 150, 0.2);
}

/* ── Explore by Topic ── */

.kg-topics {
  display: flex;
  flex-direction: column;
  gap: 48px;
  padding: 64px 64px 80px;
  background: #F4F2EF;
}

.kg-topics-header {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.kg-topics-title {
  font-family: 'Newsreader', Georgia, serif;
  font-size: 40px;
  font-weight: 400;
  color: #1A1A1A;
  letter-spacing: -0.5px;
}

.kg-topics-desc {
  font-family: 'Geist', 'Inter', system-ui, sans-serif;
  font-size: 16px;
  color: #4A4A4A;
  line-height: 1.5;
  max-width: 560px;
}

.kg-card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.kg-card {
  background: #FFFFFF;
  border-radius: 6px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  border: 1px solid rgba(200, 180, 150, 0.13);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.031);
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.2s, transform 0.2s;
}

.kg-card:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

.kg-card-unpublished { opacity: 0.65; }

.kg-card-label {
  display: block;
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-size: 10px;
  font-weight: 500;
  color: #C8B496;
  letter-spacing: 1.5px;
}

.kg-card-title {
  display: block;
  font-family: 'Newsreader', Georgia, serif;
  font-size: 22px;
  font-weight: 500;
  color: #1A1A1A;
  line-height: 1.25;
}

.kg-card-desc {
  display: block;
  font-family: 'Geist', 'Inter', system-ui, sans-serif;
  font-size: 14px;
  color: #4A4A4A;
  line-height: 1.55;
}

.kg-empty {
  grid-column: 1 / -1;
  font-family: 'Geist', system-ui, sans-serif;
  font-size: 15px;
  color: #777777;
  font-style: italic;
}

/* ── Enter the Garden ── */

.kg-enter {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  padding: 80px 120px;
  background: #F4F2EF;
  text-align: center;
}

.kg-enter-headline {
  font-family: 'Newsreader', Georgia, serif;
  font-size: 72px;
  font-weight: 400;
  color: #1A1A1A;
  letter-spacing: -1.5px;
  width: 100%;
}

.kg-enter-desc {
  font-family: 'Geist', 'Inter', system-ui, sans-serif;
  font-size: 18px;
  color: #4A4A4A;
  line-height: 1.6;
  max-width: 720px;
}

.kg-enter-divider {
  width: 60px;
  height: 1.5px;
  background: #C8B496;
}

.kg-node-viz {
  width: 800px;
  max-width: 100%;
}

/* ── Library Intro (dark section) ── */

.kg-library-intro {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 40px;
  padding: 80px 64px;
  background: #1A1A1A;
  text-align: center;
}

.kg-library-heading {
  font-family: 'Newsreader', Georgia, serif;
  font-size: 44px;
  font-weight: 500;
  color: #FFFFFF;
  letter-spacing: -0.5px;
  max-width: 700px;
  line-height: 1.15;
}

.kg-library-desc {
  font-family: 'Geist', 'Inter', system-ui, sans-serif;
  font-size: 16px;
  color: #999999;
  line-height: 1.7;
  max-width: 640px;
}

.kg-library-divider {
  width: 60px;
  height: 1px;
  background: #C8B496;
}

.kg-stats {
  display: flex;
  align-items: center;
  gap: 48px;
}

.kg-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.kg-stat-num {
  font-family: 'Newsreader', Georgia, serif;
  font-size: 36px;
  font-weight: 500;
  color: #C8B496;
  line-height: 1;
}

.kg-stat-label {
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-size: 10px;
  font-weight: 500;
  color: #777777;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.kg-library-cta {
  display: inline-block;
  margin-top: 8px;
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-size: 13px;
  font-weight: 500;
  color: #C8B496;
  letter-spacing: 0.5px;
  text-decoration: none;
  transition: opacity 0.15s;
}
.kg-library-cta:hover { opacity: 0.7; }

/* ── Favorite Books ── */

.kg-books {
  display: flex;
  flex-direction: column;
  gap: 48px;
  padding: 72px 64px;
  background: #F4F2EF;
}

.kg-books-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.kg-books-header-left {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.kg-shelf-label {
  display: block;
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-size: 11px;
  font-weight: 500;
  color: #C8B496;
  letter-spacing: 2.5px;
}

.kg-books-title {
  font-family: 'Newsreader', Georgia, serif;
  font-size: 32px;
  font-weight: 500;
  color: #1A1A1A;
  letter-spacing: -0.3px;
}

.kg-books-subtext {
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-size: 11px;
  font-weight: 400;
  color: #777777;
  letter-spacing: 0.5px;
  padding-bottom: 5px;
}

.kg-books-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}

.kg-book-card {
  display: flex;
  flex-direction: column;
  background: #FFFFFF;
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}

.kg-book-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.09);
}

.kg-book-cover {
  height: 220px;
  overflow: hidden;
  flex-shrink: 0;
}

.kg-book-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s;
}

.kg-book-card:hover .kg-book-cover img {
  transform: scale(1.03);
}

.kg-book-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 20px;
  flex: 1;
}

.kg-book-title {
  display: block;
  font-family: 'Newsreader', Georgia, serif;
  font-size: 17px;
  font-weight: 600;
  color: #1A1A1A;
  line-height: 1.3;
}

.kg-book-author {
  display: block;
  font-family: 'Geist', 'Inter', system-ui, sans-serif;
  font-size: 13px;
  color: #777777;
}

.kg-book-note {
  display: block;
  font-family: 'Geist', 'Inter', system-ui, sans-serif;
  font-size: 12px;
  color: #4A4A4A;
  line-height: 1.5;
  font-style: italic;
  margin-top: 4px;
}

/* ══════════════════════════════════════════════════════════════
   Responsive
   ══════════════════════════════════════════════════════════════ */

@media (max-width: 1200px) {
  .kg-books-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 1024px) {
  .kg-hero { padding: 60px 40px; gap: 40px; min-height: 0; }
  .kg-hero-visual { width: 380px; height: 340px; }
  .kg-divider { margin: 0 40px; }
  .kg-topics { padding: 56px 40px 64px; }
  .kg-card-grid { grid-template-columns: repeat(2, 1fr); }
  .kg-enter { padding: 64px 64px; }
  .kg-enter-headline { font-size: 56px; }
  .kg-library-intro { padding: 64px 40px; }
  .kg-library-heading { font-size: 36px; }
  .kg-books { padding: 56px 40px; }
  .kg-books-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
  .kg-hero { flex-direction: column; padding: 48px 24px; gap: 40px; }
  .kg-hero-headline { font-size: 52px; }
  .kg-hero-visual { width: 100%; height: 300px; }
  .kg-divider { margin: 0 24px; }
  .kg-topics { padding: 48px 24px 56px; }
  .kg-card-grid { grid-template-columns: 1fr; }
  .kg-enter { padding: 56px 24px; }
  .kg-enter-headline { font-size: 44px; }
  .kg-enter-desc { font-size: 16px; }
  .kg-library-intro { padding: 56px 24px; }
  .kg-library-heading { font-size: 30px; }
  .kg-stats { gap: 32px; flex-wrap: wrap; justify-content: center; }
  .kg-books { padding: 48px 24px; }
  .kg-books-header { flex-direction: column; align-items: flex-start; }
  .kg-books-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .kg-hero-headline { font-size: 40px; }
  .kg-enter-headline { font-size: 36px; }
  .kg-books-grid { grid-template-columns: 1fr; }
}

/* ══════════════════════════════════════════════════════════════
   Individual Note Page — Two-Pane Layout
   ══════════════════════════════════════════════════════════════ */

/* Outer flex wrapper sits below the nav */
.note-layout {
  display: flex;
  align-items: flex-start;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 32px;
}

/* ── Left sidebar — 50% split ── */
.note-sidebar {
  flex: 1 1 0;
  min-width: 0;
  max-width: 620px;
  position: sticky;
  top: 64px;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  padding: 40px 32px 40px 0;
  border-right: 1px solid rgba(0,0,0,0.06);
  scrollbar-width: none;
}
.note-sidebar::-webkit-scrollbar { display: none; }

/* ── Right content — 50% split ── */
.note-main {
  flex: 1 1 0;
  min-width: 0;
  max-width: 680px;
  padding: 64px 0 64px 48px;
}

/* ── Sidebar sections ── */
.sb-section { margin-bottom: 28px; }

.sb-heading {
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #C8B496;
  margin-bottom: 10px;
}

.sb-sub-heading {
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-size: 10px;
  color: #9A8A78;
  margin: 10px 0 5px;
}

.sb-link {
  display: flex;
  align-items: center;
  font-size: 12px;
  color: #5A5A5A;
  text-decoration: none;
  line-height: 1.5;
  padding: 2px 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  max-width: 100%;
}
.sb-link:hover { color: #1A1A1A; }
.sb-link.current { color: #C8B496; cursor: default; }

.sb-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-right: 7px;
  flex-shrink: 0;
}

/* ── Graph canvas ── */
.sb-graph-canvas {
  width: 100%;
  height: 320px;
  background: #1A1A1A;
  border-radius: 8px;
  display: block;
  cursor: grab;
}
.sb-graph-canvas:active { cursor: grabbing; }

.sb-graph-hint {
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-size: 9px;
  color: rgba(200,180,150,0.4);
  letter-spacing: 0.5px;
  margin-top: 5px;
  text-align: right;
}

.sb-tooltip {
  position: fixed;
  background: rgba(26,26,26,0.92);
  color: #E8E3D8;
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-size: 11px;
  padding: 5px 9px;
  border-radius: 4px;
  pointer-events: none;
  white-space: nowrap;
  z-index: 300;
  opacity: 0;
  transition: opacity 0.1s;
}
.sb-tooltip.visible { opacity: 1; }

/* ── Mobile: sidebar becomes slide-up drawer ── */
@media (max-width: 960px) {
  .note-layout { display: block; padding: 0 20px; }

  .note-main { padding: 40px 0 64px; max-width: 100%; }

  .note-sidebar {
    position: fixed;
    left: 0; bottom: 0;
    width: 100%;
    max-height: 85vh;
    height: auto;
    border-right: none;
    border-top: 1px solid rgba(0,0,0,0.1);
    background: #F4F2EF;
    z-index: 200;
    padding: 20px 20px 32px;
    transform: translateY(100%);
    transition: transform 0.25s ease;
    overflow-y: auto;
  }
  .note-sidebar.open { transform: translateY(0); }

  .sb-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.3);
    z-index: 199;
  }
  .sb-overlay.visible { display: block; }

  .sb-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 44px; height: 44px;
    border-radius: 50%;
    background: #1A1A1A;
    color: #E8E3D8;
    border: none;
    font-size: 16px;
    cursor: pointer;
    z-index: 201;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

@media (min-width: 961px) {
  .sb-toggle  { display: none; }
  .sb-overlay { display: none; }
}

/* Legacy single-column class — now unused but kept for safety */
.note-page {
  max-width: 680px;
  margin: 0 auto;
  padding: 64px 32px;
}

.note-header {
  margin-bottom: 40px;
  padding-bottom: 24px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.note-page-title {
  font-size: 36px;
  font-weight: 600;
  color: var(--text-dark);
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}

.note-date {
  font-size: 13px;
  color: var(--text-mid);
}

.nav-back {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-mid);
  text-decoration: none;
  transition: color 0.15s;
}

.nav-back:hover { color: var(--text-dark); }

/* ── Prose (note body) ── */
.prose { line-height: 1.75; color: var(--text-dark); }
.prose h1, .prose h2, .prose h3 { font-weight: 600; margin: 2em 0 0.5em; letter-spacing: -0.3px; }
.prose h1 { font-size: 28px; }
.prose h2 { font-size: 22px; }
.prose h3 { font-size: 18px; }
.prose p  { margin: 0 0 1.2em; }
.prose a,
.kg-hero-desc a,
.kg-hero-desc-sub a { color: #C67A52; text-decoration: underline; }
.prose ul, .prose ol { padding-left: 1.5em; margin: 0 0 1.2em; }
.prose li { margin-bottom: 0.4em; }
.prose code { background: #F0EDE8; padding: 2px 6px; border-radius: 4px; font-size: 0.9em; }
.prose pre  { background: #F0EDE8; padding: 16px; border-radius: 8px; overflow-x: auto; margin: 0 0 1.2em; }
.prose blockquote { border-left: 3px solid #C67A52; margin: 0 0 1.2em; padding: 4px 16px; color: var(--text-mid); }
.prose img { max-width: 100%; height: auto; border-radius: 6px; margin: 1em 0 1.4em; display: block; }

/* ── Callouts ── */
.callout {
  border-radius: 6px;
  padding: 12px 16px;
  margin: 0 0 1.2em;
  background: #F5F2EE;
  border-left: 3px solid #C4A84F;
}
/* Standard types */
.callout-note    { border-color: #6B8FA6; background: #EEF3F6; }
.callout-tip     { border-color: #7A9F87; background: #EEF4F0; }
.callout-warning { border-color: #C4A84F; background: #F8F4E8; }
.callout-danger  { border-color: #C67A52; background: #F8EFEA; }
.callout-info    { border-color: #6B8FA6; background: #EEF3F6; }
.callout-success { border-color: #7A9F87; background: #EEF4F0; }

/* Note type header callouts (insight, concept) — compact banner */
.callout-insight,
.callout-concept {
  padding: 8px 14px;
  background: transparent;
  border-left: none;
  border-bottom: 1px solid #E8E2D8;
  border-radius: 0;
  margin: 0 0 0.8em;
}
.callout-insight { border-bottom-color: #C8B49640; }
.callout-concept { border-bottom-color: #6B8FA640; }
.callout-insight .callout-title { color: #C8B496; }
.callout-concept .callout-title { color: #6B8FA6; }

/* Structure section callouts */
.callout-stems-from,
.callout-related-to {
  background: #EEF4F0;
  border-color: #7A9F87;
}
.callout-references {
  background: #F0EDE8;
  border-color: #9A8A78;
}
.callout-abstract {
  background: transparent;
  border-color: #C8B49660;
  padding: 8px 14px;
}

/* Excerpt / pull quote — parchment paper box */
.callout-excerpt {
  position: relative;
  background: #F7F2E8;
  border: 1px solid #DDD5C0;
  border-radius: 4px;
  padding: 32px 36px 24px;
  margin: 2em 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06), inset 0 1px 0 rgba(255,255,255,0.6);
}
.callout-excerpt-mark {
  font-family: 'Newsreader', Georgia, serif;
  font-size: 56px;
  line-height: 1;
  color: #C67A52;
  opacity: 0.35;
  position: absolute;
  top: 12px;
  left: 28px;
  user-select: none;
}
.callout-excerpt-body {
  font-family: 'Newsreader', Georgia, serif;
  font-size: 18px;
  font-style: italic;
  line-height: 1.75;
  color: #2A2A2A;
  margin: 0 0 16px;
}
.callout-excerpt-citation {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.4px;
  color: #9A8A78;
  border-top: 1px solid #DDD5C060;
  padding-top: 12px;
}
.callout-excerpt-citation a[data-book-slug] {
  color: #9A8A78;
  text-decoration: none;
  border-bottom: 1px solid #9A8A7860;
  cursor: pointer;
}
.callout-excerpt-citation a[data-book-slug]:hover {
  color: #C8B496;
  border-bottom-color: #C8B496;
}

/* Callout title */
.callout-title {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #6A6A6A;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 0;
}
.callout-body:not(:empty) { margin-top: 10px; }

.callout-icon { font-style: normal; font-size: 13px; }

/* #note/type tag badge */
.callout-tag {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.5px;
  background: #E8E3D8;
  color: #9A8A78;
  border-radius: 3px;
  padding: 2px 7px;
  text-transform: none;
}

/* Callout body */
.callout-body {
  font-family: 'Geist', sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: #3A3A3A;
}
.callout-body ul { margin: 0; padding-left: 16px; }
.callout-body li { margin-bottom: 4px; }
.callout-body p  { margin: 0 0 6px; }
.callout-body a  { color: #C8B496; text-decoration: none; border-bottom: 1px solid #C8B49660; }
.callout-body a:hover { border-bottom-color: #C8B496; }

@media (max-width: 768px) {
  .note-page { padding: 48px 20px; }
  .note-page-title { font-size: 26px; }
}

/* ══════════════════════════════════════════════════════════════
   Knowledge Garden — Graph View
   ══════════════════════════════════════════════════════════════ */

.kg-graph-wrap {
  position: relative;
  width: 100%;
  height: 520px;
  background: #1A1A1A;
  border-radius: 10px;
  overflow: hidden;
  margin-top: 32px;
}

#kg-graph {
  width: 100%;
  height: 100%;
  display: block;
}

/* Legend */
.kg-graph-legend {
  position: absolute;
  top: 14px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  z-index: 10;
  pointer-events: none;
}

.kg-legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-size: 10px;
  letter-spacing: 0.5px;
  color: rgba(255,255,255,0.65);
}

/* Tooltip */
.kg-tooltip {
  position: absolute;
  background: rgba(30, 28, 26, 0.92);
  color: #E8E3D8;
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-size: 11px;
  padding: 6px 10px;
  border-radius: 5px;
  pointer-events: none;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 20;
  border: 1px solid rgba(200,180,150,0.2);
}

.kg-tooltip.visible { opacity: 1; }


/* Unpublished wikilinks — dashed underline, muted color */
a[data-coming-soon] {
  color: #9A8A78;
  text-decoration: none;
  border-bottom: 1px dashed #9A8A7880;
  cursor: pointer;
}
a[data-coming-soon]:hover {
  color: #C8B496;
  border-bottom-color: #C8B496;
}

/* Topic map badge */
.note-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #D4A84B;
  margin-bottom: 10px;
}
.note-type-badge svg {
  flex-shrink: 0;
}
