/* =====================================================================
   Battery Health Checker — components.css
   Colors live in design-system.css. This file is layout/components only.
   ===================================================================== */

/* ---------- 0. Component-only variables ---------- */
:root {
  --trust-width: 960px;
  --trust-num-1: var(--s0);
  --trust-num-2: var(--s1);
  --trust-num-3: var(--s4);
  --trust-num-4: var(--s6);
  --btn-sm-color: var(--accent-primary);
}
:root[data-theme="dark"] {
  --btn-sm-color: var(--accent-primary);
}


/* ---------- 1. Header, theme toggle ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  height: var(--header-height);
  display: flex; align-items: center;
  background: var(--header-bg);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border-bottom: 1px solid var(--border);
}
.site-header .container { display: flex; align-items: center; justify-content: space-between; gap: var(--space-5); }
.logo { display: flex; align-items: center; gap: var(--space-2); font-weight: 800; font-size: var(--fs-base); letter-spacing: -0.01em; flex-shrink: 1; min-width: 0; line-height: 1.15; color: var(--text-primary); }
@media (min-width: 981px) {
  .logo { font-size: var(--fs-lg); flex-shrink: 0; }
}
.logo-mark {
  width: 40px; height: 24px; border-radius: 0;
  background: none;
  display: grid; place-items: center; flex-shrink: 0;
  box-shadow: none;
  color: var(--tool-text, var(--text-primary));
}
.logo-mark svg { display: block; width: 40px; height: 24px; }
.logo-mark .logo-bat-shell { fill: var(--bg-secondary); stroke: currentColor; }
.logo-mark .logo-bat-fill { fill: #19d132; }
.logo-mark .logo-bat-cap { fill: currentColor; }
.nav-links { display: flex; align-items: center; gap: var(--space-5); font-size: var(--fs-sm); font-weight: 600; }
.nav-links a { color: var(--text-secondary); transition: color var(--duration-fast) var(--ease-out); white-space: nowrap; }
.nav-links a:hover, .nav-links a.active { color: var(--accent-primary); }
.nav-actions { display: flex; align-items: center; gap: var(--space-3); }
.nav-toggle { display: none; background: none; border: none; cursor: pointer; padding: var(--space-2); color: var(--text-primary); }
@media (max-width: 980px) {
  .nav-links { position: absolute; top: var(--header-height); left: 0; right: 0; flex-direction: column; align-items: flex-start; gap: 0; background: var(--bg-primary); border-bottom: 1px solid var(--border); padding: 0 var(--space-6); max-height: 0; overflow: hidden; transition: max-height var(--duration-base) var(--ease-out); }
  .nav-links.nav-open { max-height: 480px; padding-block: var(--space-4); }
  .nav-links a { padding-block: var(--space-3); width: 100%; }
  .nav-toggle { display: block; }
}

/* Theme toggle — icon switch, top-right of header */
.theme-toggle {
  position: relative; width: 44px; height: 44px; border-radius: 50%;
  background: var(--bg-card); border: 1px solid var(--border);
  cursor: pointer; flex-shrink: 0; display: grid; place-items: center;
  transition: background var(--duration-base) var(--ease-out), border-color var(--duration-base) var(--ease-out), transform var(--duration-fast) var(--ease-out);
  color: var(--text-primary);
}
.theme-toggle:hover { border-color: var(--accent-primary); transform: translateY(-1px); }
.theme-toggle svg { width: 19px; height: 19px; }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

/* ---------- 2. Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  padding: 0.8rem 1.6rem; border-radius: var(--radius-button);
  font-size: var(--fs-sm); font-weight: 700; border: 1px solid transparent; cursor: pointer;
  transition: transform var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out),
              background var(--duration-fast) var(--ease-out), border-color var(--duration-fast) var(--ease-out), filter var(--duration-fast) var(--ease-out);
  white-space: nowrap;
}
.btn-primary { background: var(--accent-primary); color: var(--on-accent); box-shadow: var(--shadow-md); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: var(--shadow-glow-blue); filter: brightness(1.08); }
.btn-primary:active { transform: translateY(0); }
.btn-secondary { background: var(--bg-card); color: var(--text-primary); border-color: var(--border); }
.btn-secondary:hover { border-color: var(--accent-primary); color: var(--accent-primary); background: var(--bg-card-hover); transform: translateY(-1px); }
.btn-sm { padding: 0.55rem 1.1rem; font-size: var(--fs-xs); }
.btn-lg { padding: 1rem 2.1rem; font-size: var(--fs-base); }
/* "All Tools" button: no fill, nav-link text color, 1px border; colored glow on hover.
   Color is --btn-sm-color in section 0. */
.btn.btn-sm{background:transparent;color:var(--text-secondary);border:1px solid var(--btn-sm-color);box-shadow:none}
.btn.btn-sm:hover{box-shadow:0 10px 24px -6px color-mix(in srgb,var(--btn-sm-color) 60%,transparent)}


