/* Wattlab's page. Loaded after site.css, which gives the type, the top line, the screens row, the "doesn't do" list,
   the other apps and the footer. Tokens come from Wattlab's own theme (wattlab repo, branding/tokens.json,
   "Instrument Yellow"), and its rule holds here too: yellow is a fill, and is text or a line only on dark. */
:root.wattlab {
  --paper: #f6f5f1;
  --ink: #1a1b1e;
  --ink-2: #5c5a54;
  --ink-3: #8a877f;
  --line: rgb(26 27 30 / 0.13);
  --link: #5a4000;
  --card: #ffffff;
  --device: #0a0a0b;
  --icon-edge: rgb(26 27 30 / 0.08);
  --mark: #1a1b1e;
  --brand: #ffc21a;
  --on-brand: #241a00;
  --shadow-card: 0 1px 2px rgb(26 27 30 / 0.06), 0 12px 32px -8px rgb(26 27 30 / 0.18);
}

@media (prefers-color-scheme: dark) {
  :root.wattlab {
    --paper: #111214;
    --ink: #f2f0ea;
    --ink-2: #a3a19a;
    --ink-3: #77756f;
    --line: rgb(242 240 234 / 0.1);
    --link: #ffc21a;
    --card: #1a1b1e;
    --device: #25262a;
    --icon-edge: rgb(242 240 234 / 0.14);
    --mark: #ffc21a;
    --shadow-card: 0 0 0 1px rgb(242 240 234 / 0.06), 0 16px 36px -12px rgb(0 0 0 / 0.65);
  }
}

/* The app is dark by default, so the top of the page is too, in both colour schemes: the top line and the bench
   sit on the app's canvas with its dark tokens, and the page turns to paper below them. */
.wattlab .dark {
  --paper: #111214;
  --ink: #f2f0ea;
  --ink-2: #a3a19a;
  --ink-3: #77756f;
  --line: rgb(242 240 234 / 0.1);
  --link: #ffc21a;
  --card: #1a1b1e;
  --surface-alt: #25262a;
  --icon-edge: rgb(242 240 234 / 0.14);
  --shadow-card: 0 0 0 1px rgb(242 240 234 / 0.06), 0 16px 36px -12px rgb(0 0 0 / 0.65);
  background: var(--paper);
  color: var(--ink);
}

/* The top line keeps the page gutter as padding, so its dark ground runs edge to edge. */
.wattlab .top.wrap { width: auto; margin: 0; padding-inline: var(--gutter); }

/* ---------- The bench: copy on the left, the instrument on the right ---------- */
.stage { overflow: hidden; }

.stage-in {
  display: grid;
  gap: 48px;
  padding-block: var(--hero-top-space) clamp(56px, 7vw, 104px);
}

/* The question is longer than Cooldown's headline, so it is set a step smaller. */
.stage h1 { font-size: clamp(2.375rem, 0.9rem + 4.9vw, 7.5rem); }
.stage .cta .fine { margin-top: 14px; }

@media (min-width: 900px) {
  .stage-in {
    grid-template-columns: minmax(0, 1fr) minmax(0, 0.76fr);
    column-gap: clamp(48px, 7vw, 128px);
    align-items: start;
  }
  .bench { max-width: none; }
}

