/* styles/wayfinding.css
   Orientation overlay — act marker, objective glyph, status strip,
   continue gate, ledger entry styling. Lives at the top-left of the
   viewport in a small column. Respects beat-mode (decision vs prose)
   and the per-biome scaffoldLevel for the faded-guidance arc. */

/* ---------- WAYFINDING OVERLAY (top-left column) ---------- */

#wayfinding-overlay {
  position: fixed;
  top: 4vh;
  left: 2vw;
  z-index: var(--z-hud);
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;       /* children re-enable as needed */
  font-family: var(--mono);
  transition: opacity 600ms ease;
  /* rem-based so the overlay grows with UI Scale; 26vw cap keeps it
     from invading the narrator's centred prose zone on narrow screens. */
  max-width: min(17.5rem, 26vw);
}

/* Hide entirely when debug param disables it (not yet wired; future use) */
#wayfinding-overlay.hidden { display: none; }

/* Scaffold-level fade — lower scaffold = dimmer overlay. */
body[data-scaffold-level="0"] #wayfinding-overlay { opacity: 0.35; }
body[data-scaffold-level="1"] #wayfinding-overlay { opacity: 0.55; }
body[data-scaffold-level="2"] #wayfinding-overlay { opacity: 0.85; }
body[data-scaffold-level="3"] #wayfinding-overlay { opacity: 1; }

/* Beat-mode — prose beats dim the overlay further. */
body.beat-prose #wayfinding-overlay { opacity: 0.3; }

/* ---------- JOURNEY STEPPER (top-center, persistent header) ---------- */

#journey-stepper {
  position: fixed;
  top: 1.5vh;
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-hud);
  pointer-events: none;
  max-width: 96vw;
  transition: opacity 600ms ease;
}

/* Stepper respects the same scaffold-level + beat-mode fades */
body[data-scaffold-level="0"] #journey-stepper { opacity: 0.5;  }
body[data-scaffold-level="1"] #journey-stepper { opacity: 0.7;  }
body[data-scaffold-level="2"] #journey-stepper { opacity: 0.92; }
body[data-scaffold-level="3"] #journey-stepper { opacity: 1;    }
body.beat-prose #journey-stepper { opacity: 0.4; }

.js-track {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 4px;
  position: relative;
  align-items: stretch;
}

.js-stop {
  position: relative;
  z-index: 1;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(10, 14, 22, 0.88);
  border: 1px solid rgba(232, 216, 255, 0.18);
  border-radius: 2px;
  pointer-events: auto;
  cursor: help;
  transition: all 220ms ease;
  min-width: 0;
}
.js-num {
  font-family: var(--mono);
  font-size: 0.55rem;
  letter-spacing: 0.18em;
  color: rgba(232, 216, 255, 0.42);
  font-weight: bold;
}
.js-name {
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.18em;
  color: rgba(232, 216, 255, 0.55);
  text-transform: uppercase;
  white-space: nowrap;
}

/* Connecting line between dots — subtle, behind */
.js-track::before {
  content: '';
  position: absolute;
  left: 8%;
  right: 8%;
  top: 50%;
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(232, 216, 255, 0.12) 12%,
    rgba(232, 216, 255, 0.12) 88%,
    transparent 100%);
  z-index: 0;
  pointer-events: none;
}

/* COMPLETED — green */
.js-stop.completed {
  border-color: rgba(10, 191, 83, 0.45);
  background: rgba(6, 26, 14, 0.92);
}
.js-stop.completed .js-num  { color: rgba(10, 191, 83, 0.95); }
.js-stop.completed .js-name { color: rgba(120, 220, 170, 0.88); }
.js-stop.completed::after {
  content: '✓';
  margin-left: 4px;
  color: rgba(10, 191, 83, 0.95);
  font-size: 0.7rem;
}

