:root {
  --bg: #030805;
  --green: #3dff7a;
  --green-mid: #24c85a;
  --green-dim: #178a3c;
  --green-faint: rgba(61, 255, 122, 0.14);
  --yellow: #f0ea5a;
  --white: #e9fff0;
  --glow: 0 0 6px rgba(61, 255, 122, 0.55), 0 0 18px rgba(61, 255, 122, 0.18);
  --font: "Courier Prime", "Courier New", Courier, monospace;
  --gutter: clamp(16px, 4vw, 48px);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse at 50% 40%, #071a0d 0%, var(--bg) 70%) fixed,
    var(--bg);
  color: var(--green);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.55;
  text-shadow: var(--glow);
  overflow-x: hidden;
}

::selection { background: var(--green); color: var(--bg); text-shadow: none; }

a { color: inherit; }

/* ---------- CRT display text ----------
   Glyphs are painted through a repeating 3-column phosphor mask (bright / mid / gap),
   like a Courier face seen through an aperture grille, then given a soft bloom. */
.crt-text {
  color: transparent;
  background-image: repeating-linear-gradient(
    90deg,
    var(--green) 0 1.5px,
    var(--green-mid) 1.5px 2.5px,
    transparent 2.5px 3.5px
  );
  -webkit-background-clip: text;
  background-clip: text;
  text-shadow: none;
  filter: drop-shadow(0 0 3px rgba(61, 255, 122, 0.7)) drop-shadow(0 0 14px rgba(61, 255, 122, 0.25));
}

/* Whole-screen scanlines + vignette */
.crt-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
  background:
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.22) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.55) 100%);
  animation: crt-flicker 6s infinite steps(1);
}
@keyframes crt-flicker {
  0%, 100% { opacity: 1; }
  41% { opacity: 0.9; }
  42% { opacity: 1; }
  77% { opacity: 0.94; }
  78% { opacity: 1; }
}

/* ---------- Layout ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px var(--gutter);
  border-bottom: 1px solid var(--green-faint);
}

.brandline {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  column-gap: 20px;
  row-gap: 2px;
  min-width: 0;
}

.brand {
  text-decoration: none;
  font-weight: 700;
  font-size: 24px;
  letter-spacing: 0.18em;
}

.layout {
  flex: 1;
  width: 100%;
  /* full-bleed box with the 1280px content width done in padding, so overflow-x: clip
     trims the cell's canvas at the window edge (no sideways scroll) without clipping it vertically */
  padding-block: clamp(32px, 6vw, 72px);
  padding-inline: max(var(--gutter), calc((100% - 1280px) / 2 + var(--gutter)));
  overflow-x: clip;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: clamp(24px, 4vw, 64px);
  align-items: center;
}

.prompt {
  margin: 0 0 20px;
  color: var(--green-dim);
  font-size: 15px;
}
.prompt::after {
  content: "";
  display: inline-block;
  width: 0.6em;
  height: 1.05em;
  margin-left: 0.35em;
  vertical-align: -0.15em;
  background: var(--green);
  box-shadow: var(--glow);
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.headline {
  margin: 0 0 32px;
  font-size: clamp(32px, 4.2vw, 56px);
  line-height: 1.08;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.headline .line { display: block; }
.headline .line--dim { opacity: 0.6; }

.questions {
  list-style: none;
  margin: 0 0 32px;
  padding: 0;
  font-size: 18px;
}
.questions li {
  position: relative;
  padding-left: 1.6em;
  margin-bottom: 8px;
}
.questions li::before {
  content: ">";
  position: absolute;
  left: 0;
  color: var(--green-dim);
}

.closer {
  margin: 0;
  font-size: 18px;
  max-width: 34em;
}
.closer strong {
  display: block;
  margin-top: 6px;
  font-size: clamp(22px, 2.4vw, 28px);
  line-height: 1.25;
  /* finer grille at mid sizes so it stays legible */
  background-image: repeating-linear-gradient(90deg, var(--green) 0 1px, var(--green-mid) 1px 1.75px, transparent 1.75px 2.25px);
}

.tagline {
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--green-dim);
}

.footer {
  padding: 18px var(--gutter);
  border-top: 1px solid var(--green-faint);
  font-size: 13px;
  color: var(--green-dim);
}

/* ---------- Organism + signup ---------- */
.organism-wrap {
  display: flex;
  justify-content: center;
  scroll-margin-top: 24px;
}

.organism {
  position: relative;
  width: min(100%, 600px);
  aspect-ratio: 1 / 1.12; /* the cell is ~12% taller than wide */
  display: grid;
  place-items: center;
}

.organism__canvas {
  position: absolute;
  /* the canvas bleeds past its column so the cell can grow around the signup box;
     app.js decides how much of that room to use */
  /* (a canvas won't stretch between insets, so its size is set explicitly) */
  top: -14%;
  left: -14%;
  width: 128%;
  height: 128%;
  pointer-events: none;
  filter: drop-shadow(0 0 4px rgba(61, 255, 122, 0.45));
}

.signup {
  position: relative;
  z-index: 1;
  width: clamp(290px, 23vw, 330px); /* independent of the cell's size */
  padding: 16px 14px 12px;
  background: rgba(3, 10, 5, 0.9);
  border: 1px solid var(--green-dim);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6), 0 0 28px rgba(0, 0, 0, 0.85), 0 0 18px rgba(61, 255, 122, 0.18);
}

