/* =========================================================
   Law Service — Clean & Minimal Light Design System
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #ffffff;
  --bg-subtle: #f8fafc;
  --bg-muted: #f1f5f9;
  --border: #e2e8f0;
  --border-hover: #cbd5e1;

  --primary: #4f46e5;
  --primary-light: #eef2ff;
  --primary-hover: #4338ca;
  --secondary: #7c3aed;
  --secondary-light: #f5f3ff;
  --accent: #f59e0b;
  --accent-light: #fffbeb;
  --success: #10b981;
  --error: #ef4444;

  --text: #1e293b;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-inverse: #ffffff;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;
  --max-w: 1200px;

  --font-head: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  --shadow-xs: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.08), 0 8px 10px -6px rgba(0,0,0,0.04);
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary-hover); }
h1, h2, h3, h4 {
  font-family: var(--font-head);
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
}
img { max-width: 100%; display: block; }

/* Layout */
.container { width: 100%; max-width: var(--max-w); margin: 0 auto; padding: 0 24px; }
.section { padding: 80px 0; }
.section-alt { background: var(--bg-subtle); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }

/* =================== HEADER =================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 12px 0 8px;
}
.nav {
  display: flex;
  align-items: center;
  gap: 32px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--text) !important;
  white-space: nowrap;
}
.brand .logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  background: var(--primary);
  color: white;
  border-radius: var(--radius-sm);
  font-size: 1.1rem;
  font-weight: 700;
}
.nav-links {
  display: flex;
  list-style: none;
  gap: 8px;
  margin-left: auto;
}
.nav-links a {
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
}
.nav-links a:hover { background: var(--bg-muted); color: var(--text); }
.nav-cta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: 16px;
}
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  width: 32px;
  height: 32px;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: var(--transition);
}

/* Semester nav row */
.header-sems-row {
  display: none !important;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  overflow-x: auto;
}
.sem-nav-tile {
  padding: 6px 16px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  white-space: nowrap;
  transition: var(--transition);
}
.sem-nav-tile:hover { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }
.sem-nav-tile.active { background: var(--primary); color: white; border-color: var(--primary); }
.sem-nav-tile.disabled { opacity: 0.4; pointer-events: none; }
.card.disabled, .doc.disabled { opacity: 0.4; pointer-events: none; cursor: default; }

/* Modules nav row */
.header-modules-row {
  display: none;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  overflow-x: auto;
}
.module-nav-tile {
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  white-space: nowrap;
  transition: var(--transition);
  cursor: pointer;
}
.module-nav-tile:hover {
  background: rgba(88, 50, 226, 0.15);
  color: var(--primary);
  border-color: var(--primary);
}
.module-nav-tile.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* =================== BUTTONS =================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 24px;
  border-radius: var(--radius-full);
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
  text-decoration: none;
}
.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover {
  background: var(--primary-hover);
  color: white;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background: var(--bg-muted);
  border-color: var(--border-hover);
}
.btn-ghost {
  background: transparent;
  color: var(--primary);
  padding: 8px 16px;
}
.btn-ghost:hover { background: var(--primary-light); }

/* =================== HERO =================== */
.hero {
  padding: 80px 0 60px;
  background: linear-gradient(180deg, var(--bg-subtle) 0%, var(--bg) 100%);
}
.hero-inner {
  max-width: 720px;
}
.hero h1 {
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}
.hero h1 .highlight {
  color: var(--primary);
}
.hero p {
  font-size: 1.15rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 32px;
}
.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 48px;
}
.hero-stats {
  display: flex;
  gap: 40px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}
.hero-stat-num {
  font-family: var(--font-head);
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary);
}
.hero-stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 500;
}

/* =================== SUBJECT CARDS (homepage grid) =================== */
#subject-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 32px;
}
.grid.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}
#semesters-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 32px;
}
.docs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 32px;
}
.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  height: 100%;
  text-decoration: none;
  color: var(--text);
}
.card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}
.card-body { display: flex; flex-direction: column; height: 100%; }
.card-body .meta {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--primary);
  font-weight: 600;
  margin-bottom: 8px;
}
.card-body h3 {
  font-size: 1.15rem;
  margin-bottom: 8px;
}
.card-body p {
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.6;
  margin-bottom: 16px;
  flex-grow: 1;
}
.card-body .read {
  color: var(--primary);
  font-weight: 600;
  font-size: 0.85rem;
  margin-top: auto;
}
.card:hover .card-body .read { color: var(--primary-hover); }

/* =================== SEARCH BAR =================== */
.search-box {
  position: relative;
  max-width: 480px;
}
.search-box input {
  width: 100%;
  padding: 14px 20px 14px 48px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 0.95rem;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  transition: var(--transition);
  outline: none;
}
.search-box input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
.search-box::before {
  content: "🔍";
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1rem;
  pointer-events: none;
}

