/* /by-the-numbers/ data pages (layouts/by-the-numbers/*, layouts/_partials/stats/*).
   Own file on purpose: changing assets/styles/custom.css rewrites the stylesheet hash that every page links to.
   Colours come from the site variables (--mtp-*). Every picture here is plain CSS next to the same numbers in a table,
   so the page is complete with scripts off; static/js/stats.js only adds sound and the print button. */

.st-page { min-width: 0; max-width: 100%; --st-a: var(--mtp-brass); --st-b: var(--mtp-copper); --st-c: #8f86b8; --st-d: #5f9c8f; --st-e: #b8b3a6; }
.st-page h1 { line-height: 1.05; }
.st-page .lede { max-width: 66ch; }
.st-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- short answer ---- */
.st-short {
  margin: 20px 0 10px; padding: 22px 24px 18px; background: var(--mtp-raised);
  border: 1px solid var(--mtp-line); border-left: 4px solid var(--mtp-brass); border-radius: 2px;
}
.st-short .st-short-label { margin: 0 0 8px; font-family: "Source Sans 3", sans-serif; font-size: 11px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--mtp-brass); }
.st-short-text { margin: 0 0 14px; max-width: 72ch; font-size: clamp(18px, 2.1vw, 21px); line-height: 1.5; color: var(--mtp-paper); }
.st-short-text strong { color: var(--mtp-brass-bright); font-weight: 700; }
.st-short-scope { margin: 12px 0 0; max-width: 78ch; color: var(--mtp-muted); font-size: 13.5px; line-height: 1.55; }
.st-short-scope a { color: var(--mtp-brass-bright); }
.markdown .st-figures, .st-figures { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
.st-figures li { margin: 0; padding: 12px 14px 10px; background: rgba(244, 233, 207, .04); border: 1px solid var(--mtp-line); border-radius: 2px; }
.st-figures li::marker { content: none; }
.st-figures strong { display: block; font-family: "Cormorant Garamond", serif; font-size: 34px; line-height: 1; font-weight: 600; color: var(--mtp-brass-bright); }
.st-figures span { display: block; margin-top: 5px; color: var(--mtp-muted); font-size: 13px; line-height: 1.4; }

/* ---- sections and text ---- */
.st-section { margin: 46px 0 0; }
.st-section > h2 { margin: 0 0 10px; font-size: clamp(26px, 3.2vw, 34px); line-height: 1.05; }
.st-section h3 { margin: 22px 0 8px; font-size: 1.35rem; color: var(--mtp-brass-bright); }
.st-section h4 { margin: 18px 0 6px; font-size: 1.05rem; color: var(--mtp-paper); }
.st-lede { max-width: 74ch; color: var(--mtp-muted); font-size: 16.5px; line-height: 1.6; }
.st-lede p, .st-prose p { margin: 0 0 12px; }
.st-prose { max-width: 74ch; font-size: 16.5px; line-height: 1.62; }
.st-prose h3 { margin-top: 4px; }
.st-prose ul, .st-prose ol, .st-lede ul { margin: 0 0 12px; padding-left: 1.3em; }
.st-prose strong, .st-lede strong { color: var(--mtp-paper); }
.st-page a { text-underline-offset: 2px; }
.st-block { margin: 20px 0 26px; min-width: 0; }
.st-figtitle { display: block; margin: 0 0 6px; font-family: "Cormorant Garamond", serif; font-size: 1.3rem; font-weight: 600; color: var(--mtp-brass-bright); }
.st-cap { margin: 2px 0 10px; max-width: 78ch; color: var(--mtp-muted); font-size: 13.5px; line-height: 1.5; }
.st-cap a { color: var(--mtp-brass-bright); }
.st-cap-after { margin-top: 8px; }
.st-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; contain: inline-size; }

