/* ============================================================
   Nursing Archives — Serif Editorial Design System
   ============================================================ */

:root {
  /* Color tokens */
  --background: #FAFAF8;
  --foreground: #1A1A1A;
  --muted: #F5F3F0;
  --muted-foreground: #6B6B6B;
  --accent: #B8860B;
  --accent-secondary: #D4A84B;
  --accent-foreground: #FFFFFF;
  --accent-muted: rgba(184, 134, 11, 0.06);
  --border: #E8E4DF;
  --border-hover: #C9C2BA;
  --card: #FFFFFF;

  /* Type */
  --font-display: "Playfair Display", Georgia, serif;
  --font-body: "Source Sans 3", system-ui, -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(26, 26, 26, 0.04);
  --shadow-md: 0 4px 12px rgba(26, 26, 26, 0.06);
  --shadow-lg: 0 8px 24px rgba(26, 26, 26, 0.08);

  /* Misc */
  --radius: 8px;
  --radius-sm: 6px;
  --transition: 200ms ease-out;
  --container: 64rem;
}

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

[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

body {
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-body);
  font-size: 1rem;
  letter-spacing: 0.01em;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* ---------- Atmosphere ---------- */
.paper-texture {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.3;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.12'/%3E%3C/svg%3E");
}
.ambient-glow {
  position: fixed;
  top: -18rem;
  right: -14rem;
  width: 38rem;
  height: 38rem;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(184, 134, 11, 0.05), transparent 65%);
  pointer-events: none;
  z-index: 0;
}

main, .site-header { position: relative; z-index: 1; }

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: 1.5rem;
}

@media (min-width: 768px) { .container { padding-inline: 2.5rem; } }

/* ---------- Small caps label pattern ---------- */
.section-label {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.75rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
}
.label-line { height: 1px; flex: 1; background: var(--border); }

/* ---------- Headings ---------- */
.section-title {
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 4vw, 2.5rem);
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.2;
  margin-bottom: 2.5rem;
}
.section-title em, .hero-title em { font-style: italic; color: var(--accent); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.65rem 1.5rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition);
  touch-action: manipulation;
  white-space: nowrap;
}
.btn:focus-visible, .input:focus-visible, select.input:focus-visible,
.tab:focus-visible, .subject-card:focus-visible, .nav-links a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-foreground);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { background: var(--accent-secondary); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.btn-outline {
  background: transparent;
  border-color: var(--foreground);
  color: var(--foreground);
}
.btn-outline:hover { background: var(--muted); border-color: var(--accent); color: var(--accent); }

.btn-ghost {
  background: transparent;
  color: var(--muted-foreground);
}
.btn-ghost:hover { color: var(--foreground); }
.btn-ghost:hover::after { width: 100%; }
.btn-ghost::after {
  content: "";
  display: block;
  height: 1px;
  width: 0;
  margin-top: 2px;
  background: var(--accent);
  transition: width var(--transition);
}

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-foreground);
  padding: 0.6rem 1rem;
  z-index: 100;
  border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { left: 0; }

/* ============================================================
   Header
   ============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(250, 250, 248, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 4.25rem;
}
.wordmark { display: inline-flex; flex-direction: column; gap: 0.3rem; text-decoration: none; }
.wordmark-name {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--foreground);
  line-height: 1.1;
}
.wordmark-name em { font-style: italic; color: var(--accent); font-weight: 500; }
.wordmark-rule { height: 1px; width: 100%; background: var(--accent); }

.nav-links {
  display: none;
  align-items: center;
  gap: 1.75rem;
}
.nav-links a {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-foreground);
  text-decoration: none;
  padding: 0.5rem 0.1rem;
  border-bottom: 1px solid transparent;
  transition: color var(--transition), border-color var(--transition);
}
.nav-links a:hover { color: var(--foreground); border-bottom-color: var(--accent); }
.nav-links a.active { color: var(--accent); border-bottom-color: var(--accent); }

.nav-toggle {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  align-items: center;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.nav-toggle-bar { display: block; width: 18px; height: 1.5px; background: var(--foreground); transition: transform var(--transition), opacity var(--transition); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) { transform: translateY(3.25px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) { transform: translateY(-3.25px) rotate(-45deg); }

@media (min-width: 900px) {
  .nav-links { display: flex; }
  .nav-toggle { display: none; }
}
@media (max-width: 899.98px) {
  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--background);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    padding: 0.5rem 1.5rem 1rem;
  }
  .nav-links.nav-open { display: flex; }
  .nav-links a { padding: 0.85rem 0.1rem; border-bottom: 1px solid var(--border); }
  .nav-links a:last-child { border-bottom: none; }
}

/* ============================================================
   Hero
   ============================================================ */
