/* =============================================
   Study Notes — Main Stylesheet
   Mobile-first, clean, designed for focus
   ============================================= */

:root {
  --jamie: #2563eb;
  --jamie-light: #dbeafe;
  --jamie-dark: #1e40af;
  --kelsey: #7c3aed;
  --kelsey-light: #ede9fe;
  --kelsey-dark: #5b21b6;

  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;

  --success: #059669;
  --success-light: #d1fae5;
  --error: #dc2626;
  --error-light: #fee2e2;

  --radius: 0.75rem;
  --radius-sm: 0.375rem;
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);

  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;

  --header-h: 60px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  font-family: var(--font-sans);
  color: var(--gray-800);
  background: var(--gray-50);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header ─────────────────────────────────── */
.site-header {
  height: var(--header-h);
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.25rem;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--gray-900);
  font-weight: 700;
  font-size: 1.1rem;
}

.logo-icon { font-size: 1.4rem; }

.nav-links { display: flex; gap: 0.5rem; }

.nav-student {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.9rem;
  border-radius: 2rem;
  text-decoration: none;
  color: var(--gray-600);
  font-weight: 500;
  font-size: 0.9rem;
  transition: all 0.15s;
}

.nav-student:hover { background: var(--gray-100); }
.nav-student.active { color: var(--gray-900); background: var(--gray-100); }

.student-badge {
  width: 26px; height: 26px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
}
.student-badge.jamie { background: var(--jamie); }
.student-badge.kelsey { background: var(--kelsey); }

/* ── Main layout ─────────────────────────────── */
.site-main { flex: 1; }
.site-footer {
  border-top: 1px solid var(--gray-200);
  padding: 1.5rem;
  text-align: center;
  color: var(--gray-400);
  font-size: 0.85rem;
  background: #fff;
}

/* ── Home page ───────────────────────────────── */
.home-hero {
  background: linear-gradient(135deg, #1e3a8a 0%, #1d4ed8 50%, #7c3aed 100%);
  color: #fff;
  padding: 4rem 1.5rem;
  text-align: center;
}
.home-hero h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); font-weight: 700; margin-bottom: 1rem; }
.home-hero p { font-size: 1.1rem; opacity: 0.85; max-width: 540px; margin: 0 auto; }

.students-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  max-width: 800px;
  margin: 3rem auto;
  padding: 0 1.5rem;
}

.student-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 2rem;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-md);
  border: 2px solid transparent;
  transition: all 0.2s;
  display: block;
}
.student-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.student-card.jamie { border-color: var(--jamie-light); }
.student-card.jamie:hover { border-color: var(--jamie); }
.student-card.kelsey { border-color: var(--kelsey-light); }
.student-card.kelsey:hover { border-color: var(--kelsey); }

.student-card .avatar {
  width: 64px; height: 64px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 1rem;
}
.student-card.jamie .avatar { background: var(--jamie); }
.student-card.kelsey .avatar { background: var(--kelsey); }

.student-card h2 { font-size: 1.4rem; margin-bottom: 0.25rem; }
.student-card .subtitle { color: var(--gray-600); font-size: 0.9rem; }
.student-card .stats {
  margin-top: 1.25rem;
  display: flex;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--gray-600);
}
.student-card .stat strong { display: block; font-size: 1.1rem; color: var(--gray-800); }

/* ── Student home page ───────────────────────── */
.student-page { max-width: 1000px; margin: 0 auto; padding: 2rem 1.25rem; }

.student-hero {
  background: linear-gradient(135deg, var(--jamie) 0%, var(--jamie-dark) 100%);
  border-radius: var(--radius);
  padding: 2.5rem;
  color: #fff;
  margin-bottom: 2rem;
}
.student-hero.kelsey {
  background: linear-gradient(135deg, var(--kelsey) 0%, var(--kelsey-dark) 100%);
}
.student-hero h1 { font-size: 1.8rem; font-weight: 700; }
.student-hero .level { opacity: 0.85; font-size: 0.95rem; margin-top: 0.25rem; }

.theme-list { display: flex; flex-direction: column; gap: 1.25rem; }

