/* ==========================================================================
   MYSTIC GLITCH LABS  --  tactical HUD
   --------------------------------------------------------------------------
   Layer stack, back to front:
     0  body            near-black teal base + deep-blue bloom (static gradients)
     1  .bg__grid       perspective city grid, fading toward a horizon
        .bg__haze       cyan/magenta light pooling on the horizon
     2  .bg__skyline    pixel-window skyline (inline SVG) with neon signs that
                        dip once every few seconds
     3  .bg__rain       vertical glyph rain (inline SVG: katakana-like strokes
                        + arcane runes drawn as paths, no font dependency)
     4  .hud            header landmark: two status corners
        .stage          hero copy (left, on a scrim) and the figure (right):
                        spell-circle HUD, thermoptic ghost copy, portrait,
                        glitch-tear copy, targeting frame, scan line, labels
        .foot           footer landmark, bottom-left
     5  .fx__camo       thermoptic-camo pixel bands sweeping over everything
     6  .fx__scan       static scanline texture + vignette
   Motion is transform / opacity / clip-path only. Under prefers-reduced-motion
   every animation is switched off by name (see the end of the file) and the
   composition stays intact.
   ========================================================================== */

:root {
  /* palette */
  --bg-0: #030d10;          /* near-black teal          */
  --bg-1: #061a20;          /* teal shadow              */
  --bg-2: #0b2e39;          /* far skyline              */
  --blue: #0b2440;          /* deep blue bloom          */
  --cyan: #5ef0ff;          /* primary HUD cyan         */
  --cyan-dim: #1fa9c9;
  --amber: #ffb547;         /* warm accent, targeting   */
  --magenta: #ff3fa4;       /* neon: rim, arc, signs, glitch beats */
  --acid: #c6ff4a;          /* neon: two small signs only */
  --text: #dbf2f7;
  --muted: #8fb5bf;

  /* rgb triplets for rgba() mixes */
  --cyan-rgb: 94, 240, 255;
  --amber-rgb: 255, 181, 71;
  --magenta-rgb: 255, 63, 164;
  --acid-rgb: 198, 255, 74;
  --ink-rgb: 3, 13, 16;

  /* type */
  --font-display: "Orbitron", "Michroma", "Audiowide", "Eurostile", "Bank Gothic", "Arial Black", Impact, sans-serif;
  --font-mono: "Share Tech Mono", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  /* rhythm */
  --gutter: clamp(20px, 6vw, 160px);
  --wm-size: clamp(2.5rem, 13.5vw, 5.6rem);
  --hud-size: 0.75rem;      /* 12px: nothing announced to AT goes below 12px */
  --tag-size: 0.75rem;
  --tagline-size: 0.95rem;

  color-scheme: dark;
}

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

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

body {
  position: relative;
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  font-family: var(--font-mono);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(120vmax 70vmax at 8% -10%, rgba(11, 36, 64, 0.85), transparent 60%),
    radial-gradient(70vmax 60vmax at 100% 100%, rgba(31, 169, 201, 0.14), transparent 60%),
    linear-gradient(180deg, var(--bg-1) 0%, var(--bg-0) 70%);
  background-color: var(--bg-0);
}

img,
svg {
  display: block;
  max-width: 100%;
}

:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 4px;
}

/* --------------------------------------------------------------------------
   Layers 1-3 : fixed backdrop
   -------------------------------------------------------------------------- */
.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

/* perspective city grid: a flat plane tilted away from the viewer */
.bg__grid {
  position: absolute;
  left: -60%;
  right: -60%;
  bottom: -2px;
  height: 120vh;
  background-image:
    linear-gradient(rgba(var(--cyan-rgb), 0.16) 1px, transparent 1px),
    linear-gradient(90deg, rgba(var(--cyan-rgb), 0.16) 1px, transparent 1px);
  background-size: 84px 84px;
  transform: perspective(900px) rotateX(68deg);
  transform-origin: 50% 100%;
  -webkit-mask-image: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.35) 45%, transparent 100%);
  mask-image: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.35) 45%, transparent 100%);
}

/* light pooling behind the skyline: cyan haze with a magenta pool on the right */
.bg__haze {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 42vh;
  background:
    radial-gradient(55% 90% at 72% 100%, rgba(var(--magenta-rgb), 0.16), transparent 70%),
    radial-gradient(70% 80% at 30% 100%, rgba(var(--cyan-rgb), 0.12), transparent 70%);
}

