/* Shared styles for pm-connector.hendrikvh.com. Ported from the on-device
   web UI's design tokens (components/pm_connector/web_ui_assets.h) so the
   site and the device feel like the same product. Kept as one plain
   stylesheet, no build step - matches how the rest of this project's web UI
   work is done. */

:root {
  --bg: #f4f6f5;
  --surface: #ffffff;
  --surface-2: #eef1f0;
  --surface-3: #e3e7e5;
  --border: #d8dedb;
  --text: #1b2224;
  --text-dim: #5b6669;
  --text-faint: #6a736f;
  --accent: #eb8500;
  --accent-2: #ffad0a;
  --accent-rgb: 235, 133, 0;
  --accent-ink: #372610;
  --accent-text: #994700;
  --success: #22a050;
  --danger: #c94040;
  --glow: #f9efe2;
  --hero-tint: #f4e9db;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --font-display: "Space Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0f10;
    --surface: #17191b;
    --surface-2: #1e2124;
    --surface-3: #262a2d;
    --border: #2a2d30;
    --text: #f2f4f3;
    --text-dim: #9aa3a0;
    --text-faint: #818a86;
    --accent: #ffa229;
    --accent-2: #ffc552;
    --accent-rgb: 255, 162, 41;
    --accent-ink: #251909;
    --accent-text: #ffa229;
    --success: #69d390;
    --glow: #211609;
    --hero-tint: #291d10;
  }
}

* { box-sizing: border-box; }
html { height: 100%; color-scheme: light dark; }
body {
  min-height: 100%;
  margin: 0;
  background-color: var(--bg);
  background-image:
    repeating-linear-gradient(0deg, rgba(var(--accent-rgb), 0.05) 0 1px, transparent 1px 88px),
    repeating-linear-gradient(90deg, rgba(var(--accent-rgb), 0.05) 0 1px, transparent 1px 88px);
  background-attachment: fixed;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}
.wrap { max-width: 640px; margin: 0 auto; padding: calc(18px + env(safe-area-inset-top)) 18px 40px; }
.wrap-wide { max-width: 760px; }
h1, h2, h3 { margin: 0; font-family: var(--font-display); }
a { color: var(--accent-text); }
.eyebrow {
  font-family: var(--font-mono); font-size: 11.5px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--accent-text);
}

/* ---------- topbar / brand ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 2px 0 22px; }
.topbar a.home-link { text-decoration: none; }
.brand { display: flex; align-items: center; gap: 11px; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 13px; flex: none;
  background: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.16);
  display: flex; align-items: center; justify-content: center;
}
.brand-mark svg { width: 36px; height: 36px; }
.brand-title { font-family: var(--font-display); font-size: 17px; font-weight: 700; letter-spacing: -0.01em; color: var(--text); }
.brand-sub { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-faint); margin-top: 1px; letter-spacing: 0.01em; }
.back-link {
  font-size: 13px; font-weight: 600; color: var(--text-dim); text-decoration: none;
  display: inline-flex; align-items: center; gap: 4px;
}
.back-link:hover { color: var(--accent-text); }
.back-link svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- hero ---------- */
.hero {
  border-radius: var(--radius-lg); padding: 30px 24px 28px; margin-bottom: 22px;
  background: var(--surface);
  border: 1px solid var(--border); position: relative; overflow: hidden;
}
.hero::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-2) 50%, var(--accent) 100%);
}
.hero::after {
  content: ""; position: absolute; z-index: 0; width: 200px; height: 200px; right: -90px; top: -100px; border-radius: 50%;
  background: radial-gradient(circle, var(--glow), transparent 72%);
}
.hero > * { position: relative; z-index: 1; }
.hero h1 { font-size: 27px; font-weight: 700; letter-spacing: -0.015em; margin-top: 9px; max-width: 20ch; }
.hero p { margin: 12px 0 0; color: var(--text-dim); font-size: 14.5px; max-width: 42ch; }
.hero-cta { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-top: 20px; }
.hero-cta .btn { padding: 12px 24px; font-size: 15px; }
.hero-note { font-family: var(--font-mono); font-size: 12px; color: var(--text-faint); }

