/* StudyHelper Hub - Main Stylesheet */

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

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #eff6ff;
  --accent: #f59e0b;
  --accent-light: #fffbeb;
  --text: #1e293b;
  --text-muted: #64748b;
  --bg: #f8fafc;
  --surface: #ffffff;
  --border: #e2e8f0;
  --success: #10b981;
  --radius: 10px;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-hover: 0 6px 24px rgba(37,99,235,0.15);
  --max-width: 900px;
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

body {
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
}

/* ── Navigation ── */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 6px rgba(0,0,0,0.06);
}

.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.logo {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  letter-spacing: -0.3px;
}

.logo span {
  color: var(--accent);
}

nav {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
}

nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.35rem 0.7rem;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}

nav a:hover,
nav a.active {
  background: var(--primary-light);
  color: var(--primary);
}

.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.4rem;
  flex-direction: column;
  gap: 5px;
}

.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.25s, opacity 0.25s;
}

/* Hide dropdowns — higher specificity beats any stray override */
.nav-group .nav-dropdown {
  display: none !important;
}
.nav-group.open .nav-dropdown {
  display: block !important;
}

/* Animate hamburger to X when nav is open */
.hamburger.active span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.hamburger.active span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}
.hamburger.active span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ── Layout ── */
main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

/* ── Hero ── */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, #3b82f6 100%);
  color: #fff;
  padding: 3.5rem 1.25rem;
  text-align: center;
}

.hero-inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

.hero h1 {
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 0.75rem;
}

.hero p {
  font-size: 1.1rem;
  opacity: 0.9;
  max-width: 560px;
  margin: 0 auto 1.75rem;
}

.btn {
  display: inline-block;
  background: var(--accent);
  color: #1a1a1a;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.7rem 1.6rem;
  border-radius: var(--radius);
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(245,158,11,0.4);
}

.btn-outline {
  background: transparent;
  border: 2px solid rgba(255,255,255,0.7);
  color: #fff;
  margin-left: 0.75rem;
}

.btn-outline:hover {
  background: rgba(255,255,255,0.15);
  box-shadow: none;
}

/* ── Cards ── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.25rem;
  margin-top: 2rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-decoration: none;
  color: var(--text);
  transition: box-shadow 0.2s, transform 0.2s;
  display: block;
}

.card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-3px);
}

.card-icon {
  font-size: 2rem;
  margin-bottom: 0.75rem;
  display: block;
}

.card h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
  color: var(--primary);
}

.card p {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ── Page headers ── */
.page-header {
  background: var(--primary-light);
  border-left: 4px solid var(--primary);
  padding: 1.5rem 1.75rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin-bottom: 2.5rem;
}

.page-header h1 {
  font-size: clamp(1.5rem, 4vw, 2.1rem);
  font-weight: 800;
  color: var(--primary-dark);
  margin-bottom: 0.4rem;
}

.page-header p {
  color: var(--text-muted);
  font-size: 1rem;
}

/* ── Content typography ── */
h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  margin: 2rem 0 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--border);
}

h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin: 1.5rem 0 0.5rem;
}

p {
  margin-bottom: 1rem;
}

ul, ol {
  padding-left: 1.4rem;
  margin-bottom: 1rem;
}

li {
  margin-bottom: 0.4rem;
}

/* ── Callout / info boxes ── */
.callout {
  background: var(--primary-light);
  border-left: 4px solid var(--primary);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 1rem 1.25rem;
  margin: 1.25rem 0;
  font-size: 0.95rem;
}

.callout.warning {
  background: var(--accent-light);
  border-color: var(--accent);
}

.callout.success {
  background: #f0fdf4;
  border-color: var(--success);
}

.callout strong {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--primary);
}

