/* Balcony Solar Advisor — friendly daylight theme: deep navy, cell blue, sun amber */
:root {
  --bg: #ffffff;
  --sky: #eef4fa;
  --paper: #ffffff;
  --ink: #13284a;
  --ink-soft: #52627a;
  --cell: #2450d6;
  --cell-deep: #183a9e;
  --cell-pale: #e8eefc;
  --sun: #f5b301;
  --sun-pale: #fff4d1;
  --sun-ink: #7d5b00;
  --grid: #8391a7;
  --export: #17975f;
  --line: #dbe3ec;
  --focus: #2450d6;
  --shadow: 0 1px 2px rgba(19,40,74,.06), 0 8px 24px rgba(19,40,74,.07);
  --st-effect: #14a35a; --st-signed: #7fd2a6; --st-gov: #f39200; --st-progress: #ffd25c; --st-stalled: #c8d2de; --st-none: #edf1f6;
  --measure: 66ch;
  --wrap: 1160px;
  --font-head: "Bricolage Grotesque", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --font-body: "Atkinson Hyperlegible", "Segoe UI", system-ui, -apple-system, sans-serif;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 1.0625rem; line-height: 1.65; overflow-x: hidden; }
img, svg { max-width: 100%; }
a { color: var(--cell); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--cell-deep); text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 4px; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 clamp(18px, 4vw, 40px); }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 12px; top: 12px; background: var(--bg); padding: 8px 12px; z-index: 30; }

/* Full-bleed tinted bands without extra markup */
.hero, .band.tint, .page-head, main > .wrap > .crumbs {
  background: var(--sky); box-shadow: 0 0 0 100vmax var(--sky); clip-path: inset(0 -100vmax);
}

/* ---------------- Header + mega menu ---------------- */
.site-head { background: var(--bg); border-bottom: 1px solid var(--line); position: relative; z-index: 20; }
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; gap: 20px; height: 72px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-family: var(--font-head);
  font-weight: 700; font-size: 1.15rem; letter-spacing: -0.01em; white-space: nowrap; }
.brand:hover { color: var(--ink); }
.brand svg { width: 34px; height: 34px; flex: none; }
.head-right { display: flex; align-items: center; gap: 6px; }
.toplinks { display: flex; gap: 2px; margin-right: 6px; }
.toplinks a { color: var(--ink); text-decoration: none; font-weight: 700; font-size: .95rem; padding: 8px 12px; border-radius: 8px; }
.toplinks a:hover { background: var(--sky); color: var(--ink); }
.toplinks a[aria-current="page"] { color: var(--cell); }
.cta-link { background: var(--cell); color: #fff !important; text-decoration: none; padding: 10px 18px; border-radius: 10px; font-weight: 700; font-size: .95rem; }
.cta-link:hover { background: var(--cell-deep); }
.menu { position: static; border: 0; padding: 0; margin: 0; max-width: none; background: none; }
.menu > summary { list-style: none; cursor: pointer; font-family: var(--font-body); font-weight: 700; font-size: .95rem; padding: 9px 14px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg); display: flex; align-items: center; gap: 9px; white-space: nowrap; }
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary::after { content: ""; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg); transition: transform .15s; font-size: 0; }
.menu[open] > summary { background: var(--ink); color: #fff; border-color: var(--ink); }
.menu[open] > summary::after { transform: translateY(2px) rotate(225deg); }
.menu-panel { position: absolute; left: 50%; transform: translateX(-50%); top: 100%; width: min(100vw, var(--wrap)); background: var(--bg);
  border: 1px solid var(--line); border-top: 0; border-radius: 0 0 18px 18px; box-shadow: 0 28px 48px rgba(19,40,74,.14);
  padding: 30px clamp(18px, 4vw, 40px) 34px; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0 32px; }
.menu-panel > div { border-top: 3px solid var(--sun); padding-top: 14px; }
.menu-panel h4 { margin: 0 0 10px; font-family: var(--font-head); font-size: 1.02rem; color: var(--ink); }
.menu-panel a { display: block; color: var(--ink-soft); text-decoration: none; padding: 5px 0; font-size: .95rem; }
.menu-panel a:hover { color: var(--cell); }
@media (max-width: 1040px) { .toplinks { display: none; } .menu-panel { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 26px 28px; } }
@media (max-width: 640px) {
  .cta-link { display: none; }
  .site-head .wrap { height: 64px; }
  .brand { font-size: 1rem; } .brand svg { width: 28px; height: 28px; }
  .menu-panel { position: fixed; left: 0; right: 0; transform: none; top: 64px; width: auto; max-height: calc(100vh - 64px); overflow: auto;
    grid-template-columns: 1fr 1fr; border-radius: 0; }
}
@media (max-width: 420px) { .menu-panel { grid-template-columns: 1fr; } }

/* ---------------- Type ---------------- */
h1, h2, h3 { font-family: var(--font-head); line-height: 1.1; letter-spacing: -0.02em; margin: 0; color: var(--ink); }
h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); font-weight: 800; max-width: 18ch; }
h2 { font-size: clamp(1.5rem, 2.8vw, 2.05rem); font-weight: 700; margin-top: 2.4em; }
h3 { font-size: 1.2rem; font-weight: 700; margin-top: 1.8em; }
p, ul, ol { margin: 0.9em 0 0; }
.lead { font-size: clamp(1.12rem, 1.7vw, 1.28rem); color: var(--ink-soft); max-width: 56ch; margin-top: 1.1rem; line-height: 1.55; }
.prose { max-width: var(--measure); }
.prose li + li { margin-top: .4em; }
.muted { color: var(--ink-soft); }
.small { font-size: .9rem; }
.updated { color: var(--ink-soft); font-size: .9rem; margin-top: 1.2rem; }

