/* HA Dispatch design tokens — dark is the only designed theme.
   Source: docs/design/tokens.css in straplocked/ha-dispatch. */
:root {
  --color-canvas: #07090d;
  --color-surface: #0d1117;
  --color-surface-2: #131a23;
  --color-line: #1f2a36;
  --color-hair: #182230;
  --color-ink: #e6edf3;
  --color-muted: #8b9bb0;
  --color-faint: #74849a;
  --color-accent: #5cff9d;
  --color-accent-soft: #0e2a1c;
  --color-accent-ink: #04150c;
  --color-critical: #ff4d6d;
  --color-critical-soft: #2a0f16;
  --color-warning: #ffb020;
  --color-warning-soft: #2a1e08;

  --font-display: 'Chakra Petch', 'Barlow', 'Arial Narrow', sans-serif;
  --font-sans: 'Barlow', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --radius-card: 6px;
  --radius-ctl: 4px;
  --radius-tag: 2px;
  --grid-size: 28px;
  --gutter: 16px;
  --max: 1200px;
}

*, *::before, *::after { box-sizing: border-box; }
html { color-scheme: dark; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.45;
  color: var(--color-ink);
  background-color: var(--color-canvas);
  background-image:
    linear-gradient(rgba(24, 34, 48, 0.4) 1px, transparent 1px),
    linear-gradient(90deg, rgba(24, 34, 48, 0.4) 1px, transparent 1px);
  background-size: var(--grid-size) var(--grid-size);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--color-accent); }
a:hover { color: #8dffbb; }
img { display: block; max-width: 100%; height: auto; }
h1, h2, h3 { margin: 0; font-family: var(--font-display); font-weight: 700; letter-spacing: 0.01em; line-height: 1.1; }
p { margin: 0; }
.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); }
.skip { position: absolute; left: -999px; top: 0; }
.skip:focus { left: 16px; top: 16px; background: var(--color-surface); padding: 8px 12px; z-index: 10; }

/* type styles */
.label { font-family: var(--font-mono); font-size: 10.5px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--color-faint); }
.label.accent { color: var(--color-accent); }
.key { font-family: var(--font-mono); font-size: 10.5px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--color-faint); }
.readout { font-family: var(--font-mono); font-size: 12px; color: var(--color-ink); }
.muted { color: var(--color-muted); }
.wordmark { font-family: var(--font-display); font-size: 15px; font-weight: 700; letter-spacing: 0.14em; color: var(--color-ink); }