/* ---------- sections & cards ---------- */
h2.section-title {
  font-family: var(--font-mono);
  font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700;
  color: var(--text-faint); margin: 30px 0 12px;
}
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 16px 18px 18px; margin-bottom: 12px;
}
.card > h2 {
  margin: -16px -18px 14px; padding: 11px 18px;
  background: linear-gradient(180deg, rgba(var(--accent-rgb), 0.06), rgba(var(--accent-rgb), 0.02)), var(--surface-2);
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  font-size: 14px; font-weight: 700; color: var(--text);
}
.card > h2::before {
  content: ""; display: inline-block; vertical-align: -1px;
  width: 3px; height: 11px; margin-right: 8px; border-radius: 2px;
  background: var(--accent);
}
.card p { color: var(--text-dim); font-size: 14px; margin: 0 0 10px; }
.card p:last-child { margin-bottom: 0; }
.card .muted { color: var(--text-faint); font-size: 12.5px; }
.card ol { padding-left: 1.2rem; margin: 0; }
.card li { margin: 6px 0; color: var(--text-dim); font-size: 14px; }
.card li strong { color: var(--text); }

/* ---------- signal-chain diagram (site/index.html hero signature) ----------
   A small schematic of what the device actually does: PM3 in over a wire,
   BLE/WiFi/ANT+ out over the air. Deliberately not another icon-badge grid. */
.signal-chain {
  background: var(--hero-tint); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 18px 18px 14px; margin-bottom: 8px;
}
.signal-chain svg { display: block; width: 100%; height: auto; overflow: visible; }
.signal-chain .sc-line { stroke: var(--text-faint); stroke-width: 1.6; fill: none; }
.signal-chain .sc-line-wired { stroke: var(--accent-text); }
.signal-chain .sc-line-wireless { stroke: var(--text-faint); stroke-dasharray: 3 4; }
.signal-chain .sc-box { fill: var(--surface); stroke: var(--border); stroke-width: 1.4; }
.signal-chain .sc-box-product { stroke: var(--accent); stroke-width: 1.8; }
.signal-chain .sc-label { font-family: var(--font-mono); font-size: 10.5px; font-weight: 700; fill: var(--text); }
.signal-chain .sc-label-sub { font-family: var(--font-mono); font-size: 8.5px; fill: var(--text-faint); letter-spacing: 0.03em; }
.signal-chain .sc-icon { stroke: var(--text-dim); fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.signal-chain .sc-led { fill: var(--success); animation: sc-blink 2.6s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .signal-chain .sc-led { animation: none; } }
@keyframes sc-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
.signal-caption {
  font-size: 12.5px; color: var(--text-faint); text-align: center; margin: 10px 0 26px;
}

/* Compact spec sheet: what the device actually does, styled as a rating-plate
   list rather than a row of icon cards. */
.spec-list { border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; background: var(--surface); }
.spec-row {
  display: grid; grid-template-columns: 88px 1fr; gap: 14px;
  padding: 13px 16px; border-bottom: 1px solid var(--border);
}
.spec-row:last-child { border-bottom: none; }
.spec-key { font-family: var(--font-mono); font-size: 11.5px; font-weight: 700; letter-spacing: 0.03em; color: var(--accent-text); text-transform: uppercase; padding-top: 1px; }
.spec-val { font-size: 13.5px; color: var(--text-dim); line-height: 1.5; }

/* Quick links back into the guided setup, for a returning visitor - a plain
   list, not a repeat of the spec sheet's card treatment. */
.quick-links { display: flex; flex-direction: column; gap: 2px; }
.quick-link {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 4px; text-decoration: none; color: var(--text);
  border-bottom: 1px solid var(--border); font-size: 14px; font-weight: 600;
}
.quick-link:last-child { border-bottom: none; }
.quick-link:hover { color: var(--accent-text); }
.quick-link svg { width: 15px; height: 15px; flex: none; stroke: var(--text-faint); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.quick-link:hover svg { stroke: var(--accent-text); }

/* ---------- form controls & buttons ---------- */
button, .btn {
  background: var(--accent); color: var(--accent-ink); border: none;
  border-radius: 999px; padding: 11px 18px; cursor: pointer; font-size: 14px; font-weight: 700;
  box-shadow: 0 4px 14px -6px rgba(var(--accent-rgb), 0.6); font-family: inherit;
}
.btn { text-decoration: none; display: inline-block; }
button:hover, .btn:hover { filter: brightness(1.06); }
button:disabled, .btn:disabled { background: var(--surface-3); color: var(--text-faint); cursor: not-allowed; box-shadow: none; }
button:focus-visible, .btn:focus-visible, a:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; }

label { display: block; font-size: 13px; font-weight: 600; color: var(--text-dim); margin-bottom: 5px; }
input[type="text"], input[type="password"] {
  font-size: 14px; padding: 10px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface-2); color: inherit;
  width: 100%; max-width: 22rem; box-sizing: border-box; font-family: inherit;
}
input[type="text"]:focus, input[type="password"]:focus {
  outline: none; border-color: var(--accent); background: var(--surface);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.16);
}

