/* ==========================================================================
   Dev Case Studies — Professional Academic Design System
   Sidebar filter layout, Cornell Notes, decade/tag/RQ filters
   ========================================================================== */

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

:root {
  --bg:             #f6f4f0;
  --bg-paper:       #faf9f6;
  --bg-warm:        #f0ebe3;
  --bg-sidebar:     #faf8f5;
  --card-bg:        #ffffff;
  --primary:        #1c1c1c;
  --primary-soft:   #2e2e2e;
  --accent:         #2d5f8a;
  --accent-hover:   #1e4a6e;
  --accent-light:   #e8f0f7;
  --accent-warm:    #7a5c3e;
  --accent-warm-bg: #faf3eb;
  --text:           #2c2c2c;
  --text-secondary: #555555;
  --text-muted:     #8a8a8a;
  --border:         #e0ddd7;
  --border-light:   #eae7e1;
  --divider:        #d4d0c8;
  --shadow-sm:      0 1px 3px rgba(0,0,0,0.06);
  --shadow-md:      0 2px 8px rgba(0,0,0,0.08);
  --shadow-lg:      0 4px 20px rgba(0,0,0,0.1);
  --shadow-card:    0 1px 4px rgba(0,0,0,0.05), 0 0 0 1px rgba(0,0,0,0.03);
  --radius-sm:      4px;
  --radius-md:      8px;
  --radius-lg:      12px;

  --evidence-strong:   #3d7a5f;
  --evidence-moderate: #c17825;
  --evidence-emerging: #8a8a8a;

  --topic-financial:     #8b6914;
  --topic-financial-bg:  #f9f3e3;
  --topic-health:        #9e3a3a;
  --topic-health-bg:     #faf0f0;
  --topic-education:     #2d5f8a;
  --topic-education-bg:  #edf3f9;
  --topic-social:        #6b4c8a;
  --topic-social-bg:     #f3eef8;
  --topic-agriculture:   #3d6b3d;
  --topic-agriculture-bg:#eef5ee;
  --topic-economic:      #4a4a4a;
  --topic-economic-bg:   #f0f0f0;
  --topic-environment:   #2d7a6b;
  --topic-environment-bg:#ecf5f3;
  --topic-governance:    #5c3d7a;
  --topic-governance-bg: #f0eaf5;
  --topic-infrastructure:#7a3d5c;
  --topic-infrastructure-bg:#f5eaf0;
  --topic-gender:        #8a4a6b;
  --topic-gender-bg:     #f8eef3;

  --font-serif:  'Source Serif 4', Georgia, 'Times New Roman', serif;
  --font-sans:   'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-hand:   'Caveat', cursive;
  --font-mono:   'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;

  --sp-1: 0.25rem; --sp-2: 0.5rem; --sp-3: 0.75rem; --sp-4: 1rem;
  --sp-5: 1.25rem; --sp-6: 1.5rem; --sp-8: 2rem; --sp-10: 2.5rem;
  --sp-12: 3rem; --sp-16: 4rem;

  --max-width: 1200px;
  --content-width: 720px;
  --header-height: 48px;
  --sidebar-width: 260px;
}

html { scroll-behavior: smooth; font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.7;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--accent-hover); }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  color: var(--primary);
  line-height: 1.3;
  font-weight: 600;
}

.container { width: 100%; max-width: var(--max-width); margin: 0 auto; padding: 0 var(--sp-6); }
.container-full { width: 100%; padding: 0 var(--sp-5); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

.si {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1em; height: 1em; vertical-align: -0.125em; flex-shrink: 0;
}
.si svg {
  width: 100%; height: 100%;
  stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; fill: none;
}

.skip-link {
  position: absolute; top: -100%; left: var(--sp-4);
  background: var(--accent); color: #fff; padding: var(--sp-2) var(--sp-4);
  border-radius: var(--radius-sm); z-index: 1000; font-weight: 600; font-size: 0.875rem;
}
.skip-link:focus { top: var(--sp-4); color: #fff; }

/* ================================================================
   HEADER — compact
   ================================================================ */
.site-header {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
  height: var(--header-height);
}
.site-header .container-full {
  display: flex; align-items: center; justify-content: space-between; height: 100%;
}

.site-logo {
  display: flex; align-items: center; gap: var(--sp-2);
  color: var(--primary); font-family: var(--font-serif);
  font-size: 0.95rem; font-weight: 700; letter-spacing: -0.02em;
  white-space: nowrap;
}
.site-logo:hover { color: var(--accent); }
.site-logo-icon { display: inline-flex; color: var(--accent); }
.site-logo-icon .si { width: 22px; height: 22px; }

.header-center { flex: 1; display: flex; justify-content: center; }
.header-stats {
  display: flex; align-items: center; gap: var(--sp-3);
  font-size: 0.75rem; color: var(--text-muted);
}
.header-stats strong { color: var(--text-secondary); font-weight: 600; }
.header-stat-sep { width: 1px; height: 12px; background: var(--border); }

.site-nav { display: flex; align-items: center; gap: var(--sp-4); }
.site-nav a { color: var(--text-secondary); font-size: 0.82rem; font-weight: 500; }
.site-nav a:hover { color: var(--primary); }

.mobile-filter-btn {
  display: none; align-items: center; gap: var(--sp-1);
  padding: 4px 12px; font-size: 0.78rem; font-weight: 600;
  color: var(--text-secondary); background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--radius-md);
  cursor: pointer; font-family: var(--font-sans);
}
.mobile-filter-btn .si { width: 14px; height: 14px; }

/* ================================================================
   INDEX PAGE — sidebar + content layout
   ================================================================ */
.index-layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: calc(100vh - var(--header-height));
}

