/* Illinois Installer Capacity Model. Builds on home.css + case-study.css; only adds .cap-* pieces, using the shared
   tokens (colours, spacing scale, type) so the page reads as part of the Base Power research. */

/* The model spans both columns of a case-study section so inputs and results fit on one screen. */
.cap-model { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: var(--s6) var(--s7); padding-top: var(--s4); border-top: 1px solid var(--ink); min-height: 34rem; }
@media (min-width: 880px) { .cs-section > .cap-model { grid-column: 1 / -1; margin-top: var(--s4); } }
@media (max-width: 879px) { .cap-model { grid-template-columns: 1fr; margin-top: var(--s4); min-height: 0; } }

/* Inputs */
.cap-inputs { display: flex; flex-direction: column; gap: var(--s4); }
.cap-input { display: flex; flex-direction: column; gap: var(--s1); }
.cap-input-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s4); }
.cap-input label { font-size: .9375rem; font-weight: 500; }
.cap-input-value { font: 400 1.25rem/1 var(--serif); font-variant-numeric: lining-nums tabular-nums; white-space: nowrap; }
.cap-input input[type="range"] { width: 100%; min-height: 44px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.cap-basis { font-size: .8125rem; line-height: 1.5; color: var(--muted); }
.cap-reset { align-self: flex-start; padding: 0; border: 0; background: none; font: inherit; font-size: .9375rem; cursor: pointer; }
@media (pointer: fine) { .cap-input input[type="range"] { min-height: 28px; } }

/* Tags: assumption types and timing status share one quiet badge style. */
.cap-tag { display: inline-block; padding: 0 var(--s2); border: 1px solid currentColor; border-radius: 2px; font-size: .6875rem; font-weight: 600; letter-spacing: .09em; line-height: 1.6; text-transform: uppercase; white-space: nowrap; }
.cap-tag--scenario, .cap-tag--public { color: var(--accent); }
.cap-tag--illustrative, .cap-tag--none { color: var(--muted); }
.cap-tag--modeled { color: var(--ink); }

/* Outputs */
.cap-outputs { display: flex; flex-direction: column; gap: var(--s4); }
.cap-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cap-tile dd { display: flex; flex-direction: column; gap: var(--s1); }
.cap-value { font: 400 2rem/1.1 var(--serif); font-variant-numeric: lining-nums tabular-nums; }
.cap-note { font: 400 .8125rem/1.45 var(--sans); color: var(--muted); min-height: calc(3 * 1.45em); }
.cap-cite { font: 400 .8125rem/1.45 var(--sans); color: var(--muted); }
.cap-from { font-style: italic; }
.cap-ref { color: var(--accent); text-underline-offset: .2em; padding-inline: .1em; }
.cap-ref:hover, .cap-ref:focus-visible { color: var(--ink); }
.cap-verdict { min-height: 15.5rem; display: flex; flex-direction: column; gap: var(--s3); padding: var(--s4); background: var(--stone); border-left: 2px solid var(--accent); font-size: .9375rem; line-height: 1.55; }
.cap-verdict strong { font-weight: 600; }
@media (max-width: 479px) { .cap-tiles { grid-template-columns: 1fr; } }

/* While the data loads, keep the empty shells' space but don't show them (or their labels) to anyone. */
html:not([data-cap-state]) [data-needs-data] { visibility: hidden; }

/* Journey */
.cap-stages li { display: grid; grid-template-columns: 2.5rem minmax(0, 1fr); column-gap: var(--s4); row-gap: var(--s2); padding-block: var(--s4); border-top: 1px solid var(--rule); }
.cap-stages li:last-child { border-bottom: 1px solid var(--rule); }
.cap-stages .cs-n { grid-row: 1 / span 3; }
.cap-stages h3 { font: 400 1.25rem/1.3 var(--serif); overflow-wrap: anywhere; }
.cap-stages p, .cap-basis, .cap-note, .cap-verdict { overflow-wrap: anywhere; }
.cap-stages .cap-tag, .cap-basis .cap-tag { white-space: normal; }
.cap-stages p { color: var(--muted); font-size: .9375rem; }
.cap-stage--public h3 { color: var(--accent); }

/* Figures table: numbers right-aligned so magnitudes compare. */
.cap-figures .cs-table th:first-child { width: 44%; }
.cap-figures .cap-num { text-align: right; color: var(--ink); font-variant-numeric: lining-nums tabular-nums; white-space: nowrap; }
.cap-figures thead th:nth-child(2) { text-align: right; }
.cap-figures .cap-text { color: var(--ink); overflow-wrap: anywhere; }

@media (max-width: 699px) {
  /* Stack each figure into a card so nothing needs horizontal scrolling. */
  .cap-figures .cs-table, .cap-figures tbody, .cap-figures tr, .cap-figures th, .cap-figures td { display: block; width: auto !important; }
  .cap-figures thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .cap-figures tr { padding-block: var(--s3); border-bottom: 1px solid var(--rule); }
  .cap-figures th, .cap-figures td { padding: var(--s1) 0; border: 0; text-align: left !important; white-space: normal; }
  .cap-figures .cap-num { white-space: normal; }
  .cap-figures td::before { content: attr(data-label) " · "; font-size: .6875rem; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
}

/* Sources */
.cap-sources li { display: grid; grid-template-columns: 2.5rem minmax(0, 1fr); column-gap: var(--s4); padding-block: var(--s3); border-top: 1px solid var(--rule); }
.cap-sources li:last-child { border-bottom: 1px solid var(--rule); }
.cap-sources li:target, .cap-sources .cap-source--target { background: var(--stone); }
.cap-sources li:focus-visible, .cap-sources li:target:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (forced-colors: active) { .cap-sources li:target, .cap-sources .cap-source--target { outline: 2px solid Highlight; } }
.cap-source-title { min-height: 0; display: inline; font-size: .9375rem; overflow-wrap: anywhere; }

.cap-error { margin-top: clamp(3.5rem, 7vw, 5.5rem); padding: var(--s4); border-left: 2px solid var(--accent); background: var(--stone); }
.cap-error p + p { margin-top: var(--s2); }

[hidden] { display: none !important; }

@media (max-width: 879px) { .cap-verdict { min-height: 0; } .cap-note { min-height: calc(4 * 1.45em); } }

/* Print: a static record of the starting scenario with full source URLs. */
@media print {
  .cap-inputs input[type="range"], .cap-reset, .skip-link, .site-header nav, .cs-next { display: none !important; }
  .cap-model { grid-template-columns: 1fr 1fr; min-height: 0; }
  .cap-source-title::after { content: ": " attr(href); font-size: .75rem; color: var(--muted); }
  .cs-section { break-inside: avoid-page; }
}

/* Very large text (200%+) on narrow screens: let long words and labels wrap instead of pushing the page sideways.
   Scoped to this page; capacity.css loads nowhere else. */
.cs-hero h1, .cap-figures, .cap-sources { overflow-wrap: anywhere; }

/* When partners are needed: chart (one series, site accent), then the sensitivity table. */
.cap-chart { margin: 0; display: flex; flex-direction: column; gap: var(--s3); }
.cap-chart-plot { position: relative; width: 100%; }
.cap-chart-svg { display: block; overflow: visible; }
.cap-grid { stroke: var(--rule); stroke-width: 1; }
.cap-axis { font: 400 .75rem/1 var(--sans); fill: var(--muted); font-variant-numeric: tabular-nums; }
.cap-chart-label { font: 500 .75rem/1 var(--sans); fill: var(--ink); paint-order: stroke; stroke: var(--paper); stroke-width: 4px; stroke-linejoin: round; }
.cap-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.cap-area { fill: var(--accent); fill-opacity: .1; stroke: none; }
.cap-ref-line { stroke: var(--ink); stroke-opacity: .45; stroke-width: 1; }
.cap-cross { stroke: var(--muted); stroke-width: 1; }
.cap-leader { stroke: var(--muted); stroke-width: 1; }
.cap-marker { fill: var(--accent); stroke: var(--paper); stroke-width: 2; }
.cap-tip { position: absolute; top: 0; left: 0; max-width: 18rem; padding: var(--s1) var(--s2); background: var(--paper); border: 1px solid var(--rule); font-size: .8125rem; line-height: 1.4; pointer-events: none; box-shadow: 0 1px 4px rgb(0 0 0 / .08); }
.cap-chart-desc { font-size: .875rem; color: var(--muted); }
.cap-chart-table summary { display: inline-flex; min-height: 44px; align-items: center; cursor: pointer; font-size: .9375rem; }
.cap-chart-table table { margin-top: var(--s3); font-size: .875rem; }
.cap-chart-table .cap-num, .cap-chart-table thead th:not(:first-child) { text-align: right; }
.cap-subhead { margin-top: var(--s5); font: 400 1.25rem/1.3 var(--serif); }
.cap-sens-conclusion { line-height: 1.6; }
.cap-sens { font-size: .875rem; }
.cap-sens td, .cap-sens th { overflow-wrap: anywhere; }
.cap-sens-main { display: block; color: var(--ink); }
.cap-sens-current th { color: var(--accent); }
@media (forced-colors: active) { .cap-line, .cap-marker { stroke: CanvasText; } .cap-area { fill: CanvasText; } }

/* Permit timing: unchecked rows are visibly unchecked, not blank. */
.cap-permits .cs-table th:first-child { width: 22%; }
.cap-unchecked td { font-style: italic; color: var(--muted); }
@media (max-width: 699px) {
  .cap-permits .cs-table, .cap-permits tbody, .cap-permits tr, .cap-permits th, .cap-permits td { display: block; width: auto !important; }
  .cap-permits thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .cap-permits tr { padding-block: var(--s3); border-bottom: 1px solid var(--rule); }
  .cap-permits th, .cap-permits td { padding: var(--s1) 0; border: 0; }
  .cap-permits td::before { content: attr(data-label) ": "; font-size: .6875rem; letter-spacing: .09em; text-transform: uppercase; font-style: normal; color: var(--muted); }
  .cap-sens thead th:first-child { width: 28%; }
}

/* One-line stand-in for the permit table while it is unpublished. */
.cap-next-line { margin-top: clamp(2.5rem, 5vw, 3.5rem); padding-top: var(--s4); border-top: 1px solid var(--rule); }
