/* ============================================================
   THE ELECT — Browser Console
   Terminal-grimoire register. Matches the landing site's
   palette, scanlines, grain, and monospace discipline exactly.
   ============================================================ */

:root {
  --bg:          #08080b;
  --bg-card:     #0d0d11;
  --bg-header:   #060608;
  --text:        #c8c4b8;
  --text-dim:    #8a8480;
  --text-muted:  #6a6560;
  --gold:        #c9a227;
  --gold-dim:    #7a6218;
  --gold-pale:   #e8cc7a;
  --red:         #8b1a1a;
  --red-bright:  #e0564e;
  --red-dim:     #4a0e0e;
  --green:       #3d6b3d;
  --border:      #2a2520;
  --border-dim:  #1a1815;
  --font-mono:   'Courier New', 'Lucida Console', 'DejaVu Sans Mono', monospace;
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.93rem;
  line-height: 1.7;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* ── TEXTURE LAYERS (verbatim from landing site) ── */
.scanlines {
  position: fixed;
  inset: 0;
  z-index: 1000;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.08) 2px,
    rgba(0, 0, 0, 0.08) 4px
  );
  transform: translateZ(0);   /* own GPU layer — not repainted on scroll */
}

.grain {
  position: fixed;
  inset: -200%;
  z-index: 999;
  pointer-events: none;
  width: 400%;
  height: 400%;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  /* Static grain (de-animated 2026-06-20 for scroll perf): matches the landing
     site. Texture unchanged, only the continuous shimmer/repaint is gone. */
  transform: translateZ(0);
}

/* ── LAYOUT ── */
.console-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* ── MASTHEAD ── */
.masthead {
  background: var(--bg-header);
  border-bottom: 2px solid var(--red);
  padding: 2rem 2rem 1.5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.masthead::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity: 0.6;
}

.masthead-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 0.75rem;
}

.sigil {
  color: var(--gold);
  font-size: 1.4rem;
  opacity: 0.7;
  animation: pulse-sigil 4s ease-in-out infinite;
}

@keyframes pulse-sigil {
  0%, 100% { opacity: 0.4; }
  50%       { opacity: 0.9; }
}

.masthead-title {
  font-family: var(--font-mono);
  font-size: clamp(1.4rem, 4vw, 2.2rem);
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--text);
  text-shadow: 0 0 40px rgba(201, 162, 39, 0.15);
  line-height: 1;
}

.masthead-tagline {
  font-size: 0.8rem;
  color: var(--text-dim);
  letter-spacing: 0.06em;
  margin-bottom: 0.75rem;
}

.masthead-back {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  text-decoration: none;
  text-transform: uppercase;
  transition: color 0.2s;
}

.masthead-back:hover { color: var(--gold); }

/* ── SECTION HEADING (gold label flanked by rules) ── */
.section-heading {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  color: var(--gold);
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}

.heading-rule {
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── VOICE PICKER ── */
.picker-section {
  padding: 1.25rem 1.5rem 0.75rem;
  border-bottom: 1px solid var(--border-dim);
}

.picker-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.voice-chip {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.3rem 0.9rem;
  border: 1px solid var(--border);
  color: var(--text-dim);
  background: transparent;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}

.voice-chip:hover {
  border-color: var(--gold-dim);
  color: var(--text);
}

/* active chip gets the voice's own hue */
.voice-chip.is-active {
  border-color: var(--chip-hue, var(--gold));
  color: var(--chip-hue, var(--gold));
  background: rgba(0, 0, 0, 0.3);
  box-shadow: 0 0 6px rgba(201, 162, 39, 0.12);
}

/* ── DISCLAIMER ── */
.disclaimer-bar {
  padding: 0.45rem 1.5rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  border-bottom: 1px solid var(--border-dim);
  min-height: 1.8rem;
}

/* ── TRANSCRIPT AREA ── */
.transcript-section {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Empty state */
.transcript-empty {
  padding: 2rem 0;
  color: var(--text-muted);
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-align: center;
  text-transform: uppercase;
}

/* Turn primitives (from homelab's .turn pattern) */
.turn {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-dim);
}

.turn:last-child { border-bottom: none; }

.turn-head {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.3rem;
}

.turn-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border);
  flex-shrink: 0;
  position: relative;
  top: -1px;
}

.turn--op .turn-dot { background: var(--gold-dim); }
.turn--model .turn-dot { background: var(--voice-hue, var(--red-bright)); }

.turn-who {
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  font-weight: 700;
}

.turn--op .turn-who { color: var(--gold-dim); }
.turn--model .turn-who { color: var(--voice-hue, var(--red-bright)); }

