/* ================================================
   Crash Course Tutorial Website — Civic Literacy Initiative
   Editorial / textbook aesthetic with CLI brand
   ================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400&family=Roboto+Mono:wght@400;500;600;700&family=Roboto+Condensed:wght@400;500;600;700&display=swap');
@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css');

/* --- Variables --- */
:root {
  --navy: #091A31;
  --blue: #56ABE1;
  --blue-light: #B6DEFF;
  --blue-pale: #EBF6FF;
  --white: #FFFFFF;
  --gray-50: #F8FAFC;
  --gray-100: #F1F5F9;
  --gray-200: #E2E8F0;
  --gray-300: #CBD5E1;
  --gray-400: #94A3B8;
  --gray-500: #64748B;
  --gray-600: #475569;
  --gray-700: #334155;
  --gold: #D4A843;
  --cyan: #2EC4B6;
  --red: #CC0000;

  --sidebar-width: 280px;
  --header-height: 56px;
  --font-display: 'Roboto Mono', monospace;
  --font-body: 'DM Sans', sans-serif;
  --font-condensed: 'Roboto Condensed', sans-serif;
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.7;
  color: var(--navy);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
}

/* --- Header --- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--navy);
  display: flex;
  align-items: center;
  padding: 0 24px;
  z-index: 100;
  border-bottom: 2px solid var(--blue);
}
.site-header .logo {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  color: var(--blue);
  letter-spacing: -0.02em;
  text-decoration: none;
}
.site-header .logo span {
  color: var(--white);
  font-weight: 400;
}
.site-header .header-right {
  margin-left: auto;
  display: flex;
  gap: 16px;
  align-items: center;
}
.site-header .header-right a {
  font-family: var(--font-condensed);
  font-size: 13px;
  color: var(--gray-400);
  text-decoration: none;
  transition: color 0.15s;
}
.site-header .header-right a:hover { color: var(--white); }
.site-header .header-right a.active { color: var(--blue-light); }

/* --- Sidebar --- */
.sidebar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--gray-50);
  border-right: 1px solid var(--gray-200);
  overflow-y: auto;
  padding: 24px 0;
  z-index: 90;
}
.sidebar-section {
  padding: 0 20px;
  margin-bottom: 24px;
}
.sidebar-section-title {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gray-400);
  padding: 0 0 8px 0;
  border-bottom: 1px solid var(--gray-200);
  margin-bottom: 8px;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 6px;
  text-decoration: none;
  color: var(--gray-600);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
  margin-bottom: 2px;
}
.sidebar-link:hover {
  background: var(--gray-100);
  color: var(--navy);
}
.sidebar-link.active {
  background: var(--blue-pale);
  color: var(--navy);
  font-weight: 600;
}
.sidebar-link .icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}
.sidebar-link .badge {
  margin-left: auto;
  font-size: 11px;
  font-family: var(--font-display);
  background: var(--gray-200);
  color: var(--gray-500);
  padding: 2px 8px;
  border-radius: 10px;
}

/* --- Sidebar exam link --- */
.sidebar-exam {
  padding-bottom: 16px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--gray-200);
}
.sidebar-link-exam {
  background: var(--navy);
  color: var(--white) !important;
  font-weight: 600;
  font-family: var(--font-condensed);
  letter-spacing: 0.02em;
}
.sidebar-link-exam .icon { color: var(--blue-light); }
.sidebar-link-exam:hover {
  background: #0e2444 !important;
  color: var(--white) !important;
}
.sidebar-link-exam.active {
  background: var(--blue) !important;
  color: var(--white) !important;
}

/* --- Main content --- */
.main {
  margin-left: var(--sidebar-width);
  margin-top: var(--header-height);
  min-height: calc(100vh - var(--header-height));
}

/* --- Landing page --- */
.landing {
  max-width: 900px;
  margin: 0 auto;
  padding: 60px 40px;
}
.landing h1 {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--navy);
  margin-bottom: 12px;
}
.landing .subtitle {
  font-size: 18px;
  color: var(--gray-500);
  margin-bottom: 48px;
  max-width: 600px;
}
.landing h2 {
  font-family: var(--font-condensed);
  font-size: 20px;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 20px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--blue);
  display: inline-block;
}

