/* Reading Companion — one stylesheet for the whole site.
   Paper, blue-black ink, and a yellow highlighter that marks unknown words and nothing else. */

@font-face {
  font-family: "Literata";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(/fonts/literata-roman-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Literata";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(/fonts/literata-roman-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Literata";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url(/fonts/literata-italic-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --paper: #fdfdfb;
  --page: #ffffff;
  --ink: #1c2530;
  --ink-soft: #4f5b69;
  --rule: #d6dbe1;
  --tint: #f1f3f6;
  --link: #1f47a5;
  --marker: #f6e14b;
  --marker-ink: #1c2530;
  --focus: #1f47a5;

  --lv-a1-bg: #e6eef7; --lv-a1-fg: #1c2530;
  --lv-a2-bg: #d0dfef; --lv-a2-fg: #1c2530;
  --lv-b1-bg: #b2c9e5; --lv-b1-fg: #1c2530;
  --lv-b2-bg: #86a8d4; --lv-b2-fg: #0f1720;
  --lv-c1-bg: #4f77b0; --lv-c1-fg: #ffffff;
  --lv-c2-bg: #25497f; --lv-c2-fg: #ffffff;

  --serif: "Literata", "Iowan Old Style", Charter, Georgia, serif;
  /* One family for everything: Literata was drawn for e-book reading and has optical sizes for small text. */
  --sans: var(--serif);

  --text: 40rem;
  --notes: 15rem;
  --gap: 3rem;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #14181d;
    --page: #1a1f25;
    --ink: #e4e8ed;
    --ink-soft: #a5b0bd;
    --rule: #333c47;
    --tint: #1d232a;
    --link: #93b4ff;
    --marker: #d8c238;
    --marker-ink: #14181d;
    --focus: #93b4ff;

    --lv-a1-bg: #26313e; --lv-a1-fg: #e4e8ed;
    --lv-a2-bg: #2c3d52; --lv-a2-fg: #e4e8ed;
    --lv-b1-bg: #34506f; --lv-b1-fg: #ffffff;
    --lv-b2-bg: #41658f; --lv-b2-fg: #ffffff;
    --lv-c1-bg: #6f93c6; --lv-c1-fg: #0f1720;
    --lv-c2-bg: #a9c3e8; --lv-c2-fg: #0f1720;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.65;
  font-optical-sizing: auto;
  font-kerning: normal;
  text-rendering: optimizeLegibility;
}

@media (min-width: 48rem) {
  body { font-size: 1.125rem; }
}

a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 2px; }

.skip {
  position: absolute; left: 1rem; top: -3rem;
  background: var(--ink); color: var(--paper);
  padding: 0.5rem 0.75rem; font-family: var(--sans); z-index: 10;
}
.skip:focus { top: 0.5rem; }

/* ------------------------------------------------------------ header and footer (2026-11-03) */

.site-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--paper) 94%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(8px); backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--rule);
}
.header-inner {
  max-width: 72rem; margin: 0 auto; padding: 0 1rem; min-height: 3.5rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.wordmark {
  font-family: var(--serif); font-weight: 650; font-size: 1.2rem; white-space: nowrap;
  color: var(--ink); text-decoration: none; letter-spacing: -0.01em;
  display: inline-flex; align-items: center; gap: 0.5rem;
}
.wordmark::before {
  content: ""; width: 1.35rem; height: 1.35rem; flex: none;
  background: url(/favicon.svg) center / contain no-repeat;
}
.site-nav { font-family: var(--sans); font-size: 0.95rem; }
.site-nav ul { list-style: none; margin: 0; padding: 0; }
.site-nav a { color: var(--ink); text-decoration: none; }
.site-nav a:hover { text-decoration: underline; }
.site-nav summary { cursor: pointer; list-style: none; user-select: none; }
.site-nav summary::-webkit-details-marker { display: none; }

/* Desktop: four items, two of them open a panel. */
.nav-top { display: flex; align-items: center; gap: 0.3rem; }
.nav-top > li > a, .nav-top summary {
  display: block; padding: 0.45rem 0.7rem; border-radius: 6px; color: var(--ink);
}
.nav-top > li > a:hover, .nav-top summary:hover { background: var(--tint); text-decoration: none; }
.nav-top > li > a[aria-current="page"], .nav-top summary.here { box-shadow: inset 0 -2px 0 var(--ink); border-radius: 0; }
.nav-top summary::after {
  content: ""; display: inline-block; width: 0.42em; height: 0.42em; margin: 0 0 0.18em 0.45em;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg);
}
.nav-top details[open] summary::after { transform: rotate(-135deg); margin-bottom: -0.05em; }
.nav-top .drop { position: relative; }
.nav-top .menu {
  position: absolute; right: 0; top: calc(100% + 0.4rem); z-index: 30;
  background: var(--page); border: 1px solid var(--rule); border-radius: 10px;
  box-shadow: 0 12px 32px rgba(15, 23, 32, 0.14); padding: 0.6rem;
}
.nav-top .menu ul { display: grid; gap: 0; }
.nav-top .menu a { display: block; padding: 0.35rem 0.6rem; border-radius: 5px; line-height: 1.35; }
.nav-top .menu a:hover { background: var(--tint); text-decoration: none; }
.nav-top .menu a[aria-current="page"] { font-weight: 650; }
.nav-top .drop:nth-child(2) .menu { min-width: 13rem; }
.nav-top .drop:nth-child(3) .menu {
  width: min(46rem, calc(100vw - 2rem)); display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.4rem 1rem;
  padding: 0.9rem;
}
.group-name {
  margin: 0.2rem 0.6rem 0.25rem; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ink-soft);
}

