/* ============================================================
   TE LINKS — signal / oscilloscope
   A CRT instrument screen.
   Palette unchanged: navy #0a0f1a · brand blue #1E3A8A · gold #FFD700
   ============================================================ */

:root {
  --navy:      #0a0f1a;   /* background / screen glass */
  --navy-deep: #060a12;   /* tube edges */
  --navy-lift: #112233;   /* screen centre lift (from original bgGlow) */
  --blue:      #1E3A8A;   /* brand blue */
  --blue-lit:  #3d7bea;   /* lit trace — same hue, readable on navy */
  --gold:      #FFD700;   /* brand gold */
  --grid:      rgba(30, 58, 138, 0.28);
  --grid-axis: rgba(61, 123, 234, 0.30);
  --ink:       #ffffff;
  --ink-dim:   #7e93b5;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  /* trace baseline — content sits above it. Mirrored in script.js (TRACE_Y). */
  --trace-y: 80%;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  background: var(--navy);
  font-family: var(--mono);
  color: var(--ink);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-font-smoothing: antialiased;
}

/* ---------- The tube ---------- */
.scope {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(120% 100% at 50% 50%, var(--navy-lift) 0%, var(--navy) 55%, var(--navy-deep) 100%);
  overflow: hidden;
  box-shadow:
    inset 0 0 120px rgba(0, 0, 0, 0.9),
    inset 0 0 12px rgba(30, 58, 138, 0.12);
  animation: warmup 1.6s ease-out both;
  /* centre the readout in the field ABOVE the trace baseline */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6vh 0 26vh;
}

/* CRT switch-on */
@keyframes warmup {
  0%   { opacity: 0; filter: brightness(3) blur(6px); transform: scaleY(0.004); }
  35%  { opacity: 1; filter: brightness(2) blur(2px); transform: scaleY(0.02); }
  100% { opacity: 1; filter: none; transform: scaleY(1); }
}

/* ---------- Graticule (scope grid) ---------- */
.graticule {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(var(--grid-axis), var(--grid-axis)),   /* horizontal axis */
    linear-gradient(var(--grid-axis), var(--grid-axis)),   /* vertical axis   */
    repeating-linear-gradient(to right,  var(--grid) 0 1px, transparent 1px 64px),
    repeating-linear-gradient(to bottom, var(--grid) 0 1px, transparent 1px 64px);
  background-size: 100% 1px, 1px 100%, 100% 100%, 100% 100%;
  background-position: 0 var(--trace-y), 50% 0, 0 0, 0 0;
  background-repeat: no-repeat, no-repeat, repeat, repeat;
  opacity: 0.85;
}

/* tick marks along the trace axis */
.graticule::after {
  content: '';
  position: absolute;
  left: 0; right: 0; top: var(--trace-y);
  height: 9px;
  transform: translateY(-50%);
  background: repeating-linear-gradient(to right,
    var(--grid-axis) 0 1px, transparent 1px 12.8px);
  opacity: 0.7;
}

/* ---------- Trace canvas ---------- */
#wave {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* ---------- Scanlines + flicker ---------- */
.scanlines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0 2px,
    rgba(0, 0, 0, 0.28) 2px 4px
  );
  mix-blend-mode: multiply;
  animation: flicker 4.2s steps(2) infinite;
}
@keyframes flicker {
  0%, 96%, 100% { opacity: 1; }
  97%           { opacity: 0.82; }
  98%           { opacity: 1; }
  99%           { opacity: 0.9; }
}

/* rolling refresh bar */
.scanlines::after {
  content: '';
  position: absolute;
  left: 0; right: 0;
  height: 22%;
  background: linear-gradient(to bottom, transparent, rgba(61, 123, 234, 0.05), transparent);
  animation: roll 7s linear infinite;
}
@keyframes roll {
  from { top: -25%; }
  to   { top: 105%; }
}

/* ---------- Vignette / glass glare ---------- */
.vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(140% 120% at 50% 50%, transparent 55%, rgba(0, 0, 0, 0.85) 100%),
    linear-gradient(115deg, rgba(255, 255, 255, 0.04) 0 18%, transparent 42%);
}

/* ---------- Instrument HUD ---------- */
.hud {
  position: absolute;
  z-index: 4;
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  color: #4a6bb5;
  text-transform: uppercase;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
}
.hud b  { color: rgba(61, 123, 234, 0.35); font-weight: 400; }
.hud em { font-style: normal; color: var(--gold); opacity: 0.7; }

