/* ============================================================
   StudyCIE — Design System
   ============================================================ */

:root {
  /* Brand colors */
  --red-50:  #fef2f2;
  --red-100: #fee2e2;
  --red-200: #fecaca;
  --red-300: #fca5a5;
  --red-400: #f87171;
  --red-500: #e63946;
  --red-600: #c1121f;
  --red-700: #9d0208;
  --red-800: #7a0a02;
  --red-900: #5e0a02;

  /* Neutrals */
  --gray-50:  #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --gray-950: #030712;

  /* Semantic */
  --primary: var(--red-600);
  --primary-hover: var(--red-700);
  --primary-light: var(--red-50);
  --text: var(--gray-900);
  --text-secondary: var(--gray-600);
  --text-muted: var(--gray-400);
  --bg: #ffffff;
  --bg-alt: var(--gray-50);
  --border: var(--gray-200);
  --border-strong: var(--gray-300);
  --card-bg: #ffffff;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.04), 0 1px 3px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -2px rgba(0,0,0,.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px -4px rgba(0,0,0,.05);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,.10), 0 8px 10px -6px rgba(0,0,0,.05);

  /* Typography */
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --fw-normal: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;
  --fw-extrabold: 800;

  /* Spacing — 8px base */
  --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;
  --sp-20: 5rem;
  --sp-24: 6rem;

  /* Radius */
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;
  --r-2xl: 24px;
  --r-full: 9999px;

  /* Transitions */
  --t-fast: 150ms ease;
  --t-normal: 250ms ease;
  --t-slow: 400ms ease;

  /* Layout */
  --container: 1140px;
  --container-narrow: 860px;
  --header-h: 64px;
}

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg { display: block; max-width: 100%; }
a { color: var(--primary); text-decoration: none; transition: color var(--t-fast); }
a:hover { color: var(--primary-hover); }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
ul { list-style: none; }
:focus-visible { outline: 3px solid var(--red-300); outline-offset: 2px; border-radius: var(--r-sm); }

.page-loader {
  position: fixed; inset: 0; z-index: 2000;
  display: flex; align-items: center; justify-content: center; gap: var(--sp-3);
  background: var(--bg); color: var(--text-secondary); font-size: 0.9375rem;
  transition: opacity var(--t-normal), visibility var(--t-normal);
}
.page-ready .page-loader { opacity: 0; visibility: hidden; pointer-events: none; }
.page-loader-spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--red-200); border-top-color: var(--primary);
  border-radius: 50%; animation: page-loader-spin 0.8s linear infinite;
}
@keyframes page-loader-spin { to { transform: rotate(360deg); } }

/* ===== Container ===== */
.container { max-width: var(--container); margin: 0 auto; padding: 0 var(--sp-6); width: 100%; }
.container-narrow { max-width: var(--container-narrow); margin: 0 auto; padding: 0 var(--sp-6); }