.hero { padding: 5.5rem 0 4rem; }
@media (min-width: 768px) { .hero { padding: 7.5rem 0 6rem; } }

.hero-inner {
  max-width: 46rem;
  margin-inline: auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 7vw, 4.5rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.08;
  margin-bottom: 1.75rem;
}
.hero-lede {
  max-width: 40rem;
  color: var(--muted-foreground);
  font-size: 1.06rem;
  line-height: 1.8;
  margin-bottom: 2.75rem;
}
.hero-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2rem 1rem;
  width: 100%;
  max-width: 42rem;
  padding: 2.25rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 2.75rem;
}
@media (min-width: 768px) { .hero-stats { grid-template-columns: repeat(4, 1fr); gap: 1rem; } }
.stat { display: flex; flex-direction: column; gap: 0.15rem; }
.stat-num {
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 4vw, 2.6rem);
  font-weight: 500;
  color: var(--accent);
  line-height: 1.15;
}
.stat-label {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted-foreground);
}
.hero-cta { display: flex; flex-wrap: wrap; justify-content: center; gap: 1rem; }
.hero-cta .btn-ghost { min-height: 44px; }

/* ============================================================
   How it works (landing)
   ============================================================ */
.how { padding: 3rem 0 5rem; }
.how-grid { display: grid; gap: 2rem; }
@media (min-width: 768px) { .how-grid { grid-template-columns: repeat(3, 1fr); gap: 3rem; } }
.how-item { border-top: 1px solid var(--border); padding-top: 1.25rem; }
.how-num { font-family: var(--font-display); font-size: 1.5rem; color: var(--accent); }
.how-title { font-family: var(--font-display); font-size: 1.15rem; font-weight: 600; margin: 0.55rem 0 0.35rem; }
.how-text { color: var(--muted-foreground); font-size: 0.95rem; }
.how-text em { font-style: italic; color: var(--foreground); }

/* ============================================================
   Subjects
   ============================================================ */
.subjects { padding: 3rem 0 6rem; }
@media (min-width: 768px) { .subjects { padding: 4rem 0 7rem; } }

.subject-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.75rem;
}
@media (min-width: 640px) { .subject-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .subject-grid { grid-template-columns: repeat(3, 1fr); } }

.subject-card {
  display: block;
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-top: 2px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.75rem 1.75rem 1.5rem;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: all var(--transition);
  overflow: hidden;
}
.subject-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-hover);
  background: var(--muted);
}
.subject-code {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.9rem;
}
.subject-name {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 1.1rem;
}
.subject-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.count-chip {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-foreground);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.22rem 0.6rem;
  background: var(--background);
}
.subject-arrow {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  color: var(--accent);
  opacity: 0;
  transform: translateX(-6px);
  transition: all var(--transition);
}
.subject-card:hover .subject-arrow { opacity: 1; transform: translateX(0); }

/* ---------- Skeletons ---------- */
.skeleton-card {
  height: 190px;
  background:
    linear-gradient(100deg, transparent 40%, rgba(26,26,26,0.05) 50%, transparent 60%)
    var(--card);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite linear;
  border: 1px solid var(--border);
  border-top: 2px solid var(--border);
  border-radius: var(--radius);
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ============================================================
   Subject hero (per-subject pages)
   ============================================================ */
.subject-hero { padding: 4.5rem 0 1.5rem; text-align: center; }
@media (min-width: 768px) { .subject-hero { padding: 6rem 0 2rem; } }
.subject-hero .section-label { max-width: 40rem; margin-inline: auto; }
.subject-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: 0.75rem;
}
.subject-meta {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-foreground);
}

