/* Device Lifespan Estimator
 *
 * Visual Theme: Black Shard (Cyber-engineering obsidian & electric cyan)
 * The product is about time running out, so the interface is built around a
 * timeline and motion is used to express duration - the marker slides, the
 * runway shortens - rather than as decoration.
 */

/* Inter is fetched from Google Fonts with display=swap, which paints text in a
 * fallback face and then reflows when Inter arrives. A trace of the live site
 * showed that single reflow was 0.0794 of a 0.083 CLS - 95% of the page's
 * layout shift, and the only shift originating from our own code.
 *
 * This gives the fallback Inter's own metrics so the two occupy identical
 * space and the swap moves nothing. The numbers were measured against the
 * loaded font rather than copied: Inter is 107.12% the advance width of Arial
 * for the same string, with ascent 96.9% and descent 24.1% of em, which become
 * 90.46% and 22.50% once divided by the size adjustment.
 *
 * Pinned to Arial specifically. Leaving it to the generic stack would pick a
 * different fallback per platform - Segoe UI measures 108.89% here - and one
 * set of overrides cannot be correct for several faces at once. */
@font-face {
  font-family: "Inter Fallback";
  src: local("Arial"), local("Helvetica"), local("Liberation Sans");
  size-adjust: 107.12%;
  ascent-override: 90.46%;
  descent-override: 22.50%;
  line-gap-override: 0%;
}

:root {
  color-scheme: light dark;

  /* Monochromatic technical light companion palette */
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #f0f1f4;
  --text: #0b0d11;
  --muted: #3a3d46;
  --faint: #5d616d;
  --border: #d5d8df;
  --border-strong: #9ca0ac;
  --track: #dfe2e8;
  --track-used: #b8bdc8;

  /* Black Shard inspired cyan/teal accents */
  --accent: #2563eb;
  --accent-2: #3b82f6;
  --accent-contrast: #ffffff;
  --accent-soft: #eff6ff;

  --good: #0e6b3f;
  --warn: #8a5300;
  --bad:  #bb2418;

  /* Non-text marks: bars and ticks. 3:1 is the bar, so these can be brighter
   * than the body colours above without failing anything. */
  --good-mark: #10a05f;
  --warn-mark: #c28300;
  --bad-mark:  #d63122;

  --note-bg: #fffbeb;
  --note-border: #fde68a;
  --good-bg: #ecfdf5;
  --good-border: #a7f3d0;

  /* Geometric shard precision: tight radii */
  --radius: 8px;
  --radius-sm: 6px;
  --radius-xs: 4px;

  /* Structure comes from hairline borders and subtle depth */
  --shadow: 0 1px 0 rgba(20, 21, 26, 0.04);
  --shadow-lift: 0 2px 0 rgba(20, 21, 26, 0.07);

  --ease: cubic-bezier(0.4, 0.0, 0.2, 1);
  --dur: 200ms;
  --dur-slow: 480ms;

  --page: 44rem;
  --page-wide: 74rem;

  --font-serif: "DM Serif Display", Georgia, serif;
  --font-sans: "Inter", "Inter Fallback", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

/* Dark values are defined once and applied by both the system preference and an
 * explicit toggle, so neither can strand a colour undefined.
 * Black Shard signature palette: Obsidian core, electric cyan glow, sharp cyber precision. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #07080b;
    --surface: #111319;
    --surface-2: #161922;
    --text: #f0f2f5;
    --muted: #9ba0aa;
    --faint: #808694;
    --border: #232732;
    --border-strong: #383e4e;
    --track: #1b1e26;
    --track-used: #343a49;
    --accent: #3b82f6;
    --accent-2: #60a5fa;
    --accent-contrast: #07080b;
    --accent-soft: #1e3a8a;
    --good: #34d399;
    --warn: #f59e0b;
    --bad:  #ff6f60;
    --good-mark: #22d3ee;
    --warn-mark: #f59e0b;
    --bad-mark:  #ff6f60;
    --note-bg: #1c180e;
    --note-border: #4d3a12;
    --good-bg: #0d2218;
    --good-border: #184e36;
    --shadow: 0 1px 0 rgba(0, 0, 0, 0.6);
    --shadow-lift: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  }
}

:root[data-theme="dark"] {
  --bg: #07080b;
  --surface: #111319;
  --surface-2: #161922;
  --text: #f0f2f5;
  --muted: #9ba0aa;
  --faint: #808694;
  --border: #232732;
  --border-strong: #383e4e;
  --track: #1b1e26;
  --track-used: #343a49;
  --accent: #3b82f6;
  --accent-2: #60a5fa;
  --accent-contrast: #07080b;
  --accent-soft: #1e3a8a;
  --good: #34d399;
  --warn: #f59e0b;
  --bad:  #ff6f60;
  --good-mark: #22d3ee;
  --warn-mark: #f59e0b;
  --bad-mark:  #ff6f60;
  --note-bg: #1c180e;
  --note-border: #4d3a12;
  --good-bg: #0d2218;
  --good-border: #184e36;
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.6);
  --shadow-lift: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  position: relative;
  min-height: 100vh;
}

/* Subtle Black Shard cyber-engineering grid & ambient radial glow texture */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    radial-gradient(ellipse 90% 60% at 50% -15%, rgba(0, 184, 212, 0.08), transparent 75%);
  background-size: 48px 48px, 48px 48px, 100% 100%;
  background-position: center top;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) body::before {
    background-image:
      linear-gradient(to right, rgba(0, 0, 0, 0.025) 1px, transparent 1px),
      linear-gradient(to bottom, rgba(0, 0, 0, 0.025) 1px, transparent 1px),
      radial-gradient(ellipse 90% 60% at 50% -15%, rgba(0, 124, 145, 0.05), transparent 75%);
  }
}
:root[data-theme="light"] body::before {
  background-image:
    linear-gradient(to right, rgba(0, 0, 0, 0.025) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0, 0, 0, 0.025) 1px, transparent 1px),
    radial-gradient(ellipse 90% 60% at 50% -15%, rgba(0, 124, 145, 0.05), transparent 75%);
}

