/* Shared stylesheet for the CCA-F teaching workspace. Tufte-ish: serif body text,
   generous margins, minimal chrome, quiet color. Used by every lesson and reference doc. */

:root {
  --bg: #fdfcfa;
  --bg-raised: #f4f1ea;
  --text: #1a1a1a;
  --text-muted: #5a5650;
  --rule: #d8d2c4;
  --accent: #8a3324;
  --accent-soft: #f1e4de;
  --code-bg: #f0ede4;
  --ok: #2f6b3a;
  --ok-bg: #e8f0e6;
  --bad: #8a3324;
  --bad-bg: #f6e9e5;
  --domain1: #8a3324;
  --domain2: #b8783a;
  --domain3: #3a6b8a;
  --domain4: #5a7a3a;
  --domain5: #6a4a8a;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171613;
    --bg-raised: #211f1a;
    --text: #e8e4da;
    --text-muted: #a39d8e;
    --rule: #3a362c;
    --accent: #e0967f;
    --accent-soft: #2e2119;
    --code-bg: #211f1a;
    --ok: #8fc79a;
    --ok-bg: #1e2c1f;
    --bad: #e0967f;
    --bad-bg: #2e2119;
  }
}
:root[data-theme="dark"] {
  --bg: #171613; --bg-raised: #211f1a; --text: #e8e4da; --text-muted: #a39d8e;
  --rule: #3a362c; --accent: #e0967f; --accent-soft: #2e2119; --code-bg: #211f1a;
  --ok: #8fc79a; --ok-bg: #1e2c1f; --bad: #e0967f; --bad-bg: #2e2119;
}
:root[data-theme="light"] {
  --bg: #fdfcfa; --bg-raised: #f4f1ea; --text: #1a1a1a; --text-muted: #5a5650;
  --rule: #d8d2c4; --accent: #8a3324; --accent-soft: #f1e4de; --code-bg: #f0ede4;
  --ok: #2f6b3a; --ok-bg: #e8f0e6; --bad: #8a3324; --bad-bg: #f6e9e5;
}

* { box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  line-height: 1.55;
  max-width: 720px;
  margin: 0 auto;
  padding: 3rem 1.5rem 6rem;
  font-size: 1.05rem;
}

h1, h2, h3 {
  font-weight: 600;
  line-height: 1.2;
  color: var(--text);
}
h1 { font-size: 1.9rem; margin-bottom: 0.2rem; }
h2 { font-size: 1.3rem; margin-top: 2.5rem; border-bottom: 1px solid var(--rule); padding-bottom: 0.3rem; }
h3 { font-size: 1.05rem; margin-top: 1.8rem; }

.kicker {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin: 0 0 0.6rem;
}

p { margin: 0.9rem 0; }
a { color: var(--accent); text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: 2px; }
a:hover { text-decoration-color: var(--accent); }

code, pre {
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.85em;
}
code {
  background: var(--code-bg);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}
pre {
  background: var(--code-bg);
  padding: 1rem 1.1rem;
  border-radius: 6px;
  overflow-x: auto;
  line-height: 1.5;
  border: 1px solid var(--rule);
}
pre code { background: none; padding: 0; }

blockquote {
  margin: 1.2rem 0;
  padding: 0.2rem 1.2rem;
  border-left: 3px solid var(--rule);
  color: var(--text-muted);
  font-style: italic;
}

hr {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 2.5rem 0;
}

ul, ol { padding-left: 1.4rem; }
li { margin: 0.4rem 0; }

.callout {
  background: var(--bg-raised);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 1rem 1.2rem;
  margin: 1.4rem 0;
}
.callout.accent { border-color: var(--accent); background: var(--accent-soft); }

.callout-title {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  margin-bottom: 0.4rem;
}

/* Domain weight bars — used on the exam blueprint and study plan */
.weight-bar-row {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin: 0.5rem 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.85rem;
}
.weight-bar-label { flex: 0 0 230px; color: var(--text); }
.weight-bar-track {
  flex: 1;
  background: var(--bg-raised);
  border-radius: 4px;
  height: 14px;
  overflow: hidden;
  border: 1px solid var(--rule);
}
.weight-bar-fill { height: 100%; border-radius: 3px 0 0 3px; }
.weight-bar-pct { flex: 0 0 40px; text-align: right; color: var(--text-muted); }

.d1 { background: var(--domain1); } .d2 { background: var(--domain2); }
.d3 { background: var(--domain3); } .d4 { background: var(--domain4); } .d5 { background: var(--domain5); }

