@import url('https://fonts.googleapis.com/css2?family=Libre+Baskerville:ital,wght@0,400;0,700;1,400&family=IBM+Plex+Sans:wght@300;400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  /* Colors - Indian Earth (Light Mode) */
  --color-bg: #faf6f0;
  --color-bg-alt: #f5efe5;
  --color-surface: #ffffff;
  --color-border: #ede4d5;
  --color-border-strong: #d4c5a9;
  --color-text: #3d2b1f;
  --color-text-secondary: #6b5443;
  --color-text-muted: #8b7560;
  --color-text-faint: #b5a48e;
  --color-accent: #c2452d; /* Terracotta */
  --color-accent-hover: #a83a26;
  --color-secondary: #1a5c4c; /* Forest Green */
  --color-secondary-hover: #134538;
  --color-tertiary: #c4a67d; /* Warm Sand */

  /* Typography */
  --font-headings: 'Libre Baskerville', Georgia, serif;
  --font-body: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  --font-code: 'IBM Plex Mono', monospace;

  /* Shadows - Warm Earth Toned */
  --shadow-sm: 0 1px 2px rgba(61, 43, 31, 0.04);
  --shadow-md: 0 2px 8px rgba(61, 43, 31, 0.06);
  --shadow-lg: 0 4px 16px rgba(61, 43, 31, 0.08);

  /* Border Radii */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-full: 9999px;

  /* Transition */
  --transition-default: all 0.2s ease-in-out;
}

/* Dark Mode Override */
body.dark {
  --color-bg: #1a120c;
  --color-bg-alt: #231911;
  --color-surface: #2a1f17;
  --color-border: #3d2b1f;
  --color-border-strong: #543b2a;
  --color-text: #ede4d5;
  --color-text-secondary: #bbaea1;
  --color-text-muted: #8c7e73;
  --color-text-faint: #5a4b3d;
  --color-accent: #e06b55;
  --color-accent-hover: #f08b77;
  --color-secondary: #3d9e82;
  --color-secondary-hover: #4fbfa0;
  --color-tertiary: #a18359;
  
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.4);
}

/* Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s ease, color 0.3s ease;
}

h1, h2, h3, h4 {
  font-family: var(--font-headings);
  font-weight: 400;
  color: var(--color-text);
  line-height: 1.25;
}

h1 { font-size: 2.25rem; margin-bottom: 1.5rem; }
h2 { font-size: 1.75rem; margin-bottom: 1.25rem; }
h3 { font-size: 1.35rem; margin-bottom: 1rem; }
h4 { font-size: 1.15rem; margin-bottom: 0.75rem; }

p {
  margin-bottom: 1.25rem;
  color: var(--color-text-secondary);
}

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: var(--transition-default);
}

a:hover {
  color: var(--color-accent-hover);
  text-decoration: underline;
}

/* Layout Containers */
.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

.reader-container {
  max-width: 680px;
  margin: 0 auto;
}

/* Header & Navigation */
.navbar {
  height: 64px;
  border-bottom: 1px solid var(--color-border);
  background-color: rgba(250, 246, 240, 0.85);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 100;
  transition: var(--transition-default);
}

body.dark .navbar {
  background-color: rgba(26, 18, 12, 0.85);
}

.navbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.brand {
  font-family: var(--font-headings);
  font-size: 1.25rem;
  color: var(--color-text);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.nav-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition-default);
  font-family: var(--font-body);
}

.btn-primary {
  background-color: var(--color-secondary);
  color: #ffffff;
}

.btn-primary:hover {
  background-color: var(--color-secondary-hover);
}

.btn-secondary {
  background-color: transparent;
  border-color: var(--color-border-strong);
  color: var(--color-text);
}

.btn-secondary:hover {
  background-color: var(--color-bg-alt);
  border-color: var(--color-text-secondary);
}

.btn-icon {
  background: transparent;
  border: none;
  color: var(--color-text-secondary);
  font-size: 1.15rem;
  padding: 6px;
  border-radius: var(--radius-xs);
}

.btn-icon:hover {
  background-color: var(--color-bg-alt);
  color: var(--color-text);
}

/* Socratic Lesson Widgets */
.role-bar {
  display: flex;
  background-color: var(--color-bg-alt);
  border-radius: var(--radius-md);
  padding: 4px;
  gap: 4px;
  margin-bottom: 24px;
  border: 1px solid var(--color-border);
}

.role-btn {
  flex: 1;
  border: none;
  background: transparent;
  padding: 8px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-default);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: center;
}

.role-btn.active {
  background-color: var(--color-surface);
  color: var(--color-text);
  box-shadow: var(--shadow-sm);
}

/* Role Visibility Filtering */
[data-role-content] {
  display: none;
}

body[data-active-role="investigator"] [data-role-content="investigator"],
body[data-active-role="recorder"] [data-role-content="recorder"],
body[data-active-role="skeptic"] [data-role-content="skeptic"] {
  display: block;
}

/* Socratic Collapsible Card */
.socratic-card {
  border-left: 3px solid var(--color-accent);
  background-color: var(--color-surface);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 20px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
  border-top: 1px solid var(--color-border);
  border-right: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}

.socratic-question {
  font-family: var(--font-headings);
  font-size: 1.15rem;
  color: var(--color-text);
  margin-bottom: 12px;
}

.socratic-reveal-btn {
  background: none;
  border: none;
  color: var(--color-accent);
  font-weight: 600;
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}

.socratic-reveal-btn:hover {
  text-decoration: underline;
}

.socratic-answer {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.3s ease, opacity 0.3s ease, margin-top 0.2s ease;
}

