/* Neon on near-black, shared by the page and Catalog Control. Every text
   colour keeps at least 4.5:1 contrast against --ink. */

:root {
  --ink: #07060d;
  --ink-2: #110f1f;
  --line: #2b2550;
  --magenta: #ff2bd6;
  --cyan: #2de2ff;
  --acid: #b8ff3d;
  --text: #e8e6f0;
  --muted: #a9a3c4;
  --warn: #ff5c8a;
  --mono: ui-monospace, "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  --sans: "Inter", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  background:
    radial-gradient(ellipse at 20% -10%, rgba(255,43,214,0.18) 0%, transparent 55%),
    radial-gradient(ellipse at 85% 110%, rgba(45,226,255,0.14) 0%, transparent 55%),
    var(--ink);
  color: var(--text);
  font: 17px/1.55 var(--sans);
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  padding: 3rem 1.25rem 2rem;
  overflow-x: hidden;
}

/* Rain, behind everything. */
.rain {
  position: fixed; inset: -50% 0 0 0; z-index: -1; pointer-events: none;
  background: repeating-linear-gradient(100deg, transparent 0 22px, rgba(45,226,255,0.05) 22px 23px, transparent 23px 61px);
  animation: rain 0.9s linear infinite;
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0);
}

/* Masthead */

.masthead { text-align: center; margin-bottom: 2.5rem; }
.corp {
  margin: 0; font: 0.72rem var(--mono); letter-spacing: 0.3em; text-transform: uppercase; color: var(--muted);
}
.masthead h1 {
  font: 700 clamp(2.2rem, 6vw, 3.8rem) var(--mono);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin: 0.5rem 0 0;
  color: var(--text);
  text-shadow: 0 0 8px var(--magenta), 0 0 28px rgba(255,43,214,0.55);
}
.tagline { margin: 0.3rem 0 0; color: var(--cyan); font: 0.95rem var(--mono); letter-spacing: 0.08em; }

main { width: min(760px, 100%); }

/* The body's data-phase picks the visible panel. */

.panel { display: none; text-align: center; animation: arrive 0.4s steps(4) both; }
body[data-phase="ask"] #ask,
body[data-phase="gathering"] #gathering,
body[data-phase="seeking"] #seeking,
body[data-phase="fact"] #fact { display: block; }

h2 { font: 600 1.7rem var(--mono); margin: 1.6rem 0 0.4rem; letter-spacing: 0.04em; }
.topic { color: var(--acid); text-shadow: 0 0 10px rgba(184,255,61,0.5); }

.litany { color: var(--muted); min-height: 1.6em; margin: 0.4rem 0; font-family: var(--mono); font-size: 0.95rem; }
.countdown { font: 0.8rem var(--mono); letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.seconds { color: var(--acid); font-size: 1.1rem; }

/* Chromatic glitch: two offset copies of data-text flicker in and out. */

.glitch { position: relative; }
.glitch::before, .glitch::after {
  content: attr(data-text);
  position: absolute; inset: 0;
  pointer-events: none;
  opacity: 0;
}
.glitch::before { color: var(--cyan); animation: glitch-a 3.1s steps(1) infinite; }
.glitch::after { color: var(--magenta); animation: glitch-b 2.3s steps(1) infinite; }

/* The question */

.seek { display: flex; gap: 0.6rem; justify-content: center; flex-wrap: wrap; margin: 0 0 1rem; }
input {
  flex: 1 1 22rem; max-width: 30rem;
  background: var(--ink-2); color: var(--text);
  border: 1px solid var(--line); border-bottom: 2px solid var(--cyan);
  padding: 0.85rem 1rem; font: 1rem var(--mono); border-radius: 0;
}
input::placeholder { color: var(--muted); }
input:focus { outline: none; box-shadow: 0 0 0 2px var(--magenta), 0 0 18px rgba(255,43,214,0.4); }
button {
  background: var(--cyan);
  color: var(--ink); border: 0; border-radius: 0;
  padding: 0.85rem 1.4rem; font: 700 0.85rem var(--mono);
  letter-spacing: 0.16em; text-transform: uppercase; cursor: pointer;
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
  box-shadow: 0 0 18px rgba(45,226,255,0.45);
}
button:hover { background: var(--acid); }
button.quiet { background: transparent; color: var(--magenta); box-shadow: inset 0 0 0 1px var(--magenta); clip-path: none; }
.fineprint { color: var(--muted); font-size: 0.85rem; }
.notice { color: var(--warn); font-family: var(--mono); }

/* Waiting screens get scanlines that crawl. */

.screen { position: relative; width: 280px; height: 280px; margin: 0 auto; }
.screen::after {
  content: ""; position: absolute; inset: -10px; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(7,6,13,0.55) 0 2px, transparent 2px 4px);
  animation: crawl 4s linear infinite;
}

/* Gathering: twelve Truth Seekers orbit a core and drift inward. */

.congregation { animation: revolve 14s linear infinite, jolt 5s steps(1) infinite; }
.seeker {
  position: absolute; top: 50%; left: 50%;
  width: 12px; height: 12px; margin: -6px;
  background: var(--cyan);
  box-shadow: 0 0 12px var(--cyan);
  transform: rotate(calc(var(--i) * 30deg)) translateX(120px);
  animation: converge 3.2s ease-in-out infinite alternate;
  animation-delay: calc(var(--i) * -0.27s);
}
.seeker:nth-child(3n) { background: var(--magenta); box-shadow: 0 0 12px var(--magenta); }
.core {
  position: absolute; top: 50%; left: 50%;
  width: 54px; height: 54px; margin: -27px;
  border: 2px solid var(--acid);
  box-shadow: 0 0 22px var(--acid), inset 0 0 18px rgba(184,255,61,0.6);
  transform: rotate(45deg);
  animation: pulse 1.6s ease-in-out infinite;
}