/* ============================================================
   Browser
   ============================================================ */
.browser { padding: 3rem 0 6rem; }
.browser-head { margin-bottom: 2rem; }
.browser-subject {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
}
.browser-subject .browser-code {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin-left: 0.5rem;
  vertical-align: middle;
}
.browser-meta {
  margin-top: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-foreground);
}

/* ---------- Tabs ---------- */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs-primary { margin-bottom: 0.75rem; }
.tabs-primary .tab { font-size: 0.78rem; }
.tab {
  appearance: none;
  background: none;
  border: none;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted-foreground);
  padding: 0.85rem 0.9rem 0.75rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color var(--transition), border-color var(--transition);
  white-space: nowrap;
  touch-action: manipulation;
  border-radius: 0;
}
.tab:hover { color: var(--foreground); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab .tab-count { opacity: 0.75; margin-left: 0.3rem; font-size: 0.62rem; }

/* ---------- Toolbar ---------- */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.search-field { position: relative; flex: 1 1 16rem; min-width: 12rem; }
.search-icon {
  position: absolute;
  left: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted-foreground);
  pointer-events: none;
}
.input {
  width: 100%;
  height: 44px;
  padding: 0.55rem 1rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--foreground);
  font-family: var(--font-body);
  font-size: 0.95rem;
  transition: all 150ms ease-out;
  appearance: none;
}
.input::placeholder { color: rgba(107, 107, 107, 0.6); }
.input:hover { border-color: var(--border-hover); }
.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(184, 134, 11, 0.25);
  background: var(--card);
}
.search-field .input { padding-left: 2.4rem; }
.select {
  flex: 0 1 auto;
  min-width: 11rem;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B6B6B' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.9rem center;
  padding-right: 2.2rem;
}

/* ---------- Summary line ---------- */
.browser-summary {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-foreground);
  margin-bottom: 1.75rem;
  min-height: 1.2rem;
}
.browser-summary strong { color: var(--accent); font-weight: 500; }

/* ---------- Question list ---------- */
.question-list { display: flex; flex-direction: column; gap: 1.25rem; }

/* ---------- Section headlines (EQ / SAQ / True-False / Best Answer) ---------- */
.section-headline {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 0.5rem 0 0.25rem;
}
.section-headline:first-child { margin-top: 0; }
.section-headline::before,
.section-headline::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--border);
}
.section-headline-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  white-space: nowrap;
}

/* ============================================================
   Question card
   ============================================================ */
.question-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.75rem 1.5rem;
  transition: box-shadow var(--transition), border-color var(--transition);
  content-visibility: auto;
  contain-intrinsic-size: auto 300px;
}
@media (min-width: 768px) { .question-card { padding: 2.25rem 2.5rem; } }
.question-card:hover { box-shadow: var(--shadow-md); border-color: var(--border-hover); }

.question-text {
  font-family: var(--font-body);
  font-size: 1.05rem;
  line-height: 1.75;
  letter-spacing: 0.01em;
  white-space: pre-wrap;
  margin-bottom: 0.35rem;
}
.question-text-mcq {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}
.question-text-mcq .q-text { flex: 1; min-width: 0; }
.question-text-mcq .q-hints { flex: 0 0 auto; }
.question-variant {
  font-size: 0.9rem;
  font-style: italic;
  color: var(--muted-foreground);
  border-left: 2px solid var(--accent-secondary);
  padding-left: 0.9rem;
  margin: 0.6rem 0 0.2rem;
}

/* ---------- Options ---------- */
.options { list-style: none; margin-top: 1.25rem; display: flex; flex-direction: column; gap: 0.5rem; }
.option {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.9rem;
  background: var(--background);
  transition: all var(--transition);
}
.option-key {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-foreground);
  flex: 0 0 1.1rem;
}
.option-text { flex: 1; font-size: 0.97rem; }
.option-mark {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  opacity: 0;
  transform: scale(0.7);
  transition: all var(--transition);
}