/* A little of the gauge's light falls on the canvas behind it, and follows the reading. */
/* Stacked under the copy (below 900px) the instrument stops growing at 36rem, so a tablet doesn't get a gauge a screen tall. */
.bench { --tier: #ffc21a; --glow: 0.56; position: relative; isolation: isolate; min-width: 0; width: 100%; max-width: 36rem; }
.bench[data-tier="standard"] { --tier: #b8901e; }
.bench[data-tier="slow"] { --tier: #8e8a80; }
.bench::before {
  content: "";
  position: absolute;
  z-index: -1;
  left: 50%;
  top: 0;
  width: 150%;
  aspect-ratio: 1;
  transform: translate(-50%, -22%);
  background: radial-gradient(closest-side, rgb(255 194 26 / 0.2), rgb(255 194 26 / 0.06) 55%, transparent);
  opacity: calc(var(--glow) * 1.3);
  pointer-events: none;
}

/* The gauge is the app's own (Gauge.kt): a half circle split where each speed tier starts, the number standing on
   the line through the arc's ends. Everything inside is sized from the gauge's width. */
.meter { position: relative; container-type: inline-size; }
@media (max-width: 899px) {
  .meter { margin-top: 22px; }
}
.gauge { display: block; width: 100%; height: auto; overflow: visible; }
.gauge-fill { stroke: var(--tier); transition: stroke 0.3s; }

.marks { position: absolute; inset: 0; font-size: 0.75rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.marks span { position: absolute; transform: translate(-50%, -50%); }

.read {
  position: absolute;
  inset: auto 0 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  gap: 3.4cqw;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.4em 0.85em;
  border-radius: 0.8em;
  background: var(--card);
  background: color-mix(in srgb, var(--tier) 18%, var(--paper));
  font-size: 0.875rem;
  font-size: clamp(0.8125rem, 3.4cqw, 1.25rem);
  line-height: 1.3;
  font-weight: 600;
  transition: background-color 0.3s;
}
.chip .ic { width: 1.2em; height: 1.2em; color: var(--tier); transition: color 0.3s; }
/* The line box is as tall as the digits, so they stand on the bottom edge of the gauge. */
.num { display: flex; align-items: baseline; gap: 0.06em; font-size: clamp(4rem, 9vw, 8rem); font-size: 23cqw; line-height: 0.74; }
.watts { font-weight: 600; font-stretch: 112%; letter-spacing: -0.035em; font-variant-numeric: tabular-nums; }
.unit { font-size: 0.32em; font-weight: 500; color: var(--ink-2); }

.flow {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  font-size: 0.9375rem;
  color: var(--ink-2);
}
.flow .end { font-size: 0.75rem; font-variant-numeric: tabular-nums; padding-left: 1.2%; }
.flow .end:last-child { text-align: right; padding: 0; }
.flow-mid { display: flex; align-items: center; gap: 9px; }
.flow .ic { flex: none; width: 1.375rem; height: 1.375rem; }
.flow .arrow { flex: none; width: 2.75rem; height: 0.8rem; color: var(--tier); transition: color 0.3s; }
.flow .batt { color: var(--tier); transition: color 0.3s; }
.flow-mid span { margin-left: 3px; }

/* The four setups, ranked as on the app's Compare tab. They are radio buttons: the row is the label, and the
   button itself is the row's background, so the choice shows without :has(). */
.setups { min-width: 0; margin: clamp(24px, 3vw, 36px) 0 0; padding: 0; border: 0; }
.setups legend { padding: 0; margin-bottom: 8px; font-size: 0.9375rem; color: var(--ink-2); }

.setup {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: 1.25rem minmax(0, 1fr) auto;
  gap: 8px 10px;
  align-items: baseline;
  margin-inline: -14px;
  padding: 11px 14px 13px;
  color: var(--ink-2);
  cursor: pointer;
}
.setup[data-tier="fast"] { --bar: #ffc21a; }
.setup[data-tier="standard"] { --bar: #b8901e; }
.setup[data-tier="slow"] { --bar: #8e8a80; }

.setup input {
  position: absolute;
  z-index: -1;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  border-radius: 14px;
  -webkit-appearance: none;
  appearance: none;
  background: none;
  cursor: pointer;
  transition: background-color 0.2s var(--ease-out);
}
.setup input:checked { background: var(--card); }
.setup input:focus-visible { outline-offset: -2px; border-radius: 14px; }

.setup-rank { font-size: 0.875rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.setup-name { font-weight: 500; transition: color 0.2s; }
.setup-watts { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; transition: color 0.2s; }
.setup input:checked ~ :is(.setup-name, .setup-watts) { color: var(--ink); }
.setup input:checked ~ .setup-rank { color: var(--ink-2); }

.setup-bar { grid-column: 2 / -1; height: 6px; border-radius: 3px; background: var(--surface-alt); overflow: hidden; }
.setup-bar i { display: block; height: 100%; border-radius: 3px; background: var(--bar); }

@media (hover: hover) {
  .setup:hover :is(.setup-name, .setup-watts) { color: var(--ink); }
}

/* What the chosen result means: the app's reason when it gives one, then a line of ours. Two lines are kept
   free so the page below does not move as the bench steps through the setups. */
.verdict { min-height: 4.7em; margin-top: 16px; color: var(--ink-2); }
.verdict .reason { display: block; font-weight: 600; color: var(--ink); }
.verdict .reason:empty { display: none; }
.bench > .fine { margin-top: 10px; color: var(--ink-3); }

@media (min-width: 900px) {
  .verdict { min-height: 3.2em; }
}

/* ---------- Battery health: a full-width band of the brand yellow ---------- */
/* Yellow as a fill with the app's own ink on it (brandFill / onBrandFill), the same in both colour schemes. */
.health {
  --ink: #241a00;
  --ink-2: rgb(36 26 0 / 0.8);
  --line: rgb(36 26 0 / 0.24);
  --link: #241a00;
  background: var(--brand);
  color: var(--ink);
}

.health-in {
  display: grid;
  gap: 48px;
  padding-block: clamp(72px, 9vw, 7.5rem);
}
.health-copy p { max-width: 34em; margin-top: 18px; color: var(--ink-2); }

@media (min-width: 900px) {
  .health-in {
    grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr);
    column-gap: clamp(56px, 8vw, 128px);
    align-items: end;
  }
}

.capacity { margin: 0; min-width: 0; }

/* The estimate is the section's headline number, and its error range is written as large as its unit. */
.cap-read { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 0.6rem; }
.cap-read b {
  font-size: clamp(4.25rem, 1rem + 9.4vw, 11rem);
  line-height: 0.9;
  font-weight: 600;
  font-stretch: 112%;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}
.cap-unit, .cap-margin { font-size: clamp(1.25rem, 0.85rem + 1.5vw, 2.5rem); line-height: 1.1; font-weight: 600; font-stretch: 108%; }
.cap-margin {
  margin-left: 0.25rem;
  padding: 0.14em 0.42em 0.16em;
  border-radius: 0.42em;
  background: var(--ink);
  color: var(--brand);
  font-variant-numeric: tabular-nums;
}

/* One axis, 5,700 to 6,400 mAh: the error range as a band, the estimate as the bar in its middle, a tick for each
   charge it rests on, and the maker's rated capacity as a dashed line. Only those points are labelled. */
.cap-scale { margin-top: clamp(30px, 4vw, 48px); font-size: 0.8125rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.cap-top, .cap-ends { position: relative; height: 1.5rem; }
.cap-top span, .cap-ends span { position: absolute; white-space: nowrap; }
.cap-top span { bottom: 6px; }
.cap-count { transform: translateX(-50%); }
.cap-rated-label { right: 0; }
.cap-ends span { top: 7px; transform: translateX(-50%); }

.cap-track { position: relative; height: 46px; border-bottom: 2px solid var(--ink); }
.cap-track i { position: absolute; bottom: 0; }
.cap-range {
  height: 28px;
  border-inline: 2px solid var(--ink);
  background: rgb(36 26 0 / 0.16);
  transform-origin: 50% 100%;
  transition: transform 0.9s var(--ease-out);
}
.cap-est { width: 4px; height: 28px; margin-left: -2px; background: var(--ink); }
.cap-track .cap-charge { bottom: 33px; width: 2px; height: 13px; margin-left: -1px; background: var(--ink); transition: opacity 0.4s 0.5s, transform 0.5s 0.5s var(--ease-out); }
.cap-rated { height: 46px; margin-left: -1px; border-left: 2px dashed var(--ink); transition: opacity 0.5s 0.8s; }
.cap-top span, .cap-ends span { transition: opacity 0.5s 0.8s; }

.capacity.wait .cap-range { transform: scaleX(0); }
.capacity.wait .cap-charge { opacity: 0; transform: translateY(-10px); }
.capacity.wait :is(.cap-rated, .cap-top span, .cap-ends span) { opacity: 0; }

.cap-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 16px clamp(28px, 4vw, 64px);
  margin: clamp(24px, 3vw, 36px) 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.cap-facts dt { font-size: 0.8125rem; color: var(--ink-2); }
.cap-facts dd { margin: 2px 0 0; font-size: 1.125rem; font-weight: 600; font-stretch: 106%; font-variant-numeric: tabular-nums; }

/* ---------- After the test ---------- */
.also { padding-block: var(--section); }
.also-list { display: grid; margin: 36px 0 0; padding: 0; list-style: none; }
.also-list li { padding-block: 22px; border-top: 1px solid var(--line); }
.also-list p { max-width: 30em; margin-top: 8px; color: var(--ink-2); }

@media (min-width: 700px) {
  .also-list { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: clamp(32px, 4vw, 88px); }
}
@media (min-width: 1200px) {
  .also-list { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* The dash before each "doesn't" is ink on paper and yellow on dark. */
.wattlab .nots li::before { background: var(--mark); }
