/* ====================================
   Wattro — Schematic Energy Theme
   v2.0 — Visual-First Rebuild
   ==================================== */

/* --- 01. Custom Properties --- */
:root {
  --font-body: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-data: 'IBM Plex Mono', 'SF Mono', 'Menlo', monospace;

  --text-xs: clamp(0.6875rem, 0.65rem + 0.12vw, 0.75rem);
  --text-sm: clamp(0.8125rem, 0.78rem + 0.18vw, 0.875rem);
  --text-base: clamp(0.9375rem, 0.88rem + 0.25vw, 1.0625rem);
  --text-lg: clamp(1.125rem, 1.05rem + 0.3vw, 1.25rem);
  --text-xl: clamp(1.375rem, 1.2rem + 0.6vw, 1.625rem);
  --text-2xl: clamp(1.75rem, 1.4rem + 1.1vw, 2.25rem);
  --text-3xl: clamp(2.25rem, 1.7rem + 1.8vw, 3.25rem);
  --text-hero: clamp(2.5rem, 1.8rem + 2.5vw, 4rem);
  --text-data-lg: clamp(2rem, 1.5rem + 1.5vw, 3rem);

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-fast: 150ms;
  --dur: 300ms;
  --dur-slow: 600ms;

  --max-w: 1120px;
  --max-w-narrow: 720px;
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
  --card-radius: 12px;
  --btn-radius: 8px;
}

/* Dark Theme (default) */
:root,
[data-theme="dark"] {
  --bg-primary: #080a0e;
  --bg-secondary: #0e1118;
  --bg-elevated: #151a24;
  --bg-inset: #090b10;

  --text-primary: #e4e8f0;
  --text-secondary: #8892a6;
  --text-tertiary: #4a5268;

  --accent: #4ecde6;
  --accent-hover: #6edcf0;
  --accent-dim: rgba(78, 205, 230, 0.07);
  --accent-glow: rgba(78, 205, 230, 0.14);
  --accent-border: rgba(78, 205, 230, 0.18);
  --accent-pulse: rgba(78, 205, 230, 0.30);

  --amber: #f0a030;
  --amber-dim: rgba(240, 160, 48, 0.10);
  --draining: #f97066;
  --draining-dim: rgba(249, 112, 102, 0.10);
  --blue: #60a5fa;
  --blue-dim: rgba(96, 165, 250, 0.10);
  --purple: #a78bfa;
  --purple-dim: rgba(167, 139, 250, 0.10);

  --border: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.10);
  --border-accent: rgba(78, 205, 230, 0.15);
  --grid-dot: rgba(255, 255, 255, 0.04);
  --gauge-track: rgba(255, 255, 255, 0.06);

  --nav-bg: rgba(8, 10, 14, 0.8);
  --nav-bg-scrolled: rgba(8, 10, 14, 0.95);
  --mobile-menu-bg: rgba(8, 10, 14, 0.98);
  --mockup-shadow:
    0 1px 3px rgba(0, 0, 0, 0.35),
    0 4px 12px rgba(0, 0, 0, 0.30),
    0 12px 32px rgba(0, 0, 0, 0.22),
    0 28px 56px rgba(0, 0, 0, 0.14),
    0 0 0 1px rgba(255, 255, 255, 0.03);
  --terminal-chrome-bg: rgba(255, 255, 255, 0.015);
  --pricing-pro-bg: linear-gradient(180deg, rgba(78, 205, 230, 0.04) 0%, var(--bg-elevated) 100%);
  --btn-primary-text: #080a0e;

  color-scheme: dark;
}

/* Light Theme */
[data-theme="light"] {
  --bg-primary: #f4f7fa;
  --bg-secondary: #ffffff;
  --bg-elevated: #e8ecf2;
  --bg-inset: #edf0f5;

  --text-primary: #161c2a;
  --text-secondary: #4a536a;
  --text-tertiary: #8590a8;

  --accent: #1a96af;
  --accent-hover: #14808f;
  --accent-dim: rgba(26, 150, 175, 0.06);
  --accent-glow: rgba(26, 150, 175, 0.10);
  --accent-border: rgba(26, 150, 175, 0.20);
  --accent-pulse: rgba(26, 150, 175, 0.25);

  --amber: #c47f18;
  --amber-dim: rgba(196, 127, 24, 0.06);
  --draining: #dc4a42;
  --draining-dim: rgba(220, 74, 66, 0.06);
  --blue: #3678d9;
  --blue-dim: rgba(54, 120, 217, 0.06);
  --purple: #7c5cd6;
  --purple-dim: rgba(124, 92, 214, 0.06);

  --border: rgba(0, 0, 0, 0.07);
  --border-hover: rgba(0, 0, 0, 0.12);
  --border-accent: rgba(26, 150, 175, 0.20);
  --grid-dot: rgba(0, 0, 0, 0.04);
  --gauge-track: rgba(0, 0, 0, 0.08);

  --nav-bg: rgba(244, 247, 250, 0.8);
  --nav-bg-scrolled: rgba(244, 247, 250, 0.95);
  --mobile-menu-bg: rgba(244, 247, 250, 0.98);
  --mockup-shadow:
    0 2px 4px rgba(0, 0, 0, 0.06),
    0 8px 16px rgba(0, 0, 0, 0.07),
    0 20px 40px rgba(0, 0, 0, 0.06),
    0 48px 96px rgba(0, 0, 0, 0.04),
    0 80px 160px rgba(0, 0, 0, 0.02),
    0 0 0 1px rgba(0, 0, 0, 0.04);
  --terminal-chrome-bg: rgba(0, 0, 0, 0.02);
  --pricing-pro-bg: linear-gradient(180deg, rgba(26, 150, 175, 0.04) 0%, var(--bg-elevated) 100%);
  --btn-primary-text: #ffffff;

  color-scheme: light;
}