/* Answers always shown */
.option.correct {
  border-color: var(--accent);
  background: var(--accent-muted);
  box-shadow: inset 3px 0 0 var(--accent);
}
.option.correct .option-key { color: var(--accent); }
.option.correct .option-mark { opacity: 1; transform: scale(1); color: var(--accent); }
.option:not(.correct) .option-mark { opacity: 1; transform: scale(1); color: var(--muted-foreground); }

/* ---------- Essay answer notes ---------- */
.answer-notes { margin-top: 1.25rem; }
.answer-notes textarea {
  width: 100%;
  min-height: 76px;
  resize: vertical;
  background: var(--background);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.9rem;
  font-family: var(--font-body);
  font-size: 0.92rem;
  color: var(--foreground);
  transition: border-color var(--transition);
}
.answer-notes textarea:focus { outline: none; border-color: var(--accent); border-style: solid; }
.answer-notes-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted-foreground);
  margin-bottom: 0.45rem;
}
.answer-notes-label em { font-style: normal; color: var(--accent); }

/* ============================================================
   Question rows (essay / short answer — click to expand)
   ============================================================ */
.question-row-card { padding: 0; }
.question-row {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  width: 100%;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  padding: 1.05rem 1.25rem;
  font-family: var(--font-body);
  font-size: 1rem;
  color: inherit;
  transition: background var(--transition);
  touch-action: manipulation;
  border-radius: var(--radius);
}
@media (min-width: 768px) { .question-row { padding: 1.15rem 1.5rem; } }
.question-row:hover { background: var(--muted); }
.q-no {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--muted-foreground);
  flex: 0 0 auto;
}
.q-text { flex: 1; line-height: 1.65; min-width: 0; }
.q-hints { display: flex; gap: 0.4rem; flex: 0 0 auto; }
.row-hint {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  color: var(--muted-foreground);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  background: var(--background);
  white-space: nowrap;
}
.row-hint.x-low {
  color: var(--muted-foreground);
  border-color: var(--border);
  background: var(--muted);
}
.row-hint.x-mid {
  color: #1e7b34;
  border-color: #2e9e4f;
  background: rgba(46, 158, 79, 0.1);
}
.row-hint.x-high {
  color: #b3261e;
  border-color: #d6453d;
  background: rgba(179, 38, 30, 0.08);
}
.row-hint.x-max {
  color: #8b5cf6;
  border-color: #a78bfa;
  background: rgba(139, 92, 246, 0.12);
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.5);
}
.hint-stack {
  position: relative;
  display: inline-flex;
}
.hint-pop {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  display: none;
  flex-direction: column;
  gap: 0.4rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  padding: 0.55rem 0.7rem;
  z-index: 40;
  min-width: max-content;
}
.hint-stack:hover .hint-pop,
.hint-stack:focus-within .hint-pop { display: flex; }
.q-chevron {
  flex: 0 0 auto;
  color: var(--muted-foreground);
  align-self: center;
  display: inline-flex;
  transition: transform var(--transition), color var(--transition);
}
.question-row-card.open .q-chevron { transform: rotate(180deg); color: var(--accent); }
.q-expand {
  padding: 0 1.25rem 1.5rem;
  animation: expandIn 200ms ease-out;
  border-top: 1px dashed var(--border);
}
@media (min-width: 768px) { .q-expand { padding: 1rem 1.5rem 1.75rem; } }
@keyframes expandIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}