/* ---------- 3. Cards, tool cards ---------- */
.card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-card);
  padding: var(--space-5);
  transition: transform var(--duration-base) var(--ease-out), box-shadow var(--duration-base) var(--ease-out), border-color var(--duration-base) var(--ease-out);
}
.card-interactive:hover { transform: translateY(-5px); border-color: var(--accent-primary); box-shadow: var(--shadow-lg); }
.panel { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-panel); padding: var(--space-6); box-shadow: var(--shadow-md); }

.tool-card { display: flex; flex-direction: column; gap: var(--space-3); }
.tool-card-icon {
  width: 46px; height: 46px; border-radius: var(--radius-input);
  background: rgba(11,95,255,0.10); border: 1px solid rgba(11,95,255,0.22);
  display: grid; place-items: center; color: var(--accent-primary); font-size: 21px;
}
.tool-card h4 { font-size: var(--fs-base); }
.tool-card p { font-size: var(--fs-sm); margin: 0; }
.tool-card .tool-link { margin-top: auto; font-size: var(--fs-sm); font-weight: 700; color: var(--accent-primary); display: inline-flex; align-items: center; gap: var(--space-1); }

/* Homepage tool cards (phone-manager style): white card, solid round icon.
   Each card gets its icon color from --tc-solid; colors cycle in page order. */
#categories a.card.tool-card{
  --tc-solid:var(--s0);
  background:var(--bg-card);border:1px solid transparent;border-radius:24px;
  padding:22px 20px 20px;gap:6px;box-shadow:0 1px 2px rgba(16,24,40,.04);
  transition:transform .2s ease,box-shadow .2s ease,border-color .2s ease;
}
#categories a.card.tool-card:hover,#categories a.card.tool-card:focus-visible{
  outline:none;border-color:var(--tc-solid);transform:translateY(-3px);
  box-shadow:0 14px 28px -12px color-mix(in srgb,var(--tc-solid) 50%,transparent);
}
#categories a.card.tool-card .tool-card-icon{
  width:52px;height:52px;border-radius:50%;border:0;margin-bottom:10px;
  background:var(--tc-solid);color:#fff;
  box-shadow:0 6px 14px -6px color-mix(in srgb,var(--tc-solid) 70%,transparent);
}
#categories a.card.tool-card .tool-card-icon svg{width:24px;height:24px;stroke:#fff}
#categories a.card.tool-card h4{font-size:1.125rem;font-weight:500;letter-spacing:-.01em;color:var(--text-primary)}
#categories a.card.tool-card p{font-size:.9rem;color:var(--text-secondary)}
#categories a.card.tool-card .tool-link{margin-top:8px;font-weight:600;color:var(--tc-solid)}
/* Icon colors keyed by category id so inserting a section (e.g. Battery) does not shift the sequence */
/* Palette cycles s0→s7 in homepage card order; Battery sits after Monitor, before Network */
#categories #cpu-testing .tool-card:nth-child(1),
#categories #mouse-tester .tool-card:nth-child(1),
#categories #monitor-testing .tool-card:nth-child(2){--tc-solid:var(--s0)}  /* amber */
#categories #gpu-testing .tool-card:nth-child(1),
#categories #mouse-tester .tool-card:nth-child(2),
#categories #monitor-testing .tool-card:nth-child(3){--tc-solid:var(--s1)}  /* green */
#categories #gpu-testing .tool-card:nth-child(2),
#categories #mouse-tester .tool-card:nth-child(3),
#categories #battery-testing .tool-card:nth-child(1){--tc-solid:var(--s2)}  /* blue */
#categories #gamepad-tester .tool-card:nth-child(1),
#categories #mouse-tester .tool-card:nth-child(4),
#categories #network-testing .tool-card:nth-child(1){--tc-solid:var(--s3)}  /* red */
#categories #keyboard-tester .tool-card:nth-child(1),
#categories #speaker-tester .tool-card:nth-child(1),
#categories #network-testing .tool-card:nth-child(2){--tc-solid:var(--s4)}  /* purple */
#categories #keyboard-tester .tool-card:nth-child(2),
#categories #touch-screen-tester .tool-card:nth-child(1){--tc-solid:var(--s5)}  /* teal */
#categories #keyboard-tester .tool-card:nth-child(3),
#categories #webcam-tester .tool-card:nth-child(1){--tc-solid:var(--s6)}  /* orange */
#categories #mic-tester .tool-card:nth-child(1),
#categories #monitor-testing .tool-card:nth-child(1){--tc-solid:var(--s7)}  /* pink */


/* ---------- 4. Sections, grids, footer, language switcher ---------- */
.section-head { max-width: 900px; margin-bottom: var(--space-7); }
.section-head.center { margin-inline: auto; text-align: center; }
.section-head h2 { margin-top: var(--space-2); }
.section-head h1 { margin-top: var(--space-2); }

