/* ════════════════════════════════════════════════════════════════════
   NexFlow · Components · buttons, cards, pills, forms
   ════════════════════════════════════════════════════════════════════ */
/* Fixed by Opus 4.7 — 2026-05-29 — repaired JSON-escaping corruption in
   .pill.live::before (content: "" → content: ""; and — / "…" in the
   adjacent comment). The escaped quotes made the `content` declaration
   invalid, so the pill's status dot never rendered. */

/* ── Buttons ──────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-sans); font-weight: 500;
  font-size: 14px; letter-spacing: -.005em;
  padding: 11px 18px;
  border-radius: 999px;
  background: var(--fg-0); color: var(--fg-inv);
  border: 1px solid var(--fg-0);
  transition: transform var(--d-base) var(--ease-out),
              box-shadow var(--d-base) var(--ease-out),
              background var(--d-fast) var(--ease-snap);
  white-space: nowrap; cursor: pointer;
  user-select: none;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-2); }
.btn:active { transform: translateY(0); }
.btn .arr { transition: transform var(--d-base) var(--ease-out); display: inline-block; }
.btn:hover .arr { transform: translateX(3px); }

.btn.ghost {
  background: transparent; color: var(--fg-0); border-color: var(--rule-strong);
}
.btn.ghost:hover { background: var(--bg-2); border-color: var(--fg-0); }

.btn.brand { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.brand:hover { box-shadow: var(--shadow-brand); }

/* Action / primary-CTA variant — warm clay. Used for the single most
   important call to action on a view; reads with energy against both the
   warm paper and the ink buttons without resorting to a gradient. */
.btn.act { background: var(--clay); border-color: var(--clay); color: #fff; }
.btn.act:hover { background: var(--clay-2); border-color: var(--clay-2); box-shadow: var(--shadow-2); }

.btn.invert { background: #fff; color: var(--fg-0); border-color: #fff; }
.btn.invert:hover { background: var(--bg-2); }

.btn.lg { padding: 14px 22px; font-size: 15px; }
.btn.sm { padding: 8px 14px; font-size: 13px; }

.btn.on-dark.ghost { color: #fff; border-color: rgba(255,255,255,.28); }
.btn.on-dark.ghost:hover { background: rgba(255,255,255,.08); border-color: #fff; }

/* Async button loading state — paired with a text swap to "Sending…" in
   the form components so the spinner reinforces the disabled state. */
.btn.loading { pointer-events: none; opacity: .9; }
.btn.loading::after {
  content: ''; display: inline-block;
  width: 12px; height: 12px; border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  animation: spin .6s linear infinite;
  margin-left: 6px;
}
.btn.ghost.loading::after, .btn.invert.loading::after { border-color: rgba(14,15,20,.25); border-top-color: var(--fg-0); }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .btn.loading::after { animation: none; } }

/* ── Pills / Tags ─────────────────────────────────────────────────── */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: 999px;
  background: var(--bg-2);
  font-family: var(--font-mono); font-size: 11px;
  color: var(--fg-1);
  border: 1px solid var(--rule);
}
.pill.brand { background: var(--brand-soft); color: var(--brand); border-color: var(--brand-line); }
.pill.live::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--emerald);
  /* Static — no pulse. The pill is decorative furniture; an oscillating
     dot turned every pill into a "look at me" beacon. */
}
.pill.on-dark { background: rgba(255,255,255,.06); color: var(--fg-inv-1); border-color: rgba(255,255,255,.12); }

.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 999px;
  background: var(--bg-2); color: var(--fg-1);
  font-family: var(--font-mono); font-size: 10.5px;
  letter-spacing: .04em;
}
.tag.brand { background: var(--brand-soft); color: var(--brand); }

/* ── Cards ────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-1);
  border: 1px solid var(--rule);
  border-radius: var(--r);
  padding: 24px;
  box-shadow: var(--shadow-1);
  transition: transform var(--d-base) var(--ease-out),
              box-shadow var(--d-base) var(--ease-out),
              border-color var(--d-fast) var(--ease-snap);
}
.card:hover {
  /* Inset brand-line stroke reads as "this card was just scanned" —
     a small reinforcement of the audit-trail brand promise. The
     outer shadow lift and border-color shift are unchanged. */
  box-shadow: var(--shadow-2), inset 0 0 0 1px var(--brand-line);
  transform: translateY(-2px);
  border-color: var(--rule-strong);
}
.card.flat { box-shadow: none; }
.card.flat:hover { transform: none; box-shadow: var(--shadow-1); }
.card.ink {
  background: var(--bg-ink);
  color: var(--fg-inv);
  border-color: rgba(255,255,255,.06);
}
.card.ink .t-body { color: var(--fg-inv-1); }