/* --- 01b. Crystal Electricity Effects --- */


/* Hero accent — no shimmer, just color */

/* Electric pulse glow on wattage display */
.mockup-watt {
  text-shadow: 0 0 20px var(--accent-glow);
  animation: voltage-pulse 3s ease-in-out infinite;
}
@keyframes voltage-pulse {
  0%, 100% { text-shadow: 0 0 16px var(--accent-glow); }
  50% { text-shadow: 0 0 28px var(--accent-pulse), 0 0 8px var(--accent-glow); }
}

/* Prismatic card hover — subtle rainbow refraction edge */
.bento-card {
  position: relative;
}
.bento-card::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: var(--card-radius);
  padding: 1px;
  background: linear-gradient(
    135deg,
    transparent 0%,
    transparent 40%,
    rgba(78, 205, 230, 0.15) 45%,
    rgba(130, 180, 250, 0.12) 50%,
    rgba(167, 139, 250, 0.08) 55%,
    transparent 60%,
    transparent 100%
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity var(--dur) ease;
  pointer-events: none;
  z-index: 1;
}
.bento-card:hover::before {
  opacity: 1;
}

/* Subtle glow on flow values */
.mockup-flow-seg-val {
  text-shadow: 0 0 8px var(--accent-glow);
}

/* --- 02. Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 400;
  line-height: 1.55;
  color: var(--text-secondary);
  background: var(--bg-primary);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--accent); text-decoration: none; transition: color var(--dur-fast); }
a:hover { color: var(--accent-hover); }
ul { list-style: none; }
::selection { background: var(--accent); color: var(--btn-primary-text); }

/* --- 03. Typography --- */
h1, h2, h3, h4 { font-family: var(--font-body); color: var(--text-primary); line-height: 1.1; }
h2 { font-size: var(--text-3xl); font-weight: 700; letter-spacing: -0.025em; }
h3 { font-size: var(--text-xl); font-weight: 600; letter-spacing: -0.01em; line-height: 1.25; }
code { font-family: var(--font-data); }
.data-mono { font-family: var(--font-data); font-weight: 500; }
.data-green { color: var(--accent); }
.section-label {
  font-size: var(--text-2xl);
  font-weight: 600;
  letter-spacing: -0.02em;
  text-align: center;
  margin-bottom: clamp(2rem, 5vh, 3.5rem);
  color: var(--text-primary);
}

/* --- 04. Layout --- */
.container { max-width: var(--max-w); margin-inline: auto; padding-inline: var(--gutter); }
.container-narrow { max-width: var(--max-w-narrow); margin-inline: auto; padding-inline: var(--gutter); }
section { padding-block: clamp(4rem, 10vh, 7rem); position: relative; scroll-margin-top: 80px; }

/* --- 05. Background Patterns --- */
.dot-grid {
  background-image: radial-gradient(circle, var(--grid-dot) 1px, transparent 1px);
  background-size: 24px 24px;
}

/* --- 06. Skip Link & Focus --- */
.skip-link { position: absolute; top: -100%; left: 1rem; padding: .4rem 1rem; background: var(--accent); color: var(--btn-primary-text); border-radius: 6px; font-weight: 600; z-index: 300; }
.skip-link:focus { top: .5rem; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* --- 07. Navigation --- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: 56px;
  background: var(--nav-bg);
  backdrop-filter: blur(20px) saturate(1.3);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
  border-bottom: 1px solid transparent;
  transition: background var(--dur) ease, border-color var(--dur) ease;
}
.nav.scrolled { background: var(--nav-bg-scrolled); }
.nav-inner {
  max-width: var(--max-w); margin-inline: auto; padding-inline: var(--gutter);
  display: flex; align-items: center; height: 100%; gap: 2rem;
}
.nav-logo { display: flex; align-items: center; gap: .5rem; flex-shrink: 0; }
.nav-logo-icon { width: 38px; height: 38px; }
.nav-wordmark { font-weight: 600; font-size: var(--text-lg); color: var(--text-primary); letter-spacing: -0.02em; }
.nav-links { display: flex; align-items: center; gap: 1.5rem; margin-left: auto; }
.nav-link { font-size: var(--text-sm); font-weight: 500; color: var(--text-secondary); transition: color var(--dur-fast); }
.nav-link:hover, .nav-link.active { color: var(--text-primary); }
.nav-toggle-input { display: none; }
.nav-toggle { display: none; cursor: pointer; flex-direction: column; gap: 5px; z-index: 110; }
.nav-toggle span { display: block; width: 20px; height: 1.5px; background: var(--text-secondary); transition: transform var(--dur) ease, opacity var(--dur) ease; }