.st-callout { padding: 14px 18px; background: var(--mtp-raised); border: 1px solid var(--mtp-line); border-left: 3px solid var(--mtp-brass); border-radius: 2px; max-width: 80ch; }
.st-callout h3 { margin: 0 0 6px; font-size: 1.15rem; }
.st-callout p { margin: 0 0 8px; color: var(--mtp-muted); font-size: 15px; line-height: 1.55; }
.st-callout p:last-child { margin-bottom: 0; }
.st-callout strong { color: var(--mtp-paper); }
.st-callout-warn { border-left-color: var(--mtp-copper); }
.st-callout-warn h3 { color: #e39a72; }
.st-callout-method h3 { color: var(--mtp-muted); }

/* hugo-book styles every table inside .markdown as a bordered, striped block; these tables are laid out here instead */
.st-page .st-table { display: table; overflow: visible; margin: 6px 0 8px; }
.st-page .st-table th, .st-page .st-table td { border: 0; border-bottom: 1px solid var(--mtp-line); }
.st-page .st-table tr:nth-child(2n) { background: transparent; }
.st-page figure { margin: 20px 0 26px; }
.st-page figure .st-figtitle { margin: 0 0 6px; }
.st-page details.st-alt, .st-page details.st-checks { padding: 0; margin: 6px 0 0; border: 0; border-radius: 0; }
.st-page details.st-alt summary, .st-page details.st-checks summary { padding: 4px 0; margin: 0; line-height: 1.4; }

/* ---- tables ---- */
.st-table { width: 100%; border-collapse: collapse; margin: 6px 0 8px; font-size: 14.5px; }
.st-table th, .st-table td { padding: 8px 10px; border-bottom: 1px solid var(--mtp-line); text-align: left; vertical-align: top; }
.st-table thead th { color: var(--mtp-muted); font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; vertical-align: bottom; }
.st-table thead th small { display: block; margin-top: 2px; font-size: 10.5px; letter-spacing: 0; text-transform: none; font-weight: 400; color: #93866a; }
.st-table tbody th { color: var(--mtp-brass-bright); font-weight: 600; }
.st-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.st-table td { color: var(--mtp-paper); }
.st-table.st-compact { font-size: 13.5px; }
.st-table.st-compact th, .st-table.st-compact td { padding: 5px 8px; }
.st-tablefig table { min-width: 460px; }
.st-heat { min-width: 560px; }
.st-heat td { --a: 0; background: rgba(196, 154, 73, calc(var(--a) * .78)); color: var(--mtp-paper); }
.st-heat tbody th { white-space: nowrap; }
.st-alt { margin: 6px 0 0; font-size: 13px; color: var(--mtp-muted); }
.st-alt summary { cursor: pointer; padding: 4px 0; color: var(--mtp-muted); }
.st-alt summary:hover { color: var(--mtp-brass-bright); }

/* ---- bars ---- */
.markdown .st-barlist, .st-barlist { list-style: none; margin: 0; padding: 0; min-width: 440px; }
.st-barlist li { margin: 0; display: grid; grid-template-columns: minmax(130px, 17em) minmax(150px, 1fr); align-items: center; column-gap: 14px; padding: 6px 0; border-bottom: 1px solid var(--mtp-line); }
.st-barlist li::marker { content: none; }
.st-bl { color: var(--mtp-paper); font-size: 14.5px; line-height: 1.3; }
.st-bl small { display: block; margin-top: 1px; color: var(--mtp-muted); font-size: 12px; }
.st-bt { display: grid; gap: 4px; min-width: 0; }
.st-trackrow { display: grid; grid-template-columns: minmax(80px, 1fr) auto; align-items: center; column-gap: 10px; }
.st-bt > .st-track { margin-bottom: 2px; }
.st-track { display: flex; height: 16px; min-width: 0; background: rgba(244, 233, 207, .06); border: 1px solid var(--mtp-line); }
.st-track i { display: block; height: 100%; }
.st-bv { font-size: 13.5px; font-weight: 600; color: var(--mtp-brass-bright); white-space: nowrap; font-variant-numeric: tabular-nums; }
.st-stacked .st-bv { color: var(--mtp-muted); font-weight: 400; font-size: 12.5px; white-space: normal; }
.k-a { background: var(--st-a); }
.k-b { background: var(--st-b); background-image: repeating-linear-gradient(135deg, rgba(0,0,0,.35) 0 2px, transparent 2px 5px); }
.k-c { background: var(--st-c); }
.k-d { background: var(--st-d); }
.k-e { background: var(--st-e); opacity: .75; }
.k-a-t { color: var(--st-a); } .k-b-t { color: #d98a63; } .k-c-t { color: var(--st-c); } .k-d-t { color: var(--st-d); } .k-e-t { color: var(--st-e); }
.st-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0 0 10px; font-size: 13px; color: var(--mtp-muted); }
.st-legend i { display: inline-block; width: 12px; height: 12px; margin-right: 6px; vertical-align: -1px; border: 1px solid var(--mtp-line); }

/* ---- range bars on a shared axis ---- */
.st-rangegrid { display: grid; grid-template-columns: minmax(130px, 15em) minmax(220px, 1fr) minmax(110px, auto); column-gap: 14px; min-width: 520px; }
.markdown .st-rangelist, .st-rangelist { display: contents; list-style: none; margin: 0; padding: 0; }
.st-rangelist li { display: contents; margin: 0; }
.st-rangelist li::marker { content: none; }
.st-axis { grid-column: 2; position: relative; height: 20px; margin-bottom: 2px; color: var(--mtp-muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.st-axis span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }
.st-rangegrid .st-bl, .st-rangegrid .st-rt, .st-rangegrid .st-rv { padding: 7px 0; border-bottom: 1px solid var(--mtp-line); }
.st-rangegrid .st-bl { grid-column: 1; }
.st-rt { grid-column: 2; display: grid; gap: 3px; align-content: center; }
.st-rv { grid-column: 3; font-size: 12.5px; color: var(--mtp-muted); font-variant-numeric: tabular-nums; display: grid; gap: 3px; align-content: center; white-space: nowrap; }
.st-rv b { font-weight: 600; }
.st-rtrack { position: relative; display: block; height: 14px; background: rgba(244, 233, 207, .05); }
.st-rbar { position: absolute; top: 2px; height: 10px; }
.st-rwhisk { position: absolute; top: 6px; height: 2px; background: var(--mtp-muted); opacity: .6; }
.st-rmid { position: absolute; top: 0; width: 2px; height: 14px; margin-left: -1px; background: var(--mtp-paper); text-decoration: none; }

/* ---- examples ---- */
.st-examples h3 { margin-top: 4px; }
.st-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 4px 34px; }
.markdown .st-songlist, .st-songlist { list-style: none; margin: 4px 0 8px; padding: 0; }
.st-songlist li { margin: 0; padding: 7px 0; border-bottom: 1px solid var(--mtp-line); line-height: 1.4; font-size: 14.5px; }
.st-songlist li::marker { content: none; }
.st-song-title { display: block; color: var(--mtp-paper); font-weight: 600; }
.st-song-by, .st-song-work, .st-song-detail { display: block; color: var(--mtp-muted); font-size: 13.5px; }
.st-song-by a { color: var(--mtp-brass-bright); }
.st-song-detail { color: var(--mtp-brass); }

/* ---- Wikipedia excerpts ---- */
.st-wiki { padding: 22px 22px 6px; background: var(--mtp-raised); border: 1px solid var(--mtp-line); border-top: 3px solid var(--mtp-brass); border-radius: 2px; }
.st-wiki > h3 { margin: 0 0 12px; }
.st-wiki-block { margin: 0 0 26px; padding-top: 14px; border-top: 1px solid var(--mtp-line); }
.st-wiki-block:first-of-type { border-top: 0; padding-top: 0; }
.st-wiki-block > h4 { margin: 0 0 10px; font-size: 1.25rem; color: var(--mtp-brass-bright); }
.st-wiki-text { max-width: 72ch; }
.st-wiki-text p { margin: 0 0 13px; font-size: 16px; line-height: 1.62; }
.st-wiki-text h5 { margin: 16px 0 6px; font-family: "Source Sans 3", sans-serif; font-size: 1rem; font-weight: 700; color: var(--mtp-muted); }
.st-wiki-text ul, .st-wiki-text ol { margin: 0 0 13px; padding-left: 1.3em; line-height: 1.6; }
.st-wiki-text a { color: var(--mtp-brass-bright); }
.st-wiki-source { max-width: 72ch; margin: 12px 0 0; padding-left: 12px; border-left: 2px solid var(--mtp-line); color: var(--mtp-muted); font-size: 12.5px; line-height: 1.55; }
.st-wiki-source a { color: var(--mtp-brass-bright); }
.markdown ul.st-wiki-items, ul.st-wiki-items { list-style: none; margin: 0; padding: 0; max-width: 80ch; }
.st-wiki-items li { display: grid; grid-template-columns: 9em 1fr; gap: 2px 18px; padding: 9px 0; border-bottom: 1px solid var(--mtp-line); margin: 0; font-size: 15.5px; line-height: 1.55; }
.st-wiki-items li::marker { content: none; }
.st-wiki-label { color: var(--mtp-brass-bright); font-family: "Cormorant Garamond", serif; font-size: 1.12rem; font-weight: 600; text-decoration: none; }

/* ---- listening ---- */
.st-keypick { margin: 0 0 10px; font-size: 14px; color: var(--mtp-muted); }
.st-keypick[hidden], .st-hear[hidden], .st-printbtn[hidden] { display: none; }
.st-keypick select { margin-left: 6px; padding: 5px 8px; background: var(--mtp-raised-2); color: var(--mtp-paper); border: 1px solid var(--mtp-line); border-radius: 2px; font: inherit; }
.markdown .st-playlist, .st-playlist { list-style: none; margin: 0; padding: 0; max-width: 84ch; }
.st-playlist li { margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; padding: 9px 0; border-bottom: 1px solid var(--mtp-line); }
.st-playlist li::marker { content: none; }
.st-pl-label { color: var(--mtp-paper); font-weight: 600; min-width: 9em; }
.st-pl-rn { color: var(--mtp-brass-bright); font-family: "Cormorant Garamond", serif; font-size: 1.1rem; font-weight: 600; letter-spacing: .02em; }
.st-pl-note { color: var(--mtp-muted); font-size: 13px; flex: 1 1 14em; }
.st-hear {
  display: inline-flex; align-items: center; gap: 6px; margin-left: 8px; padding: 3px 11px; min-height: 28px;
  background: transparent; color: var(--mtp-brass-bright); border: 1px solid var(--mtp-brass); border-radius: 2px;
  font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; vertical-align: middle; white-space: nowrap;
}
.st-hear:hover, .st-hear:focus-visible { background: rgba(196, 154, 73, .16); color: var(--mtp-paper); }
.st-hear.is-on { background: var(--mtp-brass); color: var(--mtp-night); }
.st-playlist .st-hear { margin-left: auto; }
.st-table td .st-hear, .st-table th .st-hear { display: flex; margin: 5px 0 0 0; }
@media (min-width: 761px) { .st-pl-label { flex: 0 0 min(100%, 21em); } }

/* beat diagram for the time-signature chart */
.st-beats { display: inline-flex; align-items: center; gap: 12px; margin-left: 4px; vertical-align: middle; }
.st-beatgroup { display: inline-flex; align-items: center; gap: 5px; }
.st-beats i { display: inline-block; border-radius: 50%; }
.st-beats .b-strong { width: 15px; height: 15px; background: var(--mtp-brass-bright); }
.st-beats .b-mid { width: 12px; height: 12px; border: 2px solid var(--mtp-brass); }
.st-beats .b-weak { width: 8px; height: 8px; background: var(--mtp-muted); opacity: .8; }

/* ---- method, related ---- */
.st-method h3 { margin-top: 20px; }
.markdown .st-method-list, .st-method-list { margin: 0 0 8px; padding-left: 1.2em; max-width: 80ch; color: var(--mtp-muted); font-size: 14.5px; line-height: 1.58; }
.st-method-list li { margin: 0 0 7px; }
.st-method-list strong { color: var(--mtp-paper); }
.st-limits li::marker { color: var(--mtp-copper); }
.markdown .st-corpora, .st-corpora { margin: 0; padding-left: 1.2em; max-width: 80ch; font-size: 14.5px; line-height: 1.55; color: var(--mtp-muted); }
.st-corpora li { margin: 0 0 7px; }
.st-lic { display: inline-block; max-width: 100%; margin-left: 6px; padding: 0 7px; border: 1px solid var(--mtp-line); border-radius: 2px; font-size: 11.5px; line-height: 1.5; color: var(--mtp-brass); overflow-wrap: anywhere; }
.st-checks { margin: 14px 0 0; font-size: 13px; color: var(--mtp-muted); max-width: 84ch; }
.st-checks summary { cursor: pointer; }
.st-checks ul { margin: 6px 0 0; padding-left: 1.2em; }
.st-related-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 6px 30px; }
.st-related-grid h3 { margin: 10px 0 6px; font-size: 1.05rem; color: var(--mtp-muted); font-family: "Source Sans 3", sans-serif; letter-spacing: .08em; text-transform: uppercase; font-weight: 700; }
.st-sources { margin: 38px 0 0; padding-top: 14px; border-top: 1px solid var(--mtp-line); max-width: 90ch; color: var(--mtp-muted); font-size: 12.5px; line-height: 1.6; }
.st-sources a { color: var(--mtp-brass-bright); }
.st-print-foot, .st-print-row .st-cap { display: none; }
.st-print-row { display: flex; align-items: center; gap: 12px; margin: 8px 0 14px; }
.st-print-row .st-cap { display: inline; margin: 0; }
.st-print-row[hidden] { display: none; }

/* index page */
.st-index .st-cards { margin: 26px 0 8px; }
.st-index .mtp-card small { color: var(--mtp-brass); }
.st-index-extra { max-width: 70ch; }

/* ---- narrow screens: nothing may widen the page ---- */
@media (max-width: 760px) {
  .mtp-page:has(.st-page) { width: 100%; max-width: 100%; box-sizing: border-box; }
  .st-short { padding: 16px 14px 14px; }
  .st-wiki { padding: 16px 14px 4px; }
  .st-wiki-items li { grid-template-columns: 1fr; }
  .st-barlist { min-width: 0; }
  .st-barlist li { grid-template-columns: 1fr; row-gap: 3px; }
  .st-rangegrid { grid-template-columns: 1fr; min-width: 0; }
  .st-axis, .st-rangegrid .st-bl, .st-rangegrid .st-rt, .st-rangegrid .st-rv { grid-column: 1; }
  .st-rangegrid .st-bl, .st-rangegrid .st-rt { border-bottom: 0; padding-bottom: 2px; }
  .st-rangegrid .st-rv { padding-top: 2px; white-space: normal; }
  .st-tablefig table { min-width: 0; }
  .st-heat { min-width: 480px; }
  .st-pl-label { min-width: 0; flex-basis: 100%; }
  .st-figures { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .st-figures strong { font-size: 28px; }
}

/* ---- print: black on white; the bars keep their shape through grey fills and hatching ---- */
@media print {
  body { background: #fff !important; color: #000 !important; }
  .mtp-topnav, .mtp-site-footer, .book-toc, .book-footer, .mtp-breadcrumb, .mtp-eyebrow, .st-noprint, .st-hear, .st-keypick,
  .st-related, .st-alt, .st-checks, .st-wiki { display: none !important; }
  .mtp-shell { display: block !important; padding: 0 !important; max-width: none !important; }
  .st-page, .st-page * { color: #000 !important; background: transparent !important; box-shadow: none !important; border-color: #888 !important; }
  .st-page h1 { font-size: 22pt; margin: 0 0 6pt; }
  .st-page h2 { font-size: 15pt; }
  .st-short { border: 1px solid #000 !important; padding: 8pt !important; }
  .st-short-text { font-size: 11.5pt; }
  .st-figures strong { font-size: 18pt; }
  .st-section { margin-top: 18pt; break-inside: auto; }
  .st-block, .st-table tr, .st-songlist li { break-inside: avoid; }
  .st-section > h2, .st-figtitle { break-after: avoid; }
  .st-scroll { overflow: visible !important; contain: none !important; }
  .st-table { font-size: 9pt; min-width: 0 !important; width: 100%; }
  .st-page .st-table th, .st-page .st-table td { padding: 3pt 5pt; }
  .st-tablefig, .st-tablefig table { break-inside: auto; min-width: 0 !important; }
  .st-table thead th { font-size: 7.5pt; }
  .st-beats { gap: 6px; } .st-beatgroup { gap: 3px; }
  .st-beats .b-strong { width: 9px; height: 9px; } .st-beats .b-mid { width: 8px; height: 8px; } .st-beats .b-weak { width: 5px; height: 5px; }
  .st-heat td { background: transparent !important; }
  .st-barlist, .st-rangegrid { min-width: 0 !important; }
  .st-track { background: #fff !important; border: 1px solid #000 !important; }
  .k-a { background: #000 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .k-b { background: #666 !important; background-image: repeating-linear-gradient(135deg, #fff 0 1.5px, transparent 1.5px 4px) !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .k-c { background: #aaa !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .k-d { background: #ddd !important; border: 1px solid #000 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .k-e { background: #eee !important; border: 1px solid #000 !important; opacity: 1; }
  .st-legend i { border-color: #000 !important; }
  .st-legend i.k-a { background: #000 !important; } .st-legend i.k-b { background: #666 !important; } .st-legend i.k-c { background: #aaa !important; }
  .st-beats i.b-strong { background: #000 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .st-beats i.b-mid { border-color: #000 !important; } .st-beats i.b-weak { background: #555 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .st-rbar { background: #000 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .st-rmid, .st-rwhisk { background: #000 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .st-page a { text-decoration: none; }
  .st-print-foot { display: block !important; margin-top: 8pt; font-size: 8.5pt; }
  .st-sources { font-size: 8pt; }
  /* the Print button: show only the chart section */
  body.st-print-one .st-page > *:not(.st-printable) { display: none !important; }
  body.st-print-one .st-page .st-printable { margin-top: 0; }
  body.st-print-one .st-page .st-printable > h2 { font-size: 20pt; }
  body.st-print-one .st-page .st-printable .st-lede { display: block; font-size: 10pt; }
}