/* ---------- Filter Sidebar ---------- */
.filter-sidebar {
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  padding: var(--sp-4) var(--sp-4) var(--sp-8);
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  /* Thin scrollbar */
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.filter-sidebar::-webkit-scrollbar { width: 5px; }
.filter-sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.sidebar-search { margin-bottom: var(--sp-3); }

.search-bar {
  position: relative;
}
.search-bar input {
  width: 100%;
  padding: 8px 12px 8px 34px;
  font-size: 0.82rem;
  font-family: var(--font-sans);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--card-bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-bar input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(45,95,138,0.1);
}
.search-bar input::placeholder { color: var(--text-muted); font-size: 0.8rem; }

.search-icon {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); pointer-events: none;
}
.search-icon .si { width: 15px; height: 15px; }

.search-clear {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; padding: 3px; border-radius: var(--radius-sm);
  display: none; line-height: 1;
}
.search-clear:hover { color: var(--text); }
.search-clear .si { width: 14px; height: 14px; }
.search-clear.visible { display: flex; }

.search-kbd {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  font-family: var(--font-mono); font-size: 0.65rem; color: var(--text-muted);
  background: var(--bg); padding: 0px 5px; border-radius: 3px;
  border: 1px solid var(--border); pointer-events: none;
}

.search-bar-rq input { font-style: italic; }

.rq-hint {
  font-size: 0.72rem; color: var(--text-muted); padding: var(--sp-1) var(--sp-1) 0;
  font-style: italic; line-height: 1.4;
  display: none;
}
.rq-hint.visible { display: block; }
.rq-hint em { color: var(--accent); font-style: normal; font-weight: 500; }

/* Filter panels */
.filter-panel {
  border-bottom: 1px solid var(--border-light);
}

.filter-panel-toggle {
  display: flex; align-items: center; gap: var(--sp-2);
  width: 100%; padding: var(--sp-3) var(--sp-1);
  font-size: 0.75rem; font-weight: 600; font-family: var(--font-sans);
  color: var(--text-secondary); background: none; border: none;
  cursor: pointer; text-transform: uppercase; letter-spacing: 0.06em;
  text-align: left;
}
.filter-panel-toggle:hover { color: var(--primary); }
.filter-panel-toggle .si { width: 14px; height: 14px; color: var(--text-muted); }
.filter-panel-static { cursor: default; }

.toggle-chevron {
  margin-left: auto;
  transition: transform 0.2s;
}
.toggle-chevron .si { width: 12px; height: 12px; }
.filter-panel-toggle[aria-expanded="false"] .toggle-chevron {
  transform: rotate(180deg);
}

.filter-count {
  font-size: 0.65rem; font-weight: 700;
  background: var(--accent); color: #fff;
  padding: 0 5px; border-radius: 8px;
  min-width: 16px; text-align: center;
  line-height: 16px; display: none;
}
.filter-count.visible { display: inline-block; }

.filter-panel-body {
  padding: 0 var(--sp-1) var(--sp-3);
  display: none;
}
.filter-panel-body.open { display: block; }

.chip-group {
  display: flex; flex-wrap: wrap; gap: 4px;
}

.chip {
  display: inline-block; padding: 3px 9px;
  font-size: 0.72rem; font-family: var(--font-sans);
  color: var(--text-secondary); background: var(--card-bg);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  cursor: pointer; transition: all 0.15s; user-select: none; white-space: nowrap;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.chip.active:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

/* Chip with count */
.chip .chip-count {
  display: inline-block; margin-left: 3px;
  font-size: 0.62rem; opacity: 0.65; font-weight: 600;
}
.chip.active .chip-count { opacity: 0.85; }

.sort-select {
  width: 100%; padding: 6px 8px; font-size: 0.78rem;
  font-family: var(--font-sans); color: var(--text);
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); outline: none; cursor: pointer;
}
.sort-select:focus { border-color: var(--accent); }