/* Homepage SEO content (intro + FAQ) */
.home-intro,
.home-faq {
  padding-block: var(--space-8);
  border-top: 1px solid var(--border);
}
.home-intro .home-panel {
  margin-top: 0;
}
.home-faq { padding-bottom: var(--space-9); }
.category-intro {
  margin: calc(var(--space-3) * -1) 0 var(--space-5);
  max-width: 720px;
  color: var(--text-secondary);
  font-size: var(--fs-sm);
}

/* Homepage feature + compatibility panels */
.home-panel {
  --home-teal: var(--accent-secondary);
  position: relative;
  margin-top: var(--space-6);
  padding: var(--space-7) var(--space-5) var(--space-6);
  background: var(--bg-card);
  border: 1.5px solid var(--home-teal);
  border-radius: var(--radius-panel);
}
.home-panel--compat {
  padding-block: var(--space-6) var(--space-5);
}
.home-panel-title {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: max-content;
  max-width: calc(100% - var(--space-6));
  font-size: var(--fs-lg);
  font-weight: 800;
  text-align: center;
  color: var(--text-primary);
  background: var(--bg-primary);
  padding-inline: var(--space-3);
  white-space: nowrap;
}
.home-panel-title::before,
.home-panel-title::after {
  content: "";
  width: 28px;
  height: 1.5px;
  flex-shrink: 0;
  background: var(--home-teal);
}
.home-panel-title span { display: block; }

.home-feature-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: var(--space-5) var(--space-4);
}
.home-feature {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
}
.home-feature-icon {
  color: var(--home-teal);
  display: grid;
  place-items: center;
  margin-bottom: var(--space-1);
}
.home-feature-icon svg {
  width: 40px;
  height: 40px;
}
.home-feature h3 {
  margin: 0;
  font-size: var(--fs-base);
  font-weight: 800;
  color: var(--text-primary);
}
.home-feature p {
  margin: 0;
  font-size: var(--fs-sm);
  line-height: var(--lh-relaxed);
  color: var(--text-secondary);
  max-width: 28ch;
}

.home-compat-section {
  padding-block: var(--space-9);
}
.home-compat-section .home-panel {
  margin-top: 0;
}
.home-compat {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: var(--space-5);
}
.home-compat-group {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: center;
  gap: var(--space-5) var(--space-6);
}
.home-compat-divider {
  width: 1px;
  align-self: stretch;
  min-height: 40px;
  background: var(--border-strong);
  flex-shrink: 0;
}
.home-compat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  min-width: 56px;
}
.home-compat-item > span:last-child {
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text-secondary);
}
.home-compat-logo {
  display: block;
}
.home-compat-logo img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  display: block;
}

@media (max-width: 1100px) {
  .home-feature-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .home-panel { padding-inline: var(--space-4); }
  .home-panel-title {
    font-size: var(--fs-base);
    white-space: normal;
    text-wrap: balance;
  }
  .home-panel-title::before,
  .home-panel-title::after { width: 20px; }
  .home-feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-5); }
  .home-compat {
    flex-direction: column;
    flex-wrap: wrap;
    gap: var(--space-5);
  }
  .home-compat-divider { display: none; }
  .home-compat-group {
    flex-wrap: wrap;
    gap: var(--space-4) var(--space-5);
  }
}
@media (max-width: 420px) {
  .home-feature-grid { grid-template-columns: 1fr; }
}

#categories { padding-top: var(--space-7); }
.category-section { margin-bottom: var(--space-8); scroll-margin-top: calc(var(--header-height) + var(--space-4)); }
.category-section:last-child { margin-bottom: 0; }
.category-section-title { display: flex; align-items: center; gap: var(--space-3); font-size: var(--fs-xl); margin-bottom: var(--space-5); color: var(--accent-primary); }
.category-section-title svg { flex-shrink: 0; color: var(--accent-primary); }
.category-section-title span { color: var(--text-primary); }

.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-5); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-4); }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-5); }
@media (max-width: 960px) { .grid-3 { grid-template-columns: repeat(2, 1fr); } .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .grid-3, .grid-4, .grid-2 { grid-template-columns: 1fr; } }

