/*
 * TORO RANK 2126 — The Last SEO Consultant
 * Design system for the A3 Web Design Challenge.
 *
 * Concept: Morpheus' choice. Landing presents two pills.
 *   Blue → /crawl  (the game, the simulation)
 *   Red  → /agent  (the agentic web — reality)
 *
 * Color: acid green dominant on near-black, blue used only as
 * the secondary "pill" accent. Stripped CRT/scan-line treatment
 * that was reading as 1999 instead of 2126.
 */

/* -------------------------------------------------------------
 * Design tokens
 * ------------------------------------------------------------- */
:root {
  color-scheme: dark;

  /* Background — very dark green tint (One Color rule: green dominates the canvas) */
  --bg: #010e05;
  --surface: #021607;
  --surface-strong: #031e0a;

  /* Acid green — the one color */
  --green-100: #e8ffe8;
  --green-300: #6dff8e;
  --green-500: #00ff66;
  --green-700: #00cc52;
  --green-900: #1a4a2a;

  /* Secondary — only the blue pill */
  --blue-glow: #4ab8ff;

  /* Text */
  --text: var(--green-500);
  --text-bright: var(--green-100);
  --text-muted: #4a8a5e;
  --text-dim: #2d5a3a;

  /* Borders */
  --border: #1a3a22;
  --border-strong: #2a5a3a;

  /* Glow — toned down. Use only where the moment matters. */
  --glow-sm: 0 0 4px rgba(0, 255, 102, 0.4);
  --glow-md: 0 0 10px rgba(0, 255, 102, 0.4);
  --glow-lg: 0 0 32px rgba(0, 255, 102, 0.35);

  /* Motion */
  --ease-out: cubic-bezier(0.2, 0, 0.2, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --dur-fast: 180ms;
  --dur-med: 320ms;
  --dur-slow: 640ms;

  /* Layout */
  --content-width: 1080px;

  /* Type */
  --font-mono: "JetBrains Mono", "IBM Plex Mono", "Fira Code", Consolas, monospace;
}

/* -------------------------------------------------------------
 * Reset & base
 * ------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 15px;
  line-height: 1.6;
  letter-spacing: 0;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

/* No more scan lines, no more vignette. The screen is the screen. */

/* -------------------------------------------------------------
 * Typography
 * ------------------------------------------------------------- */
h1,
h2,
h3,
h4 {
  font-family: var(--font-mono);
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.03em;
}

h1 {
  font-size: clamp(2.6rem, 9vw, 6.5rem);
  line-height: 0.96;
  color: var(--text-bright);
}

h2 {
  font-size: clamp(1.6rem, 3.2vw, 2.4rem);
  line-height: 1.05;
}

h3 {
  font-size: 1.05rem;
}

p {
  margin: 0 0 1rem;
  color: var(--text);
  max-width: 64ch;
}

a {
  color: var(--text-bright);
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  transition: text-decoration-color var(--dur-fast) var(--ease-out);
}

a:hover {
  text-decoration-color: var(--green-500);
}

a:focus-visible {
  outline: 2px solid var(--green-500);
  outline-offset: 2px;
}

code,
.mono {
  font-family: var(--font-mono);
  color: var(--green-300);
}

/* -------------------------------------------------------------
 * Layout shell
 * ------------------------------------------------------------- */
.page-shell {
  width: min(calc(100% - 2rem), var(--content-width));
  margin: 0 auto;
  padding: 1.5rem 0 4rem;
}

/* Full-viewport variant for the landing — no scroll, cinematic. */
.page-shell--full {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: 1.5rem;
}

/* -------------------------------------------------------------
 * Centered nav menu — shared across all pages
 *
 * Sits right below the status bar. Highlights the current page
 * via body[data-page] + matching href attribute.
 * ------------------------------------------------------------- */
.nav-menu {
  display: flex;
  justify-content: center;
  gap: 2rem;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.nav-menu__item {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-family: var(--font-mono);
  transition: color var(--dur-fast) var(--ease-out), text-shadow var(--dur-fast) var(--ease-out);
}

.nav-menu__item:hover {
  color: var(--green-500);
  text-shadow: var(--glow-sm);
  text-decoration: none;
}

/* Current-page highlight — match body[data-page] to href */
body[data-page="home"] .nav-menu__item[href="index.html"],
body[data-page="agent"] .nav-menu__item[href="agent.html"],
body[data-page="crawl"] .nav-menu__item[href="crawl.html"],
body[data-page="take-control"] .nav-menu__item[href="take-control.html"] {
  color: var(--text-bright);
  text-shadow: var(--glow-sm);
}

@media (max-width: 720px) {
  .nav-menu {
    gap: 1.2rem;
    font-size: 0.78rem;
  }
}

@media (max-width: 560px) {
  .nav-menu {
    gap: 0.8rem;
    font-size: 0.72rem;
  }
}

/*
 * Landing pills on mobile — smaller, sit visually ABOVE the bull
 * hands GLB (hands sit in the lower half of the canvas, pills get
 * pushed up by adjusting flex justification on the parent).
 */
@media (max-width: 720px) {
  .choice {
    justify-content: flex-start;
    padding-top: 2.5rem;
  }
  .choice__pills {
    gap: 1rem;
    margin-bottom: 2rem;
  }
  .pill {
    padding: 0.85rem 1.2rem;
    min-width: 130px;
  }
  .pill__label {
    font-size: 1.15rem;
  }
  .pill__sub {
    font-size: 0.7rem;
  }
}

/* Provenance page — about-style content section */
body[data-page="provenance"] .nav-menu__item[href="provenance.html"] {
  color: var(--text-bright);
  text-shadow: var(--glow-sm);
}

body[data-page="signals"] .nav-menu__item[href="signals.html"],
body[data-page="oracle"] .nav-menu__item[href="oracle.html"],
body[data-page="dispatches"] .nav-menu__item[href="dispatches.html"] {
  color: var(--text-bright);
  text-shadow: var(--glow-sm);
}

/* -------------------------------------------------------------
 * Status bar (top HUD) — shared across pages
 * ------------------------------------------------------------- */
.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.status-bar__left,
.status-bar__right {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.status-bar__pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green-500);
  box-shadow: var(--glow-sm);
  animation: pulse 1.4s ease-in-out infinite;
}

.status-bar__link {
  text-decoration: none;
  color: var(--text-muted);
  transition: color var(--dur-fast) var(--ease-out);
}

.status-bar__link:hover {
  color: var(--green-500);
  text-decoration: none;
}

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

/* -------------------------------------------------------------
 * Landing — the choice
 *
 * Centered cinematic moment. Works without the hands image
 * (typography + pill CTAs carry the page). Image lays behind
 * the type when present.
 * ------------------------------------------------------------- */
.choice {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 4rem 0;
  position: relative;
}

.choice__fallback {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  opacity: 0.95;
  transition: opacity 600ms var(--ease-out);
}

.choice__fallback span {
  position: absolute;
  width: min(58vw, 620px);
  aspect-ratio: 1;
  border: 1px solid rgba(0, 255, 102, 0.16);
  box-shadow: inset 0 0 44px rgba(0, 255, 102, 0.04);
  transform: rotate(45deg);
  animation: fallbackPulse 4.8s var(--ease-in-out) infinite;
}

.choice__fallback span:nth-child(2) {
  width: min(42vw, 450px);
  animation-delay: -1.6s;
}

.choice__fallback span:nth-child(3) {
  width: min(24vw, 260px);
  border-color: rgba(232, 255, 232, 0.16);
  animation-delay: -3.2s;
}

/*
 * Hero 3D canvas — fills the choice area as cinematic backdrop.
 * Now interactive: pointer-events: auto so OrbitControls can capture
 * drag-to-rotate. Text overlays above it use pointer-events: none so
 * the canvas underneath still receives drags; pill CTAs explicitly
 * re-enable pointer-events so they remain clickable.
 */
.choice__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: auto;
  cursor: grab;
  animation: fadeIn 1.4s var(--ease-out) both;
}