/* Phone: one Menu button, the whole list drops below the header. */
.nav-mobile { display: none; }
@media (max-width: 47.99rem) {
  .nav-top { display: none; }
  .nav-mobile { display: block; }
  .nav-mobile > summary {
    display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.4rem 0.7rem;
    border: 1px solid var(--rule); border-radius: 8px; background: var(--page); font-size: 0.95rem;
  }
  .burger, .burger::before, .burger::after {
    display: block; width: 1rem; height: 1.5px; background: currentColor; position: relative;
  }
  .burger::before, .burger::after { content: ""; position: absolute; left: 0; }
  .burger::before { top: -5px; }
  .burger::after { top: 5px; }
  .nav-mobile[open] .burger { background: transparent; }
  .nav-mobile[open] .burger::before { top: 0; transform: rotate(45deg); }
  .nav-mobile[open] .burger::after { top: 0; transform: rotate(-45deg); }
  .nav-mobile .sheet {
    position: absolute; left: 0; right: 0; top: 100%;
    max-height: calc(100vh - 3.5rem); max-height: calc(100dvh - 3.5rem); overflow-y: auto;
    background: var(--page); border-bottom: 1px solid var(--rule);
    box-shadow: 0 16px 32px rgba(15, 23, 32, 0.16); padding: 0.6rem 1rem 1.4rem;
  }
  .nav-mobile .group-name { margin: 1rem 0 0.2rem; }
  .nav-mobile .sheet a { display: block; padding: 0.5rem 0; border-bottom: 1px solid var(--rule); font-size: 1.02rem; }
  .nav-mobile .sheet a[aria-current="page"] { font-weight: 650; }
  .nav-mobile .last { margin-top: 1rem; }
  .header-inner { position: static; }
  .site-header { position: sticky; }
}

.site-footer {
  margin-top: 5rem; border-top: 1px solid var(--rule); background: var(--tint);
  font-family: var(--sans); font-size: 0.92rem; line-height: 1.55; color: var(--ink-soft);
}
.footer-inner { max-width: 72rem; margin: 0 auto; padding: 2.5rem 1rem 3rem; }
.footer-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: 1.6rem 2rem; }
.footer-cols .col-name {
  margin: 0 0 0.5rem; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink);
}
.footer-cols ul { list-style: none; margin: 0; padding: 0; }
.footer-cols li { margin: 0 0 0.35rem; }
.footer-cols a { color: var(--ink-soft); text-decoration: none; }
.footer-cols a:hover { color: var(--ink); text-decoration: underline; }
.footer-about { margin-top: 2.2rem; padding-top: 1.4rem; border-top: 1px solid var(--rule); }
.footer-about p { max-width: 44rem; margin: 0 0 0.8rem; }
.footer-about strong { color: var(--ink); }

