/* kWhPlan design system */
@font-face { font-family: "Inter"; src: url("../fonts/inter-latin.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "Space Grotesk"; src: url("../fonts/space-grotesk-latin.woff2") format("woff2"); font-weight: 500 700; font-display: swap; }

:root {
  --ink: #0f1b2d;
  --ink-2: #44536a;
  --ink-3: #6b7a90;
  --bg: #f5f7fb;
  --card: #ffffff;
  --line: #e2e8f0;
  --brand: #1f4fd8;
  --brand-700: #173da8;
  --brand-900: #0d2466;
  --brand-50: #edf2ff;
  --amber: #f5b301;
  --amber-50: #fff6db;
  --green: #0e9f6e;
  --green-50: #e7f7f0;
  --red: #d64545;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(15, 27, 45, .06), 0 8px 24px rgba(15, 27, 45, .06);
  --maxw: 1120px;
  --read: 760px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; font-size: 17px; line-height: 1.65; color: var(--ink); background: var(--bg); }
img, svg { max-width: 100%; height: auto; }
a { color: var(--brand); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--brand-700); }
h1, h2, h3 { font-family: "Space Grotesk", "Inter", sans-serif; line-height: 1.2; letter-spacing: -.01em; color: var(--ink); }
h1 { font-size: clamp(1.9rem, 4vw, 2.75rem); margin: 0 0 .5rem; }
h2 { font-size: clamp(1.35rem, 2.6vw, 1.7rem); margin: 2.2rem 0 .7rem; }
h3 { font-size: 1.15rem; margin: 1.4rem 0 .4rem; }
p { margin: 0 0 1rem; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.read { max-width: var(--read); }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 12px; top: 12px; background: #fff; padding: 8px 12px; z-index: 50; }

/* Header */
.site-header { background: rgba(255,255,255,.92); backdrop-filter: saturate(160%) blur(8px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 40; }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 64px; }
.logo { display: inline-flex; align-items: center; gap: 9px; font-family: "Space Grotesk", sans-serif; font-weight: 700; font-size: 1.35rem; color: var(--ink); text-decoration: none; }
.logo svg { width: 30px; height: 30px; flex: none; }
.logo b { color: var(--brand); font-weight: 700; }
.nav { display: flex; gap: 4px; align-items: center; }
.nav a { color: var(--ink-2); text-decoration: none; font-weight: 500; font-size: .95rem; padding: 8px 12px; border-radius: 8px; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink); background: var(--brand-50); }
.nav-toggle { display: none; background: none; border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; font: inherit; color: var(--ink); cursor: pointer; }
@media (max-width: 900px) {
  .nav-toggle { display: inline-flex; }
  .nav { display: none; position: absolute; left: 0; right: 0; top: 64px; background: #fff; border-bottom: 1px solid var(--line); flex-direction: column; align-items: stretch; padding: 8px 12px 14px; box-shadow: var(--shadow); }
  .nav.open { display: flex; }
  .nav a { padding: 12px; }
}

/* Hero */
.hero { background: radial-gradient(1200px 400px at 85% -10%, rgba(245,179,1,.28), transparent 60%), linear-gradient(135deg, var(--brand-900) 0%, var(--brand) 100%); color: #fff; }
.hero .wrap { display: grid; grid-template-columns: 1.05fr .95fr; gap: 40px; align-items: center; padding-top: 56px; padding-bottom: 64px; }
.hero h1 { color: #fff; font-size: clamp(2rem, 4.4vw, 3.1rem); }
.hero .lead { font-size: 1.15rem; color: #dbe5ff; max-width: 34rem; }
.hero .meta { color: #b9c8f5; font-size: .9rem; margin-top: 1.2rem; }
.hero .meta a { color: #fff; }
.pill { display: inline-flex; align-items: center; gap: 6px; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.25); color: #fff; font-size: .82rem; font-weight: 600; padding: 5px 11px; border-radius: 999px; margin-bottom: 14px; }
.pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); display: inline-block; }
.hero-points { display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 0; margin: 1.2rem 0 0; list-style: none; color: #e6edff; font-size: .95rem; }
.hero-points li::before { content: "✓"; color: var(--amber); font-weight: 700; margin-right: 7px; }
@media (max-width: 900px) { .hero .wrap { grid-template-columns: 1fr; padding-top: 36px; padding-bottom: 40px; gap: 24px; } }

/* Calculator card */
.calc { background: var(--card); color: var(--ink); border-radius: var(--radius); box-shadow: 0 20px 50px rgba(5, 15, 45, .25); padding: 22px; }
.page .calc { box-shadow: var(--shadow); border: 1px solid var(--line); margin: 1.4rem 0 1.6rem; }
.calc h2, .calc .calc-title { font-family: "Space Grotesk", sans-serif; font-size: 1.15rem; font-weight: 700; margin: 0 0 14px; display: flex; align-items: center; gap: 8px; }
.calc .calc-title svg { width: 22px; height: 22px; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.fields.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field label { display: block; font-size: .82rem; font-weight: 600; color: var(--ink-2); margin-bottom: 5px; }
.field input, .field select { width: 100%; font: inherit; font-size: 1rem; color: var(--ink); background: #fbfcfe; border: 1px solid #cfd8e6; border-radius: var(--radius-sm); padding: 10px 12px; min-height: 46px; }
.field input:focus, .field select:focus { outline: 3px solid rgba(31,79,216,.18); border-color: var(--brand); background: #fff; }
.field .unit { position: relative; }
.field .unit span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-3); font-size: .9rem; pointer-events: none; }
.field .unit input { padding-right: 58px; }
.field .hint { font-size: .78rem; color: var(--ink-3); margin-top: 4px; }
@media (max-width: 560px) { .fields, .fields.three { grid-template-columns: 1fr; } }
.results { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 16px; }
.tile { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; }
.tile .k { font-size: .78rem; color: var(--ink-3); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.tile .v { font-family: "Space Grotesk", sans-serif; font-size: 1.45rem; font-weight: 700; color: var(--ink); line-height: 1.25; margin-top: 2px; font-variant-numeric: tabular-nums; }
.tile.main { background: var(--brand-50); border-color: #cdd9ff; }
.tile.main .v { color: var(--brand-700); }
.calc .note { font-size: .82rem; color: var(--ink-3); margin: 12px 0 0; }
@media (max-width: 560px) { .results { grid-template-columns: 1fr 1fr; } .results .tile.main { grid-column: 1 / -1; } }

/* Sections */
.section { padding: 56px 0; }
.section.alt { background: #fff; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin-bottom: 20px; }
.section-head h2 { margin: 0; }
.section-head p { margin: 4px 0 0; color: var(--ink-2); }
.section-head > a { white-space: nowrap; font-weight: 600; }
@media (max-width: 640px) { .section-head { flex-direction: column; align-items: flex-start; gap: 8px; } }
.eyebrow { font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--brand); }

/* Tool cards */
.grid { display: grid; gap: 14px; }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 900px) { .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .grid.cols-3, .grid.cols-2 { grid-template-columns: 1fr; } }
.card { display: flex; gap: 14px; align-items: flex-start; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; text-decoration: none; color: var(--ink); transition: border-color .15s, box-shadow .15s, transform .15s; }
.card:hover { border-color: #b9c9f7; box-shadow: var(--shadow); transform: translateY(-1px); color: var(--ink); }
.card .ic { flex: none; width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); }
.card .ic.amber { background: var(--amber-50); color: #a87800; }
.card .ic.green { background: var(--green-50); color: var(--green); }
.card .ic svg { width: 22px; height: 22px; }
.card h3 { font-family: "Inter", sans-serif; font-size: 1rem; font-weight: 700; margin: 0 0 3px; }
.card p { margin: 0; font-size: .9rem; color: var(--ink-2); line-height: 1.5; }

/* Hub blocks */
.hub { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; }
.hub h3 { margin: 0 0 4px; display: flex; align-items: center; gap: 9px; }
.hub h3 svg { width: 20px; height: 20px; color: var(--brand); }
.hub p { color: var(--ink-2); font-size: .92rem; margin: 0 0 10px; }
.hub ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.hub li a { text-decoration: none; font-weight: 500; font-size: .95rem; display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.hub li:last-child a { border-bottom: 0; }
.hub li a::after { content: "→"; color: var(--ink-3); }

/* Data table */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
table.data { width: 100%; border-collapse: collapse; font-size: .95rem; font-variant-numeric: tabular-nums; }
table.data th, table.data td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); }
table.data th { background: #f8fafd; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2); }
table.data tr:last-child td { border-bottom: 0; }
table.data td.num, table.data th.num { text-align: right; }
.bar { height: 8px; border-radius: 99px; background: var(--brand-50); overflow: hidden; min-width: 80px; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), #4f7bff); border-radius: 99px; }
.source { font-size: .82rem; color: var(--ink-3); margin-top: 8px; }

/* Stat strip */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.stat .v { font-family: "Space Grotesk", sans-serif; font-size: 1.8rem; font-weight: 700; line-height: 1.1; }
.stat .k { color: var(--ink-2); font-size: .9rem; margin-top: 4px; }
@media (max-width: 760px) { .stats { grid-template-columns: 1fr 1fr; } }

/* Article page */
.page-head { background: #fff; border-bottom: 1px solid var(--line); padding: 28px 0 22px; }
.breadcrumb { font-size: .85rem; color: var(--ink-3); margin: 0 0 10px; }
.breadcrumb a { color: var(--ink-3); text-decoration: none; }
.breadcrumb a:hover { color: var(--brand); }
.byline { display: flex; align-items: center; gap: 10px; color: var(--ink-3); font-size: .88rem; margin: 10px 0 0; }
.byline .av { width: 28px; height: 28px; border-radius: 50%; background: var(--brand-50); color: var(--brand); display: grid; place-items: center; font-weight: 700; font-size: .75rem; }
.page-grid { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 40px; padding-top: 28px; padding-bottom: 56px; }
.page-grid > aside { position: sticky; top: 88px; align-self: start; }
@media (max-width: 1000px) { .page-grid { grid-template-columns: minmax(0, 1fr); } .page-grid > aside { position: static; } }
.toc { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; font-size: .9rem; }
.toc b { display: block; margin-bottom: 6px; }
.toc ol { margin: 0; padding-left: 18px; }
.toc li { margin: 4px 0; }
.toc a { text-decoration: none; color: var(--ink-2); }
.callout { background: var(--amber-50); border: 1px solid #f3dc92; border-radius: var(--radius); padding: 14px 16px; margin: 1.2rem 0; }
.callout.info { background: var(--brand-50); border-color: #cdd9ff; }
.faq details { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0 16px; margin-bottom: 8px; }
.faq summary { cursor: pointer; font-weight: 600; padding: 14px 0; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::after { content: "+"; color: var(--brand); font-weight: 700; }
.faq details[open] summary::after { content: "–"; }
.faq details p { margin: 0 0 14px; color: var(--ink-2); }
.author-box { display: flex; gap: 14px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-top: 2rem; }
.author-box .av { width: 48px; height: 48px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; flex: none; }
.author-box p { margin: 0; font-size: .92rem; color: var(--ink-2); }

/* Footer */
.site-footer { background: var(--brand-900); color: #c3cff0; padding: 48px 0 28px; font-size: .92rem; }
.site-footer .cols { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 28px; }
.site-footer h4 { color: #fff; font-family: "Space Grotesk", sans-serif; font-size: 1rem; margin: 0 0 10px; }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.site-footer a { color: #c3cff0; text-decoration: none; }
.site-footer a:hover { color: #fff; }
.site-footer .logo { color: #fff; }
.site-footer .logo b { color: var(--amber); }
.site-footer .legal { border-top: 1px solid rgba(255,255,255,.12); margin-top: 32px; padding-top: 18px; font-size: .82rem; color: #93a3cf; }
@media (max-width: 800px) { .site-footer .cols { grid-template-columns: 1fr 1fr; } }
table.data tr.hl td { background: var(--brand-50); }
/* editable usage table */
table.data.usage input { width: 100%; min-width: 60px; font: inherit; font-size: .92rem; border: 1px solid #cfd8e6; border-radius: 6px; padding: 6px 8px; background: #fbfcfe; }
table.data.usage td:first-child input { min-width: 150px; }
table.data.usage td.num input { text-align: right; max-width: 90px; }
.btn-sm { font: inherit; font-size: .9rem; font-weight: 600; color: var(--brand); background: var(--brand-50); border: 1px solid #cdd9ff; border-radius: 8px; padding: 7px 12px; cursor: pointer; }
.btn-sm:hover { background: #dfe7ff; }