/* Active filters strip */
.active-filters {
  display: flex; flex-wrap: wrap; gap: 4px;
  padding: 0 var(--sp-1) var(--sp-2);
}
.active-filters:empty { display: none; }

.active-filter-tag {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 8px; font-size: 0.68rem;
  color: var(--accent); background: var(--accent-light);
  border: 1px solid rgba(45,95,138,0.15);
  border-radius: var(--radius-sm); cursor: pointer;
}
.active-filter-tag:hover { background: rgba(45,95,138,0.12); }
.active-filter-tag .remove { font-size: 0.85rem; line-height: 1; font-weight: 600; }

.clear-all-btn {
  display: inline-flex; padding: 2px 8px; font-size: 0.68rem;
  color: var(--text-muted); background: transparent;
  border: 1px dashed var(--border); border-radius: var(--radius-sm);
  cursor: pointer; font-family: var(--font-sans);
}
.clear-all-btn:hover { color: var(--text-secondary); border-color: var(--text-muted); }

.sidebar-footer {
  margin-top: auto; padding-top: var(--sp-4);
  border-top: 1px solid var(--border-light);
  font-size: 0.72rem; color: var(--text-muted); line-height: 1.5;
}

/* ---------- Main Content Area ---------- */
.index-main {
  padding: var(--sp-4) var(--sp-5) var(--sp-16);
  min-width: 0;
}

/* ---------- Welcome Banner ---------- */
.welcome-banner {
  position: relative;
  background: linear-gradient(135deg, var(--accent-light) 0%, var(--bg-paper) 100%);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-md);
  padding: var(--sp-5) var(--sp-6);
  margin-bottom: var(--sp-4);
}
.welcome-banner.hidden { display: none; }
.welcome-close {
  position: absolute; top: var(--sp-2); right: var(--sp-3);
  background: none; border: none; font-size: 1.3rem;
  color: var(--text-muted); cursor: pointer; line-height: 1;
  padding: 2px 6px; border-radius: var(--radius-sm);
}
.welcome-close:hover { color: var(--text); background: rgba(0,0,0,0.05); }
.welcome-title {
  font-family: var(--font-serif);
  font-size: 1.25rem; font-weight: 700;
  color: var(--accent); margin-bottom: var(--sp-2);
}
.welcome-desc {
  font-size: 0.88rem; color: var(--text-secondary);
  line-height: 1.6; margin-bottom: var(--sp-4);
  max-width: 680px;
}
.welcome-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--sp-3);
}
.welcome-feature {
  font-size: 0.8rem; line-height: 1.5;
}
.welcome-feature strong {
  display: block; color: var(--text);
  font-size: 0.82rem; margin-bottom: 2px;
}
.welcome-feature span { color: var(--text-muted); }

.results-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: var(--sp-3); margin-bottom: var(--sp-3);
  border-bottom: 1px solid var(--border-light);
}
.results-count { font-size: 0.82rem; color: var(--text-muted); }
.results-count strong { color: var(--text-secondary); font-weight: 600; }

.view-controls { display: flex; gap: 2px; }
.view-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; background: none;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  cursor: pointer; color: var(--text-muted); transition: all 0.15s;
}
.view-btn:hover { color: var(--text-secondary); }
.view-btn.active { color: var(--accent); border-color: var(--accent-light); background: var(--accent-light); }
.view-btn .si { width: 16px; height: 16px; }

/* ---------- Card Grid ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--sp-3);
}

.card-grid.list-view {
  grid-template-columns: 1fr;
  gap: var(--sp-2);
}

.case-card {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  overflow: hidden;
  transition: box-shadow 0.2s, border-color 0.2s;
  display: flex; flex-direction: column;
  animation: fadeUp 0.3s ease both;
}
.case-card:hover { box-shadow: var(--shadow-md); border-color: var(--border); }

.card-body {
  padding: var(--sp-4);
  display: flex; flex-direction: column; flex: 1;
}

/* List-view card layout */
.list-view .case-card { flex-direction: row; }
.list-view .card-body { flex-direction: row; align-items: center; gap: var(--sp-4); flex-wrap: wrap; }
.list-view .card-topic { margin-bottom: 0; }
.list-view .card-title { flex: 1; min-width: 200px; margin-bottom: 0; font-size: 0.95rem; }
.list-view .card-meta { margin-bottom: 0; }
.list-view .card-summary { display: none; }
.list-view .card-footer { margin-top: 0; }

.card-topic {
  display: inline-block; font-size: 0.62rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  padding: 2px 7px; border-radius: var(--radius-sm);
  margin-bottom: var(--sp-2); align-self: flex-start;
}