.choice__canvas:active {
  cursor: grabbing;
}

/*
 * Text overlays above the canvas — don't block drag events.
 * The CSS pills inside .choice__pills re-enable pointer-events
 * via their own .pill rule below.
 */
.choice__intro,
.choice__sub,
.choice__footer {
  pointer-events: none;
}

.choice__pills {
  pointer-events: none; /* container is just layout */
}

.pill {
  pointer-events: auto; /* actual click targets */
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fallbackPulse {
  0%,
  100% {
    opacity: 0.28;
    transform: rotate(45deg) scale(0.96);
  }
  50% {
    opacity: 0.72;
    transform: rotate(45deg) scale(1.04);
  }
}

.choice__intro,
.choice__pills,
.choice__footer {
  position: relative;
  z-index: 2;
}

.choice__loading {
  position: absolute;
  left: 50%;
  bottom: clamp(1.5rem, 5vh, 3.5rem);
  z-index: 3;
  width: min(280px, calc(100% - 2rem));
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  pointer-events: none;
  opacity: 1;
  transition: opacity 420ms var(--ease-out), transform 420ms var(--ease-out);
}

.choice__loading-bar {
  height: 1px;
  background:
    linear-gradient(90deg, var(--green-500), var(--green-100))
      0 0 / var(--hero-3d-progress, 12%) 100% no-repeat,
    rgba(0, 255, 102, 0.18);
  box-shadow: var(--glow-sm);
}

.choice__loading-text {
  color: var(--text-dim);
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-align: center;
}

.choice.is-3d-loaded .choice__loading,
.choice.is-3d-fallback .choice__loading {
  opacity: 0;
  transform: translate(-50%, 8px);
}

.choice.is-3d-loaded .choice__fallback {
  opacity: 0.22;
}

.choice__eyebrow {
  color: var(--text-muted);
  font-size: 0.82rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 1.5rem;
}

.choice__title {
  margin-bottom: 1rem;
}

.choice__sub {
  color: var(--text-muted);
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
  max-width: 40ch;
  margin-left: auto;
  margin-right: auto;
}

.choice__category {
  color: var(--text-dim);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin: 0 auto 3.4rem;
}

.choice__pills {
  display: flex;
  gap: 3rem;
  margin-top: 4.5rem;
  margin-bottom: 4rem;
  flex-wrap: wrap;
  justify-content: center;
}

.choice__footer {
  margin-top: auto;
  text-align: center;
}

.choice__footer-line {
  color: var(--text-dim);
  font-size: 0.82rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin: 0;
}

/* Sub-line: clarifies what the consultant actually does. Lower-key
   than the headline so the cinematic moment still owns the screen. */
.choice__footer-sub {
  color: var(--text-muted);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  margin: 0.6rem auto 0;
  max-width: 50ch;
}

/* -------------------------------------------------------------
 * Pill CTA — the two giant choices on the landing
 * ------------------------------------------------------------- */
.pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1.4rem 2rem;
  border: 1px solid var(--border-strong);
  background: rgba(1, 12, 5, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  text-decoration: none;
  color: var(--text-bright);
  width: min(280px, 100%);
  min-height: 116px;
  justify-content: center;
  transition:
    transform var(--dur-med) var(--ease-out),
    border-color var(--dur-med) var(--ease-out),
    box-shadow var(--dur-med) var(--ease-out);
}

.pill:hover {
  transform: translateY(-4px);
  text-decoration: none;
}

.pill:focus-visible {
  outline: 2px solid var(--green-500);
  outline-offset: 4px;
}

.pill__label {
  font-size: clamp(1.12rem, 2vw, 1.42rem);
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.15;
  margin-bottom: 0.35rem;
}

.pill__sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/*
 * Both pills live in the same green family — the 3D model shows
 * two near-identical pills, so the CTAs no longer reference color.
 * Hierarchy comes from intensity: Loop is muted, Signal is sharp.
 */

/* Loop — the simulation / the game (dimmer, cooler — "stuck" feel) */
.pill--loop:hover {
  border-color: var(--green-700);
  box-shadow: 0 0 18px rgba(0, 204, 82, 0.3);
}

.pill--loop:hover .pill__label {
  color: var(--green-300);
}

/* Signal — the agent web / reality (brighter, sharper — "awake" feel) */
.pill--signal:hover {
  border-color: var(--green-500);
  box-shadow: var(--glow-lg);
}

.pill--signal:hover .pill__label {
  color: var(--green-500);
}

/* -------------------------------------------------------------
 * Subpages — agent.html and crawl.html share this wrapper
 * ------------------------------------------------------------- */
.subpage-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2.5rem 0 4rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.88rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  transition: color var(--dur-fast) var(--ease-out);
}

.back-link:hover {
  color: var(--green-500);
  text-decoration: none;
}

.back-link__arrow {
  transition: transform var(--dur-fast) var(--ease-out);
}

.back-link:hover .back-link__arrow {
  transform: translateX(-3px);
}

.subpage-label {
  font-size: 0.78rem;
  color: var(--text-dim);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

/* -------------------------------------------------------------
 * Boot lines (used on agent.html — terminal type-on intro)
 * ------------------------------------------------------------- */
.boot__lines {
  margin-bottom: 1.5rem;
  min-height: 4rem;
}

.boot__line {
  display: block;
  font-size: 0.92rem;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
  white-space: pre;
}

.boot__line--current::after {
  content: "_";
  display: inline-block;
  margin-left: 4px;
  color: var(--green-500);
  animation: blink 1s steps(2) infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

/* Agent hero — 2-column grid. Copy left, bull head 3D right. */
.agent-hero {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 2.5rem;
  align-items: center;
  margin-bottom: 6rem;
  min-height: 60vh;
}

/*
 * Grid items must allow shrinking — otherwise the huge h1 forces
 * the copy column to expand past its 1.1fr allocation and the
 * visual column collapses below the text. min-width: 0 fixes the
 * default min-width: auto on grid children.
 */
.agent-hero__copy,
.agent-hero__visual {
  min-width: 0;
}

.agent-hero__visual {
  position: relative;
  min-height: 480px;
  height: 100%;
  overflow: hidden;
}

.agent-hero__fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  opacity: 1;
  transition: opacity 600ms var(--ease-out);
}

.agent-hero__fallback span {
  position: absolute;
  width: min(80%, 420px);
  aspect-ratio: 1;
  border: 1px solid rgba(0, 255, 102, 0.15);
  transform: rotate(45deg);
  animation: fallbackPulse 5.4s var(--ease-in-out) infinite;
}

.agent-hero__fallback span:nth-child(2) {
  width: min(58%, 300px);
  border-color: rgba(74, 184, 255, 0.18);
  animation-delay: -1.8s;
}

.agent-hero__fallback span:nth-child(3) {
  width: min(36%, 190px);
  border-color: rgba(232, 255, 232, 0.16);
  animation-delay: -3.6s;
}

#agent-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 1;
}