/* ── Surface · glass ─────────────────────────────────────────────── */
.glass {
  background: rgba(255,255,255,.55);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid var(--rule);
  border-radius: var(--r);
  box-shadow: var(--shadow-2);
}

/* ── Industry switcher ────────────────────────────────────────────── */
.swap {
  display: inline-flex; align-items: center;
  gap: 4px; padding: 4px;
  border-radius: 999px;
  background: var(--bg-2);
  border: 1px solid var(--rule);
  flex-wrap: wrap;
}
.swap button {
  padding: 7px 14px; border-radius: 999px;
  font-size: 13px; font-weight: 500;
  color: var(--fg-1);
  transition: all var(--d-fast) var(--ease-out);
  white-space: nowrap;
}
.swap button:hover { color: var(--fg-0); }
/* Matches both true-tabs (aria-selected, HeroUI industry switcher)
   and true-toggles (aria-pressed, Contact's duration switch). */
.swap button[aria-pressed="true"],
.swap button[aria-selected="true"] {
  background: var(--fg-0); color: var(--fg-inv);
  box-shadow: var(--shadow-1);
}

/* ── Stat grid ────────────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.stat-grid > div {
  padding: 32px 24px;
  border-right: 1px solid var(--rule);
}
.stat-grid > div:last-child { border-right: 0; }
.stat-grid .val {
  font-family: var(--font-serif);
  font-size: clamp(38px, 4vw, 60px);
  line-height: 1; letter-spacing: -.02em;
  margin-bottom: 8px;
}
.stat-grid .lbl { font-size: 13.5px; color: var(--fg-1); line-height: var(--lh-base); }
.stat-grid .src {
  font-family: var(--font-mono);
  font-size: 10.5px; color: var(--fg-3);
  margin-top: 10px; letter-spacing: .04em;
}
@media (max-width: 880px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .stat-grid > div:nth-child(2) { border-right: 0; }
  .stat-grid > div:nth-child(1), .stat-grid > div:nth-child(2) {
    border-bottom: 1px solid var(--rule);
  }
}

/* ── Terminal block ───────────────────────────────────────────────── */
.term {
  background: var(--bg-ink);
  border-radius: var(--r-s);
  padding: 14px 16px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.75;
  color: var(--emerald-bright);
  border: 1px solid rgba(255,255,255,.06);
  overflow: hidden;
  position: relative;
  isolation: isolate;
}
/* Faint scanlines · CRT character without going full retro. The
   pseudo sits above the text but with such a low contrast that
   readability is unchanged. */
.term::after {
  content: '';
  position: absolute; inset: 0;
  pointer-events: none;
  background-image: repeating-linear-gradient(
    0deg,
    transparent 0,
    transparent 2px,
    rgba(255,255,255,.025) 2px,
    rgba(255,255,255,.025) 3px
  );
  z-index: 1;
  border-radius: inherit;
}
.term > * { position: relative; z-index: 2; }
.term .ts { color: #5C6373; }
.term .ok { color: var(--emerald-bright); }
.term .now { color: #fff; }
.term .warn { color: var(--amber); }
.term .err { color: var(--rose); }
.term .dim { color: rgba(255,255,255,.4); }

/* ── Forms ────────────────────────────────────────────────────────── */
.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-family: var(--font-mono); font-size: 10.5px;
  color: var(--fg-2); text-transform: uppercase; letter-spacing: .08em;
  margin-bottom: 6px;
}
.field input, .field textarea {
  width: 100%;
  border: 1px solid var(--rule);
  border-radius: var(--r-s);
  padding: 11px 14px;
  font-size: 14px;
  background: var(--bg-1);
  color: var(--fg-0);
  transition: border-color var(--d-fast), box-shadow var(--d-fast);
}
.field input:focus, .field textarea:focus {
  outline: 0;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.field textarea { min-height: 88px; resize: vertical; }

/* ── Slider ───────────────────────────────────────────────────────── */
input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 4px;
  background: var(--bg-3);
  border-radius: 2px;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--fg-0);
  border: 3px solid var(--bg-1);
  box-shadow: var(--shadow-1);
  cursor: pointer;
  transition: transform var(--d-fast) var(--ease-out);
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.15); }
input[type="range"]::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--fg-0); border: 3px solid var(--bg-1);
  cursor: pointer;
}