/* ===== Typography ===== */
h1, h2, h3, h4 { line-height: 1.2; font-weight: var(--fw-bold); color: var(--text); }
h1 { font-size: clamp(2rem, 5vw, 3.5rem); font-weight: var(--fw-extrabold); letter-spacing: -0.02em; }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.25rem); letter-spacing: -0.01em; }
h3 { font-size: clamp(1.25rem, 2.5vw, 1.5rem); }
h4 { font-size: 1.125rem; }
p { color: var(--text-secondary); }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-5);
  font-size: 0.9375rem; font-weight: var(--fw-semibold);
  border-radius: var(--r-md);
  transition: all var(--t-normal);
  white-space: nowrap; border: 1.5px solid transparent;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary {
  background: var(--primary); color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { background: var(--primary-hover); color: #fff; box-shadow: var(--shadow-md); transform: translateY(-1px); }
.btn-secondary {
  background: var(--bg); color: var(--text);
  border-color: var(--border-strong);
}
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }
.btn-ghost { color: var(--text-secondary); padding: var(--sp-2) var(--sp-3); }
.btn-ghost:hover { color: var(--primary); background: var(--primary-light); }
.btn-lg { padding: var(--sp-4) var(--sp-8); font-size: 1rem; }
.btn-sm { padding: var(--sp-2) var(--sp-4); font-size: 0.8125rem; }
.btn-full { width: 100%; justify-content: center; }

/* ===== Header ===== */
.site-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  height: var(--header-h);
  background: rgba(255,255,255,0.85);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: background var(--t-normal), border-color var(--t-normal), box-shadow var(--t-normal);
}
.site-header.scrolled {
  background: rgba(255,255,255,0.95);
  border-bottom-color: var(--border);
  box-shadow: var(--shadow-sm);
}
.header-inner {
  max-width: var(--container); margin: 0 auto;
  height: 100%; padding: 0 var(--sp-6);
  display: flex; align-items: center; gap: var(--sp-6);
}
.header-logo {
  display: flex; align-items: baseline;
  gap: 0;
  font-size: 1.25rem; font-weight: var(--fw-extrabold);
  color: var(--text); letter-spacing: -0.02em;
  text-decoration: none; flex-shrink: 0;
}
.header-logo:hover { color: var(--text); }
.header-logo-text {
  font-weight: var(--fw-extrabold);
  letter-spacing: -0.04em;
  line-height: 1;
  transform: translateY(0.02em);
}
.header-logo-mark {
  width: auto; height: auto; border-radius: 0;
  background: transparent; color: var(--primary);
  display: inline-block;
  font-size: clamp(1.5rem, 1.8vw, 1.8rem);
  font-weight: 700;
  font-family: "Segoe Print", "Segoe Script", "Lucida Handwriting", "Bradley Hand", cursive;
  font-style: italic;
  line-height: 0.9;
  margin-right: -0.12em;
  transform: translateY(0.08em);
  flex-shrink: 0;
}
.header-nav {
  display: flex; align-items: center; justify-content: center; gap: var(--sp-1);
  flex: 1;
}
.header-nav a {
  padding: var(--sp-2) var(--sp-3);
  font-size: 0.875rem; font-weight: var(--fw-medium);
  color: var(--text-secondary); border-radius: var(--r-md);
  transition: all var(--t-fast); text-decoration: none; text-align: center;
}
.header-nav a:hover { color: var(--text); background: var(--gray-100); }
.header-nav a.active { color: var(--primary); }

.header-actions { display: flex; align-items: center; gap: var(--sp-2); flex-shrink: 0; }
.header-icon-btn {
  width: 38px; height: 38px; border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary); transition: all var(--t-fast);
}
.header-icon-btn:hover { color: var(--primary); background: var(--primary-light); }
.header-icon-btn svg { width: 20px; height: 20px; }

.header-hamburger { display: none; }

/* Profile dropdown */

/* ===== Mobile Nav ===== */
.mobile-nav {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(320px, 85vw); z-index: 1100;
  background: var(--bg);
  box-shadow: var(--shadow-xl);
  transform: translateX(100%);
  transition: transform var(--t-normal);
  display: flex; flex-direction: column;
  overflow-y: auto;
}
.mobile-nav.open { transform: translateX(0); }
.mobile-nav-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.mobile-nav-links { padding: var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-1); }
.mobile-nav-links a {
  padding: var(--sp-3) var(--sp-4); border-radius: var(--r-md);
  font-weight: var(--fw-medium); color: var(--text-secondary);
  transition: all var(--t-fast); font-size: 0.9375rem;
}
.mobile-nav-links a:hover, .mobile-nav-links a.active { background: var(--primary-light); color: var(--primary); }
.mobile-nav-backdrop {
  position: fixed; inset: 0; z-index: 1050;
  background: rgba(0,0,0,0.3); opacity: 0; visibility: hidden;
  transition: all var(--t-normal);
}
.mobile-nav-backdrop.open { opacity: 1; visibility: visible; }