a { color: var(--accent); text-decoration: none; transition: color var(--dur) var(--ease); }
a:hover { text-decoration: underline; color: var(--accent-2); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 0.7rem 1.1rem;
  background: var(--accent);
  color: var(--accent-contrast);
  border-radius: 0 0 var(--radius-xs) 0;
  font-weight: 600;
}
.skip-link:focus { left: 0; text-decoration: none; }

.link-button {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
  font-family: inherit;
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  transition: color var(--dur) var(--ease);
}
.link-button:hover { color: var(--text); }

.eyebrow {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

/* ------------------------------------------------------------------- nav -- */

.site-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.5rem;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.site-nav .brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 1.22rem;
  letter-spacing: -0.015em;
  color: var(--text);
  transition: color var(--dur) var(--ease);
}
.site-nav .brand:hover { text-decoration: none; color: var(--accent); }

.brand-mark {
  width: 1.7rem;
  height: 1.7rem;
  border-radius: var(--radius-xs);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.site-nav .brand:hover .brand-mark {
  border-color: var(--accent);
  
}
.brand-mark svg { width: 1.05rem; height: 1.05rem; }

.nav-right { display: flex; align-items: center; gap: 1rem; }

.nav-links {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
  font-size: 0.88rem;
}
.nav-links a {
  position: relative;
  color: var(--muted);
  font-weight: 500;
  transition: color var(--dur) var(--ease);
}
.nav-links a:hover { color: var(--text); text-decoration: none; }
.nav-links a[aria-current="page"] { color: var(--text); }
.nav-links a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -0.85rem;
  height: 2px;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  border-radius: 0;
}