/* Breadcrumbs above the title, on every page but the home page. */
.crumbs { font-family: var(--sans); font-size: 0.88rem; color: var(--ink-soft); margin: 0 0 0.9rem; }
.crumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; }
.crumbs li { margin: 0; }
.crumbs li:not(:last-child)::after { content: "/"; margin: 0 0.5rem; color: var(--ink-soft); opacity: 0.5; }
.crumbs a { color: inherit; text-decoration: none; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; }

/* Table of contents on long pages. */
.toc {
  margin: 0 0 2.2rem; padding: 0.8rem 1rem; background: var(--tint); border-radius: 10px;
  font-family: var(--sans); font-size: 0.95rem; clear: right;
}
.toc summary {
  cursor: pointer; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-soft);
}
.toc ol { margin: 0.6rem 0 0.2rem; padding-left: 1.4rem; columns: 2 18rem; column-gap: 2rem; }
.toc li { margin: 0 0 0.35rem; break-inside: avoid; }
.toc a { color: var(--ink); text-decoration: none; }
.toc a:hover { text-decoration: underline; }
.toc li::marker { color: var(--ink-soft); font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------ the text column */

main { padding: 0 1rem; }

.prose {
  max-width: var(--text);
  margin: 2rem auto 0;
}

@media (min-width: 72rem) {
  .prose { margin-left: max(1rem, calc(50% - (var(--text) + var(--gap) + var(--notes)) / 2)); }
}

.prose h1 {
  font-size: 2.05rem; line-height: 1.14; font-weight: 640; letter-spacing: -0.015em;
  margin: 0 0 0.6rem; text-wrap: balance;
}
@media (min-width: 48rem) { .prose h1 { font-size: 2.75rem; } }

.prose h2 {
  font-size: 1.5rem; line-height: 1.25; font-weight: 620; letter-spacing: -0.01em;
  margin: 3rem 0 0.8rem; text-wrap: balance; scroll-margin-top: 4.5rem;
}
@media (min-width: 48rem) { .prose h2 { font-size: 1.7rem; } }

.prose h3 { font-size: 1.2rem; line-height: 1.3; font-weight: 620; margin: 2rem 0 0.5rem; }

.prose p, .prose ul, .prose ol { margin: 0 0 1.1rem; }
.prose li { margin: 0 0 0.45rem; }
.prose li > ul, .prose li > ol { margin-top: 0.45rem; }

.meta { font-family: var(--sans); font-size: 0.9rem; color: var(--ink-soft); margin: 0 0 1.8rem; }

.lead { font-size: 1.2rem; line-height: 1.55; }
@media (min-width: 48rem) { .lead { font-size: 1.3rem; } }

/* Steps are a real sequence, so they get numbers. */
ol.steps { list-style: none; counter-reset: step; padding: 0; }
ol.steps > li { counter-increment: step; position: relative; padding-left: 2.6rem; margin-bottom: 1.3rem; }
ol.steps > li::before {
  content: counter(step);
  position: absolute; left: 0; top: 0.05rem;
  width: 1.8rem; height: 1.8rem; border: 1.5px solid var(--ink); border-radius: 50%;
  font-family: var(--sans); font-weight: 700; font-size: 0.9rem; line-height: 1.7rem; text-align: center;
}
ol.steps > li > strong:first-child { display: block; }

blockquote { margin: 1.5rem 0; padding-left: 1.1rem; border-left: 3px solid var(--rule); color: var(--ink-soft); }

/* Key points under the byline (2026-10-07): a short summary with sources, kept plain. */
.key-points {
  margin: 0 0 2.2rem; padding: 0.9rem 0 0.3rem; clear: right;
  border-top: 1.5px solid var(--ink); border-bottom: 1px solid var(--rule);
}
.prose .key-points h2 {
  font-size: 0.85rem; line-height: 1.3; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-soft); margin: 0 0 0.6rem;
}
.key-points ul { padding-left: 1.2rem; margin: 0 0 0.8rem; }
.key-points li { margin-bottom: 0.5rem; }
.key-points li::marker { color: var(--ink-soft); }