/* ===== Hero ===== */
.hero {
  position: relative; min-height: 100vh; min-height: 100svh;
  display: flex; align-items: center; justify-content: center;
  text-align: center; padding: var(--sp-24) var(--sp-6) var(--sp-16);
  overflow: hidden;
}
.hero-bg { position: absolute; inset: 0; z-index: 0; }
.hero-bg-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(to right, var(--gray-100) 1px, transparent 1px),
    linear-gradient(to bottom, var(--gray-100) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 40%, black 30%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 40%, black 30%, transparent 70%);
}
.hero-bg-glow {
  position: absolute; top: 30%; left: 50%; transform: translateX(-50%);
  width: 600px; height: 600px; max-width: 90vw;
  background: radial-gradient(circle, rgba(193,18,31,0.08) 0%, transparent 70%);
  filter: blur(40px);
}
.hero-content { position: relative; z-index: 1; max-width: 720px; }
.hero-badge {
  display: inline-block; padding: var(--sp-2) var(--sp-4);
  background: var(--primary-light); color: var(--primary);
  border: 1px solid var(--red-200);
  border-radius: var(--r-full);
  font-size: 0.8125rem; font-weight: var(--fw-semibold);
  margin-bottom: var(--sp-6);
}
.hero-title { margin-bottom: var(--sp-5); }
.hero-title .accent { color: var(--primary); }
.hero-catchline {
  margin: 0 auto var(--sp-2); color: var(--text-primary);
  font-weight: var(--fw-semibold); line-height: 1.5;
}
.hero-subtitle {
  font-size: clamp(1.0625rem, 2vw, 1.25rem);
  color: var(--text-secondary); max-width: 560px; margin: 0 auto var(--sp-8);
  line-height: 1.7;
}
.hero-actions { display: flex; gap: var(--sp-4); justify-content: center; flex-wrap: wrap; }

/* ===== Sections ===== */
.section { padding: var(--sp-20) 0; }
.section-alt { background: var(--bg-alt); }
.section-head { text-align: center; max-width: 640px; margin: 0 auto var(--sp-12); }
.section-title { margin-bottom: var(--sp-4); }
.section-subtitle { font-size: 1.0625rem; color: var(--text-secondary); }
.section-eyebrow {
  display: inline-block; font-size: 0.75rem; font-weight: var(--fw-bold);
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--primary); margin-bottom: var(--sp-3);
}
.section-body { margin: var(--sp-4) 0 var(--sp-6); font-size: 1.0625rem; line-height: 1.7; max-width: 540px; }

/* Two-column layout */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-16); align-items: center; }
.two-col.reverse .two-col-text { order: 2; }
.two-col.reverse .two-col-visual { order: 1; }

/* Visual cards */
.visual-card {
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--r-2xl); padding: var(--sp-10);
  box-shadow: var(--shadow-lg); position: relative; overflow: hidden;
}
.visual-card-red { border-color: var(--red-200); background: linear-gradient(135deg, var(--primary-light), #fff); }
.visual-card-icon { font-size: 3rem; margin-bottom: var(--sp-6); }
.visual-card-lines div {
  height: 12px; border-radius: var(--r-full);
  background: var(--gray-100); margin-bottom: var(--sp-3);
}
.visual-card-lines div:nth-child(1) { width: 80%; background: var(--red-100); }
.visual-card-lines div:nth-child(2) { width: 60%; }
.visual-card-lines div:nth-child(3) { width: 90%; }
.visual-card-lines div:nth-child(4) { width: 45%; background: var(--red-100); }
.visual-card-lines div:nth-child(5) { width: 70%; }
.visual-card-lines div:nth-child(6) { width: 55%; }

/* ===== Feature Grid ===== */
.feature-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-5);
}
.feature-card {
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: var(--sp-6);
  text-decoration: none; color: inherit;
  transition: all var(--t-normal);
  display: flex; flex-direction: column; gap: var(--sp-3);
}
.feature-card:hover {
  border-color: var(--red-200); box-shadow: var(--shadow-lg);
  transform: translateY(-4px); text-decoration: none;
}
.feature-card-icon {
  width: 44px; height: 44px; border-radius: var(--r-md);
  background: var(--primary-light); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem; flex-shrink: 0;
}
.feature-card-title { font-size: 0.9375rem; font-weight: var(--fw-semibold); color: var(--text); }
.feature-card-desc { font-size: 0.8125rem; color: var(--text-muted); line-height: 1.5; }