.topic-financial-inclusion         { background: var(--topic-financial-bg); color: var(--topic-financial); }
.topic-health                      { background: var(--topic-health-bg); color: var(--topic-health); }
.topic-education                   { background: var(--topic-education-bg); color: var(--topic-education); }
.topic-social-protection           { background: var(--topic-social-bg); color: var(--topic-social); }
.topic-agriculture-food-security   { background: var(--topic-agriculture-bg); color: var(--topic-agriculture); }
.topic-economic-growth-industrial-policy { background: var(--topic-economic-bg); color: var(--topic-economic); }
.topic-environment-climate         { background: var(--topic-environment-bg); color: var(--topic-environment); }
.topic-governance-decentralization { background: var(--topic-governance-bg); color: var(--topic-governance); }
.topic-infrastructure-urbanization { background: var(--topic-infrastructure-bg); color: var(--topic-infrastructure); }
.topic-gender-inclusion            { background: var(--topic-gender-bg); color: var(--topic-gender); }

.card-title {
  font-family: var(--font-serif); font-size: 1rem; font-weight: 600;
  color: var(--primary); margin-bottom: var(--sp-2); line-height: 1.35;
}

.card-meta {
  display: flex; align-items: center; gap: var(--sp-3);
  font-size: 0.76rem; color: var(--text-muted); margin-bottom: var(--sp-2);
}
.card-country { display: inline-flex; align-items: center; gap: 3px; color: var(--text-secondary); }
.card-country .si { width: 12px; height: 12px; }
.card-year { font-size: 0.74rem; }

.card-tags {
  display: flex; flex-wrap: wrap; gap: 3px;
  margin-bottom: var(--sp-2);
}
.card-tag {
  font-size: 0.6rem; font-weight: 500; padding: 1px 5px;
  background: var(--bg-warm); color: var(--text-muted);
  border-radius: 2px; letter-spacing: 0.02em;
}

.card-summary {
  font-size: 0.82rem; color: var(--text-secondary); line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; margin-bottom: var(--sp-3); flex: 1;
}

.card-footer {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: auto;
}
.card-link {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 0.78rem; font-weight: 600; color: var(--accent);
  transition: gap 0.15s;
}
.card-link:hover { gap: 8px; }
.card-link .si { width: 13px; height: 13px; }