.section-label { display: flex; align-items: center; gap: 12px; }
.section-label::after { content: ""; flex-grow: 1; height: 1px; background: var(--color-hair); }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 46px; padding: 0 22px;
  border-radius: var(--radius-ctl); border: 1px solid transparent;
  font-family: var(--font-display); font-size: 13px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  text-decoration: none; cursor: pointer; transition: transform 120ms ease-out;
}
.btn:active { transform: scale(0.99); }
.btn-primary { background: var(--color-accent); color: var(--color-accent-ink); }
.btn-primary:hover { background: #8dffbb; color: var(--color-accent-ink); }
.btn-secondary { background: var(--color-surface-2); color: var(--color-ink); border-color: var(--color-line); }
.btn-secondary:hover { color: var(--color-ink); background: #1a2330; }

.card { background: var(--color-surface); border: 1px solid var(--color-line); border-radius: var(--radius-card); padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.card h3 { font-size: 19px; }
.card p { font-size: 14px; color: var(--color-muted); }

.tag { display: inline-flex; align-self: flex-start; padding: 2px 7px; border-radius: var(--radius-tag); font-family: var(--font-mono); font-size: 11px; line-height: 16px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.tag-ok { background: var(--color-accent-soft); color: var(--color-accent); }
.tag-warning { background: var(--color-warning-soft); color: var(--color-warning); }
.tag-critical { background: var(--color-critical-soft); color: var(--color-critical); }

.shot { border: 1px solid var(--color-line); border-radius: var(--radius-card); background: var(--color-surface); }

/* HudCard — bracket corners; the one card allowed to shout */
.hud { position: relative; background: var(--color-surface); border: 1px solid rgba(92, 255, 157, 0.4); border-radius: var(--radius-tag); padding: 12px; }
.hud::before, .hud::after, .hud > .c1, .hud > .c2 { content: ""; position: absolute; width: 10px; height: 10px; border: 0 solid var(--color-accent); pointer-events: none; }
.hud::before { top: -1px; left: -1px; border-top-width: 2px; border-left-width: 2px; }
.hud::after { top: -1px; right: -1px; border-top-width: 2px; border-right-width: 2px; }
.hud > .c1 { bottom: -1px; left: -1px; border-bottom-width: 2px; border-left-width: 2px; }
.hud > .c2 { bottom: -1px; right: -1px; border-bottom-width: 2px; border-right-width: 2px; }

.kv { border-top: 1px solid var(--color-hair); }
.kv > div { display: flex; flex-direction: column; gap: 4px; padding: 12px 0; border-bottom: 1px solid var(--color-hair); }
.kv span:last-child { font-size: 14px; line-height: 1.4; }

.live { display: inline-flex; align-items: center; gap: 7px; }
.live::before { content: ""; width: 7px; height: 7px; border-radius: 9999px; background: var(--color-accent); box-shadow: 0 0 7px rgba(92, 255, 157, 0.67); }

/* nav */
.nav { position: sticky; top: 0; z-index: 5; height: 60px; background: var(--color-surface); border-bottom: 1px solid var(--color-hair); }
.nav .wrap { height: 100%; display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; }
.brand svg { width: 26px; height: 26px; }
.nav-links { display: none; align-items: center; gap: 32px; }
.nav-links a { font-family: var(--font-mono); font-size: 11px; font-weight: 600; letter-spacing: 0.1em; color: var(--color-muted); text-decoration: none; }
.nav-links a:hover { color: var(--color-ink); }
.nav .btn { min-height: 40px; padding: 0 14px; font-size: 12px; }

/* sections */
section { padding: 40px 0; }
section .wrap { display: flex; flex-direction: column; gap: 16px; }
h2 { font-size: 28px; text-wrap: balance; }
.lede { font-size: 15px; line-height: 1.5; color: var(--color-muted); }

.hero { padding: 40px 0 32px; }
.hero h1 { font-size: 40px; line-height: 1.02; text-wrap: balance; }
.hero .lede { font-size: 16px; }
.hero-actions { display: flex; flex-direction: column; gap: 10px; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 8px 24px; }
.hero-art { position: relative; margin-top: 8px; }
.hero-art .phone { width: 280px; margin: 0 auto; }
.hero-art .desk { display: none; }

.grid-3, .grid-4, .grid-2 { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }

.screens figure { margin: 0; display: flex; flex-direction: column; gap: 12px; }
.screens figcaption { display: flex; flex-direction: column; gap: 4px; }
.screens figcaption strong { font-size: 15px; font-weight: 600; }
.screens figcaption span:last-child { font-size: 13px; color: var(--color-muted); line-height: 1.45; }
.screens img { width: 100%; aspect-ratio: 390 / 460; object-fit: cover; object-position: top; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.facts .card { padding: 14px; gap: 6px; }
.facts .card span:first-child { font-family: var(--font-mono); font-size: 9.5px; font-weight: 600; letter-spacing: 0.1em; color: var(--color-faint); }
.facts .card span:last-child { font-family: var(--font-mono); font-size: 12px; line-height: 1.4; }

.consent-shot { width: 100%; aspect-ratio: 390 / 774; object-fit: cover; object-position: top; }
.scopes .card { padding: 14px; gap: 8px; }
.scopes .card span:last-child { font-size: 13px; color: var(--color-muted); }

.steps .card { flex-direction: row; gap: 16px; }
.steps .num { font-family: var(--font-display); font-size: 28px; line-height: 0.95; font-weight: 700; color: var(--color-accent); width: 44px; flex-shrink: 0; }
.steps .card > div { display: flex; flex-direction: column; gap: 8px; }
.steps .readout { color: var(--color-faint); }

form.card { gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; }
input[type=text], input[type=email], textarea {
  width: 100%; min-height: 46px; padding: 10px 12px;
  background: var(--color-canvas); border: 1px solid var(--color-line); border-radius: var(--radius-ctl);
  color: var(--color-ink); font-family: var(--font-sans); font-size: 16px; line-height: 1.4;
}
textarea { resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--color-faint); }
input:focus, textarea:focus { outline: 2px solid var(--color-accent); outline-offset: 0; border-color: var(--color-accent); }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--color-muted); }
.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--color-accent); }
.contact-kv > div { flex-direction: row; gap: 16px; align-items: baseline; }
.contact-kv .key { width: 100px; flex-shrink: 0; }
.contact-kv span:last-child, .contact-kv a { font-family: var(--font-mono); font-size: 13px; text-decoration: none; }

