/* The Reading statistics page (inc/reading-stats.php). A research publication in the site's own type and colours:
   paper background, white data panels, copper for Reading and for the page's own analysis. No motion.
   Theme-only: not synced from website/. */

.rs-page { --rs-panel: #ffffff; --rs-soft: #e9ebee; --rs-grid: #e3e5e9; --rs-axis: #b6bcc5; --rs-other: #9aa1ab; background: var(--paper); }
.rs-page a { text-underline-offset: 3px; text-decoration-thickness: 1px; }
.rs-page a:focus-visible, .rs-page summary:focus-visible, .rs-table-wrap:focus-visible { outline: 2px solid var(--copper); outline-offset: 2px; }

/* ---------- Hero ---------- */
.rs-hero { padding: calc(var(--header) + clamp(40px, 9vh, 110px)) var(--gutter) clamp(28px, 5vh, 56px); max-width: 1500px; }
.rs-kicker { margin-bottom: 18px; font-size: 13px; font-weight: 650; letter-spacing: .14em; text-transform: uppercase; color: var(--copper); }
.rs-hero h1 { max-width: 15em; font-size: clamp(34px, 5.2vw, 84px); text-wrap: balance; }
.rs-sub { max-width: 38em; margin-top: clamp(18px, 2.4vw, 30px); font-size: clamp(17px, 1.4vw, 21px); color: var(--muted); }
.rs-byline { margin-top: 22px; font-size: 14.5px; color: var(--muted); }
.rs-byline a { color: var(--ink); font-weight: 600; }

/* ---------- At a glance ---------- */
.rs-glance { padding: 0 var(--gutter) clamp(36px, 7vh, 80px); }
.rs-glance h2 { margin-bottom: 16px; font-stretch: 100%; font-size: 13px; font-weight: 650; letter-spacing: .14em; line-height: 1.4; text-transform: uppercase; color: var(--muted); }
.rs-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.rs-tiles a { display: grid; gap: 4px; height: 100%; padding: clamp(14px, 2vw, 26px); background: var(--rs-panel); text-decoration: none; transition: background .15s; }
.rs-tiles a:hover { background: #fbf6f2; }
.rs-tile-l { font-size: 14px; font-weight: 600; color: var(--muted); }
.rs-tile-v { font-stretch: 112%; font-size: clamp(26px, 3.4vw, 50px); font-weight: 720; letter-spacing: -.03em; line-height: 1.05; }
.rs-tile-p { font-size: 13px; color: var(--muted); }
@media (min-width: 900px) { .rs-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1300px) { .rs-tiles { grid-template-columns: repeat(6, minmax(0, 1fr)); } .rs-tile-v { font-size: clamp(26px, 2.3vw, 40px); } }

/* ---------- Layout: contents rail and body ---------- */
.rs-layout { display: grid; gap: 28px; padding: 0 var(--gutter) 12vh; }
.rs-body { min-width: 0; max-width: 900px; }
.rs-toc { padding: 18px 20px; background: var(--rs-panel); border: 1px solid var(--line); border-radius: 8px; font-size: 15px; }
.rs-toc-h { margin-bottom: 8px; font-size: 13px; font-weight: 650; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.rs-toc ol { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); column-gap: 20px; }
.rs-toc a { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); text-decoration: none; }
.rs-toc a:hover { color: var(--copper); }
.rs-toc a span { color: var(--muted); font-variant-numeric: tabular-nums; }
.rs-toc a[aria-current] { font-weight: 700; box-shadow: inset 3px 0 0 var(--copper); padding-left: 10px; }
@media (min-width: 1100px) {
  .rs-layout { grid-template-columns: 250px minmax(0, 1fr); gap: clamp(36px, 5vw, 90px); align-items: start; }
  .rs-toc { position: sticky; top: calc(var(--header) + 20px); max-height: calc(100vh - var(--header) - 40px); overflow: auto; padding: 0; background: none; border: 0; border-radius: 0; }
  .rs-toc ol { display: block; }
  body.admin-bar .rs-toc { top: calc(var(--header) + 52px); }
}

/* ---------- Sections ---------- */
.rs-body > h2 { margin-top: clamp(64px, 12vh, 130px); padding-top: 22px; border-top: 2px solid var(--ink); font-size: clamp(28px, 3.3vw, 52px); text-wrap: balance; scroll-margin-top: calc(var(--header) + 16px); }
.rs-body > h2:first-child { margin-top: 0; }
.rs-body > p { max-width: 40em; margin-top: 18px; font-size: clamp(17px, 1.25vw, 19.5px); color: var(--muted); }
.rs-body > p a { color: var(--ink); }
.rs-body > h3 { margin-top: 44px; font-size: clamp(20px, 1.8vw, 26px); }
.rs-body > ul, .rs-body > ol { max-width: 42em; margin-top: 14px; padding-left: 1.2em; list-style: disc; color: var(--muted); }
.rs-body > ul li + li { margin-top: 8px; }
.rs-body > p + .rs-stat, .rs-body > h2 + .rs-stat { margin-top: 36px; }

/* ---------- One statistic ---------- */
.rs-stat { padding: 30px 0 26px; border-top: 1px solid var(--line); scroll-margin-top: calc(var(--header) + 12px); }
.rs-stat:target { box-shadow: -14px 0 0 -10px var(--copper); }
.rs-stat-head { display: flex; align-items: baseline; gap: 14px; }
.rs-stat-n { flex: none; font-size: 13px; font-weight: 700; letter-spacing: .06em; font-variant-numeric: tabular-nums; color: var(--copper); text-decoration: none; }
.rs-stat-n:hover { text-decoration: underline; }
.rs-stat-n.is-copied::after { content: " link copied"; font-weight: 500; letter-spacing: 0; color: var(--muted); }
.rs-stat-title { font-stretch: 108%; font-size: clamp(19px, 1.55vw, 23px); font-weight: 680; line-height: 1.2; text-wrap: balance; }
.rs-stat--original .rs-stat-title::after { content: "Original analysis"; display: inline-block; margin-left: 10px; padding: 2px 8px; border: 1px solid var(--copper); border-radius: 99px; font-stretch: 100%; font-size: 11.5px; font-weight: 650; letter-spacing: .04em; color: #9a4a1f; vertical-align: 3px; white-space: nowrap; }
.rs-fig { margin-top: 12px; font-stretch: 116%; font-size: clamp(40px, 5.6vw, 76px); font-weight: 740; letter-spacing: -.035em; line-height: 1; }
.rs-fig span { display: block; margin-top: 8px; font-stretch: 100%; font-size: 14px; font-weight: 600; letter-spacing: 0; line-height: 1.3; color: var(--muted); }
.rs-text { max-width: 41em; margin-top: 12px; font-size: clamp(17px, 1.25vw, 19px); }
.rs-text strong { font-weight: 700; }
.rs-why { max-width: 44em; margin-top: 14px; padding-left: 14px; border-left: 2px solid var(--rs-soft); font-size: 15.5px; color: var(--muted); }
.rs-src { max-width: 56em; margin-top: 14px; font-size: 13.5px; line-height: 1.5; color: var(--muted); }
.rs-src-k { margin-right: 4px; font-weight: 700; font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink); }
.rs-src a { color: var(--ink); }
.rs-flag { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 3px; background: var(--rs-soft); font-size: 11.5px; font-weight: 650; color: var(--ink); white-space: nowrap; }
.rs-flag--derived { background: #f6e6dc; color: #7c3a17; }
.rs-notes, .rs-data { margin-top: 8px; font-size: 14px; color: var(--muted); }
.rs-notes summary, .rs-data summary { display: inline-block; cursor: pointer; font-weight: 600; color: var(--ink); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; list-style: none; }
.rs-notes summary::-webkit-details-marker, .rs-data summary::-webkit-details-marker { display: none; }
.rs-notes summary::after, .rs-data summary::after { content: " +"; color: var(--copper); }
.rs-notes[open] summary::after, .rs-data[open] summary::after { content: " \2212"; }
.rs-notes p, .rs-notes ul { max-width: 52em; margin-top: 8px; }
.rs-notes li { margin-top: 4px; padding-left: 12px; border-left: 2px solid var(--rs-soft); }
.rs-notes a { color: var(--ink); }
.rs-missing { padding: 12px; background: #fff3cd; }

/* ---------- Charts ---------- */
.rs-chart { margin-top: 20px; padding: clamp(14px, 2vw, 24px); background: var(--rs-panel); border: 1px solid var(--line); border-radius: 8px; }
.rs-chart-title { font-size: 15.5px; font-weight: 700; line-height: 1.3; }
.rs-chart-title span { display: block; margin-top: 2px; font-size: 13.5px; font-weight: 400; color: var(--muted); }
.rs-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 12px; font-size: 13.5px; color: var(--muted); }
.rs-legend li { display: flex; align-items: center; gap: 7px; }
.rs-key { width: 11px; height: 11px; border-radius: 2px; }
.rs-key--line { width: 16px; height: 3px; border-radius: 2px; }
.rs-svg { display: block; width: 100%; height: auto; margin-top: 12px; overflow: visible; font-family: inherit; }
.rs-svg--wide { display: none; }
.rs-grid { stroke: var(--rs-grid); stroke-width: 1; }
.rs-axis { stroke: var(--rs-axis); stroke-width: 1; }
.rs-tick { fill: var(--muted); font-variant-numeric: tabular-nums; }
@media (min-width: 640px) { .rs-svg--wide { display: block; } .rs-svg--narrow { display: none; } }

/* Ranked bars in HTML */
.rs-hbar { display: grid; gap: 10px; margin-top: 16px; }
.rs-hbar li { display: grid; grid-template-columns: minmax(96px, 30%) minmax(0, 1fr) auto; align-items: center; gap: 12px; font-size: 14.5px; }
.rs-hbar-l { color: var(--muted); }
.rs-hbar-t { display: block; height: 16px; }
.rs-hbar-b { display: block; height: 100%; min-width: 2px; border-radius: 0 4px 4px 0; background: var(--rs-other); }
.rs-hbar-v { min-width: 3.4em; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.rs-hbar .is-hi .rs-hbar-b { background: var(--copper); }
.rs-hbar .is-hi .rs-hbar-l { color: var(--ink); font-weight: 700; }

/* ---------- Tables ---------- */
.rs-table-wrap { margin-top: 20px; overflow-x: auto; background: var(--rs-panel); border: 1px solid var(--line); border-radius: 8px; -webkit-overflow-scrolling: touch; }
.rs-table-wrap.is-long { max-height: 560px; overflow-y: auto; }
.rs-chart .rs-table-wrap { margin-top: 10px; border: 0; border-top: 1px solid var(--line); border-radius: 0; }
.rs-table { width: 100%; border-collapse: collapse; font-size: 14.5px; line-height: 1.35; }
.rs-table caption { padding: 14px 16px 10px; text-align: left; font-weight: 700; font-size: 15.5px; caption-side: top; }
.rs-table th, .rs-table td { padding: 9px 16px; text-align: left; vertical-align: top; border-top: 1px solid var(--line); }
.rs-table thead th { position: sticky; top: 0; background: #f7f8f9; font-size: 12.5px; font-weight: 650; color: var(--muted); vertical-align: bottom; border-top: 0; }
.rs-table tbody th { min-width: 9.5em; font-weight: 500; }
.rs-table th:first-child { position: sticky; left: 0; z-index: 1; background: #fff; }
.rs-table thead th:first-child { z-index: 2; background: #f7f8f9; }
.rs-table tbody tr:nth-child(even) th { background: #fafbfc; }
.rs-table tbody tr:nth-child(even) { background: #fafbfc; }
.rs-table .is-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rs-table .is-hi th, .rs-table .is-hi td { font-weight: 700; background: #fbf3ee; }
.rs-table tbody tr.is-hi th { background: #fbf3ee; box-shadow: inset 3px 0 0 var(--copper); }

/* ---------- Methodology, sources, attribution ---------- */
.rs-sources { margin-top: 28px; font-size: 15px; }
.rs-sources h3 { margin-top: 40px; font-size: clamp(20px, 1.8vw, 26px); scroll-margin-top: calc(var(--header) + 16px); }
.rs-sources h4 { margin: 22px 0 6px; font-size: 13px; font-weight: 650; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.rs-sources li { padding: 7px 0; border-top: 1px solid var(--line); }
.rs-used { margin-left: 6px; font-size: 13px; color: var(--muted); }
.rs-used a { color: var(--muted); }
.rs-downloads span { margin-left: 6px; font-size: 13px; color: var(--muted); }
.rs-cite { max-width: 46em; margin-top: 18px; padding: 16px 18px; background: var(--rs-panel); border: 1px solid var(--line); border-left: 3px solid var(--copper); border-radius: 0 8px 8px 0; font-size: 15.5px; color: var(--ink); }
.rs-body > p.rs-cite { color: var(--ink); font-size: 15.5px; }
.rs-about { margin-top: clamp(56px, 10vh, 110px); padding: clamp(22px, 3vw, 40px); background: var(--ink); color: #f5f6f8; border-radius: 10px; }
.rs-about h2 { font-size: clamp(22px, 2.2vw, 32px); }
.rs-about p { max-width: 40em; margin-top: 12px; color: var(--muted-dark); }
.rs-about a { color: #fff; }

@media print {
  .site-header, .mobile-nav, .rs-toc, .site-footer { display: none !important; }
  .rs-notes > *, .rs-data > * { display: block; }
  .rs-stat { break-inside: avoid; }
}