/* Quick tags */
.quick-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.quick-tags a {
  padding: 6px 14px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: var(--transition);
}
.quick-tags a:hover { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }

/* =================== RESOURCE LIBRARY =================== */
.filter-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 24px;
}
.filter-bar input,
.filter-bar select {
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: var(--transition);
}
.filter-bar input:focus,
.filter-bar select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
.filter-bar input { flex: 1; min-width: 200px; }

#resource-list { margin-top: 16px; }
.subject-group { margin-bottom: 32px; }
.subject-group-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.doc {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  transition: var(--transition);
  text-decoration: none;
  color: var(--text);
}
.doc:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}
.doc-ic { font-size: 1.4rem; flex-shrink: 0; }
.doc-info { flex: 1; }
.doc-title { font-weight: 600; font-size: 0.9rem; }
.doc-sub { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }
.doc-arrow { color: var(--text-muted); font-size: 1.1rem; }
.doc:hover .doc-arrow { color: var(--primary); }

#no-results {
  display: none;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* =================== READER LAYOUT (notes/answers pages) =================== */
.reader-layout {
  padding: 40px 0 80px;
  max-width: 800px;
  margin: 0 auto;
  padding-left: 24px;
  padding-right: 24px;
  overflow-x: hidden;
  word-wrap: break-word;
  overflow-wrap: break-word;
}
.reader-body h1 { font-size: 2rem; margin-bottom: 8px; }
.reader-body h2 {
  font-size: 1.3rem;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  color: var(--primary);
  font-family: var(--font-head);
  padding-bottom: 8px;
  border-bottom: 2px solid var(--primary-light);
}
.reader-body h3 {
  font-size: 1.05rem;
  margin-top: 1.8rem;
  margin-bottom: 0.6rem;
  color: var(--text);
  font-family: var(--font-head);
}
.reader-body h4 {
  font-size: 0.95rem;
  margin-top: 1.4rem;
  margin-bottom: 0.5rem;
  color: var(--secondary);
  font-family: var(--font-head);
  font-weight: 700;
}
.reader-body p { margin-bottom: 1rem; line-height: 1.8; color: var(--text-secondary); }
.reader-body ul, .reader-body ol { margin: 0.5rem 0 1rem 1.5rem; color: var(--text-secondary); }
.reader-body li {
  margin-bottom: 0.5rem;
  line-height: 1.7;
  padding-left: 4px;
}
.reader-body ol > li::marker {
  color: var(--primary);
  font-weight: 700;
}
.reader-body ul > li::marker {
  color: var(--secondary);
}
.reader-body blockquote {
  border-left: 3px solid var(--primary);
  padding: 12px 16px;
  margin: 1rem 0;
  background: var(--primary-light);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-secondary);
  font-style: italic;
}
.reader-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.9rem;
  display: table;
  table-layout: fixed;
  word-wrap: break-word;
  overflow-wrap: break-word;
}
.reader-body th, .reader-body td {
  padding: 12px 16px;
  border: 1px solid var(--border);
  text-align: left;
}
.reader-body th {
  background: var(--primary-light);
  font-weight: 700;
  color: var(--primary);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.reader-body tr:hover td { background: var(--bg-subtle); }
.reader-body table tr:only-child td:only-child,
.reader-body table tr:first-child:last-child td {
  border: none;
  border-left: 4px solid var(--primary);
  background: var(--primary-light);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 16px 20px;
  line-height: 1.7;
}
.reader-body table tr:only-child td:only-child p:first-child strong,
.reader-body table tr:first-child:last-child td p:first-child strong {
  color: var(--primary);
  font-size: 0.95rem;
}

/* Breadcrumb above reader */
.reader-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
  font-size: 0.85rem;
}
.reader-breadcrumb a { color: var(--primary); font-weight: 500; }
.reader-breadcrumb .sep { color: var(--text-muted); }
.reader-breadcrumb .current { color: var(--text-muted); }