.site-footer {
  border-top: 1px solid var(--border-strong);
  padding-top: var(--space-7);
  padding-bottom: 0;
  background: var(--bg-footer);
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-6);
  margin-bottom: 0;
  padding-bottom: var(--space-6);
  align-items: center;
}
.footer-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-width: 0;
  height: 100%;
}
.footer-col h5 {
  font-size: var(--fs-sm);
  margin-bottom: var(--space-3);
  color: var(--text-primary);
}
.footer-col > a:not(.logo) {
  display: block;
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  padding-block: var(--space-1);
  transition: color var(--duration-fast);
}
.footer-col > a:not(.logo):hover { color: var(--accent-primary); }
.site-footer .logo {
  justify-content: center;
  margin-inline: auto;
}
.site-footer .footer-col > p {
  max-width: 28rem;
  margin-inline: auto;
  margin-top: var(--space-3);
  font-size: var(--fs-sm);
  color: var(--text-secondary);
}
.footer-company-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  column-gap: var(--space-4);
  row-gap: var(--space-2);
  width: 100%;
  max-width: 360px;
}
.footer-company-links a {
  box-sizing: border-box;
  flex: 0 0 calc((100% - (2 * var(--space-4))) / 3);
  display: block;
  text-align: center;
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  padding-block: var(--space-1);
  transition: color var(--duration-fast);
  white-space: nowrap;
}
.footer-company-links a:hover { color: var(--accent-primary); }
.footer-bottom {
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding-block: var(--space-5);
  border-top: 1px solid var(--border-strong);
  font-size: var(--fs-xs);
  color: var(--text-muted);
}
@media (max-width: 860px) {
  .footer-grid { grid-template-columns: 1fr; gap: var(--space-7); }
  .footer-company-links { max-width: 320px; }
}

/* ---- footer social icons ---- */
.footer-social {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--space-3);
}
.footer-social a {
  --social-color: var(--text-secondary);
  --social-glow: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--social-color);
  transition:
    background var(--duration-fast) var(--ease-out),
    color var(--duration-fast) var(--ease-out),
    border-color var(--duration-fast) var(--ease-out),
    box-shadow var(--duration-base) var(--ease-out),
    transform var(--duration-fast) var(--ease-out);
  padding: 0;
}
.footer-social a:hover {
  background: var(--social-color);
  border-color: var(--social-color);
  color: #fff;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--social-color) 35%, transparent),
              0 0 22px var(--social-glow);
  transform: translateY(-2px);
}
.footer-social a svg { width: 17px; height: 17px; flex-shrink: 0; }
.footer-social a.footer-social--fill svg { fill: currentColor; stroke: none; }

.footer-social a.footer-social--facebook { --social-color: #1877F2; --social-glow: rgba(24, 119, 242, 0.55); }
.footer-social a.footer-social--x { --social-color: #0F1419; --social-glow: rgba(15, 20, 25, 0.4); }
.footer-social a.footer-social--youtube { --social-color: #FF0000; --social-glow: rgba(255, 0, 0, 0.5); }
.footer-social a.footer-social--instagram { --social-color: #E4405F; --social-glow: rgba(228, 64, 95, 0.5); }
.footer-social a.footer-social--pinterest { --social-color: #E60023; --social-glow: rgba(230, 0, 35, 0.5); }

:root[data-theme="dark"] .footer-social a.footer-social--x {
  --social-color: #FFFFFF;
  --social-glow: rgba(255, 255, 255, 0.35);
}
:root[data-theme="dark"] .footer-social a.footer-social--x:hover {
  color: #0F1419;
}

/* ---- Header language switcher ---- */
#headerLangSwitch { display: flex; align-items: center; }
.lang-switch { position: relative; display: inline-block; }
.lang-switch-btn {
  display: inline-flex; align-items: center; gap: var(--space-2);
  padding: 8px 12px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-button); font-size: var(--fs-sm); font-family: inherit;
  color: var(--text-secondary); cursor: pointer; transition: background var(--duration-fast), border-color var(--duration-fast);
}
.lang-switch-btn:hover { background: var(--bg-card-hover); border-color: var(--border-strong); }
.lang-switch-btn svg { flex-shrink: 0; color: var(--text-muted); }
.lang-switch-flag { font-size: 1rem; line-height: 1; }
.lang-switch-code { font-weight: 700; letter-spacing: 0.02em; }
.lang-switch-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  left: auto;
  transform: none;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-card);
  box-shadow: var(--shadow-lg); padding: var(--space-3); z-index: 120;
  width: max-content; min-width: 220px; max-width: 320px;
  display: none;
}
.lang-switch.open .lang-switch-panel { display: block; }
.lang-switch-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px; }
.lang-switch-option {
  display: flex; align-items: center; gap: var(--space-2);
  padding: 8px 10px; border-radius: var(--radius-input); border: none; background: transparent;
  font-size: var(--fs-sm); font-family: inherit; color: var(--text-secondary); text-align: left;
  cursor: pointer; transition: background var(--duration-fast), color var(--duration-fast);
  text-decoration: none;
}
.lang-switch-option:hover { background: var(--bg-secondary); }
.lang-switch-option.current { background: var(--bg-secondary); color: var(--text-primary); font-weight: 700; }
.lang-switch-option .lang-switch-flag { font-size: 1.05rem; }
.lang-switch-option-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lang-switch-check { color: var(--success); font-size: var(--fs-xs); flex-shrink: 0; }

/* ---------- 5. Hero, trust bar, Quick CPS test ---------- */
.hero { position: relative; overflow: hidden; padding-block: var(--space-8) 48px; }
.hero::before { content: ""; position: absolute; inset: 0; background: var(--gradient-glow); pointer-events: none; }
.hero-content { position: relative; max-width: 900px; }
.hero h1 { margin-bottom: var(--space-4); }
.hero p.lead { font-size: var(--fs-lg); margin-bottom: var(--space-6); }
.hero-actions { display: flex; gap: var(--space-3); flex-wrap: wrap; }

.breadcrumb { color: var(--text-muted); font-size: var(--fs-sm); padding-top: var(--space-5); display: flex; gap: 6px; flex-wrap: wrap; }
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--accent-primary); }