.theme-toggle {
  width: auto;
  margin: 0;
  padding: 0.35rem 0.5rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  line-height: 1;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.theme-toggle:hover {
  color: var(--text);
  border-color: var(--accent);
  
}
.theme-toggle svg { width: 1rem; height: 1rem; }

/* ----------------------------------------------------------------- header -- */

header.hero {
  max-width: var(--page);
  margin: 0 auto;
  padding: 3.5rem 1.5rem 1.5rem;
  text-align: center;
}

header.hero h1 {
  margin: 0 0 0.85rem;
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: clamp(2.1rem, 5vw, 3.15rem);
  line-height: 1.05;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

header.hero p {
  color: var(--muted);
  font-size: 1.08rem;
  max-width: 37rem;
  margin: 0 auto;
  text-wrap: pretty;
  line-height: 1.6;
}

.stats-strip {
  display: flex;
  justify-content: center;
  gap: 0.6rem 1.35rem;
  flex-wrap: wrap;
  margin-top: 1.75rem;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.stats-strip span { display: inline-flex; align-items: center; gap: 0.45rem; }
.stats-strip .dot {
  width: 4px; height: 4px;
  border-radius: 0;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  flex-shrink: 0;
}

header.page-header {
  max-width: var(--page);
  margin: 0 auto;
  padding: 2.75rem 1.5rem 1rem;
}
header.page-header h1 {
  margin: 0 0 0.5rem;
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: clamp(1.8rem, 4vw, 2.45rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
}
header.page-header p { color: var(--muted); margin: 0; line-height: 1.6; }

.breadcrumb {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  letter-spacing: 0.03em;
  color: var(--faint);
  margin: 0 0 1.1rem;
}
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--accent); }

main { max-width: var(--page); margin: 0 auto; padding: 0 1.5rem 4rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.75rem;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.card:hover {
  border-color: var(--border-strong);
}

/* ------------------------------------------------------------------ form -- */

label, .field-label {
  display: block;
  font-weight: 600;
  margin: 1.1rem 0 0.4rem;
  font-size: 0.85rem;
  letter-spacing: 0.01em;
  color: var(--text);
}

select, input[type="search"], input[type="number"], input[type="month"] {
  width: 100%;
  padding: 0.72rem 0.85rem;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  font-size: 0.95rem;
  background: var(--surface-2);
  color: var(--text);
  font-family: inherit;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
select:hover, input:hover { border-color: var(--border-strong); }
select:focus, input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 0 14px color-mix(in srgb, var(--accent) 30%, transparent);
}

button {
  font-family: inherit;
  cursor: pointer;
}

.btn-primary {
  margin-top: 1.5rem;
  width: 100%;
  padding: 0.85rem;
  border: 1px solid var(--accent);
  border-radius: var(--radius-xs);
  background: var(--accent);
  color: var(--accent-contrast);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  
  transition: transform 120ms var(--ease), box-shadow var(--dur) var(--ease), opacity var(--dur) var(--ease), background var(--dur) var(--ease);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 22px color-mix(in srgb, var(--accent) 50%, transparent);
}
.btn-primary:active { transform: translateY(0) scale(0.99); }

.form-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0 0 0.35rem;
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
}
.form-title-bar {
  width: 2px;
  height: 1.15rem;
  border-radius: 0;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
  flex-shrink: 0;
}

.field-row { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.field-row > * { flex: 1 1 12rem; }
.field-row-3 > * { flex: 1 1 8rem; }

/* Segmented usage control */
.usage-group { display: flex; gap: 0.5rem; }

.usage-pill {
  flex: 1;
  position: relative;
  text-align: center;
  padding: 0.62rem 0.5rem;
  margin: 0;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.usage-pill input { position: absolute; opacity: 0; pointer-events: none; }
.usage-pill:hover { border-color: var(--border-strong); color: var(--text); }
.usage-pill:has(input:checked) {
  background: color-mix(in srgb, var(--accent) 15%, var(--surface-2));
  border-color: var(--accent);
  color: var(--text);
  
}
.usage-pill:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

.usage-caption { color: var(--muted); font-size: 0.8rem; margin: 0.55rem 0 0; }

details.advanced { margin-top: 1.25rem; border-top: 1px solid var(--border); padding-top: 0.85rem; }
details.advanced summary {
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
details.advanced summary::-webkit-details-marker { display: none; }
details.advanced summary::before {
  content: "";
  width: 0.4rem; height: 0.4rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform var(--dur) var(--ease);
}
details.advanced[open] summary::before { transform: rotate(45deg); }
details.advanced summary:hover { color: var(--text); }
.advanced-hint { font-size: 0.8rem; color: var(--muted); margin: 0.75rem 0 0; }

/* ---------------------------------------------------------------- status -- */

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.28rem 0.7rem;
  border-radius: var(--radius-xs);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border: 1px solid currentColor;
}
.status-pill::before {
  content: "";
  width: 4px; height: 4px;
  border-radius: 0;
  background: currentColor;
  box-shadow: 0 0 6px currentColor;
  flex-shrink: 0;
}
.status-good { background: color-mix(in srgb, var(--good) 14%, transparent); color: var(--good); }
.status-warn { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.status-bad  { background: color-mix(in srgb, var(--bad)  14%, transparent); color: var(--bad);  }

.confidence {
  display: inline-flex;
  align-items: center;
  padding: 0.22rem 0.55rem;
  border-radius: var(--radius-xs);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  border: 1px solid var(--border-strong);
  color: var(--muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: help;
}
.conf-official { border-color: color-mix(in srgb, var(--good) 45%, var(--border)); color: var(--good); }

/* ---------------------------------------------------------------- result -- */

#result:not(:empty) {
  margin-top: 1.25rem;
  scroll-margin-top: 2rem;
}

.result-card {
  animation: result-in var(--dur-slow) var(--ease);
  max-height: min(82vh, 42rem);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) var(--surface);
}

.result-card::-webkit-scrollbar {
  width: 5px;
}
.result-card::-webkit-scrollbar-track {
  background: var(--surface);
}
.result-card::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-xs);
}
.result-card::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}
@keyframes result-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

.result-head { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.9rem; }

.result-headline {
  font-family: var(--font-sans);
  font-size: 1.35rem;
  font-weight: 400;
  letter-spacing: -0.015em;
  margin: 0 0 1.25rem;
  line-height: 1.35;
}

.result-figure { display: flex; align-items: baseline; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 0.35rem; }
.result-number {
  font-family: var(--font-sans);
  font-size: clamp(2rem, 5vw, 2.85rem);
  font-weight: 400;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.result-card[data-tone="good"] .result-number { color: var(--good); }
.result-card[data-tone="warn"] .result-number { color: var(--warn); }
.result-card[data-tone="bad"]  .result-number { color: var(--bad);  }
.result-figure-sub { color: var(--muted); font-size: 0.9rem; }

.limiter { font-size: 0.92rem; color: var(--muted); margin: 1.4rem 0 0; line-height: 1.6; }
.limiter b { color: var(--text); font-weight: 600; }

/* --------------------------------------------------------------- timeline -- */

.timeline {
  position: relative;
  margin: 1.5rem 0 0;
  padding: 1.6rem 0 0.4rem;
}

.timeline-svg { display: block; width: 100%; height: 4.2rem; overflow: visible; }

.tl-track { fill: var(--track); }
.tl-life  { fill: color-mix(in srgb, var(--accent) 12%, transparent); }

.tl-elapsed {
  fill: var(--track-used);
  transition: width var(--dur-slow) var(--ease);
}
.tl-remaining {
  transition: width var(--dur-slow) var(--ease), x var(--dur-slow) var(--ease), fill var(--dur) var(--ease);
}
.timeline[data-tone="good"] .tl-remaining { fill: var(--good-mark); filter: drop-shadow(0 0 3px color-mix(in srgb, var(--good-mark) 60%, transparent)); }
.timeline[data-tone="warn"] .tl-remaining { fill: var(--warn-mark); filter: drop-shadow(0 0 3px color-mix(in srgb, var(--warn-mark) 60%, transparent)); }
.timeline[data-tone="bad"]  .tl-remaining { fill: var(--bad-mark);  filter: drop-shadow(0 0 3px color-mix(in srgb, var(--bad-mark)  60%, transparent)); }

.tl-tick {
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
  transition: x1 var(--dur-slow) var(--ease), x2 var(--dur-slow) var(--ease);
}
.tl-tick-hw  { stroke: var(--accent); filter: drop-shadow(0 0 4px color-mix(in srgb, var(--accent) 60%, transparent)); }
.tl-tick-sec { stroke: var(--accent-2); filter: drop-shadow(0 0 4px color-mix(in srgb, var(--accent-2) 60%, transparent)); }

.tl-now {
  stroke: var(--text);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
  transition: x1 var(--dur-slow) var(--ease), x2 var(--dur-slow) var(--ease);
}

.tl-marker {
  position: absolute;
  top: 0;
  left: var(--at);
  transform: translateX(-50%);
  transition: left var(--dur-slow) var(--ease);
  white-space: nowrap;
}
.tl-marker-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 0.1rem 0.35rem;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.4);
}

