/* Shared stylesheet for financial-statements-lessons workspace.
   Tufte-influenced: quiet typography, generous margins, restrained color used only to encode meaning. */

:root {
  --ink: #1a1a1a;
  --paper: #fdfbf7;
  --muted: #6b6558;
  --rule: #d8d2c4;
  --accent: #0a5c36;      /* Safaricom-green-ish, used for positive/primary emphasis */
  --accent-soft: #e8f3ec;
  --warn: #8a3b1f;        /* used for negative figures / red flags */
  --warn-soft: #f6ebe6;
  --highlight: #f2e6b8;
  serif: Palatino Linotype, Palatino, "URW Palladio L", serif;
}

* { box-sizing: border-box; }

html { font-size: 18px; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: "Palatino Linotype", Palatino, "Iowan Old Style", "URW Palladio L", P052, serif;
  line-height: 1.55;
  max-width: 42rem;
  margin: 0 auto;
  padding: 3rem 1.5rem 6rem;
  overflow-wrap: break-word;
}

img, svg { max-width: 100%; }

@media (max-width: 600px) {
  html { font-size: 16px; }
  body { padding: 1.75rem 1rem 4rem; }
}

h1, h2, h3 {
  font-weight: 600;
  line-height: 1.2;
  color: var(--ink);
}

h1 {
  font-size: 2rem;
  margin-bottom: 0.2rem;
}

.kicker {
  font-family: "Helvetica Neue", Arial, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

h2 {
  font-size: 1.35rem;
  margin-top: 2.5rem;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 0.3rem;
}

h3 {
  font-size: 1.05rem;
  margin-top: 1.5rem;
}

p, li { font-size: 1rem; }

a { color: var(--accent); }
a:visited { color: var(--accent); }

.lede {
  font-size: 1.15rem;
  color: var(--muted);
  margin-bottom: 1.5rem;
}

/* Statement tables: real numbers, right-aligned, tabular figures.
   Wrap in .table-scroll so wide tables scroll horizontally instead of
   overflowing the viewport or crushing illegibly on narrow screens. */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1.2rem 0;
}

table.statement {
  width: 100%;
  border-collapse: collapse;
  font-family: "Helvetica Neue", Arial, sans-serif;
  font-size: 0.92rem;
  margin: 0;
}

@media (max-width: 600px) {
  table.statement {
    font-size: 0.82rem;
    min-width: 30rem;
  }
}

table.statement caption {
  text-align: left;
  font-family: serif;
  font-style: italic;
  color: var(--muted);
  margin-bottom: 0.4rem;
  caption-side: top;
}

table.statement th, table.statement td {
  padding: 0.35rem 0.6rem;
  text-align: right;
  border-bottom: 1px solid var(--rule);
}

table.statement th:first-child, table.statement td:first-child {
  text-align: left;
}

table.statement thead th {
  border-bottom: 2px solid var(--ink);
  font-weight: 600;
}

table.statement tr.subtotal td, table.statement tr.subtotal th {
  font-weight: 700;
  border-top: 1px solid var(--ink);
}

table.statement td.negative { color: var(--warn); }

/* Callouts */
.callout {
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  padding: 0.8rem 1rem;
  margin: 1.3rem 0;
  border-radius: 0 4px 4px 0;
}

.callout.warn {
  border-left-color: var(--warn);
  background: var(--warn-soft);
}

.callout h4 {
  margin: 0 0 0.3rem 0;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-family: "Helvetica Neue", Arial, sans-serif;
  color: inherit;
}

/* Quiz widget */
.quiz {
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 1rem 1.2rem;
  margin: 1.5rem 0;
  background: #fff;
}

.quiz .q { font-weight: 600; margin-bottom: 0.6rem; }

.quiz .options {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.quiz button.opt {
  text-align: left;
  font-family: inherit;
  font-size: 0.95rem;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--paper);
  cursor: pointer;
  color: var(--ink);
}

.quiz button.opt:hover { border-color: var(--accent); }

.quiz button.opt.correct {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.quiz button.opt.incorrect {
  background: var(--warn-soft);
  border-color: var(--warn);
}

.quiz .feedback {
  margin-top: 0.6rem;
  font-size: 0.92rem;
  min-height: 1.2em;
}

.quiz .feedback.correct { color: var(--accent); }
.quiz .feedback.incorrect { color: var(--warn); }

/* Nav / footer */
.lesson-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-family: "Helvetica Neue", Arial, sans-serif;
  font-size: 0.85rem;
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
}

@media (max-width: 600px) {
  .lesson-nav {
    flex-direction: column;
    gap: 0.6rem;
  }
}

.ask-teacher {
  margin-top: 3rem;
  font-size: 0.9rem;
  color: var(--muted);
  font-style: italic;
}

.source {
  font-size: 0.85rem;
  color: var(--muted);
}

.glossary-term {
  border-bottom: 1px dotted var(--muted);
  cursor: help;
}
