/* Solar power guide. Warm paper, deep ink, one sun amber accent. Big, plain type for easy reading. */

@font-face {
  font-family: 'Figtree';
  font-style: normal;
  font-weight: 300 800;
  font-display: swap;
  src: url('/fonts/figtree-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'Newsreader';
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url('/fonts/newsreader-latin-wght-normal.woff2') format('woff2');
}

:root {
  color-scheme: light dark;
  --paper: #faf6ee;
  --card: #ffffff;
  --ink: #1f2622;
  --ink-2: #4a524d;
  --ink-3: #6b726d;
  --rule: #e3ddd0;
  --grid: #ece6da;
  --sun: #b8650f;
  --sun-bar: #d9822b;
  --sun-wash: #fbecd9;
  --leaf: #2f6b4f;
  --leaf-wash: #e4f0e9;
  --warn: #8a3b12;
  --warn-wash: #fbe9e0;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(31, 38, 34, .06), 0 8px 24px rgba(31, 38, 34, .06);
  --serif: 'Newsreader', Georgia, 'Times New Roman', serif;
  --sans: 'Figtree', 'Segoe UI', system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #161a18;
    --card: #1e2321;
    --ink: #f1ece2;
    --ink-2: #c9c3b8;
    --ink-3: #9d988f;
    --rule: #343a37;
    --grid: #2a302d;
    --sun: #f0a54e;
    --sun-bar: #e08f3a;
    --sun-wash: #33281c;
    --leaf: #7cc39d;
    --leaf-wash: #1f2e27;
    --warn: #f3a37e;
    --warn-wash: #3a2219;
    --shadow: none;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.1875rem;
  line-height: 1.6;
}

a { color: var(--sun); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
a:focus-visible, .bar:focus-visible, summary:focus-visible {
  outline: 3px solid var(--sun);
  outline-offset: 3px;
  border-radius: 4px;
}

.wrap { width: min(1080px, 100% - 40px); margin-inline: auto; }

/* Header */
.top {
  border-bottom: 1px solid var(--rule);
  padding: 56px 0 40px;
}
.kicker {
  margin: 0 0 14px;
  font-size: .95rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-3);
}
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.15; margin: 0; }
h1 { font-size: clamp(2.2rem, 5.2vw, 3.6rem); letter-spacing: -.01em; max-width: 18ch; }
.lede { margin: 20px 0 0; max-width: 60ch; font-size: 1.25rem; color: var(--ink-2); }
.stamp {
  display: flex; flex-wrap: wrap; gap: 10px 22px;
  margin: 26px 0 0; padding: 0; list-style: none;
  font-size: 1rem; color: var(--ink-2);
}
.stamp li { display: flex; align-items: center; gap: 8px; }
.stamp svg { width: 20px; height: 20px; color: var(--sun); flex: none; }

section { padding: 56px 0; border-bottom: 1px solid var(--rule); }
section:last-of-type { border-bottom: 0; }
h2 { font-size: clamp(1.75rem, 3.4vw, 2.4rem); margin-bottom: 10px; }
.sub { margin: 0 0 28px; color: var(--ink-2); max-width: 62ch; }

.sub.after { margin: 16px 0 0; font-size: 1rem; }
.sub.tablenote { margin: 12px 0 0; font-size: 1rem; }

/* Quick picks */
.picks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.pick {
  background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 22px 22px 20px; display: flex; flex-direction: column; gap: 8px;
}
.pick .tag { font-size: .9rem; font-weight: 700; color: var(--sun); letter-spacing: .02em; }
.pick h3 { font-size: 1.45rem; }
.pick p { margin: 0; color: var(--ink-2); font-size: 1.05rem; }
.pick .price { font-weight: 700; color: var(--ink); font-size: 1.15rem; }
.pick a.go { margin-top: auto; padding-top: 6px; font-weight: 700; }

/* Size guide */
.sizes { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; }
.sizes th, .sizes td { text-align: left; padding: 14px 18px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.sizes thead th { font-size: .95rem; color: var(--ink-3); font-weight: 700; background: var(--paper); }
.sizes tbody tr:last-child td { border-bottom: 0; }
.sizes td:first-child { font-weight: 700; white-space: nowrap; }

/* Chart */
.chart {
  margin: 0;
  background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 26px 26px 18px;
}
.chart-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 20px; margin-bottom: 18px; }
.chart-head h3 { font-size: 1.35rem; }
.chart-head p { margin: 0; color: var(--ink-3); font-size: 1rem; }
.rows { list-style: none; margin: 0; padding: 0; position: relative; }
.row {
  display: grid; grid-template-columns: minmax(150px, 290px) 1fr; align-items: center;
  gap: 16px; padding: 7px 0;
}
.row .name { font-size: 1.02rem; line-height: 1.25; }
.row .name b { display: block; }
.row .name span { color: var(--ink-3); font-size: .92rem; }
.track {
  position: relative; height: 34px;
  background-image: linear-gradient(to right, var(--grid) 1px, transparent 1px);
  background-size: 25% 100%;
  border-left: 1px solid var(--ink-3);
}
.bar {
  position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  height: 22px;
  background: var(--sun-bar);
  border-radius: 0 4px 4px 0;
  cursor: default;
}
.bar .val {
  position: absolute; left: calc(100% + 10px); top: 50%; transform: translateY(-50%);
  font-weight: 700; font-size: 1rem; white-space: nowrap; color: var(--ink);
}
.bar .tip {
  position: absolute; z-index: 5; left: 0; bottom: calc(100% + 10px);
  min-width: 230px; max-width: 300px;
  background: var(--ink); color: var(--paper);
  padding: 10px 14px; border-radius: 6px; font-size: .95rem; line-height: 1.45;
  opacity: 0; visibility: hidden; transition: opacity .12s;
  pointer-events: none;
}
.bar .tip b { display: block; }
.bar:hover .tip, .bar:focus-visible .tip { opacity: 1; visibility: visible; }
/* Bar lengths: Wh per $100 on a 0 to 200 scale (a class each, because the CSP allows no inline style). */
.b1 { width: 84.5%; }
.b2 { width: 83.8%; }
.b3 { width: 74.0%; }
.b4 { width: 73.0%; }
.b5 { width: 70.8%; }
.b6 { width: 69.7%; }
.b7 { width: 64.5%; }
.b8 { width: 64.1%; }
.b9 { width: 60.3%; }
.b10 { width: 48.9%; }
.axis {
  display: grid; grid-template-columns: minmax(150px, 290px) 1fr; gap: 16px;
  margin-top: 6px; font-size: .88rem; color: var(--ink-3);
}
.axis .ticks { display: flex; justify-content: space-between; }
.chart .note { margin: 14px 0 0; font-size: .95rem; color: var(--ink-3); }