/* Theme toggle */
.theme-toggle {
  background: none; border: none; cursor: pointer; color: var(--text-secondary);
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  border-radius: 6px; transition: color var(--dur-fast), background var(--dur-fast);
}
.theme-toggle:hover { color: var(--text-primary); background: var(--accent-dim); }
.theme-toggle svg { width: 18px; height: 18px; }
/* Show moon in dark mode, sun in light mode */
.icon-moon, .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: block; }
[data-theme="light"] .icon-sun { display: block; }

.nav-cta { margin-left: .5rem; }

/* --- 08. Buttons --- */
.btn-primary, .btn-secondary {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .625rem 1.25rem;
  border-radius: var(--btn-radius);
  font-family: var(--font-body); font-size: var(--text-sm); font-weight: 600;
  transition: all var(--dur-fast);
  cursor: pointer; border: none; text-decoration: none;
}
.btn-primary {
  background: var(--accent); color: var(--btn-primary-text);
}
.btn-primary:hover { background: var(--accent-hover); color: var(--btn-primary-text); }
.btn-secondary {
  background: transparent; color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--border-hover); color: var(--text-primary); }
.btn-primary svg, .btn-secondary svg { flex-shrink: 0; }

/* --- 09. Hero Section --- */
.section-hero { padding-top: clamp(10rem, 20vh, 14rem); padding-bottom: clamp(4rem, 8vh, 6rem); }
.hero-container {
  max-width: var(--max-w); margin-inline: auto; padding-inline: var(--gutter);
  display: grid; grid-template-columns: 1fr 1.2fr; gap: clamp(2rem, 5vw, 4rem); align-items: center;
}
.hero-title {
  font-size: var(--text-hero); font-weight: 700; letter-spacing: -0.03em;
  line-height: 1.05; margin-bottom: 1rem;
}
.hero-accent { color: var(--accent); }
.hero-sub { font-size: var(--text-lg); color: var(--text-secondary); margin-bottom: 2rem; max-width: 400px; }
.hero-ctas { display: flex; gap: .75rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.hero-meta { font-size: var(--text-xs); color: var(--text-tertiary); font-family: var(--font-data); }

/* Hero Mockup */
.hero-mockup { position: relative; }
.menubar-strip {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 8px 8px 0 0; padding: 6px 12px;
  font-family: var(--font-data); font-size: 11px; color: var(--text-secondary);
}
.menubar-left { display: flex; align-items: center; gap: 6px; }
.menubar-left svg { display: inline-block; }
.menubar-watt { color: var(--accent); font-weight: 600; }
.menubar-right { color: var(--text-tertiary); }
.mockup-card {
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-top: none; border-radius: 0 0 var(--card-radius) var(--card-radius);
  padding: clamp(.875rem, 1.5vw, 1.25rem); box-shadow: var(--mockup-shadow);
}
/* Wattage hero area */
.mockup-hero-watt { text-align: center; padding: .75rem 0 .5rem; }
.mockup-gauge { width: 90px; height: 50px; margin: 0 auto .15rem; }
.mockup-gauge-svg { width: 100%; height: 100%; overflow: visible; }
.mockup-gauge-needle {
  transform-origin: 50px 50px;
  transform: rotate(12deg);
  transition: transform 1s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.mockup-watt {
  font-family: var(--font-data); font-weight: 600;
  font-size: clamp(1.75rem, 3vw, 2.25rem); color: var(--accent);
  display: block; line-height: 1;
}
.mockup-status {
  font-family: var(--font-data); font-size: 10px;
  color: var(--accent); display: block; margin-top: 4px; letter-spacing: 0.03em;
}
/* Battery bar */
.mockup-battery-bar {
  position: relative; height: 6px; background: var(--gauge-track);
  border-radius: 3px; margin: .5rem 0 .75rem; overflow: hidden;
}
.mockup-battery-fill { height: 100%; width: 87%; background: var(--accent); border-radius: 3px; transition: width 1s ease; }
.mockup-battery-pct {
  position: absolute; right: 0; top: -16px;
  font-family: var(--font-data); font-size: 10px; color: var(--text-secondary);
}
/* Section labels in mockup */
.mockup-section-label {
  font-family: var(--font-data); font-size: 9px; font-weight: 600;
  color: var(--text-tertiary); letter-spacing: 0.08em;
  margin: .75rem 0 .25rem; padding-top: .5rem;
  border-top: 1px solid var(--border);
}
/* Data rows */
.mockup-data-rows { display: flex; flex-direction: column; gap: 0; }
.mockup-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 3px 0; font-size: 11px;
}
.mockup-label { color: var(--text-tertiary); }
.mockup-value { color: var(--text-primary); font-family: var(--font-data); font-size: 11px; }
.mockup-dim { color: var(--text-tertiary); }
/* Sparkline rows */
.mockup-sparkline-area { display: flex; flex-direction: column; gap: 4px; }
.mockup-spark-row { display: flex; align-items: center; gap: 6px; }
.mockup-spark-label { font-family: var(--font-data); font-size: 9px; color: var(--text-tertiary); min-width: 56px; }
.mockup-sparkline { flex: 1; height: 24px; }
.mockup-spark-val { font-size: 9px; color: var(--text-secondary); min-width: 30px; text-align: right; }
/* Process bars in mockup */
.mockup-procs { display: flex; flex-direction: column; gap: 4px; }
.mockup-proc { display: flex; align-items: center; gap: 6px; font-size: 10px; }
.mockup-proc-name { color: var(--text-tertiary); min-width: 60px; max-width: 100px; flex-shrink: 0; font-family: var(--font-data); font-size: 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mockup-proc-bar { flex: 1; height: 3px; background: var(--gauge-track); border-radius: 2px; overflow: hidden; }
.mockup-proc-bar div { height: 100%; background: var(--accent); border-radius: 2px; }
.mockup-proc-bar-gpu div { background: var(--amber); }
.mockup-proc-bar-amber div { background: var(--amber); }
.mockup-proc-val { font-size: 9px; color: var(--text-secondary); min-width: 28px; text-align: right; }
.mockup-proc-cpu { font-size: 9px; color: var(--text-tertiary); min-width: 28px; text-align: right; }
/* Process table header */
.mockup-proc-header {
  display: flex; align-items: center; gap: 6px;
  padding: 2px 0; margin-bottom: 2px;
}
.mockup-proc-header-name {
  font-family: var(--font-data); font-size: 8px; color: var(--text-tertiary);
  letter-spacing: 0.04em; flex: 1;
}
.mockup-proc-header-col {
  font-family: var(--font-data); font-size: 8px; color: var(--text-tertiary);
  letter-spacing: 0.04em; min-width: 28px; text-align: right;
}

/* Flow strip — compact horizontal bar matching real app */
.mockup-flow-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin: 2px 0 4px;
}
.mockup-flow-seg {
  display: flex; flex-direction: column; align-items: center; gap: 0;
  padding: 3px 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 6px;
  min-width: 50px;
}
.mockup-flow-seg-active {
  border-color: var(--border-hover);
}
.mockup-flow-seg-name {
  font-family: var(--font-data); font-size: 7px; font-weight: 600;
  color: var(--text-tertiary); letter-spacing: 0.03em;
}
.mockup-flow-seg-val { font-size: 9px; line-height: 1.2; }
.mockup-flow-arrow {
  padding: 0 2px;
  font-size: 8px;
  color: var(--accent);
  animation: flow-arrow-pulse 2s ease-in-out infinite;
}
@keyframes flow-arrow-pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* Time scale tabs */
.mockup-time-tabs {
  display: flex; gap: 2px; margin-bottom: 6px;
}
.mockup-tab {
  font-family: var(--font-data); font-size: 8px; font-weight: 500;
  color: var(--text-tertiary); padding: 2px 6px; border-radius: 3px;
  cursor: default;
}
.mockup-tab-active {
  background: var(--accent-dim);
  color: var(--accent); font-weight: 600;
}

/* --- 10b. Power Flow Diagram --- */
.section-power-flow { background: var(--bg-secondary); padding-block: clamp(4rem, 10vh, 7rem); }
/* Wrapper: state on left, diagram on right */
.pflow-wrapper {
  display: flex; align-items: center; gap: 2rem;
  max-width: 1100px; margin: 0 auto 1.5rem;
}
/* State label — left column beside the diagram */
.pflow-state {
  display: flex; flex-direction: column; gap: 4px; min-width: 180px; max-width: 200px; flex-shrink: 0;
  text-align: left;
}
.pflow-state-label {
  font-family: var(--font-data); font-size: var(--text-xl); font-weight: 600;
  color: var(--accent); transition: color 0.5s ease; white-space: nowrap;
}
.pflow-state-desc {
  font-size: var(--text-sm); color: var(--text-tertiary); line-height: 1.5;
}
/* Diagram — the 3 nodes + traces */
.pflow-diagram {
  display: flex; align-items: center; justify-content: center; gap: 0; flex: 1;
}
.pflow-node {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 1.75rem 2.25rem; background: var(--bg-elevated);
  border: 1px solid var(--border); border-radius: var(--card-radius);
  width: 170px; flex-shrink: 0;
}
.pflow-icon { margin-bottom: 2px; }
.pflow-icon svg { display: block; }
.pflow-value { font-size: var(--text-3xl); line-height: 1; transition: color 0.5s ease; }
.pflow-name { font-size: var(--text-base); font-weight: 600; color: var(--text-primary); }
.pflow-detail { font-size: var(--text-sm); color: var(--text-tertiary); }
.pflow-detail-row { display: flex; justify-content: center; }
.pflow-detail-wrap { position: relative; display: inline-flex; align-items: center; }
.pflow-trend-char { position: absolute; left: 100%; margin-left: 4px; top: 50%; transform: translateY(-50%); font-size: 0.8rem; line-height: 1; transition: color 0.5s ease, opacity 0.5s ease; }
:root .pflow-detail,
[data-theme="dark"] .pflow-detail { color: #6b7890; }
.pflow-trace {
  flex: 1; min-width: 40px; max-width: 100px; height: 3px;
  background: var(--accent-border); position: relative; overflow: hidden;
}
.pflow-trace-line { width: 100%; height: 100%; background: var(--accent-border); }
.pflow-trace-pulse {
  position: absolute; top: -1px; left: -24px; width: 24px; height: 5px;
  background: linear-gradient(90deg, transparent, var(--trace-color, var(--blue)), transparent);
  border-radius: 3px; animation: pflow-move 2s linear infinite;
}
@keyframes pflow-move {
  0% { left: -24px; }
  100% { left: calc(100% + 24px); }
}
.pflow-trace-label {
  position: absolute; top: -18px; left: 50%; transform: translateX(-50%);
  font-size: var(--text-xs); white-space: nowrap; transition: color 0.5s ease;
}
.pflow-trace.pflow-trace-reverse .pflow-trace-pulse { animation-direction: reverse; }
.pflow-node.pflow-node-dim { opacity: 0.35; filter: saturate(0.3); }
.pflow-trace.pflow-trace-dim { opacity: 0.2; }
.pflow-trace.pflow-trace-dim .pflow-trace-pulse { display: none; }
/* Nav controls — under state label */
.pflow-nav {
  display: flex; align-items: center; gap: 10px; margin-top: 12px; justify-content: flex-start;
}
.pflow-nav-btn {
  background: none; border: 1px solid var(--border); border-radius: 8px;
  width: 38px; height: 38px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text-secondary); transition: all var(--dur-fast);
}
.pflow-nav-btn:hover { border-color: var(--accent); color: var(--accent); }
.pflow-nav-btn svg { display: block; }
.pflow-nav-dots { display: flex; gap: 6px; }
.pflow-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--text-tertiary); opacity: 0.3; transition: all var(--dur-fast);
}
.pflow-dot-active { background: var(--accent); opacity: 1; }
/* Transitions */
.pflow-value, .pflow-detail, .pflow-trace-label, .pflow-state-label, .pflow-state-desc { transition: color 0.8s ease, opacity 0.8s ease; }
.pflow-node, .pflow-trace { transition: opacity 0.5s ease; }