.signup__title {
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.signup__row {
  display: flex;
  gap: 8px;
}

.signup input[type="email"] {
  flex: 1;
  min-width: 0;
  padding: 10px 10px;
  font: inherit;
  font-size: 16px; /* ≥16px avoids iOS zoom */
  color: var(--green);
  text-shadow: var(--glow);
  caret-color: var(--green);
  background: #010402;
  border: 1px solid var(--green-dim);
  border-radius: 0;
  outline: none;
}
.signup input::placeholder { color: var(--green-dim); opacity: 0.8; text-shadow: none; }
.signup input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 1px var(--green), 0 0 14px rgba(61, 255, 122, 0.35);
}
.signup input[aria-invalid="true"] { border-color: var(--yellow); }

.signup__status {
  min-height: 1.5em;
  margin: 10px 0 0;
  font-size: 14px;
  line-height: 1.4;
}
.signup__status.is-error { color: var(--yellow); text-shadow: 0 0 6px rgba(240, 234, 90, 0.5); }

/* echoed command, e.g.  > join "you@work.dev" -addToList */
.signup__cmd {
  margin: 10px 0 0;
  font-size: 14px;
  line-height: 1.4;
}
.signup__cmd + .signup__status { margin-top: 4px; }
.signup__addr { word-break: break-all; } /* long addresses wrap anywhere, not at their hyphens */
.signup__flag { white-space: nowrap; }

.signup.is-done .signup__row { display: none; }
.signup.is-done .signup__cmd { font-size: 16px; margin-top: 0; }
.signup.is-done .signup__status { font-size: 16px; }
.signup.is-done .signup__cmd[hidden] + .signup__status { margin-top: 0; }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Buttons: janky phosphor flicker into yellow on hover ---------- */
.btn {
  font: inherit;
  font-weight: 700;
  color: var(--green);
  text-shadow: var(--glow);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.btn--link { font-size: 15px; padding: 6px 0; }
.btn--primary {
  padding: 0 12px;
  border: 1px solid var(--green-dim);
  background: #010402;
  font-size: 15px;
}

.btn:hover,
.btn:focus-visible {
  color: var(--yellow);
  text-shadow: 0 0 6px rgba(240, 234, 90, 0.55), 0 0 16px rgba(240, 234, 90, 0.2);
  /* --jit-* are randomised by app.js on every pointerenter so no two hovers flicker the same */
  animation: jank var(--jit-dur, 260ms) steps(1, end) var(--jit-delay, 0ms) both;
}
.btn--primary:hover,
.btn--primary:focus-visible { border-color: var(--yellow); }
.btn:focus-visible { outline: 1px dashed var(--yellow); outline-offset: 4px; }
.btn:disabled { cursor: progress; opacity: 0.6; animation: none; }

@keyframes jank {
  0%   { color: var(--green); }
  9%   { color: var(--yellow); }
  17%  { color: var(--green); }
  21%  { color: var(--yellow); }
  38%  { color: var(--green); }
  44%  { color: var(--yellow); }
  52%  { color: var(--green); }
  70%  { color: var(--yellow); }
  100% { color: var(--yellow); }
}

/* ---------- About screen ---------- */
.about {
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--green);
}
.about::backdrop {
  background:
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.22) 0 1px, transparent 1px 3px),
    rgba(2, 6, 3, 0.94);
  backdrop-filter: blur(3px);
}
.about__screen {
  /* one text size throughout */
  font-size: 20px;
  line-height: 1.6;
  max-width: 40em;
  min-height: 100%;
  margin: 0 auto;
  padding: clamp(32px, 10vh, 120px) var(--gutter);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1.2em;
}
.about__screen p { margin: 0; }
.about__prompt { color: var(--green-dim); }
.about__screen .btn { font-size: inherit; align-self: flex-start; }
.about[open] .about__screen { animation: power-on 220ms steps(4, end); }
@keyframes power-on {
  0%   { opacity: 0; transform: scaleY(0.02); }
  50%  { opacity: 1; transform: scaleY(0.04); }
  100% { opacity: 1; transform: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); align-content: start; }
  .organism { width: min(100%, 520px); }
  .organism__canvas { top: 0; left: 0; width: 100%; height: 100%; } /* stacked: no bleed into the copy */
  .signup { width: clamp(290px, 64%, 340px); }
}

@media (max-width: 480px) {
  body { font-size: 16px; }
  .brand { font-size: 18px; letter-spacing: 0.14em; }
  .btn--link { font-size: 13px; }
  .brandline { flex-direction: column; }
  .tagline { font-size: 11px; letter-spacing: 0.08em; }
  .about__screen { font-size: 17px; }
  .questions, .closer { font-size: 16px; }
  /* let the cell run edge to edge so the form doesn't swallow it */
  .organism-wrap { margin-inline: calc(-1 * var(--gutter)); }
  .organism { width: 100%; max-width: 440px; }
  .signup { width: 68%; padding: 10px 10px 6px; }
  .signup__title { font-size: 13px; margin-bottom: 8px; }
  .signup__row { gap: 6px; }
  .signup input[type="email"] { padding: 8px; }
  .btn--primary { padding: 0 8px; font-size: 13px; }
  .signup__status, .signup__cmd { font-size: 13px; margin-top: 6px; }
  .signup.is-done .signup__cmd, .signup.is-done .signup__status { font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .crt-overlay, .prompt::after, .about[open] .about__screen { animation: none; }
  .btn:hover, .btn:focus-visible { animation: none; }
}
