/* NerdyWatts — no framework, no webfonts. Fast pages are worth real money:
   ad viewability tracks render speed, and this is served from a CDN. */
:root {
  /* Softened toward the register public-agency publications use: a mid
     institutional blue rather than flag navy, neutral rather than tinted
     greys, and a brick that reads as ink rather than alarm. Every pair
     below clears WCAG AA. This is a private site in a civic idiom - no
     seal, no insignia, nothing claiming official standing. */
  --serif: Georgia, "Iowan Old Style", "Times New Roman", Times, serif;
  --bg: #f5f6f7; --fg: #1b1b1b; --muted: #565c65; --line: #d9dce0;
  --accent: #205493; --accent-fg: #fff; --accent-2: #8b2f45;
  --warn-bg: #faf3d1; --warn-line: #c9b165; --flag: #8a5a0b;
  --card: #fff; --band: #1b3a5f; --band-fg: #dfe6ec; --band-link: #a9c9e8;
  --radius: .25rem; --max: 68rem;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14181d; --fg: #e4e7ea; --muted: #a3abb4; --line: #2c333c;
    --accent: #9ec3e8; --accent-fg: #0d2136; --accent-2: #e59aab;
    --warn-bg: #241f14; --warn-line: #55492c; --flag: #d9a75f;
    --card: #1b2028; --band: #0d1116; --band-fg: #c9d1d9; --band-link: #9ec3e8;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 16px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 1.25rem; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--accent); color: var(--accent-fg); padding: .5rem 1rem; z-index: 10; }

/* Keyboard focus was relying on the browser default, which is nearly invisible
   against the accent blue on links. */
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; border-radius: .2rem; }

a { color: var(--accent); }
h1, h2, h3 { font-family: var(--serif); font-weight: 700; }
h1 { font-size: clamp(1.7rem, 3.6vw, 2.4rem); line-height: 1.2; letter-spacing: -.01em; margin: 1.5rem 0 .5rem; }
h2 { font-size: 1.35rem; margin: 2.5rem 0 .75rem; padding-bottom: .35rem; border-bottom: 1px solid var(--line); }
h3 { font-size: 1.1rem; margin: 1.5rem 0 .5rem; }
.lede { font-size: 1.15rem; color: var(--muted); max-width: 48rem; }
.note, .meta { color: var(--muted); font-size: .9rem; }

.site-header { border-top: 4px solid var(--accent); border-bottom: 1px solid var(--line); background: var(--card); }
.site-header .row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding-block: .85rem; }
.brand { font-family: var(--serif); font-weight: 700; text-decoration: none; color: var(--fg); font-size: 1.1rem; }
nav a { margin-left: 1.1rem; text-decoration: none; font-size: .93rem; }
nav a:hover { text-decoration: underline; }

.hero { padding: 2rem 0 1rem; }
.btn {
  display: inline-block; background: var(--accent); color: var(--accent-fg);
  padding: .7rem 1.2rem; border-radius: var(--radius); text-decoration: none; font-weight: 600;
}
.btn:hover { filter: brightness(1.1); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 1rem; margin: 2rem 0; }
.stats div { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }
.stats strong { display: block; font-size: 1.6rem; letter-spacing: -.02em; }
.stats span { color: var(--muted); font-size: .85rem; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: .75rem; }
.card {
  display: block; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: .85rem; text-decoration: none; color: inherit;
}
.card:hover { border-color: var(--accent); }
.card strong { display: block; }
.card span { display: block; color: var(--muted); font-size: .85rem; }
.card .rate { color: var(--fg); font-variant-numeric: tabular-nums; }

/* Nine columns of data do not belong in a reading measure. At 68rem the last
   column was clipped even on a 1920px display, with 800px of screen going
   spare, so the results block gets its own wider measure and is re-centred on
   the page. Below this it stays in the wrap and scrolls. */
@media (min-width: 74rem) {
  #results {
    --results-measure: min(78rem, calc(100vw - 3rem));
    width: var(--results-measure);
    margin-left: calc((100% - var(--results-measure)) / 2);
  }
}

/* Overlay scrollbars stay invisible until they are used, which makes a clipped
   table look broken rather than scrollable. Where one still scrolls, show it. */