/* pixel-window skyline on the horizon */
.bg__skyline {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 5vh;
  width: 100%;
  height: clamp(150px, 26vh, 360px);
  opacity: 0.95;
}

.sky__far {
  fill: var(--bg-2);
}

.sky__near {
  fill: #051920;
  stroke: rgba(var(--cyan-rgb), 0.28);
  stroke-width: 1;
}

.sky__win--far {
  fill: var(--amber);
  opacity: 0.55;
}

.sky__win--near {
  fill: var(--cyan);
  opacity: 0.4;
}

/* neon signs: a wide low-alpha duplicate behind each sign gives the bloom */
.sign--magenta { fill: var(--magenta); stroke: var(--magenta); }
.sign--cyan { fill: var(--cyan); stroke: var(--cyan); }
.sign--acid { fill: var(--acid); stroke: var(--acid); }
.sign--amber { fill: var(--amber); stroke: var(--amber); }

.sign {
  stroke: none;
  opacity: 0.95;
}

.sign--bloom {
  opacity: 0.18;
}

.sign--outline {
  fill: none;
  stroke-width: 3;
}

.sign__rungs {
  stroke: #051920;
  stroke-width: 3;
}

/* single dips spaced seconds apart: far below the 3 flashes/second limit */
.sign--flick-a { animation: flick-a 6.4s steps(1, end) infinite; }
.sign--flick-b { animation: flick-b 9.1s steps(1, end) infinite 1.3s; }
.sign--flick-c { animation: flick-c 7.7s steps(1, end) infinite 3.1s; }
.sign--beacon { animation: beacon 4s steps(1, end) infinite; }
.sign--beacon-2 { animation-delay: 1.7s; }

@keyframes flick-a {
  0%, 41%, 45%, 100% { opacity: 0.95; }
  42%, 44% { opacity: 0.15; }
}

@keyframes flick-b {
  0%, 62%, 66%, 100% { opacity: 1; }
  63%, 65% { opacity: 0.08; }
}

@keyframes flick-c {
  0%, 20%, 25%, 70%, 74%, 100% { opacity: 0.95; }
  21%, 24%, 71%, 73% { opacity: 0.2; }
}

@keyframes beacon {
  0%, 12%, 100% { opacity: 0.95; }
  13%, 60% { opacity: 0.2; }
}

/* glyph rain: each column loops on its own custom properties (--dist, --dur,
   --delay, --o), set on the column in the markup */
.bg__rain {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.42;
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 18%, #000 78%, transparent 100%);
  mask-image: linear-gradient(180deg, transparent 0%, #000 18%, #000 78%, transparent 100%);
}

.rain {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: var(--cyan);
}

.rain .hot { color: #fff; }
.rain .hot--amber { color: var(--amber); }

.rain__col {
  opacity: var(--o, 0.5);
  will-change: transform;
  animation: rain var(--dur, 22s) linear infinite;
  animation-delay: var(--delay, 0s);
}

@keyframes rain {
  to { transform: translateY(var(--dist, 504px)); }
}

/* --------------------------------------------------------------------------
   Layer 4 : HUD strip (header landmark)
   -------------------------------------------------------------------------- */
.hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 3;
  pointer-events: none;
}

.hud__block {
  position: absolute;
  top: 18px;
  margin: 0;
  font-size: var(--hud-size);
  letter-spacing: 0.14em;
  color: var(--muted);
  text-transform: uppercase;
  line-height: 1.4;
  padding: 10px 12px;
  background: rgba(var(--ink-rgb), 0.7);  /* backing: the rings pass behind */
}

.hud__block--tl {
  left: var(--gutter);
  padding-left: 14px;
  border-left: 1px solid rgba(var(--cyan-rgb), 0.55);
}

.hud__block--tr {
  display: none;  /* shown from tablet up: a right-anchored block has no room on phones */
  right: var(--gutter);
  text-align: right;
  padding-right: 14px;
  border-right: 1px solid rgba(var(--amber-rgb), 0.6);
}

.hud strong {
  font-weight: 400;
  color: var(--cyan);
}

.amber {
  color: var(--amber);
}

/* quad data-port motif: four ring-dots */
.hud__ports {
  display: inline-block;
  width: 34px;
  height: 8px;
  margin-left: 8px;
  vertical-align: 1px;
  background: radial-gradient(circle, var(--cyan) 0 1.5px, transparent 2px, transparent 2.8px, rgba(var(--cyan-rgb), 0.7) 3.2px, transparent 3.8px) 0 0 / 8.5px 8px repeat-x;
}

.hud__dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 8px var(--amber);
  vertical-align: 1px;
  animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.35; }
}

