@import url("tokens.css");

*, *::before, *::after { box-sizing: border-box; }
html { font-family: var(--font); font-size: 16px; background: var(--paper); scroll-behavior: smooth; }
body { min-width: 20rem; margin: 0; color: var(--ink); background: var(--paper); }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-family: var(--display); font-weight: 500; letter-spacing: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button, input, textarea { font: inherit; color: inherit; }
button { border: 0; background: transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
::selection { color: var(--accent-ink); background: var(--accent); }

.wrap { width: min(100% - 2rem, 64rem); margin-inline: auto; }
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4.5rem;
  padding: .4rem 1rem;
  background: var(--paper);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  color: var(--ink);
  font-family: var(--mono);
  font-size: .8125rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.brand-mark {
  display: block;
  width: auto;
  height: 2.75rem;
  flex: 0 0 auto;
}
.brand-mark path { fill: currentColor; }

.nav { display: flex; align-items: center; gap: 1.25rem; }
.nav a { color: var(--ink); font-size: var(--text-1); }
.nav a:hover { color: var(--accent); }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.5rem;
  padding: 0 1.15rem;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font-size: var(--text-0);
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
}
.btn:hover { color: var(--ink); background: var(--paper); border-color: var(--ink); }
.btn:disabled { opacity: .48; cursor: not-allowed; }
.nav .btn,
.nav .btn:hover,
.btn-header,
.btn-on-dark {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
}
.nav .btn:hover,
.btn-header:hover,
.btn-on-dark:hover {
  color: var(--accent-ink);
  background: var(--ink);
  border-color: var(--ink);
}

.hero {
  padding: 5.5rem 0 4.5rem;
  color: var(--ink);
  background: var(--paper);
}
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2rem;
  align-items: start;
}
.hero-copy { position: relative; z-index: 1; min-width: 0; }
.hero-copy .btn { width: 100%; }
.hero-media {
  width: 100%;
  margin: 0;
  min-width: 0;
}
.hero-media img {
  display: block;
  width: 100%;
  height: auto;
}
.hero .eyebrow { display: inline-flex; align-items: center; gap: .55rem; color: var(--accent); }
.status-dot {
  width: .45rem;
  height: .45rem;
  flex: 0 0 auto;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 22%, transparent);
}
.hero .lede { color: var(--ink-3); }
.eyebrow {
  margin-bottom: .75rem;
  color: var(--accent);
  font-family: var(--mono);
  font-size: .6875rem;
  font-weight: 400;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.hero h1 {
  max-width: 16ch;
  font-size: clamp(2.25rem, 6vw, 3.75rem);
  font-weight: 500;
  line-height: 1.05;
}
.hero .lede {
  max-width: 40rem;
  margin-top: 1.25rem;
  font-size: var(--text-3);
  line-height: 1.55;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.75rem; }

.section { padding: 3.5rem 0; }
.section-heading {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  font-size: clamp(1.85rem, 3vw, 2.35rem);
  font-weight: 500;
  line-height: 1.15;
}
.section-heading span { min-width: 0; }
.section-icon {
  width: 1.85rem;
  height: 1.85rem;
  flex: 0 0 auto;
  margin-top: .15rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
  color: var(--accent);
}
.section > .wrap > p { max-width: 42rem; margin-top: .6rem; color: var(--ink-3); font-size: var(--text-1); line-height: 1.55; }

.theme-low,
.theme-medium,
.theme-high,
.theme-critical {
  --ink: var(--color-text);
  --ink-2: color-mix(in srgb, var(--color-text) 82%, var(--color-background));
  --ink-3: color-mix(in srgb, var(--color-text) 72%, var(--color-background));
  --muted: color-mix(in srgb, var(--color-text) 68%, transparent);
  --muted-2: color-mix(in srgb, var(--color-text) 48%, transparent);
  --paper: var(--color-background);
  --surface: var(--color-background);
  --surface-2: color-mix(in srgb, var(--color-text) 6%, var(--color-background));
  --surface-3: color-mix(in srgb, var(--color-text) 12%, var(--color-background));
  --line: color-mix(in srgb, var(--color-text) 22%, transparent);
  --line-strong: color-mix(in srgb, var(--color-text) 42%, transparent);
  --accent: var(--color-accent);
  --accent-ink: var(--color-background);
  color: var(--ink);
  background: var(--paper);
}
.theme-low {
  --color-text: var(--color-low-text);
  --color-accent: var(--color-low-accent);
  --color-background: var(--color-low-background);
  --color-overlay: var(--color-low-overlay);
}
.theme-medium {
  --color-text: var(--color-medium-text);
  --color-accent: var(--color-medium-accent);
  --color-background: var(--color-medium-background);
  --color-overlay: var(--color-medium-overlay);
}
.theme-high {
  --color-text: var(--color-high-text);
  --color-accent: var(--color-high-accent);
  --color-background: var(--color-high-background);
  --color-overlay: var(--color-high-overlay);
}
.theme-critical {
  --color-text: var(--color-critical-text);
  --color-accent: var(--color-critical-accent);
  --color-background: var(--color-critical-background);
  --color-overlay: var(--color-critical-overlay);
}
.theme-low ::selection,
.theme-medium ::selection,
.theme-high ::selection,
.theme-critical ::selection { color: var(--accent-ink); background: var(--accent); }

.features {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2rem 1.5rem;
  margin-top: 2rem;
}
.feature h3 {
  display: flex;
  align-items: flex-start;
  gap: .55rem;
  font-size: var(--text-2);
  font-weight: 500;
}
.feature h3 .section-icon { width: 1.25rem; height: 1.25rem; margin-top: .1rem; }
.feature p { margin-top: .45rem; color: var(--ink-3); font-size: var(--text-1); line-height: 1.5; }

.how-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 2.5rem;
  align-items: center;
  margin-top: 2.25rem;
}

