/* ============================================================
   WattRunCost — Design System
   Light theme only. No external fonts, no images, no dependencies.
   Target: < 30 KB. Mobile-first, single column at 360px.
   ============================================================ */

/* ---------- Design tokens ---------- */
:root {
  /* Brand */
  --teal-900: #083845;
  --teal-800: #0B4A5C;
  --primary: #0E5A6D;          /* primary deep teal */
  --teal-600: #12718C;
  --teal-100: #DCEEF2;
  --teal-50:  #EFF7F9;
  --amber: #F59E0B;            /* energy amber — accent only, never body text */
  --amber-dark: #B45309;       /* amber for text on light bg (contrast-safe) */
  --amber-50: #FEF6E0;

  /* Warm neutrals */
  --ink: #26221C;              /* body text on white: >12:1 */
  --ink-soft: #4A4438;         /* secondary text on white: >7:1 */
  --muted: #6B6455;            /* captions on white: >4.5:1 */
  --line: #DDD6C8;
  --line-soft: #EAE4D6;
  --bg: #FDFBF7;               /* warm paper background */
  --surface: #FFFFFF;
  --surface-warm: #F7F3EA;

  /* States */
  --success: #177245;
  --success-bg: #E6F4EC;
  --error: #B3261E;
  --error-bg: #FCEBEA;

  /* Type scale (1.25 ratio) */
  --fs-xs: 0.8rem;
  --fs-sm: 0.9rem;
  --fs-base: 1rem;
  --fs-md: 1.125rem;
  --fs-lg: 1.4rem;
  --fs-xl: 1.75rem;
  --fs-2xl: 2.2rem;
  --fs-result: 1.9rem;

  /* Spacing scale */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.5rem;
  --sp-6: 2rem;
  --sp-7: 3rem;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 3px rgba(38, 34, 28, 0.1), 0 4px 14px rgba(38, 34, 28, 0.06);
  --maxw: 72rem;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
          Arial, sans-serif;
  --font-num: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
}

/* ---------- Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
}
img, svg { display: block; max-width: 100%; }
a { color: var(--teal-800); text-underline-offset: 0.15em; }
a:hover { color: var(--teal-600); }
:focus-visible {
  outline: 3px solid var(--amber-dark);
  outline-offset: 2px;
  border-radius: 2px;
}
::selection { background: var(--teal-100); }

/* ---------- Typography ---------- */
h1, h2, h3 { line-height: 1.25; color: var(--teal-900); font-weight: 700; }
h1 { font-size: var(--fs-2xl); letter-spacing: -0.01em; margin-bottom: var(--sp-3); }
h2 { font-size: var(--fs-xl); margin: var(--sp-6) 0 var(--sp-3); }
h3 { font-size: var(--fs-lg); margin: var(--sp-5) 0 var(--sp-2); }
p { margin-bottom: var(--sp-4); max-width: 68ch; }
.lede { font-size: var(--fs-md); color: var(--ink-soft); max-width: 62ch; }
.small { font-size: var(--fs-sm); }
.caption { font-size: var(--fs-xs); color: var(--muted); }
strong { font-weight: 650; }
ul, ol { padding-left: 1.4em; margin-bottom: var(--sp-4); }
li { margin-bottom: var(--sp-1); }

/* ---------- Layout ---------- */
.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--sp-4); }
main { padding-bottom: var(--sp-7); }
.section { margin-top: var(--sp-6); }

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute; left: var(--sp-3); top: -4rem; z-index: 50;
  background: var(--primary); color: #fff; padding: var(--sp-2) var(--sp-4);
  border-radius: var(--radius-sm); text-decoration: none; font-weight: 600;
}
.skip-link:focus { top: var(--sp-3); color: #fff; }

/* ---------- Header & nav ---------- */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3) var(--sp-5);
  padding-block: var(--sp-3);
}
.wordmark {
  font-size: var(--fs-lg); font-weight: 800; letter-spacing: -0.01em;
  color: var(--teal-900); text-decoration: none; white-space: nowrap;
}
.wordmark .watt { color: var(--primary); }
.wordmark .bolt { color: var(--amber-dark); }
.site-nav { margin-left: auto; }
.site-nav ul {
  display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-5);
  list-style: none; padding: 0; margin: 0;
}
.site-nav a {
  color: var(--ink-soft); text-decoration: none; font-weight: 550;
  padding: var(--sp-1) 0; border-bottom: 2px solid transparent;
}
.site-nav a:hover, .site-nav a[aria-current="page"] {
  color: var(--teal-800); border-bottom-color: var(--amber);
}