.theme-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.theme-header {
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid var(--gray-100);
}
.theme-header h2 { font-size: 1.05rem; font-weight: 600; }
.theme-header .topic-count { font-size: 0.8rem; color: var(--gray-400); }

.topic-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0;
}

.topic-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.25rem;
  text-decoration: none;
  color: var(--gray-700);
  font-size: 0.9rem;
  border-bottom: 1px solid var(--gray-100);
  border-right: 1px solid var(--gray-100);
  transition: all 0.15s;
  gap: 0.5rem;
}
.topic-link:hover { background: var(--gray-50); color: var(--gray-900); }
.topic-link .arrow { color: var(--gray-300); font-size: 0.8rem; }

.topic-link.has-notes .topic-name::before {
  content: "✓ ";
  color: var(--success);
  font-size: 0.8rem;
}

/* ── Topic page ──────────────────────────────── */
.topic-container { max-width: 900px; margin: 0 auto; padding: 1.5rem 1.25rem 3rem; }

.breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.25rem;
  font-size: 0.82rem;
  color: var(--gray-400);
  margin-bottom: 1.25rem;
}
.breadcrumb a { color: var(--gray-500); text-decoration: none; }
.breadcrumb a:hover { color: var(--gray-700); }
.breadcrumb .sep { color: var(--gray-300); }
.breadcrumb .current { color: var(--gray-700); font-weight: 500; }

.topic-header {
  border-radius: var(--radius);
  padding: 2rem;
  margin-bottom: 1.5rem;
  background: var(--jamie-light);
  border-left: 4px solid var(--jamie);
}
.topic-header.kelsey { background: var(--kelsey-light); border-color: var(--kelsey); }
.topic-header h1 { font-size: clamp(1.3rem, 3vw, 1.8rem); font-weight: 700; margin-top: 0.75rem; }

.topic-meta { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.5rem; }
.tag {
  display: inline-flex; align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 2rem;
  font-size: 0.75rem;
  font-weight: 500;
}
.theme-tag { background: rgba(255,255,255,0.6); color: var(--gray-700); }
.level-tag { background: rgba(255,255,255,0.4); color: var(--gray-600); }

/* Content tabs */
.content-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--gray-200);
  margin-bottom: 1.5rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.content-tabs::-webkit-scrollbar { display: none; }

.tab-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.75rem 1.25rem;
  border: none;
  background: transparent;
  color: var(--gray-500);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.15s;
  white-space: nowrap;
  font-family: var(--font-sans);
}
.tab-btn:hover { color: var(--gray-700); }
.tab-btn.active { color: var(--gray-900); border-bottom-color: var(--jamie); }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Prose (notes content) ───────────────────── */
.prose {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--gray-800);
}
.prose h1 { font-size: 1.5rem; font-weight: 700; margin: 2rem 0 1rem; color: var(--gray-900); }
.prose h2 {
  font-size: 1.2rem; font-weight: 700;
  margin: 2.5rem 0 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--gray-200);
  color: var(--gray-900);
}
.prose h3 { font-size: 1.05rem; font-weight: 600; margin: 1.5rem 0 0.5rem; color: var(--gray-800); }
.prose p { margin-bottom: 0.9rem; }
.prose ul, .prose ol { margin: 0.5rem 0 1rem 1.5rem; }
.prose li { margin-bottom: 0.35rem; }
.prose strong { font-weight: 600; color: var(--gray-900); }
.prose em { font-style: italic; color: var(--gray-600); }
.prose code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--gray-100);
  padding: 0.15em 0.4em;
  border-radius: var(--radius-sm);
}
.prose blockquote {
  border-left: 3px solid var(--gray-300);
  padding-left: 1rem;
  margin: 1rem 0;
  color: var(--gray-600);
  font-style: italic;
}
.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.25rem 0;
  font-size: 0.9rem;
}
.prose th {
  background: var(--gray-100);
  padding: 0.6rem 0.8rem;
  text-align: left;
  font-weight: 600;
  border: 1px solid var(--gray-200);
}
.prose td {
  padding: 0.5rem 0.8rem;
  border: 1px solid var(--gray-200);
}
.prose tr:nth-child(even) td { background: var(--gray-50); }