.tl-ends { position: relative; height: 2.2rem; }
.tl-end {
  position: absolute;
  top: 0;
  left: var(--at);
  transform: translateX(-50%);
  text-align: center;
  font-size: 0.68rem;
  line-height: 1.25;
  color: var(--faint);
  white-space: nowrap;
  transition: left var(--dur-slow) var(--ease);
}
.tl-end b { display: block; font-size: 0.74rem; font-weight: 600; color: var(--muted); }
.tl-end-start { transform: translateX(0); text-align: left; }
.tl-end.is-limiter b { color: var(--text); }
.tl-end.is-limiter::after {
  content: "";
  display: block;
  width: 100%;
  height: 2px;
  margin-top: 0.2rem;
  border-radius: 0;
  background: currentColor;
  opacity: 0.6;
}
.tl-end-hw.is-stacked { top: 2.1rem; }
.tl-end-hw  { color: var(--accent); }
.tl-end-sec { color: var(--accent-2); }

/* ------------------------------------------------------------------ notes -- */

.note {
  background: var(--note-bg);
  border: 1px solid var(--note-border);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  font-size: 0.9rem;
  margin: 1rem 0 0;
  line-height: 1.55;
}
.note-good { background: var(--good-bg); border-color: var(--good-border); }

.repair-prompt {
  margin-top: 1.4rem;
  padding: 1.15rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.repair-prompt p { margin: 0 0 0.75rem; font-size: 0.92rem; }

.cta-inline {
  display: inline-block;
  padding: 0.65rem 1.2rem;
  border-radius: var(--radius-xs);
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-contrast);
  font-weight: 600;
  font-size: 0.88rem;
  letter-spacing: 0.02em;
  
  transition: transform 120ms var(--ease), box-shadow var(--dur) var(--ease);
}
.cta-inline:hover {
  text-decoration: none;
  transform: translateY(-1px);
  
}