/* Power flow section-level reveal (heading + wrapper) */
.pflow-section-reveal {
  opacity: 0; transform: translateY(20px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
.pflow-section-reveal.is-visible {
  opacity: 1; transform: translateY(0);
}

/* Power flow slide-in reveal */
@keyframes pflow-slide-in {
  from { opacity: 0; transform: translateX(40px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes pflow-slide-in-reverse {
  from { opacity: 0; transform: translateX(-40px); }
  to   { opacity: 1; transform: translateX(0); }
}
.pflow-reveal.pflow-slide-reverse.is-visible {
  animation: pflow-slide-in-reverse 0.8s var(--ease) var(--pflow-delay, 0ms) both;
}
@keyframes pflow-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.pflow-reveal.pflow-fade-only.is-visible {
  animation: pflow-fade-in 0.8s var(--ease) var(--pflow-delay, 0ms) both;
}
/* Dim nodes: slide in to reduced opacity + desaturated */
@keyframes pflow-slide-in-dim {
  from { opacity: 0; transform: translateX(40px); filter: saturate(0); }
  to   { opacity: 0.35; transform: translateX(0); filter: saturate(0.3); }
}
@keyframes pflow-slide-in-reverse-dim {
  from { opacity: 0; transform: translateX(-40px); filter: saturate(0.3); }
  to   { opacity: 0.35; transform: translateX(0); filter: saturate(0.3); }
}
.pflow-reveal.pflow-node-dim.is-visible {
  animation: pflow-slide-in-dim 0.8s var(--ease) var(--pflow-delay, 0ms) both;
}
.pflow-reveal.pflow-slide-reverse.pflow-node-dim.is-visible {
  animation: pflow-slide-in-reverse-dim 0.8s var(--ease) var(--pflow-delay, 0ms) both;
}
@keyframes pflow-trace-grow {
  from { opacity: 0; transform: scaleX(0); }
  to   { opacity: 1; transform: scaleX(1); }
}
.pflow-reveal.is-visible {
  animation: pflow-slide-in 0.8s var(--ease) var(--pflow-delay, 0ms) both;
}
.pflow-trace.pflow-reveal.is-visible {
  animation: pflow-trace-grow 0.8s var(--ease) var(--pflow-delay, 0ms) both;
}
/* Dim trace: grow in to reduced opacity */
@keyframes pflow-trace-grow-dim {
  from { opacity: 0; transform: scaleX(0); }
  to   { opacity: 0.1; transform: scaleX(1); }
}
.pflow-trace.pflow-reveal.pflow-trace-dim.is-visible {
  animation: pflow-trace-grow-dim 0.8s var(--ease) var(--pflow-delay, 0ms) both;
}
/* Component breakdown bars */
.pflow-components {
  display: flex; gap: clamp(1rem, 2vw, 2rem);
  justify-content: center; flex-wrap: wrap; max-width: 800px; margin: 0 auto;
}
.pflow-comp {
  display: flex; flex-direction: column; align-items: center; gap: 6px; flex: 1; min-width: 70px; max-width: 140px;
}
.pflow-comp-bar {
  width: 100%; height: 6px; background: var(--gauge-track); border-radius: 3px;
  position: relative; overflow: hidden;
}
.pflow-comp-bar::after {
  content: ''; position: absolute; left: 0; top: 0; height: 100%;
  width: var(--w); background: var(--accent); border-radius: 3px;
}
.pflow-comp-bar-gpu::after { background: var(--amber); }
.pflow-comp-label { font-size: var(--text-sm); color: var(--text-tertiary); font-weight: 500; }
.pflow-comp-val { font-size: var(--text-base); color: var(--text-primary); }

/* --- 11. Features Bento Grid --- */
.section-features { background: var(--bg-primary); }
.bento-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(.75rem, 1.5vw, 1rem);
}
.bento-card {
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--card-radius); padding: clamp(1rem, 2vw, 1.5rem);
  transition: border-color var(--dur-fast);
  overflow: hidden;
}
.bento-card:hover { border-color: var(--border-hover); }
.bento-lg { grid-column: span 2; }
.bento-title {
  font-size: var(--text-sm); font-weight: 600; color: var(--text-primary);
  display: block; margin-bottom: clamp(.75rem, 1.5vw, 1rem);
  letter-spacing: -0.01em;
}
.bento-visual { color: var(--text-secondary); }

/* Chart area (Power Monitoring & Energy by App cards) */
.spark-chart-area { display: flex; gap: 6px; margin-bottom: 8px; }
.spark-y-axis { display: flex; flex-direction: column; justify-content: space-between; min-width: 28px; }
.spark-y-label { font-family: var(--font-data); font-size: 8px; color: var(--text-tertiary); text-align: right; }
.spark-chart { flex: 1; height: 60px; }
.spark-canvas { flex: 1; height: 140px; width: 100%; display: block; }
.spark-legend { display: flex; flex-wrap: wrap; gap: 10px; }
.spark-legend-item { display: flex; align-items: center; gap: 4px; font-size: var(--text-xs); color: var(--text-tertiary); }
.spark-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }

/* Connection grid */
.conn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.conn-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 8px 4px; border-radius: 8px; border: 1px solid transparent;
  transition: border-color var(--dur-fast);
}
.conn-item svg { display: block; }
.conn-active { border-color: var(--accent-border); background: var(--accent-dim); }
.conn-active .conn-icon { color: var(--accent); }
.conn-icon { color: var(--text-tertiary); }
.conn-name { font-size: var(--text-xs); color: var(--text-tertiary); }
.conn-watt { font-size: var(--text-xs); color: var(--text-primary); }


/* Health visual */
.health-visual { display: flex; gap: clamp(1rem, 2vw, 2rem); align-items: center; }
.health-gauge { text-align: center; position: relative; flex-shrink: 0; }
.health-arc { width: 100px; height: 55px; display: block; }
.health-pct { display: block; font-size: var(--text-xl); color: var(--accent); margin-top: -8px; }
.health-label { font-size: var(--text-xs); color: var(--text-tertiary); }
.health-stats { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.health-stat { display: flex; flex-direction: column; gap: 2px; }
.health-stat-label { font-size: var(--text-xs); color: var(--text-tertiary); }
.health-stat-value { font-size: var(--text-sm); color: var(--text-primary); }
.health-cycle-bar { height: 4px; background: var(--gauge-track); border-radius: 2px; margin-top: 4px; }
.health-cycle-fill { height: 100%; background: var(--accent); border-radius: 2px; }
.cycle-chart-area { margin-bottom: 2px; }
.cycle-chart-area .spark-chart { height: 80px; }
.cycle-chart-label { display: flex; justify-content: space-between; padding-left: 30px; }
.cycle-chart-dates { font-size: 9px; color: var(--text-tertiary); }

/* Adapter Details */
.adapter-detail-grid { display: flex; flex-direction: column; gap: 6px; }
.ad-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.ad-label { font-size: var(--text-xs); color: var(--text-tertiary); }
.ad-value { font-size: var(--text-xs); color: var(--text-primary); text-align: right; }

/* Session bars */
.session-visual { display: flex; flex-direction: column; gap: 10px; }
.session-bar { position: relative; height: 18px; background: var(--gauge-track); border-radius: 9px; overflow: hidden; }
.session-fill { height: 100%; border-radius: 6px; }
.session-charge { background: var(--accent); opacity: 0.6; }
.session-drain { background: var(--amber); opacity: 0.6; }
.session-label { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font-size: var(--text-xs); color: var(--text-primary); }

/* Process bars */
.proc-visual { display: flex; flex-direction: column; gap: 10px; }
.proc-row { display: flex; align-items: center; gap: 8px; }
.proc-name { font-size: var(--text-sm); color: var(--text-tertiary); min-width: 90px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.proc-val { font-size: var(--text-sm); }
.proc-bar {
  flex: 1; height: 6px; background: var(--gauge-track); border-radius: 3px;
  position: relative; overflow: hidden;
}
.proc-bar::after { content: ''; position: absolute; left: 0; top: 0; height: 100%; width: var(--w); background: var(--amber); border-radius: 3px; }
.proc-val { font-size: var(--text-sm); color: var(--text-secondary); min-width: 36px; text-align: right; }

/* Lightweight gauge */
.light-visual { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.light-gauge { width: 80px; height: 80px; }
.light-value { font-size: var(--text-xl); color: var(--accent); line-height: 1; }
.light-label { font-size: var(--text-sm); color: var(--text-tertiary); }

/* --- 12. Pricing --- */
.section-pricing { background: var(--bg-secondary); }
.pricing-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: clamp(1rem, 2vw, 1.5rem); max-width: 680px; margin: 0 auto;
}
.pricing-card {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--card-radius); padding: clamp(1.5rem, 3vw, 2rem);
  display: flex; flex-direction: column;
}
.pricing-pro {
  border-color: var(--accent-border); background: var(--pricing-pro-bg);
  position: relative;
}
.pricing-badge {
  position: absolute; top: -1px; right: 20px;
  background: var(--accent); color: var(--btn-primary-text);
  font-family: var(--font-data); font-size: var(--text-xs); font-weight: 600;
  padding: 3px 10px; border-radius: 0 0 6px 6px; letter-spacing: 0.05em;
}
.pricing-header { margin-bottom: 1.5rem; }
.pricing-tier { font-size: var(--text-sm); font-weight: 600; color: var(--text-primary); display: block; margin-bottom: 4px; }
.pricing-price { font-size: var(--text-3xl); color: var(--text-primary); line-height: 1; }
.pricing-once { font-size: var(--text-xs); color: var(--text-tertiary); display: block; margin-top: 4px; }
.pricing-features { flex: 1; display: flex; flex-direction: column; gap: 10px; margin-bottom: 1.5rem; }
.pricing-row { display: flex; align-items: center; gap: 8px; font-size: var(--text-sm); color: var(--text-secondary); }
.pricing-row svg { flex-shrink: 0; }
.pricing-locked { opacity: 0.4; }
.pricing-highlight { color: var(--text-primary); }
.pricing-btn { width: 100%; justify-content: center; }

/* --- 13. Install --- */
.section-install { background: var(--bg-primary); }
.install-header { text-align: center; margin-bottom: clamp(1.5rem, 4vh, 2.5rem); }
.install-header .section-label { margin-bottom: .4rem; }
.install-headline-sub {
  font-size: var(--text-base); color: var(--text-secondary); margin: 0;
}
.install-grid {
  display: grid; grid-template-columns: minmax(300px, 460px);
  margin: 0 auto; justify-content: center;
}
.install-card {
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--card-radius); padding: clamp(1.25rem, 2vw, 1.5rem);
}
.install-card--hero {
  border-color: var(--accent-border);
  background: linear-gradient(160deg, var(--bg-elevated) 0%, var(--bg-secondary) 100%);
  box-shadow: 0 2px 0 var(--accent-border), 0 8px 40px var(--accent-glow), 0 2px 16px rgba(0,0,0,0.12);
  padding: clamp(1.5rem, 3vw, 2rem);
  display: flex; flex-direction: column; align-items: stretch; gap: 1.1rem;
}
.install-identity {
  display: flex; align-items: center; gap: 1rem;
}
.install-identity-text { flex: 1; min-width: 0; }
.install-app-name-row {
  display: flex; align-items: center; gap: .5rem; margin-bottom: .25rem;
}
.install-app-icon {
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
  flex-shrink: 0;
}
.install-app-name {
  font-size: var(--text-xl); font-weight: 700; color: var(--text-primary); margin: 0;
}
.install-version-badge {
  font-size: 10px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--accent); background: var(--accent-dim); border: 1px solid var(--accent-border);
  border-radius: 4px; padding: 1px 6px; line-height: 1.6;
}
.install-app-tagline {
  font-size: var(--text-sm); color: var(--text-secondary); margin: 0; line-height: 1.4;
}
.install-divider {
  height: 1px; background: var(--border); margin: 0 -.5rem;
}
.install-dl-btn {
  width: 100%; justify-content: center; padding: .875rem 1.5rem;
  font-size: var(--text-base); font-weight: 600; border-radius: 10px;
  transition: background var(--dur-fast), transform var(--dur-fast), box-shadow var(--dur-fast);
}
.install-dl-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--accent-pulse);
}
.install-dl-btn:active { transform: translateY(0); }
.install-chips {
  display: flex; gap: .5rem; justify-content: center; flex-wrap: wrap;
}
.install-chip {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: var(--text-xs); color: var(--text-tertiary);
  background: var(--bg-inset); border: 1px solid var(--border);
  border-radius: 99px; padding: .2rem .65rem;
}
.install-chip svg { flex-shrink: 0; }
.install-card-label {
  font-size: var(--text-xs); font-weight: 600; color: var(--text-tertiary);
  text-transform: uppercase; letter-spacing: 0.06em; display: block; margin-bottom: .75rem;
}
.install-sub { font-size: var(--text-xs); color: var(--text-tertiary); margin-top: 0; text-align: center; }
.install-sub a { color: var(--accent); }
.install-note {
  text-align: center; font-size: var(--text-xs); color: var(--text-tertiary);
  margin-top: 1.5rem; max-width: 500px; margin-inline: auto;
}

