/* tern-sidepulse canonical site. Tokens from docs/BRAND.md. Fonts are first-party latin
   subsets in site/fonts (Space Grotesk and JetBrains Mono, OFL-1.1); no remote font requests. */
@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("fonts/space-grotesk-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url("fonts/jetbrains-mono-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
:root {
  color-scheme: dark;
  --ground: #060809;
  --raised: #0b0e11;
  --surface: #0e1319;
  --surface-press: #131a22;
  --border-subtle: #161c22;
  --border: #1c232b;
  --border-strong: #2a343e;
  --ink: #e8ecef;
  --body: #b6bec7;
  --muted: #8a939d;
  --faint: #78828d;
  --pane: #70b3f7;
  --pane-bright: #97c9fd;
  --pane-wash: rgba(112,179,247,0.08);
  --danger: #c85045;
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --font-display: "Space Grotesk", var(--font-sans);
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --wrap: 1120px;
  --measure: 62ch;
  --gutter: clamp(20px, 4vw, 40px);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--ground);
  color: var(--body);
  font: 16px/1.6 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--pane); text-decoration: none; text-underline-offset: 0.18em; }
a:hover { color: var(--pane-bright); text-decoration: underline; }
:focus-visible { outline: 2px solid var(--pane); outline-offset: 2px; border-radius: 4px; }
code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  color: var(--ink);
  background: var(--raised);
  border: 1px solid var(--border-subtle);
  padding: 0.05em 0.4em;
  border-radius: 5px;
  overflow-wrap: anywhere;
}
pre {
  margin: 0;
  padding: 14px 16px;
  background: var(--raised);
  border: 1px solid var(--border);
  border-radius: 10px;
  font: 13.5px/1.6 var(--font-mono);
  color: var(--ink);
  overflow-x: auto;
  tab-size: 2;
}
pre code { background: none; border: 0; padding: 0; font-size: inherit; }
pre .c { color: var(--muted); }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }

