/* Reusable UI pieces — compose in HTML; change look here. */

/* --- Shell / nav --- */
.shell {
  width: min(var(--max), 100% - 2 * var(--gutter));
  margin-inline: auto;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  padding: var(--s-4) 0;
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(14px);
  background: linear-gradient(to bottom, var(--bg-glass), transparent);
  border-bottom: 1px solid transparent;
}

.nav.is-scrolled {
  border-bottom-color: var(--border);
  background: var(--bg-glass);
}

.nav__brand {
  display: inline-flex;
  align-items: center;
  gap: var(--s-3);
  color: var(--ink);
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 1.35rem;
  letter-spacing: var(--tracking-display);
  flex-shrink: 0;
}

.nav__mark {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  border: 2px solid var(--herald);
  box-shadow: 0 0 0 4px rgba(232, 184, 74, 0.12), inset 0 0 12px var(--herald-glow);
  position: relative;
}

.nav__mark::after {
  content: "";
  position: absolute;
  inset: 28%;
  border-radius: 50%;
  background: var(--herald);
  box-shadow: 0 0 12px var(--herald);
}

.nav__links {
  display: none;
  flex-wrap: nowrap;
  gap: var(--s-4);
  list-style: none;
  margin: 0;
  padding: 0;
  align-items: center;
}

@media (min-width: 720px) {
  .nav__links {
    display: flex;
  }
}

.nav__links a {
  color: var(--ink-muted);
  text-decoration: none;
  font-size: var(--fs-small);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  font-weight: 500;
}

.nav__links a:hover {
  color: var(--ink);
}

/* Mobile: single GitHub CTA instead of crowded link wrap */
.nav__mobile-cta {
  display: inline-flex;
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--herald);
  text-decoration: none;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  padding: 0.4rem 0.75rem;
}

@media (min-width: 720px) {
  .nav__mobile-cta {
    display: none;
  }
}

/* Product / external brand links (e.g. Herdr) — inherit tone, underline on hover */
a.product-link {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
}

a.product-link:hover {
  color: var(--herald);
  text-decoration-color: var(--herald);
}

.verse a.product-link {
  font-style: italic;
}

/* --- Eyebrow / kicker --- */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--herald);
  margin-bottom: var(--s-4);
}

.eyebrow__dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--signal);
  box-shadow: 0 0 10px var(--signal);
  animation: pulse-dot 1.8s var(--ease-out) infinite;
}

@keyframes pulse-dot {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.45;
    transform: scale(0.85);
  }
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  padding: 0.9rem 1.5rem;
  border-radius: var(--radius-pill);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition:
    transform var(--dur-fast) var(--ease-out),
    background var(--dur-fast),
    border-color var(--dur-fast),
    box-shadow var(--dur);
}

.btn:active {
  transform: translateY(1px);
}

.btn--primary {
  background: linear-gradient(135deg, #f0c96a 0%, var(--herald) 42%, var(--herald-dim) 100%);
  color: var(--ink-invert);
  box-shadow: 0 10px 32px var(--herald-glow), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.btn--primary:hover {
  color: var(--ink-invert);
  box-shadow: 0 14px 44px var(--herald-glow), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.btn--ghost {
  background: rgba(238, 241, 247, 0.03);
  border-color: var(--border-strong);
  color: var(--ink);
}

.btn--ghost:hover {
  border-color: var(--herald);
  color: var(--herald);
  background: rgba(232, 184, 74, 0.08);
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3);
  margin-top: var(--s-6);
}

/* Mobile first fold: keep CTAs side-by-side when they fit; stack only on very narrow */
@media (max-width: 360px) {
  .btn {
    width: 100%;
  }
  .btn-row {
    flex-direction: column;
    align-items: stretch;
  }
}

/* --- Cards --- */
.card {
  background: linear-gradient(165deg, rgba(22, 27, 40, 0.95), var(--bg-panel) 55%, #0c0f16);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--s-5) var(--s-5) var(--s-6);
  box-shadow: var(--shadow-panel);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--herald), transparent);
  opacity: 0.65;
}

.card__icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  margin-bottom: var(--s-4);
  background: rgba(232, 184, 74, 0.12);
  border: 1px solid var(--border-strong);
  color: var(--herald);
  font-family: var(--font-mono);
  font-size: var(--fs-small);
}

.card h3 {
  font-size: var(--fs-h3);
  margin-bottom: var(--s-2);
}

.card p {
  font-size: var(--fs-small);
  color: var(--ink-muted);
}

/* --- Install picker (segmented control + command block) --- */
.install-picker {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  min-width: 0;
}

.install-picker__fieldset {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.segmented-control {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.15rem;
  padding: 0.2rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.segmented-control__opt {
  position: relative;
  display: block;
  cursor: pointer;
  margin: 0;
}

.segmented-control__opt input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 1;
}

.segmented-control__label {
  display: block;
  padding: 0.45rem 0.95rem;
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  background: transparent;
  transition:
    color var(--dur-fast) var(--ease-out),
    background var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-fast) var(--ease-out);
  user-select: none;
}

.segmented-control__opt:hover .segmented-control__label {
  color: var(--ink);
}

/* Selected pill */
.segmented-control__opt input:checked + .segmented-control__label {
  color: var(--ink-invert);
  background: linear-gradient(135deg, #f0c96a 0%, var(--herald) 50%, var(--herald-dim) 100%);
  box-shadow: 0 4px 16px var(--herald-glow), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.segmented-control__opt input:focus-visible + .segmented-control__label {
  outline: 2px solid var(--signal);
  outline-offset: 2px;
}

.install-picker .term__bar {
  gap: var(--s-2);
}

/* Title + copy sit as a trailing group after the traffic-light dots */
.install-picker .term__title {
  margin-left: auto;
}

.install-picker__copy {
  flex-shrink: 0;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink-muted);
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    color var(--dur-fast),
    border-color var(--dur-fast),
    background var(--dur-fast);
}

.install-picker__copy:hover {
  color: var(--herald);
  border-color: var(--border-strong);
  background: rgba(232, 184, 74, 0.08);
}

.install-picker__copy:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 2px;
}

.install-picker__copy.is-copied {
  color: var(--safe);
  border-color: rgba(134, 239, 172, 0.4);
}

.install-picker__line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.5rem;
  min-width: 0;
}

.install-picker__line .cmd {
  word-break: break-all;
}

/* --- Terminal panel --- */
.term {
  background: linear-gradient(180deg, #0b0e16 0%, #06080e 100%);
  border: 1px solid rgba(232, 184, 74, 0.18);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-term);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.6;
}

.term__bar {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: 0.8rem 1rem;
  background: rgba(255, 255, 255, 0.035);
  border-bottom: 1px solid rgba(238, 241, 247, 0.08);
}

.term__dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: #3a3f4b;
}

.term__dot:nth-child(1) {
  background: #fb7185;
}
.term__dot:nth-child(2) {
  background: #fbbf24;
}
.term__dot:nth-child(3) {
  background: #86efac;
}

.term__title {
  margin-left: auto;
  color: var(--ink-faint);
  font-size: var(--fs-micro);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.term__body {
  padding: 1.2rem 1.3rem 1.45rem;
  color: var(--ink-muted);
  overflow-x: auto;
}

.term__body .prompt {
  color: var(--herald);
  font-weight: 500;
}

.term__body .cmd {
  color: var(--ink);
}

.term__body .out {
  color: var(--signal);
}

.term__body .dim {
  color: #8b93a6;
}

.term__body .err {
  color: var(--blocked);
}

/* --- Flow steps --- */
.flow {
  display: grid;
  gap: var(--s-3);
  counter-reset: step;
}

.flow__step {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--s-4);
  align-items: start;
  padding: var(--s-4) var(--s-5);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: linear-gradient(135deg, var(--bg-panel), rgba(10, 12, 18, 0.6));
}

.flow__num {
  counter-increment: step;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  color: var(--ink-invert);
  background: var(--herald);
  box-shadow: 0 0 20px var(--herald-glow);
}

.flow__num::before {
  content: counter(step);
}

.flow__step h3 {
  font-size: 1.05rem;
  margin-bottom: var(--s-1);
}

.flow__step p {
  font-size: var(--fs-small);
  margin: 0;
}

/* --- Verse / quote --- */
.verse {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(1.1rem, 2.4vw, 1.5rem);
  line-height: var(--lh-snug);
  color: var(--ink);
  border-left: 3px solid var(--herald);
  padding: var(--s-3) 0 var(--s-3) var(--s-5);
  margin: var(--s-5) 0 0;
  max-width: 36rem;
}

.verse span {
  display: block;
  color: var(--ink-muted);
}

/* --- Badge / pill --- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid var(--border);
  color: var(--ink-muted);
  background: rgba(255, 255, 255, 0.04);
}

.pill--live {
  border-color: rgba(94, 234, 212, 0.45);
  color: var(--signal);
  background: rgba(94, 234, 212, 0.06);
}

.pill--risk {
  border-color: rgba(251, 113, 133, 0.45);
  color: #fda4af;
  background: rgba(251, 113, 133, 0.06);
}

/* --- Waveform canvas frame --- */
.wave-frame {
  position: relative;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(232, 184, 74, 0.16);
  background: linear-gradient(180deg, rgba(232, 184, 74, 0.07), transparent 45%),
    var(--bg-deep);
  overflow: hidden;
  min-height: 11rem;
  box-shadow: var(--shadow-panel);
}

.wave-frame canvas {
  width: 100%;
  height: 11rem;
  display: block;
}

