/* === Risk Runners Exam Prep — exam.riskrunners.com ===
   A calm, exam-appropriate "study desk" theme: warm paper background,
   academic indigo accents, comfortable typography for long study sessions.
   (The footer signature links are shared with state.riskrunners.com; the
    visual theme is its own.) */

:root {
  /* Paper & surfaces */
  --bg: #f5f1e8;            /* warm paper */
  --bg-soft: #efe9dc;       /* slightly deeper paper */
  --surface: #fffdf8;       /* card / sheet */
  --surface-alt: #faf6ee;   /* subtle alt surface */
  --line: #e2dac9;          /* hairline borders */
  --line-strong: #cfc4ac;

  /* Ink & text */
  --ink: #2b2a26;           /* primary text (soft near-black) */
  --ink-soft: #57544c;      /* secondary text */
  --ink-muted: #8a8577;     /* muted / meta */

  /* Academic accents */
  --indigo: #3a4a7a;        /* primary — exam navy/indigo */
  --indigo-deep: #2c3a63;
  --indigo-soft: #eef1f8;
  --teal: #2f7d6f;          /* success / pass */
  --teal-soft: #e6f2ee;
  --amber: #b7791f;         /* caution / overtime warm */
  --amber-soft: #f7edd8;
  --rose: #a8433c;          /* incorrect / overtime */
  --rose-soft: #f6e6e3;

  --font-ui: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  --font-read: Georgia, 'Iowan Old Style', 'Palatino Linotype', 'Times New Roman', serif;
  --font-mono: 'SF Mono', 'Fira Code', ui-monospace, Menlo, monospace;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(43, 42, 38, 0.08), 0 4px 14px rgba(43, 42, 38, 0.06);
  --shadow-lg: 0 10px 34px rgba(43, 42, 38, 0.14);
  --nav-h: 63px;   /* height of the sticky top nav; exam topbar sticks below it */
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  -webkit-text-size-adjust: 100%;
  line-height: 1.5;
}

/* === Top Nav === */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: rgba(245, 241, 232, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  font-size: 1.05rem;
  cursor: pointer;
  background: none;
  border: none;
  color: var(--ink);
  font-family: var(--font-ui);
}
.nav-logo { height: 34px; width: auto; display: block; }
.nav-brand-text { color: var(--indigo-deep); font-weight: 700; }
@media (max-width: 480px) { .nav-brand-text { display: none; } }

.nav-links { display: flex; gap: 6px; }

.nav-link {
  background: none;
  border: 1px solid transparent;
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-ui);
  transition: all 0.2s ease;
}
.nav-link:hover { color: var(--ink); background: var(--bg-soft); }
.nav-link.active { color: var(--indigo); background: var(--indigo-soft); }

/* === Layout === */
.view { display: none; }
.view.active { display: block; }

.container {
  max-width: 860px;
  margin: 0 auto;
  padding: 32px 20px 80px;
}

/* === Home / Hero === */
.hero {
  text-align: center;
  padding: 44px 20px 20px;
}
.hero-logo {
  width: 100%;
  max-width: 360px;
  height: auto;
  margin: 0 auto 18px;
  display: block;
}
.hero h1 {
  font-family: var(--font-read);
  font-size: 2.7rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--indigo-deep);
  margin-bottom: 12px;
}
.hero .subtitle { color: var(--ink-soft); font-size: 1.12rem; margin-bottom: 6px; }
.hero .tagline { color: var(--ink-muted); font-size: 0.95rem; }

/* Track cards on home */
.track-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-top: 34px;
}
.track-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 30px 26px;
  text-align: center;
  box-shadow: var(--shadow);
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.track-card:hover { border-color: var(--indigo); transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.track-card h2 { font-family: var(--font-read); font-size: 1.7rem; color: var(--indigo-deep); margin-bottom: 4px; }
.track-card .track-full { color: var(--ink-soft); font-size: 0.98rem; margin-bottom: 6px; }
.track-card .track-meta { color: var(--ink-muted); font-size: 0.82rem; margin-bottom: 18px; line-height: 1.6; }
.track-card .exam-count {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--ink-soft);
  background: var(--bg-soft);
  border-radius: 20px;
  padding: 4px 12px;
  margin-bottom: 18px;
}