/* --- 14. FAQ --- */
.section-faq { background: var(--bg-secondary); }
.faq-list { display: flex; flex-direction: column; gap: 0; }
.faq-item {
  border-bottom: 1px solid var(--border);
}
.faq-item:first-child { border-top: 1px solid var(--border); }
.faq-item summary {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 0; cursor: pointer; font-weight: 500; font-size: var(--text-base);
  color: var(--text-primary); list-style: none;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-chevron {
  width: 20px; height: 20px; position: relative; flex-shrink: 0;
}
.faq-chevron::before {
  content: '+'; display: block; font-size: 18px; color: var(--text-tertiary);
  font-weight: 300; text-align: center; line-height: 20px;
  transition: transform var(--dur) ease;
}
.faq-item[open] .faq-chevron::before { content: '-'; }
.faq-body { padding-bottom: 1rem; }
.faq-body p { font-size: var(--text-sm); color: var(--text-secondary); line-height: 1.6; }

/* --- 15. Footer --- */
.site-footer {
  padding: 2rem 0; border-top: 1px solid var(--border);
}
.footer-inner {
  max-width: var(--max-w); margin-inline: auto; padding-inline: var(--gutter);
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem;
  font-size: var(--text-xs); color: var(--text-tertiary);
}
.footer-left { display: flex; align-items: center; gap: .5rem; }
.footer-left svg { flex-shrink: 0; }
.footer-links { display: flex; gap: 1.5rem; }
.footer-links a { color: var(--text-tertiary); transition: color var(--dur-fast); }
.footer-links a:hover { color: var(--text-primary); }
.footer-copy { color: var(--text-tertiary); }

/* --- 16. Scroll Reveal --- */
.reveal {
  opacity: 0; transform: translateY(20px) scale(0.97);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease), border-color 0.7s var(--ease);
  transition-delay: var(--reveal-delay, 0ms);
}
.reveal.is-visible { opacity: 1; transform: translateY(0) scale(1); }

