@layer site {
/* Statistics pages (Sjukdomsradarn, VAB i siffror). Loaded only on those pages, next to styles.css. Mobile first.
   Charts are inline SVG made at build time; text and halos are styled here (the CSP forbids style attributes). */

.stat-page { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; margin-top: 8px; }
.st-status {
  margin: 20px 0 0; padding: 14px 18px; border-radius: 14px; background: var(--primary-pale); border: 1px solid var(--primary-light);
  color: var(--primary-dark); font-size: .95rem; line-height: 1.55; max-width: 70ch;
}
.st-notice {
  margin: 16px 0 0; padding: 14px 18px; border-radius: 12px; background: var(--tertiary-pale); border: 1px solid var(--tertiary);
  color: var(--text-primary); font-weight: 600; max-width: 70ch;
}
.st-card-note { max-width: 66ch; padding: 16px 18px; border: 1px dashed var(--primary-light); border-radius: 14px; background: #fff; color: var(--text-secondary); line-height: 1.6; }

.st-section { margin-top: 56px; scroll-margin-top: 76px; }
.st-section > h2 { margin: 0 0 8px; }
.st-h3 { margin: 32px 0 6px; font-size: 1.1rem; font-weight: 800; letter-spacing: -.01em; }
.st-def { max-width: 66ch; color: var(--text-secondary); margin: 0 0 16px; }
.st-small { max-width: 66ch; margin: 8px 0 0; font-size: .86rem; line-height: 1.5; color: var(--text-muted); }
.st-sub { display: block; font-size: .78rem; font-weight: 400; color: var(--text-muted); }
.st-prov { font-size: .8rem; color: var(--text-muted); overflow-wrap: anywhere; }
.st-link { font-weight: 700; color: var(--primary-dark); }
.st-list { max-width: 600px; padding-left: 0; list-style: none; margin: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; line-height: 1.6; overflow-wrap: anywhere; }
.st-list li { color: var(--text-secondary); margin-bottom: 4px; }
/* The site's global li has a bullet and padding; cards and legends do not want them. */
.st-legend li { padding-left: 0; margin-bottom: 0; }
.st-kpis > li { margin-bottom: 0; }
.st-kpis li::before, .st-legend li::before { content: none; }
.st-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Key figures */
.st-kpis { list-style: none; margin: 0 0 24px; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr)); gap: 10px; }
.st-kpis > .st-kpi {
  display: grid; align-content: start; gap: 2px; padding: clamp(10px, 2vw, 18px); overflow-wrap: anywhere; background: var(--bg-card); border: 1px solid var(--separator); border-radius: 14px; min-width: 0;
}
.st-kpi--main { grid-column: 1 / -1; background: var(--primary-pale); border-color: var(--primary-light); }
.st-kpi__num { font-size: 1.45rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; color: var(--primary-dark); font-variant-numeric: tabular-nums; }
.st-kpi--main .st-kpi__num { font-size: 2.4rem; }
.st-kpi__label { font-size: .88rem; line-height: 1.35; color: var(--text-secondary); }
.st-kpi__week { font-size: .8rem; color: var(--text-muted); }
.st-kpis--five { grid-template-columns: repeat(auto-fit, minmax(min(100%, 10.5rem), 1fr)); }
@media (min-width: 960px) {
  .st-kpi__num { font-size: 1.7rem; }
}
/* Figures */
.st-fig { margin: 0 0 28px; padding: 18px 16px 14px; background: var(--bg-card); border: 1px solid var(--separator); border-radius: 16px; }
.st-figcap { font-weight: 800; font-size: 1rem; line-height: 1.35; letter-spacing: -.01em; margin: 0 0 10px; max-width: 60ch; }
.st-chart { display: block; width: 100%; height: auto; }
.st-chart--wide { display: none; }
@media (min-width: 720px) { .st-chart--narrow { display: none; } .st-chart--wide { display: block; } }
.st-chart text { font-family: inherit; fill: var(--text-secondary); }
.st-tick { font-size: 13px; fill: var(--text-muted); }
.st-ylabel { font-size: 13px; font-weight: 700; fill: var(--text-secondary); }
.st-endlabel, .st-barlabel { font-size: 13px; font-weight: 800; fill: var(--text-primary); }
.st-rowlabel { font-size: 12.5px; fill: var(--text-primary); }
.st-halo { paint-order: stroke; stroke: #fff; stroke-width: 3px; stroke-linejoin: round; }
.st-legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 12px 0 0; padding: 0; font-size: .85rem; color: var(--text-secondary); }
.st-legend li { display: inline-flex; align-items: center; gap: 8px; }
.st-swatch { flex: none; }