/* Top 10 cards */
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; }
.item {
  background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 24px 26px; display: grid; grid-template-columns: 64px 1fr; gap: 4px 20px;
}
.item:first-child { box-shadow: var(--shadow); border-color: var(--sun); }
.rank {
  grid-row: 1 / span 3; width: 52px; height: 52px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--serif); font-size: 1.6rem; font-weight: 700;
  color: var(--sun); border: 2px solid var(--sun);
}
.item h3 { font-size: 1.5rem; }
.item .brand { color: var(--ink-3); font-size: 1rem; margin: 2px 0 0; }
.facts {
  display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 4px; padding: 0; list-style: none;
}
.facts li {
  background: var(--paper); border: 1px solid var(--rule); border-radius: 6px;
  padding: 4px 10px; font-size: .95rem;
}
.facts li b { font-weight: 700; }
.facts li.cost { background: var(--sun-wash); border-color: transparent; font-weight: 700; }
.item .why { grid-column: 2; }
.item h4 { margin: 14px 0 4px; font-size: 1rem; letter-spacing: .02em; }
.item ul.points { margin: 0; padding-left: 1.2em; }
.item ul.points li { margin: 2px 0; }
.item .watch { margin: 12px 0 0; padding: 10px 14px; background: var(--warn-wash); border-radius: 6px; color: var(--ink); font-size: 1.02rem; }
.item .watch b { color: var(--warn); }
.item .buy { margin: 16px 0 0; display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--ink); color: var(--paper); text-decoration: none;
  padding: 11px 18px; border-radius: 6px; font-weight: 700; font-size: 1.02rem;
}
.btn:hover { background: var(--sun); color: #fff; }
.btn svg { width: 18px; height: 18px; }
.item .seen { color: var(--ink-3); font-size: .92rem; }

/* Full table */
.scroll { overflow-x: auto; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--card); }
.full { border-collapse: collapse; width: 100%; min-width: 900px; font-size: 1rem; }
.full th, .full td { padding: 12px 10px; border-bottom: 1px solid var(--rule); text-align: left; white-space: nowrap; }
.full th:first-child, .full td:first-child { padding-left: 16px; }
.full thead th { background: var(--paper); color: var(--ink-3); font-size: .9rem; white-space: normal; vertical-align: bottom; line-height: 1.25; }
.full td.num, .full th.num { text-align: right; font-variant-numeric: tabular-nums; }
.full tbody tr:last-child td { border-bottom: 0; }

/* Words and tips */
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
dl.words { margin: 0; }
dl.words dt { font-weight: 700; margin-top: 14px; }
dl.words dt:first-child { margin-top: 0; }
dl.words dd { margin: 2px 0 0; color: var(--ink-2); }
ol.tips { margin: 0; padding-left: 1.3em; }
ol.tips li { margin: 0 0 10px; }

footer { padding: 36px 0 60px; color: var(--ink-3); font-size: 1rem; }
footer p { margin: 0 0 6px; max-width: 70ch; }

@media (max-width: 900px) {
  .picks { grid-template-columns: 1fr; }
  .two { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  body { font-size: 1.125rem; }
  .top { padding: 36px 0 28px; }
  section { padding: 40px 0; }
  .row, .axis { grid-template-columns: 1fr; gap: 4px; }
  .axis .spacer { display: none; }
  .row { padding: 8px 0; }
  .track, .axis .ticks { margin-right: 68px; }
  .chart { padding: 18px 16px 14px; }
  .item { grid-template-columns: 1fr; padding: 20px 18px; }
  .rank { grid-row: auto; width: 44px; height: 44px; font-size: 1.35rem; }
  .item .why { grid-column: 1; }
  /* The size table turns into one card per battery size on a phone. */
  .sizes thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .sizes, .sizes tbody, .sizes tr, .sizes td { display: block; width: 100%; }
  .sizes tr { border-bottom: 1px solid var(--rule); padding: 6px 0; }
  .sizes tbody tr:last-child { border-bottom: 0; }
  .sizes td { border: 0; padding: 4px 16px; display: flex; justify-content: space-between; gap: 16px; text-align: right; }
  .sizes td:first-child { font-size: 1.15rem; padding-top: 10px; text-align: left; }
  .sizes td[data-label]::before { content: attr(data-label); color: var(--ink-3); text-align: left; font-weight: 400; white-space: nowrap; flex: none; }
}
@media (prefers-reduced-motion: reduce) { .bar .tip { transition: none; } }
@media print {
  body { background: #fff; color: #000; font-size: 12pt; }
  .btn { border: 1px solid #000; background: #fff; color: #000; }
  .bar .tip { display: none; }
  section { break-inside: avoid-page; }
}