.card-evidence {
  font-size: 0.65rem; font-weight: 600; padding: 2px 6px;
  border-radius: var(--radius-sm); white-space: nowrap;
}
.card-evidence.strong { background: #e8f5ee; color: var(--evidence-strong); }
.card-evidence.moderate { background: #fef3e4; color: var(--evidence-moderate); }
.card-evidence.emerging { background: #f0f0f0; color: var(--evidence-emerging); }

/* No results */
.no-results { text-align: center; padding: var(--sp-16) var(--sp-6); grid-column: 1 / -1; }
.no-results-icon { margin-bottom: var(--sp-4); color: var(--text-muted); }
.no-results-icon .si { width: 40px; height: 40px; }
.no-results h3 { font-size: 1.1rem; margin-bottom: var(--sp-2); }
.no-results p { color: var(--text-muted); max-width: 360px; margin: 0 auto; font-size: 0.88rem; }

/* ================================================================
   STUDY PAGE
   ================================================================ */

/* Use container for study pages */
.study-page-body { display: flex; flex-direction: column; }

/* Breadcrumb */
.breadcrumb {
  padding: var(--sp-4) 0; font-size: 0.78rem; color: var(--text-muted);
}
.breadcrumb a { color: var(--text-secondary); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .sep { margin: 0 var(--sp-2); color: var(--border); }

/* Study header */
.study-header {
  padding: var(--sp-6) 0 var(--sp-5);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--sp-6);
}

.study-topic-tag {
  display: inline-block; font-size: 0.68rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  padding: 3px 10px; border-radius: var(--radius-sm); margin-bottom: var(--sp-3);
}

.study-title {
  font-size: clamp(1.5rem, 3.5vw, 2rem);
  margin-bottom: var(--sp-4); letter-spacing: -0.025em;
  max-width: 680px; font-weight: 700; line-height: 1.2;
}

.study-meta {
  display: flex; flex-wrap: wrap; gap: var(--sp-3) var(--sp-6);
  font-size: 0.85rem; color: var(--text-secondary);
}
.study-meta-item { display: flex; align-items: center; gap: var(--sp-2); }
.study-meta-item .si { width: 15px; height: 15px; color: var(--text-muted); }
.study-meta-label {
  font-weight: 600; color: var(--text-muted);
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em;
}

/* Study layout — two column */
.study-layout {
  display: grid; grid-template-columns: 1fr; gap: var(--sp-8);
}
@media (min-width: 960px) {
  .study-layout { grid-template-columns: 1fr 260px; }
}

/* Sidebar */
.study-sidebar {
  display: flex; flex-direction: column; gap: var(--sp-5);
}
@media (min-width: 960px) {
  .study-sidebar {
    position: sticky; top: calc(var(--header-height) + var(--sp-5));
    align-self: start; max-height: calc(100vh - var(--header-height) - var(--sp-10));
    overflow-y: auto;
  }
}

.sidebar-panel {
  background: var(--bg-sidebar); border-radius: var(--radius-md);
  padding: var(--sp-4); border: 1px solid var(--border-light);
}
.sidebar-panel-title {
  font-size: 0.7rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--text-muted);
  margin-bottom: var(--sp-3); padding-bottom: var(--sp-2);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: var(--sp-2);
}
.sidebar-panel-title .si { width: 13px; height: 13px; }

.key-data-grid { display: grid; gap: var(--sp-3); }
.key-data-item { padding-bottom: var(--sp-3); border-bottom: 1px solid var(--border-light); }
.key-data-item:last-child { border-bottom: none; padding-bottom: 0; }
.key-data-label {
  font-size: 0.68rem; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 1px;
}
.key-data-value {
  font-size: 0.92rem; font-weight: 700; color: var(--primary); font-family: var(--font-serif);
}

.toc-list { list-style: none; }
.toc-list li { margin-bottom: var(--sp-1); }
.toc-list a {
  display: block; font-size: 0.78rem; color: var(--text-secondary);
  padding: 2px 0 2px var(--sp-3); border-left: 2px solid transparent;
  transition: all 0.15s; line-height: 1.4;
}
.toc-list a:hover { color: var(--accent); border-left-color: var(--accent); }
.toc-list a.active { color: var(--accent); border-left-color: var(--accent); font-weight: 500; }

/* ── Evidence Summary Card ── */
.evidence-card {
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: var(--sp-5); margin-bottom: var(--sp-6);
}
.evidence-card-header {
  display: flex; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-4);
}
.evidence-card-header .si { width: 18px; height: 18px; color: var(--accent); }
.evidence-card-title {
  font-family: var(--font-serif); font-size: 1.05rem; font-weight: 600;
}

.evidence-meter {
  display: flex; align-items: center; gap: var(--sp-3);
  margin-bottom: var(--sp-4); padding: var(--sp-3); background: var(--bg); border-radius: var(--radius-md);
}
.evidence-meter-bar { flex: 1; height: 5px; background: var(--border); border-radius: 3px; overflow: hidden; }
.evidence-meter-fill { height: 100%; border-radius: 3px; transition: width 0.6s ease; }
.evidence-meter-fill.strong { background: var(--evidence-strong); }
.evidence-meter-fill.moderate { background: var(--evidence-moderate); }
.evidence-meter-fill.emerging { background: var(--evidence-emerging); }
.evidence-meter-label { font-size: 0.75rem; font-weight: 600; white-space: nowrap; }
.evidence-meter-label.strong { color: var(--evidence-strong); }
.evidence-meter-label.moderate { color: var(--evidence-moderate); }
.evidence-meter-label.emerging { color: var(--evidence-emerging); }

.evidence-findings { list-style: none; }
.evidence-findings li {
  display: flex; gap: var(--sp-3); padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.85rem; line-height: 1.55;
}
.evidence-findings li:last-child { border-bottom: none; }
.finding-icon { flex-shrink: 0; width: 16px; height: 16px; margin-top: 2px; color: var(--evidence-strong); }

/* ── Conceptual Framework ── */
.framework-card {
  background: var(--accent-warm-bg); border: 1px solid #e8dcc8;
  border-radius: var(--radius-lg); padding: var(--sp-5); margin-bottom: var(--sp-6);
}
.framework-card-header {
  display: flex; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-4);
}
.framework-card-header .si { width: 18px; height: 18px; color: var(--accent-warm); }
.framework-card-title {
  font-family: var(--font-serif); font-size: 1.05rem; font-weight: 600; color: var(--accent-warm);
}
.framework-questions { list-style: none; }
.framework-questions li {
  padding: var(--sp-3) 0; border-bottom: 1px solid rgba(122,92,62,0.12);
  font-size: 0.85rem; line-height: 1.6; display: flex; gap: var(--sp-3);
}
.framework-questions li:last-child { border-bottom: none; }
.q-marker {
  flex-shrink: 0; font-family: var(--font-serif);
  font-weight: 700; color: var(--accent-warm); font-size: 0.88rem;
}

/* ── Cornell Notes ── */
.cornell-notes {
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  margin-top: var(--sp-8); overflow: hidden; background: var(--card-bg);
}
.cornell-notes-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg-sidebar); border-bottom: 1px solid var(--border);
}
.cornell-notes-title {
  font-family: var(--font-serif); font-size: 0.95rem; font-weight: 600;
  display: flex; align-items: center; gap: var(--sp-2);
}
.cornell-notes-title .si { width: 16px; height: 16px; color: var(--accent-warm); }
.cornell-notes-toolbar {
  display: flex; gap: var(--sp-2);
}