/* ---------- Breadcrumb ---------- */
.breadcrumb { padding-block: var(--sp-3); font-size: var(--fs-sm); }
.breadcrumb ol {
  display: flex; flex-wrap: wrap; gap: var(--sp-1); list-style: none; padding: 0; margin: 0;
}
.breadcrumb li { margin: 0; }
.breadcrumb li + li::before { content: "›"; margin-inline: var(--sp-2); color: var(--muted); }
.breadcrumb a { color: var(--teal-800); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb [aria-current="page"] { color: var(--ink-soft); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block; font: inherit; font-weight: 650; cursor: pointer;
  padding: var(--sp-3) var(--sp-5); border-radius: var(--radius-sm);
  border: 2px solid var(--primary); text-decoration: none; text-align: center;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--teal-800); color: #fff; }
.btn-ghost { background: transparent; color: var(--teal-800); }
.btn-ghost:hover { background: var(--teal-50); color: var(--teal-800); }
.btn-block { width: 100%; }

/* ---------- Trust strip ---------- */
.trust-strip {
  background: var(--teal-50); border-block: 1px solid var(--teal-100);
  font-size: var(--fs-sm); color: var(--teal-900);
}
.trust-strip .container {
  display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-5); padding-block: var(--sp-2);
}
.trust-strip strong { color: var(--teal-800); }

/* ---------- Forms ---------- */
.field { margin-bottom: var(--sp-4); }
.field label { display: block; font-weight: 600; margin-bottom: var(--sp-1); }
.field .hint { font-size: var(--fs-sm); color: var(--ink-soft); margin-bottom: var(--sp-1); }
input[type="text"], input[type="number"], select, textarea {
  font: inherit; color: var(--ink); width: 100%;
  padding: var(--sp-3); background: var(--surface);
  border: 1.5px solid var(--muted); border-radius: var(--radius-sm);
  min-height: 3rem;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary); outline: 3px solid var(--teal-100); outline-offset: 0;
}
input[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--error); }
.field-error { color: var(--error); font-size: var(--fs-sm); font-weight: 600; margin-top: var(--sp-1); }
.input-suffix { position: relative; }
.input-suffix .suffix {
  position: absolute; right: var(--sp-3); top: 50%; transform: translateY(-50%);
  color: var(--muted); font-size: var(--fs-sm); pointer-events: none;
}
.input-suffix input { padding-right: 4.5rem; }

/* ---------- Calculator components ---------- */
.calc-card {
  background: var(--surface); border: 1px solid var(--line);
  border-top: 4px solid var(--primary); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: var(--sp-5); margin-block: var(--sp-5);
}
.calc-card h2 { margin-top: 0; font-size: var(--fs-lg); }
.calc-grid { display: grid; gap: var(--sp-4); }
.preset-chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-bottom: var(--sp-4); }
.chip {
  font: inherit; font-size: var(--fs-sm); font-weight: 600; cursor: pointer;
  padding: var(--sp-2) var(--sp-3); border-radius: 999px;
  border: 1.5px solid var(--teal-600); background: var(--surface); color: var(--teal-800);
  transition: background-color 0.15s ease, color 0.15s ease;
}
.chip:hover { background: var(--teal-50); }
.chip[aria-pressed="true"] { background: var(--primary); color: #fff; border-color: var(--primary); }

.results { margin-top: var(--sp-5); }
.results-heading { font-size: var(--fs-md); margin-bottom: var(--sp-3); }
.results-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
.result-tile {
  background: var(--teal-50); border: 1px solid var(--teal-100);
  border-radius: var(--radius-sm); padding: var(--sp-3) var(--sp-4);
}
.result-tile .amount {
  display: block; font-size: var(--fs-result); font-weight: 750; line-height: 1.15;
  color: var(--teal-900); font-variant-numeric: tabular-nums;
}
.result-tile .label { display: block; font-size: var(--fs-sm); color: var(--ink-soft); }
.result-tile.highlight { background: var(--amber-50); border-color: var(--amber); }
.rate-note { font-size: var(--fs-sm); color: var(--ink-soft); margin-top: var(--sp-3); }
.rate-note a { font-weight: 600; }

.notice {
  border-radius: var(--radius-sm); padding: var(--sp-4); margin-block: var(--sp-4);
  font-size: var(--fs-sm);
}
.notice h3 { font-size: var(--fs-base); margin: 0 0 var(--sp-1); }
.notice p { margin: 0; }
.notice-excludes { background: var(--amber-50); border: 1px solid var(--amber); color: var(--ink); }
.notice-info { background: var(--teal-50); border: 1px solid var(--teal-100); color: var(--ink); }
.notice-success { background: var(--success-bg); border: 1px solid var(--success); }
.notice-error { background: var(--error-bg); border: 1px solid var(--error); }

/* ---------- Content components ---------- */
.card-grid { display: grid; gap: var(--sp-4); margin-block: var(--sp-4); }
.hub-card {
  display: block; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: var(--sp-4); text-decoration: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.hub-card:hover { border-color: var(--teal-600); box-shadow: var(--shadow); }
.hub-card h3 { margin: 0 0 var(--sp-1); font-size: var(--fs-md); color: var(--teal-800); }
.hub-card p { margin: 0; font-size: var(--fs-sm); color: var(--ink-soft); }
.hub-card .typical {
  display: inline-block; margin-top: var(--sp-2); font-size: var(--fs-sm);
  font-weight: 650; color: var(--teal-900); background: var(--teal-50);
  padding: var(--sp-1) var(--sp-2); border-radius: var(--radius-sm);
}

.table-wrap { overflow-x: auto; margin-block: var(--sp-4); border: 1px solid var(--line); border-radius: var(--radius-sm); }
table { border-collapse: collapse; width: 100%; font-size: var(--fs-sm); background: var(--surface); }
caption { text-align: left; font-weight: 650; padding: var(--sp-3); color: var(--teal-900); }
th, td { padding: var(--sp-2) var(--sp-3); text-align: left; border-top: 1px solid var(--line-soft); }
thead th { background: var(--surface-warm); border-top: none; color: var(--teal-900); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:hover { background: var(--teal-50); }

.example-box {
  background: var(--surface-warm); border: 1px solid var(--line);
  border-left: 4px solid var(--amber); border-radius: var(--radius-sm);
  padding: var(--sp-4) var(--sp-5); margin-block: var(--sp-4);
}
.example-box h3 { margin-top: 0; }
.example-box .formula {
  font-family: var(--font-num); font-size: var(--fs-sm); background: var(--surface);
  border: 1px solid var(--line-soft); border-radius: var(--radius-sm);
  padding: var(--sp-3); margin-block: var(--sp-3); overflow-x: auto; white-space: nowrap;
}
.example-box p:last-child { margin-bottom: 0; }

details.faq {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm); margin-bottom: var(--sp-3);
}
details.faq summary {
  cursor: pointer; font-weight: 650; color: var(--teal-900);
  padding: var(--sp-3) var(--sp-4); list-style: none;
  display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3);
}
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary::after { content: "+"; font-size: var(--fs-lg); color: var(--primary); flex-shrink: 0; }
details.faq[open ] summary::after { content: "–"; }
details.faq summary:hover { background: var(--teal-50); }
details.faq .faq-body { padding: 0 var(--sp-4) var(--sp-4); }
details.faq .faq-body p:last-child { margin-bottom: 0; }

.related { margin-top: var(--sp-6); }
.related ul { list-style: none; padding: 0; display: grid; gap: var(--sp-2); }
.related a { font-weight: 550; }
.updated-stamp { font-size: var(--fs-sm); color: var(--ink-soft); }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--teal-900); color: #EAF3F5; margin-top: var(--sp-7);
  font-size: var(--fs-sm);
}
.footer-inner { padding-block: var(--sp-6); display: grid; gap: var(--sp-5); }
.site-footer .wordmark { color: #fff; }
.site-footer .wordmark .watt { color: #7FC4D4; }
.site-footer p { color: #C9DEE3; margin: 0; max-width: 60ch; }
.footer-nav ul {
  display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-5);
  list-style: none; padding: 0; margin: 0;
}
.footer-nav a { color: #EAF3F5; text-decoration: none; }
.footer-nav a:hover { text-decoration: underline; }
.footer-stamp { border-top: 1px solid rgba(255, 255, 255, 0.2); padding-top: var(--sp-3); color: #C9DEE3; }

/* ---------- Utilities ---------- */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.mt-0 { margin-top: 0; }
.text-success { color: var(--success); }
.text-error { color: var(--error); }

/* ---------- Breakpoints ---------- */
@media (min-width: 768px) {
  .container { padding-inline: var(--sp-5); }
  h1 { font-size: 2.6rem; }
  .calc-grid { grid-template-columns: 1fr 1fr; }
  .results-grid { grid-template-columns: repeat(4, 1fr); }
  .card-grid { grid-template-columns: 1fr 1fr; }
  .footer-inner { grid-template-columns: 1.4fr 1fr; align-items: start; }
}
@media (min-width: 1100px) {
  .card-grid { grid-template-columns: repeat(3, 1fr); }
  .calc-card { padding: var(--sp-6); }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- Print ---------- */
@media print {
  .site-nav, .breadcrumb, .preset-chips, .btn, .related { display: none; }
  body { background: #fff; font-size: 11pt; }
  .site-header, .site-footer { background: #fff; color: #000; border: none; }
  .site-footer p, .footer-stamp { color: #000; }
  .calc-card, .example-box, .result-tile { box-shadow: none; break-inside: avoid; }
  a { color: #000; text-decoration: none; }
  main { padding-bottom: 0; }
}

/* Range inputs + [hidden] enforcement — folded in from the pilot page under Decision A1 (M3, 2026-11-19) */
input[type="range"] { width: 100%; min-height: 44px; accent-color: var(--primary); cursor: pointer; }
[hidden] { display: none !important; }
