/* ==========================================================================
   teach/OLI — shared stylesheet for every lesson and reference doc.
   Lessons link this relatively: ../assets/style.css
   Vietnamese typesetting rules baked in: no auto-hyphenation, balanced titles,
   number+unit welded (use .nb or U+00A0 in content).
   ========================================================================== */

:root {
  --ink: #1d1d1b;
  --ink-soft: #565650;
  --paper: #fffdf8;
  --panel: #f6f2e8;
  --rule: #e3dccb;
  --accent: #14532d;        /* deep green — used for headings/links */
  --accent-soft: #e8f0e9;
  --n-pole: #c0392b;        /* red = North (standard convention) */
  --s-pole: #2471a3;        /* blue = South */
  --warn: #9a3412;
  --serif: "Charter", "Bitstream Charter", "Sitka Text", Cambria, Georgia, "Times New Roman", serif;
  --sans: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.62;
  /* Vietnamese words are short; break at spaces only, never mid-word */
  hyphens: none;
  -webkit-hyphenate-character: none;
  /* no overflow-wrap: break-word — Vietnamese must never break mid-word (vn-rules [79]);
     over-wide welded runs must overflow and be caught by the audit instead */
}

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 2.2rem 1.25rem 4rem;
}

h1, h2, h3 {
  font-family: var(--serif);
  line-height: 1.28;
  /* keep titles whole-phrase; last line never one stranded word */
  text-wrap: balance;
  hyphens: none;
  overflow-wrap: normal;
}

h1 { font-size: 1.85rem; margin: 0 0 .35em; }
h2 { font-size: 1.35rem; margin: 2.2em 0 .55em; color: var(--accent); }
h3 { font-size: 1.1rem;  margin: 1.6em 0 .4em; }

p { margin: .7em 0; text-wrap: pretty; }

a { color: var(--accent); }
a:hover { text-decoration-thickness: 2px; }

/* small caps kicker above the title */
.kicker {
  font-family: var(--sans);
  font-size: .72rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: .6em;
}

/* weld number + unit, instrument + number, date word + numeral (vn-rules [79]) */
.nb { white-space: nowrap; }

strong { font-weight: 700; }

hr { border: 0; border-top: 1px solid var(--rule); margin: 2.4em 0; }

/* ---------------------------------------------------------------- boxes */

.goal {
  background: var(--accent-soft);
  border-left: 4px solid var(--accent);
  padding: .8em 1.1em;
  margin: 1.4em 0;
  border-radius: 0 8px 8px 0;
}
.goal h2 { margin-top: 0; }

.callout {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: .8em 1.1em;
  margin: 1.4em 0;
}

.integrity {
  background: #fdf6ec;
  border: 1px solid #ecd9b4;
  border-radius: 8px;
  padding: .8em 1.1em;
  margin: 1.4em 0;
  font-size: .95em;
}

.source-box {
  background: var(--accent-soft);
  border: 1px solid #cfe0d2;
  border-radius: 8px;
  padding: .9em 1.1em;
  margin: 1.4em 0;
}

/* ---------------------------------------------------------------- media */

figure { margin: 1.6em 0; text-align: center; }
figcaption {
  font-family: var(--sans);
  font-size: .85rem;
  color: var(--ink-soft);
  margin-top: .6em;
  line-height: 1.45;
  text-wrap: balance;
}

.svg-wrap { max-width: 100%; overflow-x: auto; }

/* ---------------------------------------------------------------- tables */

.table-wrap { overflow-x: auto; }

table {
  border-collapse: collapse;
  width: 100%;
  margin: 1.2em 0;
  font-size: .92em;
}
th, td {
  border: 1px solid var(--rule);
  padding: .45em .7em;
  text-align: left;
  vertical-align: top;
}
th { background: var(--panel); font-family: var(--sans); font-size: .88em; }
tbody tr:nth-child(even) { background: #fbf8f0; }

/* ---------------------------------------------------------------- widgets */

.btn {
  font-family: var(--sans);
  font-size: .95rem;
  padding: .5em 1.1em;
  border-radius: 8px;
  border: 1px solid var(--rule);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}
.btn:hover { border-color: var(--ink-soft); }
.btn:focus-visible { outline: 3px solid #93b7a0; outline-offset: 2px; }

.sim {
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 1em;
  margin: 1.5em 0;
}
.sim-controls { display: flex; flex-wrap: wrap; gap: .5em; margin-top: .8em; }
.sim-caption {
  font-family: var(--sans);
  font-size: .92rem;
  min-height: 1.4em;
  margin: .6em 0 0;
  color: var(--ink-soft);
}
.balance-readout {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 1.5rem;
}

/* quiz */
.quiz { margin: 1.5em 0; }
.quiz-q { margin: 1.4em 0; padding: 1em; border: 1px solid var(--rule); border-radius: 10px; background: #fff; }
.quiz-q p.qtext { margin: 0 0 .7em; font-weight: 700; }
.quiz-opts { display: grid; gap: .45em; }
.quiz-opts button { text-align: left; }
.quiz-opts button.correct { border-color: var(--accent); background: var(--accent-soft); }
.quiz-opts button.wrong   { border-color: var(--warn);  background: #fdece6; }
.quiz-opts button:disabled { cursor: default; opacity: .92; }
.quiz-feedback { min-height: 1.3em; font-family: var(--sans); font-size: .92rem; margin: .6em 0 0; }
.quiz-score { font-family: var(--sans); font-size: .95rem; margin-top: 1em; }

/* ---------------------------------------------------------------- print */

@media (max-width: 400px) {
  th, td { padding: .4em .5em; }
  table { font-size: .85em; }
}

@media print {
  body { font-size: 12.5pt; background: #fff; }
  .sim-controls, .btn, .no-print { display: none; }
  .sim, .quiz-q, .callout, .goal, .source-box, .integrity { break-inside: avoid; }
  main { max-width: none; padding: 0; }
  a { color: var(--ink); }
}