.trust-bar { display: flex; justify-content: center; gap: var(--space-7); flex-wrap: wrap; padding-block: var(--space-6); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.trust-stat .stat-value { font-size: var(--fs-2xl); font-weight: 700; }
.trust-stat .stat-label { font-size: var(--fs-sm); color: var(--text-secondary); }

/* Trust stack: rounded tinted chips on top, Quick CPS card below.
   HTML: <div class="trust-split"> wraps .trust-bar and #home-cps-widget. */
.trust-split{
  max-width:var(--trust-width);margin-inline:auto;padding-block:8px 16px;
  display:grid;grid-template-columns:minmax(0,1fr);gap:var(--space-6);align-items:stretch;
}
.trust-split .trust-bar{
  display:flex;flex-wrap:wrap;justify-content:center;align-items:stretch;gap:12px;
  padding:0;border:0;
}
.trust-split .trust-stat{
  flex:1 1 140px;padding:14px 18px;text-align:center;border-radius:16px;
  background:color-mix(in srgb,var(--trust-tint) 14%,var(--bg-card));
  border:1px solid color-mix(in srgb,var(--trust-tint) 30%,transparent);
  transition:transform .2s ease,box-shadow .2s ease;
}
.trust-split .trust-stat:hover{transform:translateY(-2px)}
.trust-split .trust-stat .stat-value{font-size:var(--fs-2xl);font-weight:800;line-height:1.1}
.trust-split .trust-stat .stat-label{
  margin-top:2px;font-size:11px;font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--text-secondary);
}
.trust-split .trust-stat:nth-child(1){--trust-tint:var(--s0)}
.trust-split .trust-stat:nth-child(2){--trust-tint:var(--s1)}
.trust-split .trust-stat:nth-child(3){--trust-tint:var(--s4)}
.trust-split .trust-stat:nth-child(4){--trust-tint:var(--s7)}
.trust-split .trust-stat:nth-child(1) .stat-value{color:var(--trust-num-1)}
.trust-split .trust-stat:nth-child(2) .stat-value{color:var(--trust-num-2)}
.trust-split .trust-stat:nth-child(3) .stat-value{color:var(--trust-num-3)}
.trust-split .trust-stat:nth-child(4) .stat-value{color:var(--trust-num-4)}
@media (max-width:900px){.trust-split{gap:var(--space-5)}}

/* Quick CPS test widget (homepage). Single source of truth - no inline <style> needed.
   Left stack (title+duration+Now+Clicks) matches click-pad height via pad spanning both rows. */
#home-cps-widget{
  display:grid;align-items:stretch;width:100%;gap:10px;padding:16px;
  grid-template-columns:minmax(160px,200px) minmax(0,1fr);
  grid-template-rows:auto minmax(0,1fr) auto;
  grid-template-areas:"title pad" "stats pad" "footer footer";
  background:var(--bg-card);border:1px solid var(--border);border-radius:0;
  box-shadow:0 2px 10px -4px rgba(0,0,0,.12);
}
:root[data-theme="dark"] #home-cps-widget{box-shadow:0 6px 24px -8px rgba(0,0,0,.6)}