.cornell-grid {
  display: grid; grid-template-columns: 170px 1fr;
  min-height: 220px;
}
.cornell-cues {
  border-right: 2px solid var(--accent-warm);
  padding: var(--sp-3);
  background: rgba(250,243,235,0.4);
}
.cornell-cues-label {
  font-size: 0.62rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--accent-warm); margin-bottom: var(--sp-2);
}
.cornell-cues textarea {
  width: 100%; height: calc(100% - 20px); resize: none;
  background: transparent; border: none; outline: none;
  font-family: var(--font-hand); font-size: 1rem; line-height: 1.7;
  color: var(--text); padding: 0;
}
.cornell-notes-area {
  padding: var(--sp-3);
}
.cornell-notes-label {
  font-size: 0.62rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--text-muted); margin-bottom: var(--sp-2);
}
.cornell-notes-area textarea {
  width: 100%; height: calc(100% - 20px); resize: none;
  background: transparent; border: none; outline: none;
  font-family: var(--font-sans); font-size: 0.88rem; line-height: 1.7;
  color: var(--text); padding: 0;
  background: repeating-linear-gradient(
    transparent, transparent 28px, var(--border-light) 28px, var(--border-light) 29px
  );
}
.cornell-notes-area textarea.handwritten {
  font-family: var(--font-hand); font-size: 1.1rem;
}
.cornell-summary {
  border-top: 2px solid var(--accent-warm);
  padding: var(--sp-3) var(--sp-4);
  background: rgba(250,243,235,0.4);
}
.cornell-summary-label {
  font-size: 0.62rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--accent-warm); margin-bottom: var(--sp-2);
}
.cornell-summary textarea {
  width: 100%; height: 50px; resize: vertical;
  background: transparent; border: none; outline: none;
  font-family: var(--font-sans); font-size: 0.85rem; line-height: 1.6;
  color: var(--text); padding: 0;
}
.cornell-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-2) var(--sp-4);
  background: var(--bg-sidebar); border-top: 1px solid var(--border-light);
  font-size: 0.7rem; color: var(--text-muted);
}

/* Notes toolbar buttons */
.notes-toolbar-btn {
  display: inline-flex; align-items: center; gap: var(--sp-1);
  padding: 3px 8px; font-size: 0.7rem; font-weight: 500;
  color: var(--text-muted); background: transparent;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  cursor: pointer; font-family: var(--font-sans);
}
.notes-toolbar-btn:hover { color: var(--text-secondary); border-color: var(--text-muted); }
.notes-toolbar-btn.active { background: var(--accent-warm-bg); border-color: var(--accent-warm); color: var(--accent-warm); }
.notes-toolbar-btn .si { width: 11px; height: 11px; }

.notes-export-btn {
  display: inline-flex; align-items: center; gap: var(--sp-1);
  padding: 3px 10px; font-size: 0.7rem; font-weight: 600;
  color: var(--accent); background: var(--accent-light);
  border: 1px solid rgba(45,95,138,0.15); border-radius: var(--radius-sm);
  cursor: pointer; font-family: var(--font-sans);
}
.notes-export-btn:hover { background: rgba(45,95,138,0.12); }
.notes-export-btn .si { width: 11px; height: 11px; }

/* ── Study Content Typography ── */
.study-content { min-width: 0; }
.study-content h2 {
  font-size: 1.3rem; margin-top: var(--sp-10); margin-bottom: var(--sp-4);
  padding-bottom: var(--sp-2); border-bottom: 1px solid var(--border-light);
  scroll-margin-top: calc(var(--header-height) + var(--sp-4));
}
.study-content h2:first-child { margin-top: 0; }
.study-content h3 {
  font-size: 1.05rem; margin-top: var(--sp-8); margin-bottom: var(--sp-3);
  color: var(--primary-soft);
  scroll-margin-top: calc(var(--header-height) + var(--sp-4));
}
.study-content p { margin-bottom: var(--sp-4); line-height: 1.8; font-size: 0.93rem; }
.study-content strong { color: var(--primary); font-weight: 600; }
.study-content ul, .study-content ol { margin-bottom: var(--sp-4); padding-left: var(--sp-6); }
.study-content li { margin-bottom: var(--sp-2); line-height: 1.7; font-size: 0.93rem; }

.study-content blockquote {
  border-left: 3px solid var(--accent); background: var(--accent-light);
  padding: var(--sp-4) var(--sp-5); margin: var(--sp-6) 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-style: italic; color: var(--text-secondary); font-size: 0.93rem;
}
.study-content hr { border: none; height: 1px; background: var(--border); margin: var(--sp-8) 0; }