/* ---------------- Page header ---------------- */
.crumbs { font-size: .88rem; color: var(--ink-soft); padding-top: 20px; margin: 0; }
.crumbs a { color: var(--ink-soft); }
.crumbs span[aria-hidden] { margin: 0 7px; }
.page-head { padding: 26px 0 44px; margin-bottom: 8px; }
.answer { margin-top: 1.5rem; max-width: 64ch; background: var(--bg); border-radius: 14px; padding: 18px 22px; border-left: 5px solid var(--sun); box-shadow: var(--shadow); font-size: 1.08rem; }
.answer p { margin: 0; }

/* ---------------- Layout ---------------- */
.article { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 64px; align-items: start; }
.toc { position: sticky; top: 20px; font-size: .92rem; margin-top: 2.8em; padding: 16px 18px; border-radius: 14px; background: var(--sky); }
.toc b { display: block; font-family: var(--font-head); margin-bottom: 8px; }
.toc a { display: block; color: var(--ink-soft); text-decoration: none; padding: 4px 0; }
.toc a:hover { color: var(--cell); }
@media (max-width: 1000px) { .article { grid-template-columns: 1fr; } .toc { display: none; } }
.band { padding: clamp(48px, 7vw, 80px) 0; }
.band h2 { margin-top: 0; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: clamp(28px, 4vw, 56px); align-items: center; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---------------- Hero ---------------- */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: clamp(28px, 5vw, 60px); align-items: center; padding: clamp(36px, 6vw, 72px) 0 clamp(44px, 6vw, 76px); }
.hero h1 { font-size: clamp(2.3rem, 4.6vw, 3.5rem); max-width: 14ch; }
.hero .instrument { margin: 0; }
@media (max-width: 900px) { .hero { grid-template-columns: 1fr; } }

/* ---------------- Cards / instruments ---------------- */
.instrument { background: var(--paper); border: 1px solid var(--line); border-radius: 18px; padding: clamp(16px, 2.6vw, 28px); margin: 2.2rem 0; box-shadow: var(--shadow); }
.instrument figcaption { color: var(--ink-soft); font-size: .9rem; margin-top: 14px; }