.answer-stack { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px dashed var(--border); }
.answer-stack-label {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}
.template-answer {
  white-space: pre-wrap;
  font-size: 0.97rem;
  line-height: 1.75;
  background: var(--background);
  border-left: 2px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 0.8rem 1rem;
  margin-top: 0.55rem;
}
.template-answer.md-rendered {
  white-space: normal;
}
.template-answer h4,
.template-answer h3 {
  font-family: var(--font-serif);
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--foreground);
  margin: 1rem 0 0.3rem;
}
.template-answer h4:first-child,
.template-answer h3:first-child {
  margin-top: 0;
}
.template-answer p {
  margin: 0.45rem 0;
}
.template-answer p:first-child {
  margin-top: 0;
}
.template-answer ul,
.template-answer ol {
  margin: 0.45rem 0 0.45rem 1.1rem;
  padding: 0;
}
.template-answer li {
  margin: 0.3rem 0;
}
.template-answer table {
  border-collapse: collapse;
  margin: 0.55rem 0;
  width: 100%;
  font-size: 0.9rem;
}
.template-answer th,
.template-answer td {
  border: 1px solid var(--border);
  padding: 0.35rem 0.55rem;
  text-align: left;
  vertical-align: top;
}
.template-answer th {
  background: var(--background);
  color: var(--accent);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.template-answer code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0 0.25em;
}
.template-note {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-foreground);
  margin-top: 0.6rem;
}

/* ---------- Empty state ---------- */
.empty-state {
  text-align: center;
  padding: 4rem 1rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--muted);
}
.empty-state-title { font-family: var(--font-display); font-size: 1.4rem; font-weight: 600; margin-bottom: 0.5rem; }
.empty-state-text { color: var(--muted-foreground); font-size: 0.95rem; }

/* ---------- List end ---------- */
.list-end {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-top: 3.5rem;
}
.list-end-line { height: 1px; flex: 1; background: var(--border); }
.list-end-text {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  white-space: nowrap;
}

/* ---------- Sentinels & placeholders ---------- */
.list-sentinel { height: 1px; margin-top: -1px; }
.skeleton-question {
  height: 210px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background:
    linear-gradient(100deg, transparent 40%, rgba(26,26,26,0.04) 50%, transparent 60%)
    var(--card);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite linear;
}

/* ============================================================
   Footer
   ============================================================ */
.site-footer { padding: 4rem 0 5rem; border-top: 1px solid var(--border); background: var(--muted); }
.footer-inner { text-align: center; }
.footer-note { max-width: 36rem; margin: 0 auto 1.5rem; color: var(--muted-foreground); font-size: 0.95rem; }
.footer-meta {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-foreground);
}

/* ============================================================
   Mobile: questions & MCQ cards — tighter spacing
   ============================================================ */
@media (max-width: 767.98px) {
  .question-list { gap: 0.8rem; }

  .question-card { padding: 1.05rem 0.85rem; border-radius: var(--radius-sm); }
  .question-text { font-size: 0.95rem; line-height: 1.6; }
  .question-variant { padding-left: 0.6rem; margin-top: 0.5rem; }

  .options { margin-top: 0.9rem; gap: 0.4rem; }
  .option { padding: 0.5rem 0.65rem; gap: 0.55rem; border-radius: calc(var(--radius-sm) - 2px); }
  .option-text { font-size: 0.91rem; }
  .answer-notes { margin-top: 0.9rem; }
  .answer-notes textarea { padding: 0.55rem 0.65rem; }

  .question-row { padding: 0.7rem 0.75rem; gap: 0.5rem; font-size: 0.93rem; }
  .question-row .q-no { font-size: 0.72rem; min-width: 1.55rem; }
  .row-hint { padding: 0.12rem 0.45rem; font-size: 0.56rem; }
  .q-expand { padding: 0 0.85rem 1.15rem; }
  .answer-stack { margin-top: 0.9rem; padding-top: 0.75rem; }
  .answer-stack-label,
  .answer-notes-label { font-size: 0.6rem; }
  .template-answer { padding: 0.6rem 0.7rem; font-size: 0.92rem; }

  .template-answer table {
    display: block;
    overflow-x: auto;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
  }
  .template-answer th,
  .template-answer td { white-space: nowrap; padding: 0.3rem 0.45rem; font-size: 0.85rem; }
}

/* ============================================================
   FAB + AI chat (example feature)
   ============================================================ */