footer { padding: 24px 0; border-top: 1px solid var(--color-hair); background: var(--color-surface); }
footer .wrap { display: flex; flex-direction: column; gap: 10px; }
footer .readout { font-size: 11px; letter-spacing: 0.04em; color: var(--color-faint); line-height: 1.4; }

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } .btn { transition: none; } }

/* ≥ 768px */
@media (min-width: 768px) {
  :root { --gutter: 40px; }
  .nav { height: 72px; }
  .nav-links { display: flex; }
  .nav .btn { min-height: 40px; padding: 0 18px; font-size: 13px; }
  section { padding: 80px 0; }
  section .wrap { gap: 32px; }
  h2 { font-size: 36px; }
  .lede { font-size: 16px; }
  .hero { padding: 96px 0 88px; }
  .hero .wrap { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 64px; align-items: center; }
  .hero-copy { display: flex; flex-direction: column; gap: 24px; }
  .hero h1 { font-size: 56px; }
  .hero .lede { font-size: 18px; max-width: 520px; }
  .hero-actions { flex-direction: row; }
  .hero-art { height: 560px; margin: 0; }
  .hero-art .desk { display: block; position: absolute; left: 0; top: 0; width: 100%; max-width: 600px; aspect-ratio: 600 / 375; object-fit: cover; object-position: left top; }
  .hero-art .phone { position: absolute; right: 0; bottom: 0; width: 236px; margin: 0; }
  .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .card { padding: 24px; }
  .facts { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
  .wrap.split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 64px; align-items: center; }
  .wrap.split > div { display: flex; flex-direction: column; gap: 20px; }
  .wrap.split.top { align-items: start; }
  .kv > div { flex-direction: row; gap: 16px; align-items: baseline; }
  .kv .key { width: 120px; flex-shrink: 0; }
  .kv span:last-child { font-size: 15px; }
  .consent-shot { max-width: 420px; justify-self: end; }
  .steps .card { flex-direction: column; gap: 12px; }
  .steps .num { font-size: 32px; width: auto; }
  footer { padding: 32px 0; }
  footer .wrap { flex-direction: row; align-items: center; justify-content: space-between; }
}

/* ≥ 1100px */
@media (min-width: 1100px) {
  :root { --gutter: 120px; --max: 1440px; }
  .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .screens .grid-4 { gap: 24px; }
  .screens img { aspect-ratio: 264 / 596; }
  .wrap.split.screen { grid-template-columns: 560px minmax(0, 1fr); }
  .wrap.split.trust { grid-template-columns: minmax(0, 1fr) 420px; }
  .wrap.split.contact { grid-template-columns: minmax(0, 1fr) 560px; }
}

/* Home hero: floor-plan art instead of console screenshots */
.hero-art.plan { height: auto; }

/* Card that links out (home → dispatch page) */
.cta-card { color: var(--color-ink); text-decoration: none; }
.cta-card > div { display: flex; flex-direction: column; gap: 8px; }
.cta-card strong { font-size: 15px; font-weight: 600; line-height: 1.4; }
.cta-card .arrow { font-family: var(--font-mono); font-size: 11px; font-weight: 600; letter-spacing: 0.1em; color: var(--color-accent); flex-shrink: 0; }
.cta-card:hover { border-color: var(--color-accent); color: var(--color-ink); }
@media (min-width: 768px) {
  .cta-card { flex-direction: row; align-items: center; justify-content: space-between; gap: 24px; }
}

/* Footer links */
.footer-links { display: flex; flex-wrap: wrap; gap: 10px 24px; }
.footer-links a { font-family: var(--font-mono); font-size: 11px; font-weight: 600; letter-spacing: 0.1em; color: var(--color-muted); text-decoration: none; }
.footer-links a:hover { color: var(--color-ink); }