.socratic-card.expanded .socratic-answer {
  max-height: 1000px;
  opacity: 1;
  margin-top: 16px;
  border-top: 1px solid var(--color-border);
  padding-top: 16px;
}

/* Think Time Countdown Bar */
.think-time-container {
  margin-top: 12px;
  background-color: var(--color-bg-alt);
  border-radius: var(--radius-xs);
  height: 6px;
  overflow: hidden;
  display: none;
}

.think-time-bar {
  background-color: var(--color-accent);
  height: 100%;
  width: 100%;
  transform-origin: left;
}

@keyframes countdown {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

.think-time-active .think-time-container {
  display: block;
}

.think-time-active .think-time-bar {
  animation: countdown 10s linear forwards;
}

/* Flowchart Dashboard Styles */
.dashboard-grid {
  display: grid;
  grid-template-columns: 3fr 1fr;
  gap: 32px;
  margin-top: 40px;
}

@media (max-width: 900px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

.flowchart-wrapper {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
}

.flowchart-svg {
  width: 100%;
  min-width: 600px;
  height: auto;
}

.flowchart-node {
  cursor: pointer;
}

.flowchart-node rect {
  fill: var(--color-bg-alt);
  stroke: var(--color-border-strong);
  stroke-width: 1.5;
  rx: 6;
  transition: var(--transition-default);
}

.flowchart-node:hover rect {
  stroke: var(--color-accent);
  fill: var(--color-surface);
}

.flowchart-node.complete rect {
  fill: rgba(26, 92, 76, 0.1);
  stroke: var(--color-secondary);
}

body.dark .flowchart-node.complete rect {
  fill: rgba(61, 158, 130, 0.15);
  stroke: var(--color-secondary);
}

.flowchart-node.active rect {
  stroke: var(--color-accent);
  stroke-width: 2.5;
}

.flowchart-node text {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
  fill: var(--color-text);
  pointer-events: none;
}

.flowchart-path {
  fill: none;
  stroke: var(--color-border);
  stroke-width: 2;
  transition: var(--transition-default);
}

.flowchart-path.active {
  stroke: var(--color-accent);
  stroke-width: 2.5;
}

/* Sidebar Info Card */
.sidebar-panel {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.info-card {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.info-card h3 {
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 10px;
  margin-bottom: 16px;
}

/* Custom Markdown Content Formatting */
.lesson-meta {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text-muted);
  margin-bottom: 16px;
  display: block;
}

blockquote {
  border-left: 3px solid var(--color-accent);
  padding-left: 16px;
  margin: 24px 0;
  font-style: italic;
  font-family: var(--font-headings);
  color: var(--color-text-secondary);
}

blockquote cite {
  display: block;
  font-style: normal;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-top: 8px;
  font-family: var(--font-body);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.materials-list {
  background-color: var(--color-bg-alt);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 24px;
  border: 1px solid var(--color-border);
}

.materials-list ul {
  list-style-type: none;
  padding-left: 0;
}

.materials-list li {
  position: relative;
  padding-left: 20px;
  margin-bottom: 8px;
  color: var(--color-text-secondary);
  font-size: 0.9rem;
}

.materials-list li::before {
  content: "•";
  color: var(--color-accent);
  position: absolute;
  left: 0;
  font-weight: bold;
}

/* Image styling */
.lesson-image-wrapper {
  margin: 32px 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background-color: var(--color-surface);
  box-shadow: var(--shadow-sm);
}

.lesson-image {
  width: 100%;
  height: auto;
  display: block;
}

.lesson-image-caption {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  padding: 12px;
  border-top: 1px solid var(--color-border);
  text-align: center;
  background-color: var(--color-bg-alt);
}

/* Jugaad Materials Guide Table */
.jugaad-table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 0.9rem;
}

.jugaad-table th, .jugaad-table td {
  padding: 12px;
  border-bottom: 1px solid var(--color-border);
  text-align: left;
}

.jugaad-table th {
  background-color: var(--color-bg-alt);
  font-family: var(--font-body);
  font-weight: 600;
  color: var(--color-text);
  border-bottom: 2px solid var(--color-border-strong);
}

.jugaad-table td strong {
  color: var(--color-accent);
}

/* Cohort Battleground Voting Card */
.battleground-card {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin: 32px 0;
  box-shadow: var(--shadow-sm);
}

.rubrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 20px;
}

@media (max-width: 600px) {
  .rubrics-grid {
    grid-template-columns: 1fr;
  }
}

.rubric-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background-color: var(--color-bg-alt);
  transition: var(--transition-default);
}

.rubric-card:hover {
  border-color: var(--color-border-strong);
  box-shadow: var(--shadow-sm);
}

.rubric-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.rubric-title {
  font-family: var(--font-headings);
  font-size: 1.05rem;
  color: var(--color-text);
}

.rubric-emoji {
  font-size: 1.5rem;
}

.rubric-desc {
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  margin-bottom: 12px;
}

.vote-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.vote-count {
  font-family: var(--font-code);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-secondary);
}

/* Expedition Tab Buttons */
.expedition-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}

.expedition-tabs .tab-btn {
  background-color: var(--color-bg-alt);
  border: 1px solid var(--color-border-strong);
  color: var(--color-text-secondary);
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-default);
  font-family: var(--font-body);
}

.expedition-tabs .tab-btn:hover {
  background-color: var(--color-surface);
  color: var(--color-text);
  border-color: var(--color-accent);
}

.expedition-tabs .tab-btn.active {
  background-color: var(--color-accent);
  color: #ffffff;
  border-color: var(--color-accent);
  box-shadow: var(--shadow-sm);
}