/* Header */
header.site { position: sticky; top: 0; z-index: 10; background: rgba(6, 8, 9, 0.86); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--border-subtle); }
section[id] { scroll-margin-top: 84px; }
header.site .wrap { display: flex; align-items: center; gap: 10px 24px; flex-wrap: wrap; min-height: 60px; padding-top: 10px; padding-bottom: 10px; }
header.site .brand { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; color: var(--ink); font-family: var(--font-display); font-weight: 600; font-size: 16px; letter-spacing: -0.015em; white-space: nowrap; }
header.site .brand:hover { text-decoration: none; color: var(--ink); }
header.site .brand img { width: 24px; height: 24px; }
header.site nav { margin-left: auto; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
header.site nav::-webkit-scrollbar { display: none; }
header.site nav a { color: var(--muted); font-size: 14px; padding: 6px 9px; border-radius: 6px; white-space: nowrap; }
header.site nav a:hover { color: var(--ink); background: var(--raised); text-decoration: none; }
header.site nav a[aria-current] { color: var(--ink); }
header.site nav a.ext::after { content: " \2197"; color: var(--faint); font-size: 12px; }
@media (max-width: 959px) {
  /* Two rows on narrow screens: the wordmark, then an edge-to-edge scrolling nav. */
  header.site { position: static; }
  section[id] { scroll-margin-top: 0; }
  header.site nav { margin-left: calc(-1 * var(--gutter)); margin-right: calc(-1 * var(--gutter)); padding: 0 calc(var(--gutter) - 9px); flex-basis: 100%; }
}
@media (max-width: 720px) { pre { font-size: 13px; padding: 12px 14px; } }

/* Type */
h1, h2, h3 { color: var(--ink); margin: 0; font-family: var(--font-display); font-weight: 600; letter-spacing: -0.02em; text-wrap: balance; }
h1 code, h2 code, h3 code { background: none; border: 0; padding: 0; font-size: 0.92em; font-weight: 600; color: inherit; }
h1 { font-size: clamp(2.25rem, 1rem + 3vw, 3.25rem); line-height: 1.04; letter-spacing: -0.03em; }
h2 { font-size: clamp(1.625rem, 1.2rem + 1.5vw, 2.25rem); line-height: 1.12; letter-spacing: -0.025em; }
h3 { font-size: 1.125rem; line-height: 1.3; letter-spacing: -0.012em; }
p { margin: 0; }
p + p { margin-top: 1em; }
.lede { font-size: clamp(1.0625rem, 1rem + 0.4vw, 1.25rem); line-height: 1.55; max-width: var(--measure); text-wrap: pretty; }
.eyebrow { color: var(--pane); font: 600 12px/1.4 var(--font-mono); text-transform: uppercase; letter-spacing: 0.14em; margin: 0 0 14px; }
.eyebrow.muted { color: var(--muted); }
.accent { color: var(--pane); }
.kin { display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: #f97316; margin: 0 5px 2px; }
.measure { max-width: var(--measure); }
.nowrap { white-space: nowrap; }
.small { font-size: 14px; color: var(--muted); }
.small a { color: var(--body); text-decoration: underline; text-decoration-color: var(--border-strong); }
.small a:hover { color: var(--ink); text-decoration-color: currentColor; }
strong { color: var(--ink); font-weight: 600; }
ul { margin: 0; padding-left: 1.2em; }
li { margin: 0.45em 0; }
li::marker { color: var(--faint); }
hr { border: 0; border-top: 1px solid var(--border-subtle); margin: 0; }

/* Buttons */
.cta {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 20px; border-radius: 10px;
  background: var(--pane); color: var(--raised); font-weight: 600; font-size: 15px;
  border: 1px solid transparent;
}
.cta:hover { background: var(--pane-bright); color: var(--raised); text-decoration: none; }
.cta.secondary { background: transparent; color: var(--ink); border-color: var(--border-strong); }
.cta.secondary:hover { background: var(--raised); border-color: var(--muted); color: var(--ink); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

/* Sections */
section { padding: clamp(56px, 8vw, 104px) 0; border-top: 1px solid var(--border-subtle); }
section > .wrap > h2 { max-width: 22ch; }
.section-head { display: grid; gap: 16px; align-items: end; margin-bottom: clamp(28px, 4vw, 48px); }
.section-head p { max-width: var(--measure); }
@media (min-width: 900px) {
  .section-head { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 48px; }
  .section-head p { margin: 0; }
}
.section-note { margin-top: 18px; }

/* Hero */
.hero { border-top: 0; padding-top: clamp(32px, 5vw, 64px); position: relative; }
.hero .wrap { display: grid; gap: clamp(36px, 5vw, 56px); }
.hero .wrap > * { min-width: 0; }
.hero h1 { max-width: 30ch; }
.hero h1 .line { display: block; }
.hero .lede { margin-top: 22px; max-width: 70ch; }
.hero .facts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 26px 0 0; padding: 0; list-style: none; }
.hero .facts li.label { font: 600 11px/1 var(--font-mono); color: var(--faint); letter-spacing: 0.14em; text-transform: uppercase; border: 0; background: none; padding: 0; margin-right: 4px; }
.hero .facts li.label::before { display: none; }
.hero .facts li { margin: 0; font: 500 12.5px/1.4 var(--font-mono); color: var(--muted); display: inline-flex; align-items: center; gap: 8px; min-height: 28px; max-width: 100%; padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--raised); }
.hero .facts li::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--pane); flex: none; }
.hero .facts a { color: inherit; }
.hero .facts a:hover { color: var(--ink); }
.demo { margin: 0; width: 100%; display: grid; gap: 12px; }
.demo > * { min-width: 0; }
.demo .frame { border: 1px solid var(--border-strong); border-radius: 14px; background: var(--ground); overflow: hidden; box-shadow: 0 30px 80px -40px rgba(0, 0, 0, 0.9); }
.demo video { width: 100%; height: auto; display: block; aspect-ratio: 16 / 9; background: var(--ground); }
.demo figcaption { font-size: 12.5px; color: var(--muted); text-wrap: pretty; max-width: var(--measure); }
.demo figcaption code { font-size: 12px; }