/* ------------------------------------------------------------ source notes in the margin */

.note {
  display: block;
  font-family: var(--sans); font-size: 0.85rem; line-height: 1.45; color: var(--ink-soft);
  border-left: 2px solid var(--rule); padding: 0.1rem 0 0.1rem 0.8rem; margin: -0.4rem 0 1.2rem;
}
.note a { color: inherit; }

@media (min-width: 72rem) {
  .with-note {
    display: grid; grid-template-columns: var(--text) var(--notes); column-gap: var(--gap); align-items: start;
    margin-right: calc(-1 * (var(--notes) + var(--gap)));
  }
  .with-note > .note { float: none; width: auto; margin: 0.3rem 0 0; }
}
@media (min-width: 72rem) {
  .note {
    float: right; clear: right;
    width: var(--notes); margin: 0.25rem calc(-1 * (var(--notes) + var(--gap))) 1rem 0;
    border-left: 0; padding: 0; border-top: 2px solid var(--rule); padding-top: 0.4rem;
  }
}

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

.table-wrap { overflow-x: auto; margin: 1.5rem 0 2rem; clear: right; }

/* Wide tables leave the text column: centred on tablets, into the notes margin on large screens. */
@media (min-width: 44rem) and (max-width: 71.99rem) {
  .wide { position: relative; left: 50%; width: min(calc(100vw - 3rem), 58rem); transform: translateX(-50%); }
}
@media (min-width: 72rem) {
  .wide { margin-right: calc(-1 * (var(--notes) + var(--gap))); }
}

table {
  border-collapse: collapse; width: 100%;
  font-family: var(--sans); font-size: 0.9rem; line-height: 1.4;
  font-variant-numeric: tabular-nums lining-nums;
}
caption {
  caption-side: top; text-align: left; color: var(--ink-soft);
  font-size: 0.85rem; padding-bottom: 0.6rem;
}
th, td { padding: 0.5rem 0.7rem 0.5rem 0; border-bottom: 1px solid var(--rule); text-align: left; vertical-align: top; }
thead th { font-weight: 700; border-bottom: 1.5px solid var(--ink); vertical-align: bottom; }
tbody th { font-weight: 400; }
td.num, th.num { text-align: right; white-space: nowrap; }
tfoot th, tfoot td { border-bottom: 0; border-top: 1.5px solid var(--ink); font-weight: 700; }

table.matrix td { text-align: right; }
table.matrix th[scope="col"]:not(:first-child) { text-align: right; }
table.matrix td.nil { color: var(--ink-soft); }
table.matrix td.total { font-weight: 700; }

.level {
  display: inline-block; min-width: 2.3em; padding: 0.05em 0.35em; border-radius: 3px;
  font-family: var(--sans); font-weight: 700; font-size: 0.82rem; text-align: center;
}
.level-a1 { background: var(--lv-a1-bg); color: var(--lv-a1-fg); }
.level-a2 { background: var(--lv-a2-bg); color: var(--lv-a2-fg); }
.level-b1 { background: var(--lv-b1-bg); color: var(--lv-b1-fg); }
.level-b2 { background: var(--lv-b2-bg); color: var(--lv-b2-fg); }
.level-c1 { background: var(--lv-c1-bg); color: var(--lv-c1-fg); }
.level-c2 { background: var(--lv-c2-bg); color: var(--lv-c2-fg); }

table.books th.book a { font-family: var(--serif); font-size: 1rem; font-weight: 600; }
table.books .by { display: block; color: var(--ink-soft); }
table.books td.form { color: var(--ink-soft); }
table.books tr { scroll-margin-top: 4.5rem; }

section.lang h2 .count { font-family: var(--sans); font-size: 0.95rem; font-weight: 400; color: var(--ink-soft); letter-spacing: 0; margin-left: 0.4rem; }