/* Quiz widget */
.quiz {
  background: var(--bg-raised);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 1.3rem 1.4rem;
  margin: 1.6rem 0;
}
.quiz-question {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 600;
  margin-bottom: 0.8rem;
}
.quiz-options { display: flex; flex-direction: column; gap: 0.5rem; }
.quiz-option {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  text-align: left;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 0.6rem 0.9rem;
  cursor: pointer;
  font-size: 0.92rem;
  color: var(--text);
  transition: background 0.15s;
}
.quiz-option:hover { background: var(--accent-soft); }
.quiz-option.correct { background: var(--ok-bg); border-color: var(--ok); }
.quiz-option.incorrect { background: var(--bad-bg); border-color: var(--bad); }
.quiz-option:disabled { cursor: default; }
.quiz-feedback {
  margin-top: 0.8rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.88rem;
  display: none;
}
.quiz-feedback.shown { display: block; }
.quiz-feedback.correct-text { color: var(--ok); }
.quiz-feedback.incorrect-text { color: var(--bad); }

/* Exam coverage widget — bottom of each lesson, shows how much of a topic's
   documented breadth (per official docs) the exam actually tests. */
.coverage-row {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  margin: 0.4rem 0 0.8rem;
}
.coverage-figure {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 800;
  font-size: 2.2rem;
  color: var(--accent);
  line-height: 1;
  flex: 0 0 auto;
}
.coverage-figure span { font-size: 1.1rem; font-weight: 600; }
.coverage-body { flex: 1; }
.coverage-bar {
  height: 8px;
  border-radius: 4px;
  background: var(--bg);
  border: 1px solid var(--rule);
  overflow: hidden;
  margin-bottom: 0.5rem;
}
.coverage-bar-fill { height: 100%; background: var(--accent); }
.coverage-body p { margin: 0; font-size: 0.88rem; }
.coverage-details {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.85rem;
  border-top: 1px solid var(--rule);
  padding-top: 0.7rem;
}
.coverage-details summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--accent);
}
.coverage-details ul { margin: 0.6rem 0 0; padding-left: 1.2rem; }
.coverage-details li { margin: 0.3rem 0; }

.nav-links {
  margin-top: 3rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--rule);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.ask-agent {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
}

table { border-collapse: collapse; width: 100%; margin: 1.2rem 0; font-size: 0.92rem; }
th, td { text-align: left; padding: 0.5rem 0.8rem; border-bottom: 1px solid var(--rule); }
th { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }

/* Table of contents — used by the root index.html landing page */
.toc-list { list-style: none; padding-left: 0; margin: 1rem 0 2rem; }
.toc-row {
  display: flex;
  align-items: baseline;
  gap: 0.8rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--rule);
}
.toc-row:last-child { border-bottom: none; }
.toc-num {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text-muted);
  font-size: 0.8rem;
  flex: 0 0 1.6rem;
}
.domain-dot {
  display: inline-block;
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  flex: 0 0 auto;
  margin-right: 0.2rem;
}
.toc-title { flex: 1; }
.toc-tag {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.ref-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.9rem;
  margin: 1.2rem 0 2rem;
}
.ref-card {
  background: var(--bg-raised);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 0.9rem 1.1rem;
}
.ref-card a {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 600;
  text-decoration: none;
}
.ref-card p { margin: 0.35rem 0 0; font-size: 0.88rem; color: var(--text-muted); }

/* Manual light/dark/auto theme toggle — see assets/theme-toggle.js.
   Present on every page (no shared layout to host it in once). */
.theme-toggle {
  position: fixed;
  top: 1.1rem;
  right: 1.1rem;
  display: inline-flex;
  gap: 0.15rem;
  padding: 0.15rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--bg-raised);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
  z-index: 100;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.theme-toggle-opt {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.theme-toggle-opt.active { background: var(--bg); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }
.theme-toggle-opt:hover:not(.active) { color: var(--text); }

@media (max-width: 600px) {
  .weight-bar-row { flex-wrap: wrap; row-gap: 0.3rem; }
  .weight-bar-label { flex-basis: 100%; }

  .toc-row { flex-wrap: wrap; }
  .toc-tag { flex-basis: 100%; margin-left: 4rem; white-space: normal; }

  .theme-toggle-opt span { display: none; }
  .theme-toggle-opt { padding: 0.4rem; }
}

@media print {
  body { max-width: 100%; padding: 0.5in; font-size: 11pt; color: #000; background: #fff; }
  a { color: #000; text-decoration: underline; }
  .quiz-option { display: none; }
  .no-print { display: none; }
  .theme-toggle { display: none; }
}