.hud.tl { top: 22px;    left: 26px; }
.hud.tr { top: 22px;    right: 26px; }
.hud.bl { bottom: 22px; left: 26px; }
.hud.br { bottom: 22px; right: 26px; }

.rec {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 8px var(--gold);
  animation: rec 1.4s steps(2) infinite;
}
@keyframes rec { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0.15; } }

/* ---------- Readout (centre content) ---------- */
.readout {
  position: relative;
  z-index: 5;
  width: min(90vw, 560px);
  margin: auto;
  text-align: left;
  padding: 0 6px;
}

.mark {
  width: 46px;
  height: auto;
  filter: drop-shadow(0 0 12px rgba(61, 123, 234, 0.85));
  animation: markPulse 3.4s ease-in-out infinite;
}
@keyframes markPulse {
  0%, 100% { filter: drop-shadow(0 0 10px rgba(30, 58, 138, 0.8)); }
  50%      { filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.6)); }
}

.title {
  margin: 18px 0 2px;
  font-size: clamp(2rem, 8.5vw, 3.6rem);
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--ink);
  text-shadow:
    0 0 6px rgba(61, 123, 234, 0.9),
    0 0 24px rgba(30, 58, 138, 0.75);
}

/* blinking terminal caret after the title */
.title::after {
  content: '';
  display: inline-block;
  width: 0.52em;
  height: 0.9em;
  margin-left: 0.16em;
  vertical-align: -0.06em;
  background: var(--gold);
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
  animation: caret 1.05s steps(2) infinite;
}
@keyframes caret { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }

.sub {
  margin: 0 0 26px;
  font-size: 0.82rem;
  letter-spacing: 0.22em;
  color: var(--ink-dim);
  text-transform: uppercase;
}

/* ---------- Boot sequence ---------- */
.boot {
  margin: 0 0 26px;
  padding: 0 0 0 14px;
  border-left: 1px solid rgba(61, 123, 234, 0.28);
  font-family: var(--mono);
  font-size: clamp(0.68rem, 2.6vw, 0.78rem);
  line-height: 1.95;
  letter-spacing: 0.04em;
  color: var(--ink-dim);
  min-height: 7.6em;
  white-space: pre;
}
.boot .ok   { color: var(--blue-lit); }
.boot .warn { color: var(--gold); }

/* ---------- Countdown readout ---------- */
.tx {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px 14px;
  padding: 14px 0 0;
  border-top: 1px solid rgba(61, 123, 234, 0.22);
}
.tx-lbl {
  font-size: 0.62rem;
  letter-spacing: 0.28em;
  color: var(--ink-dim);
}
.tx-val {
  font-size: clamp(1.5rem, 6vw, 2.1rem);
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 14px rgba(255, 215, 0, 0.45);
}
.tx-unit {
  font-size: 0.58rem;
  letter-spacing: 0.2em;
  color: rgba(126, 147, 181, 0.7);
}

/* ---------- Socials ---------- */
.socials {
  margin-top: 30px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.socials a {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 9px 15px;
  text-decoration: none;
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  color: #4a6bb5;
  border: 1px solid rgba(61, 123, 234, 0.3);
  background: rgba(30, 58, 138, 0.12);
  transition: color 0.22s ease, border-color 0.22s ease,
              background 0.22s ease, box-shadow 0.22s ease;
}
.socials svg { width: 14px; height: 14px; fill: currentColor; }
.socials a:hover {
  color: var(--ink);
  border-color: var(--blue-lit);
  background: rgba(30, 58, 138, 0.45);
  box-shadow: 0 0 0 1px rgba(61, 123, 234, 0.3), 0 0 22px rgba(30, 58, 138, 0.7);
}
/* gold hover for Instagram so the two reads differ */
.socials a:first-child:hover {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px rgba(255, 215, 0, 0.28), 0 0 22px rgba(255, 215, 0, 0.22);
}

/* ---------- Responsive ---------- */
@media (max-width: 620px) {
  .hud    { font-size: 0.56rem; letter-spacing: 0.1em; gap: 6px; }
  .hud.tl { top: 14px; left: 14px; }
  .hud.tr { top: 14px; right: 14px; }
  .hud.bl { bottom: 14px; left: 14px; }
  .hud.br { bottom: 14px; right: 14px; }
  .readout { width: 88vw; }
}
/* the lower HUD readouts crowd small screens */
@media (max-width: 400px) {
  .hud.bl, .hud.br { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; }
  .scope { opacity: 1; filter: none; transform: none; }
}