/* --------------------------------------------------------------------------
   Layer 4 : stage
   -------------------------------------------------------------------------- */
.stage {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: 1fr;
}

/* hero copy ----------------------------------------------------------- */
.hero {
  position: relative;
  z-index: 2;
  align-self: start;
  padding: 84px var(--gutter) 28px;
  max-width: 100%;
  /* phone/tablet scrim: keeps the copy legible where it meets the spell circle */
  background: linear-gradient(180deg, rgba(var(--ink-rgb), 0.82) 0%, rgba(var(--ink-rgb), 0.55) 72%, transparent 100%);
}

.hero__eyebrow {
  margin: 0 0 18px;
  font-size: var(--hud-size);
  letter-spacing: 0.16em;   /* one line on a 360px phone; wider from tablet up */
  text-transform: uppercase;
  color: var(--amber);
}

.hero__eyebrow::before {
  content: "// " / "";   /* decorative: empty alt text keeps it out of AT */
  color: var(--cyan);
}

/* the wordmark: real text, chrome gradient fill, a cyan hologram outline
   offset behind it, a magenta slice for the glitch beats, and a scan line
   that travels down the block like a signal acquiring lock */
.wordmark {
  position: relative;
  width: fit-content;   /* so the scan line spans the letters, not the column */
  max-width: 100%;
  margin: 0 0 22px -0.06em;
  padding: 0.12em 0.25em 0.14em 0.06em;
  overflow: hidden;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: var(--wm-size);
  line-height: 0.98;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.word {
  position: relative;
  display: block;
  color: var(--text);
}

.word__ink {
  position: relative;
  z-index: 2;
  background: linear-gradient(180deg,
    #ffffff 0%,
    #d8ecf2 28%,
    #7fa3ad 47%,
    #f2fbfd 52%,
    #a6c8d2 72%,
    #f8ffff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.55));
}

.word::before,
.word::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  pointer-events: none;
  -webkit-text-fill-color: transparent;
}

/* cyan hologram ghost, offset up-left */
.word::before {
  z-index: 1;
  color: transparent;
  -webkit-text-stroke: 1px rgba(var(--cyan-rgb), 0.9);
  transform: translate(-0.05em, -0.045em);
  opacity: 0.85;
}

/* magenta slice, offset down-right, shown only during the glitch beats */
.word::after {
  z-index: 3;
  color: var(--magenta);
  -webkit-text-fill-color: var(--magenta);
  clip-path: inset(38% 0 42% 0);
  transform: translate(0.06em, 0.02em);
  opacity: 0;
  animation: glitch 9s steps(1, end) infinite;
}

.word:nth-child(2)::after { animation-delay: 3s; clip-path: inset(55% 0 20% 0); }
.word:nth-child(3)::after { animation-delay: 6s; clip-path: inset(20% 0 60% 0); }

/* two brief beats per 9 s cycle, never faster than 3 Hz */
@keyframes glitch {
  0%, 100% { opacity: 0; transform: translate(0.06em, 0.02em); }
  4%       { opacity: 0.85; transform: translate(0.08em, 0.02em); }
  6%       { opacity: 0; }
  7.5%     { opacity: 0.7; transform: translate(-0.06em, -0.01em); }
  9%       { opacity: 0; }
}

/* tap / click burst (js adds .is-glitching for 800 ms): two beats, 2.5 Hz */
.wordmark.is-glitching .word::after {
  animation: glitch-burst 0.8s steps(1, end) 1;
}

@keyframes glitch-burst {
  0%   { opacity: 0.9; transform: translate(0.1em, 0.02em); }
  20%  { opacity: 0; }
  45%  { opacity: 0.8; transform: translate(-0.08em, -0.02em); }
  65%  { opacity: 0; }
  100% { opacity: 0; }
}

/* signal-lock scan line */
.wordmark::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  background: linear-gradient(180deg,
    transparent 0%,
    rgba(var(--cyan-rgb), 0) 44%,
    rgba(var(--cyan-rgb), 0.22) 49.4%,
    #ffffff 50%,
    rgba(var(--cyan-rgb), 0.55) 50.4%,
    transparent 51.6%);
  transform: translateY(-50%);
  opacity: 0;
  animation: lock 8s cubic-bezier(0.45, 0, 0.2, 1) infinite;
}

@keyframes lock {
  0%   { transform: translateY(-50%); opacity: 0; }
  6%   { opacity: 1; }
  48%  { transform: translateY(50%); opacity: 1; }
  56%  { opacity: 0; transform: translateY(50%); }
  100% { opacity: 0; transform: translateY(50%); }
}