/* ---------------- Buttons & controls ---------------- */
.btn { display: inline-flex; align-items: center; font: inherit; font-weight: 700; cursor: pointer; border: 0; border-radius: 12px; padding: 0 22px; min-height: 50px;
  background: var(--cell); color: #fff; text-decoration: none; box-shadow: 0 4px 14px rgba(36,80,214,.25); }
.btn:hover { background: var(--cell-deep); color: #fff; }
.controls { display: grid; gap: 20px; margin-top: 20px; }
.ctrl label, .ctrl .lbl { display: block; font-weight: 700; font-size: .95rem; margin-bottom: 7px; }
.ctrl .hint { display: block; font-weight: 400; color: var(--ink-soft); font-size: .86rem; }
input[type="range"] { width: 100%; accent-color: var(--cell); height: 28px; }
select, input[type="number"] { font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%; }
select:focus, input[type="number"]:focus { border-color: var(--cell); }
.unit-input { display: flex; align-items: center; gap: 10px; }
.unit-input span { color: var(--ink-soft); white-space: nowrap; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; background: var(--sky); padding: 4px; border-radius: 12px; }
.seg button { font: inherit; font-weight: 700; font-size: .9rem; color: var(--ink-soft); background: transparent; border: 0; border-radius: 9px; padding: 7px 13px; cursor: pointer; min-height: 36px; }
.seg button[aria-pressed="true"] { background: var(--bg); color: var(--ink); box-shadow: 0 1px 3px rgba(19,40,74,.18); }
.compass { display: grid; grid-template-columns: repeat(3, 54px); grid-template-rows: repeat(3, 46px); gap: 6px; }
.compass button { font: inherit; font-weight: 700; border: 1px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 10px; cursor: pointer; }
.compass button[aria-pressed="true"] { background: var(--cell); color: #fff; border-color: var(--cell); }
.compass .hub { display: grid; place-items: center; font-size: .72rem; color: var(--ink-soft); }

/* ---------------- Readouts ---------------- */
.readouts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-top: 18px; }
.readout { background: var(--sky); border-radius: 12px; padding: 12px 14px 12px 18px; position: relative; overflow: hidden; }
.readout::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--line); }
.readout.solar::before { background: var(--sun); } .readout.grid::before { background: var(--grid); }
.readout.out::before { background: var(--export); } .readout.home::before { background: var(--cell); }
.readout .v { font-family: var(--font-head); font-weight: 800; font-size: 1.6rem; line-height: 1.15; font-variant-numeric: tabular-nums; }
.readout .k { color: var(--ink-soft); font-size: .85rem; }
.explain { margin-top: 14px; font-size: 1rem; min-height: 3.2em; }