.turn-meta {
  font-size: 0.65rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.turn-mock-tag {
  font-size: 0.62rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  font-style: italic;
}

/* Operator text */
.op-text {
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.65;
  white-space: pre-wrap;
}

/* Model paragraphs */
.turn--model p, .turn--model .seg-p {
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.75;
  margin-bottom: 0.5rem;
}

.turn--model p:last-child,
.turn--model .seg-p:last-child { margin-bottom: 0; }

/* Error */
.turn-error-box {
  border: 1px solid var(--red);
  padding: 0.6rem 0.8rem;
  margin-top: 0.2rem;
  background: rgba(139, 26, 26, 0.06);
}

.turn-error-stamp {
  font-size: 0.67rem;
  letter-spacing: 0.15em;
  color: var(--red-bright);
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}

.turn-error-msg {
  font-size: 0.82rem;
  color: var(--text-dim);
}

/* ── SUMMONING LOADER ── */
.loader-wrap {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border-dim);
}

.loader-who {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
}

.loader-label {
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--loader-hue, var(--red-bright));
}

.loader-hint {
  font-size: 0.67rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.loader-ascii {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.3;
  color: var(--loader-hue, var(--red-bright));
  text-shadow: 0 0 8px var(--loader-glow, rgba(224, 86, 78, 0.45));
  white-space: pre;
  height: 3.5rem;
  overflow: hidden;
  display: flex;
  align-items: center;
}

/* The actual frames are animated via JS requestAnimationFrame — see app.js.
   The text-shadow glow is set inline per voice hue. */

@keyframes loader-pulse {
  0%, 100% { opacity: 0.6; }
  50%       { opacity: 1.0; }
}

.loader-ascii { animation: loader-pulse 1.2s ease-in-out infinite; }

/* ── CONTROLS BAR ── */
.controls-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.5rem;
  border-top: 1px solid var(--border-dim);
  border-bottom: 1px solid var(--border-dim);
  background: var(--bg-header);
  flex-wrap: wrap;
}

.ctrl-btn {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.25rem 0.7rem;
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: transparent;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.ctrl-btn:hover {
  border-color: var(--text-dim);
  color: var(--text);
  background: rgba(255, 255, 255, 0.02);
}

.ctrl-sep {
  color: var(--border);
  font-size: 0.8rem;
  margin: 0 0.1rem;
}

/* ── COMPOSER ── */
.composer {
  padding: 1rem 1.5rem 1.25rem;
  background: var(--bg-header);
  border-top: 1px solid var(--border-dim);
}

.composer-inner {
  position: relative;
}

/* ── LENGTH SELECTOR ── */
.length-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.55rem;
  flex-wrap: wrap;
}

.length-label {
  font-size: 0.65rem;
  letter-spacing: 0.14em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-right: 0.2rem;
  flex-shrink: 0;
}

.length-chip {
  font-family: var(--font-mono);
  font-size: 0.67rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.2rem 0.65rem;
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: transparent;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  white-space: nowrap;
}

.length-chip:hover {
  border-color: var(--gold-dim);
  color: var(--text);
}

.length-chip.is-active {
  border-color: var(--gold-dim);
  color: var(--gold-pale);
  background: rgba(201, 162, 39, 0.06);
}

.length-hint {
  font-size: 0.62rem;
  color: var(--text-muted);
  letter-spacing: 0.03em;
  font-style: italic;
  margin-left: 0.3rem;
}

textarea#composer-input {
  width: 100%;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  color: var(--text);
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 0.65rem 0.85rem;
  resize: none;
  line-height: 1.55;
  min-height: 4rem;
  outline: none;
  transition: border-color 0.15s;
  margin-bottom: 0.6rem;
}

textarea#composer-input::placeholder { color: var(--text-muted); }
textarea#composer-input:focus { border-color: var(--border); }

.composer-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.composer-hint {
  font-size: 0.65rem;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.char-counter {
  font-size: 0.65rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  margin-left: auto;
  margin-right: 0.5rem;
  transition: color 0.2s;
}

.char-counter.is-warn { color: var(--red-bright); }

/* SEND button — matches landing site's .link-btn style */
.send-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid var(--red);
  color: var(--red-bright);
  background: transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.send-btn:hover:not(:disabled) {
  background: var(--red-dim);
  border-color: var(--red-bright);
  color: var(--text);
}

.send-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

/* ── FOOTER ── */
.console-footer {
  background: var(--bg-header);
  border-top: 1px solid var(--border-dim);
  padding: 0.75rem 1.5rem;
  font-size: 0.67rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-align: center;
  line-height: 1.5;
}

/* ── RESPONSIVE ── */
@media (max-width: 600px) {
  .masthead { padding: 1.25rem 1rem 1rem; }
  .picker-section,
  .disclaimer-bar,
  .transcript-section,
  .controls-bar,
  .composer,
  .console-footer { padding-left: 0.85rem; padding-right: 0.85rem; }
  .masthead-title { font-size: 1.3rem; }
}