.successors { margin-top: 1.4rem; }
.successors-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 0.5rem;
}
.successor-list { display: flex; flex-wrap: wrap; gap: 0.5rem; list-style: none; margin: 0; padding: 0; }
.successor-list a {
  display: inline-flex;
  align-items: baseline;
  gap: 0.4rem;
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  font-size: 0.82rem;
  color: var(--text);
  background: var(--surface);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.successor-list a:hover {
  border-color: var(--accent);
  
  text-decoration: none;
}
.successor-list em { font-style: normal; color: var(--muted); font-size: 0.75rem; font-family: var(--font-mono); }

.sources { margin-top: 1.4rem; font-size: 0.8rem; color: var(--muted); }
.sources-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 0.35rem;
}
.sources ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.25rem 0.9rem; }
.sources-verified { display: block; margin-top: 0.35rem; color: var(--faint); font-family: var(--font-mono); font-size: 0.72rem; }
.sources-none { font-style: normal; }

.disclaimer { color: var(--muted); font-size: 0.8rem; margin-top: 1.1rem; line-height: 1.5; }

.error-card { border-color: color-mix(in srgb, var(--bad) 40%, var(--border)); }
.error-card h2 { margin-top: 0; font-size: 1.05rem; }

/* ------------------------------------------------------------------ browse -- */

.browse-section {
  max-width: var(--page-wide);
  margin: 3.5rem auto 0;
  padding: 2.5rem 1.5rem 0;
  border-top: 1px solid var(--border);
}
.browse-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.browse-section h2 {
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 1.45rem;
  letter-spacing: -0.015em;
  margin: 0 0 0.35rem;
}
.browse-note { color: var(--muted); font-size: 0.85rem; margin: 0 0 1rem; }
.browse-note b { color: var(--text); font-weight: 600; }

.filter-bar { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; margin-bottom: 0.75rem; }
.search-wrap { position: relative; flex: 1 1 14rem; }
.search-wrap input[type="search"] { padding-right: 2.2rem; }
.search-wrap input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }

.search-clear {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  padding: 0.15rem 0.4rem;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}
.search-clear:hover { color: var(--text); }

.type-tabs { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.type-tab {
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.type-tab:hover { border-color: var(--border-strong); color: var(--text); }
.type-tab[aria-pressed="true"] {
  background: color-mix(in srgb, var(--accent) 15%, var(--surface));
  border-color: var(--accent);
  color: var(--accent);
  
}
.tab-count { opacity: 0.8; font-size: 0.75rem; font-family: var(--font-mono); }

.sort-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.sort-row label { margin: 0; font-weight: 600; font-size: 0.82rem; }
.sort-row select { width: auto; padding: 0.4rem 0.6rem; font-size: 0.82rem; }
.result-count { margin-left: auto; color: var(--faint); font-family: var(--font-mono); font-size: 0.76rem; }

.device-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11.5rem, 1fr));
  gap: 0.85rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.device-cell[hidden] { display: none; }