.callout.warning strong { color: #92400e; }
.callout.success strong { color: #065f46; }

/* ── ASCII / Code blocks ── */
pre, .diagram {
  background: #1e293b;
  color: #e2e8f0;
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius);
  overflow-x: auto;
  font-family: 'Cascadia Code', 'Fira Code', 'Courier New', monospace;
  font-size: 0.85rem;
  line-height: 1.6;
  margin: 1.25rem 0;
}

code {
  background: #f1f5f9;
  color: var(--primary-dark);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.875em;
  font-family: 'Cascadia Code', 'Fira Code', monospace;
}

/* ── Example boxes ── */
.example-box {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin: 1.25rem 0;
}

.example-box h4 {
  color: #065f46;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.75rem;
  font-weight: 700;
}

/* ── Tables ── */
table, .data-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.25rem 0;
  font-size: 0.9rem;
}

th {
  background: var(--primary);
  color: #fff;
  text-align: left;
  padding: 0.65rem 1rem;
  font-weight: 600;
}

td {
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border);
}

tr:nth-child(even) td {
  background: var(--bg);
}

/* ── Calculator ── */
.calculator {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
  max-width: 640px;
  margin: 0 auto;
}

.calc-course-row {
  display: grid;
  grid-template-columns: 1fr 90px 90px 36px;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
  align-items: center;
}

.calc-course-row input,
.calc-course-row select {
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
  font-family: var(--font);
  color: var(--text);
  background: var(--surface);
  width: 100%;
}

.calc-course-row input:focus,
.calc-course-row select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.calc-labels {
  display: grid;
  grid-template-columns: 1fr 90px 90px 36px;
  gap: 0.5rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 0.4rem;
}

.btn-remove {
  background: #fee2e2;
  color: #dc2626;
  border: none;
  border-radius: 6px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: 700;
  transition: background 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-remove:hover {
  background: #fca5a5;
}

.calc-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 0.65rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
  transition: background 0.15s;
}

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

.btn-secondary {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.65rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
  transition: background 0.15s;
}

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

.gpa-result {
  margin-top: 1.5rem;
  padding: 1.5rem;
  background: var(--primary-light);
  border-radius: var(--radius);
  text-align: center;
  display: none;
}

.gpa-result.visible {
  display: block;
}

.gpa-number {
  font-size: 3rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
  margin: 0.25rem 0;
}

.gpa-label {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.gpa-verdict {
  margin-top: 0.75rem;
  font-weight: 600;
  font-size: 1rem;
}

/* ── FAQ ── */
details {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
  overflow: hidden;
}

summary {
  padding: 1rem 1.25rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface);
  user-select: none;
}

summary::-webkit-details-marker {
  display: none;
}

summary::after {
  content: '+';
  font-size: 1.3rem;
  color: var(--primary);
  font-weight: 400;
  transition: transform 0.2s;
  flex-shrink: 0;
  margin-left: 1rem;
}

details[open] summary::after {
  content: '\2212';
}

details[open] summary {
  border-bottom: 1px solid var(--border);
}

.faq-answer {
  padding: 1rem 1.25rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  background: var(--bg);
  line-height: 1.65;
}

/* ── Glossary ── */
.glossary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.5rem;
  margin: 1.25rem 0;
}

.glossary-letter {
  background: var(--primary);
  color: #fff;
  text-align: center;
  padding: 0.4rem;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.85rem;
  text-decoration: none;
  transition: background 0.15s;
}

.glossary-letter:hover {
  background: var(--primary-dark);
}

.glossary-section {
  margin: 2rem 0;
}

.glossary-section h2 {
  color: var(--primary);
  font-size: 1.5rem;
}

.term-item {
  border-bottom: 1px solid var(--border);
  padding: 0.85rem 0;
}

.term-name {
  font-weight: 700;
  color: var(--text);
  font-size: 0.95rem;
}

.term-def {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-top: 0.2rem;
}

/* ── Contact form ── */
.contact-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
  max-width: 580px;
}

.form-group {
  margin-bottom: 1.2rem;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.4rem;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
  font-family: var(--font);
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.form-group textarea {
  min-height: 130px;
  resize: vertical;
}

.form-success {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #065f46;
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  font-weight: 600;
  display: none;
}

/* ── Stats strip ── */
.stats-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 2.5rem 0;
}

.stat-item {
  padding: 1.5rem 1.25rem;
  text-align: center;
  border-right: 1px solid var(--border);
}

.stat-item:last-child {
  border-right: none;
}