.fab {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  display: grid;
  place-items: center;
  cursor: pointer;
  background: var(--accent);
  color: var(--accent-foreground);
  box-shadow: 0 8px 24px rgba(184, 134, 11, 0.35);
  z-index: 90;
  transition: transform var(--transition), box-shadow var(--transition), opacity var(--transition);
  touch-action: manipulation;
}
.fab.fab-hidden {
  opacity: 0;
  transform: scale(0.35);
  pointer-events: none;
}
.fab:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(184, 134, 11, 0.45); }
.fab:active { transform: translateY(0); }

.chat-panel {
  position: fixed;
  right: 1.5rem;
  bottom: calc(1.5rem + 68px);
  width: min(380px, calc(100vw - 2rem));
  max-height: min(520px, calc(100vh - 8rem));
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  z-index: 91;
  transform-origin: bottom right;
}
.chat-panel.opening { animation: chat-in var(--transition); }
.chat-panel.closing { animation: chat-out var(--transition) forwards; }
@keyframes chat-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@keyframes chat-out {
  from { opacity: 1; transform: none; }
  to { opacity: 0; transform: scale(0.8) translateY(14px); }
}
.chat-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.8rem 1rem;
  background: var(--muted);
  border-bottom: 1px solid var(--border);
}
.chat-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--foreground);
}
.chat-badge {
  font-family: var(--font-mono);
  font-size: 0.56rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 0.1rem 0.45rem;
}
.chat-close {
  background: none;
  border: none;
  font-size: 1.3rem;
  line-height: 1;
  color: var(--muted-foreground);
  cursor: pointer;
  padding: 0.1rem 0.3rem;
  border-radius: var(--radius-sm);
}
.chat-clear {
  margin-left: auto;
  background: none;
  border: none;
  display: grid;
  place-items: center;
  color: var(--muted-foreground);
  cursor: pointer;
  padding: 0.3rem;
  border-radius: var(--radius-sm);
}
.chat-close:hover { color: var(--foreground); background: var(--border); }
.chat-clear:hover { color: #b3261e; background: var(--border); }

.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  min-height: 200px;
}
.chat-msg {
  max-width: 85%;
  padding: 0.55rem 0.8rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  line-height: 1.55;
  white-space: pre-wrap;
}
.chat-msg.ai {
  align-self: flex-start;
  background: var(--muted);
  border: 1px solid var(--border);
  border-top-left-radius: 2px;
  color: var(--foreground);
}
.chat-msg.user {
  align-self: flex-end;
  background: var(--accent);
  color: var(--accent-foreground);
  border-bottom-right-radius: 2px;
}

.chat-msg.ai.streaming::after {
  content: "▍";
  margin-left: 2px;
  color: var(--accent);
  animation: caret-blink 0.9s steps(2, start) infinite;
}
@keyframes caret-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.chat-msg.ai.typing .dots {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 0;
}
.chat-msg.ai.typing .dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.45;
  animation: chat-dot 1.2s infinite ease-in-out;
}
.chat-msg.ai.typing .dots span:nth-child(2) {
  animation-delay: 0.18s;
}
.chat-msg.ai.typing .dots span:nth-child(3) {
  animation-delay: 0.36s;
}
@keyframes chat-dot {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.45; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* ---------- SEO overview + popular ---------- */
.seo-overview {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--muted);
}
.seo-overview .container {
  padding-top: 2.5rem;
  padding-bottom: 2.5rem;
}
.seo-overview-text {
  max-width: 52rem;
  margin: 0 auto 1.4rem;
  color: var(--muted-foreground);
  font-size: 0.98rem;
}
.seo-subtitle {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  margin: 0 0 0.8rem;
  color: var(--foreground);
}
.seo-links {
  list-style: none;
  display: grid;
  gap: 0.45rem;
  max-width: 52rem;
  margin: 0 auto;
}
.seo-links a {
  color: var(--foreground);
  text-decoration: none;
  border-bottom: 1px dotted var(--border-hover);
  transition: color var(--transition), border-color var(--transition);
}
.seo-links a:hover {
  color: var(--accent);
  border-color: var(--accent);
}
.popular {
  border-top: 1px solid var(--border);
}
.popular .container {
  padding-top: 2.5rem;
  padding-bottom: 2.5rem;
}
.popular-meta {
  color: var(--muted-foreground);
  font-size: 0.85rem;
  margin-left: 0.4rem;
}
.question-card:target {
  box-shadow: 0 0 0 2px var(--accent);
}

