/* WattPenny — light by default, dark via [data-theme="dark"] */
:root {
  --bg: #fffdf7;
  --bg-elev: #ffffff;
  --bg-soft: #fff6d6;
  --text: #17202e;
  --text-muted: #55606f;
  --line: #e7e2d3;
  --brand: #f5b400;
  --brand-ink: #b97d00;
  --brand-deep: #0b1220;
  --accent: #0b5fff;
  --accent-ink: #0a47b8;
  --ok: #157347;
  --shadow: 0 1px 2px rgba(23, 32, 46, 0.06), 0 8px 24px rgba(23, 32, 46, 0.06);
  --radius: 14px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0b1220;
  --bg-elev: #121b2e;
  --bg-soft: #1a2338;
  --text: #e8ecf3;
  --text-muted: #a5afc0;
  --line: #26314a;
  --brand: #ffc72c;
  --brand-ink: #ffd867;
  --accent: #7aa7ff;
  --accent-ink: #a9c4ff;
  --ok: #4cd08a;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
}
img, svg { max-width: 100%; height: auto; display: block; }
a { color: var(--accent-ink); text-underline-offset: 2px; }
a:hover { color: var(--accent); }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 0.5em; font-weight: 750; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.8rem, 2.4vw + 1rem, 2.6rem); }
h2 { font-size: clamp(1.4rem, 1.2vw + 1rem, 1.75rem); margin-top: 1.6em; }
h3 { font-size: 1.15rem; margin-top: 1.4em; }
p, ul, ol { margin: 0 0 1em; }
small { color: var(--text-muted); font-size: 0.875rem; }
table { border-collapse: collapse; width: 100%; margin: 1em 0 1.5em; font-size: 0.95rem; }
th, td { text-align: left; padding: 0.55em 0.7em; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 700; background: var(--bg-soft); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 1em 0 1.5em; }
.table-wrap table { margin: 0; }
code { font-family: var(--mono); font-size: 0.92em; background: var(--bg-soft); padding: 0.1em 0.35em; border-radius: 4px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--brand); color: #000; padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip-link:focus { left: 8px; }

.container { width: min(100% - 2rem, 1100px); margin-inline: auto; }
.prose { max-width: 74ch; }
.prose img { border-radius: var(--radius); }
.prose li { margin-bottom: 0.35em; }
.lead { font-size: 1.15rem; color: var(--text-muted); }

/* Header */
.site-header { border-bottom: 1px solid var(--line); background: var(--bg-elev); position: sticky; top: 0; z-index: 50; }
.header-inner { display: flex; align-items: center; gap: 1rem; min-height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 0.55rem; text-decoration: none; color: var(--text); font-weight: 800; font-size: 1.2rem; }
.brand-name span { color: var(--brand-ink); }
.nav-menu { margin-left: auto; }
.nav-menu summary { list-style: none; cursor: pointer; padding: 0.45rem 0.8rem; border: 1px solid var(--line); border-radius: 8px; font-weight: 600; }
.nav-menu summary::-webkit-details-marker { display: none; }
.site-nav { display: flex; flex-wrap: wrap; gap: 0.15rem 0.2rem; }
.site-nav a { text-decoration: none; color: var(--text); padding: 0.4rem 0.6rem; border-radius: 8px; font-weight: 600; font-size: 0.95rem; }
.site-nav a:hover { background: var(--bg-soft); color: var(--text); }
.theme-toggle { border: 1px solid var(--line); background: var(--bg-elev); color: var(--text); width: 40px; height: 40px; border-radius: 10px; display: inline-grid; place-items: center; cursor: pointer; }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
@media (max-width: 899px) {
  .nav-menu[open] .site-nav { position: absolute; left: 0; right: 0; top: 60px; background: var(--bg-elev); border-bottom: 1px solid var(--line); padding: 0.75rem 1rem 1rem; flex-direction: column; box-shadow: var(--shadow); }
}
@media (min-width: 900px) {
  .nav-menu summary { display: none; }
  .nav-menu { display: contents; }
  .site-nav { margin-left: auto; }
}

/* Hero */
.hero { padding: 2.25rem 0 1rem; }
.hero h1 { max-width: 20ch; }
.hero .lead { max-width: 62ch; }
.crumbs { font-size: 0.9rem; color: var(--text-muted); margin: 1rem 0 0; }
.crumbs a { color: inherit; }
.crumbs span::before { content: "›"; margin: 0 0.4em; }