/* Seeking: a scanner sweeps the topic. */

.ring {
  position: absolute; inset: 40px;
  border: 1px solid var(--magenta); border-radius: 50%;
  animation: ripple 3s ease-out infinite;
}
.ring:nth-child(2) { animation-delay: -1s; border-color: var(--cyan); }
.ring:nth-child(3) { animation-delay: -2s; }
.beam {
  position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0 300deg, rgba(45,226,255,0.6) 355deg, transparent 360deg);
  animation: revolve 2.2s linear infinite;
}
.iris {
  position: absolute; top: 50%; left: 50%;
  width: 96px; height: 96px; margin: -48px;
  border-radius: 50%;
  background: radial-gradient(circle, #3a1050 0%, var(--ink-2) 70%);
  border: 2px solid var(--magenta);
  box-shadow: 0 0 20px rgba(255,43,214,0.6);
  display: grid; place-items: center;
  animation: gaze 4s steps(6) infinite;
}
.pupil {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--ink); box-shadow: 0 0 0 4px var(--acid), 0 0 24px var(--acid);
  animation: dilate 2.2s ease-in-out infinite;
}

/* The fact */

.certificate {
  position: relative;
  background: var(--ink-2);
  border: 1px solid var(--cyan);
  box-shadow: 0 0 0 1px var(--ink), 0 0 0 3px rgba(255,43,214,0.6), 0 0 40px rgba(45,226,255,0.2);
  padding: 2.6rem 2.2rem 1.6rem;
  margin: 1rem auto 2rem;
  animation: boot 0.7s steps(7) both;
}
.stamp {
  position: absolute; top: -0.95rem; left: 1.4rem; margin: 0;
  padding: 0.2rem 0.8rem;
  font: 700 0.85rem var(--mono); letter-spacing: 0.24em; text-transform: uppercase;
  color: var(--ink); background: var(--magenta);
  box-shadow: 0 0 16px var(--magenta);
}
.about { margin: 0; font: 0.9rem var(--mono); color: var(--cyan); text-align: left; }
blockquote { margin: 1rem 0; font-size: 1.4rem; line-height: 1.45; text-align: left; }
.verified { margin: 0; font: 0.72rem var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--acid); text-align: left; }
.actions { display: flex; gap: 0.8rem; justify-content: center; flex-wrap: wrap; }

footer { margin-top: auto; padding-top: 3rem; color: var(--muted); font: 0.75rem var(--mono); letter-spacing: 0.1em; }

/* Catalog Control */

body.console-page { justify-content: flex-start; }
.console { width: min(980px, 100%); }
.console h1 {
  font: 700 2rem var(--mono); color: var(--text); letter-spacing: 0.2em; text-transform: uppercase; text-align: center;
  text-shadow: 0 0 10px var(--magenta);
}
.console h2 { font-size: 1rem; color: var(--cyan); text-transform: uppercase; letter-spacing: 0.16em; text-align: left; }
.motto { color: var(--muted); text-align: center; font-family: var(--mono); font-size: 0.9rem; }
table { width: 100%; border-collapse: collapse; font: 0.9rem var(--mono); }
th, td { text-align: left; padding: 0.55rem 0.6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
td em { color: var(--warn); }
td form { margin: 0; }
td button { padding: 0.4rem 0.8rem; font-size: 0.72rem; }
.tag { color: var(--acid); font-size: 0.75rem; letter-spacing: 0.14em; text-transform: uppercase; }
ul.approved { display: flex; flex-wrap: wrap; gap: 0.5rem; padding: 0; list-style: none; }
ul.approved li { border: 1px solid var(--magenta); padding: 0.2rem 0.8rem; color: var(--text); font: 0.85rem var(--mono); }

/* Motion */

@keyframes arrive { from { opacity: 0; transform: translateX(-6px); } }
@keyframes rain { to { transform: translateY(50%); } }
@keyframes revolve { to { transform: rotate(360deg); } }
@keyframes jolt { 0%, 92%, 100% { translate: 0 0; } 93% { translate: 4px -2px; } 95% { translate: -3px 1px; } }
@keyframes converge {
  from { transform: rotate(calc(var(--i) * 30deg)) translateX(124px) scale(1); opacity: 1; }
  to { transform: rotate(calc(var(--i) * 30deg + 18deg)) translateX(54px) scale(0.55); opacity: 0.6; }
}
@keyframes pulse { 50% { transform: rotate(45deg) scale(1.2); } }
@keyframes ripple { from { transform: scale(0.6); opacity: 1; } to { transform: scale(1.5); opacity: 0; } }
@keyframes gaze { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@keyframes dilate { 50% { transform: scale(0.55); } }
@keyframes crawl { to { background-position: 0 40px; } }
@keyframes boot { from { opacity: 0; clip-path: inset(0 0 100% 0); } to { opacity: 1; clip-path: inset(-3rem); } }
@keyframes glitch-a {
  0%, 88%, 100% { opacity: 0; transform: none; }
  89% { opacity: 0.85; transform: translate(-3px, 1px); clip-path: inset(10% 0 55% 0); }
  92% { opacity: 0.85; transform: translate(2px, -1px); clip-path: inset(60% 0 8% 0); }
}
@keyframes glitch-b {
  0%, 80%, 100% { opacity: 0; transform: none; }
  81% { opacity: 0.85; transform: translate(3px, 0); clip-path: inset(30% 0 40% 0); }
  84% { opacity: 0.85; transform: translate(-2px, 1px); clip-path: inset(0 0 75% 0); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}