.stat-number {
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* ── Study tips grid ── */
.tips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.tip-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.tip-card h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 0.4rem;
}

.tip-card p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0;
}

/* ── Footer ── */
footer {
  background: var(--text);
  color: #94a3b8;
  margin-top: 4rem;
}

.footer-simple {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  text-align: center;
}

.footer-simple .logo {
  font-size: 1rem;
  color: #fff;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.25rem 1.5rem;
}

.footer-nav a {
  color: #94a3b8;
  text-decoration: none;
  font-size: 0.875rem;
  transition: color 0.15s;
}

.footer-nav a:hover {
  color: #fff;
}

.footer-copy {
  font-size: 0.8rem;
  color: #64748b;
  margin: 0;
}

/* ── Back button ── */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.3rem 0;
  margin-bottom: 0.25rem;
  transition: color 0.15s;
  cursor: pointer;
  background: none;
  border: none;
}
.back-btn:hover { color: var(--primary); }

/* ── Quiz ── */
.quiz-section {
  background: var(--surface);
  border: 2px solid var(--primary);
  border-radius: var(--radius);
  padding: 2rem 2rem 1.5rem;
  margin: 3rem 0 2rem;
}

.quiz-section > h2 {
  font-size: 1.25rem;
  color: var(--primary);
  margin: 0 0 0.25rem;
  padding: 0;
  border: none;
}

.quiz-section > p {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
}

.qq { margin-bottom: 1.5rem; }

.qq-text {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.65rem;
  line-height: 1.5;
}

.qq-num {
  color: var(--primary);
  margin-right: 0.35rem;
}

.qq-opts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.qq-opt {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.9rem;
  font-size: 0.875rem;
  font-family: var(--font);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: background 0.12s, border-color 0.12s;
  line-height: 1.4;
}

.qq-opt:hover:not(:disabled) {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

.qq-opt:disabled { cursor: default; }

.qq-opt.qq-correct {
  background: #f0fdf4;
  border-color: var(--success);
  color: #065f46;
  font-weight: 600;
}

.qq-opt.qq-wrong {
  background: #fef2f2;
  border-color: #ef4444;
  color: #b91c1c;
}

.qq-exp {
  font-size: 0.85rem;
  border-radius: 6px;
  padding: 0.6rem 0.9rem;
  margin-top: 0.6rem;
  line-height: 1.5;
}

.qq-exp-ok {
  background: #f0fdf4;
  color: #065f46;
  border-left: 3px solid var(--success);
}

.qq-exp-no {
  background: #fef2f2;
  color: #b91c1c;
  border-left: 3px solid #ef4444;
}

.quiz-score {
  text-align: center;
  padding: 1.5rem;
  background: var(--primary-light);
  border-radius: var(--radius);
  margin-top: 1rem;
}

.quiz-score-ring {
  font-size: 3rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
  margin-bottom: 0.5rem;
}

.quiz-score-ring span {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-muted);
}

.quiz-score-msg {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 1rem;
  color: var(--text);
}

.quiz-retry {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 0.6rem 1.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
  transition: background 0.15s;
}

.quiz-retry:hover { background: var(--primary-dark); }

@media (max-width: 680px) {
  .qq-opts { grid-template-columns: 1fr; }
  .quiz-section { padding: 1.25rem 1rem 1rem; }
  .quiz-score-ring { font-size: 2.2rem; }
}

/* ── Scroll progress bar ── */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0;
  background: var(--accent);
  z-index: 9999;
  transition: width 0.1s linear;
  pointer-events: none;
}

/* ── Back-to-top button ── */
.back-top {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 2.8rem;
  height: 2.8rem;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 1.4rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(37,99,235,0.35);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  z-index: 500;
}
.back-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.back-top:hover {
  background: var(--primary-dark);
}

/* ── Breadcrumb ── */
.breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  padding: 0.6rem 0;
}
.breadcrumb a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}
.breadcrumb a:hover { text-decoration: underline; }
.bc-sep { opacity: 0.5; }
.bc-cat { font-weight: 500; }
.bc-current { color: var(--text); font-weight: 600; }