.agent-hero__loading {
  position: absolute;
  left: 50%;
  bottom: 1rem;
  z-index: 2;
  width: min(250px, calc(100% - 2rem));
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  pointer-events: none;
  transition: opacity 420ms var(--ease-out), transform 420ms var(--ease-out);
}

.agent-hero__loading-bar {
  height: 1px;
  background:
    linear-gradient(90deg, var(--green-500), var(--green-100))
      0 0 / var(--agent-3d-progress, 8%) 100% no-repeat,
    rgba(0, 255, 102, 0.18);
  box-shadow: var(--glow-sm);
}

.agent-hero__loading-text {
  color: var(--text-dim);
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-align: center;
}

.agent-hero__visual.is-3d-loaded .agent-hero__loading,
.agent-hero__visual.is-3d-fallback .agent-hero__loading {
  opacity: 0;
  transform: translate(-50%, 8px);
}

.agent-hero__visual.is-3d-loaded .agent-hero__fallback {
  opacity: 0.2;
}

@media (max-width: 860px) {
  .agent-hero {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .agent-hero__visual {
    min-height: 320px;
    order: -1; /* head appears above the copy on mobile */
  }
}

/* Hero copy on agent.html — fades in after boot lines */
.agent-hero__title,
.agent-hero__subtitle,
.agent-hero__cta {
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity var(--dur-slow) var(--ease-out),
    transform var(--dur-slow) var(--ease-out);
}

.agent-hero__subtitle {
  transition-delay: 180ms;
}

.agent-hero__cta {
  transition-delay: 360ms;
}

.agent-hero__title--ready,
.agent-hero__subtitle--ready,
.agent-hero__cta--ready {
  opacity: 1;
  transform: none;
}

.agent-hero__title {
  margin-bottom: 1.5rem;
}

.agent-hero__subtitle {
  margin-top: 1.2rem;
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 64ch;
}

/* -------------------------------------------------------------
 * Buttons (used throughout subpages)
 * ------------------------------------------------------------- */
.button {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1.4rem;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text-bright);
  font-family: var(--font-mono);
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  text-decoration: none;
  transition:
    background-color var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-fast) var(--ease-out);
}

.button:hover {
  background: var(--green-500);
  color: var(--bg);
  border-color: var(--green-500);
  box-shadow: var(--glow-md);
  text-decoration: none;
}

.button:focus-visible {
  outline: 2px solid var(--green-500);
  outline-offset: 3px;
}

.button--ghost {
  border-color: var(--border);
  color: var(--text-muted);
}

.button--ghost:hover {
  border-color: var(--green-500);
  background: transparent;
  color: var(--green-500);
  box-shadow: none;
}

.button__arrow {
  display: inline-block;
  transition: transform var(--dur-fast) var(--ease-out);
}

.button:hover .button__arrow {
  transform: translateX(3px);
}

/* -------------------------------------------------------------
 * Sections (used on agent.html)
 * ------------------------------------------------------------- */
section {
  margin-bottom: 6rem;
  scroll-margin-top: 2rem;
}

.section-heading {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 2.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.section-heading__index {
  font-size: 0.78rem;
  color: var(--text-muted);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  position: relative;
}

/* Pulsing LED dot before each section index — feels like a live signal */
.section-heading__index::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green-500);
  box-shadow: var(--glow-sm);
  animation: pulse 1.8s ease-in-out infinite;
  flex-shrink: 0;
}

/* -------------------------------------------------------------
 * Manifesto
 * ------------------------------------------------------------- */
.manifesto__body {
  max-width: 64ch;
}

.manifesto__lead {
  font-size: clamp(1.4rem, 2.6vw, 1.8rem);
  color: var(--text-bright);
  margin-bottom: 1.5rem;
  line-height: 1.3;
  max-width: 100%;
}

.manifesto__close {
  margin-top: 2rem;
  padding-left: 1rem;
  border-left: 2px solid var(--green-500);
  color: var(--text-bright);
  line-height: 1.5;
}

/* -------------------------------------------------------------
 * Services
 * ------------------------------------------------------------- */
.services__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.service {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 1.8rem 1.6rem;
  transition:
    border-color var(--dur-fast) var(--ease-out),
    transform var(--dur-med) var(--ease-out),
    box-shadow var(--dur-med) var(--ease-out);
}

.service {
  position: relative;
  transform-origin: center bottom;
}

/*
 * Boot-up corner brackets — appear when card enters the viewport.
 * Reads as "system boundary established" — agent-fx.js adds the
 * .is-booted class via IntersectionObserver.
 */
.service::before,
.service::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--green-500);
  opacity: 0;
  transition: opacity 0.45s var(--ease-out);
  pointer-events: none;
  box-shadow: 0 0 6px rgba(0, 255, 102, 0.45);
}

.service::before {
  top: -1px;
  left: -1px;
  border-right: none;
  border-bottom: none;
}

.service::after {
  bottom: -1px;
  right: -1px;
  border-left: none;
  border-top: none;
}

.service.is-booted::before,
.service.is-booted::after {
  opacity: 1;
}

.service:hover {
  border-color: var(--green-500);
  transform: translateY(-5px);
  box-shadow:
    0 12px 32px rgba(0, 0, 0, 0.4),
    0 0 24px rgba(0, 255, 102, 0.2);
}

.service__index {
  font-size: 0.78rem;
  color: var(--text-dim);
  letter-spacing: 0.15em;
  margin-bottom: 0.5rem;
}

.service__title {
  font-size: 1.15rem;
  color: var(--text-bright);
  margin-bottom: 0.4rem;
}

.service__alias {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0 0 1rem;
}

.service__body {
  font-size: 0.92rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.55;
}

/* -------------------------------------------------------------
 * Known signals — keyword chip cloud
 * Lightweight strip of vocabulary the consultant works in. Sits
 * between the manifesto and the services grid as a "proof ribbon".
 * ------------------------------------------------------------- */
.signals__lead {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.signals__list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.signals__list li {
  padding: 0.42rem 0.85rem;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  /* Stagger-in start state — agent-fx.js adds .is-booted */
  opacity: 0;
  transform: translateY(6px);
  transition:
    opacity 0.45s var(--ease-out),
    transform 0.45s var(--ease-out),
    border-color var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out);
}

.signals__list li.is-booted {
  opacity: 1;
  transform: none;
}

.signals__list li:hover {
  border-color: var(--green-500);
  color: var(--text-bright);
  transform: translateY(-2px);
  box-shadow: var(--glow-sm);
}

/* Random flicker — agent-fx.js toggles .is-flickering on a random
   chip every couple of seconds. Reads as "data point activating". */
.signals__list li.is-flickering {
  border-color: var(--green-500);
  color: var(--text-bright);
  box-shadow: var(--glow-md);
  background: var(--surface-strong);
}