/* ---------------- Paths ---------------- */
.paths { list-style: none; padding: 0; margin: 1.6rem 0 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.paths a { display: block; height: 100%; padding: 22px 22px 24px; background: var(--paper); border: 1px solid var(--line); border-radius: 16px; text-decoration: none; color: var(--ink); transition: border-color .15s, transform .15s; }
.paths a:hover { border-color: var(--cell); transform: translateY(-2px); color: var(--ink); }
.paths a strong { display: block; font-family: var(--font-head); font-size: 1.2rem; line-height: 1.25; }
.paths a span { display: block; color: var(--ink-soft); margin-top: 8px; font-size: .95rem; }

/* ---------------- Tables ---------------- */
.table-wrap { overflow-x: auto; margin-top: 1.2rem; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; }
table { border-collapse: collapse; width: 100%; min-width: 540px; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line); }
tbody tr:last-child td { border-bottom: 0; }
thead th { font-family: var(--font-head); font-size: .9rem; background: var(--sky); color: var(--ink); }
td.num, th.num { text-align: right; }
caption { text-align: left; color: var(--ink-soft); font-size: .88rem; padding: 12px 16px 4px; }
tr.hl td { background: var(--sun-pale); }
tbody tr:hover td { background: #f7fafd; }

/* ---------------- Status badges ---------------- */
.badge { display: inline-flex; align-items: center; gap: 7px; font-weight: 700; font-size: .86rem; padding: 4px 11px 4px 9px; border-radius: 999px; white-space: nowrap; background: var(--st-none); color: var(--ink); }
.badge i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.b-effect { background: #e3f6ec; } .b-effect i { background: var(--st-effect); }
.b-signed { background: #ecf8f1; } .b-signed i { background: var(--st-signed); }
.b-gov { background: #fff0dc; } .b-gov i { background: var(--st-gov); }
.b-progress { background: #fff7dc; } .b-progress i { background: var(--st-progress); }
.b-stalled { background: #eef1f5; } .b-stalled i { background: var(--st-stalled); }
.b-none { background: #f4f6f9; } .b-none i { background: var(--st-none); box-shadow: inset 0 0 0 1px var(--grid); }
.legend { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

/* ---------------- Facts strip ---------------- */
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: 10px; margin: 1.6rem 0 0; }
.facts > div { background: var(--bg); border-radius: 14px; padding: 14px 16px; box-shadow: var(--shadow); min-width: 0; }
.facts .k { font-size: .84rem; color: var(--ink-soft); }
.facts .v { font-family: var(--font-head); font-weight: 700; font-size: 1.2rem; line-height: 1.25; margin-top: 4px; }
.facts .badge { white-space: normal; font-family: var(--font-body); }

/* ---------------- Map ---------------- */
.map-wrap { position: relative; }
.usmap { width: 100%; height: auto; display: block; }
.usmap a, .usmap a text { text-decoration: none; }
.usmap path { stroke: #fff; stroke-width: 1.4; transition: opacity .15s; }
.usmap a:hover path, .usmap a:focus path { opacity: .78; }
.usmap .s-effect { fill: var(--st-effect); } .usmap .s-signed { fill: var(--st-signed); } .usmap .s-gov { fill: var(--st-gov); }
.usmap .s-progress { fill: var(--st-progress); } .usmap .s-stalled { fill: var(--st-stalled); } .usmap .s-none { fill: var(--st-none); }
.usmap text { font-family: var(--font-body); font-size: 11px; font-weight: 700; fill: var(--ink); pointer-events: none; }
.usmap .lab-dark { fill: #fff; }
.map-tip { position: absolute; pointer-events: none; background: var(--ink); color: #fff; padding: 8px 11px; border-radius: 8px; font-size: .88rem; max-width: 260px; opacity: 0; z-index: 4; }

/* ---------------- Callouts ---------------- */
.callout { background: var(--cell-pale); border-radius: 14px; padding: 16px 20px; margin: 1.6rem 0; max-width: var(--measure); }
.callout.warn { background: var(--sun-pale); }
.callout.good { background: #e6f6ee; }
.callout p:first-child { margin-top: 0; }

/* ---------------- Steps ---------------- */
ol.steps { padding-left: 0; list-style: none; counter-reset: s; }
ol.steps li { counter-increment: s; position: relative; padding: 6px 0 6px 46px; margin-top: 10px; }
ol.steps li::before { content: counter(s); position: absolute; left: 0; top: 4px; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--font-head); font-weight: 800; font-size: .95rem; background: var(--cell); color: #fff; }

/* ---------------- FAQ ---------------- */
.prose details, section details { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 0; margin-top: 10px; max-width: var(--measure); }
.prose details summary, section details summary { cursor: pointer; font-family: var(--font-head); font-weight: 700; font-size: 1.06rem; list-style: none; padding: 16px 20px;
  display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.prose details summary::-webkit-details-marker, section details summary::-webkit-details-marker { display: none; }
.prose details summary::after, section details summary::after { content: "+"; font-size: 1.4rem; font-weight: 400; color: var(--cell); line-height: 1; }
.prose details[open] summary::after, section details[open] summary::after { content: "\2212"; }
.prose details p, section details p { margin: 0; padding: 0 20px 18px; }
.sources { font-size: .9rem; color: var(--ink-soft); }
.sources li { margin-top: .3em; }

/* ---------------- Related ---------------- */
.related { margin-top: clamp(48px, 6vw, 72px); }
.related h2 { margin-top: 0; font-size: 1.4rem; }
.related ul { list-style: none; padding: 0; margin-top: 14px; display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.related li a { display: block; height: 100%; background: var(--sky); border-radius: 14px; padding: 16px 18px; text-decoration: none; color: var(--ink); font-family: var(--font-head); font-weight: 700; transition: background .15s; }
.related li a:hover { background: var(--cell-pale); color: var(--ink); }
.related li a span { display: block; font-family: var(--font-body); font-weight: 400; color: var(--ink-soft); font-size: .9rem; margin-top: 4px; }

/* ---------------- Calculator ---------------- */
.calc { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(18px, 3vw, 28px); align-items: start; margin-top: 36px; }
.calc .results { position: sticky; top: 16px; }
@media (max-width: 900px) { .calc { grid-template-columns: 1fr; } .calc .results { position: static; } }
.big-save { font-family: var(--font-head); font-weight: 800; font-size: clamp(2.8rem, 6vw, 3.9rem); line-height: 1; font-variant-numeric: tabular-nums; color: var(--ink); }
.big-save span.muted { font-family: var(--font-body); font-size: 1rem !important; font-weight: 700; margin-left: 8px; }
.bars { display: grid; grid-template-columns: repeat(12, 1fr); gap: 5px; align-items: end; height: 120px; margin-top: 14px; }
.bars div { background: var(--sun); border-radius: 5px 5px 2px 2px; min-height: 2px; }
.bars-labels { display: grid; grid-template-columns: repeat(12, 1fr); gap: 5px; font-size: .72rem; color: var(--ink-soft); text-align: center; margin-top: 4px; }
.dirs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 10px; }
.dirs div { background: var(--sky); border-radius: 10px; padding: 10px 6px; text-align: center; border: 2px solid transparent; }
.dirs b { display: block; font-family: var(--font-head); font-size: 1.1rem; }
.dirs .sel { border-color: var(--cell); background: var(--bg); }
.note { background: var(--sky); border-radius: 10px; padding: 12px 14px; font-size: .93rem; margin-top: 14px; }
.chart-svg { width: 100%; height: auto; display: block; margin-top: 10px; }
.chart-svg text { font-family: var(--font-body); font-size: 12px; fill: var(--ink-soft); }

/* ---------------- Diagrams ---------------- */
.diagram { width: 100%; height: auto; display: block; }
.diagram text { font-family: var(--font-body); fill: var(--ink); }
.diagram .lbl { font-size: 16px; font-weight: 700; }
.diagram .sub { font-size: 13.5px; fill: var(--ink-soft); }
.flowline { fill: none; stroke-linecap: round; }
.flowline.base { stroke: var(--line); stroke-width: 8; }
.flowline.solar { stroke: var(--sun); stroke-width: 6; stroke-dasharray: 2 14; }
.flowline.grid { stroke: var(--grid); stroke-width: 6; stroke-dasharray: 2 14; }
.flowline.out { stroke: var(--export); stroke-width: 6; stroke-dasharray: 2 14; }

/* ---------------- Footer ---------------- */
.site-foot { margin-top: clamp(64px, 9vw, 110px); padding: 60px 0 40px; background: var(--ink); color: #b5c2d6; font-size: .92rem; }
.site-foot a { color: #fff; text-decoration: none; }
.site-foot a:hover { color: var(--sun); }
.foot-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 28px; padding-bottom: 34px; margin-bottom: 24px; border-bottom: 1px solid rgba(255,255,255,.12); }
.foot-grid h4 { margin: 0 0 10px; font-family: var(--font-head); color: var(--sun); font-size: 1rem; }
.foot-grid a { display: block; padding: 3px 0; color: #dbe4f0; }
.site-foot nav { display: flex; gap: 20px; flex-wrap: wrap; margin-bottom: 12px; }

@media (prefers-reduced-motion: reduce) {
  .flowline.solar, .flowline.grid, .flowline.out { stroke-dasharray: none; }
  .paths a { transition: none; }
}
@media (max-width: 560px) { .instrument { padding: 14px; border-radius: 14px; } }
/* no white gap when a page ends on a tinted band */
main:has(> .wrap > .band.tint:last-child) + .site-foot { margin-top: 0; }
/* menu/footer group labels (not headings) */
.menu-panel .mh { margin: 0 0 10px; font-family: var(--font-head); font-weight: 700; font-size: 1.02rem; color: var(--ink); }
.foot-grid .mh { margin: 0 0 10px; font-family: var(--font-head); font-weight: 700; color: var(--sun); font-size: 1rem; }