/* === Buttons === */
.btn {
  padding: 12px 22px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
  font-family: var(--font-ui);
  -webkit-tap-highlight-color: transparent;
}
.btn-primary { background: var(--indigo); color: #fff; }
.btn-primary:hover { background: var(--indigo-deep); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-secondary:hover { background: var(--bg-soft); }
.btn-success { background: var(--teal); color: #fff; }
.btn-success:hover { filter: brightness(1.06); }
.btn-block { display: block; width: 100%; }
.btn-small { padding: 8px 14px; font-size: 0.85rem; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* === Section headings === */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 8px;
}
.section-head h2 { font-family: var(--font-read); font-size: 1.55rem; color: var(--indigo-deep); }
.section-head .hint { color: var(--ink-muted); font-size: 0.85rem; }

/* === Library list === */
.exam-list { display: flex; flex-direction: column; gap: 12px; }
.exam-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow);
  transition: border-color 0.2s, transform 0.2s;
  flex-wrap: wrap;
}
.exam-row:hover { border-color: var(--indigo); transform: translateY(-1px); }
.exam-row .exam-info { flex: 1; min-width: 200px; }
.exam-row .exam-title { font-weight: 700; font-size: 1.08rem; display: flex; align-items: center; gap: 10px; }
.exam-row .exam-sub { color: var(--ink-muted); font-size: 0.82rem; margin-top: 4px; }
.exam-row .exam-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.badge {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 9px;
  border-radius: 20px;
}
.badge-taken { background: var(--teal-soft); color: var(--teal); border: 1px solid var(--teal); }
.badge-score { background: var(--indigo-soft); color: var(--indigo); border: 1px solid var(--indigo); }

.empty-state {
  text-align: center;
  color: var(--ink-muted);
  padding: 48px 20px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  line-height: 1.7;
  background: var(--surface-alt);
}

/* === Exam-taking view === */
.exam-topbar {
  position: sticky;
  top: var(--nav-h);   /* stick just below the site nav so it stays visible */
  z-index: 45;
  background: rgba(245, 241, 232, 0.97);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  padding: 12px 20px;
}
.exam-topbar-inner {
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.timer-box { text-align: center; }
.timer {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 700;
  padding: 4px 14px;
  border-radius: var(--radius-sm);
  background: var(--teal-soft);
  color: var(--teal);
  min-width: 118px;
  text-align: center;
}
.timer.overtime { color: #fff; background: var(--rose); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.7; } }
.timer-label { font-size: 0.68rem; color: var(--ink-muted); text-transform: uppercase; letter-spacing: 0.5px; }

.progress-wrap { flex: 1; min-width: 160px; }
.progress-meta { display: flex; justify-content: space-between; font-size: 0.76rem; color: var(--ink-soft); margin-bottom: 5px; }
.progress-track { height: 10px; background: var(--bg-soft); border-radius: 6px; overflow: hidden; border: 1px solid var(--line); }
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--indigo), var(--teal));
  border-radius: 6px;
  transition: width 0.35s ease;
  width: 0%;
}
/* Complete button floats with the page, pinned bottom-right */
.btn-complete-float {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 45;
  box-shadow: var(--shadow-lg);
  padding: 14px 26px;
  font-size: 1.02rem;
}
#view-exam .container { padding-bottom: 110px; }  /* room for the floating button */

/* Question cards */
.question-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 26px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  scroll-margin-top: 132px;   /* clears sticky nav + exam topbar */
}
.question-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.question-num { font-weight: 800; font-size: 1.05rem; color: var(--indigo); }
.question-head-right { display: flex; align-items: center; gap: 12px; }
.question-topic { font-size: 0.72rem; color: var(--ink-muted); text-transform: uppercase; letter-spacing: 0.6px; }

/* Copy-to-clipboard button on each problem */
.btn-copy {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-soft);
  background: var(--surface-alt);
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  padding: 5px 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}
.btn-copy:hover { color: var(--indigo); border-color: var(--indigo); background: var(--indigo-soft); }
.btn-copy .copy-icon { font-size: 0.9rem; line-height: 1; }
.btn-copy.copied { color: var(--teal); border-color: var(--teal); background: var(--teal-soft); }
.btn-copy.copy-failed { color: var(--rose); border-color: var(--rose); background: var(--rose-soft); }
.question-stem {
  font-family: var(--font-read);
  font-size: 1.1rem;
  line-height: 1.65;
  margin-bottom: 20px;
  color: var(--ink);
}