.flow {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(4rem, 1fr) auto;
  align-items: center;
  gap: 1rem;
  min-height: 14rem;
  padding: 1.35rem 1.25rem;
  border: 1px solid var(--ink);
  background:
    radial-gradient(circle at 88% 50%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 42%),
    var(--paper);
  overflow: hidden;
}
.flow-sources {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: .45rem;
  width: max-content;
}
.flow-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 1.85rem;
  padding: 0 .7rem;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--mono);
  font-size: .6875rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
  animation: chip-pulse 3.6s ease-in-out infinite;
  animation-delay: var(--d, 0s);
}
.flow-stream {
  position: relative;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, var(--line-strong), var(--accent));
}
.flow-packet {
  position: absolute;
  top: 50%;
  left: 0;
  width: .55rem;
  height: .55rem;
  margin-top: -.275rem;
  border-radius: 0;
  background: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 24%, transparent);
  animation: packet-drift 3.2s linear infinite;
  animation-delay: var(--d, 0s);
}
.flow-hub {
  display: grid;
  gap: .2rem;
  place-items: center;
  min-width: 8.5rem;
  padding: 1rem 1.15rem;
  border: 1px solid var(--accent);
  border-radius: 0;
  background: var(--accent);
  color: var(--accent-ink);
  animation: hub-glow 3.6s ease-in-out infinite;
}
.flow-hub .brand-mark { height: 2.6rem; color: var(--accent-ink); }
.flow-hub span {
  color: color-mix(in srgb, var(--accent-ink) 72%, transparent);
  font-size: .6875rem;
}

@keyframes chip-pulse {
  0%, 100% { transform: translateX(0); opacity: .72; }
  50% { transform: translateX(3px); opacity: 1; }
}
@keyframes packet-drift {
  0% { left: 0; opacity: 0; }
  12% { opacity: 1; }
  85% { opacity: 1; }
  100% { left: calc(100% - .55rem); opacity: 0; }
}
@keyframes hub-glow {
  0%, 100% { box-shadow: 0 0 0 0 transparent; }
  50% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--accent) 18%, transparent); }
}

.steps {
  display: grid;
  gap: 0;
  border-top: 1px solid var(--line-strong);
}
.step {
  display: grid;
  grid-template-columns: 4.75rem 1fr;
  gap: 1rem;
  align-items: start;
  padding: 1.45rem 0;
  border-bottom: 1px solid var(--line-strong);
}
.step-index {
  color: var(--accent);
  font-family: var(--mono);
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 600;
  line-height: .9;
  letter-spacing: -.04em;
}
.step h3 { font-size: var(--text-2); font-weight: 500; }
.step p { margin-top: .35rem; color: var(--ink-3); font-size: var(--text-1); line-height: 1.5; }