/* header: title, then 5s/10s underneath */
#hcps-title-wrap{grid-area:title;display:flex;flex-direction:column;align-items:flex-start;gap:8px;width:100%}
#hcps-title{display:inline-flex;align-items:center;font-weight:800;font-size:14px;color:var(--text-primary);white-space:nowrap}
#hcps-title::before{
  content:"";width:10px;height:10px;border-radius:50%;margin-right:8px;
  background:var(--hcps-accent);box-shadow:0 0 0 4px color-mix(in srgb,var(--hcps-accent) 35%,transparent);
}
#hcps-duration{display:flex;gap:2px;padding:2px;background:var(--bg-secondary);border:1px solid var(--border);border-radius:10px}
.hcps-dur-btn{
  cursor:pointer;border:none;background:transparent;color:var(--text-secondary);
  font-size:12px;font-weight:700;font-family:inherit;padding:4px 10px;border-radius:8px;
  transition:background .15s ease,color .15s ease;
}
.hcps-dur-btn:not(.selected):not(:disabled):hover{color:var(--text-primary);background:color-mix(in srgb,var(--hcps-accent) 25%,transparent)}
.hcps-dur-btn.selected{background:var(--hcps-accent);color:#14192b}
.hcps-dur-btn:disabled{opacity:.5;cursor:not-allowed}

/* Now / Clicks — fill leftover left height; label + value horizontal */
#hcps-stats{grid-area:stats;display:grid;grid-template-columns:1fr;grid-template-rows:1fr 1fr;gap:10px;width:100%;min-height:0;height:100%;align-self:stretch}
.hcps-stat{
  min-width:0;min-height:0;padding:10px 14px;display:flex;flex-direction:row;align-items:center;justify-content:space-between;gap:10px;text-align:left;
  background:var(--bg-card);border:2px solid var(--hcps-border);border-radius:14px;
}
.hcps-stat:nth-child(1){--hcps-border:var(--hcps-now-border)}
.hcps-stat:nth-child(2){--hcps-border:var(--hcps-clicks-border)}
.hcps-stat-label{font-size:10px;text-transform:uppercase;letter-spacing:.1em;font-weight:700;color:var(--text-secondary);margin:0;flex-shrink:0}
.hcps-stat-val{font-size:20px;font-weight:800;font-family:'Courier New',monospace;color:var(--text-primary);line-height:1}

/* click pad — spans left stack height (title + stats) */
#hcps-pad{
  grid-area:pad;cursor:pointer;user-select:none;width:100%;min-width:0;min-height:0;height:100%;align-self:stretch;
  display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;
  position:relative;overflow:hidden;background:var(--hcps-pad);
  border:2px solid transparent;border-radius:16px;padding:12px;
  transition:background .2s ease,transform .12s ease,box-shadow .2s ease,border-color .2s ease;
}
#hcps-pad::before{
  content:"";width:28px;height:28px;margin-bottom:8px;background:#fff;opacity:.95;
  -webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 9 5 12 1.8-5.2L21 14Z'/%3E%3Cpath d='M7.2 2.2 8 5.1'/%3E%3Cpath d='m5.1 8-2.9-.8'/%3E%3Cpath d='M14 4.1 12 6'/%3E%3Cpath d='m6 12-1.9 2'/%3E%3C/svg%3E") center/contain no-repeat;
  mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 9 5 12 1.8-5.2L21 14Z'/%3E%3Cpath d='M7.2 2.2 8 5.1'/%3E%3Cpath d='m5.1 8-2.9-.8'/%3E%3Cpath d='M14 4.1 12 6'/%3E%3Cpath d='m6 12-1.9 2'/%3E%3C/svg%3E") center/contain no-repeat;
}
#hcps-pad::after{content:"";position:absolute;inset:0;pointer-events:none;opacity:0;background:radial-gradient(circle at center,rgba(255,255,255,.7) 0%,rgba(255,255,255,0) 65%)}
#hcps-pad:hover{background:var(--hcps-pad-hover);transform:translateY(-2px);box-shadow:0 10px 24px color-mix(in srgb,var(--hcps-pad-hover) 35%,transparent)}
/* click feel: press in, darken, inner shadow, white flash that restarts on every click */
#hcps-pad:active{background:var(--hcps-pad-active);transform:scale(.95);box-shadow:inset 0 4px 14px rgba(0,0,0,.35)}
#hcps-pad:active::after{animation:hcps-pulse .35s ease-out}
@keyframes hcps-pulse{from{opacity:1;transform:scale(.4)}to{opacity:0;transform:scale(1.6)}}
#hcps-pad-label{color:#fff;font-weight:800;font-size:18px}
#hcps-pad-sub{color:#ffffffd9;font-weight:600;font-size:12px;margin-top:2px}
#hcps-try-again{display:none;cursor:pointer;border:none;background:transparent;color:#fff;font-size:12px;font-weight:700;font-family:inherit;text-decoration:underline;margin-top:4px;padding:0}
/* finished state (class added by the widget script): green pad, dark text, not clickable */
#hcps-pad.hcps-done{cursor:default}
#hcps-pad.hcps-done,#hcps-pad.hcps-done:hover,#hcps-pad.hcps-done:active{background:var(--hcps-done-bg);border-color:var(--hcps-done-border);transform:none;box-shadow:none}
#hcps-pad.hcps-done:active::after{animation:none}
#hcps-pad.hcps-done::before{background:#14192b}
#hcps-pad.hcps-done #hcps-pad-label,#hcps-pad.hcps-done #hcps-try-again{color:#14192b}
#hcps-pad.hcps-done #hcps-pad-sub{color:#14192bb3}

/* footer link */
#hcps-footer{grid-area:footer;display:flex;align-items:center;justify-content:flex-end;gap:var(--space-4);width:100%}
#hcps-open-full{display:inline-flex;align-items:center;gap:4px;font-size:12px;font-weight:700;color:var(--hcps-link);white-space:nowrap}
#hcps-open-full:hover{text-decoration:underline}