/* ===== Subject Cards ===== */
.subject-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-6); }
.subject-card {
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: var(--sp-6);
  transition: all var(--t-normal);
  display: flex; flex-direction: column; gap: var(--sp-3);
  text-decoration: none; color: inherit;
  min-height: 320px;
}
.subject-card:hover {
  border-color: var(--red-200); box-shadow: var(--shadow-lg);
  transform: translateY(-4px); text-decoration: none;
}
.subject-card-code {
  display: inline-block; font-size: 0.75rem; font-weight: var(--fw-bold);
  color: var(--primary); background: var(--primary-light);
  padding: var(--sp-1) var(--sp-3); border-radius: var(--r-full);
  letter-spacing: 0.03em; align-self: flex-start;
}
.subject-card-name { font-size: 1.125rem; font-weight: var(--fw-semibold); color: var(--text); }
.subject-card-desc { font-size: 0.875rem; color: var(--text-secondary); flex: 1; }
.subject-card .btn { align-self: flex-start; margin-top: var(--sp-2); }

/* Coming soon subjects */
.subject-card.locked {
  opacity: 0.7;
  min-height: 320px;
}
.subject-card.locked .subject-card-code { color: var(--text-muted); background: var(--gray-100); }
.subject-card-locked-badge {
  display: inline-flex; align-items: center; gap: var(--sp-1);
  font-size: 0.75rem; font-weight: var(--fw-semibold);
  color: var(--text-muted); background: var(--gray-100);
  padding: var(--sp-1) var(--sp-3); border-radius: var(--r-full);
  align-self: flex-start;
}

/* ===== Page Hero (inner pages) ===== */
.page-hero {
  padding: calc(var(--header-h) + var(--sp-16)) 0 var(--sp-12);
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
}
.page-hero .container { text-align: center; }
.page-hero h1 { margin-bottom: var(--sp-4); }
.page-hero .page-catchline {
  margin-bottom: var(--sp-2); color: var(--text-primary);
  font-weight: var(--fw-semibold); line-height: 1.5;
}
.page-hero p { font-size: 1.125rem; max-width: 560px; margin: 0 auto; }

/* ===== Generic Cards (resource lists, info) ===== */
.card {
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: var(--sp-6);
  transition: all var(--t-normal);
}
.card:hover { box-shadow: var(--shadow-md); }

/* ===== Info section (about, registration) ===== */
.info-section { padding: var(--sp-16) 0; }
.info-section-alt { background: var(--bg-alt); }
.info-section h2 { margin-bottom: var(--sp-4); }
.info-section p { margin-bottom: var(--sp-4); line-height: 1.7; }
.info-section ul { padding-left: var(--sp-5); margin: var(--sp-4) 0; }
.info-section ul li { list-style: disc; color: var(--text-secondary); margin-bottom: var(--sp-2); line-height: 1.6; }

/* Stats cards */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-5); margin: var(--sp-12) 0; }
.stat-card {
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: var(--sp-8) var(--sp-6);
  text-align: center; transition: all var(--t-normal);
}
.stat-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.stat-card .stat-number { font-size: 2rem; font-weight: var(--fw-extrabold); color: var(--primary); margin-bottom: var(--sp-2); }
.stat-card .stat-label { font-size: 0.875rem; color: var(--text-secondary); }