/* =================== QUESTION BANK ACCORDION =================== */
.qb-topic { margin: 2.5rem 0 1rem; }
.qb-topic-title {
  font-size: 1.1rem;
  color: var(--text);
  border-bottom: 2px solid var(--primary-light);
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
}
.qb-item { margin-bottom: 8px; border-radius: var(--radius-sm); overflow: hidden; }
.qb-question {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: var(--transition);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
}
.qb-question:hover { background: var(--primary-light); border-color: var(--primary); }
.qb-question::after {
  content: "+";
  font-size: 1.3rem;
  font-weight: 300;
  color: var(--primary);
  transition: transform 0.3s;
}
.qb-item.open .qb-question::after { content: "−"; }
.qb-item.open .qb-question { border-radius: var(--radius-sm) var(--radius-sm) 0 0; background: var(--primary-light); border-color: var(--primary); }
.qb-answer {
  max-height: 0;
  overflow: hidden;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  padding: 0 18px;
}
.qb-item.open .qb-answer {
  max-height: none;
  padding: 18px;
  overflow: visible;
}
.qb-accordion[open] .qb-answer,
details[open] .qb-answer {
  max-height: none;
  overflow: visible;
}
.qb-section { margin-bottom: 1rem; }
.qb-section-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.3rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.qb-answer p { margin: 0.3rem 0; line-height: 1.7; color: var(--text-secondary); font-size: 0.9rem; }
.qb-answer ul { margin: 0.3rem 0 0.3rem 1.2rem; color: var(--text-secondary); font-size: 0.9rem; }
.qb-answer li { margin: 0.2rem 0; line-height: 1.6; }
.qb-answer blockquote {
  border-left: 3px solid var(--primary);
  padding: 8px 12px;
  margin: 0.5rem 0;
  background: var(--primary-light);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-style: italic;
  font-size: 0.85rem;
}
.qb-answer h4 { color: var(--text); margin: 0.6rem 0 0.2rem; font-size: 0.85rem; }
.qb-toc { margin: 1rem 0 2rem; }
.qb-toc a {
  display: inline-block;
  margin: 0.3rem 0.4rem;
  padding: 6px 14px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 500;
  transition: var(--transition);
}
.qb-toc a:hover { background: var(--primary-light); border-color: var(--primary); }
.qb-stats { display: flex; gap: 16px; flex-wrap: wrap; margin: 1rem 0 2rem; }
.qb-stat {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  text-align: center;
}
.qb-stat-num { font-size: 1.4rem; font-weight: 800; color: var(--primary); font-family: var(--font-head); }
.qb-stat-label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }

/* =================== AUTH GATE / LOGIN PROMPT =================== */
.auth-gate {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 40px;
  text-align: center;
  margin: 2rem 0;
}
.auth-gate h3 { margin-bottom: 8px; }
.auth-gate p { color: var(--text-secondary); margin-bottom: 20px; font-size: 0.9rem; }
.btn-google {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 28px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}
.btn-google:hover { box-shadow: var(--shadow-md); border-color: var(--border-hover); }
.btn-google img { width: 20px; height: 20px; }

/* =================== FOOTER =================== */
.site-footer {
  background: var(--bg-subtle);
  border-top: 1px solid var(--border);
  padding: 48px 0 32px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 32px;
}
.footer-brand { font-family: var(--font-head); font-weight: 800; font-size: 1.1rem; margin-bottom: 12px; color: var(--text); }
.footer-desc { color: var(--text-secondary); font-size: 0.85rem; line-height: 1.6; }
.footer-col h4 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); margin-bottom: 12px; font-weight: 600; }
.footer-col a { display: block; color: var(--text-secondary); font-size: 0.85rem; padding: 4px 0; }
.footer-col a:hover { color: var(--primary); }
.footer-bottom {
  padding-top: 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* =================== CONTACT PAGE =================== */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  margin-top: 32px;
}
.contact-form label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.contact-form input,
.contact-form textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.9rem;
  margin-bottom: 16px;
  outline: none;
  transition: var(--transition);
}
.contact-form input:focus,
.contact-form textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.contact-form textarea { resize: vertical; min-height: 120px; }

/* =================== REVEAL ANIMATION =================== */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s, transform 0.5s;
}
.reveal.in { opacity: 1; transform: translateY(0); }

/* =================== EYEBROW =================== */
.eyebrow {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--primary);
  display: block;
  margin-bottom: 8px;
}

/* =================== COPY PROTECTION (for question banks) =================== */
.protected-content {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}
.protected-content::selection { background: transparent; }

/* =================== WATERMARK =================== */
.watermark {
  position: fixed;
  bottom: 10px;
  right: 10px;
  font-size: 0.65rem;
  color: var(--text-muted);
  opacity: 0.3;
  pointer-events: none;
  z-index: 9999;
}

/* =================== MOBILE =================== */
@media (max-width: 768px) {
  .nav-links, .nav-cta { display: none; }
  .nav-toggle { display: flex; margin-left: auto; }
  .nav.open .nav-links {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(18, 22, 43, 0.96);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    padding: 16px 24px;
    box-shadow: var(--shadow-card);
  }
  .nav.open .nav-links a {
    color: var(--text-inverse) !important;
  }
  .nav.open .nav-cta {
    display: flex;
    position: absolute;
    top: calc(100% + 140px);
    left: 0;
    right: 0;
    padding: 0 24px 16px;
    background: rgba(18, 22, 43, 0.96);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-card);
  }
  .nav { position: relative; }

  .hero h1 { font-size: 2rem; }
  .hero-stats { gap: 24px; flex-wrap: wrap; }
  #subject-grid { grid-template-columns: 1fr; }
  #semesters-grid { grid-template-columns: 1fr; }
  .docs-grid { grid-template-columns: 1fr; margin-top: 16px; }
  .footer-grid { grid-template-columns: 1fr; gap: 24px; }
  .contact-grid { grid-template-columns: 1fr; }
  .header-sems-row { padding-bottom: 4px; }
  .filter-bar { flex-direction: column; }
  .filter-bar input { min-width: unset; width: 100%; }
}