/* ---------- Get Result page ---------- */
.result-section {
  padding: 2rem 0 4rem;
}
.result-container {
  max-width: 46rem;
}
.result-form {
  display: grid;
  gap: 1rem;
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-sm);
}
@media (min-width: 768px) {
  .result-form { grid-template-columns: 1fr 1fr 1fr auto; align-items: end; }
}
.result-field { display: grid; gap: 0.4rem; }
.result-label { font-size: 0.85rem; font-weight: 600; color: var(--muted-foreground); }
.result-submit { min-height: 44px; white-space: nowrap; }
.result-submit:disabled { opacity: 0.6; cursor: wait; }
.result-status { margin-top: 1.5rem; min-height: 4rem; }
.result-hint { color: var(--muted-foreground); font-size: 0.95rem; text-align: center; }
.result-loading {
  display: flex; align-items: center; justify-content: center; gap: 0.7rem;
  color: var(--muted-foreground); font-size: 0.95rem;
}
.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--border-hover); border-top-color: var(--accent);
  animation: result-spin 0.8s linear infinite;
}
@keyframes result-spin { to { transform: rotate(360deg); } }
.result-notfound, .result-errorbox {
  text-align: center; padding: 2.5rem 1.5rem;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--card); box-shadow: var(--shadow-sm);
}
.result-notfound h2, .result-errorbox h2 { font-family: var(--font-display); margin-bottom: 0.6rem; }
.result-notfound p, .result-errorbox p { color: var(--muted-foreground); margin-bottom: 0.9rem; }
.result-error { color: var(--accent); text-align: center; font-size: 0.95rem; }