/* ===== Notes / Textbook topic interface ===== */
.topic-view { display: none; scroll-margin-top: calc(var(--header-h) + var(--sp-4)); }
.topic-view.active { display: block; }
.breadcrumb {
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: 0.875rem; color: var(--text-muted); margin-bottom: var(--sp-6);
  flex-wrap: wrap;
}
.breadcrumb a { color: var(--text-secondary); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb-sep { color: var(--gray-300); }
.breadcrumb-current { color: var(--text); font-weight: var(--fw-medium); }

.topic-list { display: flex; flex-direction: column; gap: var(--sp-3); }
.topic-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-4) var(--sp-5); background: var(--card-bg);
  border: 1px solid var(--border); border-radius: var(--r-md);
  cursor: pointer; transition: all var(--t-fast);
}
.topic-item:hover { border-color: var(--primary); background: var(--primary-light); }
.topic-item-title { font-weight: var(--fw-medium); color: var(--text); }
.topic-item-arrow { color: var(--text-muted); transition: transform var(--t-fast); }
.topic-item:hover .topic-item-arrow { color: var(--primary); transform: translateX(4px); }

/* ===== PDF Viewer ===== */
.pdf-viewer {
  position: fixed; inset: 0; z-index: 1200;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden;
  transition: all var(--t-normal);
  padding: var(--sp-4);
}
.pdf-viewer.open { opacity: 1; visibility: visible; }
.pdf-viewer-panel {
  background: var(--bg); border-radius: var(--r-xl);
  width: 100%; max-width: 1000px; height: 100%; max-height: 700px;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: var(--shadow-xl);
  transform: scale(0.95); transition: transform var(--t-normal);
}
.pdf-viewer.open .pdf-viewer-panel { transform: scale(1); }
.pdf-viewer-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--border);
  flex-shrink: 0; gap: var(--sp-4);
}
.pdf-viewer-title { font-weight: var(--fw-semibold); font-size: 0.9375rem; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pdf-viewer-controls { display: flex; align-items: center; gap: var(--sp-2); flex-shrink: 0; }
.pdf-viewer-btn {
  width: 36px; height: 36px; border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary); transition: all var(--t-fast);
}
.pdf-viewer-btn:hover { color: var(--primary); background: var(--primary-light); }
.pdf-viewer-zoom { font-size: 0.8125rem; color: var(--text-muted); min-width: 50px; text-align: center; }
.pdf-viewer-body {
  flex: 1; overflow: auto; background: var(--gray-100);
  display: flex; align-items: center; justify-content: center;
}
.pdf-viewer-content { width: 100%; height: 100%; border: none; background: #fff; }
.pdf-viewer-placeholder {
  text-align: center; padding: var(--sp-16);
  color: var(--text-muted);
}
.pdf-viewer-placeholder .page-loader-spinner {
  display: inline-block;
}
.pdf-viewer-placeholder-icon { font-size: 3rem; margin-bottom: var(--sp-4); opacity: 0.4; }
.pdf-viewer-placeholder p { margin-bottom: var(--sp-2); }
.pdf-viewer-placeholder .placeholder-path { font-family: monospace; font-size: 0.8125rem; color: var(--text-secondary); }

/* ===== Search Overlay ===== */
.search-overlay {
  position: fixed; inset: 0; z-index: 1150;
  background: rgba(0,0,0,0.4); backdrop-filter: blur(6px);
  opacity: 0; visibility: hidden;
  transition: all var(--t-normal);
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 15vh; padding: var(--sp-6);
}
.search-overlay.open { opacity: 1; visibility: visible; }
.search-dialog {
  width: 100%; max-width: 640px;
  display: flex; align-items: center; gap: var(--sp-4);
}
.search-panel {
  width: 100%; background: var(--bg);
  border-radius: var(--r-xl); box-shadow: var(--shadow-xl);
  overflow: hidden; transform: translateY(-20px) scale(0.98);
  transition: transform var(--t-normal);
}
.search-overlay.open .search-panel { transform: translateY(0) scale(1); }
.search-input-wrapper {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--border);
}
.search-input-wrapper svg { width: 20px; height: 20px; color: var(--text-muted); flex-shrink: 0; }
.search-input {
  flex: 1; border: none; outline: none; font-size: 1rem;
  font-family: inherit; color: var(--text); background: transparent;
}
.search-input::placeholder { color: var(--text-muted); }
.search-close-hint { font-size: 0.75rem; color: var(--text-muted); flex-shrink: 0; }
.search-results { max-height: 400px; overflow-y: auto; padding: var(--sp-2); }
.search-result-item {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4); border-radius: var(--r-md);
  cursor: pointer; transition: background var(--t-fast);
  text-decoration: none; color: inherit;
}
.search-result-item:hover, .search-result-item.focused { background: var(--gray-100); }
.search-result-icon {
  width: 36px; height: 36px; border-radius: var(--r-md);
  background: var(--primary-light); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; flex-shrink: 0;
}
.search-result-info { flex: 1; min-width: 0; }
.search-result-title { font-size: 0.875rem; font-weight: var(--fw-medium); color: var(--text); }
.search-result-meta { font-size: 0.75rem; color: var(--text-muted); }
.search-empty { text-align: center; padding: var(--sp-10); color: var(--text-muted); }
.search-shortcut {
  display: inline-flex; align-items: center; gap: var(--sp-1);
  padding: var(--sp-1) var(--sp-2); border: 1px solid var(--border);
  border-radius: var(--r-sm); font-size: 0.6875rem;
  color: var(--text-muted); font-family: monospace;
}