#demo .wrap { text-align: center; }
#demo .section-heading { justify-content: center; }
#demo .wrap > p { width: min(100%, 28rem); margin-inline: auto; }
.register-form {
  display: grid;
  gap: 1rem;
  width: min(100%, 28rem);
  margin: 1.75rem auto 0;
  text-align: left;
}
.field { display: grid; gap: .4rem; }
.field label, .agree { font-size: var(--text-0); color: var(--ink); letter-spacing: .02em; }
.field:focus-within > label { color: var(--accent); }
.optional { color: var(--muted); font-size: var(--text-0); }
.input {
  width: 100%;
  min-height: 2.25rem;
  padding: .35rem 0;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  border-radius: 0;
}
textarea.input { min-height: 6rem; resize: vertical; }
.input:hover { border-bottom-color: var(--ink); }
.input:focus {
  outline: none;
  border-bottom-color: var(--accent);
  box-shadow: inset 0 -1px 0 var(--accent);
}
.agree { display: flex; align-items: flex-start; gap: .55rem; line-height: 1.45; }
.agree input { margin-top: .2rem; accent-color: var(--accent); }
.agree a { text-decoration: underline; text-underline-offset: .15em; }
.form-status { min-height: 1.25rem; font-size: var(--text-1); color: var(--ink-3); }
.form-status.is-success { color: var(--accent); }
.form-status.is-error { color: var(--red); }
.hp {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.legal { width: min(100% - 2rem, 42rem); margin: 0 auto; padding: 3.5rem 0 4rem; }
.legal h1 { font-size: var(--text-6); font-weight: 500; line-height: 1.05; }
.legal-intro { margin-top: 1.25rem; color: var(--ink-3); font-size: var(--text-3); line-height: 1.55; }
.legal-date { margin-top: .85rem; color: var(--muted); font-size: var(--text-0); }
.legal section { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--line-strong); }
.legal h2 { margin-bottom: .55rem; font-size: var(--text-2); font-weight: 500; }
.legal section p { color: var(--ink-3); font-size: var(--text-1); line-height: 1.65; }
.legal a:not(.btn) { text-decoration: underline; text-underline-offset: .15em; }
.legal .btn { margin-top: 2rem; }

.missing {
  display: grid;
  justify-items: start;
  gap: .85rem;
  width: min(100% - 2rem, 42rem);
  margin: 0 auto;
  padding: 5rem 0 6rem;
}
.missing h1 { font-size: clamp(2rem, 6vw, 3rem); font-weight: 500; }
.missing p { max-width: 32rem; color: var(--ink-3); font-size: var(--text-1); line-height: 1.55; }
.missing .btn { margin-top: .5rem; }

.site-footer {
  color: var(--color-healthy-text);
  background: var(--color-healthy-background);
  font-size: var(--text-0);
}
.site-footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: 1.25rem 0 2rem;
  border-top: 1px solid color-mix(in srgb, var(--color-healthy-text) 42%, transparent);
}
.footer-nav { display: flex; flex-wrap: wrap; gap: .5rem 1.15rem; }
.site-footer a { color: var(--color-healthy-text); }
.site-footer a:hover { color: var(--color-healthy-accent); }
.site-footer a[aria-current="page"] { text-decoration: underline; text-underline-offset: .15em; }

@media (min-width: 52rem) {
  .hero-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
@media (max-width: 52rem) {
  .features { grid-template-columns: 1fr; }
  .how-grid { grid-template-columns: 1fr; gap: 1.75rem; }
  .flow {
    grid-template-columns: auto minmax(3rem, 1fr) auto;
    min-height: 0;
    padding: 1.1rem;
  }
  .flow-hub { min-width: 7rem; padding: .85rem 1rem; }
}
@media (max-width: 40rem) {
  .nav .hide-narrow { display: none; }
  .hero { padding: 3.5rem 0 3rem; }
  .step { grid-template-columns: 3.5rem 1fr; gap: .85rem; }
  .step-index { font-size: 2rem; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .flow-chip,
  .flow-packet,
  .flow-hub { animation: none; }
}
