/* Home hero: a playable piece of the surface (layout/hero-home.php, js/hero.js). */
.living-hero {
  position: relative; height: 410px; isolation: isolate; overflow: hidden;
  image-rendering: pixelated;
}
.living-hero[style*="--map"] {
  height: calc(var(--rows) * 64px);
  background: var(--map) 50% 0 / 3840px auto no-repeat;
}
/* A short shade under the header and its crest; a plain vertical fade with no shape of its own. */
.living-hero::before {
  content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(180deg, #071325b3 0, #07132566 70px, #07132500 170px);
}
.phero.living-hero::before {
  background: linear-gradient(180deg, #071325e6 0, #071325a6 38%, #07132559 70%, #07132500 100%);
}
.living-hero .pht { z-index: 400; pointer-events: none; }
/* the header crest hangs ~100px into the hero: centre the title in the space below it */
.phero.living-hero { padding-top: 100px; }
@media (max-width: 1100px) { .phero.living-hero { padding-top: 60px; } }
@media (max-width: 640px) { .phero.living-hero { padding-top: 0; } }
/* ---- map ---- */
.map-stage { position: absolute; inset: 0; z-index: 2; outline: none; }
.map-stage.over-foe { cursor: pointer; }
.map-stage:focus-visible { box-shadow: inset 0 0 0 3px var(--gold); }

.actor, .fx, .corpse, .map-mark, .float { position: absolute; left: 0; top: 0; pointer-events: none; }
.actor { width: 64px; height: 64px; opacity: 0; transition: opacity .4s var(--ease); }
.is-ready .actor { opacity: 1; }
/* 128px cells hold the body in their bottom-right tile; creatures sit 16px up-left of their tile */
.actor .sprite {
  position: absolute; left: -80px; top: -80px; width: 128px; height: 128px;
  background-repeat: no-repeat;
  background-size: calc(var(--frames) * 128px) 512px;
  background-position: calc(var(--frame, 0) * -128px) calc(var(--direction, 2) * -128px);
  filter: drop-shadow(0 2px 1px #0c1f1266);
}
.actor.is-target .sprite::after {
  content: ''; position: absolute; left: 64px; top: 64px; width: 64px; height: 64px;
  box-sizing: border-box; border: 2px solid #ff1f1f;
}
.actor .label {
  position: absolute; left: 16px; bottom: calc(100% + 18px); z-index: 1;
  display: flex; flex-direction: column; align-items: center; gap: 2px; transform: translateX(-50%);
}
.actor .name { font-size: 12px; color: #00c000; }
.actor .hp { display: block; width: 54px; height: 6px; border: 1px solid #000; background: #000; }
.actor .hp i { display: block; height: 100%; background: #00c000; }

.fx, .corpse { width: 128px; height: 128px; }
.fx { background-repeat: no-repeat; background-size: calc(var(--frames) * 128px) 128px; background-position: calc(var(--frame, 0) * -128px) 0; }
.corpse { transition: opacity 3s linear; }
.corpse.is-fading { opacity: 0; }

.float { z-index: 300; font-size: 13px; margin-left: -10px; animation: hero-float 900ms var(--ease) both; }
@keyframes hero-float { from { translate: 0 0; opacity: 1; } 70% { opacity: 1; } to { translate: 0 -34px; opacity: 0; } }

/* destination: four pixel corners, like a selection in the client */
.map-mark {
  z-index: 8; width: 64px; height: 64px; --c: #fff; --l: 14px; --w: 3px;
  background:
    linear-gradient(var(--c) 0 0) 0 0 / var(--l) var(--w), linear-gradient(var(--c) 0 0) 0 0 / var(--w) var(--l),
    linear-gradient(var(--c) 0 0) 100% 0 / var(--l) var(--w), linear-gradient(var(--c) 0 0) 100% 0 / var(--w) var(--l),
    linear-gradient(var(--c) 0 0) 0 100% / var(--l) var(--w), linear-gradient(var(--c) 0 0) 0 100% / var(--w) var(--l),
    linear-gradient(var(--c) 0 0) 100% 100% / var(--l) var(--w), linear-gradient(var(--c) 0 0) 100% 100% / var(--w) var(--l);
  background-repeat: no-repeat; filter: drop-shadow(1px 1px 0 #000a);
}

/* ---- hint and ambient pause ---- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.map-hint {
  position: absolute; z-index: 410; left: 50%; bottom: 14px; margin: 0; transform: translateX(-50%);
  font-size: 12px; color: #fff; pointer-events: none; image-rendering: auto;
  opacity: 0; transition: opacity .6s var(--ease);
}
.is-ready .map-hint { opacity: .95; }
.is-ready.has-played .map-hint { opacity: 0; transition-delay: 2.5s; }

.scene-pause {
  position: absolute; z-index: 410; right: 14px; bottom: 12px; display: grid; place-items: center;
  width: 32px; height: 32px; padding: 0; cursor: pointer; image-rendering: auto;
  border: 1px solid #c99a3e99; border-radius: 4px; color: var(--gold-light);
  background: linear-gradient(#1a2c46, #0b1d36); box-shadow: 0 2px 4px #0006, inset 0 1px 0 #ffffff1a;
}
.living-hero:not(.is-ready) .scene-pause { display: none; }
.scene-pause:hover { border-color: var(--gold); color: #fff; }
.scene-pause:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.scene-pause svg { width: 14px; height: 14px; fill: currentColor; }
.scene-pause .i-play, .is-paused .scene-pause .i-pause { display: none; }
.is-paused .scene-pause .i-play { display: block; }
.is-paused .float { animation-play-state: paused; }

@media (max-width: 700px) {
  .map-hint { left: 12px; right: 56px; transform: none; white-space: normal; text-align: left; font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  .float { animation-duration: 1ms; }
}
