/*!
 * hprm-2026.css — what the HPRM explainer needs on top of ern-2026.css.
 *
 * ern-2026.css (copied from the main site) supplies the tokens, header,
 * buttons, type scale, and footer. This file lays out one long article with
 * a table of contents, and styles the things pandoc produces from the qmd:
 * sections, lists, code blocks, and Quarto callouts. The copy in
 * EXPLAINER.qmd is approved text; nothing here changes it, only how it sits.
 */

/* ─── Hero ─── */
.hero { padding-bottom: 36px; border-bottom: 1px solid var(--rule); }
.hero .hero-in { max-width: none; }
.hero h1 { margin-bottom: 0; max-width: 18ch; }

/* The HPRM site's own pages, in a quiet row under the title. */
.subnav { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 32px; }
.subnav a {
  font-size: 13px; font-weight: 500; color: var(--body);
  text-decoration: none; white-space: nowrap;
}
.subnav a:hover { color: var(--accent-deep); text-decoration: underline; }
.subnav a[aria-current="page"] { color: var(--accent-deep); font-weight: 600; }

/* ─── Article and table of contents ─── */
.article-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) 232px; gap: 64px;
  align-items: start; padding-top: 48px; padding-bottom: 72px;
}
/* The contents box comes first in the markup (so a phone reads it first)
   but sits in the right-hand column on a wide screen. */
.article { grid-column: 1; grid-row: 1; min-width: 0; }
.toc { grid-column: 2; grid-row: 1; position: sticky; top: 104px; min-width: 0; }
.toc details {
  max-height: calc(100vh - 128px); overflow-y: auto;
  border-left: 1px solid var(--rule); padding-left: 18px;
}
.toc summary {
  list-style: none; cursor: default;
  font-size: 11px; font-weight: 800; letter-spacing: 0.28em; text-transform: uppercase;
  color: var(--accent-deep); margin: 0 0 14px;
}
.toc summary::-webkit-details-marker { display: none; }
.toc ul { list-style: none; margin: 0; padding: 0; }
.toc ul ul { padding-left: 14px; margin-top: 2px; }
.toc li { margin: 0; }
.toc a {
  display: block; padding: 4px 0; font-size: 13px; line-height: 1.4;
  color: var(--muted); text-decoration: none; text-wrap: pretty;
}
.toc ul ul a { font-size: 12.5px; padding: 3px 0; }
.toc a:hover { color: var(--accent-deep); }
.toc a[aria-current] { color: var(--ink); font-weight: 600; }

/* ─── Type inside the article ─── */
.article section { scroll-margin-top: 100px; }
.article section.level2 { padding-top: 40px; margin-top: 40px; border-top: 1px solid var(--rule); }
.article section.level2:first-child { padding-top: 0; margin-top: 0; border-top: 0; }
.article h2 { font-size: 34px; line-height: 1.1; letter-spacing: -0.022em; margin: 0 0 20px; max-width: none; }
.article h3 { font-size: 21px; font-weight: 600; line-height: 1.35; color: var(--ink); margin: 36px 0 12px; text-wrap: pretty; }
.article h4 { font-size: 16.5px; font-weight: 600; line-height: 1.4; color: var(--ink); margin: 28px 0 10px; text-wrap: pretty; }
.article h3:first-child, .article h4:first-child { margin-top: 0; }
.article h2 + h3, .article h3 + h4 { margin-top: 0; }

.article p, .article li { font-size: 16.5px; line-height: 1.7; color: var(--body); text-wrap: pretty; }
.article p { margin: 0 0 16px; max-width: 72ch; }
.article ul, .article ol { margin: 0 0 18px; padding-left: 24px; max-width: 72ch; }
.article li { margin: 0 0 6px; }
.article li > p { margin-bottom: 6px; }
.article ul ul, .article ol ul, .article ul ol { margin: 6px 0 0; }
.article strong { color: var(--ink); font-weight: 600; }
.article a { text-decoration: underline; text-underline-offset: 2px; }
.article hr { border: 0; border-top: 1px solid var(--rule); margin: 36px 0; }

/* Inline code and code blocks. The code on this page is quoted from the
   model scripts, so it reads as a figure: light ground, hairline border. */
.article code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.92em; color: var(--ink);
  background: var(--tint); border-radius: 3px; padding: 1px 5px;
}
.article pre {
  margin: 0 0 20px; padding: 16px 18px; overflow-x: auto;
  background: var(--tint); border: 1px solid var(--rule); border-radius: 4px;
  font-size: 13.5px; line-height: 1.55;
}
.article pre code { background: none; padding: 0; font-size: inherit; color: var(--ink); }
.article div.sourceCode { margin: 0 0 20px; }
.article div.sourceCode pre { margin: 0; }

/* Callouts (markup from _extensions/ern/explainer/callouts.lua). One shape,
   two weights: a note keeps the ink rule, an important callout takes the
   brand red. */
.article .ern-callout {
  margin: 24px 0 28px; padding: 18px 22px 6px;
  border: 1px solid var(--rule); border-left: 4px solid var(--ink);
  border-radius: 4px; background: var(--tint); max-width: 72ch;
}
.article .ern-callout-important { border-left-color: var(--accent); }
.article .ern-callout-title {
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink); margin: 0 0 10px;
}
.article .ern-callout-important .ern-callout-title { color: var(--accent-deep); }
.article .ern-callout p { font-size: 15.5px; line-height: 1.65; }
.article .ern-callout p:last-child { margin-bottom: 12px; }

/* ─── The map ─── */
/* The iframe in the qmd carries height="600" and an inline border from the
   old Bootstrap layout; both are overridden here. The map fills the article
   column and most of the viewport, and its own legend panel handles phones
   (it becomes a bottom sheet under 600px wide). */
.article iframe {
  display: block; width: 100%; max-width: none;
  height: clamp(560px, 78vh, 900px) !important;
  margin: 28px 0 32px;
  border: 1px solid var(--rule) !important; border-radius: 4px !important;
  background: var(--tint);
}

/* ─── Responsive ─── */
@media (max-width: 1000px) {
  .article-grid { grid-template-columns: minmax(0, 1fr); gap: 28px; padding-top: 28px; }
  .article { grid-column: 1; grid-row: 2; }
  .toc { grid-column: 1; grid-row: 1; position: static; }
  .toc details {
    max-height: none; overflow: visible; padding: 0;
    border: 1px solid var(--rule); border-radius: 4px;
  }
  .toc summary { cursor: pointer; margin: 0; padding: 14px 18px; display: flex; align-items: center; justify-content: space-between; }
  .toc summary::after { content: "+"; font-size: 16px; font-weight: 500; letter-spacing: 0; }
  .toc details[open] summary::after { content: "–"; }
  .toc details[open] summary { border-bottom: 1px solid var(--rule); }
  .toc ul { padding: 10px 18px 6px; }
  .toc ul ul { padding: 0 0 0 14px; }
  .subnav { margin-top: 24px; gap: 8px 18px; }
  .article iframe { height: clamp(480px, 72vh, 760px) !important; }
}
@media (max-width: 900px) {
  .hero { padding-top: 44px; padding-bottom: 28px; }
  .article h2 { font-size: 28px; }
  .article section.level2 { padding-top: 32px; margin-top: 32px; }
  .article p, .article li { font-size: 16px; }
  .article pre { font-size: 12.5px; padding: 14px; }
}