/* Region picker */
.st-region[hidden], .st-fig[hidden] { display: none; }
.st-region { margin: 14px 0 20px; }
.st-label { display: block; font-size: .85rem; font-weight: 700; color: var(--text-secondary); margin-bottom: 6px; }
.st-select {
  min-height: 48px; width: 100%; max-width: 320px; padding-block: 10px; font: inherit; font-size: 1rem; color: var(--text-primary);
  background-color: #fff; border: 1.5px solid #A9B5A5; border-radius: 10px; margin-bottom: 14px;
}
.st-select:focus-visible, .st-details summary:focus-visible, .st-tablewrap:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.st-fig--region { margin-bottom: 12px; }

/* Tables */
.st-details { margin-top: 14px; }
.st-details > summary { cursor: pointer; width: fit-content; padding-block: 10px; min-height: 44px; font-weight: 700; color: var(--primary-dark); }
.st-tablewrap { margin-top: 10px; overflow-x: auto; border: 1px solid var(--separator); border-radius: 12px; background: #fff; max-height: 460px; overflow-y: auto; }
.st-section > .st-tablewrap { max-height: none; }
.st-table { width: 100%; border-collapse: collapse; font-size: .88rem; font-variant-numeric: tabular-nums; }
.st-table caption { text-align: left; padding: 10px 12px; font-weight: 700; color: var(--text-secondary); font-size: .85rem; }
.st-table th, .st-table td { padding: 8px 12px; border-top: 1px solid var(--separator); text-align: left; vertical-align: top; }
.st-table thead th { position: sticky; top: 0; background: var(--primary-pale); font-size: .8rem; color: var(--primary-dark); z-index: 1; }
.st-table .num { text-align: right; white-space: nowrap; }
.st-table tbody th { font-weight: 600; background: #fff; white-space: nowrap; }

/* Explanation box and closing blocks */
.st-box { margin: 8px 0 20px; padding: 16px 18px; border-radius: 14px; background: var(--primary-pale); border: 1px solid var(--primary-light); max-width: 70ch; }
.st-box .st-h3 { margin-top: 0; }
.st-box p { margin: 0 0 8px; line-height: 1.6; }
.st-about { margin-bottom: 24px; padding-top: 24px; border-top: 1px solid var(--separator); }
.st-about p { max-width: 70ch; color: var(--text-secondary); }

/* Radar tabs: a sticky anchor bar. Without JavaScript it jumps to sections; with it, one panel shows at a time. */
.rd-tabs { position: sticky; top: 64px; z-index: 5; margin: 16px -4px 0; padding: 4px 0; background: var(--bg-base); }
.rd-tabs ul { list-style: none; display: flex; gap: 5px; margin: 0; padding: 5px 3px; overflow-x: auto; scrollbar-width: thin; }
.rd-tabs li { margin: 0; padding: 0; flex: none; }
.rd-tabs li::before { content: none; }
.rd-tabs a { display: inline-flex; align-items: center; min-height: 44px; padding: 4px 13px; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--text-primary); font-weight: 700; font-size: .92rem; text-decoration: none; }
.rd-tabs a:hover { background: var(--sage-wash); }
.rd-tabs a:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.rd-tabs a[aria-current="true"] { background: var(--sage-wash); border-color: var(--primary); color: var(--primary-dark); }
.rd-panel[hidden] { display: none; }
.rd-panel > .st-section:first-child { margin-top: 28px; }
.guide .rd-overview { padding: 0; }

/* Season picker (js/stats.js) and mobile tab bar */
.st-chart .is-off { display: none; }
.st-legend button { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 4px 10px; font: inherit; color: inherit; background: #fff; border: 1.5px solid #A9B5A5; border-radius: 999px; cursor: pointer; }
.st-legend button[aria-pressed="false"] { opacity: .55; text-decoration: line-through; background: transparent; }
.st-legend button:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
@media (max-width: 639px) {
  .rd-tabs { position: static; margin-top: 8px; }
  .rd-tabs ul { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; overflow: visible; }
  .rd-tabs li { min-width: 0; }
  .rd-tabs a { justify-content: center; width: 100%; height: 100%; min-height: 44px; padding: 4px 5px; font-size: .85rem; line-height: 1.25; text-align: center; overflow-wrap: anywhere; }
}
@media (max-width: 359px) {
  .rd-tabs ul { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 640px) {
  /* The global anchor offset clears the header. Heading targets also need to clear the sticky Radar tabs. */
  .rd-panel .st-section > [id] { scroll-margin-top: 64px; }
}

/* Export controls live with the radar's method and sources. */
#chart-sharing > section { margin-block: 16px; }
.dp-chart-preview { display: block; width: min(100%, 540px); height: auto; border: 1px solid var(--line); }
.dp-embed-code summary { min-height: 44px; cursor: pointer; padding-block: 10px; }
.dp-code { padding: 12px; border: 1px solid var(--line); border-radius: 8px; white-space: pre-wrap; overflow-wrap: anywhere; }
}
