.hero-card {
  position: relative;
  z-index: 0;
  width: 55%;
  aspect-ratio: 120 / 128;
  perspective: 52rem;
  transform-style: preserve-3d;
}

.hero-card-turn {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
}

.hero-card-front,
.hero-card-back {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.hero-card-front #hero-mark {
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: fill;
}

.hero-card-back { transform: rotateY(180deg); }

.hero-portrait-frame {
  --portrait-hexagon: polygon(50% 0%, 100% 25.16%, 100% 74.84%, 50% 100%, 0 74.84%, 0 25.16%);
  position: absolute;
  top: 50%;
  left: 50%;
  /* Match the 276 × 318 outer outline in the hero guide SVG. */
  width: calc(100% * 276 / 242);
  aspect-ratio: 276 / 318;
  transform: translate(-50%, -50%);
  clip-path: var(--portrait-hexagon);
  background: color-mix(in srgb, var(--gold) 48%, var(--line));
}

.hero-portrait {
  position: absolute;
  inset: 1.5px;
  width: calc(100% - 3px);
  height: calc(100% - 3px);
  clip-path: var(--portrait-hexagon);
  object-fit: cover;
}

.hero-card.is-playing .hero-card-turn {
  animation: portrait-flip 1.85s cubic-bezier(.55, .03, .2, 1) both;
}

@keyframes portrait-flip {
  0%, 100% { transform: rotateY(0deg); }
  23%, 77% { transform: rotateY(180deg); }
}

.hero-card-trigger {
  position: absolute;
  z-index: 3;
  inset: -.55rem;
  display: block;
  min-width: 100%;
  min-height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: .75rem;
  background: transparent;
  color: transparent;
  cursor: pointer;
}

.hero-card-trigger:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 4px;
}

.hero-card-trigger[aria-disabled="true"] { cursor: default; }

@media (prefers-reduced-motion: reduce) {
  .hero-card.is-static-photo .hero-card-front { visibility: hidden; }
  .hero-card.is-static-photo .hero-card-back { transform: none; }
}