/* CURRENT — warm highlight */
.js-stop.current {
  border-color: rgba(248, 232, 192, 0.95);
  background: rgba(40, 30, 12, 0.95);
  box-shadow: 0 0 14px rgba(248, 232, 192, 0.3);
  padding: 6px 16px;
  /* P2-6: gentle pulse so a glance at the top of the screen says
     "you are HERE" without needing to read the small label. ~3s
     cycle — below conscious-motion threshold but visually anchoring. */
  animation: js-current-pulse 3000ms ease-in-out infinite;
}
@keyframes js-current-pulse {
  0%, 100% {
    box-shadow: 0 0 14px rgba(248, 232, 192, 0.3);
    border-color: rgba(248, 232, 192, 0.95);
  }
  50% {
    box-shadow: 0 0 22px rgba(248, 232, 192, 0.55);
    border-color: rgba(252, 244, 220, 1);
  }
}
@media (prefers-reduced-motion: reduce) {
  .js-stop.current { animation: none; }
}
.js-stop.current .js-num  { color: rgba(248, 232, 192, 1); }
.js-stop.current .js-name { color: rgba(248, 232, 192, 1); font-weight: bold; }
.js-stop.current::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid rgba(248, 232, 192, 0.95);
}

/* HOVER + FOCUS tooltip — shows the poetic name.
   Keyboard-focus surfaces the same tooltip mouse users get on hover,
   so the poetic name is available to keyboard users (the aria-label
   already includes it for screen-reader users). */
.js-stop[data-poetic]:hover::before,
.js-stop[data-poetic]:focus-visible::before {
  content: attr(data-poetic);
  position: absolute;
  top: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.94);
  padding: 4px 10px;
  border-radius: 2px;
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  color: rgba(248, 232, 192, 0.95);
  white-space: nowrap;
  border: 1px solid rgba(232, 216, 255, 0.3);
  pointer-events: none;
  z-index: 32;
}
.js-stop.current:hover::before,
.js-stop.current:focus-visible::before { display: none; }   /* Don't compete with the arrow */

/* ---------- OBJECTIVE GLYPH ---------- */

/* Objective + Status: leading glyph carries the "callout" feel
   instead of a side stripe (BAN 1). The glyph color encodes the
   callout type (gold for objective, blue for status). */
#objective-glyph {
  display: none;
  flex-direction: column;
  gap: 2px;
  padding: 8px 12px;
  background: rgba(10, 14, 22, 0.7);
  border-radius: 2px;
}
#objective-glyph.visible { display: flex; }

.og-label {
  font-family: var(--mono);
  font-size: 0.52rem;
  letter-spacing: 0.5em;
  color: rgba(248, 232, 192, 0.55);
  text-transform: uppercase;
}
.og-label::before {
  content: '▸ ';
  color: rgba(248, 232, 192, 0.8);
  letter-spacing: 0;
}
#objective-text {
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.92rem;
  line-height: 1.3;
  color: rgba(248, 232, 192, 0.88);
}

/* ---------- STATUS STRIP ---------- */

#status-strip {
  display: none;
  padding: 6px 12px;
  background: rgba(10, 14, 22, 0.55);
  border-radius: 2px;
  /* Smooth opacity transition for beat-mode gating below. */
  transition: opacity 600ms ease;
}
#status-strip.visible { display: block; }
/* P1-3: Dim status strip during pure-prose beats. Decision beats
   surface it fully. Reduces chrome density when the player should be
   reading prose, not parsing a counter. */
body.beat-prose #status-strip { opacity: 0.25; }
body.beat-decision #status-strip { opacity: 1; }
#status-strip::before {
  content: '● ';
  color: rgba(184, 224, 255, 0.8);
  font-family: var(--mono);
  font-size: 0.55rem;
  vertical-align: 1px;
  margin-right: 2px;
}

#status-text {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  color: rgba(184, 224, 255, 0.85);
  text-transform: uppercase;
}

/* Pulse animation when status updates */
#status-strip.pulse #status-text {
  animation: status-pulse 600ms ease-out;
}
@keyframes status-pulse {
  0%   { color: rgba(255, 255, 255, 1);
         text-shadow: 0 0 12px rgba(184, 224, 255, 0.9); }
  100% { color: rgba(184, 224, 255, 0.85);
         text-shadow: none; }
}

/* ---------- CONTINUE GATE (universal) ----------
   Used by every interactive biome before the "live" beat begins.
   Same word, same shape — becomes a recognizable ritual gesture. */

