/* $BELIEVE — HUD: per-stratum lore panels + left-edge progress track.
   DOM is built entirely by js/hud.js; this file only styles it. Same
   HUD-terminal language as gate.css/cards.css: thin green hairline border,
   Space Mono, letter-spaced caps, CSS-only barcode texture. Colors read from
   the --believe-* custom properties gate.js bridges off CFG.colors; the hex
   fallbacks here just mirror config.js in case that bridge hasn't run yet
   (same defensive pattern gate.css/cards.css already use). */

/* #hud itself is `position:fixed; inset:0; pointer-events:none;` via
   base.css already -- pointer-events inherits, so everything below is
   inert to mouse/touch by default. Only .hud__cta / .hud__social opt back
   in below, matching the brief: scroll/drag over empty panel space must
   fall through to the 3D world's rail input untouched. */

.hud {
  opacity: 0;
  transition: opacity 400ms ease;
}

.hud.is-visible {
  opacity: 1;
}

.hud[hidden] {
  display: none;
}

/* Task 10 (Daily Sit): js/sit.js toggles this directly on #hud while a sit
   is entering/active/ending -- reuses the opacity transition above (rather
   than a hard [hidden] cut) so the HUD fades out/in instead of popping. */
.hud.is-sit-active {
  opacity: 0;
  pointer-events: none;
}

/* Remedy 1 ("one tab, one spark"): js/hud.js toggles this on 'rail:egg' so
   the stale panel + track fade out for the whole Log Zero dive. The
   delayed visibility flip removes the invisible ctas from hit-testing once
   the fade lands (visibility, unlike pointer-events, can't be re-opted
   into by the ctas' own `pointer-events: auto`); dropping the class
   restores visibility instantly and lets the base opacity transition fade
   the HUD back in. */
.hud.is-eclipsed {
  opacity: 0;
  visibility: hidden;
  transition: opacity 400ms ease, visibility 0s 400ms;
}

/* ---- progress track (left edge) ---- */

.hud__track {
  position: fixed;
  left: clamp(14px, 3vw, 28px);
  top: 50%;
  transform: translateY(-50%);
  height: min(56vh, 440px);
  width: 24px;
  display: flex;
  align-items: stretch;
  justify-content: center;
}