/* Bento card reveal glow — subtle border flash on entry */
.bento-card.reveal.is-visible {
  animation: card-glow 1.2s var(--ease) var(--reveal-delay, 0ms) both;
}
@keyframes card-glow {
  0% { border-color: var(--border); }
  30% { border-color: var(--accent-border); }
  100% { border-color: var(--border); }
}

/* --- 17. Theme Transition --- */
.theme-transitioning,
.theme-transitioning *,
.theme-transitioning *::before,
.theme-transitioning *::after {
  transition: background var(--dur) ease, color var(--dur) ease, border-color var(--dur) ease, box-shadow var(--dur) ease !important;
}

/* --- 18. Responsive --- */
@media (max-width: 1024px) {
  .hero-container { grid-template-columns: 1fr; text-align: center; }
  .hero-sub { margin-inline: auto; }
  .hero-ctas { justify-content: center; }
  .hero-meta { text-align: center; }
  .hero-mockup { max-width: 400px; margin: 0 auto; }
  .bento-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .nav-links { display: none; }
  .nav-toggle { display: flex; margin-left: auto; }
  .nav-toggle-input:checked ~ .nav-links {
    display: flex; flex-direction: column; position: fixed;
    inset: 56px 0 0 0; background: var(--mobile-menu-bg);
    padding: 2rem var(--gutter); gap: 1.5rem; z-index: 99;
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  }
  .nav-toggle-input:checked ~ .nav-toggle span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
  .nav-toggle-input:checked ~ .nav-toggle span:nth-child(2) { opacity: 0; }
  .nav-toggle-input:checked ~ .nav-toggle span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }
  .nav-cta { display: none; }

  .hero-container { gap: 2rem; }
  .hero-title { font-size: clamp(2.25rem, 6vw, 3rem); }

  .bento-grid { grid-template-columns: 1fr 1fr; }
  .bento-lg { grid-column: span 2; }

  .pflow-wrapper { flex-direction: column; gap: 1.5rem; }
  .pflow-state { position: static; text-align: center; max-width: unset; min-width: unset; }
  .pflow-diagram { flex-direction: column; gap: 0; }
  .pflow-trace { width: 3px; height: 30px; min-width: unset; max-width: unset; }
  .pflow-trace-pulse {
    width: 5px; height: 24px; left: -1px; top: -24px;
    background: linear-gradient(180deg, transparent, var(--accent), transparent);
    animation: pflow-move-v 2s linear infinite;
  }
  @keyframes pflow-move-v {
    0% { top: -24px; }
    100% { top: calc(100% + 24px); }
  }
  .pflow-trace-label { top: 50%; left: 20px; transform: translateY(-50%); }
  .pflow-node { min-width: 100px; padding: 1rem 1.5rem; }

  .pricing-grid { grid-template-columns: 1fr; }

  .footer-inner { flex-direction: column; text-align: center; }
  .footer-links { flex-wrap: wrap; justify-content: center; }
}

@media (max-width: 400px) {
  .bento-grid { grid-template-columns: 1fr; }
  .bento-lg { grid-column: span 1; }
  .conn-grid { grid-template-columns: 1fr 1fr; }
  .proc-name { min-width: 60px; }
}

/* --- 19. Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1; transform: none; }
  .pflow-reveal { opacity: 1; transform: none; }
  .pflow-section-reveal { opacity: 1; transform: none; }
  .bento-card.reveal.is-visible { animation: none; }
}
