/* dojo-progress.css — HUD. Koro's lantern is the diegetic progress
   signal; the explicit "X / 13 scrolls" counter at top-center makes the
   goal legible to first-time visitors and demo watchers. This file
   styles the counter, the hints-toggle button (bottom-right), and the
   scroll-orb arc animation. Colors from tokens.css. */

/* --- Home button (upper-left) --- */
.dojo-home-btn {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: var(--z-ui);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  background: rgba(15, 14, 23, 0.78);
  border: 2px solid var(--color-gold);
  border-radius: 6px;
  color: var(--color-pixel-cream);
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}
.dojo-home-btn:hover,
.dojo-home-btn:focus-visible {
  border-color: var(--color-pixel-cream);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45),
              0 0 0 2px rgba(255, 209, 102, 0.38);
  transform: translateY(-1px);
  outline: none;
}
.dojo-home-btn:active {
  transform: translateY(1px);
}
.dojo-home-btn svg {
  display: block;
}

/* --- Visible scroll counter (top-center) --- */
.dojo-scroll-counter {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-ui);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.6px;
  color: var(--color-pixel-cream);
  background: rgba(15, 14, 23, 0.78);
  border: 2px solid var(--color-gold);
  border-radius: 6px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
  pointer-events: none;
  user-select: none;
}
.dojo-scroll-counter-icon {
  font-size: 14px;
  line-height: 1;
  filter: drop-shadow(0 0 4px rgba(255, 209, 102, 0.6));
}
.dojo-scroll-counter-found {
  color: var(--color-gold);
  font-size: 14px;
  text-shadow: 0 0 8px rgba(255, 209, 102, 0.55);
}
.dojo-scroll-counter-sep,
.dojo-scroll-counter-total {
  color: rgba(254, 246, 228, 0.7);
}
.dojo-scroll-counter-label {
  color: rgba(254, 246, 228, 0.7);
  font-size: 11px;
}
/* Bump animation when the count increments */
.dojo-scroll-counter-bump {
  animation: dojoCounterBump 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.4);
}
@keyframes dojoCounterBump {
  0%   { transform: translateX(-50%) scale(1); }
  40%  { transform: translateX(-50%) scale(1.18); border-color: var(--color-pixel-warm); }
  100% { transform: translateX(-50%) scale(1); }
}
/* All scrolls found — counter pulses gold */
.dojo-scroll-counter[data-complete="true"] {
  animation: dojoCounterComplete 1.6s ease-in-out infinite;
}
@keyframes dojoCounterComplete {
  0%, 100% { box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45),
                          0 0 0 0 rgba(255, 209, 102, 0.0); }
  50%      { box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45),
                          0 0 18px 4px rgba(255, 209, 102, 0.7); }
}
@media (prefers-reduced-motion: reduce) {
  .dojo-scroll-counter-bump,
  .dojo-scroll-counter[data-complete="true"] { animation: none; }
}

.dojo-hud {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: var(--z-ui);
  pointer-events: none;
}

.dojo-hud-toggle {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 8px;
  min-width: 44px;
  min-height: 44px;
  background: rgba(15, 14, 23, 0.72);
  border: 2px solid var(--color-gold);
  border-radius: 6px;
  color: var(--color-pixel-cream);
  font-family: var(--font-body);
  cursor: pointer;
  box-shadow: 0 0 0 2px rgba(255, 209, 102, 0.18);
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.dojo-hud-toggle:hover,
.dojo-hud-toggle:focus-visible {
  border-color: var(--color-pixel-cream);
  box-shadow: 0 0 0 2px rgba(255, 209, 102, 0.38);
  outline: none;
}

.dojo-hud[data-hints-enabled="false"] .dojo-hud-toggle {
  border-color: var(--color-pixel-warm);
  opacity: 0.82;
}

.dojo-hud-lantern-icon {
  position: relative;
  width: 14px;
  height: 18px;
  border: 2px solid var(--color-gold);
  border-radius: 2px;
  background: rgba(15, 14, 23, 0.6);
  overflow: hidden;
}

.dojo-hud-lantern-flame {
  position: absolute;
  left: 1px;
  right: 1px;
  bottom: 1px;
  height: 70%;
  background: radial-gradient(ellipse at center bottom,
    var(--color-gold) 0%, rgba(255, 209, 102, 0.5) 60%, transparent 100%);
  border-radius: 40% 40% 20% 20%;
  box-shadow: 0 0 6px var(--color-gold);
}

.dojo-hud[data-hints-enabled="false"] .dojo-hud-lantern-flame {
  background: rgba(254, 246, 228, 0.18);
  box-shadow: none;
}

.dojo-hud-hint-state {
  font-family: var(--font-body);
  font-size: 9px;
  font-weight: 600;
  color: var(--color-moss);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.dojo-hud[data-hints-enabled="false"] .dojo-hud-hint-state {
  color: var(--color-pixel-warm);
}

.dojo-hud[data-hints-enabled="false"] .dojo-hud-hint-state::after {
  content: " (off)";
}

/* Pulse animation fired when idle-hint triggers; toggled via data attribute. */
@keyframes dojoHudTogglePulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 2px rgba(255, 209, 102, 0.18); }
  50%      { transform: scale(1.08); box-shadow: 0 0 0 4px rgba(255, 209, 102, 0.55); }
}

.dojo-hud[data-pulsing="true"] .dojo-hud-toggle {
  animation: dojoHudTogglePulse 0.6s ease-in-out 2;
}

/* --- Scroll-to-lantern orb arc animation ---
   Spawned by dojo-hud.ts at container screen coords; its CSS custom properties
   drive the translate end-state and mid-arc lift. ~600ms ease-out. */
.dojo-lantern-orb {
  position: fixed;
  left: 0;
  top: 0;
  width: 24px;
  height: 24px;
  margin-left: -12px;
  margin-top: -12px;
  border-radius: 50%;
  background: radial-gradient(circle,
    var(--color-pixel-cream) 0%, var(--color-gold) 45%, rgba(255, 209, 102, 0.2) 75%, transparent 100%);
  box-shadow: 0 0 14px var(--color-gold), 0 0 28px rgba(255, 209, 102, 0.5);
  pointer-events: none;
  z-index: calc(var(--z-ui) + 2);
  transform: translate(var(--orb-x0, 0px), var(--orb-y0, 0px)) scale(0.6);
  opacity: 0;
  animation: dojoLanternOrbArc 600ms cubic-bezier(0.32, 0.72, 0.3, 1) forwards;
}

@keyframes dojoLanternOrbArc {
  0%   { transform: translate(var(--orb-x0), var(--orb-y0)) scale(0.6); opacity: 0; }
  12%  { opacity: 1; }
  50%  { transform: translate(var(--orb-xm), var(--orb-ym)) scale(1.1); opacity: 1; }
  100% { transform: translate(var(--orb-x1), var(--orb-y1)) scale(0.2); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .dojo-hud[data-pulsing="true"] .dojo-hud-toggle { animation: none; }
  .dojo-lantern-orb { animation: none; opacity: 0; }
}