/* narrow screens: stack left controls above the pad */
@media (max-width:560px){
  #home-cps-widget{grid-template-columns:1fr;grid-template-rows:auto;grid-template-areas:"title" "stats" "pad" "footer"}
  #hcps-stats{grid-template-columns:1fr 1fr;grid-template-rows:auto;height:auto}
  #hcps-pad{min-height:140px;height:auto}
}


.tool-frame-wrap {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-panel);
  padding: var(--space-6); box-shadow: var(--shadow-md);
}

/* ---------- 6. Prose, FAQ, blog ---------- */
.prose { max-width: 760px; }
.prose p { margin-bottom: var(--space-4); font-size: var(--fs-base); }
.prose h2 { margin-top: var(--space-7); margin-bottom: var(--space-3); }
.prose h3 { margin-top: var(--space-7); margin-bottom: var(--space-3); }
.prose a { color: var(--accent-primary); text-decoration: underline; text-underline-offset: 2px; }
.prose a:hover { color: var(--accent-primary-dark); }
.tip-list { display: flex; flex-direction: column; gap: var(--space-3); margin-top: var(--space-4); }
.tip-list li { list-style: none; display: flex; gap: var(--space-3); background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-input); padding: var(--space-4); font-size: var(--fs-sm); color: var(--text-secondary); }
.tip-list li::before { content: "→"; color: var(--accent-primary); font-weight: 800; flex-shrink: 0; }
.faq-item { border-bottom: 1px solid var(--border); padding-block: var(--space-5); }
.faq-item h3, .faq-item h4 { font-size: var(--fs-base); margin-top: 0; margin-bottom: var(--space-2); }
.faq-item p { margin: 0; }
.step-list { list-style: none; counter-reset: step; display: flex; flex-direction: column; gap: var(--space-3); margin-top: var(--space-4); padding: 0; }
.step-list li { counter-increment: step; display: flex; gap: var(--space-3); background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-input); padding: var(--space-4); font-size: var(--fs-sm); color: var(--text-secondary); }
.step-list li::before { content: counter(step); flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%; background: var(--accent-primary); color: var(--on-accent); font-size: var(--fs-xs); font-weight: 800; display: flex; align-items: center; justify-content: center; }
.prose-table-wrap { overflow-x: auto; margin: var(--space-4) 0; }
.prose table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-input); overflow: hidden; }
.prose th, .prose td { text-align: left; padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border); }
.prose th { background: var(--bg-secondary); font-weight: 700; color: var(--text-primary); }
.prose tr:last-child td { border-bottom: none; }

/* Battery tool page: platforms → FAQ — wider block; headings centered, body left */
.home-compat-section .container,
.bv-section:has(.prose) > .container {
  max-width: 1200px;
}
.bv-section .prose {
  max-width: none;
  width: 100%;
  margin-inline: auto;
  text-align: left;
}
.bv-section .prose > h2,
.bv-section .prose > h3 {
  text-align: center;
}
.bv-section .prose > h2 {
  margin-top: calc(var(--space-9) * 2);
}
.bv-section .prose > h2:first-child {
  margin-top: 0;
}

.blog-card p { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.blog-meta { font-size: var(--fs-xs); color: var(--text-muted); margin-top: var(--space-2); }
.article-meta { color: var(--text-muted); font-size: var(--fs-sm); margin-bottom: var(--space-6); }

/* Blog article: centered wide column + featured image */
.page-main { min-height: calc(100vh - var(--header-height) - 220px); }
.page-main > .container { padding-block: 0 var(--space-8); }
.prose.prose-wide {
  max-width: 1100px;
  width: 100%;
  margin-inline: auto;
}
.blog-article {
  max-width: 1100px;
  width: 100%;
  margin-inline: auto;
}
.blog-article.prose {
  max-width: 1100px;
}
.blog-featured {
  display: block;
  width: 100%;
  aspect-ratio: 1200 / 630;
  object-fit: cover;
  border-radius: var(--radius-panel);
  border: 1px solid var(--border);
  margin: 0 0 var(--space-7);
  background: var(--bg-secondary);
}
.prose.prose-wide > .blog-featured {
  margin-top: var(--space-2);
}

/* ---------- 7. Sidebar ---------- */
/* ---------------------------------------------------------------------------
   Persistent left sidebar (global site chrome, present on every page).
   Layout: .site-body-layout is a flex row of [.site-sidebar, .site-main-col],
   inserted as a sibling wrapper around the existing <main>. On narrow
   viewports the sidebar becomes an off-canvas drawer toggled by a floating
   button, so it never squeezes page content into a thin column.
--------------------------------------------------------------------------- */
.site-body-layout { display: flex; align-items: flex-start; }
.site-main-col { flex: 1 1 0%; min-width: 0; }

.site-sidebar {
  width: 272px; flex-shrink: 0;
  position: sticky; top: var(--header-height);
  /* max-height (not height) so the sidebar only ever grows to its own
     natural content size — using a fixed height here previously forced
     the whole two-column flex row to be at least full-viewport-tall on
     EVERY page, even short ones (like blog posts), leaving a large blank
     gap between short content and the footer. max-height still caps and
     scrolls the sidebar internally on the rare page where its own content
     (many expanded categories) would otherwise exceed the viewport. */
  max-height: calc(100vh - var(--header-height));
  overflow-y: auto;
  border-right: 1px solid var(--border);
  background: var(--bg-primary);
}
.sidebar-scroll { padding: var(--space-5) var(--space-4) var(--space-7); }
.sidebar-brand {
  display: none;
}
.sidebar-heading {
  font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-muted); padding: 0 var(--space-2) var(--space-3);
}
.sidebar-category + .sidebar-category { margin-top: var(--space-1); }