/* Calculator */
.calc { background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem; margin: 1rem 0 2rem; }
.calc-title { margin: 0 0 1rem; font-size: 1.25rem; }
.calc-grid { display: grid; gap: 1.5rem; }
@media (min-width: 820px) { .calc-grid { grid-template-columns: 1.1fr 1fr; align-items: start; } }
.field { margin-bottom: 1rem; }
.field label { display: block; font-weight: 650; margin-bottom: 0.3rem; font-size: 0.95rem; }
.field small { display: block; margin-top: 0.3rem; }
.field-row { display: flex; gap: 0.5rem; }
.field-row > * { flex: 1 1 0; min-width: 0; }
.field-row.two { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
input[type="number"], select {
  width: 100%; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 0.6rem 0.75rem; min-height: 46px;
}
input[type="number"]:focus, select:focus, button:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 60%, transparent); outline-offset: 1px; border-color: var(--brand-ink); }
.mode-switch { border: 0; padding: 0; margin: 0 0 1rem; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.mode-switch label { display: inline-flex; align-items: center; gap: 0.4rem; border: 1px solid var(--line); border-radius: 999px; padding: 0.4rem 0.8rem; cursor: pointer; font-size: 0.95rem; }
.mode-switch label:has(input:checked) { background: var(--bg-soft); border-color: var(--brand-ink); font-weight: 650; }
.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.45rem; }
.chips button, .btn-secondary { font: inherit; font-size: 0.85rem; padding: 0.3rem 0.7rem; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); color: var(--text); cursor: pointer; }
.chips button:hover, .btn-secondary:hover { border-color: var(--brand-ink); background: var(--bg-soft); }
.calc-more summary { cursor: pointer; font-weight: 650; margin-bottom: 0.75rem; }
.calc-results { background: var(--bg-soft); border-radius: var(--radius); padding: 1.25rem; min-height: 340px; }
.result-label { margin: 0; font-size: 0.9rem; color: var(--text-muted); font-weight: 650; text-transform: uppercase; letter-spacing: 0.04em; }
.result-big { font-size: clamp(2.4rem, 4vw + 1rem, 3.4rem); font-weight: 800; margin: 0 0 0.6rem; line-height: 1.05; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.result-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.6rem 1rem; margin: 0 0 0.9rem; }
.result-grid div { background: var(--bg-elev); border-radius: 10px; padding: 0.55rem 0.75rem; }
.result-grid dt { font-size: 0.8rem; color: var(--text-muted); }
.result-grid dd { margin: 0; font-weight: 750; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.result-grid.energy dd { font-size: 1rem; }
.result-grid.energy { grid-template-columns: repeat(3, 1fr); }
.calc[data-variant="ev"] .result-grid.energy { grid-template-columns: repeat(2, 1fr); }
.result-summary { font-weight: 550; margin: 0.5rem 0; min-height: 3.2em; }
.result-compare { background: var(--bg-elev); border-radius: 10px; padding: 0.75rem 0.9rem; margin: 0.5rem 0; }
.result-compare p { margin: 0; }
.result-fine { font-size: 0.82rem; color: var(--text-muted); margin: 0.5rem 0 0.75rem; }
.result-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* Content blocks */
.section { margin: 2.5rem 0; }
.grid-cards { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); margin: 1rem 0 2rem; padding: 0; list-style: none; }
.card { background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 0.35rem; }
.card h3 { margin: 0; font-size: 1.05rem; }
.card p { margin: 0; color: var(--text-muted); font-size: 0.95rem; }
.card a { text-decoration: none; }
.card a:hover { text-decoration: underline; }
.card .meta { font-size: 0.8rem; color: var(--text-muted); margin-top: auto; }
.callout { background: var(--bg-soft); border-left: 4px solid var(--brand); border-radius: 8px; padding: 0.9rem 1.1rem; margin: 1.25rem 0; }
.callout p:last-child { margin: 0; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.75rem; margin: 1rem 0 1.5rem; }
.stat { background: var(--bg-elev); border: 1px solid var(--line); border-radius: 12px; padding: 0.8rem 1rem; }
.stat .v { font-size: 1.5rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat .l { font-size: 0.85rem; color: var(--text-muted); }

/* FAQ */
.faq { margin: 2.5rem 0; }
.faq-item { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 0.6rem; background: var(--bg-elev); }
.faq-item summary { cursor: pointer; padding: 0.9rem 1.1rem; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary h3 { margin: 0; font-size: 1.05rem; }
.faq-item summary::after { content: "+"; font-size: 1.4rem; color: var(--text-muted); flex: none; }
.faq-item[open] summary::after { content: "–"; }
.faq-answer { padding: 0 1.1rem 1rem; color: var(--text); }
.faq-answer p:last-child { margin-bottom: 0; }

/* Ads: reserved space so nothing jumps when a unit loads */
.ad-slot { margin: 1.5rem 0; min-height: 280px; display: flex; align-items: center; justify-content: center; }
.ad-slot--toolBelow { min-height: 250px; }
.ad-slot .adsbygoogle { width: 100%; }
/* AdSense marks a unit it could not fill; collapse the whole reserved box so no blank space is left */
.ad-slot:has(.adsbygoogle[data-ad-status="unfilled"]) { display: none; }
.adsbygoogle[data-ad-status="unfilled"] { display: none !important; }

/* Article */
.article-header { padding: 2rem 0 0.5rem; }
.article-meta { color: var(--text-muted); font-size: 0.9rem; }
.article-body { max-width: 74ch; }
.article-body h2 { scroll-margin-top: 80px; }
.related { margin: 2.5rem 0; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); margin-top: 3rem; background: var(--bg-elev); font-size: 0.93rem; }
.footer-grid { display: grid; gap: 1.5rem; padding: 2rem 0 1rem; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.footer-grid h2 { font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.05em; margin: 0 0 0.5rem; color: var(--text-muted); }
.footer-grid nav a { display: block; text-decoration: none; color: var(--text); padding: 0.2rem 0; }
.footer-grid nav a:hover { text-decoration: underline; }
.footer-brand .brand-name { font-weight: 800; font-size: 1.15rem; margin-bottom: 0.3rem; }
.footer-note { color: var(--text-muted); font-size: 0.85rem; }
.footer-bottom { border-top: 1px solid var(--line); padding: 1rem 0 1.5rem; color: var(--text-muted); font-size: 0.85rem; }
.footer-bottom p { margin: 0; }

/* 404 */
.notfound { text-align: center; padding: 4rem 0; }
.notfound .big { font-size: 5rem; font-weight: 800; color: var(--brand-ink); line-height: 1; }

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
@media print { .site-header, .site-footer, .ad-slot, .theme-toggle, .result-actions { display: none !important; } }