.study-content table { width: 100%; border-collapse: collapse; margin: var(--sp-6) 0; font-size: 0.82rem; }
.study-content th, .study-content td {
  padding: var(--sp-2) var(--sp-3); text-align: left; border-bottom: 1px solid var(--border-light);
}
.study-content th {
  background: var(--bg-sidebar); font-weight: 600; font-size: 0.72rem;
  text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted);
}
.study-content tbody tr:hover { background: var(--bg); }
.study-content a {
  color: var(--accent); text-decoration: underline;
  text-decoration-color: rgba(45,95,138,0.25); text-underline-offset: 2px;
}
.study-content a:hover { text-decoration-color: var(--accent); }

/* ── Citations ── */
.citations-section {
  margin-top: var(--sp-10); padding-top: var(--sp-8); border-top: 1px solid var(--border);
}
.citations-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--sp-4);
}
.citations-title {
  font-family: var(--font-serif); font-size: 1.15rem; font-weight: 600;
  display: flex; align-items: center; gap: var(--sp-2);
}
.citations-title .si { width: 18px; height: 18px; color: var(--accent); }

.citation-item {
  display: flex; gap: var(--sp-3); padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--border-light); font-size: 0.85rem; line-height: 1.6;
}
.citation-item:last-child { border-bottom: none; }
.citation-number {
  flex-shrink: 0; width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.68rem; font-weight: 700; color: var(--accent);
  background: var(--accent-light); border-radius: 50%; margin-top: 2px;
}
.citation-text { flex: 1; }
.citation-actions { display: flex; gap: var(--sp-2); flex-shrink: 0; align-items: flex-start; margin-top: 2px; }
.cite-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; background: transparent;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  cursor: pointer; color: var(--text-muted); padding: 0;
}
.cite-btn:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-light); }
.cite-btn .si { width: 13px; height: 13px; }

/* Further reading */
.further-reading-section {
  margin-top: var(--sp-6); padding-top: var(--sp-5); border-top: 1px solid var(--border-light);
}
.reading-item { display: flex; gap: var(--sp-3); padding: var(--sp-3) 0; border-bottom: 1px solid var(--border-light); }
.reading-item:last-child { border-bottom: none; }
.reading-number { flex-shrink: 0; font-family: var(--font-serif); font-weight: 700; color: var(--text-muted); font-size: 0.82rem; min-width: 18px; }
.reading-text { font-size: 0.82rem; line-height: 1.6; color: var(--text-secondary); }

/* ── Literature Map ── */
.litmap-section { margin-top: var(--sp-8); padding-top: var(--sp-6); border-top: 1px solid var(--border); }
.litmap-header { display: flex; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-3); }
.litmap-header .si { width: 18px; height: 18px; color: var(--accent); }
.litmap-title { font-family: var(--font-serif); font-size: 1.15rem; font-weight: 600; }
.litmap-subtitle { font-size: 0.8rem; color: var(--text-muted); margin-bottom: var(--sp-4); }
.litmap-canvas {
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius-md); overflow: hidden; position: relative;
}
.litmap-canvas svg { width: 100%; display: block; }
.litmap-node { cursor: pointer; }
.litmap-node:hover { opacity: 0.8; }
.litmap-node text { font-family: var(--font-sans); font-size: 9px; fill: var(--text-secondary); pointer-events: none; }
.litmap-node.current text { font-weight: 600; fill: var(--primary); }
.litmap-edge { stroke: var(--border); stroke-width: 1; fill: none; opacity: 0.5; }
.litmap-edge.same-topic { stroke: var(--accent); opacity: 0.3; }
.litmap-legend {
  display: flex; gap: var(--sp-4); padding: var(--sp-2) var(--sp-3);
  border-top: 1px solid var(--border-light); font-size: 0.7rem; color: var(--text-muted);
}
.litmap-legend-item { display: flex; align-items: center; gap: var(--sp-1); }
.litmap-legend-dot { width: 7px; height: 7px; border-radius: 50%; border: 1.5px solid; }

