/* Typography is deliberately larger and looser than a normal article: the
   intended reader is over 70 and often reading on a phone held at arm's
   length. Nothing here should require a pinch-zoom. */

:root {
  --measure: 34rem;

  --bg: #fbf9f5;
  --panel: #ffffff;
  --ink: #1b1917;
  --ink-soft: #57524b;
  --rule: #e2dcd2;
  --accent: #2f6b4f;
  --accent-soft: #eef4f0;
  --warn: #8a5a1f;
  --warn-soft: #fbf1e2;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16181a;
    --panel: #1e2124;
    --ink: #e9e6e1;
    --ink-soft: #a9a49c;
    --rule: #333739;
    --accent: #7fc0a0;
    --accent-soft: #1f2a25;
    --warn: #e0b071;
    --warn-soft: #2a2319;
  }
}

* { box-sizing: border-box; }

html {
  font-size: 20px;
  -webkit-text-size-adjust: 100%;
}
html[data-size="2"] { font-size: 23px; }
html[data-size="3"] { font-size: 27px; }

body {
  margin: 0;
  padding: 0 1.2rem 4rem;
  background: var(--bg);
  color: var(--ink);
  font-family: "PingFang TC", "Hiragino Sans CJK TC", "Noto Sans TC",
               "Microsoft JhengHei", system-ui, sans-serif;
  line-height: 1.95;
  letter-spacing: 0.015em;
}

article, footer { max-width: var(--measure); margin: 0 auto; }

p { margin: 0 0 1.4em; }

strong { font-weight: 700; }

hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 3rem auto;
  width: 100%;
}

/* ---- Reading controls ---- */

.toolbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0.6rem 0;
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
}

.toolbar-label {
  font-size: 0.75rem;
  color: var(--ink-soft);
  margin-right: 0.2rem;
}

.toolbar button {
  font: inherit;
  font-size: 0.78rem;
  line-height: 1;
  padding: 0.6rem 0.85rem;      /* deliberately large: fingertip target */
  min-height: 2.4rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
}

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

.toolbar button[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 700;
}