/* On a phone each book becomes a short block instead of a seven-column row. */
@media (max-width: 40rem) {
  table.books, table.books tbody, table.books tr, table.books th, table.books td { display: block; }
  table.books thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  table.books caption, table.tools caption { display: block; }
  table.books tr {
    display: grid; grid-template-columns: auto auto auto; justify-content: start; gap: 0.35rem 1.4rem;
    padding: 0.9rem 0; border-bottom: 1px solid var(--rule);
  }
  table.books th, table.books td { border: 0; padding: 0; text-align: left; }
  table.books th.book, table.books td.form { grid-column: 1 / -1; }
  table.books td[data-label]::before {
    content: attr(data-label); display: block; font-size: 0.75rem; color: var(--ink-soft);
  }
  table.books td.form { margin-top: -0.3rem; font-style: italic; }
}

/* ------------------------------------------------------------ the known-words demo on the home page */

.demo { margin: 2rem 0 2.5rem; }
.demo input[type="radio"] { position: absolute; opacity: 0; width: 1px; height: 1px; }
.demo-controls { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0 0 1rem; font-family: var(--sans); }
.demo-controls .ask { flex-basis: 100%; font-size: 0.95rem; color: var(--ink-soft); margin: 0 0 0.2rem; }
.demo-controls label {
  cursor: pointer; border: 1.5px solid var(--ink); border-radius: 4px;
  padding: 0.35rem 0.8rem; font-size: 0.95rem; background: var(--page); color: var(--ink);
}
.demo-controls label .sub { color: var(--ink-soft); }
#k98:checked ~ .demo-controls label[for="k98"],
#k95:checked ~ .demo-controls label[for="k95"],
#k90:checked ~ .demo-controls label[for="k90"] { background: var(--ink); color: var(--paper); }
#k98:checked ~ .demo-controls label[for="k98"] .sub,
#k95:checked ~ .demo-controls label[for="k95"] .sub,
#k90:checked ~ .demo-controls label[for="k90"] .sub { color: inherit; opacity: 0.8; }
#k98:focus-visible ~ .demo-controls label[for="k98"],
#k95:focus-visible ~ .demo-controls label[for="k95"],
#k90:focus-visible ~ .demo-controls label[for="k90"] { outline: 3px solid var(--focus); outline-offset: 2px; }

.demo-page {
  background: var(--page); border: 1px solid var(--rule); border-radius: 2px;
  padding: 1.4rem 1.5rem 1rem; box-shadow: 0 1px 0 var(--rule), 0 3px 0 -1px var(--page), 0 4px 0 -1px var(--rule);
}
.demo-page p { margin: 0; font-size: 1.12rem; line-height: 1.75; hyphens: auto; }
.demo-page .folio { margin-top: 0.8rem; text-align: center; font-family: var(--sans); font-size: 0.8rem; color: var(--ink-soft); }

/* Without CSS the paragraph reads normally. With it, the chosen share of words is replaced by nonwords,
   the way Hu and Nation built their test texts. */
#k98:checked ~ .demo-page .t98 .rw,
#k95:checked ~ .demo-page :is(.t98, .t95) .rw,
#k90:checked ~ .demo-page .nw .rw { display: none; }

#k98:checked ~ .demo-page .t98::after,
#k95:checked ~ .demo-page :is(.t98, .t95)::after,
#k90:checked ~ .demo-page .nw::after {
  content: attr(data-nw);
  background: linear-gradient(to bottom, transparent 18%, var(--marker) 18%, var(--marker) 88%, transparent 88%);
  color: var(--marker-ink); padding: 0 0.1em; margin: 0 -0.1em;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}

.demo-caption { font-family: var(--sans); font-size: 0.92rem; color: var(--ink-soft); margin-top: 0.9rem; }
.demo-caption span { display: none; }
#k98:checked ~ .demo-caption .c98,
#k95:checked ~ .demo-caption .c95,
#k90:checked ~ .demo-caption .c90 { display: inline; }

/* Marked unknown words elsewhere, for example in the page test. */
mark.unknown {
  background: linear-gradient(to bottom, transparent 18%, var(--marker) 18%, var(--marker) 88%, transparent 88%);
  color: var(--marker-ink); padding: 0 0.1em;
}