/* ── June 2026 sale banner ────────────────────────────────────────── */
/* Injected by engine/sale-banner.js as the first <body> child on every
   page. Fixed at the very top; the page is offset by the measured height
   published as --nf-sale-h (see the .nf-sale-on rules below). */
.nf-sale-banner {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 9000;                 /* above nav (50) + overlay (80) + chat (100) */
  display: flex; align-items: center; justify-content: center;
  gap: 8px;
  padding: 8px var(--gutter);
  color: #fff;
  background: linear-gradient(100deg, var(--brand) 0%, #5B46D6 42%, var(--cyan) 100%);
  background-size: 200% 100%;
  box-shadow: 0 1px 0 rgba(255,255,255,.10) inset, var(--shadow-soft);
  animation: nf-sale-sheen 9s var(--ease-in-out) infinite,
             nf-sale-glow 3.2s var(--ease-in-out) infinite;
}
.nf-sale-inner {
  display: inline-flex; align-items: center; gap: 9px;
  color: #fff; line-height: 1.2;
  font-size: 13.5px;
  max-width: 100%;
}
.nf-sale-inner:hover .nf-sale-cta { transform: translateX(2px); }
.nf-sale-spark { font-size: 14px; filter: saturate(1.1); }
.nf-sale-text { display: inline-flex; align-items: baseline; gap: 7px; white-space: nowrap; }
.nf-sale-text strong { font-weight: 700; letter-spacing: -.01em; }
.nf-sale-sep { opacity: .65; }
.nf-sale-hl {
  font-weight: 600;
  background: rgba(255,255,255,.16);
  padding: 2px 8px; border-radius: 999px;
}
.nf-sale-cta {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .04em;
  text-transform: uppercase; font-weight: 600;
  padding-left: 4px;
  display: inline-flex; align-items: center; gap: 5px;
  transition: transform var(--d-base) var(--ease-out);
}
.nf-sale-cta span { display: inline-block; }
.nf-sale-close {
  position: absolute; top: 50%; right: 12px; transform: translateY(-50%);
  width: 28px; height: 28px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,.85);
  transition: background var(--d-fast) var(--ease-out), color var(--d-fast);
}
.nf-sale-close:hover { background: rgba(255,255,255,.18); color: #fff; }
.nf-sale-close:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }

@keyframes nf-sale-sheen {
  0%, 100% { background-position: 0% 50%; }
  50%      { background-position: 100% 50%; }
}
@keyframes nf-sale-glow {
  0%, 100% { box-shadow: 0 1px 0 rgba(255,255,255,.10) inset, 0 2px 14px -4px rgba(110,88,232,.55); }
  50%      { box-shadow: 0 1px 0 rgba(255,255,255,.10) inset, 0 4px 22px -2px rgba(110,88,232,.85); }
}

/* Page offset while the banner is present. --nf-sale-h is set by the JS
   to the bar's real (post-wrap) height so the offset is always exact. */
.nf-sale-on body { padding-top: var(--nf-sale-h, 42px); }
.nf-sale-on .nf-nav { top: var(--nf-sale-h, 42px); }
.nf-sale-on .art-progress { top: var(--nf-sale-h, 42px); }
.nf-sale-on .nf-skip { top: calc(var(--nf-sale-h, 42px) + 8px); }

@media (max-width: 560px) {
  .nf-sale-banner { padding: 7px 40px 7px 14px; }
  .nf-sale-inner { font-size: 12.5px; gap: 7px; }
  /* Drop the secondary CTA label on phones so the bar stays one line and
     doesn't eat vertical space — the whole bar is still tappable. */
  .nf-sale-cta { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .nf-sale-banner { animation: none; background-position: 0% 50%; }
}

/* ── Cite block ───────────────────────────────────────────────────── */
.cite {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--fg-3);
  margin-top: 6px;
  letter-spacing: .04em;
}
.cite a { color: var(--fg-2); text-decoration: underline; text-decoration-color: var(--rule); }
.cite a:hover { color: var(--fg-0); }