.result-card {
  background: #FFFFFF; color: #1A1A1A;
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-md); overflow: hidden;
  font-size: 0.95rem;
}
.result-card-head {
  text-align: center; padding: 1.4rem 1.2rem 1rem;
  border-bottom: 2px solid #B8860B;
  background: #FFFFFF;
}
.result-logo { width: 72px; height: 72px; object-fit: contain; margin-bottom: 0.6rem; }
.result-council {
  font-weight: 700; letter-spacing: 0.03em; color: #8A6D0B; margin-bottom: 0.2rem;
}
.result-program { font-family: var(--font-display); color: #1A1A1A; margin-bottom: 0.15rem; }
.result-level { color: #333333; font-weight: 600; margin-bottom: 0.15rem; }
.result-exam-line { color: #555555; font-size: 0.9rem; margin-bottom: 0.3rem; }
.result-online { text-decoration: underline; color: #1A1A1A; font-weight: 600; }
.result-student {
  display: grid; gap: 0.35rem; padding: 1.1rem 1.2rem;
  border-bottom: 1px solid var(--border); background: #FAFAF8;
}
@media (min-width: 768px) {
  .result-student { grid-template-columns: 1fr 1fr; }
  .result-institution { grid-column: 1 / -1; }
}
.result-student p { display: flex; gap: 0.5rem; margin: 0; }
.result-student p span { color: #666666; min-width: 7.5rem; }
.result-student p strong { font-weight: 600; color: #1A1A1A; }
.result-table { width: 100%; border-collapse: collapse; }
.result-table th, .result-table td {
  border: 1px solid #000000; padding: 0.55rem 0.7rem; text-align: left; vertical-align: top;
}
.result-table th {
  background: #FAFAF8; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.04em; color: #444444;
  text-align: center;
}
.result-subject { font-weight: 600; }
.result-marks { color: #555555; font-size: 0.85rem; white-space: pre-line; }
.result-source { padding: 0.9rem 1.2rem; background: #FAFAF8; color: #777777; font-size: 0.8rem; text-align: center; }
.result-source a { color: #8A6D0B; }
.result-actions { margin-top: 1rem; text-align: center; display: flex; gap: 0.8rem; justify-content: center; }

@media print {
  .site-header, .subject-hero, .result-form, .result-hint, .result-actions,
  .site-footer, .fab, .chat-panel, .ambient-glow, .paper-texture { display: none !important; }
  .result-status { min-height: 0; margin-top: 0; }
  .result-card {
    border: 1px solid #000000; box-shadow: none; border-radius: 0;
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
  .result-table th, .result-table td { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .result-table tr, .result-table th, .result-table td { break-inside: avoid; page-break-inside: avoid; }
}

.chat-form {
  display: flex;
  gap: 0.5rem;
  padding: 0.8rem;
  border-top: 1px solid var(--border);
  background: var(--card);
}
.chat-input {
  flex: 1;
  min-width: 0;
  padding: 0.55rem 0.75rem;
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--foreground);
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
}
.chat-input:focus { border-color: var(--accent); }
.chat-send {
  padding: 0.55rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-foreground);
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
/* ============================================================
   Feedback form
   ============================================================ */
.feedback {
  padding: 4rem 0 5rem;
  background: var(--bg);
  position: relative;
}
.feedback::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, var(--muted) 0%, var(--bg) 100%);
  pointer-events: none;
}
@media (min-width: 768px) { .feedback { padding: 5.5rem 0 6.5rem; } }
.feedback > .container { position: relative; z-index: 1; }
.feedback .section-title { margin-bottom: 0.3rem; }
.feedback-note {
  color: var(--muted-foreground);
  font-size: 0.95rem;
  max-width: 26rem;
  margin-bottom: 2.5rem;
}
.feedback-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.25rem 2rem;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  max-width: 100%;
  animation: feedback-in 0.55s ease-out both;
}
@media (min-width: 480px) { .feedback-card { padding: 2rem 2.5rem 2.5rem; } }
@keyframes feedback-in {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}
.feedback-form {
  display: grid;
  gap: 1.6rem;
}
.feedback-row {
  display: grid;
  gap: 0.45rem;
}
@media (min-width: 580px) {
  .feedback-row--pair { grid-template-columns: 1fr 1fr; gap: 1.25rem; }
}
.feedback-field {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--foreground);
  letter-spacing: 0.02em;
}
.feedback-input {
  width: 100%;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--foreground);
  font-family: var(--font-body);
  font-size: 1rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  box-sizing: border-box;
  -webkit-appearance: none;
}
.feedback-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(184, 134, 11, 0.14);
}
.feedback-input--textarea {
  resize: vertical;
  min-height: 7.5rem;
  line-height: 1.5;
}
.feedback-hint {
  font-size: 0.78rem;
  color: var(--muted-foreground);
  margin-top: 0.15rem;
}
.feedback-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.8rem;
  margin-top: 0.5rem;
}
.feedback-status {
  font-size: 0.9rem;
  min-height: 1.4em;
  transition: opacity 0.25s ease;
}
.feedback-status--ok { color: var(--success, #16a34a); }
.feedback-status--err { color: var(--danger, #dc2626); }
.feedback-input:invalid:not(:placeholder-shown) { border-color: var(--danger, #dc2626); }
.feedback-input:valid:not(:placeholder-shown) { border-color: var(--success, #16a34a); }
.feedback-input:disabled, .btn:disabled { opacity: 0.5; cursor: not-allowed; }

@media (max-width: 480px) {
  .feedback-card { padding: 1.25rem 1rem; }
  .feedback-row { gap: 0.25rem; }
  .feedback-form { gap: 1.15rem; }
}
@media print {
  .site-header, .hero-cta, .toolbar, .nav-toggle, .skip-link, .paper-texture, .ambient-glow { display: none !important; }
  .fab, .chat-panel { display: none !important; }
  .question-card { break-inside: avoid; content-visibility: visible; }
  .hero { padding-top: 1rem; }
  .option:not(.correct) { opacity: 0.6; }
}