/* -------------------------------------------------------------
 * Field log — concrete missions, formatted as agent dossier entries
 * ------------------------------------------------------------- */
.field-log__lead {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  letter-spacing: 0.02em;
}

.field-log__list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.field-log__entry {
  display: grid;
  grid-template-columns: minmax(120px, max-content) 1fr;
  gap: 1.5rem;
  padding: 1.5rem 0;
  border-bottom: 1px dashed var(--border);
  align-items: baseline;
  /* Boot-up — slides in from left when in view */
  opacity: 0;
  transform: translateX(-12px);
  transition:
    opacity 0.55s var(--ease-out),
    transform 0.55s var(--ease-out);
}

.field-log__entry.is-booted {
  opacity: 1;
  transform: none;
}

.field-log__entry:last-child {
  border-bottom: none;
}

.field-log__id {
  color: var(--green-500);
  text-shadow: var(--glow-sm);
  font-size: 0.78rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  white-space: nowrap;
}

#agent-protocol .field-log__id {
  font-size: 0;
}

#agent-protocol .field-log__id::after {
  font-size: 0.78rem;
}

#agent-protocol .field-log__entry:nth-child(1) .field-log__id::after {
  content: "01 :: BIND ENTITY";
}

#agent-protocol .field-log__entry:nth-child(2) .field-log__id::after {
  content: "02 :: EXPOSE SIGNAL";
}

#agent-protocol .field-log__entry:nth-child(3) .field-log__id::after {
  content: "03 :: PROVE RECOMMENDATION";
}

.field-log__body {
  margin: 0;
  color: var(--text);
  font-size: 0.98rem;
  line-height: 1.55;
  max-width: 64ch;
}

/* On narrow screens, stack the id above the body */
@media (max-width: 560px) {
  .field-log__entry {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
}

/* -------------------------------------------------------------
 * Open channel
 * ------------------------------------------------------------- */
.channel__lead {
  font-size: 1.2rem;
  color: var(--text-bright);
  margin-bottom: 0.3rem;
}

.channel__sub {
  color: var(--text-muted);
  margin-bottom: 2rem;
}

.channel__list {
  list-style: none;
  padding: 0;
  margin: 0 0 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.channel__list li {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-size: 1.05rem;
}

.channel__arrow {
  color: var(--green-500);
  font-weight: 700;
}

.channel__footnote {
  font-size: 0.82rem;
  color: var(--text-dim);
  letter-spacing: 0.05em;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

/* -------------------------------------------------------------
 * Crawl — the old web surface
 * ------------------------------------------------------------- */
.old-web {
  background: #031c0a;
  color: var(--green-100);
  font-family: Arial, Helvetica, sans-serif;
  border: 1px solid var(--border-strong);
  box-shadow: 0 0 36px rgba(0, 255, 102, 0.08);
  padding: clamp(1rem, 3vw, 2rem);
  position: relative;
}

.old-web::before {
  content: "HUMAN-READABLE ARCHIVE";
  position: absolute;
  top: -0.8rem;
  right: 1rem;
  background: var(--bg);
  color: var(--green-300);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--border-strong);
}

.old-web__chrome {
  border-bottom: 1px solid var(--border-strong);
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
}

.old-web__brand {
  color: var(--green-300);
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  margin-bottom: 0.8rem;
}

.old-web__search {
  display: flex;
  gap: 0.5rem;
  max-width: 720px;
}

.old-web__search input {
  flex: 1;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 0.8rem 1rem;
  color: var(--green-100);
  background: #010c05;
  font-size: 1rem;
  font-family: Arial, Helvetica, sans-serif;
}

.old-web__search button {
  border: 1px solid var(--border-strong);
  background: #021607;
  color: var(--green-300);
  border-radius: 4px;
  padding: 0 1rem;
  font-family: Arial, Helvetica, sans-serif;
}

.old-web__meta {
  color: var(--text-muted);
  font-size: 0.84rem;
  margin: 0.75rem 0 0;
}

.old-web__results {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 1.35rem;
  max-width: 760px;
}

.old-link {
  display: grid;
  gap: 0.18rem;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 0;
  cursor: pointer;
  font-family: Arial, Helvetica, sans-serif;
}

.old-link:hover .old-link__title,
.old-link:focus-visible .old-link__title {
  text-decoration: underline;
}

.old-link:focus-visible {
  outline: 2px solid var(--green-500);
  outline-offset: 4px;
}

.old-link__title {
  color: #6dff8e;
  font-size: 1.2rem;
  line-height: 1.25;
}

.old-link__url {
  color: #00cc52;
  font-size: 0.86rem;
  line-height: 1.35;
}

.old-link__snippet {
  color: #4a8a5e;
  font-size: 0.96rem;
  line-height: 1.45;
  max-width: 72ch;
}

.fake-site {
  position: fixed;
  inset: 0;
  z-index: 7600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms var(--ease-out);
}

.fake-site.is-visible {
  opacity: 1;
  pointer-events: all;
}

.fake-site__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(1, 12, 5, 0.78);
}

.fake-site__window {
  position: relative;
  width: min(860px, calc(100% - 2rem));
  margin: 7vh auto 0;
  background: #021607;
  color: var(--green-100);
  border: 1px solid var(--border-strong);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.45);
  font-family: Arial, Helvetica, sans-serif;
}

.fake-site__bar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.8rem;
  align-items: center;
  background: #031c0a;
  border-bottom: 1px solid var(--border-strong);
  padding: 0.7rem;
}

.fake-site__dots {
  display: flex;
  gap: 0.34rem;
}

.fake-site__dots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green-900);
}

.fake-site__address {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: #010c05;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
  color: var(--text-muted);
  font-size: 0.86rem;
}

.fake-site__close {
  border: 0;
  background: transparent;
  color: var(--green-300);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}

.fake-site__close:focus-visible {
  outline: 2px solid var(--green-500);
  outline-offset: 2px;
}

.fake-site__body {
  padding: clamp(1.4rem, 4vw, 3rem);
}

.fake-site__tag {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-bottom: 0.9rem;
}