.continue-gate {
  position: absolute;
  left: 50%;
  bottom: 8%;
  transform: translateX(-50%);
  z-index: 6;
  background: linear-gradient(180deg,
    rgba(20, 24, 36, 0.95) 0%,
    rgba(10, 12, 20, 0.95) 100%);
  border: 2px solid currentColor;
  border-radius: 4px;
  padding: 14px 32px;
  cursor: pointer;
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-family: var(--mono);
  box-shadow:
    0 0 24px rgba(255, 255, 255, 0.08),
    0 8px 22px rgba(0, 0, 0, 0.65);
  transition: all 200ms ease;
}
.continue-gate.revealed { display: inline-flex; }
.continue-gate:hover {
  box-shadow:
    0 0 36px rgba(255, 255, 255, 0.18),
    0 12px 28px rgba(0, 0, 0, 0.8);
  transform: translateX(-50%) translateY(-2px);
}
.continue-gate:active {
  transform: translateX(-50%) translateY(0) scale(0.97);
  filter: brightness(1.2);
}

.cg-eyebrow {
  font-size: 0.55rem;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  opacity: 0.6;
}
.cg-label {
  font-size: 1rem;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  font-weight: bold;
}
.cg-hint {
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  opacity: 0.7;
  margin-top: 2px;
}

/* Per-biome accent colors — applied via inline style on the button */
.continue-gate[data-accent="brass"]  { color: rgba(200, 152, 88, 0.95); }
.continue-gate[data-accent="cool"]   { color: rgba(184, 224, 255, 0.95); }
.continue-gate[data-accent="warm"]   { color: rgba(255, 244, 208, 0.95); }
.continue-gate[data-accent="cream"]  { color: rgba(240, 232, 216, 0.95); }
.continue-gate[data-accent="sunset"] { color: rgba(255, 168, 100, 0.95); }

/* ---------- LEDGER ENTRY (System voice variant) ----------
   The first System line in each biome is a "ledger entry" — a
   clearance-house statement of the goal. We don't need a new voice;
   we use System.speak with a specific HTML prefix. The prefix uses
   <em> which the existing .sys-line em rule tints packet-blue, and
   we sharpen that into a mono-cap header here. */

.sys-line .ledger-prefix {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.32em;
  color: rgba(184, 224, 255, 0.95);
  padding: 1px 8px;
  margin-right: 8px;
  border: 1px solid rgba(184, 224, 255, 0.5);
  border-radius: 2px;
  text-transform: uppercase;
  font-style: normal;
  vertical-align: middle;
}

@media (prefers-reduced-motion: reduce) {
  #wayfinding-overlay, #act-spine, #objective-glyph, #status-strip,
  .continue-gate { transition-duration: 100ms; }
  #status-strip.pulse #status-text { animation-duration: 200ms; }
}

/* ---------------------------------------------------------------------
   DIEGETIC HUD — journey stepper mirrors payment-condition (C10)
   ---------------------------------------------------------------------
   The seven-stop spine at the top is persistent chrome — diegetically
   it's the Intent's path through the system. As the Intent wears, the
   spine dims and desaturates so the chrome reflects the protagonist's
   actual state. Pristine = bright brass; battered = dim, faded.
--------------------------------------------------------------------- */
#journey-stepper {
  transition: filter 1200ms ease;
}
body[data-payment-condition="scuffed"]  #journey-stepper { filter: saturate(0.90); }
body[data-payment-condition="worn"]     #journey-stepper { filter: saturate(0.70) brightness(0.94); }
body[data-payment-condition="battered"] #journey-stepper { filter: saturate(0.45) brightness(0.82); }
@media (prefers-reduced-motion: reduce) {
  #journey-stepper { transition-duration: 200ms; }
}

/* ---------- MOBILE (C7) ----------
   Journey stepper stops need 44px touch targets. Wayfinding overlay
   shrinks but stays at the corner. Continue-gate scales down. */
@media (max-width: 520px) {
  #wayfinding-overlay {
    max-width: min(15rem, 44vw);
  }
  .js-stop {
    padding: 8px 12px;
    min-height: 44px;
  }
  .js-num  { font-size: 0.6rem; }
  .js-name { font-size: 0.64rem; }
  .continue-gate {
    padding: 12px 22px;
    min-height: 48px;
  }
  .cg-label   { font-size: 0.88rem; letter-spacing: 0.32em; }
  .cg-eyebrow { font-size: 0.5rem; }
  .cg-hint    { font-size: 0.7rem; }
  #status-strip { font-size: 0.7rem; }
}