.hud__track-line {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  transform: translateX(-50%);
  background: color-mix(in srgb, var(--believe-grey, #6a6f5e) 45%, transparent);
  overflow: hidden;
}

.hud__track-fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0%;
  background: var(--believe-green, #b8d62e);
  box-shadow: 0 0 8px var(--believe-green, #b8d62e);
}

.hud__pips {
  position: relative;
  list-style: none;
  width: 100%;
  height: 100%;
  display: flex;
  /* index 0 (DOUBT) at the bottom, index 4 (TRANSCEND) at the top -- reads
     as climbing, matching the ascent, without hud.js having to reverse its
     own straightforward CFG.strata-order indexing. */
  flex-direction: column-reverse;
  justify-content: space-between;
  align-items: center;
  padding: 3px 0;
}

.hud__pip {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
}

.hud__pip-shape {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1.5px solid var(--believe-grey, #6a6f5e);
  background: var(--believe-bg, #050603);
  transition: background-color 200ms ease, border-color 200ms ease,
    box-shadow 200ms ease, transform 200ms ease;
}

/* past: solid fill. active: bright + glow + slightly larger. future: hollow. */
.hud__pip.is-past .hud__pip-shape {
  background: var(--believe-green, #b8d62e);
  border-color: var(--believe-green, #b8d62e);
}

.hud__pip.is-active .hud__pip-shape {
  background: var(--believe-bright, #d4f24b);
  border-color: var(--believe-bright, #d4f24b);
  box-shadow: 0 0 10px 2px var(--believe-bright, #d4f24b);
  transform: scale(1.25);
}

.hud__pip.is-future .hud__pip-shape {
  background: transparent;
  border-color: var(--believe-grey, #6a6f5e);
}

/* ---- pips as tiny ensos (progressively enhanced) ----
   Where conic-gradient + mask are available, each pip becomes a miniature
   enso: an arc with the sigil's ~50 degree brush gap. The states read as
   lore, not just chart-progress -- "The ring closes for those who hold":
     future: open ring, grey, faint -- an enso not yet drawn closed.
     active: open ring, bright, glowing, the gap slowly orbiting.
     past:   the gap closes -- a completed ring.
   The border-circle rules above stay as the no-mask fallback. */
@supports (mask: radial-gradient(#000, #000)) {
  .hud__pip-shape {
    --pip-gap: 50deg;
    border: none;
    color: var(--believe-grey, #6a6f5e);
    background: conic-gradient(
      from 205deg,
      transparent 0 var(--pip-gap),
      currentColor var(--pip-gap) 360deg
    );
    mask: radial-gradient(circle closest-side, transparent 58%, #000 62%);
    transition: color 200ms ease, opacity 200ms ease,
      box-shadow 200ms ease, transform 200ms ease;
  }

  .hud__pip.is-future .hud__pip-shape {
    background: conic-gradient(
      from 205deg,
      transparent 0 var(--pip-gap),
      currentColor var(--pip-gap) 360deg
    );
    color: var(--believe-grey, #6a6f5e);
    opacity: 0.75;
  }

  .hud__pip.is-past .hud__pip-shape {
    --pip-gap: 0deg;
    background: conic-gradient(
      from 205deg,
      transparent 0 var(--pip-gap),
      currentColor var(--pip-gap) 360deg
    );
    color: var(--believe-green, #b8d62e);
  }

  .hud__pip.is-active .hud__pip-shape {
    background: conic-gradient(
      from 205deg,
      transparent 0 var(--pip-gap),
      currentColor var(--pip-gap) 360deg
    );
    color: var(--believe-bright, #d4f24b);
    box-shadow: 0 0 10px 2px color-mix(in srgb, var(--believe-bright, #d4f24b) 55%, transparent);
    animation: pipOrbit 14s linear infinite;
  }
}

/* The active enso's brush gap drifts slowly around the ring -- transform
   carries the scale the static rule would otherwise apply (an animation
   outranks it), so the keyframes own both. */
@keyframes pipOrbit {
  from { transform: scale(1.25) rotate(0deg); }
  to { transform: scale(1.25) rotate(360deg); }
}

/* ---- panel ---- */

.hud__panel {
  position: fixed;
  top: 50%;
  right: clamp(12px, 3vw, 32px);
  transform: translateY(-50%);
  width: min(380px, 92vw);
  max-width: 380px;
  /* Defensive clamp, not the primary fit strategy -- panel copy (js/copy.js)
     is deliberately kept short enough to fit without this ever kicking in
     on a normal desktop viewport. It stays as a graceful-degradation net
     for extreme zoom/small-viewport cases; see copy.js's panel 0/1 comments.
     Short-but-ordinary desktop windows are handled properly instead by the
     two max-height fit tiers at the bottom of this file. */
  max-height: calc(100vh - 4rem);
  /* Owner request 2026-08-03: no visible scrollbars on the panel — the box
     must read as a solid HUD card. Content is height-budgeted per panel
     (copy.js); anything that would overflow is clipped, never scrolled. */
  overflow: hidden;
  scrollbar-width: none;
  opacity: 1;
  transition: opacity var(--hud-fade-in-ms, 250ms) ease;
}

.hud__panel.is-fading {
  transition: opacity var(--hud-fade-out-ms, 200ms) ease;
  opacity: 0;
}

/* Remedy 6 (decrypt-OUT): js/hud.js adds this the moment a travel leg
   begins -- the text is mid reverse-scramble, so the opacity fade waits
   120ms (the dissolve gets its two or three readable frames) and the
   delayed visibility flip drops the invisible ctas out of hit-testing for
   the whole leg. Removal falls back to the base fade-in transition, with
   visibility returning instantly. Reduced-motion: the transition kill at
   the bottom of this file makes both flips instant. */
.hud__panel.is-derezzed {
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--hud-fade-out-ms, 200ms) ease 120ms, visibility 0s 320ms;
}

.hud__panel-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.4rem 1.2rem 1rem;
  border: 1px solid var(--believe-green, #b8d62e);
  background: var(--believe-bg, #050603);
  background: color-mix(in srgb, var(--believe-bg, #050603) 88%, var(--believe-green, #b8d62e));
}

/* corner ticks -- small reticle brackets at each corner of the frame.
   Each panel render rebuilds these nodes, so the draw-out replays on every
   stratum change -- the reticle re-acquires its target as the text
   decrypts (js/hud.js's scramble pass). */
.hud__corner {
  position: absolute;
  width: 14px;
  height: 14px;
  animation: cornerDraw 340ms ease-out;
}

@keyframes cornerDraw {
  from {
    width: 0;
    height: 0;
  }
}

.hud__corner--tl {
  top: -1px;
  left: -1px;
  border-top: 1px solid var(--believe-green, #b8d62e);
  border-left: 1px solid var(--believe-green, #b8d62e);
}

.hud__corner--tr {
  top: -1px;
  right: -1px;
  border-top: 1px solid var(--believe-green, #b8d62e);
  border-right: 1px solid var(--believe-green, #b8d62e);
}

.hud__corner--bl {
  bottom: -1px;
  left: -1px;
  border-bottom: 1px solid var(--believe-green, #b8d62e);
  border-left: 1px solid var(--believe-green, #b8d62e);
}

.hud__corner--br {
  bottom: -1px;
  right: -1px;
  border-bottom: 1px solid var(--believe-green, #b8d62e);
  border-right: 1px solid var(--believe-green, #b8d62e);
}

.hud__title {
  margin: 0;
  font: 700 clamp(1.2rem, 2.4vw, 1.6rem) / 1.15 "Space Mono", "Courier New", monospace;
  letter-spacing: 0.13em;
  color: var(--believe-bright, #d4f24b);
}

/* Disclosure header (mobile peek/expand -- see hud.js's sheet block).
   Reset to read as the plain title on desktop, where hud.js keeps the
   button disabled; the mobile block below turns it into the peek bar. */
.hud__peek-btn {
  appearance: none;
  display: block;
  width: 100%;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  letter-spacing: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.hud__peek-btn:disabled {
  cursor: default;
}

.hud__peek-chevron {
  display: none; /* desktop: no affordance on an inert title */
}

/* Outside the collapsed state the body wrapper is layout-transparent --
   panel-inner's flex gap spaces its children exactly as when they were
   direct children. */
.hud__body {
  display: contents;
}

.hud__panel.is-collapsed .hud__body {
  display: none;
}

.hud__lines {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.hud__line {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.5;
  letter-spacing: 0.015em;
  color: var(--believe-green, #b8d62e);
}

.hud__steps {
  margin: 0;
  padding: 0.65rem 0 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  border-top: 1px solid color-mix(in srgb, var(--believe-green, #b8d62e) 35%, transparent);
}

.hud__step {
  font-size: 0.7rem;
  letter-spacing: 0.07em;
  color: var(--believe-grey, #6a6f5e);
}

.hud__cta {
  appearance: none;
  display: inline-block;
  font: 700 0.76rem/1 "Space Mono", "Courier New", monospace;
  letter-spacing: 0.15em;
  text-decoration: none;
  text-align: center;
  padding: 0.7rem 1rem;
  border: 1px solid var(--believe-green, #b8d62e);
  background: none;
  color: var(--believe-green, #b8d62e);
  cursor: pointer;
  transition: color 120ms ease, border-color 120ms ease, background-color 120ms ease;
  /* Opts back into hit-testing -- the one thing in .hud__panel that should
     ever catch a click. */
  pointer-events: auto;
  /* Kills the double-tap-to-zoom heuristic (and its ~ms tap delay) on this
     control without blocking scroll gestures that start on it. */
  touch-action: manipulation;
}

.hud__cta:hover,
.hud__cta:focus-visible {
  color: var(--believe-bg, #050603);
  background: var(--believe-green, #b8d62e);
}

/* Launch flip: the live CA button carries the full 42-char address --
   tighter type + break-all so it wraps inside the panel instead of
   blowing out the layout on any viewport. */
.hud__cta--ca {
  font-size: 0.66rem;
  letter-spacing: 0.05em;
  word-break: break-all;
  line-height: 1.4;
}

.hud__cta.is-disabled,
.hud__cta[aria-disabled="true"] {
  color: var(--believe-grey, #6a6f5e);
  border-color: var(--believe-grey, #6a6f5e);
  cursor: not-allowed;
  /* AWAITING DEPLOYMENT: a soft data-pulse -- the terminal is listening,
     not dead. Glow/border only, never text opacity (the grey sits at its
     AA floor; brightness may only ever go UP from rest). */
  animation: dataPulseGlow 3.4s ease-in-out infinite;
}

@keyframes dataPulseGlow {
  0%, 100% {
    box-shadow: 0 0 0 0 transparent;
  }
  50% {
    box-shadow: 0 0 9px 0 color-mix(in srgb, var(--believe-green, #b8d62e) 30%, transparent);
    border-color: color-mix(in srgb, var(--believe-grey, #6a6f5e) 55%, var(--believe-green, #b8d62e));
  }
}

.hud__cta.is-disabled:hover,
.hud__cta[aria-disabled="true"]:hover {
  color: var(--believe-grey, #6a6f5e);
  background: none;
}

.hud__socials {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

/* Chips share one row: flex-grow spreads the five slots (X / UNISWAP /
   DEXSCREENER / GMGN / VERIFY) across the full panel width, and the
   tightened type/padding is sized so that row never wraps inside the
   380px panel (owner call 2026-08-04: a chip breaking onto its own line
   read as clutter). */
.hud__social {
  pointer-events: auto;
  touch-action: manipulation;
  flex: 1 1 auto;
  text-align: center;
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  padding: 0.4rem 0.45rem;
  border: 1px solid var(--believe-grey, #6a6f5e);
  color: var(--believe-grey, #6a6f5e);
  text-decoration: none;
  transition: color 120ms ease, border-color 120ms ease;
}

/* Full-width chip variant (TRANSCEND's SPREAD THE WORD): sized/spaced like
   the cta above it so the SIT WITH HIM + SPREAD pair reads as one clean
   two-row block -- but it keeps the chip's grey secondary voice. */
.hud__social--wide {
  flex: 1 1 100%;
  text-align: center;
  padding: 0.6rem 1rem;
  font-weight: 700;
  letter-spacing: 0.15em;
}

.hud__social:hover,
.hud__social:focus-visible {
  color: var(--believe-green, #b8d62e);
  border-color: var(--believe-green, #b8d62e);
}

.hud__social.pending {
  opacity: 0.55;
  cursor: not-allowed;
  /* AWAITING SIGNAL: the pending slots breathe faintly brighter -- opacity
     only ever rises from the 0.55 rest (never dims below it). Staggered
     via nth-of-type so the three slots read as a slow status sweep, not a
     synchronized blink. */
  animation: dataPulseLift 3.4s ease-in-out infinite;
}

.hud__socials .hud__social.pending:nth-of-type(2) {
  animation-delay: 0.5s;
}

.hud__socials .hud__social.pending:nth-of-type(3) {
  animation-delay: 1s;
}

@keyframes dataPulseLift {
  0%, 100% {
    box-shadow: 0 0 0 0 transparent;
  }
  50% {
    opacity: 0.8;
    box-shadow: 0 0 7px 0 color-mix(in srgb, var(--believe-green, #b8d62e) 22%, transparent);
  }
}

.hud__social.pending:hover {
  color: var(--believe-grey, #6a6f5e);
  border-color: var(--believe-grey, #6a6f5e);
}

.hud__barcode {
  position: relative;
  overflow: hidden;
  width: 100%;
  height: 12px;
  margin-top: 0.2rem;
  color: var(--believe-grey, #6a6f5e);
  opacity: 0.7;
  background-image: repeating-linear-gradient(
    90deg,
    currentColor 0 2px,
    transparent 2px 5px,
    currentColor 5px 6px,
    transparent 6px 8px,
    currentColor 8px 12px,
    transparent 12px 15px,
    currentColor 15px 16px,
    transparent 16px 20px
  );
}

/* Occasional scan-shimmer: a light bar sweeps the strip (~1.2s), then the
   strip rests dark for the remainder of the cycle. Shared visual language
   with cards.css/fallback.css's own barcode sweeps (each file keeps its
   own keyframes -- distinct names, no cross-file coupling). */
.hud__barcode::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    100deg,
    transparent 30%,
    color-mix(in srgb, var(--believe-bright, #d4f24b) 32%, transparent) 50%,
    transparent 70%
  );
  transform: translateX(-101%);
  animation: hudBarcodeScan 8s linear 2.5s infinite;
}

@keyframes hudBarcodeScan {
  0% { transform: translateX(-101%); }
  15% { transform: translateX(101%); }
  100% { transform: translateX(101%); }
}

/* ---- mobile: bottom sheet ---- */

@media (max-width: 640px) {
  .hud__panel {
    top: auto;
    bottom: 0;
    right: 0;
    left: 0;
    transform: none;
    width: 100%;
    max-width: none;
    max-height: 68vh;
  }

  .hud__panel-inner {
    border-left: none;
    border-right: none;
    border-bottom: none;
    /* Tighter than desktop -- the constraint here is the sheet's own
       max-height against content that's sized by WIDTH (wraps the same
       regardless of device height), so a shorter phone gets no more room
       than a tall one. Shrinking type/spacing a notch keeps the longest
       panel (DOUBT -- 8 lines[] entries / 6 stanzas, no cta) clear of that
       ceiling on real devices instead of chasing an unreachable vh
       percentage. Verified against both a 812px-tall and a 667px-tall
       (iPhone SE class, the shortest common modern phone) viewport.
       Safe-area terms keep the sheet's content clear of the home indicator
       (bottom) and a landscape notch (left/right) on notched phones --
       env() resolves to 0 everywhere else, leaving the plain values. */
    padding: 0.95rem
      max(0.9rem, env(safe-area-inset-right))
      calc(0.65rem + env(safe-area-inset-bottom))
      max(0.9rem, env(safe-area-inset-left));
    gap: 0.5rem;
  }

  .hud__title {
    font-size: 0.98rem;
  }

  .hud__lines {
    gap: 0.36rem;
  }

  .hud__line {
    font-size: 0.7rem;
    line-height: 1.36;
  }

  .hud__corner--bl,
  .hud__corner--br {
    display: none;
  }

  .hud__track {
    left: max(10px, env(safe-area-inset-left));
    height: min(38vh, 300px);
  }

  /* Peek bar: the title row is the whole collapsed sheet, and the one
     thing in the panel that catches taps. min-height keeps it a real
     thumb target even though the type is small. Chevron points up when
     collapsed ("there's more below your thumb"), down when expanded. */
  .hud__peek-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    min-height: 2.4rem;
    pointer-events: auto;
    touch-action: manipulation;
  }

  .hud__peek-chevron {
    display: block;
    flex: none;
    width: 0.55em;
    height: 0.55em;
    margin-right: 0.15em;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(-135deg) translate(-15%, -15%); /* points up */
    transition: transform 200ms ease;
  }

  .hud__peek-btn[aria-expanded="true"] .hud__peek-chevron {
    transform: rotate(45deg); /* points down */
  }
}

/* ---- short desktop windows: two fit tiers ----

   Owner rule (2026-08-03): panels never scroll -- overflow stays hidden.
   So when the window is short, the content itself must shrink to fit.
   The budget panel is DOUBT (8 lines[] entries -> ~21 wrapped text lines
   at the 380px panel width): 572px tall at full desktop type, which plus
   the panel's 4rem viewport margin stops fitting below ~636px of window
   height. That's a realistic desktop case (a 1366x768 laptop with normal
   browser chrome commonly lands around 560-620px innerHeight), not an
   extreme-zoom one, so it can't be left to the max-height clip above.

   Same technique as the mobile block: smaller title, tighter gaps,
   smaller line type, tighter inner padding. Two tiers so a 700px-tall
   window only pays a whisker of shrink and only genuinely short windows
   take the second notch (measured DOUBT heights, 1024px-wide viewport):
     <=700px tier: 508px -> fits every window >=572px tall.
     <=620px tier: 441px -> fits every window >=505px tall, well clear
       of the 560px floor this was tuned against; below ~505px the
       max-height clamp above resumes as the graceful-degradation net.

   The (min-width: 641px) guard is load-bearing, not decoration: a
   landscape phone can be simultaneously <=640px wide and <=700px tall,
   and without the guard these declarations would stack on top of the
   mobile bottom-sheet block above, which is its own separately-tuned
   layout. */

@media (min-width: 641px) and (max-height: 700px) {
  .hud__panel-inner {
    padding: 1.1rem 1.2rem 0.8rem;
    gap: 0.6rem;
  }

  .hud__title {
    font-size: 1.15rem;
  }

  .hud__lines {
    gap: 0.45rem;
  }

  .hud__line {
    font-size: 0.76rem;
    line-height: 1.45;
  }
}

/* Second notch. Must stay AFTER the 700px tier: a <=620px window matches
   both blocks, and these same-specificity declarations win by source
   order alone. */
@media (min-width: 641px) and (max-height: 620px) {
  .hud__panel-inner {
    padding: 0.9rem 1.2rem 0.65rem;
    gap: 0.5rem;
  }

  .hud__title {
    font-size: 1rem;
  }

  .hud__lines {
    gap: 0.38rem;
  }

  .hud__line {
    font-size: 0.72rem;
    line-height: 1.4;
  }
}

/* Third notch -- landscape PHONES (e.g. 812x375), mobile lane. Same
   min-width guard and same source-order rule as the two desktop tiers
   above: a landscape phone matches all three blocks, and this one must
   stay LAST so its tighter values win. Beyond type shrink it also trims
   the panel's viewport margin (100vh - 2rem, vs the base 4rem -- at 375px
   tall the margin alone was costing a fifth of the height budget), keeps
   the track from colliding with a notch, and honors the right-edge
   safe-area inset. */
@media (min-width: 641px) and (max-height: 480px) {
  .hud__panel {
    max-height: calc(100vh - 2rem);
    right: max(clamp(12px, 3vw, 32px), env(safe-area-inset-right));
    /* Wider than the base 380px on purpose: height is the scarce axis in
       landscape, so trade the abundant one for it -- longer lines wrap
       into fewer rows. Measured with the budget panel (DOUBT): 380px wide
       clipped 419px of content into a 343px budget; 60vw + the type notch
       below fits it with margin. */
    width: min(480px, 60vw);
    max-width: min(480px, 60vw);
  }

  .hud__panel-inner {
    padding: 0.9rem 0.9rem 0.7rem;
    gap: 0.45rem;
  }

  .hud__title {
    font-size: 0.94rem;
  }

  .hud__lines {
    gap: 0.32rem;
  }

  .hud__line {
    font-size: 0.66rem;
    line-height: 1.32;
  }

  .hud__track {
    left: max(clamp(14px, 3vw, 28px), env(safe-area-inset-left));
    height: min(64vh, 300px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .hud,
  .hud__panel,
  .hud__pip-shape,
  .hud__cta,
  .hud__peek-chevron {
    transition: none !important;
  }

  .hud__barcode::after,
  .hud__pip.is-active .hud__pip-shape,
  .hud__cta.is-disabled,
  .hud__cta[aria-disabled="true"],
  .hud__social.pending,
  .hud__corner {
    animation: none !important;
  }
}