.fake-site__body h3 {
  color: var(--green-100);
  font-family: Arial, Helvetica, sans-serif;
  font-size: clamp(1.7rem, 4vw, 3rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}

.fake-site__body p {
  color: var(--green-300);
  font-size: 1.05rem;
  line-height: 1.6;
  max-width: 68ch;
}

.fake-site__noise {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 2rem;
}

.fake-site__noise span {
  border: 1px solid var(--border-strong);
  background: #031c0a;
  color: var(--green-300);
  border-radius: 999px;
  padding: 0.42rem 0.7rem;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

@media (max-width: 640px) {
  .old-web__search {
    grid-template-columns: 1fr;
    display: grid;
  }

  .old-web__search button {
    min-height: 42px;
  }

  .fake-site__window {
    margin-top: 4vh;
  }
}

/* -------------------------------------------------------------
 * Reveal on scroll
 * ------------------------------------------------------------- */
.reveal {
  opacity: 1;
  transform: none;
}

.js-ready .reveal {
  opacity: 0;
  transform: translateY(12px);
  transition:
    opacity 520ms var(--ease-out),
    transform 520ms var(--ease-out);
}

.js-ready .reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* -------------------------------------------------------------
 * Provenance — about / archive page
 * ------------------------------------------------------------- */
.signal-hero,
.oracle-console {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.82fr);
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
  margin-bottom: 5rem;
}

.signal-hero h1,
.oracle-console h1 {
  margin-bottom: 1.2rem;
}

.signal-hero p,
.oracle-console p {
  color: var(--text-muted);
  font-size: 1.05rem;
}

.signal-radar {
  position: relative;
  aspect-ratio: 1;
  min-height: 320px;
  border: 1px solid var(--border-strong);
  background:
    radial-gradient(circle at center, rgba(0, 255, 102, 0.14), transparent 58%),
    #010c05;
  overflow: hidden;
  box-shadow: inset 0 0 48px rgba(0, 255, 102, 0.08), var(--glow-lg);
  cursor: crosshair;
  touch-action: none;
}

.signal-radar canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.signal-radar__core {
  position: absolute;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border: 1px solid var(--green-500);
  border-radius: 50%;
  color: var(--green-100);
  background: rgba(1, 12, 5, 0.76);
  box-shadow: var(--glow-md);
  font-weight: 700;
  pointer-events: none;
}

.signal-radar__tooltip {
  position: absolute;
  z-index: 3;
  width: min(230px, calc(100% - 2rem));
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--green-500);
  background: rgba(1, 12, 5, 0.94);
  color: var(--green-100);
  box-shadow: 0 0 24px rgba(0, 255, 102, 0.22);
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, calc(-100% - 14px));
  transition: opacity 140ms var(--ease-out);
}

.signal-radar__tooltip.is-visible {
  opacity: 1;
}

.signal-radar__tooltip strong {
  display: block;
  margin-bottom: 0.25rem;
  color: var(--green-100);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-shadow: var(--glow-sm);
}

.signal-radar__tooltip span {
  display: block;
  color: var(--green-300);
  font-size: 0.72rem;
  margin-bottom: 0.25rem;
}

.signal-radar__tooltip p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.75rem;
  line-height: 1.35;
}

.signal-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.signal-card {
  position: relative;
  min-height: 240px;
  border: 1px solid var(--border-strong);
  background:
    linear-gradient(145deg, rgba(0, 255, 102, 0.09), transparent 48%),
    var(--surface);
  padding: 1.1rem;
  overflow: hidden;
  transition:
    transform 240ms var(--ease-out),
    border-color 240ms var(--ease-out),
    box-shadow 240ms var(--ease-out);
}

.signal-card::after {
  content: "";
  position: absolute;
  inset: auto -30% -40% 20%;
  height: 120px;
  background: radial-gradient(circle, rgba(0, 255, 102, 0.22), transparent 68%);
  opacity: 0;
  transition: opacity 240ms var(--ease-out);
}

.signal-card:hover {
  transform: translateY(-6px);
  border-color: var(--green-500);
  box-shadow: var(--glow-md);
}

.signal-card:hover::after {
  opacity: 1;
}

.signal-card span {
  color: var(--text-dim);
  font-size: 0.74rem;
  letter-spacing: 0.18em;
}

.signal-card h2 {
  margin: 1rem 0 0.85rem;
  color: var(--green-100);
  font-size: clamp(1.15rem, 2vw, 1.45rem);
}

.signal-card p {
  color: var(--text-muted);
  font-size: 0.92rem;
}

.signal-card meter {
  position: absolute;
  left: 1.1rem;
  right: 1.1rem;
  bottom: 1.1rem;
  width: calc(100% - 2.2rem);
  height: 8px;
}

.signal-card meter::-webkit-meter-bar {
  background: #010c05;
  border: 1px solid var(--border);
}

.signal-card meter::-webkit-meter-optimum-value {
  background: var(--green-500);
  box-shadow: var(--glow-sm);
}

.oracle-console {
  grid-template-columns: minmax(0, 0.85fr) minmax(320px, 1fr);
  border: 1px solid var(--border-strong);
  background:
    linear-gradient(135deg, rgba(0, 255, 102, 0.07), transparent 45%),
    var(--surface);
  padding: clamp(1rem, 3vw, 2rem);
  overflow: hidden;
}

.oracle-console::before {
  content: "";
  position: absolute;
  inset: -40% auto auto -20%;
  width: 380px;
  height: 380px;
  border: 1px solid rgba(0, 255, 102, 0.18);
  transform: rotate(45deg);
  animation: fallbackPulse 6s var(--ease-in-out) infinite;
}

.oracle-console__copy,
.oracle-apparition,
.oracle-form,
.oracle-output {
  position: relative;
  z-index: 1;
}

.oracle-apparition {
  min-height: clamp(420px, 62vh, 680px);
  border: 1px solid var(--border-strong);
  background:
    radial-gradient(circle at 50% 34%, rgba(0, 255, 102, 0.18), transparent 45%),
    #010c05;
  overflow: hidden;
  box-shadow: inset 0 0 70px rgba(0, 255, 102, 0.1), var(--glow-lg);
}

.oracle-apparition::before,
.oracle-apparition::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
}

.oracle-apparition::before {
  background: repeating-linear-gradient(
    180deg,
    rgba(0, 255, 102, 0.08) 0,
    rgba(0, 255, 102, 0.08) 1px,
    transparent 1px,
    transparent 8px
  );
  mix-blend-mode: screen;
  opacity: 0.65;
}

.oracle-apparition::after {
  background:
    linear-gradient(90deg, transparent, rgba(232, 255, 232, 0.08), transparent),
    radial-gradient(circle at center, transparent 45%, rgba(1, 12, 5, 0.9) 100%);
  animation: oracleGlitch 5.2s steps(2) infinite;
}

.oracle-apparition__image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 38%;
  filter: saturate(1.15) contrast(1.08);
  transform: scale(1.015);
}

.oracle-apparition__image--human {
  opacity: 1;
  animation: oracleHumanCycle 8s var(--ease-in-out) infinite;
}

.oracle-apparition__image--code {
  opacity: 0;
  mix-blend-mode: screen;
  animation: oracleCodeCycle 8s var(--ease-in-out) infinite;
}

#oracleRain {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 3;
  mix-blend-mode: screen;
  opacity: 0;
  animation: oracleRainPulse 8s var(--ease-in-out) infinite;
}

@keyframes oracleHumanCycle {
  0%,
  34%,
  100% {
    opacity: 1;
    filter: saturate(1.15) contrast(1.08);
  }
  46%,
  78% {
    opacity: 0;
    filter: saturate(2) contrast(1.7) brightness(0.45);
  }
}

@keyframes oracleCodeCycle {
  0%,
  34%,
  100% {
    opacity: 0;
    transform: scale(1.015) translateX(0);
  }
  46%,
  78% {
    opacity: 1;
    transform: scale(1.025) translateX(1px);
  }
}

@keyframes oracleRainPulse {
  0%,
  30%,
  50%,
  73%,
  100% {
    opacity: 0;
  }
  35%,
  43%,
  79%,
  88% {
    opacity: 0.9;
  }
}

@keyframes oracleGlitch {
  0%,
  86%,
  100% {
    transform: translateX(0);
    opacity: 0.55;
  }
  88% {
    transform: translateX(8px);
    opacity: 0.95;
  }
  90% {
    transform: translateX(-5px);
    opacity: 0.7;
  }
}