/* HUD ruler: tick marks with a magenta cursor, sits under the wordmark */
.ruler {
  position: relative;
  height: 12px;
  margin: 0 0 16px;
  max-width: 420px;
  background:
    repeating-linear-gradient(90deg, rgba(var(--cyan-rgb), 0.55) 0 1px, transparent 1px 10px) 0 100% / 100% 5px no-repeat,
    repeating-linear-gradient(90deg, rgba(var(--cyan-rgb), 0.9) 0 1px, transparent 1px 60px) 0 100% / 100% 12px no-repeat;
}

.ruler::after {
  content: "";
  position: absolute;
  left: 38%;
  bottom: -3px;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 7px solid var(--magenta);
  filter: drop-shadow(0 0 4px rgba(var(--magenta-rgb), 0.9));
}

.tagline {
  position: relative;
  max-width: none;   /* phones: one line, so the copy stays above the figure */
  margin: 0 0 26px;
  padding-left: 16px;
  font-size: var(--tagline-size);
  line-height: 1.55;
  color: var(--text);
  border-left: 2px solid var(--cyan);
}

.tagline em {
  font-style: normal;
  color: var(--cyan);
}

/* readout block: a real <dl>, desktop only ------------------------------ */
.readout {
  display: none;  /* below 1024px the figure needs the room */
  gap: 8px;
  margin: 0;
  max-width: 380px;
  font-size: var(--hud-size);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.readout__row {
  display: grid;
  grid-template-columns: 9.5em 1fr;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(var(--cyan-rgb), 0.16);
}

.readout__row:first-child {
  border-top: 1px solid rgba(var(--cyan-rgb), 0.16);
}

.readout dt {
  color: var(--amber);
}

.readout dt::before {
  content: "\25B8\00a0" / "";  /* small right-pointing triangle, decorative */
  color: var(--cyan-dim);
}

.readout dd {
  margin: 0;
  color: var(--cyan);
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

.bar {
  position: relative;
  display: inline-block;
  flex: 1 1 auto;
  height: 6px;
  max-width: 120px;
  background: rgba(var(--cyan-rgb), 0.14);
  overflow: hidden;
}

.bar::before {
  content: "";
  position: absolute;
  inset: 0;
  width: 100%;
  background: linear-gradient(90deg, var(--cyan-dim), var(--cyan));
  transform: scaleX(var(--w, 0.7));
  transform-origin: 0 50%;
  box-shadow: 0 0 8px rgba(var(--cyan-rgb), 0.7);
}

.bar--74 { --w: 0.74; }

/* avatar figure ------------------------------------------------------- */
.avatar {
  position: absolute;
  left: 6%;
  bottom: 0;
  z-index: 1;
  margin: 0;
  /* reserved space for the hero copy grows with the vw-scaled wordmark, so
     the tagline stays above the crown on 480-599px phones too */
  height: clamp(300px, 100vh - 372px - 12vw, 56vh);
  height: clamp(300px, 100dvh - 372px - 12vw, 56dvh);
  aspect-ratio: 3 / 4;
}

.avatar__img,
.avatar__ghost,
.avatar__tear {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: auto;
}

.avatar__img {
  z-index: 3;
  /* neon rim: magenta bloom off the left edge, cyan off the right (two
     shadows only: the portrait animates internally, so the filter re-runs) */
  filter:
    drop-shadow(-6px 0 12px rgba(var(--magenta-rgb), 0.5))
    drop-shadow(6px 0 10px rgba(var(--cyan-rgb), 0.42));
}

/* thermoptic ghost: a cyan-tinted, scan-lined copy shifted left that
   breathes in and out on a slow 12 s cycle */
.avatar__ghost {
  z-index: 2;
  opacity: 0.32;
  mix-blend-mode: screen;
  filter: grayscale(1) brightness(1.6) sepia(1) hue-rotate(140deg) saturate(3.5);
  -webkit-mask-image:
    repeating-linear-gradient(0deg, #000 0 3px, transparent 3px 5px),
    linear-gradient(90deg, transparent 0%, #000 40%, #000 100%);
  mask-image:
    repeating-linear-gradient(0deg, #000 0 3px, transparent 3px 5px),
    linear-gradient(90deg, transparent 0%, #000 40%, #000 100%);
  -webkit-mask-composite: source-in;
  mask-composite: intersect;
  transform: translate3d(-7%, -0.6%, 0);
  animation: ghost 12s ease-in-out infinite;
  will-change: opacity, transform;
}

/* visible early, drops out, resurfaces: slow, never strobes */
@keyframes ghost {
  0%       { opacity: 0.5;  transform: translate3d(-7%, -0.6%, 0); }
  24%      { opacity: 0.5;  transform: translate3d(-7.5%, -0.6%, 0); }
  30%      { opacity: 0.12; transform: translate3d(-6%, 0, 0); }
  36%      { opacity: 0.46; transform: translate3d(-8.5%, -1%, 0); }
  50%, 74% { opacity: 0;    transform: translate3d(-5%, 0, 0); }
  86%      { opacity: 0.3;  transform: translate3d(-6.5%, -0.4%, 0); }
  100%     { opacity: 0.5;  transform: translate3d(-7%, -0.6%, 0); }
}

/* glitch tear: a magenta-tinted, clipped duplicate that slides sideways for
   a few frames, twice per 13 s cycle */
.avatar__tear {
  z-index: 4;
  opacity: 0;
  filter: saturate(0) sepia(1) hue-rotate(245deg) saturate(5) brightness(1.15);
  clip-path: inset(38% 0 48% 0);
  animation: tear 13s steps(1, end) infinite 4s;
}

@keyframes tear {
  0%, 100% { opacity: 0; transform: translateX(0); clip-path: inset(38% 0 48% 0); }
  34%      { opacity: 0.9; transform: translateX(3%); clip-path: inset(38% 0 48% 0); }
  37%      { opacity: 0.9; transform: translateX(-2.5%); clip-path: inset(62% 0 22% 0); }
  40%      { opacity: 0; }
  78%      { opacity: 0.9; transform: translateX(-3.5%); clip-path: inset(12% 0 74% 0); }
  81%      { opacity: 0; }
}

/* spell-circle HUD (inline SVG) centred behind the face ------------------ */
.spell {
  position: absolute;
  z-index: 1;
  left: 50%;
  top: 32%;
  width: 130%;
  max-width: none;   /* wider than the figure box on purpose (base rule caps svg at 100%) */
  height: auto;
  aspect-ratio: 1 / 1;
  overflow: visible;
  pointer-events: none;
  transform: translate(-50%, -50%);
  opacity: 0.85;
}

.spell__ring {
  fill: none;
  stroke: var(--cyan);
  stroke-width: 1.5;
  transform-box: fill-box;
  transform-origin: center;
  will-change: transform;
}

.spell__ring--a { animation: spin 150s linear infinite; }
.spell__ring--b { animation: spin 110s linear infinite reverse; }
.spell__ring--c { animation: spin 220s linear infinite; }
.spell__ring--d { animation: spin 70s linear infinite reverse; }

@keyframes spin {
  to { transform: rotate(360deg); }
}

.spell__ticks {
  stroke-width: 10;
  stroke-dasharray: 1.5 11.5;
  opacity: 0.55;
}

.spell__arc {
  stroke: var(--amber);
  stroke-width: 3;
  stroke-dasharray: 260 70 120 40 420 90 60 30;
  opacity: 0.85;
}

/* the persistent magenta arc: a thin bright stroke over a wide low-alpha one */
.spell__arc-m {
  stroke: var(--magenta);
  stroke-width: 3;
  stroke-linecap: round;
  opacity: 0.9;
}

.spell__arc-m--bloom {
  stroke-width: 14;
  opacity: 0.22;
}

.spell__dash {
  stroke-dasharray: 6 10;
  opacity: 0.6;
}

.spell__faint {
  opacity: 0.35;
}

.spell__rune {
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.spell__node {
  fill: var(--amber);
  stroke: none;
}

.spell__pad {
  fill: none;
  stroke: var(--amber);
  stroke-width: 1;
  opacity: 0.6;
}

.spell__core {
  stroke: var(--amber);
}

/* inscription and lock labels: real text, so they use the page's mono face */
.spell__text {
  font-family: var(--font-mono);
  font-size: 16px;
  letter-spacing: 4px;
  text-transform: uppercase;
  fill: var(--cyan);
  stroke: none;
  opacity: 0.7;
}

.spell__label {
  font-family: var(--font-mono);
  font-size: 18px;
  letter-spacing: 4px;
  fill: var(--amber);
  stroke: none;
}

.spell__soul {
  transform-box: fill-box;
  transform-origin: center;
  animation: breathe 7s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% { opacity: 0.55; transform: scale(0.94); }
  50%      { opacity: 1; transform: scale(1.04); }
}

/* targeting frame drawn with 8 gradient strokes on one element */
.avatar__frame {
  position: absolute;
  z-index: 5;
  inset: 4% 6% 3% 6%;
  --c: var(--amber);
  --len: 26px;
  background:
    linear-gradient(var(--c), var(--c)) top left / var(--len) 2px no-repeat,
    linear-gradient(var(--c), var(--c)) top left / 2px var(--len) no-repeat,
    linear-gradient(var(--c), var(--c)) top right / var(--len) 2px no-repeat,
    linear-gradient(var(--c), var(--c)) top right / 2px var(--len) no-repeat,
    linear-gradient(var(--c), var(--c)) bottom left / var(--len) 2px no-repeat,
    linear-gradient(var(--c), var(--c)) bottom left / 2px var(--len) no-repeat,
    linear-gradient(var(--c), var(--c)) bottom right / var(--len) 2px no-repeat,
    linear-gradient(var(--c), var(--c)) bottom right / 2px var(--len) no-repeat;
  opacity: 0.9;
}

/* a thin scan line sweeping the figure */
.avatar__scan {
  position: absolute;
  z-index: 5;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.avatar__scan::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg,
    transparent 0%,
    rgba(var(--cyan-rgb), 0) 46%,
    rgba(var(--cyan-rgb), 0.18) 49.6%,
    rgba(var(--cyan-rgb), 0.9) 50%,
    transparent 50.5%);
  transform: translateY(-50%);
  animation: avscan 11s linear infinite;
}

@keyframes avscan {
  0%   { transform: translateY(-50%); }
  100% { transform: translateY(50%); }
}

/* thermoptic pixel dissolve on the outer edge */
.avatar__dissolve {
  position: absolute;
  z-index: 5;
  top: 24%;
  right: 4%;
  width: 20%;
  height: 46%;
  background: repeating-conic-gradient(rgba(var(--cyan-rgb), 0.55) 0 25%, transparent 0 50%);
  background-size: 9px 9px;
  -webkit-mask-image: radial-gradient(ellipse 55% 50% at 60% 50%, #000 0%, rgba(0, 0, 0, 0.5) 45%, transparent 100%);
  mask-image: radial-gradient(ellipse 55% 50% at 60% 50%, #000 0%, rgba(0, 0, 0, 0.5) 45%, transparent 100%);
  opacity: 0.35;
  animation: pulse 5s ease-in-out infinite;
}

/* small labels pinned to the frame */
.tag {
  position: absolute;
  z-index: 6;
  padding: 2px 6px;
  font-size: var(--tag-size);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--amber);
  white-space: nowrap;
  background: rgba(var(--ink-rgb), 0.6);
}

.tag strong {
  font-weight: 400;
  color: var(--cyan);
}

/* phones: both labels ride above the frame's top edge (the frame top sits
   on the crown of the hair, so labels inside the corners would cover it) */
.tag--lock {
  top: 4%;
  left: 6%;
  transform: translateY(-120%);
}

.tag--id {
  top: 4%;
  right: 6%;
  transform: translateY(-120%);
}

/* narrow phones (360-class): the frame is too narrow for two labels */
@media (max-width: 379px) {
  .tag--id {
    display: none;
  }
}

/* footer -------------------------------------------------------------- */
.foot {
  position: absolute;
  left: var(--gutter);
  bottom: 14px;
  z-index: 2;
  margin: 0;
  padding: 4px 8px;
  font-size: var(--tag-size);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  background: rgba(var(--ink-rgb), 0.72);  /* legible where it meets the figure on phones */
}

/* --------------------------------------------------------------------------
   Layers 5-6 : effects above everything
   -------------------------------------------------------------------------- */
.fx {
  position: fixed;
  inset: 0;
  z-index: 5;
  overflow: hidden;
  pointer-events: none;
}

/* thermoptic camo: pixel-checker bands that sweep across the screen */
.fx__camo {
  position: absolute;
  top: -20%;
  bottom: -20%;
  left: -50vw;
  width: 40vw;
  background: repeating-conic-gradient(rgba(190, 250, 255, 0.15) 0 25%, transparent 0 50%);
  background-size: 7px 7px;
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 35%, #000 65%, transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0%, #000 35%, #000 65%, transparent 100%);
  will-change: transform;
  animation: sweep 38s linear infinite;
  animation-delay: -12s;  /* negative delays: a band is already on screen at load */
}

.fx__camo--2 {
  width: 18vw;
  background-size: 5px 5px;
  animation-duration: 53s;
  animation-delay: -30s;
}

@keyframes sweep {
  from { transform: translateX(0) skewX(-16deg); }
  to   { transform: translateX(200vw) skewX(-16deg); }
}

/* static scanlines + vignette */
.fx__scan {
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(180deg, rgba(0, 0, 0, 0.16) 0 1px, transparent 1px 3px),
    radial-gradient(120% 90% at 50% 45%, transparent 55%, rgba(2, 8, 10, 0.75) 100%);
}

/* --------------------------------------------------------------------------
   404 page specifics
   -------------------------------------------------------------------------- */
/* phones: the 404 copy is compact (numerals, ruler, note, 3-line paragraph,
   button) so the figure below it still holds 45vh+ */
.hero--404 .wordmark {
  font-size: clamp(3.4rem, 17vw, 12rem);
  letter-spacing: 0.1em;
  margin-bottom: 6px;
}

.hero--404 .ruler {
  margin-bottom: 12px;
}

.hero--404 .tagline {
  max-width: 36ch;
  margin-bottom: 14px;
}

.hero--404 ~ .avatar {
  height: clamp(45vh, 100vh - 460px, 50vh);
  height: clamp(45dvh, 100dvh - 460px, 50dvh);
}

/* cloaked: the portrait dissolves into pixel blocks, the ghost copy stays bright */
.avatar--lost .avatar__img {
  opacity: 0.5;
  -webkit-mask-image:
    repeating-linear-gradient(90deg, #000 0 7px, transparent 7px 9px),
    repeating-linear-gradient(0deg, #000 0 7px, transparent 7px 9px),
    linear-gradient(180deg, transparent 0%, #000 40%, #000 100%);
  mask-image:
    repeating-linear-gradient(90deg, #000 0 7px, transparent 7px 9px),
    repeating-linear-gradient(0deg, #000 0 7px, transparent 7px 9px),
    linear-gradient(180deg, transparent 0%, #000 40%, #000 100%);
  -webkit-mask-composite: source-in;
  mask-composite: intersect;
}

.avatar--lost .avatar__ghost {
  opacity: 0.6;
  animation-name: ghost-lost;
}

@keyframes ghost-lost {
  0%, 100% { opacity: 0.62; transform: translate3d(-7%, -0.6%, 0); }
  30%      { opacity: 0.3;  transform: translate3d(-5.5%, 0, 0); }
  60%      { opacity: 0.55; transform: translate3d(-8%, -1%, 0); }
}

.avatar--lost .avatar__dissolve {
  width: 46%;
  height: 60%;
  right: 8%;
  opacity: 0.4;
}

.avatar--lost .spell {
  opacity: 0.55;
}

.avatar--lost .tag--id {
  display: none;   /* phones: the ghosted figure is too narrow for two labels */
}

.lost {
  margin: 0 0 6px;
  font-size: var(--hud-size);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--amber);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-top: 2px;
  padding: 12px 22px;
  font-family: var(--font-mono);
  font-size: 0.86rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--bg-0);
  background: var(--cyan);
  clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px);
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.btn::before {
  content: "\25C2" / "";
}

.btn:hover {
  background: #fff;
  transform: translateX(-3px);
}

.btn:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 4px;
  background: #fff;
}

/* --------------------------------------------------------------------------
   Breakpoints
   -------------------------------------------------------------------------- */
@media (min-width: 600px) {
  :root {
    --wm-size: clamp(3.2rem, 9.5vw, 6rem);
    --tagline-size: 1.05rem;
    --hud-size: 0.8rem;
  }

  .hero__eyebrow {
    letter-spacing: 0.22em;
  }

  .hud__block--tr {
    display: block;
  }

  .tagline {
    max-width: 36ch;
  }

  .hero--404 .tagline {
    max-width: 30ch;
  }

  .btn {
    padding: 14px 22px;
  }

  /* tablet portrait: the figure stays dominant (72vh) and right-anchored */
  .avatar {
    left: auto;
    right: -2%;
    height: min(72vh, 88vw);
    height: min(72dvh, 88vw);
  }

  .hero--404 ~ .avatar {
    height: min(62vh, 88vw);
    height: min(62dvh, 88vw);
  }

  .avatar--lost .tag--id {
    display: block;
  }

  .spell {
    width: 140%;
  }

  /* tablet: both labels sit on the right, clear of the copy column */
  .tag--lock {
    left: auto;
    right: 6%;
    transform: translate(-8px, 8px);
  }

  .tag--id {
    top: auto;
    bottom: 3%;
    transform: translateY(-40%);
  }
}

@media (min-width: 1024px) {
  :root {
    --wm-size: clamp(3.6rem, 6.4vw, 11rem);
    --hud-size: 0.82rem;
    --tag-size: 0.78rem;
    --tagline-size: 1.3rem;
  }

  .stage {
    grid-template-columns: minmax(0, 54%) minmax(0, 46%);
  }

  /* hero-column scrim: the glyph rain and rings fade out behind the copy */
  .stage::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    background: linear-gradient(90deg,
      rgba(var(--ink-rgb), 0.92) 0%,
      rgba(var(--ink-rgb), 0.82) 34%,
      rgba(var(--ink-rgb), 0.4) 50%,
      transparent 62%);
    pointer-events: none;
  }

  .hero {
    grid-column: 1;
    grid-row: 1;
    align-self: center;
    padding: 110px var(--gutter) 60px;
    background: none;
  }

  .tagline {
    max-width: 36ch;
    margin-bottom: 30px;
  }

  .ruler {
    margin-bottom: 22px;
  }

  .readout {
    display: grid;
    max-width: 420px;
  }

  .foot {
    background: none;
    padding: 0;
  }

  /* the figure owns the right side: 82vh tall, bottom-anchored (the vw term
     only bites on portrait tablets that are 1024px wide) */
  .avatar,
  .hero--404 ~ .avatar {
    right: clamp(24px, 6vw, 200px);
    height: min(82vh, 60vw);
    height: min(82dvh, 60vw);
  }

  .avatar__img {
    filter:
      drop-shadow(-8px 0 16px rgba(var(--magenta-rgb), 0.5))
      drop-shadow(8px 0 14px rgba(var(--cyan-rgb), 0.42));
  }

  /* ring diameter capped in vh/vw and centred a little lower on the figure,
     so the outer ring clears the top edge and the top-right HUD block at
     every desktop aspect ratio from 1024x768 to 2560x1440 */
  .spell {
    top: 38%;
    width: min(150%, 80vh, 60vw);
  }

  /* desktop: the lock label rides above the frame's top-left corner, the id
     label sits on the torso at the bottom-left corner */
  .tag--lock {
    right: auto;
    left: 6%;
    transform: translateY(-120%);
  }

  .tag--id {
    right: auto;
    left: 6%;
    bottom: 3%;
    transform: translate(8px, -40%);
  }
}

@media (min-width: 1800px) {
  :root {
    --hud-size: 0.95rem;
    --tag-size: 0.9rem;
    --wm-size: clamp(3.6rem, 7vw, 12rem);
    --tagline-size: 1.45rem;
  }

  .hero {
    padding-top: 140px;
  }

  .tagline {
    max-width: 38ch;
  }

  .readout,
  .ruler {
    max-width: 520px;
  }
}

/* ultra-wide: the wordmark grows so the left column reaches toward the figure */
@media (min-width: 2200px) {
  :root {
    --wm-size: clamp(3.6rem, 8vw, 14rem);
    --tagline-size: 1.55rem;
    --hud-size: 1rem;
  }

  .tagline {
    max-width: 40ch;
  }

  .readout,
  .ruler {
    max-width: 600px;
  }
}

/* short landscape phones: keep the figure but shrink it and tuck it right */
@media (max-width: 1023px) and (max-height: 520px) {
  :root {
    --wm-size: clamp(2rem, 7vw, 3.4rem);
  }

  .avatar,
  .hero--404 ~ .avatar {
    left: auto;
    right: 2%;
    height: 72vh;
  }

  .hero {
    padding-top: 72px;
    max-width: 60%;
  }
}

/* --------------------------------------------------------------------------
   Reduced motion: keep the composition, drop the movement (by name, so a
   future transition is never silently killed)
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .hud__dot,
  .sign--flick-a,
  .sign--flick-b,
  .sign--flick-c,
  .sign--beacon,
  .rain__col,
  .word::after,
  .wordmark::after,
  .wordmark.is-glitching .word::after,
  .avatar__ghost,
  .avatar__tear,
  .avatar__scan::before,
  .avatar__dissolve,
  .spell__ring,
  .spell__soul,
  .fx__camo {
    animation: none;
  }

  .btn {
    transition: none;
  }

  /* the magenta slice and the tear are motion-only effects: hide them */
  .word::after,
  .avatar__tear {
    opacity: 0;
  }

  .wordmark::after,
  .avatar__scan,
  .fx__camo {
    display: none;
  }

  .avatar__ghost {
    opacity: 0.28;
  }
}