.device-card {
  display: block;
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem 1.25rem;
  color: var(--text);
  height: 100%;
  transition: transform 160ms var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.device-card:hover {
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px -6px rgba(0, 0, 0, 0.7), 0 0 1px var(--accent);
  border-color: var(--accent);
}

.device-icon {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.45rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.device-icon svg { flex-shrink: 0; }
.device-name { font-weight: 600; font-size: 0.94rem; display: block; line-height: 1.3; }
.device-sub {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  margin-top: 0.45rem;
  display: inline-block;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.device-sub.status-good { color: var(--good); background: none; padding: 0; }
.device-sub.status-warn { color: var(--warn); background: none; padding: 0; }
.device-sub.status-bad  { color: var(--bad);  background: none; padding: 0; }

/* A quiet wear bar: how much of this device's life is already spent. */
.device-bar {
  position: absolute;
  left: 1.1rem; right: 1.1rem; bottom: 0.65rem;
  height: 2px;
  background: var(--track);
  overflow: hidden;
  display: block;
}
.device-bar i {
  display: block;
  height: 100%;
  width: var(--fill);
  background: var(--track-used);
  transition: width var(--dur-slow) var(--ease);
}
.device-card:has(.status-good) .device-bar i { background: var(--good-mark); box-shadow: 0 0 4px var(--good-mark); }
.device-card:has(.status-warn) .device-bar i { background: var(--warn-mark); box-shadow: 0 0 4px var(--warn-mark); }
.device-card:has(.status-bad)  .device-bar i { background: var(--bad-mark);  box-shadow: 0 0 4px var(--bad-mark);  }

.no-results { color: var(--muted); font-size: 0.9rem; padding: 1.5rem 0; font-family: var(--font-mono); }

/* ----------------------------------------------------------------- guides -- */

.content-card h2 {
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 1.25rem;
  letter-spacing: -0.012em;
  margin: 1.75rem 0 0.5rem;
}
.content-card h2:first-child { margin-top: 0; }
.content-card h3 {
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 1.08rem;
  margin: 1.35rem 0 0.4rem;
}
.content-card ul { padding-left: 1.2rem; }
.content-card li { margin-bottom: 0.4rem; line-height: 1.6; }
.content-card table { width: 100%; border-collapse: collapse; font-size: 0.88rem; margin: 0.75rem 0; }
.content-card th, .content-card td { text-align: left; padding: 0.55rem 0.65rem; border-bottom: 1px solid var(--border); }
.content-card th {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--faint);
}
.table-scroll { overflow-x: auto; }

.calc-panel {
  margin: 1.25rem 0;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.calc-panel h3 { margin-top: 0; }
.verdict {
  margin-top: 1.1rem;
  padding: 1rem;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.95rem;
  max-height: min(82vh, 32rem);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) var(--surface);
}
.verdict::-webkit-scrollbar {
  width: 5px;
}
.verdict::-webkit-scrollbar-track {
  background: var(--surface);
}
.verdict::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-xs);
}
.verdict::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}
.verdict[data-verdict="repair"]  { border-color: color-mix(in srgb, var(--good) 45%, var(--border)); }
.verdict[data-verdict="replace"] { border-color: color-mix(in srgb, var(--warn) 45%, var(--border)); }
/* "No repair helps" is the most consequential thing this page ever says, so it
 * does not get the neutral fallback border the other states would leave it. */
.verdict[data-verdict="no-repair-helps"] { border-color: color-mix(in srgb, var(--bad) 45%, var(--border)); }
.verdict b { font-weight: 700; }
.verdict-math {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.verdict-math span b { display: block; color: var(--text); font-size: 1.05rem; }

.verdict-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.9rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}
.verdict-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.8rem;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.verdict-btn:hover {
  border-color: var(--accent);
  color: var(--text);
  text-decoration: none;
  
}

.affiliate-note {
  font-size: 0.78rem;
  color: var(--faint);
  margin: 0.6rem 0 0;
  line-height: 1.5;
}

/* ------------------------------------------------------------- crosslinks -- */

.crosslinks { margin-top: 2.5rem; }
.crosslinks h2 {
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 1.15rem;
  margin-bottom: 0.75rem;
}
.crosslinks ul {
  list-style: none;
  padding: 0;
  margin: 0 0 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.crosslinks li a {
  display: inline-block;
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  font-size: 0.82rem;
  color: var(--text);
  background: var(--surface);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.crosslinks li a:hover {
  border-color: var(--accent);
  
  text-decoration: none;
}

/* ----------------------------------------------------------------- footer -- */

footer {
  max-width: var(--page);
  margin: 2.5rem auto 0;
  padding: 1.5rem 1.5rem 3.5rem;
  text-align: center;
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
}
footer a { color: var(--muted); }
footer a:hover { color: var(--accent); }
footer .disclaimer { margin-top: 0.9rem; }

.back-to-top {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(0.5rem);
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease), border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  z-index: 15;
}
.back-to-top.visible { opacity: 1; pointer-events: auto; transform: none; }
.back-to-top:hover {
  border-color: var(--accent);
  color: var(--accent);
  
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* -------------------------------------------------------- reduced motion --
 *
 * One place, covering everything above. Motion here carries meaning, so when it
 * is switched off the states still change - they just change instantly.
 */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .device-card:hover, .btn-primary:hover, .cta-inline:hover { transform: none; }
  .device-image:hover img { transform: none; }
}

@media (max-width: 32rem) {
  .site-nav { padding: 0.75rem 1rem; }
  .nav-links { gap: 0.85rem; font-size: 0.85rem; }
  main, .browse-section { padding-left: 1rem; padding-right: 1rem; }
  .card { padding: 1.25rem; }
  .device-grid { grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); }
  .tl-end { font-size: 0.62rem; }
}