.oracle-form {
  grid-column: 1 / -1;
  display: grid;
  gap: 0.7rem;
}

.oracle-form label {
  color: var(--text-muted);
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.oracle-form__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.7rem;
}

.oracle-form input {
  border: 1px solid var(--border-strong);
  background: #010c05;
  color: var(--green-100);
  font-family: var(--font-mono);
  padding: 1rem;
}

.oracle-form button {
  border: 1px solid var(--green-500);
  background: var(--green-500);
  color: var(--bg);
  font-family: var(--font-mono);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0 1.4rem;
  cursor: pointer;
}

.oracle-output {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 1rem;
  align-items: stretch;
  min-height: 330px;
}

.oracle-output__eye {
  position: relative;
  border: 1px solid var(--border-strong);
  background: #010c05;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.oracle-output__eye span {
  position: absolute;
  width: calc(42px * var(--n, 1));
  aspect-ratio: 1;
  border: 1px solid rgba(0, 255, 102, 0.35);
  border-radius: 50%;
  animation: oracleEye 3s var(--ease-in-out) infinite;
}

.oracle-output__eye span:nth-child(1) {
  --n: 2;
}

.oracle-output__eye span:nth-child(2) {
  --n: 3.5;
  animation-delay: -0.8s;
}

.oracle-output__eye span:nth-child(3) {
  --n: 5;
  animation-delay: -1.6s;
}

.oracle-lines {
  border: 1px solid var(--border-strong);
  background: #010c05;
  padding: 1rem;
  overflow: auto;
  min-height: 100%;
}

.oracle-lines p {
  margin: 0 0 0.55rem;
  max-width: none;
  color: var(--green-300);
  font-size: 0.92rem;
}

@keyframes oracleEye {
  0%,
  100% {
    transform: scale(0.88);
    opacity: 0.35;
  }
  50% {
    transform: scale(1.08);
    opacity: 1;
    box-shadow: var(--glow-md);
  }
}

@media (max-width: 900px) {
  .signal-hero,
  .oracle-console,
  .oracle-output {
    grid-template-columns: 1fr;
  }

  .signal-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .signal-grid,
  .oracle-form__row {
    grid-template-columns: 1fr;
  }

  .signal-radar {
    min-height: 260px;
  }
}

.prov-hero {
  margin-bottom: 5rem;
}

.prov-hero__title {
  margin-bottom: 1.5rem;
}

.prov-hero__sub {
  color: var(--text-muted);
  font-size: 1.2rem;
  max-width: 60ch;
}

.prov-body {
  max-width: 64ch;
}

.prov-body p {
  margin-bottom: 1.1rem;
}

.prov-name {
  color: var(--text-bright);
  text-shadow: var(--glow-sm);
  font-weight: 600;
}

.prov-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem 2rem;
  margin-bottom: 1.5rem;
  padding: 1.5rem;
  border: 1px solid var(--border-strong);
  background: var(--surface);
}

.prov-meta__item {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.prov-meta__label {
  font-size: 0.72rem;
  color: var(--text-dim);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.prov-meta__value {
  color: var(--text-bright);
  font-size: 0.98rem;
}

.prov-stance__line {
  font-size: clamp(1.15rem, 2vw, 1.4rem);
  color: var(--text-bright);
  margin-bottom: 0.4rem;
  line-height: 1.4;
  max-width: 100%;
}

.prov-stance__close {
  margin-top: 1.5rem;
  padding-left: 1rem;
  border-left: 2px solid var(--green-500);
  color: var(--green-300);
  font-size: 1rem;
}

/* -------------------------------------------------------------
 * Take control page — contact form
 *
 * Cinematic form. Custom-styled inputs, radio buttons rendered as
 * data-channel selectors, transmission animation on submit.
 * ------------------------------------------------------------- */
.control-hero {
  margin-bottom: 4rem;
}

.control-hero__title {
  margin-bottom: 1.5rem;
}

.control-hero__sub {
  color: var(--text-muted);
  font-size: 1.15rem;
  max-width: 56ch;
}

.control-section {
  position: relative;
}

.control-form {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  max-width: 720px;
}

.control-form__row {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  position: relative;
}

.control-form__row.is-invalid .control-form__input {
  border-color: #ff3055;
  box-shadow: 0 0 12px rgba(255, 48, 85, 0.25);
}

.control-form__label {
  font-size: 0.78rem;
  color: var(--text-muted);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
}

.control-form__input {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 0;
  padding: 0.95rem 1.1rem;
  color: var(--text-bright);
  font-family: var(--font-mono);
  font-size: 1rem;
  letter-spacing: 0.01em;
  transition:
    border-color 0.2s var(--ease-out),
    box-shadow 0.2s var(--ease-out),
    background 0.2s var(--ease-out);
  width: 100%;
}

.control-form__input:focus {
  outline: none;
  border-color: var(--green-500);
  background: var(--surface-strong);
  box-shadow: 0 0 14px rgba(0, 255, 102, 0.18);
}

.control-form__input::placeholder {
  color: var(--text-dim);
  opacity: 0.7;
}

.control-form__textarea {
  resize: vertical;
  min-height: 140px;
  line-height: 1.55;
}

.control-form__input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Custom radio buttons — rendered as data-channel selectors */
.control-form__options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 0.55rem;
}

.control-form__option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.8rem 1rem;
  border: 1px solid var(--border-strong);
  cursor: pointer;
  transition:
    border-color 0.2s var(--ease-out),
    background 0.2s var(--ease-out);
  background: var(--surface);
}

.control-form__option:hover {
  border-color: var(--green-500);
  background: var(--surface-strong);
}

.control-form__option input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  margin: 0;
  position: relative;
  flex-shrink: 0;
  cursor: pointer;
  transition: border-color 0.2s;
}

.control-form__option input[type="radio"]:checked {
  border-color: var(--green-500);
}

.control-form__option input[type="radio"]:checked::after {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  background: var(--green-500);
  box-shadow: var(--glow-sm);
}

.control-form__option input[type="radio"]:focus-visible {
  outline: 2px solid var(--green-500);
  outline-offset: 2px;
}

.control-form__option input[type="radio"]:checked ~ span {
  color: var(--green-500);
}

.control-form__option span {
  font-size: 0.94rem;
  color: var(--text);
  transition: color 0.2s;
}

/* Submit button — the moment of transmission */
.control-form__submit {
  margin-top: 1rem;
  padding: 1.2rem 2rem;
  background: var(--green-500);
  color: var(--bg);
  border: none;
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  transition:
    background 0.2s var(--ease-out),
    box-shadow 0.2s var(--ease-out),
    transform 0.2s var(--ease-out);
  align-self: flex-start;
  position: relative;
  overflow: hidden;
}

.control-form__submit:hover {
  background: var(--green-300);
  box-shadow: var(--glow-lg);
  transform: translateY(-2px);
}

.control-form__submit:focus-visible {
  outline: 2px solid var(--text-bright);
  outline-offset: 3px;
}

.control-form__submit:disabled {
  opacity: 0.8;
  cursor: progress;
  transform: none;
}

.control-form__submit-arrow {
  transition: transform 0.2s;
}

.control-form__submit:hover .control-form__submit-arrow {
  transform: translateX(4px);
}