.choice-list { display: flex; flex-direction: column; gap: 10px; }
.choice {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 14px 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 1rem;
}
.choice:hover { border-color: var(--indigo); background: var(--indigo-soft); }
.choice.selected { border-color: var(--indigo); background: var(--indigo-soft); box-shadow: inset 0 0 0 1px var(--indigo); }
.choice-letter {
  font-family: var(--font-mono);
  font-weight: 700;
  width: 28px; height: 28px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  color: var(--ink-soft);
  background: var(--surface);
}
.choice.selected .choice-letter { background: var(--indigo); color: #fff; border-color: var(--indigo); }

/* Review / results correctness */
.choice.correct { border-color: var(--teal); background: var(--teal-soft); }
.choice.correct .choice-letter { background: var(--teal); color:#fff; border-color: var(--teal); }
.choice.incorrect { border-color: var(--rose); background: var(--rose-soft); }
.choice.incorrect .choice-letter { background: var(--rose); color:#fff; border-color: var(--rose); }

/* Solution collapsible */
.solution { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; }
.solution-toggle {
  display: flex; align-items: center; gap: 8px;
  background: var(--indigo-soft);
  border: 1px solid var(--line);
  color: var(--indigo-deep);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  width: 100%;
  font-family: var(--font-ui);
  transition: background 0.2s;
}
.solution-toggle:hover { background: #e4e9f5; }
.solution-toggle .chevron { transition: transform 0.2s; display: inline-block; }
.solution-toggle.open .chevron { transform: rotate(90deg); }
.solution-body {
  display: none;
  margin-top: 12px;
  padding: 18px;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.86rem;
  line-height: 1.75;
  white-space: pre-wrap;
  color: var(--ink-soft);
}
.solution-body.open { display: block; }
.solution-answer { color: var(--teal); font-weight: 700; margin-bottom: 10px; font-family: var(--font-ui); font-size: 0.92rem; }

/* === Scorecard === */
.scorecard {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 34px;
  margin-bottom: 28px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}
.score-ring {
  --pct: 0;
  width: 172px; height: 172px;
  border-radius: 50%;
  margin: 0 auto 22px;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(closest-side, var(--surface) 79%, transparent 80% 100%),
    conic-gradient(var(--teal) calc(var(--pct) * 1%), var(--bg-soft) 0);
  position: relative;
}
.score-ring .score-inner { display:flex; flex-direction:column; align-items:center; }
.score-ring .score-num { font-family: var(--font-read); font-size: 2.7rem; font-weight: 700; color: var(--ink); }
.score-ring .score-den { font-size: 0.85rem; color: var(--ink-muted); }
.score-verdict { font-family: var(--font-read); font-size: 1.4rem; font-weight: 700; margin-bottom: 6px; }
.score-verdict.pass { color: var(--teal); }
.score-verdict.fail { color: var(--amber); }
.score-detail { color: var(--ink-soft); font-size: 0.96rem; margin-bottom: 22px; line-height: 1.7; }
.score-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* === Toast === */
.toast {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(140%);
  background: var(--ink);
  color: var(--bg);
  padding: 12px 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 100;
  transition: transform 0.3s ease;
  font-size: 0.9rem;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* === Footer (signature shared with statecraft) === */
.site-footer {
  text-align: center;
  padding: 50px 20px;
  border-top: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--ink-muted);
  font-size: 0.85em;
}
.footer-brand { font-family: var(--font-mono); letter-spacing: 2px; color: var(--ink-soft); margin-bottom: 8px; }
.site-footer p { color: var(--ink-muted); margin-bottom: 0; }
.site-footer .footer-sub { margin-top: 8px; color: var(--ink-soft); }
.footer-copyright { margin-top: 10px; font-size: 0.95em; color: var(--ink-muted); }
.footer-links { display: flex; justify-content: center; gap: 14px; margin-top: 18px; flex-wrap: wrap; }
.footer-links a {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--ink-soft); text-decoration: none;
  font-size: 0.9em; padding: 8px 16px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface);
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.footer-links a:hover { color: var(--indigo); border-color: var(--indigo); background: var(--indigo-soft); }
.footer-links svg { width: 16px; height: 16px; fill: currentColor; flex-shrink: 0; }

/* === Responsive (iPad + phone) === */
@media (max-width: 680px) {
  .track-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 2.1rem; }
  .exam-topbar-inner { gap: 10px; }
  .timer { font-size: 1.15rem; min-width: 96px; }
  .btn-complete-float { right: 14px; bottom: 14px; padding: 12px 20px; }
}

.spinner {
  border: 3px solid var(--bg-soft);
  border-top-color: var(--indigo);
  border-radius: 50%;
  width: 32px; height: 32px;
  animation: spin 0.8s linear infinite;
  margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }
