/* EV-or-not — "daylight instrument cluster".
   Two semantic poles encode the whole comparison: green = electric/cheaper, amber = fuel/ICE.
   Signature: the crossover line chart + the pence-per-mile gauges. */

:root {
  --bg: #F2F5F4;
  --panel: #FFFFFF;
  --ink: #1B2A2E;
  --muted: #5C6B6B;
  --ev: #16A571;
  --ice: #D9772B;
  --accent: #2E6BE6;
  --grid: #C9D2D0;
  --line: #E4E9E7;
  --good-bg: #E7F6EF;
  --bad-bg: #FBEDE2;
  --radius: 12px;
  --topbar-h: 64px;
  --shadow: 0 1px 2px rgba(27, 42, 46, .06), 0 8px 24px rgba(27, 42, 46, .06);
  font-synthesis: none;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.45 "Inter", system-ui, -apple-system, sans-serif;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .verdict-head, .gauge strong {
  font-family: "Space Grotesk", "Inter", sans-serif;
  letter-spacing: -.01em;
}

a { color: var(--accent); }

/* ---------------- top bar ---------------- */
.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 20px;
  background: var(--ink);
  color: #EFF4F2;
  position: sticky;
  top: 0;
  z-index: 5;
}
.brand { display: flex; align-items: baseline; gap: 10px; }
.brand .mark { font-size: 22px; transform: translateY(2px); }
.brand h1 { font-size: 22px; margin: 0; }
.tagline { margin: 0; color: #9DB3AD; font-size: 13px; }
.templates { display: flex; gap: 8px; flex: 1; flex-wrap: wrap; }
.chip {
  border: 1px solid #3A4D52;
  background: transparent;
  color: #CFE0DB;
  padding: 6px 12px;
  border-radius: 999px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.chip:hover { border-color: var(--ev); color: #fff; }
.chip.active { background: var(--ev); border-color: var(--ev); color: #062b1e; font-weight: 600; }
.globals { display: flex; align-items: center; gap: 16px; }
.years { display: flex; flex-direction: column; font-size: 12px; color: #9DB3AD; gap: 2px; }
.years strong { color: #fff; font-size: 14px; }
.years input { width: 120px; accent-color: var(--ev); }
.btn-ghost {
  background: transparent; color: #CFE0DB; border: 1px solid #3A4D52;
  border-radius: 8px; padding: 7px 14px; font: inherit; cursor: pointer;
}
.btn-ghost:hover { border-color: var(--ev); color: #fff; }

/* ---------------- dashboard: one viewport ---------------- */
.dashboard {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr) 300px;
  gap: 16px;
  padding: 16px 20px;
  height: calc(100vh - var(--topbar-h));
  min-height: 560px;
}
.panel {
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.inputs { overflow-y: auto; gap: 12px; }
.hero { gap: 12px; }
.side { gap: 8px; }

/* ---------------- scenario cards ---------------- */
#scenario-cards { display: flex; flex-direction: column; gap: 12px; }
.scenario {
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  padding: 10px 12px;
  box-shadow: none;
}
.scenario-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.scenario-head .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.scenario-name {
  flex: 1; border: none; border-bottom: 1px dashed transparent; background: transparent;
  font: 600 15px "Space Grotesk", sans-serif; color: var(--ink); padding: 2px 0;
}
.scenario-name:hover { border-bottom-color: var(--grid); }
.scenario-name:focus { outline: none; border-bottom-color: var(--accent); }
.remove {
  border: none; background: var(--line); color: var(--muted);
  width: 22px; height: 22px; border-radius: 50%; cursor: pointer; font-size: 15px; line-height: 1;
}
.remove:hover { background: var(--ice); color: #fff; }

.row { display: grid; grid-template-columns: 1fr 92px; align-items: center; gap: 8px; margin: 5px 0; font-size: 13px; }
.row > span { color: var(--muted); }
.row input, .row select {
  font: inherit; padding: 5px 8px; border: 1px solid var(--line); border-radius: 7px;
  background: #FBFCFB; text-align: right; width: 100%;
}
.row select { text-align: left; }
.row input:focus, .row select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.charging { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 6px 0; }
.mini { display: flex; flex-direction: column; gap: 2px; font-size: 11px; color: var(--muted); }
.mini input { font: inherit; padding: 4px; border: 1px solid var(--line); border-radius: 6px; text-align: center; }
.mix { grid-column: 1 / -1; margin: 2px 0 0; font-size: 11px; text-align: right; }
.mix.ok { color: var(--ev); }
.mix.bad { color: var(--ice); }

/* car preset picker */
.car-pick select { background: #F4F8F6; font-weight: 500; }

/* miles per year/week toggle */
.unit-toggle {
  border: none; background: var(--bg); color: var(--accent); cursor: pointer;
  font: inherit; font-size: 12px; padding: 1px 6px; border-radius: 5px; text-decoration: underline dotted;
}
.unit-toggle:hover { background: var(--line); }

/* per-card note (e.g. old-car warning) */
.card-note {
  margin: 6px 0 0; font-size: 11.5px; line-height: 1.35; color: #8a5a1c;
  background: #FBF0E2; border-radius: 7px; padding: 6px 8px;
}

.btn-add {
  border: 1px dashed var(--grid); background: transparent; color: var(--muted);
  border-radius: 9px; padding: 9px; font: inherit; cursor: pointer; width: 100%;
}
.btn-add:hover:not(:disabled) { border-color: var(--ev); color: var(--ev); }
.btn-add:disabled { opacity: .4; cursor: not-allowed; }

.rates summary { cursor: pointer; color: var(--muted); font-size: 13px; padding: 4px 0; }
.rates-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 6px; }
.rates-grid label { display: flex; flex-direction: column; gap: 2px; font-size: 11px; color: var(--muted); }
.rates-grid input { font: inherit; padding: 5px 7px; border: 1px solid var(--line); border-radius: 6px; }

/* ---------------- hero: verdict + line chart ---------------- */
.verdict {
  border-radius: 10px; padding: 12px 14px; border: 1px solid var(--line);
  background: var(--good-bg);
}
.verdict.bad { background: var(--bad-bg); }
.verdict-head { margin: 0 0 4px; font-size: 19px; }
.verdict.good .verdict-head { color: #0b7a52; }
.verdict.bad .verdict-head { color: #b5571a; }
.verdict-sub { margin: 0; font-size: 13.5px; color: var(--ink); }
.verdict-sub em { font-style: normal; font-weight: 600; }
.chart-box { position: relative; flex: 1; min-height: 0; }
.chart-box.small { min-height: 150px; flex: none; height: 150px; }
.chart-box canvas { position: absolute; inset: 0; }
/* slightly smaller hero chart so the "why they diverge" panel fits below it */
.hero-chart { flex: 1 1 0; min-height: 150px; }

/* why-they-diverge panel */
.why { flex: 0 0 auto; max-height: 36%; overflow-y: auto; border-top: 1px solid var(--line); padding-top: 8px; }
.why-head { margin: 0 0 6px; font-size: 13px; font-weight: 600; }
.why-key { font-weight: 400; color: var(--muted); font-size: 11.5px; }
.why-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.why-row { display: grid; grid-template-columns: 130px 1fr 72px; align-items: center; gap: 8px; font-size: 12.5px; }
.why-label { color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.why-bar { background: var(--bg); border-radius: 4px; height: 9px; overflow: hidden; }
.why-bar > span { display: block; height: 100%; border-radius: 4px; }
.why-amt { text-align: right; font-weight: 600; }

/* ---------------- side: gauges + breakdown ---------------- */
.side-h { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 6px 0 2px; font-family: "Inter", sans-serif; }
.gauges { display: flex; flex-wrap: wrap; gap: 6px; justify-content: space-around; }
.gauge { margin: 0; text-align: center; flex: 1 1 80px; }
.gauge svg { width: 100%; max-width: 110px; }
.gauge-track { fill: none; stroke: var(--line); stroke-width: 9; stroke-linecap: round; }
.gauge-fill { fill: none; stroke-width: 9; stroke-linecap: round; transition: stroke-dasharray .35s; }
.gauge figcaption { display: flex; flex-direction: column; margin-top: -6px; }
.gauge figcaption strong { font-size: 20px; }
.gauge figcaption span { font-size: 11px; color: var(--muted); line-height: 1.2; }

/* ---------------- report cue + section ---------------- */
.report-cue {
  display: block; margin: 0 auto; padding: 10px 22px; border: none;
  background: var(--ink); color: #EFF4F2; border-radius: 999px; cursor: pointer;
  font: 600 14px "Space Grotesk", sans-serif; transform: translateY(-22px);
  box-shadow: var(--shadow);
}
.report-cue:hover { background: var(--ev); color: #062b1e; }

.report { background: var(--panel); border-top: 1px solid var(--line); }
.report-inner { max-width: 980px; margin: 0 auto; padding: 24px 24px 56px; }
.report h2 { font-size: 26px; margin: 8px 0 4px; }
.lede { color: var(--muted); max-width: 70ch; }
.report h3 { font-size: 17px; margin: 22px 0 8px; }
.table-wrap { overflow-x: auto; }
#report-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
#report-table th, #report-table td { text-align: right; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
#report-table th:first-child, #report-table td:first-child,
#report-table th:nth-child(2), #report-table td:nth-child(2) { text-align: left; }
#report-table thead th { color: var(--muted); font-weight: 600; border-bottom: 2px solid var(--grid); }
.report-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; margin-top: 8px; }
.method { padding-left: 18px; }
.method li { margin: 6px 0; }
.sources { font-size: 13px; color: var(--muted); }
.links-grid {
  list-style: none; padding: 0; margin: 8px 0 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 6px 20px;
  font-size: 13.5px;
}
.links-grid li { color: var(--muted); }
.disclaimer { font-size: 12.5px; color: var(--muted); margin-top: 28px; }
.site-foot {
  font-size: 13px; color: var(--muted); margin-top: 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.coffee {
  text-decoration: none; font-size: 20px; line-height: 1; opacity: .55;
  transition: opacity .15s, transform .15s; filter: grayscale(1);
}
.coffee:hover { opacity: 1; filter: grayscale(0); transform: scale(1.15); }

/* ---------------- responsive ---------------- */
@media (max-width: 1080px) {
  .dashboard { grid-template-columns: 1fr; height: auto; }
  .inputs { overflow: visible; }
  .chart-box { min-height: 320px; }
  .report-cols { grid-template-columns: 1fr; gap: 8px; }
  .topbar { flex-wrap: wrap; height: auto; padding: 10px 16px; gap: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}

/* ---------------- guided start (onboarding overlay) ---------------- */
.onboard {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center; padding: 20px;
  background: rgba(27, 42, 46, .55);
}
.onboard[hidden] { display: none; }
.onboard-card {
  position: relative; width: 100%; max-width: 560px; padding: 26px 24px 22px;
  background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow);
}
.onboard-card h2 { font-size: 24px; margin: 0 0 4px; }
.onboard-lede { color: var(--muted); margin: 0 0 18px; }
.onboard-skip {
  position: absolute; top: 14px; right: 14px;
  background: transparent; border: 1px solid var(--line); color: var(--muted);
  border-radius: 8px; padding: 6px 12px; font: inherit; cursor: pointer;
}
.onboard-skip:hover { color: var(--ink); border-color: var(--grid); }
.onboard-q { font-family: "Space Grotesk", "Inter", sans-serif; font-size: 17px; margin: 0 0 12px; }
.onboard-choices { display: flex; flex-direction: column; gap: 10px; }
.onboard-choice {
  text-align: left; font: inherit; cursor: pointer;
  background: #FBFCFB; border: 1px solid var(--line); border-left: 4px solid var(--accent);
  border-radius: 10px; padding: 12px 14px; transition: border-color .15s, background .15s;
}
.onboard-choice:hover { border-left-color: var(--ev); background: var(--good-bg); }
.onboard-choice strong { display: block; font-family: "Space Grotesk", "Inter", sans-serif; }
.onboard-choice span { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.onboard-select {
  width: 100%; font: inherit; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px; background: #FBFCFB; color: var(--ink);
}
.onboard-actions { margin-top: 14px; }
.onboard-next {
  font: inherit; cursor: pointer; color: #fff; background: var(--ev);
  border: none; border-radius: 10px; padding: 10px 18px;
}
.onboard-next:hover { filter: brightness(1.05); }
.onboard-back {
  margin-top: 14px; padding: 6px 0; font: inherit; cursor: pointer;
  background: none; border: none; color: var(--accent);
}

/* visible keyboard focus everywhere */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