/* ── Prev / Next navigation ── */
.page-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 2px solid var(--border);
  flex-wrap: wrap;
}
.pn-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.65rem 1.1rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
  transition: background 0.15s, box-shadow 0.15s, transform 0.15s;
}
.pn-btn:hover {
  background: var(--primary-light);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}
.pn-next { margin-left: auto; }

/* ── Prevent horizontal scroll globally ── */
html, body {
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

/* ── Responsive: mobile (≤ 680px) ── */
@media (max-width: 680px) {

  /* --- Nav --- */
  .hamburger {
    display: flex;
  }

  .nav-inner {
    justify-content: space-between;
    padding: 0 1rem;
  }

  header nav {
    display: none;
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 0.5rem 0 2rem;
    flex-direction: column;
    gap: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    z-index: 200;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  }

  header nav.open {
    display: flex;
  }

  .nav-group {
    width: 100%;
    border-bottom: 1px solid var(--border);
  }

  .nav-cat {
    display: flex;
    width: 100%;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    background: none;
    border: none;
    border-radius: 0;
    min-height: 48px;
    cursor: pointer;
    font-family: var(--font);
  }

  .nav-cat:hover, .nav-cat.active {
    background: var(--primary-light);
    color: var(--primary);
  }

  .nav-group.open .nav-cat {
    background: var(--primary-light);
    color: var(--primary);
  }

  .nav-group.open .nav-caret {
    transform: rotate(180deg);
  }

  .nav-dropdown {
    position: static;
    transform: none;
    box-shadow: none;
    border: none;
    border-radius: 0;
    background: var(--bg);
    padding: 0.25rem 0 0.5rem 0;
    min-width: unset;
  }

  .nav-dropdown a {
    padding: 0.8rem 1.75rem;
    font-size: 0.95rem;
    border-radius: 0;
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  .nav-grade-label {
    padding: 0.5rem 1.25rem 0.2rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    margin-top: 0.2rem;
    display: block;
    cursor: default;
    pointer-events: none;
  }

  .nav-grade-label:first-child {
    border-top: none;
  }

  header nav > a {
    padding: 1rem 1.25rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    min-height: 48px;
    display: flex;
    align-items: center;
  }

  /* --- Hero --- */
  .hero {
    padding: 2.75rem 1.25rem 2.25rem;
  }

  .hero h1 {
    font-size: 1.7rem;
  }

  .hero p {
    font-size: 1rem;
  }

  .btn {
    display: block;
    text-align: center;
    margin-bottom: 0.6rem;
  }

  .btn-outline {
    display: block;
    text-align: center;
    margin-left: 0;
  }

  /* --- Layout --- */
  main {
    padding: 1.25rem 1rem 3rem;
  }

  /* --- Typography --- */
  h2 { font-size: 1.2rem; margin: 1.75rem 0 0.75rem; }
  h3 { font-size: 1rem; margin: 1.25rem 0 0.5rem; }

  /* --- Page header --- */
  .page-header {
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    border-radius: 0 6px 6px 0;
  }

  .page-header h1 { font-size: 1.35rem; }
  .page-header p  { font-size: 0.9rem; }

  /* --- Breadcrumb --- */
  .breadcrumb {
    font-size: 0.78rem;
    margin-bottom: 1rem;
  }

  /* --- Tables: horizontal scroll --- */
  .table-wrap, table {
    display: block;
    width: 100%;    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    font-size: 0.83rem;
  }

  th, td {
    padding: 0.5rem 0.75rem;
    white-space: nowrap;
  }

  /* --- Code / pre blocks --- */
  pre, .diagram {
    font-size: 0.72rem;
    padding: 0.9rem 1rem;
    margin: 1rem 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* --- Callout / example boxes --- */
  .callout   { padding: 0.9rem 1rem; margin: 1rem 0; }
  .example-box { padding: 1rem; margin: 1rem 0; }

  /* --- Cards & grids --- */
  .card-grid     { grid-template-columns: 1fr; gap: 0.75rem; }
  .tips-grid     { grid-template-columns: 1fr; gap: 0.75rem; }
  .subject-grid  { grid-template-columns: 1fr; gap: 0.75rem; }
  .how-grid      { grid-template-columns: 1fr; gap: 0.75rem; }

  .card          { padding: 1.25rem; }
  .tip-card      { padding: 1rem; }
  .subject-card  { padding: 1.25rem; }

  /* --- Stats strip --- */
  .stats-strip {
    grid-template-columns: repeat(2, 1fr);
    margin: 1.5rem 0;
  }
  .stat-item { padding: 1.25rem 1rem; }
  .stat-item:nth-child(even) { border-right: none; }
  .stat-number { font-size: 1.7rem; }

  /* --- GPA calculator --- */
  .calc-course-row {
    grid-template-columns: 1fr 70px 68px 34px;
    gap: 0.35rem;
    font-size: 0.82rem;
  }

  .calc-labels {
    grid-template-columns: 1fr 70px 68px 34px;
    gap: 0.35rem;
    font-size: 0.7rem;
  }

  .calculator { padding: 1.25rem; }

  /* --- FAQ --- */
  summary { padding: 0.85rem 1rem; font-size: 0.9rem; }
  .faq-answer { padding: 0.85rem 1rem; }

  /* --- Prev / Next --- */
  .page-nav {
    flex-direction: column;
    gap: 0.6rem;
    margin-top: 2rem;
    padding-top: 1.25rem;
  }

  .pn-btn {
    width: 100%;
    justify-content: center;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
  }

  .pn-next { margin-left: 0; }

  /* --- Back-to-top --- */
  .back-top {
    bottom: 1rem;
    right: 1rem;
    width: 2.4rem;
    height: 2.4rem;
    font-size: 1.1rem;
  }

  /* --- Footer --- */
  .footer-simple { padding: 1.5rem 1rem; }
}

/* ── Very small phones (≤ 380px) ── */
@media (max-width: 380px) {
  .logo { font-size: 1rem; }
  .stats-strip { grid-template-columns: 1fr 1fr; }
  .footer-inner { grid-template-columns: 1fr; }
  h2 { font-size: 1.1rem; }
  .page-header h1 { font-size: 1.2rem; }
  pre { font-size: 0.65rem; }
}

/* ── Hero: more breathing room from the top (desktop only) ── */
@media (min-width: 681px) {
  .hero {
    padding: 5.5rem 1.25rem 4.5rem;
  }

  main {
    padding: 2.75rem 1.5rem 5.5rem;
  }

  .page-header {
    padding: 2rem 2.25rem;
    margin-bottom: 3rem;
  }
}


/* ── Logo icon ── */
.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.logo-icon {
  flex-shrink: 0;
  opacity: 0.92;
  margin-top: -1px;
}

/* ── Spacing improvements ── */
body {
  line-height: 1.8;
}

p {
  margin-bottom: 1.2rem;
}

li {
  margin-bottom: 0.55rem;
}

ul, ol {
  margin-bottom: 1.25rem;
}

h2 {
  margin: 2.75rem 0 1rem;
}

h3 {
  margin: 2rem 0 0.7rem;
  font-size: 1.15rem;
}

.card {
  padding: 1.875rem;
}

.callout {
  padding: 1.25rem 1.6rem;
  margin: 1.75rem 0;
}

.example-box {
  padding: 1.5rem 1.75rem;
  margin: 1.75rem 0;
}

pre, .diagram {
  padding: 1.5rem 1.75rem;
  margin: 1.75rem 0;
}

table {
  margin: 1.75rem 0;
}

details {
  margin-bottom: 1.1rem;
}

summary {
  padding: 1.1rem 1.4rem;
}

.faq-answer {
  padding: 1.1rem 1.4rem;
  line-height: 1.75;
}

.tip-card {
  padding: 1.5rem;
}

.stats-strip {
  margin: 3rem 0;
}

.stat-item {
  padding: 1.75rem 1.5rem;
}

.stat-number {
  font-size: 2.2rem;
}

/* ── Home page: subject cards ── */
.subject-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.25rem;
  margin: 2rem 0 3rem;
}

.subject-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  transition: box-shadow 0.2s, transform 0.2s;
}

.subject-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.subject-icon {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 0.75rem;
  line-height: 1;
}

.subject-card h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.subject-card p {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  line-height: 1.55;
}

.subject-link {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
  transition: color 0.15s;
}

.subject-link:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

/* ── Home page: how it works ── */
.how-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
  margin: 1.5rem 0 2rem;
}