/* SidePulse's default programs are illustration, not LED evidence. Status colors stay here. */
.states { --led-cyan: #00E5FF; --led-amber: #FF3A00; --led-green: #00FF66; --led-dim: #006060; display: grid; list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }
.states > li { margin: 0; padding: 24px 0; border-bottom: 1px solid var(--border); display: grid; gap: 16px; align-items: center; }
.states .state-visual { min-width: 0; display: grid; gap: 10px; }
.states .edge { position: relative; width: 244px; max-width: 100%; height: 56px; border-radius: 10px; background: linear-gradient(180deg, #C9CDD2 0%, #B9BEC5 55%, #8F959D 100%); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.25), 0 14px 30px -16px rgba(0, 0, 0, 0.9); }
.states .edge::before { content: ""; position: absolute; left: 16px; right: 16px; top: 20px; height: 16px; border-radius: 8px; background: #0A0C0E; box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.9); }
.states .leds { position: absolute; left: 24px; right: 24px; top: 23px; height: 10px; display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.states .led { height: 10px; border-radius: 5px; background: #111518; --c: var(--led-cyan); }
.states .program { color: var(--muted); font: 500 11.5px/1.4 var(--font-mono); }
.states .status { font-size: 14px; }
.states .status code { padding: 0; border: 0; background: none; font-size: 13px; }
.states .condition { font-size: 15px; }
.states .note { display: block; margin-top: 4px; color: var(--muted); font-size: 13.5px; }
.states .leds[data-prog="cyan-roll"] { --duration: 760ms; }
.states .leds[data-prog="cyan-roll"] .led { animation: roll 760ms ease-in-out infinite; }
.states .leds[data-prog="cyan-roll"] .led:nth-child(1) { animation-delay: 0ms; }
.states .leds[data-prog="cyan-roll"] .led:nth-child(2) { animation-delay: 95ms; }
.states .leds[data-prog="cyan-roll"] .led:nth-child(3) { animation-delay: 190ms; }
.states .leds[data-prog="cyan-roll"] .led:nth-child(4) { animation-delay: 285ms; }
.states .leds[data-prog="cyan-roll"] .led:nth-child(5) { animation-delay: 380ms; }
.states .leds[data-prog="cyan-roll"] .led:nth-child(6) { animation-delay: 475ms; }
.states .leds[data-prog="cyan-roll"] .led:nth-child(7) { animation-delay: 570ms; }
.states .leds[data-prog="cyan-roll"] .led:nth-child(8) { animation-delay: 665ms; }
@keyframes roll {
  0%, 100% { background: #111518; box-shadow: none; }
  50% { background: var(--led-cyan); box-shadow: 0 0 10px 2px rgba(0, 229, 255, 0.75), 0 0 28px 6px rgba(0, 229, 255, 0.25); }
}
.states .leds[data-prog="amber-pulse"] { --duration: 1.6s; }
.states .leds[data-prog="amber-pulse"] .led { --c: var(--led-amber); animation: amber 1.6s ease-in-out infinite; }
@keyframes amber {
  0%, 100% { background: #111518; box-shadow: none; }
  50% { background: var(--led-amber); box-shadow: 0 0 10px 2px rgba(255, 58, 0, 0.75), 0 0 28px 6px rgba(255, 58, 0, 0.25); }
}
.states .leds[data-prog="solid-green"] .led { background: var(--led-green); box-shadow: 0 0 10px 2px rgba(0, 255, 102, 0.75), 0 0 28px 6px rgba(0, 255, 102, 0.25); }
.states .leds[data-prog="idle-pulse"] { --duration: 4s; }
.states .leds[data-prog="idle-pulse"] .led { animation: idle 4s ease-in-out infinite; }
.states .leds[data-prog="idle-pulse"] .led:nth-child(3), .states .leds[data-prog="idle-pulse"] .led:nth-child(6) { --c: var(--led-dim); }
.states .leds[data-prog="idle-pulse"] .led:nth-child(1), .states .leds[data-prog="idle-pulse"] .led:nth-child(2), .states .leds[data-prog="idle-pulse"] .led:nth-child(7), .states .leds[data-prog="idle-pulse"] .led:nth-child(8) { animation: none; }
@keyframes idle {
  0%, 50%, 100% { background: #111518; box-shadow: none; }
  75% { background: var(--c); box-shadow: 0 0 10px 2px color-mix(in srgb, var(--c) 60%, transparent); }
}
@media (min-width: 640px) {
  .states > li { grid-template-columns: 244px minmax(0, 1fr); gap: 8px 28px; }
  .states .state-visual { grid-row: 1 / span 2; }
  .states .condition { grid-column: 2; }
}
@media (min-width: 960px) {
  .states > li { grid-template-columns: 244px 190px minmax(0, 1fr); gap: 28px; }
  .states .state-visual { grid-row: auto; }
  .states .condition { grid-column: auto; }
}
@media (prefers-reduced-motion: reduce) {
  /* Pause every animated LED at its own 50% keyframe, including idle's unlit midpoint. */
  .states .leds .led { animation-play-state: paused !important; animation-delay: calc(var(--duration, 0s) * -0.5) !important; }
}

/* Pipeline */
.pipeline { display: grid; gap: 12px; list-style: none; margin: 0; padding: 0; }
.pipeline li { position: relative; margin: 0; min-width: 0; display: grid; gap: 6px; padding: 18px 18px 20px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; align-content: start; }
.pipeline li.handoff { background: transparent; border-style: dashed; }
.pipeline .node { font: 600 13px/1.3 var(--font-mono); color: var(--ink); display: flex; align-items: center; gap: 8px; }
.pipeline .node::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--pane); flex: none; }
.pipeline li.handoff .node::before { background: transparent; border: 2px solid var(--pane); width: 6px; height: 6px; }
.pipeline .where { font: 500 11.5px/1.4 var(--font-mono); color: var(--muted); letter-spacing: 0.04em; }
.pipeline p { font-size: 14px; color: var(--body); }
.pipeline code { min-width: 0; background: none; border: 0; padding: 0; color: var(--ink); }
.pipeline .node code { font-size: inherit; }
.pipeline li + li::before { content: "\2193"; position: absolute; top: -14px; left: 18px; width: 18px; height: 18px; display: grid; place-items: center; font-size: 13px; color: var(--muted); background: var(--ground); }
@media (min-width: 1000px) {
  .pipeline { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
  .pipeline li + li::before { content: "\2192"; top: 50%; left: -16px; transform: translateY(-50%); }
}

/* Card grids */
.grid { display: grid; gap: 14px; list-style: none; margin: 0; padding: 0; }
.grid > li, .grid > div { margin: 0; min-width: 0; padding: 20px 20px 22px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; display: grid; gap: 8px; align-content: start; }
.grid h3 { font-size: 1rem; }
.grid p { font-size: 14.5px; color: var(--body); }
.grid p a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--border-strong); }
.grid p a:hover { text-decoration-color: currentColor; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 960px) { .grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* Setup */
.setup { display: grid; gap: 28px; list-style: none; margin: 0; padding: 0; counter-reset: setup; }
.setup > li { margin: 0; display: grid; gap: 14px; grid-template-columns: 36px minmax(0, 1fr); counter-increment: setup; }
.setup > li::before { content: counter(setup); grid-row: 1; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--border-strong); color: var(--ink); font: 600 14px/1 var(--font-mono); background: var(--raised); }
.setup > li > * { grid-column: 2; min-width: 0; }
.setup h3 { align-self: center; }
.setup p { font-size: 15px; max-width: var(--measure); }
.setup .snippet { margin-top: 2px; display: grid; border: 1px solid var(--border); border-radius: 10px; background: var(--raised); overflow: hidden; }
.setup .snippet pre { border: 0; border-radius: 0; }
.snippet-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 8px 6px 16px; border-bottom: 1px solid var(--border); }
.snippet-bar .lang { font: 500 11.5px/1 var(--font-mono); color: var(--faint); letter-spacing: 0.08em; text-transform: uppercase; }
.copy-button { min-height: 30px; padding: 0 10px; border-radius: 7px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); font: 500 12px/1 var(--font-mono); cursor: pointer; }
.copy-button:hover { color: var(--ink); border-color: var(--border-strong); }
.copy-button[data-done] { color: var(--pane); border-color: var(--pane); }
.setup-wrap { display: grid; gap: 40px; }
.setup-aside { display: grid; gap: 18px; padding: 22px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); align-self: start; }
@media (min-width: 900px) {
  .setup-wrap { grid-template-columns: minmax(0, 1fr) 300px; gap: 56px; align-items: start; }
  .setup-aside { order: 1; position: sticky; top: 84px; }
}
.setup-aside h3 { font-size: 0.95rem; }
.setup-aside ul { list-style: none; padding: 0; display: grid; gap: 10px; }
.setup-aside li { margin: 0; font-size: 14px; display: grid; gap: 2px; }
.setup-aside li .k { font: 500 11.5px/1.4 var(--font-mono); color: var(--muted); letter-spacing: 0.04em; text-transform: uppercase; }
.setup-aside li .v { color: var(--ink); }

/* Evidence */
.evidence { display: grid; gap: 14px; list-style: none; margin: 0; padding: 0; }
.evidence li { margin: 0; min-width: 0; padding: 20px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; display: grid; gap: 8px; align-content: start; }
.evidence .k { font: 600 11.5px/1.4 var(--font-mono); color: var(--muted); letter-spacing: 0.1em; text-transform: uppercase; }
.evidence .v { color: var(--ink); font-size: 15px; line-height: 1.45; }
.evidence .s { font-size: 13.5px; color: var(--muted); }
@media (min-width: 760px) { .evidence { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* Alternatives */
.alts { display: grid; gap: 0; list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }
.alts li { margin: 0; padding: 18px 0; border-bottom: 1px solid var(--border); display: grid; gap: 4px 24px; }
.alts .want { color: var(--ink); font-weight: 600; text-wrap: balance; }
.alts .use { font-size: 15px; }
@media (min-width: 760px) { .alts li { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); align-items: baseline; } }

/* Footer */
footer { border-top: 1px solid var(--border-subtle); padding: 36px 0 48px; color: var(--muted); font-size: 13.5px; }
footer .wrap { display: grid; gap: 18px; }
footer .links { display: flex; flex-wrap: wrap; gap: 6px 20px; margin: 0; padding: 0; list-style: none; }
footer .links li { margin: 0; }
footer a { color: var(--body); }
footer a:hover { color: var(--ink); }
footer .brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-family: var(--font-display); font-weight: 600; letter-spacing: -0.015em; }
footer .brand img { width: 20px; height: 20px; }
footer p { max-width: var(--measure); }
footer .family-wrap { display: grid; gap: 10px; }
footer .family-label { font: 500 11.5px/1.4 var(--font-mono); text-transform: uppercase; letter-spacing: 0.1em; }
footer .family { display: flex; flex-wrap: wrap; gap: 6px 20px; margin: 0; padding: 0; list-style: none; }
footer .family li { margin: 0; }
@media (min-width: 760px) {
  footer .wrap { grid-template-columns: minmax(0, 1fr) auto; align-items: start; }
  footer .links { justify-content: flex-end; }
  footer p, footer .family-wrap { grid-column: 1 / -1; }
}

@media print {
  header.site { position: static; backdrop-filter: none; border-bottom: 1px solid #ccc; }
  header.site nav, .copy-button, .snippet-bar, .actions { display: none; }
  section { break-inside: auto; padding: 24px 0; }
  .demo, .states > li, .grid > li, .evidence li, .pipeline li, .setup > li { break-inside: avoid; }
  .states .led { animation-play-state: paused !important; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.85em; color: #666; }
  header.site .brand::after, footer a::after, nav a::after { content: none; }
}