/* ===== Past Papers ===== */
.filter-bar {
  display: flex; flex-wrap: wrap; gap: var(--sp-3);
  padding: var(--sp-5); background: var(--card-bg);
  border: 1px solid var(--border); border-radius: var(--r-lg);
  margin-bottom: var(--sp-6); align-items: flex-end;
}
.paper-resources-section:not(.ready) .filter-bar,
.paper-resources-section:not(.ready) .paper-list { visibility: hidden; }
.filter-group { display: flex; flex-direction: column; gap: var(--sp-1); }
.filter-label { font-size: 0.75rem; font-weight: var(--fw-semibold); color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.filter-select, .filter-input {
  padding: var(--sp-2) var(--sp-3); border: 1px solid var(--border-strong);
  border-radius: var(--r-md); font-size: 0.875rem; font-family: inherit;
  background: var(--bg); color: var(--text); transition: border-color var(--t-fast);
  min-width: 140px;
}
.filter-select:focus, .filter-input:focus { border-color: var(--primary); outline: none; }

.paper-list { display: flex; flex-direction: column; gap: var(--sp-3); }
.paper-row {
  display: grid; grid-template-columns: 1fr auto auto auto;
  gap: var(--sp-4); align-items: center;
  padding: var(--sp-4) var(--sp-5); background: var(--card-bg);
  border: 1px solid var(--border); border-radius: var(--r-md);
  transition: all var(--t-fast);
}
.paper-row:hover { border-color: var(--red-200); box-shadow: var(--shadow-sm); }
.paper-info { display: flex; flex-direction: column; gap: var(--sp-1); }
.paper-title { font-weight: var(--fw-semibold); font-size: 0.9375rem; color: var(--text); }
.paper-meta { display: flex; gap: var(--sp-3); flex-wrap: wrap; }
.paper-tag {
  font-size: 0.6875rem; font-weight: var(--fw-semibold);
  padding: var(--sp-1) var(--sp-2); border-radius: var(--r-sm);
  background: var(--gray-100); color: var(--text-secondary);
}
.paper-tag.type-qp { background: var(--primary-light); color: var(--primary); }
.paper-tag.type-ms { background: #ecfdf5; color: #059669; }
.paper-actions { display: flex; gap: var(--sp-2); }

/* ===== Practice Questions ===== */
.practice-layout { display: grid; grid-template-columns: 260px 1fr; gap: var(--sp-6); }
.practice-sidebar {
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: var(--sp-5);
  height: fit-content;
}
.practice-sidebar h4 { margin-bottom: var(--sp-3); font-size: 0.875rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.practice-select-group { margin-bottom: var(--sp-4); }
.practice-select-group label { display: block; font-size: 0.8125rem; font-weight: var(--fw-medium); color: var(--text-secondary); margin-bottom: var(--sp-2); }
.practice-select-group select {
  width: 100%; padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--border-strong); border-radius: var(--r-md);
  font-size: 0.875rem; font-family: inherit; background: var(--bg); color: var(--text);
}
.practice-select-group select:focus { border-color: var(--primary); outline: none; }

.practice-main {
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: var(--sp-8);
  min-height: 400px; display: flex; flex-direction: column;
}
.practice-question-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--sp-6); }
.practice-question-num { font-size: 0.8125rem; color: var(--text-muted); }
.practice-difficulty-badge {
  font-size: 0.75rem; font-weight: var(--fw-semibold);
  padding: var(--sp-1) var(--sp-3); border-radius: var(--r-full);
}
.difficulty-easy { background: #ecfdf5; color: #059669; }
.difficulty-medium { background: #fffbeb; color: #d97706; }
.difficulty-hard { background: var(--red-50); color: var(--red-600); }
.practice-question { font-size: 1.0625rem; color: var(--text); line-height: 1.7; margin-bottom: var(--sp-6); flex: 1; }
.practice-answer {
  background: var(--bg-alt); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: var(--sp-5);
  margin-bottom: var(--sp-6);
  max-height: 0; overflow: hidden; opacity: 0;
  transition: all var(--t-normal);
}
.practice-answer.visible { max-height: 500px; opacity: 1; padding: var(--sp-5); }
.practice-answer-label { font-size: 0.75rem; font-weight: var(--fw-bold); color: #059669; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: var(--sp-2); }
.practice-answer-text { color: var(--text); line-height: 1.7; }
.practice-actions { display: flex; gap: var(--sp-3); }

/* ===== Websites Directory ===== */
.website-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-5); }
.website-card {
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: var(--sp-6);
  transition: all var(--t-normal);
  display: flex; flex-direction: column; gap: var(--sp-3);
}
.website-card:hover { border-color: var(--red-200); box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.website-card-category {
  font-size: 0.6875rem; font-weight: var(--fw-bold);
  color: var(--primary); text-transform: uppercase; letter-spacing: 0.05em;
}
.website-card-name { font-size: 1.125rem; font-weight: var(--fw-semibold); color: var(--text); }
.website-card-desc { font-size: 0.875rem; color: var(--text-secondary); flex: 1; line-height: 1.6; }
.website-card .btn { align-self: flex-start; }

/* ===== Cambridge links ===== */
.cambridge-link-list { display: flex; flex-direction: column; gap: var(--sp-3); max-width: 600px; margin: 0 auto; }
.cambridge-link {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-5) var(--sp-6); background: var(--card-bg);
  border: 1px solid var(--border); border-radius: var(--r-md);
  transition: all var(--t-fast); text-decoration: none; color: inherit;
  gap: var(--sp-4);
}
.cambridge-link:hover { border-color: var(--primary); box-shadow: var(--shadow-sm); text-decoration: none; }
.cambridge-link-info { flex: 1; }
.cambridge-link-title { font-weight: var(--fw-semibold); color: var(--text); margin-bottom: var(--sp-1); }
.cambridge-link-desc { font-size: 0.8125rem; color: var(--text-muted); }
.cambridge-link-arrow { color: var(--text-muted); flex-shrink: 0; }
.cambridge-link:hover .cambridge-link-arrow { color: var(--primary); }

/* ===== Disclaimer ===== */
.disclaimer {
  background: var(--gray-100); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: var(--sp-4) var(--sp-5);
  font-size: 0.8125rem; color: var(--text-secondary); line-height: 1.6;
  margin: var(--sp-6) 0;
}
.disclaimer strong { color: var(--text); }

/* ===== Footer ===== */
.site-footer {
  background: var(--gray-950); color: var(--gray-400);
  padding: var(--sp-16) 0 var(--sp-8);
  margin-top: var(--sp-20);
}
.footer-grid {
  display: grid; grid-template-columns: 1.5fr 2fr 1.5fr;
  gap: var(--sp-10); margin-bottom: var(--sp-12);
}
.footer-brand h3 { color: #fff; font-size: 1.5rem; margin-bottom: var(--sp-2); }
.footer-brand p { color: var(--gray-500); font-size: 0.9375rem; }
.footer-links h4 { color: #fff; font-size: 0.8125rem; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: var(--sp-4); }
.footer-links ul { display: flex; flex-direction: column; gap: var(--sp-2); }
.footer-links a { color: var(--gray-400); font-size: 0.875rem; }
.footer-links a:hover { color: #fff; }
.footer-bottom {
  border-top: 1px solid var(--gray-800);
  padding-top: var(--sp-8);
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.8125rem; flex-wrap: wrap; gap: var(--sp-4);
}
.footer-disclaimer { color: var(--gray-500); font-size: 0.75rem; max-width: 600px; line-height: 1.6; margin-top: var(--sp-4); }
.footer-copy { color: var(--gray-500); }

/* ===== Reveal animations ===== */
.reveal {
  opacity: 0; transform: translateY(24px);
  transition: opacity var(--t-slow), transform var(--t-slow);
}
.reveal.visible { opacity: 1; transform: translateY(0); }

/* ===== Utility ===== */
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.hidden { display: none !important; }
.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;
}

/* ===== Empty state ===== */
.empty-state {
  text-align: center; padding: var(--sp-16) var(--sp-6);
  color: var(--text-muted);
}
.empty-state-icon { font-size: 2.5rem; margin-bottom: var(--sp-4); opacity: 0.4; }
.empty-state h3 { color: var(--text-secondary); margin-bottom: var(--sp-2); }
.empty-state p { font-size: 0.875rem; }

/* ===== Syllabus topics ===== */
.syllabus-subject {
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: var(--sp-6); margin-bottom: var(--sp-5);
}
.syllabus-subject-header { display: flex; align-items: center; gap: var(--sp-4); margin-bottom: var(--sp-4); }
.syllabus-subject-code {
  font-size: 0.8125rem; font-weight: var(--fw-bold); color: var(--primary);
  background: var(--primary-light); padding: var(--sp-1) var(--sp-3);
  border-radius: var(--r-full); flex-shrink: 0;
}
.syllabus-subject-name { font-size: 1.125rem; font-weight: var(--fw-semibold); }
.syllabus-topics { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-2) var(--sp-6); }
.syllabus-topic {
  padding: var(--sp-2) 0; font-size: 0.875rem; color: var(--text-secondary);
  border-bottom: 1px solid var(--gray-100);
  display: flex; align-items: center; gap: var(--sp-2);
}
.syllabus-topic-num {
  width: 24px; height: 24px; border-radius: var(--r-full);
  background: var(--gray-100); color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.6875rem; font-weight: var(--fw-bold); flex-shrink: 0;
}

/* ===== Registration sections ===== */
.reg-section {
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: var(--sp-6); margin-bottom: var(--sp-5);
}
.reg-section h3 { margin-bottom: var(--sp-3); display: flex; align-items: center; gap: var(--sp-3); }
.reg-section h3 .reg-icon {
  width: 36px; height: 36px; border-radius: var(--r-md);
  background: var(--primary-light); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.125rem; flex-shrink: 0;
}
.reg-section p { margin-bottom: var(--sp-3); }
.reg-section ul { padding-left: var(--sp-5); margin-bottom: var(--sp-3); }
.reg-section ul li { list-style: disc; color: var(--text-secondary); margin-bottom: var(--sp-2); line-height: 1.6; }

/* ===== Loading skeleton ===== */
.skeleton {
  background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 50%, var(--gray-100) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--r-md);
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ===== Accessibility ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1; transform: none; }
}