/* "Transmitting" state — submit button shows progress text */
.control-form.is-transmitting .control-form__submit-label::after {
  content: " // transmitting";
}

.control-form.is-transmitting .control-form__submit-arrow {
  animation: blink 0.8s steps(2) infinite;
}

.control-form__note {
  color: var(--text-dim);
  font-size: 0.82rem;
  margin-top: 1rem;
  letter-spacing: 0.04em;
}

/* Agent handshake — replaces the ordinary contact-form rhythm. */
.control-form--handshake {
  max-width: none;
}

.handshake-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1rem;
  align-items: stretch;
}

.handshake-panel {
  position: relative;
  border: 1px solid var(--border-strong);
  background:
    linear-gradient(135deg, rgba(0, 255, 102, 0.055), transparent 34%),
    var(--surface);
  padding: 1rem;
  min-width: 0;
  overflow: hidden;
}

.handshake-panel::before,
.handshake-panel::after {
  content: "";
  position: absolute;
  width: 38px;
  height: 38px;
  pointer-events: none;
  opacity: 0.75;
}

.handshake-panel::before {
  top: -1px;
  left: -1px;
  border-top: 1px solid var(--green-500);
  border-left: 1px solid var(--green-500);
}

.handshake-panel::after {
  right: -1px;
  bottom: -1px;
  border-right: 1px solid var(--green-500);
  border-bottom: 1px solid var(--green-500);
}

.handshake-panel--packet {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1.2rem;
  align-items: start;
}

.handshake-panel--packet .handshake-panel__head,
.handshake-panel--packet .control-form__note {
  grid-column: 1 / -1;
}

.handshake-panel__head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.2rem;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 0.76rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.handshake-panel__head strong {
  color: var(--text-bright);
  font-weight: 600;
}

.scan-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.6rem;
}

.scan-input__button {
  border: 1px solid var(--border-strong);
  background: rgba(0, 255, 102, 0.08);
  color: var(--green-300);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 0 1rem;
  cursor: pointer;
  transition:
    border-color 0.2s var(--ease-out),
    color 0.2s var(--ease-out),
    background 0.2s var(--ease-out);
}

.scan-input__button:hover,
.scan-input__button:focus-visible {
  border-color: var(--green-500);
  color: var(--text-bright);
  background: rgba(0, 255, 102, 0.14);
  outline: none;
}

.scan-input__button:disabled {
  cursor: progress;
  color: var(--text-dim);
}