.wave-frame__label {
  position: absolute;
  left: 1rem;
  bottom: 0.85rem;
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

@media (max-width: 719px) {
  .wave-frame {
    min-height: 9.5rem;
    margin-top: var(--s-2);
  }
  .wave-frame canvas {
    height: 9.5rem;
  }
}

/* --- Architecture diagram (hero RHS) --- */
.arch {
  position: relative;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(232, 184, 74, 0.2);
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(232, 184, 74, 0.08), transparent 55%),
    linear-gradient(180deg, #0c1018 0%, var(--bg-deep) 100%);
  box-shadow: var(--shadow-panel), 0 0 48px rgba(232, 184, 74, 0.08);
  overflow: hidden;
  padding: var(--s-4) var(--s-3) var(--s-3);
}

.arch__title {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  text-align: center;
  margin: 0 0 var(--s-3);
}

.arch__svg {
  width: 100%;
  height: auto;
  display: block;
}

.arch__svg .node-fill {
  fill: var(--bg-elevated);
}

.arch__svg .node-stroke {
  stroke: var(--border-strong);
  stroke-width: 1.25;
  fill: none;
}

.arch__svg .node-fill--you {
  fill: rgba(94, 234, 212, 0.12);
}

.arch__svg .node-stroke--you {
  stroke: rgba(94, 234, 212, 0.55);
}

.arch__svg .node-fill--hark {
  fill: rgba(232, 184, 74, 0.14);
}

.arch__svg .node-stroke--hark {
  stroke: var(--herald);
  stroke-width: 1.5;
}

.arch__svg .node-fill--svc {
  fill: rgba(238, 241, 247, 0.04);
}

.arch__svg .node-stroke--svc {
  stroke: rgba(238, 241, 247, 0.16);
}

.arch__svg .node-fill--herdr {
  fill: rgba(16, 19, 28, 0.9);
}

.arch__svg .node-stroke--herdr {
  stroke: rgba(232, 184, 74, 0.28);
  stroke-dasharray: 4 3;
}

.arch__svg .node-fill--agent {
  fill: rgba(251, 113, 133, 0.1);
}

.arch__svg .node-stroke--agent {
  stroke: rgba(251, 113, 133, 0.4);
}

.arch__svg .lbl {
  fill: var(--ink);
  font-family: var(--font-body), system-ui, sans-serif;
  font-size: 13px;
  font-weight: 600;
}

.arch__svg .lbl-sub {
  fill: var(--ink-muted);
  font-family: var(--font-mono), ui-monospace, monospace;
  font-size: 9.5px;
  letter-spacing: 0.04em;
}

.arch__svg .lbl-you {
  fill: var(--signal);
}

.arch__svg .lbl-hark {
  fill: var(--herald);
}

.arch__svg .arrow {
  stroke: rgba(232, 184, 74, 0.55);
  stroke-width: 1.5;
  fill: none;
  marker-end: url(#arch-arrow);
}

.arch__svg .arrow--signal {
  stroke: rgba(94, 234, 212, 0.5);
  marker-end: url(#arch-arrow-signal);
}

.arch__svg .arrow--dim {
  stroke: rgba(238, 241, 247, 0.22);
  marker-end: url(#arch-arrow-dim);
}

.arch__svg .edge-lbl {
  fill: var(--ink-faint);
  font-family: var(--font-mono), ui-monospace, monospace;
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.arch__caption {
  margin: var(--s-2) var(--s-2) 0;
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
  text-align: center;
}

@media (max-width: 719px) {
  .arch {
    margin-top: var(--s-2);
  }
}

/* --- Section chrome — consistent vertical rhythm */
.section {
  padding: clamp(3.5rem, 8vw, 5.5rem) 0;
}

.section__head {
  max-width: 38rem;
  margin-bottom: var(--s-6);
}

@media (min-width: 720px) {
  .section__head {
    margin-bottom: var(--s-7);
  }
}

.section__head h2 {
  font-size: var(--fs-h1);
}

.section__head p {
  font-size: var(--fs-body);
}

.divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(238, 241, 247, 0.12), transparent);
  border: 0;
  margin: 0;
}

/* --- Footer --- */
.footer {
  padding: var(--s-7) 0 calc(var(--s-8) + env(safe-area-inset-bottom, 0px));
  color: var(--ink-muted);
  font-size: var(--fs-small);
  border-top: 1px solid var(--border);
  margin-top: 0;
}

.footer__row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-5) var(--s-6);
  justify-content: space-between;
  align-items: center;
}

.footer__row > div:first-child {
  line-height: 1.5;
}

.footer__row > div:first-child strong {
  font-size: 1.15rem;
}

.footer__row > div:first-child div {
  margin-top: var(--s-1);
  color: var(--ink-faint);
}

.footer__credit {
  margin: var(--s-3) 0 0;
  font-size: var(--fs-micro);
  letter-spacing: 0.02em;
  color: var(--ink-faint);
}

.footer__credit a {
  color: var(--ink-muted);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, currentColor 40%, transparent);
  text-underline-offset: 0.15em;
}

.footer__credit a:hover {
  color: var(--herald);
}

.footer a {
  color: var(--ink-muted);
  text-decoration: none;
}

.footer a:hover {
  color: var(--herald);
}