/* Track cards */
.track-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 48px;
}
.track-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  padding: 32px;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}
.track-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}
.track-card.course::before { background: var(--blue); }
.track-card.review::before { background: var(--gold); }
.track-card:hover {
  border-color: var(--blue);
  box-shadow: 0 4px 20px rgba(9, 26, 49, 0.08);
  transform: translateY(-2px);
}
.track-card h3 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
}
.track-card p {
  font-size: 14px;
  color: var(--gray-500);
  line-height: 1.6;
}
.track-card .arrow {
  position: absolute;
  bottom: 20px;
  right: 24px;
  font-size: 20px;
  color: var(--gray-300);
  transition: all 0.2s;
}
.track-card:hover .arrow {
  color: var(--blue);
  transform: translateX(4px);
}

/* --- Section page --- */
.section-page {
  max-width: 900px;
  margin: 0 auto;
  padding: 48px 40px 80px;
}
.section-page .section-label {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--blue);
  margin-bottom: 8px;
}
.section-page h1 {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--navy);
  margin-bottom: 16px;
}
.section-page .section-intro {
  font-size: 17px;
  color: var(--gray-600);
  line-height: 1.8;
  margin-bottom: 40px;
  max-width: 700px;
}

/* Slide embed */
.slide-embed {
  margin-bottom: 40px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--gray-200);
  background: var(--gray-100);
}
.slide-embed-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
}
.slide-embed-title {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-600);
}
.slide-embed-actions {
  display: flex;
  gap: 8px;
}
.slide-embed-actions a,
.slide-embed-actions button {
  font-family: var(--font-condensed);
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 4px;
  text-decoration: none;
  border: 1px solid var(--gray-300);
  background: var(--white);
  color: var(--gray-600);
  cursor: pointer;
  transition: all 0.15s;
}
.slide-embed-actions a:hover,
.slide-embed-actions button:hover {
  border-color: var(--blue);
  color: var(--navy);
}
.slide-embed iframe {
  width: 100%;
  height: 520px;
  border: none;
  display: block;
}

/* Navigation */
.page-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--gray-200);
}
.page-nav a {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--gray-500);
  font-size: 14px;
  font-weight: 500;
  padding: 12px 20px;
  border-radius: 8px;
  border: 1px solid var(--gray-200);
  transition: all 0.15s;
}
.page-nav a:hover {
  border-color: var(--blue);
  color: var(--navy);
  background: var(--blue-pale);
}
.page-nav .nav-label {
  font-family: var(--font-display);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gray-400);
}
.page-nav .nav-title {
  font-weight: 600;
  color: var(--navy);
}

/* --- Mobile menu toggle --- */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--white);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  margin-right: 12px;
}

/* --- Responsive --- */
@media (max-width: 900px) {
  .menu-toggle { display: block; }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 95;
    width: 280px;
    background: var(--white);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 20px rgba(9, 26, 49, 0.15);
  }

  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(9, 26, 49, 0.3);
    z-index: 94;
  }
  .sidebar-overlay.open { display: block; }

  .main { margin-left: 0; }
  .track-grid { grid-template-columns: 1fr; }

  .landing { padding: 40px 20px; }
  .landing h1 { font-size: 24px; }
  .landing .subtitle { font-size: 16px; }

  .section-page { padding: 32px 20px 60px; }
  .section-page h1 { font-size: 22px; }

  .slide-embed iframe { height: 300px; }

  .page-nav { flex-direction: column; gap: 12px; }
  .page-nav a { justify-content: center; }

  .site-header .logo { font-size: 12px; }
  .site-header .logo span { display: none; }
  .site-header .header-right a { font-size: 12px; }

  .track-card { padding: 24px; }
  .track-card h3 { font-size: 16px; }
}

@media (max-width: 480px) {
  .slide-embed iframe { height: 220px; }
  .landing h1 { font-size: 20px; }
  .track-card .arrow { display: none; }
}

/* --- Utility --- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}