/* ------------------------------------------------------------ reading-time calculator */

.calc {
  font-family: var(--sans); border: 1px solid var(--rule); background: var(--page);
  padding: 1.2rem 1.25rem; margin: 1.5rem 0 2rem; border-radius: 2px;
}
.calc h2 { margin-top: 0; font-family: var(--serif); }
.calc .fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: 0.9rem 1.2rem; }
.calc label { display: block; font-size: 0.9rem; color: var(--ink-soft); margin-bottom: 0.25rem; }
.calc input {
  width: 100%; font: inherit; font-size: 1.05rem; padding: 0.45rem 0.55rem;
  border: 1.5px solid var(--ink-soft); border-radius: 3px; background: var(--paper); color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.calc output { display: block; margin-top: 1rem; font-size: 1.1rem; color: var(--ink); min-height: 1.6em; }
.calc .hint { font-size: 0.85rem; color: var(--ink-soft); margin: 0.8rem 0 0; }

/* ------------------------------------------------------------ misc */

.disclosure { font-family: var(--sans); font-size: 0.9rem; color: var(--ink-soft); }

.sources { margin-top: 3.5rem; border-top: 1px solid var(--rule); padding-top: 0.5rem; clear: both; }
.sources h2 { margin-top: 1rem; }
.sources ol { font-family: var(--sans); font-size: 0.9rem; line-height: 1.5; padding-left: 1.4rem; }
.sources li { margin-bottom: 0.6rem; scroll-margin-top: 4.5rem; }
.sources li:target { background: var(--tint); }

.see-also { font-family: var(--sans); font-size: 0.95rem; }

.cluster { margin-top: 2.5rem; border-top: 1px solid var(--rule); padding-top: 0.5rem; clear: both; font-family: var(--sans); }
.cluster h2 { margin-top: 1rem; font-size: 1.05rem; }
.cluster ul { font-size: 0.95rem; line-height: 1.5; padding-left: 1.2rem; }
.cluster li { margin-bottom: 0.4rem; }

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

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

@media print {
  .site-header nav, .site-footer .footer-cols, .toc, .app-top, .demo-controls, .calc { display: none; }
  .note { float: none; width: auto; margin: 0 0 1rem; }
}

/* ------------------------------------------------------------ tools comparison */

table.tools .by { display: block; color: var(--ink-soft); font-size: 0.85rem; }
table.tools th[scope="row"] a { font-weight: 700; }

@media (max-width: 40rem) {
  table.tools, table.tools tbody, table.tools tr, table.tools th, table.tools td { display: block; }
  table.tools thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  table.tools tr { padding: 0.9rem 0; border-bottom: 1px solid var(--rule); }
  table.tools th, table.tools td { border: 0; padding: 0.15rem 0; }
  table.tools td::before { display: block; font-size: 0.75rem; color: var(--ink-soft); }
  table.tools td:nth-of-type(1)::before { content: "Runs on"; }
  table.tools td:nth-of-type(2)::before { content: "What you read"; }
  table.tools td:nth-of-type(3)::before { content: "Looking up a word"; }
  table.tools td:nth-of-type(4)::before { content: "Saved words"; }
  table.tools td:nth-of-type(5)::before { content: "Price"; }
}

/* Free graded readers (free-graded-readers.html): same card layout as table.tools on phones */
table.free th[scope="row"] a { font-weight: 700; }
table.free .by { display: block; color: var(--ink-soft); font-size: 0.85rem; font-weight: 400; }
@media (max-width: 40rem) {
  table.free, table.free tbody, table.free tr, table.free th, table.free td { display: block; }
  table.free thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  table.free caption { display: block; }
  table.free tr { padding: 0.9rem 0; border-bottom: 1px solid var(--rule); }
  table.free th, table.free td { border: 0; padding: 0.15rem 0; }
  table.free td::before { display: block; font-size: 0.75rem; color: var(--ink-soft); }
  table.free td:nth-of-type(1)::before { content: "What you get"; }
  table.free td:nth-of-type(2)::before { content: "Levels"; }
  table.free td:nth-of-type(3)::before { content: "Format"; }
  table.free td:nth-of-type(4)::before { content: "Cost"; }
}

/* ------------------------------------------------------------ app card (2026-10-07) */

.app-card {
  margin: 2rem 0; padding: 1.2rem 1.3rem 1.1rem; background: var(--tint);
  border: 1px solid var(--rule); border-radius: 14px;
}
.app-card .shot {
  display: block; width: 100%; max-width: 28rem; height: auto; margin: 0.3rem 0 0.9rem;
  border-radius: 10px; border: 1px solid var(--rule); background: #fff;
}
.app-card p { margin: 0 0 0.7rem; }
.app-card .title { font-weight: 640; font-size: 1.15rem; line-height: 1.3; margin-bottom: 0.5rem; }
.app-card .badge { display: inline-block; line-height: 0; }
.app-card .badge img { height: 40px; width: auto; }
.app-card .fine { font-family: var(--sans); font-size: 0.82rem; line-height: 1.45; color: var(--ink-soft); margin: 0; }
@media (max-width: 40rem) {
  .app-card { padding: 1rem; }
}
/* App card: under the title, lead and byline (2026-11-03). The app shot stays full width, as before. */
.app-top {
  display: block; text-align: center; margin: 0 0 2.2rem; padding: 0.8rem 0.8rem 1rem;
  background: var(--tint); border: 1px solid var(--rule); border-radius: 12px; clear: right;
}
.app-top .shot { display: block; width: 100%; height: auto; border-radius: 10px; }
.app-top .body { display: flex; flex-direction: column; align-items: center; gap: 0.7rem; margin-top: 0.9rem; }
.app-top .body p { max-width: 32rem; margin: 0 auto; font-size: 0.95rem; line-height: 1.4; }
.app-top .fine { display: block; margin-top: 0.2rem; font-family: var(--sans); font-size: 0.82rem; color: var(--ink-soft); }
.app-top .badge { display: inline-block; line-height: 0; flex: none; }
.app-top .badge img { height: 40px; width: auto; }

/* Каталог: страницы книг и подборки */
.book-head { display: flex; gap: 1.4rem; align-items: flex-start; margin: 0 0 1.8rem; }
.book-head .cover { flex: none; width: 150px; height: auto; border-radius: 4px; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18); }
dl.facts { display: grid; grid-template-columns: auto 1fr; gap: 0.25rem 1rem; margin: 0; font-family: var(--sans); font-size: 0.92rem; }
dl.facts dt { color: var(--ink-soft); }
dl.facts dd { margin: 0; }
@media (max-width: 30rem) {
  .book-head { flex-direction: column; }
  .book-head .cover { width: 120px; }
}
ul.keywords { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 0.4rem 0.5rem; }
ul.keywords li { margin: 0; padding: 0.15rem 0.6rem; background: var(--tint); border-radius: 999px; font-size: 0.95rem; }
ul.keywords .n { font-family: var(--sans); font-size: 0.8rem; color: var(--ink-soft); }
.collection h2 .count { font-family: var(--sans); font-size: 0.95rem; font-weight: 400; color: var(--ink-soft); }
.small { font-family: var(--sans); font-size: 0.88rem; color: var(--ink-soft); }