/* ---------------------------------------------------------- battery health --
 *
 * The input is part of the form proper, not an optional extra behind a
 * disclosure. It used to live in a collapsed <details>, which hid the one
 * number that decides between a cheap part and a new device.
 */
[hidden] { display: none !important; }

.battery-block {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.battery-block .field-label { display: block; }
.battery-lede {
  margin: 0.15rem 0 0.75rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.battery-block .field-row { margin-top: 0.25rem; }
.battery-howto-line { display: block; }
.battery-howto-line + .battery-howto-line { margin-top: 0.3rem; }

/* --------------------------------------------------------- battery verdict -- */

.battery-card { margin-top: 1.25rem; }
.battery-card[data-outcome="new-battery"] { border-color: color-mix(in srgb, var(--good) 45%, var(--border)); }
.battery-card[data-outcome="new-device"]  { border-color: color-mix(in srgb, var(--bad) 45%, var(--border)); }
.battery-card[data-outcome="keep"]        { border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }

.battery-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 0.6rem;
}
.battery-pill {
  display: inline-block;
  padding: 0.22rem 0.6rem;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.battery-pill.outcome-new-battery { color: var(--good); border-color: color-mix(in srgb, var(--good) 45%, var(--border)); }
.battery-pill.outcome-new-device  { color: var(--bad);  border-color: color-mix(in srgb, var(--bad) 45%, var(--border)); }
.battery-pill.outcome-keep        { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.battery-pill.outcome-needs-health { color: var(--muted); }
.battery-reading {
  font-size: 0.8rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.battery-headline {
  margin: 0 0 0.4rem;
  font-size: clamp(1.1rem, 2.6vw, 1.4rem);
  font-weight: 600;
  line-height: 1.25;
}
.battery-reason {
  margin: 0;
  font-size: 0.92rem;
  color: var(--muted);
}

.battery-math {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-top: 0.9rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.battery-math span b { display: block; color: var(--text); font-size: 1.02rem; font-weight: 600; }

.battery-steps-title {
  margin: 1.1rem 0 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
}
.battery-steps {
  margin: 0;
  padding-left: 1.2rem;
  font-size: 0.92rem;
  line-height: 1.55;
}
.battery-steps li { margin-bottom: 0.55rem; }
.battery-steps li:last-child { margin-bottom: 0; }
.battery-steps li::marker { color: var(--accent); font-weight: 700; }

/* Device Image Styles */
.device-image {
  text-align: center;
  margin: 1.5rem 10%;
  padding: 1rem;
  background: var(--surface-2);
  border-radius: var(--radius-xs);
  box-shadow: var(--shadow);
}
.device-image img {
  max-width: 100%;
  max-height: 200px;
  object-fit: contain;
  border-radius: var(--radius-xs);
  background: #ffffff;
}
[data-theme='dark'] .device-image img {
  padding: 8px;
}


/* --- Premium Animations --- */
.card, .content-card, .result-card {
  animation: card-appear 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes card-appear {
  0% { opacity: 0; transform: translateY(16px); }
  100% { opacity: 1; transform: translateY(0); }
}

.device-grid > li {
  animation: card-appear 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.device-grid > li:nth-child(1) { animation-delay: 0.05s; }
.device-grid > li:nth-child(2) { animation-delay: 0.10s; }
.device-grid > li:nth-child(3) { animation-delay: 0.15s; }
.device-grid > li:nth-child(4) { animation-delay: 0.20s; }
.device-grid > li:nth-child(5) { animation-delay: 0.25s; }
.device-grid > li:nth-child(6) { animation-delay: 0.30s; }
.device-grid > li:nth-child(n+7) { animation-delay: 0.35s; }

/* Timeline animations */
.tl-elapsed, .tl-remaining, .tl-life {
  animation: tl-grow 0.9s cubic-bezier(0.16, 1, 0.3, 1) both;
  transform-origin: left;
}

@keyframes tl-grow {
  0% { transform: scaleX(0); opacity: 0; }
  100% { transform: scaleX(1); opacity: 1; }
}

.tl-tick {
  animation: tl-fade 0.8s ease-out 0.4s both;
}

.tl-marker {
  animation: tl-drop 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.5s both;
}

.tl-end {
  animation: tl-fade-up 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.5s both;
}

@keyframes tl-fade {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

@keyframes tl-drop {
  0% { opacity: 0; transform: translate(-50%, -10px); }
  100% { opacity: 1; transform: translate(-50%, 0); }
}

@keyframes tl-fade-up {
  0% { opacity: 0; transform: translate(-50%, 6px); }
  100% { opacity: 1; transform: translate(-50%, 0); }
}

/* Device Image hover animation */
.device-image img {
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.device-image:hover img {
  transform: scale(1.05) translateY(-2px);
}

/* ------------------------------------------------------------ calculator --
 *
 * Two columns on a wide screen: the form, and a preview of whatever device is
 * currently selected. The preview is an aside because it restates the form's
 * state rather than adding anything; a screen reader reaching it has already
 * been told which model is chosen.
 */
.calculator-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 18rem;
  gap: 1.5rem;
  align-items: start;
}
.calculator-main { min-width: 0; }

.device-preview {
  position: sticky;
  top: 1.5rem;
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  text-align: center;
}
.device-preview-frame {
  display: flex;
  align-items: center;
  justify-content: center;
  /* Reserved before anything loads, so swapping models does not jump the page. */
  min-height: 11rem;
}
.device-preview-frame img {
  max-width: 100%;
  max-height: 10rem;
  object-fit: contain;
  opacity: 0;
  transition: opacity var(--dur) var(--ease);
}
.device-preview-frame img.is-loaded { opacity: 1; }
.device-preview-name {
  margin: 0.75rem 0 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}
.device-preview-hint {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  color: var(--faint);
}
/* The hint is only useful while nothing is picked. */
.device-preview:has(.device-preview-name:not(:empty)) .device-preview-hint { display: none; }

/* --------------------------------------------------------- visual picker --
 *
 * Buttons that drive the three native selects, which stay in the DOM as the
 * source of truth. Styled to match .type-tab, which is the same idea already.
 */
.visual-selector { display: flex; flex-direction: column; gap: 1.25rem; margin-bottom: 1.5rem; }
.visual-step { display: flex; flex-direction: column; gap: 0.5rem; }
.visual-step-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--faint);
}
.visual-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(6.5rem, 1fr));
  gap: 0.5rem;
}
.visual-grid-models { grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); }
.visual-btn {
  padding: 0.55rem 0.5rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.visual-btn:hover { border-color: var(--border-strong); }
.visual-btn[aria-pressed='true'] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
  font-weight: 600;
}
/* Focus must stay visible on the pressed button too, where an accent-coloured
 * ring would otherwise sit on an accent-coloured background. */
.visual-btn:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

/* ------------------------------------------------------------ cta block -- */

.cta-block {
  margin: 2.5rem auto 0;
  padding: 1.75rem;
  max-width: 44rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-xs);
  text-align: center;
}
.cta-block h2 { margin: 0 0 0.5rem; font-size: 1.25rem; }
.cta-block p { margin: 0 auto; max-width: 34rem; color: var(--muted); }
.btn-cta {
  display: inline-block;
  width: auto;
  min-width: 14rem;
  padding: 0.85rem 2rem;
  text-decoration: none;
  text-align: center;
}

.footer-legal { font-size: 0.85rem; }

/* ------------------------------------------------------------ responsive --
 *
 * The site had one layout breakpoint, at 32rem, so everything between a phone
 * and a desktop got the desktop grid. These fill that gap.
 */

/* Tablet and small laptop: the preview stops being a second column. */
@media (max-width: 60rem) {
  .calculator-layout { grid-template-columns: minmax(0, 1fr); }
  .device-preview { position: static; }
  .device-preview-frame { min-height: 8rem; }
}

@media (max-width: 48rem) {
  .nav-links { flex-wrap: wrap; }
  .field-row, .field-row-3 { grid-template-columns: minmax(0, 1fr); }
  .table-scroll { overflow-x: auto; }
  .cta-block { padding: 1.25rem; }
  .visual-grid { grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr)); }
  .visual-grid-models { grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr)); }
}

@media (max-width: 32rem) {
  .btn-cta { width: 100%; min-width: 0; }
  .device-preview { padding: 1rem; }
  /* A tap target under about 44px is the commonest mobile failure there is.
   * The footer links are exempt under WCAG 2.5.8 as inline text, but they are
   * 16px tall and sit next to each other, so padding them out costs nothing. */
  .visual-btn, .type-tab, .usage-pill { min-height: 2.75rem; }
  .footer-legal { line-height: 1.9; }
  .footer-legal a { display: inline-block; padding: 0.5rem 0.25rem; }
  .back-to-top { width: 2.75rem; height: 2.75rem; }
}

@media (max-width: 26rem) {
  .visual-grid, .visual-grid-models { grid-template-columns: repeat(auto-fill, minmax(4.5rem, 1fr)); }
  .stats-strip { flex-wrap: wrap; }
}