/* ── Study Navigation ── */
.study-nav {
  display: flex; justify-content: space-between; gap: var(--sp-4);
  margin-top: var(--sp-10); padding-top: var(--sp-6); border-top: 1px solid var(--border);
}
.study-nav-link {
  display: flex; flex-direction: column; gap: 3px;
  padding: var(--sp-3) var(--sp-4); background: var(--bg);
  border: 1px solid var(--border-light); border-radius: var(--radius-md);
  color: var(--text); max-width: 45%; min-width: 0;
}
.study-nav-link:hover { border-color: var(--accent); color: var(--text); }
.study-nav-link.next { text-align: right; margin-left: auto; }
.study-nav-label {
  font-size: 0.68rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--accent);
  display: flex; align-items: center; gap: var(--sp-1);
}
.study-nav-label .si { width: 11px; height: 11px; }
.study-nav-link.next .study-nav-label { justify-content: flex-end; }
.study-nav-title {
  font-family: var(--font-serif); font-size: 0.88rem; font-weight: 600;
  color: var(--primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.back-to-library {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  margin-top: var(--sp-6); margin-bottom: var(--sp-6);
  padding: var(--sp-2) var(--sp-4); font-size: 0.82rem; font-weight: 600;
  color: var(--accent); border: 1px solid var(--accent);
  border-radius: var(--radius-md); text-decoration: none;
}
.back-to-library .si { width: 13px; height: 13px; }
.back-to-library:hover { background: var(--accent); color: #fff; }

/* ── Error & Loading ── */
.error-state { text-align: center; padding: var(--sp-16); }
.error-state-icon { margin-bottom: var(--sp-5); color: var(--text-muted); }
.error-state-icon .si { width: 40px; height: 40px; }
.error-state h2 { margin-bottom: var(--sp-3); }
.error-state p { color: var(--text-muted); margin-bottom: var(--sp-6); }

.loading-spinner {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: var(--sp-16); gap: var(--sp-4);
}
.spinner {
  width: 28px; height: 28px; border: 2px solid var(--border);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { font-size: 0.82rem; color: var(--text-muted); }

/* Toast */
.toast {
  position: fixed; bottom: 20px; left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--primary); color: #fff;
  padding: var(--sp-3) var(--sp-5); border-radius: var(--radius-md);
  font-size: 0.82rem; font-weight: 500; box-shadow: var(--shadow-lg);
  z-index: 1000; opacity: 0;
  transition: transform 0.3s, opacity 0.3s; pointer-events: none;
}
.toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--primary); color: rgba(255,255,255,0.6);
  padding: var(--sp-6) 0; text-align: center; font-size: 0.8rem;
}
.site-footer p { max-width: 500px; margin: 0 auto; line-height: 1.6; }
.site-footer strong { color: rgba(255,255,255,0.85); }

/* Scroll to top */
.scroll-top {
  position: fixed; bottom: 16px; right: 16px;
  width: 32px; height: 32px; background: var(--card-bg);
  color: var(--text-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-md); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-sm); opacity: 0; visibility: hidden;
  transform: translateY(8px); transition: all 0.2s; z-index: 80;
}
.scroll-top .si { width: 14px; height: 14px; }
.scroll-top.visible { opacity: 1; visibility: visible; transform: translateY(0); }
.scroll-top:hover { color: var(--accent); border-color: var(--accent); }

/* Skeleton */
.skeleton-card {
  background: var(--card-bg); border-radius: var(--radius-md);
  border: 1px solid var(--border-light); padding: var(--sp-4);
}
.skeleton-line {
  background: linear-gradient(90deg, var(--bg) 25%, var(--border-light) 50%, var(--bg) 75%);
  background-size: 200% 100%; animation: shimmer 1.5s ease-in-out infinite;
  border-radius: 3px; margin-bottom: var(--sp-2);
}
.skeleton-line.short { width: 35%; height: 10px; }
.skeleton-line.medium { width: 65%; height: 14px; }
.skeleton-line.long { width: 100%; height: 10px; }
.skeleton-line.title { width: 80%; height: 18px; margin-bottom: var(--sp-3); }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Animation */
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- Sidebar Overlay ---------- */
.sidebar-overlay {
  position: fixed; inset: 0; top: var(--header-height);
  background: rgba(0,0,0,0.3); z-index: 98;
  opacity: 0; pointer-events: none; transition: opacity 0.25s;
}
.sidebar-overlay.visible { opacity: 1; pointer-events: auto; }

/* ================================================================
   Responsive
   ================================================================ */
@media (max-width: 840px) {
  .index-layout { grid-template-columns: 1fr; }

  .filter-sidebar {
    position: fixed; top: var(--header-height); left: 0; bottom: 0;
    width: 280px; z-index: 99;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: none;
  }
  .filter-sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
  .mobile-filter-btn { display: flex; }

  .header-stats { display: none; }

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

  .study-nav { flex-direction: column; }
  .study-nav-link { max-width: 100%; }
  .study-layout { grid-template-columns: 1fr; }
  .study-sidebar { position: static !important; }

  .cornell-grid { grid-template-columns: 120px 1fr; }
}

@media (max-width: 480px) {
  .container, .container-full { padding: 0 var(--sp-3); }
  .index-main { padding: var(--sp-3); }
  .card-body { padding: var(--sp-3); }
  .site-logo span:last-child { display: none; }
  .cornell-grid { grid-template-columns: 1fr; }
  .cornell-cues { border-right: none; border-bottom: 2px solid var(--accent-warm); }
}

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

/* Print */
@media print {
  .site-header, .filter-sidebar, .scroll-top, .study-nav,
  .back-to-library, .site-footer, .cornell-notes,
  .litmap-section, .cite-btn, .view-controls,
  .mobile-filter-btn { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .index-layout { grid-template-columns: 1fr; }
  .case-card { break-inside: avoid; box-shadow: none; border: 1px solid #ccc; }
}