code {
  font-size: 0.92em; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 5px; padding: 0.1em 0.4em;
}

/* ---------- guided setup stepper (site/getting-started.html) ----------
   Alpine drives the open/done state; everything here is presentation only. */
[x-cloak] { display: none !important; }

.progress-bar { display: flex; align-items: center; gap: 12px; margin: 0 0 16px; }
.progress-track {
  flex: 1; height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden;
}
.progress-fill {
  height: 100%; border-radius: 999px; width: 0;
  background: var(--accent);
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.progress-label { font-family: var(--font-mono); font-size: 11.5px; font-weight: 700; color: var(--text-dim); flex: none; }
.progress-reset {
  font-size: 12px; color: var(--text-faint); text-decoration: none; flex: none;
  border-bottom: 1px dotted currentColor;
}
.progress-reset:hover { color: var(--accent-text); }

.step {
  position: relative; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); margin-bottom: 12px;
  transition: border-color 0.2s;
}
.step.is-open { border-color: rgba(var(--accent-rgb), 0.45); }
.step.is-done { border-color: rgba(34, 160, 80, 0.4); }
/* Connector drawn in the 12px gap below each card, so the five cards read as
   one track. Turns green behind a completed step. */
.step:not(:last-of-type)::after {
  content: ""; position: absolute; left: 33px; top: 100%; width: 2px; height: 12px;
  background: var(--border);
}
.step.is-done:not(:last-of-type)::after { background: rgba(34, 160, 80, 0.45); }

.step-head {
  display: flex; align-items: center; gap: 13px; padding: 14px 16px; cursor: pointer;
  user-select: none;
}
.step-head:focus-visible { outline: 2px solid var(--accent-text); outline-offset: -2px; border-radius: var(--radius-lg); }
.step-badge {
  width: 34px; height: 34px; flex: none; border-radius: 50%; border: none; padding: 0;
  background: var(--surface-3); color: var(--text-dim); font-family: var(--font-mono);
  font-size: 13px; font-weight: 700; box-shadow: none;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s, color 0.2s, transform 0.2s;
}
.step-badge:hover { transform: scale(1.08); filter: none; }
.step.is-open .step-badge {
  background: var(--accent); color: var(--accent-ink);
  box-shadow: 0 4px 12px -5px rgba(var(--accent-rgb), 0.7);
}
.step.is-done .step-badge, .step.is-done.is-open .step-badge {
  background: var(--success); color: #fff; box-shadow: none;
}
.step-badge svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.step-headings { flex: 1; min-width: 0; }
.step-title { display: block; font-family: var(--font-display); font-size: 15px; font-weight: 700; color: var(--text); }
.step.is-done .step-title { color: var(--text-dim); }
.step-sub { display: block; font-size: 12.5px; color: var(--text-faint); margin-top: 1px; }
.step-tag {
  flex: none; font-family: var(--font-mono); font-size: 10px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 999px; background: var(--surface-2);
  border: 1px solid var(--border); color: var(--text-faint);
}
.step-tag.price { background: rgba(var(--accent-rgb), 0.12); border-color: rgba(var(--accent-rgb), 0.35); color: var(--accent-text); }
.step-chev {
  width: 17px; height: 17px; flex: none; stroke: var(--text-faint); fill: none;
  stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round;
  transition: transform 0.25s;
}
.step.is-open .step-chev { transform: rotate(180deg); }
.step-body { padding: 0 16px 16px 63px; }
@media (max-width: 480px) { .step-body { padding-left: 16px; } }
.step-body > p { color: var(--text-dim); font-size: 14px; margin: 0 0 10px; }
.step-body ol, .step-body ul { padding-left: 1.15rem; margin: 0 0 10px; }
.step-body li { margin: 6px 0; color: var(--text-dim); font-size: 14px; }
.step-body li strong { color: var(--text); }
.step-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 14px; }

