/* studymcat.com — one stylesheet for every page. No build step. */
:root {
  --bg: #fbfaf7;
  --fg: #1f2328;
  --muted: #5d6470;
  --rule: #e2ded5;
  --accent: #1f6f5c;
  --accent-soft: #e4f1ec;
  --note-bg: #f4f1ea;
  --measure: 42rem;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15181c;
    --fg: #e6e4df;
    --muted: #9aa1ab;
    --rule: #2c3138;
    --accent: #6cc4a8;
    --accent-soft: #1d2f2a;
    --note-bg: #1d2126;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  padding: 0 1rem;
  background: var(--bg);
  color: var(--fg);
  font: 1.0625rem/1.65 Charter, "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;
}
.wrap { max-width: var(--measure); margin: 0 auto; }

header.site {
  border-bottom: 1px solid var(--rule);
  padding-block: 1rem;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}
header.site .wrap { display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem 1.5rem; }
header.site .brand { font-weight: 700; font-size: 1.125rem; color: var(--fg); text-decoration: none; }
header.site .brand span { color: var(--accent); }
header.site nav { display: flex; flex-wrap: wrap; gap: 1rem; font-size: .9375rem; }
header.site nav a { color: var(--muted); text-decoration: none; }
header.site nav a:hover, header.site nav a[aria-current="page"] { color: var(--accent); }

main { padding-block: 2rem 3rem; }
h1, h2, h3 { font-family: system-ui, -apple-system, "Segoe UI", sans-serif; line-height: 1.25; }
h1 { font-size: 1.875rem; margin: 0 0 .5rem; }
h2 { font-size: 1.3rem; margin: 2.25rem 0 .5rem; }
h3 { font-size: 1.075rem; margin: 1.5rem 0 .25rem; }
p, ul, ol { margin: 0 0 1rem; }
a { color: var(--accent); text-underline-offset: .15em; }
.lede { font-size: 1.15rem; color: var(--muted); }
.meta { font: .875rem/1.5 system-ui, sans-serif; color: var(--muted); margin-bottom: 1.5rem; }

/* "In medicine" and similar asides. */
.note {
  background: var(--note-bg);
  border-left: 3px solid var(--accent);
  padding: .75rem 1rem;
  margin: 1.5rem 0;
  border-radius: 0 4px 4px 0;
}
.note > :last-child { margin-bottom: 0; }
.note .label {
  display: block;
  font: 700 .75rem/1.4 system-ui, sans-serif;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: .25rem;
}

/* Resource and topic lists. */
.list { list-style: none; padding: 0; }
.list li { padding: .75rem 0; border-bottom: 1px solid var(--rule); }
.list li:last-child { border-bottom: 0; }
.list .name { font-weight: 600; }
.list .why { display: block; color: var(--muted); font-size: .95rem; }
.tag {
  display: inline-block;
  font: 600 .7rem/1.6 system-ui, sans-serif;
  padding: 0 .45rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  vertical-align: .1em;
  margin-left: .35rem;
}
.empty { color: var(--muted); font-style: italic; }

/* Comparison tables; scroll sideways on narrow screens instead of the page. */
.table-wrap { overflow-x: auto; margin: 0 0 1rem; }
table { width: 100%; border-collapse: collapse; font: .9375rem/1.45 system-ui, sans-serif; }
th, td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .8125rem; }
@media (min-width: 40rem) { td.num { white-space: nowrap; } }
table.chart td:first-child { white-space: nowrap; font-weight: 600; }
table.chart tbody th { padding-top: 1rem; color: var(--accent); font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; }

/* Interactive chart controls (aa-chart.js). */
.chart-controls { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; align-items: center; font: .875rem/1.4 system-ui, sans-serif; margin: 0 0 .75rem; }
.chart-controls select, .chart-controls input[type=range] { font: inherit; accent-color: var(--accent); }
.chart-controls .ph input { width: 9rem; vertical-align: middle; }
.chart-controls output { display: inline-block; min-width: 2.2em; font-weight: 600; margin-left: .25rem; }
/* Let the interactive chart use more than the text measure on wide screens. */
@media (min-width: 48rem) {
  #aa-chart, #explorer { --chart-w: min(100vw - 2rem, 64rem); width: var(--chart-w); margin-left: calc(50% - var(--chart-w) / 2); }
}
img.struct { display: block; width: 7.5rem; height: auto; background: #fbfaf7; border-radius: 4px; padding: .15rem; }
td.hid { cursor: pointer; }
td.hid .v { visibility: hidden; }
td.hid.open .v { visibility: visible; }
td.hid:not(.open) { background: var(--accent-soft); }

img.struct.big { width: 100%; max-width: 17rem; }

/* Charge-and-pH tutorial: protonation-state figures, formula, explorer, curve. */
.states { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 1rem; margin: 1rem 0 1.25rem; }
.states figure { margin: 0; text-align: center; }
.states img { width: 100%; height: auto; background: #fbfaf7; border-radius: 4px; }
.states figcaption { font: .8125rem/1.45 system-ui, sans-serif; color: var(--muted); margin-top: .35rem; }
.formula { font-family: system-ui, sans-serif; text-align: center; padding: .5rem; background: var(--note-bg); border-radius: 4px; }
.explorer { display: grid; grid-template-columns: minmax(0, 17rem) minmax(0, 1fr); gap: 1rem 1.5rem; align-items: start; margin-bottom: 1rem; }
@media (max-width: 40rem) { .explorer { grid-template-columns: minmax(0, 1fr); } }
.explorer > * { min-width: 0; }
.explorer .meta { margin-bottom: 0; }
svg.curve { width: 100%; height: auto; display: block; font: 11px system-ui, sans-serif; margin-top: .5rem; }
svg.curve .grid { stroke: var(--rule); stroke-width: 1; }
svg.curve .zero { stroke: var(--muted); stroke-width: 1; }
svg.curve .pka { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
svg.curve .cursor { stroke: var(--accent); stroke-width: 1; opacity: .5; }
svg.curve .line { stroke: var(--accent); stroke-width: 2; fill: none; stroke-linejoin: round; }
svg.curve .pt { fill: var(--accent); stroke: var(--bg); stroke-width: 2; }
svg.curve .pi { fill: var(--bg); stroke: var(--fg); stroke-width: 2; }
svg.curve .lbl { fill: var(--muted); }
svg.curve .lbl.strong { fill: var(--fg); font-weight: 600; }

/* Retrieval prompts (self-test) and practice-question answers. */
details.q { border-bottom: 1px solid var(--rule); padding: .6rem 0; }
details.q summary { cursor: pointer; font-weight: 600; }
details.q summary::marker { color: var(--accent); }
details.q > :not(summary) { margin: .5rem 0 0 1.1rem; }
.quiz > li { margin-bottom: 1.5rem; }
.quiz ol.opts { list-style: upper-alpha; margin: .35rem 0 .25rem; }
.quiz details.q { border-bottom: 0; padding-bottom: 0; }

footer.site {
  border-top: 1px solid var(--rule);
  padding-block: 1.25rem 2rem;
  font: .8125rem/1.55 system-ui, sans-serif;
  color: var(--muted);
}
footer.site p { margin: 0 0 .5rem; }
footer.site a { color: var(--muted); }
