/* the-price-of-legibility: type first, ornament nowhere.
   The page is about density, so the design spends its own budget the same way:
   one serif for argument, one mono for anything that is a measurement, and no
   decoration that is not carrying a number. */

:root {
  --ink: #16150f;
  --ink-soft: #4a4638;
  --ink-faint: #6d6857;
  --ground: #f4f1e8;
  --ground-warm: #eae5d6;
  --rule: #cfc7b0;
  --free: #8a3324;      /* the arm allowed any notation */
  --legible: #2d5468;   /* the arm told a person must be able to read it */
  --floor: #8b8574;
  --good: #3f6b3f;
  --bad: #8a3324;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #ece7d8; --ink-soft: #bdb6a2; --ink-faint: #948d7b;
    --ground: #14140f; --ground-warm: #1e1d16; --rule: #3a382c;
    --free: #d98b72; --legible: #7fb4cd; --floor: #7a7566;
    --good: #8fc08f; --bad: #d98b72;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--ground); color: var(--ink);
  font-family: var(--serif); font-size: 19px; line-height: 1.62;
}
.wrap { max-width: 42rem; margin: 0 auto; padding: 0 1.25rem; }
.wide { max-width: 58rem; }

h1, h2, h3 { font-weight: 600; line-height: 1.2; letter-spacing: -0.01em; }
h1 { font-size: clamp(2.1rem, 6vw, 3.4rem); margin: 0 0 .6rem; }
h2 { font-size: clamp(1.3rem, 3.4vw, 1.7rem); margin: 3.4rem 0 .8rem; }
h3 { font-size: 1.06rem; margin: 2rem 0 .5rem; }
p { margin: 0 0 1.05rem; }
a { color: inherit; text-underline-offset: 2px; }

.lede { font-size: 1.14em; color: var(--ink-soft); }
.small { font-size: .82em; color: var(--ink-faint); line-height: 1.5; }
.mono { font-family: var(--mono); font-size: .84em; }

header.top { padding: 5rem 0 1.5rem; }
.kicker {
  font-family: var(--mono); font-size: .7rem; letter-spacing: .16em;
  text-transform: uppercase; color: var(--ink-faint); margin: 0 0 1.4rem;
}

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

/* --- the measurement blocks --- */
figure { margin: 2rem 0; }
figcaption { font-size: .82em; color: var(--ink-faint); line-height: 1.5; margin-top: .7rem; }

.msg {
  font-family: var(--mono); font-size: .86rem; line-height: 1.55;
  background: var(--ground-warm); border: 1px solid var(--rule);
  padding: .85rem 1rem; border-radius: 3px; word-break: break-word;
  white-space: pre-wrap;
}
.msg.free { border-left: 3px solid var(--free); }
.msg.legible { border-left: 3px solid var(--legible); }

table { border-collapse: collapse; width: 100%; font-size: .84rem; font-family: var(--mono); }
th, td { padding: .38rem .55rem; text-align: right; border-bottom: 1px solid var(--rule); }
th:first-child, td:first-child { text-align: left; }
th { font-weight: 600; color: var(--ink-faint); font-size: .74rem;
     text-transform: uppercase; letter-spacing: .07em; }
.scroll { overflow-x: auto; }

.swatch { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; margin-right: .4rem; }
.sw-free { background: var(--free); }
.sw-legible { background: var(--legible); }

/* --- the reader's turn --- */
.trial { border: 1px solid var(--rule); background: var(--ground-warm);
         border-radius: 4px; padding: 1.4rem 1.3rem; margin: 1.6rem 0; }
.controls { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.1rem; }
button {
  font: inherit; font-size: .82rem; font-family: var(--mono);
  background: transparent; color: var(--ink); border: 1px solid var(--rule);
  padding: .38rem .7rem; border-radius: 3px; cursor: pointer;
}
button:hover { border-color: var(--ink-faint); }
button[aria-pressed="true"] { background: var(--ink); color: var(--ground); border-color: var(--ink); }
button.primary { background: var(--ink); color: var(--ground); border-color: var(--ink); }
button:disabled { opacity: .45; cursor: default; }

.q { margin: 1.1rem 0; padding-top: .9rem; border-top: 1px solid var(--rule); }
.q:first-of-type { border-top: 0; }
.q .prompt { font-size: .95rem; margin-bottom: .45rem; }
.opts { display: flex; flex-wrap: wrap; gap: .35rem; }
.opt {
  font-family: var(--mono); font-size: .78rem; padding: .3rem .55rem;
  border: 1px solid var(--rule); border-radius: 3px; cursor: pointer; background: transparent;
  color: var(--ink);
}
.opt[aria-pressed="true"] { background: var(--ink); color: var(--ground); border-color: var(--ink); }
.opt.correct { border-color: var(--good); color: var(--good); }
.opt.wrong { border-color: var(--bad); color: var(--bad); text-decoration: line-through; }
.opt[aria-pressed="true"].correct { background: var(--good); color: var(--ground); }
.opt[aria-pressed="true"].wrong { background: var(--bad); color: var(--ground); }

.result { margin-top: 1.2rem; padding-top: 1rem; border-top: 2px solid var(--ink); }
.bignum { font-family: var(--mono); font-size: 2.1rem; line-height: 1; }
.bignum small { font-size: .38em; color: var(--ink-faint); letter-spacing: .04em; }

.bars { margin: .9rem 0 0; }
.bar { display: grid; grid-template-columns: 11rem 1fr 4rem; gap: .5rem;
       align-items: center; font-family: var(--mono); font-size: .74rem; margin: .28rem 0; }
.bar .track { background: var(--rule); height: .62rem; border-radius: 2px; overflow: hidden; }
.bar .fill { height: 100%; background: var(--ink-faint); }
.bar.you .fill { background: var(--ink); }
.bar .val { text-align: right; }

footer.aw-wayout { margin-top: 5rem; padding: 2rem 1.25rem 3rem; border-top: 1px solid var(--rule);
                   font-size: .8rem; color: var(--ink-faint); text-align: center; }
footer.aw-wayout a { color: inherit; }