/* Secondary / ghost button, for "mark as done" and back links inside steps. */
.btn-ghost {
  background: var(--surface-2); color: var(--text-dim); border: 1px solid var(--border);
  box-shadow: none; font-weight: 600;
}
.btn-ghost:hover { filter: none; border-color: rgba(var(--accent-rgb), 0.5); color: var(--text); }
.btn-done { background: rgba(34, 160, 80, 0.14); border-color: rgba(34, 160, 80, 0.45); color: var(--success); }

/* Callouts inside steps: a required-hardware warning, a success result. */
.callout {
  border: 1px solid var(--border); border-left: 3px solid var(--text-faint);
  background: var(--surface-2); border-radius: var(--radius-sm);
  padding: 11px 13px; margin: 0 0 12px; font-size: 13.5px; color: var(--text-dim);
}
.callout strong { color: var(--text); }
.callout.warn { border-left-color: var(--accent); background: rgba(var(--accent-rgb), 0.07); }
.callout.good { border-left-color: var(--success); background: rgba(34, 160, 80, 0.09); }
.callout p { margin: 0 0 6px; }
.callout p:last-child { margin-bottom: 0; }

/* Buy links: one row per retailer. */
.buy-link {
  display: flex; align-items: center; gap: 11px; text-decoration: none;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 11px 13px; margin-bottom: 8px; color: var(--text);
}
.buy-link:hover { border-color: rgba(var(--accent-rgb), 0.5); }
.buy-link-where { flex: 1; font-size: 14px; font-weight: 700; }
.buy-link-note { display: block; font-size: 12px; font-weight: 500; color: var(--text-faint); margin-top: 1px; }
.buy-link svg { width: 16px; height: 16px; flex: none; stroke: var(--text-faint); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Inline status line with an optional spinner, used by the Bluetooth flows. */
.status-line { display: flex; align-items: center; gap: 9px; font-size: 13.5px; color: var(--text-dim); margin: 12px 0 0; }
.spinner {
  width: 15px; height: 15px; flex: none; border-radius: 50%;
  border: 2px solid var(--surface-3); border-top-color: var(--accent);
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.device-link {
  display: inline-flex; align-items: center; gap: 7px; font-size: 15px; font-weight: 700;
  word-break: break-all;
}

details.helper { margin-top: 12px; }
details.helper > summary {
  cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text-dim);
  list-style: none; display: inline-flex; align-items: center; gap: 5px;
}
details.helper > summary::-webkit-details-marker { display: none; }
details.helper > summary::before { content: "+"; font-weight: 800; color: var(--accent-text); }
details.helper[open] > summary::before { content: "\2212"; }
details.helper > summary:hover { color: var(--accent-text); }
details.helper .helper-body { padding: 9px 0 0 14px; font-size: 13px; color: var(--text-faint); }
details.helper .helper-body p { margin: 0 0 7px; }

/* ---------- WiFi network picker (site/discover.html) ---------- */
.wifi-list { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; max-width: 22rem; }
.wifi-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 14px; text-align: left;
  font-size: 14px; font-weight: 600; box-shadow: none;
}
.wifi-item:hover { border-color: rgba(var(--accent-rgb), 0.5); filter: none; }
.wifi-item-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wifi-item-meta { font-family: var(--font-mono); font-size: 11.5px; font-weight: 600; color: var(--text-faint); flex: none; }

/* ---------- attention pulse (e.g. site/flash.html's next-step card, once the
   ESP Web Tools install dialog closes) ---------- */
@keyframes pulse-highlight {
  0%, 100% { box-shadow: 0 0 0 0 rgba(var(--accent-rgb), 0); }
  50% { box-shadow: 0 0 0 6px rgba(var(--accent-rgb), 0.25); }
}
.highlight-pulse { animation: pulse-highlight 1.1s ease-in-out 3; border-color: var(--accent); }

/* ---------- footer ---------- */
.site-footer { margin-top: 30px; padding-top: 18px; border-top: 1px solid var(--border); }
.site-footer p { margin: 0; font-size: 12px; color: var(--text-faint); }