@media (prefers-color-scheme: dark) {
  .toolbar button[aria-pressed="true"] { color: #10221a; }
}

.print-btn { margin-left: auto; }

/* ---- Masthead ---- */

.masthead {
  padding: 3rem 0 2.2rem;
  border-bottom: 3px solid var(--ink);
  margin-bottom: 2.5rem;
}

h1 {
  font-size: 2.1rem;
  line-height: 1.35;
  letter-spacing: -0.01em;
  margin: 0 0 1rem;
}

.standfirst {
  font-size: 1.05rem;
  line-height: 1.75;
  color: var(--ink-soft);
  margin: 0 0 1.4rem;
}

.jump {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.6rem;
}

.jump a {
  font-size: 0.85rem;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  padding-bottom: 2px;
}

.lede { font-size: 1.1rem; }

/* A quieter register — used for the sentence that answers an aside the reader
   is thinking but has not asked. Set apart so it can be skipped without
   losing the thread. */
.aside {
  border-left: 3px solid var(--rule);
  padding-left: 1.1rem;
  color: var(--ink-soft);
  font-size: 0.95rem;
  line-height: 1.85;
}

/* ---- Section headings ---- */

h2 {
  font-size: 1.45rem;
  line-height: 1.5;
  margin: 0 0 1.4rem;
  scroll-margin-top: 4.5rem;   /* clears the sticky toolbar on anchor jump */
}

h2 .num {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 0.4em;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

h2.plain-h2 { text-align: center; }

h3 {
  font-size: 1.12rem;
  line-height: 1.6;
  margin: 2.4rem 0 1rem;
}

/* ---- Pull-out statistic ---- */

.stat {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 1.3rem 1.5rem;
  margin: 0 0 1.8em;
  background: var(--accent-soft);
  border-left: 5px solid var(--accent);
  border-radius: 0 10px 10px 0;
}

.stat b {
  font-size: 2.2rem;
  line-height: 1.2;
  color: var(--accent);
  letter-spacing: -0.02em;
}

.stat span {
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--ink-soft);
}

blockquote {
  margin: 2rem 0;
  padding: 0;
  font-size: 1.2rem;
  line-height: 1.8;
  text-align: center;
  color: var(--ink);
}

/* ---- Lists ---- */

ul.plain, ol.principles, ol.ladder {
  margin: 0 0 1.6em;
  padding: 0;
  list-style: none;
}

ul.plain li {
  padding-left: 1.6rem;
  position: relative;
  margin-bottom: 0.5rem;
}

ul.plain li::before {
  content: "";
  position: absolute;
  left: 0.35rem;
  top: 0.85em;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

ol.principles { counter-reset: p; }

ol.principles li {
  counter-increment: p;
  position: relative;
  padding-left: 2.6rem;
  margin-bottom: 1.1rem;
}

ol.principles li::before {
  content: counter(p);
  position: absolute;
  left: 0;
  top: 0.42em;
  width: 1.85rem;
  height: 1.85rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1;
}

@media (prefers-color-scheme: dark) {
  ol.principles li::before { color: #10221a; }
}

/* The sit-to-stand progression: a visible ladder, one rung per line. */
ol.ladder {
  counter-reset: l;
  border-left: 2px dashed var(--rule);
  padding-left: 1.4rem;
  margin-left: 0.6rem;
}

ol.ladder li {
  counter-increment: l;
  position: relative;
  margin-bottom: 0.7rem;
}

ol.ladder li::before {
  content: "";
  position: absolute;
  left: -1.83rem;
  top: 0.82em;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
}

ol.ladder li:last-child::before { background: var(--accent); }

/* ---- Cards ---- */

.two-up {
  display: grid;
  gap: 1rem;
  margin-bottom: 1.8em;
}

@media (min-width: 40rem) {
  .two-up { grid-template-columns: 1fr 1fr; }
}

.card {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 1.3rem 1.4rem;
}

.card h3 {
  margin: 0 0 0.6rem;
  font-size: 1.02rem;
  color: var(--accent);
}

.card p { margin: 0; font-size: 0.94rem; line-height: 1.8; }

.callout {
  background: var(--warn-soft);
  border: 1px solid var(--warn);
  border-radius: 12px;
  padding: 1.4rem 1.5rem;
  margin-bottom: 1.8em;
}

.callout h3 { margin: 0 0 0.8rem; color: var(--warn); font-size: 1.1rem; }
.callout p:last-child { margin-bottom: 0; }

.callout-soft {
  background: var(--accent-soft);
  border-radius: 10px;
  padding: 1.1rem 1.3rem;
  margin-bottom: 1.8em;
  font-size: 0.98rem;
}

.callout-soft p:last-child { margin-bottom: 0; }

/* ---- Objection blocks (section 六) ----
   Each is a question the reader is already holding, answered with one figure.
   The question carries the visual weight because that is what he scans for. */

.qa {
  margin: 0 0 2rem;
  padding: 0 0 0 1.2rem;
  border-left: 4px solid var(--accent);
}

.qa h3 {
  margin: 0 0 0.9rem;
  font-size: 1.08rem;
  line-height: 1.6;
  color: var(--accent);
}

.qa p { font-size: 0.98rem; margin-bottom: 1.1em; }
.qa p:last-child { margin-bottom: 0; }

/* Honest small print — the caveat that keeps a claim from overreaching.
   Deliberately readable rather than hidden: naming a limit precisely is what
   makes the rest of the page believable. */
.note {
  font-size: 0.87rem;
  line-height: 1.85;
  color: var(--ink-soft);
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 0.85rem 1rem;
}

/* ---- The 30-second self-test ----
   Sits at the top of section 七 rather than earlier on purpose: the reader
   should never get a discouraging number before the remedy is on the same
   screen. */

.selftest {
  background: var(--panel);
  border: 2px solid var(--accent);
  border-radius: 14px;
  padding: 1.5rem 1.5rem 1.3rem;
  margin: 0 0 2rem;
  scroll-margin-top: 4.5rem;
}

.selftest h3 {
  margin: 0 0 1rem;
  font-size: 1.12rem;
  color: var(--accent);
}

.selftest p { font-size: 0.98rem; }

.selftest ul {
  list-style: none;
  margin: 0 0 1.2em;
  padding: 0;
}

.selftest ul li {
  padding: 0.7rem 0.9rem;
  margin-bottom: 0.5rem;
  border-radius: 8px;
  background: var(--accent-soft);
  font-size: 0.95rem;
  line-height: 1.75;
}

.selftest ul li b { display: block; }

.fine {
  font-size: 0.85rem;
  line-height: 1.85;
  color: var(--ink-soft);
  margin-bottom: 0.9em;
}

.fine:last-child { margin-bottom: 0; }

/* ---- Week-one table ---- */

.table-wrap {
  overflow-x: auto;              /* never lets the page itself scroll sideways */
  margin: 0 0 1.6em;
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: var(--panel);
}

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 24rem;
  font-size: 0.92rem;
  line-height: 1.7;
}

th, td {
  padding: 0.85rem 0.9rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--rule);
}

thead th {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  background: var(--accent-soft);
  white-space: nowrap;
}

tbody th { font-weight: 700; white-space: nowrap; }

tbody tr:last-child th, tbody tr:last-child td { border-bottom: 0; }

td small { color: var(--ink-soft); font-size: 0.82em; }

/* ---- Closer ---- */

.closer {
  margin: 2.6rem 0 0;
  padding: 1.8rem 1rem;
  text-align: center;
  font-size: 1.25rem;
  line-height: 1.75;
  font-weight: 700;
  color: var(--accent);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

/* ---- Footer ---- */

footer {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
}

footer h2 {
  font-size: 0.85rem;
  letter-spacing: 0.15em;
  color: var(--ink-soft);
  margin-bottom: 1rem;
}

.footnote-intro {
  font-size: 0.82rem;
  line-height: 1.85;
  color: var(--ink-soft);
  margin-bottom: 1.6rem;
}

/* Each source gets a Chinese gloss the reader can actually parse, with the
   English citation beneath in smaller type for whoever is checking the page —
   a doctor, or one of the children. */
.sources {
  margin: 0 0 2rem;
  padding-left: 1.4rem;
  font-size: 0.86rem;
  line-height: 1.7;
  color: var(--ink);
}

.sources li { margin-bottom: 1.1rem; padding-left: 0.2rem; }

.sources b { font-weight: 700; }

.sources .en {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.72rem;
  line-height: 1.65;
  color: var(--ink-soft);
  word-break: break-word;      /* long DOIs must not widen the page */
}

.sources a { color: var(--ink-soft); }

.disclaimer {
  font-size: 0.75rem;
  line-height: 1.8;
  color: var(--ink-soft);
  margin: 0;
}

/* ---- Print: the fridge-door version ---- */

@media print {
  .toolbar, .jump { display: none; }

  html { font-size: 12.5pt; }

  body {
    background: #fff;
    color: #000;
    padding: 0;
    line-height: 1.65;
  }

  article, footer { max-width: none; }

  a { color: #000; text-decoration: none; }

  .stat, .callout, .callout-soft, .card, .table-wrap, .closer,
  .selftest, .qa, .note {
    background: #fff !important;
    border: 1px solid #999;
    break-inside: avoid;
  }

  .selftest ul li { background: #fff !important; border: 1px solid #ccc; }

  .qa { border-left: 4px solid #000; }

  .aside { border-left: 3px solid #999; color: #000; }

  .stat b, .card h3, .callout h3, .closer,
  .selftest h3, .qa h3 { color: #000; }

  .note, .fine, .sources, .sources .en, .footnote-intro { color: #333; }

  h2, h3 { break-after: avoid; }

  table { min-width: 0; }
  thead th { background: #eee; }

  hr { margin: 1.4rem auto; }
}