@media (max-width: 480px) {
  .hero h1 { font-size: 1.7rem; }
  .container { padding: 0 16px; }
  .hero-actions { flex-direction: column; }
  .btn { width: 100%; justify-content: center; }
}

/* Unit Tabs & Syllabus Styling */
.unit-tabs-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}
.unit-tab-btn {
  border: none;
  background: var(--bg-muted);
  color: var(--text-secondary);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
  outline: none;
}
.unit-tab-btn:hover {
  background: var(--primary-light);
  color: var(--primary);
}
.unit-tab-btn.active {
  background: var(--primary);
  color: white !important;
}

@media (max-width: 768px) {
  .unit-tabs-grid {
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  }
  .unit-tab-btn {
    padding: 10px 12px;
    font-size: 0.8rem;
  }
}

/* =================== SPLIT READER LAYOUT =================== */
.split-reader {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 32px;
  align-items: start;
}
.split-reader:not(:has(.reader-sidebar)) {
  grid-template-columns: 1fr;
}
.reader-main {
  min-width: 0;
}
.reader-sidebar {
  position: sticky;
  top: 90px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
}
.sidebar-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  font-weight: 700;
}
.sidebar-title:first-child {
  margin-top: 0;
}
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sidebar-nav-link {
  display: block;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
  transition: var(--transition);
  cursor: pointer;
  border-left: 2px solid transparent;
}
.sidebar-nav-link:hover {
  background: var(--bg-muted);
  color: var(--primary);
}
.sidebar-nav-link.active {
  background: var(--primary-light);
  color: var(--primary);
  border-left-color: var(--primary);
  font-weight: 600;
}
.answer-section {
  display: none;
}
.answer-section.active {
  display: block;
  animation: fadeIn 0.2s ease-in-out;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (max-width: 992px) {
  .split-reader {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .reader-sidebar {
    position: static;
    max-height: none;
    overflow-y: visible;
    padding: 16px;
  }
  .sidebar-nav {
    flex-direction: row;
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 8px;
    -webkit-overflow-scrolling: touch;
  }
  .sidebar-nav-link {
    white-space: nowrap;
    border-left: none;
    border-bottom: 2px solid transparent;
    padding: 6px 12px;
    background: var(--bg-muted);
  }
  .sidebar-nav-link.active {
    border-bottom-color: var(--primary);
    background: var(--primary-light);
  }
  .sidebar-title {
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
  }
}

/* =================== UNIT TAB SELECTOR =================== */
.unit-selector-container {
  margin-bottom: 24px;
  width: 100%;
}
.unit-tabs {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  padding: 6px;
  border-radius: var(--radius-md);
  width: 100%;
}
@media (max-width: 640px) {
  .unit-tabs {
    grid-template-columns: repeat(3, 1fr);
  }
  .unit-tabs .unit-tab-btn {
    padding: 8px 6px;
    font-size: 0.75rem;
  }
  .reader-body table {
    font-size: 0.82rem;
    table-layout: auto;
  }
  .reader-body th, .reader-body td {
    padding: 8px 10px;
  }
  .reader-body h2 {
    font-size: 1.1rem;
    margin-top: 2rem;
  }
  .reader-layout {
    padding-left: 16px;
    padding-right: 16px;
  }
}

/* =================== READER TABLE RESPONSIVE WRAPPER =================== */
.reader-body .table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1rem 0;
  border-radius: var(--radius-sm);
}
.reader-body .table-wrap table {
  margin: 0;
  min-width: 400px;
}

/* Q/Marks two-column question header */
.reader-body table tr td:last-child:not(:only-child) {
  white-space: nowrap;
  width: 1%;
  text-align: right;
  vertical-align: top;
  color: var(--primary);
}

/* Reader footer styling */
.reader-footer {
  margin-top: 40px;
  border-top: 2px solid var(--primary-light);
  padding-top: 24px;
}
.reader-footer table tr:only-child td:only-child {
  border-left-color: var(--accent);
  background: var(--accent-light);
}
.reader-footer table tr:only-child td:only-child p:first-child strong {
  color: var(--accent);
}

/* Gating and Login Removal overrides */
.nav-cta {
  display: none !important;
}
.site-footer a[href*="googlesignon.html"],
.site-footer a[href*="userregistration.html"] {
  display: none !important;
}
.gate-lock {
  display: none !important;
}