/* ── Question cards ──────────────────────────── */
.questions-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.25rem;
  flex-wrap: wrap; gap: 0.75rem;
}
.questions-meta { color: var(--gray-500); font-size: 0.9rem; }

.question-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
  position: relative;
}
.question-card.mcq { border-left: 3px solid var(--jamie); }
.question-card.structured { border-left: 3px solid var(--kelsey); }

.question-number {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.question-text { font-size: 0.95rem; margin-bottom: 0.75rem; }

.diagram-note {
  background: var(--gray-50);
  border: 1px dashed var(--gray-300);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  color: var(--gray-600);
  margin-bottom: 0.75rem;
  display: flex; gap: 0.5rem; align-items: flex-start;
}

.mcq-options { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 0.75rem; }
.mcq-option {
  padding: 0.5rem 0.75rem;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.15s;
  user-select: none;
}
.mcq-option:hover { border-color: var(--gray-400); background: var(--gray-50); }
.mcq-option.selected { border-color: var(--jamie); background: var(--jamie-light); }
.mcq-option.correct { border-color: var(--success); background: var(--success-light); }
.mcq-option.wrong { border-color: var(--error); background: var(--error-light); }

.marks-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.5rem;
  background: var(--gray-100);
  border-radius: 2rem;
  font-size: 0.75rem;
  color: var(--gray-500);
  margin-bottom: 0.5rem;
}

.answer-reveal { margin-top: 0.75rem; }

.btn-reveal {
  padding: 0.35rem 0.8rem;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--gray-600);
  font-size: 0.82rem;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: all 0.15s;
}
.btn-reveal:hover { border-color: var(--gray-500); color: var(--gray-800); }

.answer-box {
  margin-top: 0.6rem;
  padding: 0.6rem 0.9rem;
  background: var(--success-light);
  border: 1px solid var(--success);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  color: var(--gray-800);
}
.answer-box.hidden { display: none; }

.question-source {
  margin-top: 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--gray-100);
  color: var(--gray-400);
}

/* ── Papers grid ─────────────────────────────── */
.papers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.75rem;
}
.paper-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.paper-school { font-weight: 500; font-size: 0.9rem; }
.paper-year { color: var(--gray-500); font-size: 0.82rem; }
.btn-download {
  padding: 0.4rem 0.9rem;
  background: var(--gray-100);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--gray-700);
  font-size: 0.82rem;
  font-weight: 500;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn-download:hover { background: var(--gray-200); }

/* ── Shared buttons ──────────────────────────── */
.btn-primary {
  display: inline-flex; align-items: center;
  padding: 0.6rem 1.25rem;
  background: var(--jamie);
  color: #fff;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
  transition: background 0.15s;
}
.btn-primary:hover { background: var(--jamie-dark); }
.btn-reveal-all {
  padding: 0.4rem 0.9rem;
  background: var(--gray-700);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  cursor: pointer;
  font-family: var(--font-sans);
}

/* ── Empty state ─────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--gray-500);
}
.empty-state p { margin-bottom: 0.5rem; }

/* ── Topic nav ───────────────────────────────── */
.topic-nav {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--gray-200);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}
.nav-prev, .nav-next {
  color: var(--gray-600);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 0.6rem 1rem;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  transition: all 0.15s;
}
.nav-prev:hover, .nav-next:hover { background: var(--gray-100); color: var(--gray-900); }
.nav-next { margin-left: auto; }

/* ── Responsive ──────────────────────────────── */
@media (max-width: 640px) {
  .nav-student span:not(.student-badge) { display: none; }
  .topic-header { padding: 1.25rem; }
  .topic-container { padding: 1rem; }
  .tab-btn { padding: 0.6rem 0.9rem; font-size: 0.82rem; }
  .student-page { padding: 1rem; }
  .student-hero { padding: 1.5rem; }
  .topic-list { grid-template-columns: 1fr; }
}

@media (min-width: 768px) {
  .prose { font-size: 1.05rem; }
}