.scan-lines {
  display: grid;
  gap: 0.25rem;
  padding: 0.9rem;
  border: 1px solid var(--border);
  background: rgba(1, 12, 5, 0.55);
  color: var(--text-dim);
  font-size: 0.76rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.scan-lines span::before {
  content: "> ";
  color: var(--green-500);
}

.scan-lines[data-state="running"] span {
  animation: scanPulse 0.8s var(--ease-in-out) infinite alternate;
  animation-delay: calc(var(--row, 0) * 110ms);
}

.scan-lines span:nth-child(2) {
  --row: 1;
}

.scan-lines span:nth-child(3) {
  --row: 2;
}

.scan-lines[data-state="complete"] {
  color: var(--green-300);
  border-color: rgba(0, 255, 102, 0.32);
}

.packet-preview {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}

.packet-preview__row {
  min-height: 82px;
  border: 1px solid var(--border);
  background: rgba(1, 12, 5, 0.62);
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.55rem;
}

.packet-preview__row--wide {
  grid-column: 1 / -1;
}

.packet-preview__row span {
  color: var(--text-dim);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
}

.packet-preview__row strong {
  color: var(--text-bright);
  font-size: clamp(0.9rem, 1.8vw, 1.1rem);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.packet-preview__row strong.is-updating {
  animation: packetLock 360ms var(--ease-out);
}

.handshake-meter {
  width: 64px;
  min-height: 236px;
  display: flex;
  flex-direction: column-reverse;
  gap: 0.45rem;
  padding: 0.35rem;
  border: 1px solid var(--border);
  background: rgba(1, 12, 5, 0.65);
}

.handshake-meter span {
  flex: 1;
  background: rgba(0, 255, 102, 0.12);
  border: 1px solid rgba(0, 255, 102, 0.12);
  animation: meterPulse 1.8s var(--ease-in-out) infinite;
  animation-delay: calc(var(--i) * -120ms);
}

.control-form--handshake .control-form__submit {
  grid-column: 1 / -1;
  align-self: stretch;
  width: 100%;
}

@media (max-width: 860px) {
  .handshake-grid,
  .handshake-panel--packet {
    grid-template-columns: 1fr;
  }

  .handshake-meter {
    width: 100%;
    min-height: 42px;
    flex-direction: row;
  }
}

@media (max-width: 560px) {
  .scan-input,
  .packet-preview {
    grid-template-columns: 1fr;
  }
}

.control-form--legacy[hidden] {
  display: none;
}

@keyframes scanPulse {
  from {
    opacity: 0.45;
  }
  to {
    opacity: 1;
  }
}

@keyframes packetLock {
  0% {
    color: var(--green-500);
    text-shadow: var(--glow-sm);
  }
  100% {
    color: var(--text-bright);
    text-shadow: none;
  }
}

@keyframes meterPulse {
  0%,
  100% {
    opacity: 0.25;
  }
  50% {
    opacity: 1;
    background: rgba(0, 255, 102, 0.28);
  }
}

/* Field-validated tick that appears next to each label after submit */
.control-form__tick {
  color: var(--green-500);
  text-shadow: var(--glow-sm);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  margin-left: auto;
  opacity: 0;
  animation: tickIn 0.35s var(--ease-out) forwards;
}

@keyframes tickIn {
  from {
    opacity: 0;
    transform: translateX(-6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Success overlay — appears after the transmission "completes" */
.control-success {
  position: fixed;
  inset: 0;
  background: rgba(1, 12, 5, 0.92);
  display: grid;
  place-items: center;
  z-index: 8000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s var(--ease-out);
  padding: 2rem;
}

.control-success.is-visible {
  opacity: 1;
  pointer-events: all;
}

.control-success__inner {
  max-width: 640px;
  text-align: center;
  border: 1px solid var(--green-500);
  background: var(--surface);
  padding: 3rem 2.5rem;
  position: relative;
  box-shadow: 0 0 60px rgba(0, 255, 102, 0.25);
}

.control-success__close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border-strong);
  background: rgba(1, 12, 5, 0.85);
  color: var(--green-300);
  font-family: var(--font-mono);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition:
    color 0.2s var(--ease-out),
    border-color 0.2s var(--ease-out),
    box-shadow 0.2s var(--ease-out);
}

.control-success__close:hover,
.control-success__close:focus-visible {
  color: var(--text-bright);
  border-color: var(--green-500);
  box-shadow: var(--glow-sm);
  outline: none;
}

.control-success__inner::before,
.control-success__inner::after {
  content: "";
  position: absolute;
  width: 24px;
  height: 24px;
  border: 1.5px solid var(--green-500);
  pointer-events: none;
  box-shadow: 0 0 6px rgba(0, 255, 102, 0.5);
}

.control-success__inner::before {
  top: -2px;
  left: -2px;
  border-right: none;
  border-bottom: none;
}

.control-success__inner::after {
  bottom: -2px;
  right: -2px;
  border-left: none;
  border-top: none;
}

.control-success__status {
  color: var(--text-muted);
  font-size: 0.82rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 1rem;
}

.control-success__headline {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  color: var(--text-bright);
  text-shadow: var(--glow-md);
  margin-bottom: 1.5rem;
  letter-spacing: 0.04em;
}

.control-success__body {
  color: var(--text);
  font-size: 1rem;
  max-width: none;
  margin: 0 auto 1.5rem;
}

.control-success__body code {
  color: var(--green-300);
  background: var(--surface-strong);
  padding: 0.15rem 0.4rem;
}

.control-success__footer {
  color: var(--text-dim);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  margin: 0;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

@media (max-width: 720px) {
  .control-form__options {
    grid-template-columns: 1fr;
  }
}

/* -------------------------------------------------------------
 * Agent page ambient decorations
 *
 * Vertical green accent line on the left edge of each content
 * section (everything below the hero). Plus 4 floating ambient
 * LED dots that drift around the viewport at different cadences.
 *
 * Scoped via [data-page="agent"] so these only appear on agent.html.
 * ------------------------------------------------------------- */

body[data-page="agent"] main > section:not(.agent-hero) {
  position: relative;
  padding-left: 1.5rem;
}

body[data-page="agent"] main > section:not(.agent-hero)::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.5rem;
  bottom: 0.5rem;
  width: 1px;
  background: linear-gradient(
    180deg,
    var(--green-500) 0%,
    var(--green-700) 60%,
    transparent 100%
  );
  box-shadow: 0 0 8px rgba(0, 255, 102, 0.3);
  pointer-events: none;
}

/* Floating ambient LEDs — four corners with offset drift cycles */
body[data-page="agent"]::before,
body[data-page="agent"]::after,
body[data-page="agent"] main::before,
body[data-page="agent"] main::after {
  content: "";
  position: fixed;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--green-500);
  box-shadow: 0 0 8px rgba(0, 255, 102, 0.7);
  pointer-events: none;
  z-index: 5;
}

body[data-page="agent"]::before {
  top: 18vh;
  right: 6%;
  animation: drift 9s ease-in-out infinite;
}

body[data-page="agent"]::after {
  top: 75vh;
  left: 5%;
  animation: drift 11s ease-in-out infinite 2s;
}

body[data-page="agent"] main::before {
  top: 50vh;
  right: 4%;
  animation: drift 13s ease-in-out infinite 4s;
}

body[data-page="agent"] main::after {
  top: 35vh;
  left: 3%;
  animation: drift 15s ease-in-out infinite 1s;
}

@keyframes drift {
  0%,
  100% {
    transform: translate(0, 0);
    opacity: 0.3;
  }
  25% {
    transform: translate(8px, -20px);
    opacity: 0.7;
  }
  50% {
    transform: translate(-5px, -10px);
    opacity: 1;
  }
  75% {
    transform: translate(3px, 10px);
    opacity: 0.5;
  }
}

/* Reduced motion — kill drift animations */
@media (prefers-reduced-motion: reduce) {
  body[data-page="agent"]::before,
  body[data-page="agent"]::after,
  body[data-page="agent"] main::before,
  body[data-page="agent"] main::after {
    animation: none;
    opacity: 0.5;
  }
}

/* -------------------------------------------------------------
 * Footer
 * ------------------------------------------------------------- */
.site-footer {
  margin-top: 6rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.site-footer p {
  margin: 0;
  color: var(--text-muted);
}

.site-footer--home {
  margin-top: 1rem;
}

.site-footer__legal {
  width: 100%;
  display: flex;
  gap: 0.85rem;
  flex-wrap: wrap;
  align-items: center;
  padding-top: 0.8rem;
  border-top: 1px dashed rgba(0, 255, 102, 0.16);
}

.site-footer__legal a {
  position: relative;
  color: var(--green-300);
  text-decoration: none;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.site-footer__legal a:hover {
  color: var(--text-bright);
  text-shadow: var(--glow-sm);
}

.site-footer__legal span {
  color: var(--text-dim);
}

body.agent-vision-active .site-footer__legal a::after {
  content: attr(data-agent-vision);
  display: inline-block;
  margin-left: 0.55rem;
  color: var(--green-500);
  font-size: 0.66rem;
  letter-spacing: 0.04em;
  text-transform: none;
  opacity: 0.78;
}

/* -------------------------------------------------------------
 * Policy pages
 * ------------------------------------------------------------- */
.policy-hero {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  background:
    linear-gradient(135deg, rgba(0, 255, 102, 0.13), rgba(1, 12, 5, 0.88)),
    repeating-linear-gradient(90deg, rgba(0, 255, 102, 0.08) 0 1px, transparent 1px 72px),
    var(--surface);
  padding: clamp(2rem, 6vw, 4.5rem);
  min-height: 62vh;
}

.policy-hero::before {
  content: "";
  position: absolute;
  inset: -30%;
  background:
    radial-gradient(circle at 22% 18%, rgba(232, 255, 232, 0.14), transparent 24%),
    radial-gradient(circle at 80% 64%, rgba(0, 255, 102, 0.16), transparent 30%);
  animation: policyScan 9s linear infinite;
  pointer-events: none;
}

.policy-hero > * {
  position: relative;
  z-index: 1;
}

.policy-kicker {
  color: var(--green-300);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  margin-bottom: 1.4rem;
}

.policy-lead {
  max-width: 66ch;
  color: var(--text-muted);
  font-size: 1rem;
  margin-top: 1.6rem;
}

.policy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-top: 2.4rem;
}

.policy-card {
  border: 1px solid var(--border-strong);
  background: rgba(2, 22, 7, 0.82);
  padding: 1.2rem;
  min-height: 150px;
  box-shadow: inset 0 0 24px rgba(0, 255, 102, 0.04);
}

.policy-card h2 {
  font-size: 1rem;
  color: var(--text-bright);
  margin-bottom: 0.8rem;
  letter-spacing: 0.02em;
}

.policy-card p,
.policy-card li {
  color: var(--text-muted);
  font-size: 0.88rem;
}

.policy-card ul {
  margin: 0;
  padding-left: 1.1rem;
}

@keyframes policyScan {
  from { transform: translate3d(-3%, -2%, 0) rotate(0deg); }
  to { transform: translate3d(3%, 2%, 0) rotate(360deg); }
}

/* -------------------------------------------------------------
 * Responsive
 * ------------------------------------------------------------- */
@media (max-width: 720px) {
  body {
    font-size: 14px;
  }

  .status-bar {
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
  }

  .status-bar__left,
  .status-bar__right {
    gap: 1rem;
  }

  .choice {
    padding: 2rem 0;
  }

  .choice__pills {
    flex-direction: column;
    gap: 1.5rem;
    width: 100%;
  }

  .pill {
    width: 100%;
  }

  .site-footer {
    flex-direction: column;
  }
}

/* -------------------------------------------------------------
 * Reduced motion
 * ------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .js-ready .reveal,
  .js-ready .reveal.is-visible {
    opacity: 1;
    transform: none;
  }

  .agent-hero__title,
  .agent-hero__subtitle,
  .agent-hero__cta {
    opacity: 1;
    transform: none;
  }

  .choice__image {
    opacity: 0.55;
  }
}