.sidebar-cat-row { display: flex; align-items: stretch; border-radius: var(--radius-input); }
.sidebar-cat-link {
  /* This is a <button> (categories no longer navigate anywhere), so the
     browser's default button chrome — border, background, font — needs an
     explicit reset here, same as .sidebar-cat-toggle already has, or it
     shows through as an unwanted boxy border around the category name. */
  background: none; border: none; cursor: pointer; font-family: inherit; text-align: left;
  flex: 1; display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-3) var(--space-2); border-radius: var(--radius-input);
  font-size: var(--fs-sm); font-weight: 600; color: var(--text-primary);
  transition: background var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out);
}
.sidebar-cat-link:hover { background: var(--bg-card-hover); color: var(--accent-primary); }
.sidebar-cat-link.active-cat { color: var(--accent-primary); }
.sidebar-cat-icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; }
.sidebar-cat-icon svg,
.sidebar-chevron {
  stroke-width: 1.5 !important;
}
.sidebar-cat-name { flex: 1; }
.sidebar-cat-toggle {
  display: grid; place-items: center; width: 36px; flex-shrink: 0;
  background: none; border: none; cursor: pointer; color: var(--text-muted);
  border-radius: var(--radius-input);
  transition: background var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out);
}
.sidebar-cat-toggle:hover { background: var(--bg-card-hover); color: var(--accent-primary); }
.sidebar-chevron { transition: transform var(--duration-base) var(--ease-out); }
.sidebar-category.open > .sidebar-cat-row .sidebar-chevron { transform: rotate(90deg); }
.sidebar-category.open > .sidebar-cat-row .sidebar-cat-toggle { color: var(--accent-primary); }

.sidebar-tool-list {
  display: grid; grid-template-rows: 0fr;
  transition: grid-template-rows var(--duration-base) var(--ease-out);
}
.sidebar-category.open .sidebar-tool-list { grid-template-rows: 1fr; }
.sidebar-tool-list-inner { overflow: hidden; display: flex; flex-direction: column; padding-left: var(--space-6); }
.sidebar-tool-list a {
  padding: var(--space-2) var(--space-2); margin-block: 1px;
  font-size: var(--fs-sm); color: var(--text-secondary); border-radius: var(--radius-input);
  transition: background var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out);
}
.sidebar-tool-list a:hover { background: var(--bg-card-hover); color: var(--accent-primary); }
.sidebar-tool-list a.active { color: var(--accent-primary); font-weight: 700; background: rgba(11,95,255,0.10); }

.sidebar-backdrop { display: none; }

@media (max-width: 980px) {
  .site-body-layout { display: block; }
  .site-sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 200;
    width: 82vw; max-width: 320px;
    /* Full viewport drawer: pin with top+bottom (not a capped max-height) so
       the panel fills the screen with no blank strip. Clear the desktop
       max-height. Scroll only the inner .sidebar-scroll if needed. */
    height: auto;
    max-height: none;
    padding-top: var(--header-height);
    display: flex; flex-direction: column;
    overflow: hidden;
    transform: translateX(-100%);
    transition: transform var(--duration-base) var(--ease-out);
    box-shadow: var(--shadow-lg);
  }
  .site-sidebar.sidebar-open { transform: translateX(0); }
  .sidebar-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .sidebar-backdrop {
    display: block; position: fixed; inset: 0; z-index: 190;
    background: rgba(8, 12, 24, 0.45);
    opacity: 0; pointer-events: none;
    transition: opacity var(--duration-base) var(--ease-out);
  }
  .sidebar-backdrop.active { opacity: 1; pointer-events: auto; }
  /* Fills the blank space created by the sidebar's padding-top (reserved so
     drawer content starts below the fixed header) with the site mark,
     so the drawer reads as "this app's menu" instead of leaving dead space. */
  .sidebar-brand {
    display: flex; align-items: center; gap: var(--space-2);
    position: absolute; top: 0; left: 0; right: 0; height: var(--header-height);
    padding-inline: var(--space-5);
    border-bottom: 1px solid var(--border);
    font-weight: 800; font-size: var(--fs-lg); letter-spacing: -0.01em;
    color: var(--text-primary);
  }
}