.how-step {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.how-number {
  width: 2.2rem;
  height: 2.2rem;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1rem;
  flex-shrink: 0;
}

.how-step h4 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.how-step p {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.55;
}

/* ── Google search box ── */
.google-search-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem 2.25rem 2rem;
  margin: 3rem 0;
  box-shadow: var(--shadow);
  max-width: 700px;
}

.google-search-header {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-bottom: 1.4rem;
}

.google-wordmark {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1;
}

.google-search-header small {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.google-input-wrap {
  display: flex;
  align-items: center;
  border: 1.5px solid #dadce0;
  border-radius: 50px;
  padding: 0 0.5rem 0 1.25rem;
  gap: 0.6rem;
  transition: box-shadow 0.2s, border-color 0.2s;
  background: var(--surface);
}

.google-input-wrap:focus-within {
  border-color: transparent;
  box-shadow: 0 1px 6px rgba(32,33,36,0.28);
}

.google-input-wrap .mag-icon {
  color: #9aa0a6;
  flex-shrink: 0;
}

.google-input-wrap input[type="text"] {
  flex: 1;
  border: none;
  outline: none;
  padding: 0.8rem 0;
  font-size: 1rem;
  font-family: var(--font);
  color: var(--text);
  background: transparent;
  min-width: 0;
}

.google-input-wrap input[type="text"]::placeholder {
  color: #9aa0a6;
}

.google-search-submit {
  background: #4285F4;
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 0.6rem 1.35rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  font-family: var(--font);
  transition: background 0.15s, box-shadow 0.15s;
  flex-shrink: 0;
}

.google-search-submit:hover {
  background: #1a73e8;
  box-shadow: 0 2px 8px rgba(66,133,244,0.4);
}

/* ── Nav: dropdown layout (desktop only) ── */
@media (min-width: 681px) {
  .nav-inner {
    display: flex;
    align-items: center;
    height: 60px;
    gap: 0;
  }

  nav {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.1rem;
    flex-wrap: nowrap;
  }

  nav a {
    white-space: nowrap;
  }

  .logo {
    flex-shrink: 0;
    white-space: nowrap;
  }

  /* Dropdown groups */
  .nav-group {
    position: relative;
  }

  .nav-cat {
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--font);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    padding: 0.35rem 0.7rem;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
  }

  .nav-cat:hover,
  .nav-cat.active {
    background: var(--primary-light);
    color: var(--primary);
  }

  .nav-caret {
    font-size: 0.65rem;
    transition: transform 0.2s;
    opacity: 0.7;
  }

  .nav-group.open .nav-caret {
    transform: rotate(180deg);
  }

  .nav-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 6px 24px rgba(0,0,0,0.11);
    min-width: 190px;
    z-index: 200;
    padding: 0.4rem 0;
    max-height: 75vh;
    overflow-y: auto;
  }

  .nav-dropdown a {
    display: block;
    padding: 0.55rem 1.1rem;
    color: var(--text);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 0;
    white-space: nowrap;
    transition: background 0.1s, color 0.1s;
    background: none;
  }

  .nav-dropdown a:hover,
  .nav-dropdown a.active {
    background: var(--primary-light);
    color: var(--primary);
  }

  .nav-grade-label {
    display: block;
    padding: 0.45rem 1.1rem 0.2rem;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    margin-top: 0.2rem;
    cursor: default;
    pointer-events: none;
  }

  .nav-grade-label:first-child {
    border-top: none;
    margin-top: 0;
  }
}
.contact-form {
  padding: 2.5rem;
  margin-bottom: 0.5rem;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  margin-bottom: 0.55rem;
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 0.7rem 1rem;
}

.form-group textarea {
  min-height: 160px;
}

.form-success {
  padding: 1.25rem 1.5rem;
  font-size: 0.95rem;
  line-height: 1.65;
}