table.data { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
table.data::-webkit-scrollbar { height: 9px; }
table.data::-webkit-scrollbar-track { background: transparent; }
table.data::-webkit-scrollbar-thumb { background: var(--line); border-radius: 5px; }
table.data::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* Wide tables scroll inside their own box; the page never scrolls sideways. */
table.data { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: .93rem; display: block; overflow-x: auto; }
table.data th, table.data td { text-align: left; padding: .55rem .7rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data thead th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
table.data .n { text-align: right; font-variant-numeric: tabular-nums; }
table.data tbody tr:hover { background: var(--card); }

/* The price columns are the whole point of the results table, so names
   truncate rather than pushing them out of view on a narrow screen. */
table.results { table-layout: auto; }
table.results .name { white-space: nowrap; max-width: 15rem; }
/* Truncate the text, not the cell, so the quality flag beside it stays visible. */
table.results .name > span {
  display: inline-block; max-width: calc(100% - 1.3rem); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom;
}
table.results .rank { width: 2.5rem; color: var(--muted); }
table.results td.struct { font-size: .85rem; color: var(--muted); }
/* Between the wider measure and the phone layout the names give up room first:
   a truncated name keeps its tooltip, where a dropped column loses the value. */
@media (max-width: 74rem) {
  table.results .name { max-width: 9.5rem; }
}
@media (max-width: 60rem) {
  table.results .struct { display: none; }
}
/* On a phone the identity columns alone filled the screen and every price was
   off the right edge - the opposite of what the table is for. The monthly fixed
   charge and the delta give way so that $/kWh and the annual total are in view
   without scrolling; both remain on the tariff's own page. */
@media (max-width: 48rem) {
  table.results .fixed, table.results .delta { display: none; }
  table.results .name { max-width: 7rem; }
  table.results th, table.results td { padding: .5rem .4rem; }
}
/* Narrowest phones: the rank number is redundant beside rows already in rank
   order, and it is the last thing worth the width. */
@media (max-width: 26rem) {
  table.results { font-size: .85rem; }
  table.results .rank { display: none; }
}
/* Truncating to "Pacific ..." on a phone identifies nothing, so at this width
   the names wrap onto a second line instead. Taller rows, readable rows. */
@media (max-width: 48rem) {
  table.results .name, table.results .name > span {
    white-space: normal; overflow: visible; text-overflow: clip; max-width: 9rem;
  }
}
table.results td.vintage { font-size: .85rem; font-variant-numeric: tabular-nums; cursor: help; }
table.results .v-stale, table.results .v-unknown { color: var(--flag); }
@media (max-width: 60rem) { table.results .vintage { display: none; } }
.warn label.inline { display: block; margin-top: .5rem; font-weight: 600; font-size: .92rem; }
.warn label.inline input { margin-right: .4rem; }

table.results .export { font-size: .85rem; cursor: help; }
table.results .export.uncertain { color: var(--flag); }

.flag { text-decoration: none; cursor: help; color: var(--flag); }
.btn-secondary {
  background: var(--card); color: var(--fg); border: 1px solid var(--line);
  padding: .55rem 1rem; border-radius: var(--radius); font: inherit; cursor: pointer;
}
.btn-secondary:hover { border-color: var(--accent); }

.calc { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 1rem; margin: 1.5rem 0; }
.field label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .3rem; }
.field .opt { font-weight: 400; color: var(--muted); }
.field select, .field input {
  width: 100%; padding: .55rem .6rem; font-size: 1rem; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--card); color: var(--fg);
}
.field.checkbox label { font-weight: 600; display: flex; gap: .5rem; align-items: flex-start; }
.field.checkbox input { width: auto; margin-top: .2rem; }
.field small { display: block; color: var(--muted); font-size: .82rem; margin-top: .25rem; }
.status { color: var(--muted); margin: .5rem 0; min-height: 1.5rem; }

.warn {
  background: var(--warn-bg); border: 1px solid var(--warn-line);
  border-left: 4px solid var(--flag); border-radius: 0 var(--radius) var(--radius) 0;
  padding: .85rem 1rem; margin: 1.25rem 0;
}
.caveat { border-top: 1px solid var(--line); margin-top: 2.5rem; padding-top: .5rem; }
.crumbs { font-size: .88rem; color: var(--muted); margin-top: 1rem; }
blockquote { border-left: 3px solid var(--line); margin: 1rem 0; padding: .25rem 0 .25rem 1rem; color: var(--muted); }
code { background: var(--card); border: 1px solid var(--line); border-radius: .25rem; padding: .1rem .3rem; font-size: .88em; }

.prose { max-width: 44rem; }
.prose p, .prose li { font-size: 1.03rem; }
.prose table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.prose th, .prose td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--line); }
.posts { list-style: none; padding: 0; }
.posts li { border-bottom: 1px solid var(--line); padding: 1rem 0; }
.posts a { font-size: 1.15rem; font-weight: 600; }
.posts p { margin: .3rem 0 0; color: var(--muted); }

/* Ad slots reserve their height so inserting one never shifts the page (CLS). */
.ad { min-height: 100px; margin: 2rem 0; }

.site-footer {
  margin-top: 4rem; padding: 2.25rem 0; font-size: .9rem;
  background: var(--band); color: var(--band-fg); border-top: 4px solid var(--accent);
}
.site-footer a { color: var(--band-link); }
.site-footer p { margin: .5rem 0; }
.disclaimer { max-width: 46rem; }