/* Карточка приложения на странице книги: цвета App Store-кадров Readlang Mobile */
.book-cta {
  display: grid; grid-template-columns: 1fr 20rem; gap: 1.5rem; align-items: center;
  margin: 0 0 2.2rem; padding: 1.6rem; border-radius: 16px; overflow: hidden;
  background: linear-gradient(135deg, #0a3d21 0%, #062b16 100%); color: #e8f5ec;
}
.book-cta .kicker { font-family: var(--sans); font-size: 0.75rem; letter-spacing: 0.14em; text-transform: uppercase; color: #5fdc8f; margin: 0 0 0.5rem; }
.book-cta .title { font-size: 1.45rem; line-height: 1.2; font-weight: 680; color: #fff; margin: 0 0 0.7rem; }
.book-cta .title span { color: #5fdc8f; }
.book-cta p { margin: 0 0 1rem; font-size: 0.98rem; line-height: 1.45; }
.book-cta .badge { display: inline-block; line-height: 0; }
.book-cta .badge img { height: 44px; width: auto; }
.book-cta .fine { font-family: var(--sans); font-size: 0.8rem; color: #a9c9b4; margin: 0.6rem 0 0; }
.book-cta .shot { display: block; line-height: 0; }
.book-cta .shot img { width: 100%; height: auto; border-radius: 12px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35); }
@media (max-width: 40rem) {
  .book-cta { grid-template-columns: 1fr; padding: 1.2rem; }
  .book-cta .shot { order: -1; }
}

/* Обложки в таблицах книг */
table.books th.book .bk { display: flex; gap: 0.8rem; align-items: flex-start; }
table.books th.book .thumb { flex: none; line-height: 0; }
table.books th.book .thumb img { width: 48px; height: auto; border-radius: 3px; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); background: var(--tint); }

/* ------------------------------------------------------------ any table on a phone (2026-11-03) */
/* stack_tables() in build.py labels every cell from the header; on a phone each row becomes a card. */
@media (max-width: 40rem) {
  table.stack, table.stack tbody, table.stack tfoot, table.stack tr, table.stack th, table.stack td { display: block; }
  table.stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  table.stack caption { display: block; }
  table.stack tr { padding: 0.8rem 0; border-bottom: 1px solid var(--rule); }
  table.stack th, table.stack td { border: 0; padding: 0.15rem 0; text-align: left; white-space: normal; }
  table.stack th[scope="row"], table.stack tbody th { font-weight: 650; margin-bottom: 0.2rem; }
  table.stack td[data-label]::before {
    content: attr(data-label); display: block; font-size: 0.75rem; line-height: 1.3; color: var(--ink-soft);
  }
  table.stack tfoot tr { border-top: 1.5px solid var(--ink); }
  /* Two row headers in one row (two series side by side): name each one by its column. */
  table.stack tr:has(> th ~ th) > th[data-label]::before {
    content: attr(data-label); display: block; font-size: 0.75rem; font-weight: 400; color: var(--ink-soft);
  }
  table.stack tr:has(> th ~ th) > th ~ th { margin-top: 0.6rem; }
  table.stack.stack-grid tr {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(6.5rem, 1fr)); gap: 0.3rem 1rem; align-items: start;
  }
  table.stack.stack-grid th { grid-column: 1 / -1; }
  /* Book cards: long time ranges wrap instead of pushing the card wider than the phone. */
  table.books td.num { white-space: normal; }
}
/* Tablets: let long numeric column headings wrap instead of widening the table. */
thead th.num { white-space: normal; }

/* Small phones (320 px): the wordmark and the Menu button must fit on one line. */
@media (max-width: 24rem) {
  .header-inner { gap: 0.5rem; padding: 0 0.75rem; }
  .wordmark { font-size: 1.05rem; gap: 0.4rem; }
  .wordmark::before { width: 1.15rem; height: 1.15rem; }
  .nav-mobile > summary { padding: 0.35rem 0.55rem; gap: 0.4rem; }
  main { padding: 0 0.75rem; }
}

/* Wide book tables (8 columns, short stories): cards on tablets too, where the columns do not fit. */
@media (min-width: 40.01rem) and (max-width: 56rem) {
  table.books.many, table.books.many tbody, table.books.many tr, table.books.many th, table.books.many td { display: block; }
  table.books.many thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  table.books.many caption { display: block; }
  table.books.many tr {
    display: grid; grid-template-columns: repeat(6, auto); justify-content: start; gap: 0.35rem 1.6rem;
    padding: 0.9rem 0; border-bottom: 1px solid var(--rule);
  }
  table.books.many th, table.books.many td { border: 0; padding: 0; text-align: left; white-space: normal; }
  table.books.many th.book, table.books.many td.form { grid-column: 1 / -1; }
  table.books.many td[data-label]::before { content: attr(data-label); display: block; font-size: 0.75rem; color: var(--ink-soft); }
  table.books.many td.form { margin-top: -0.3rem; font-style: italic; }
}
