/* HERO GAME  prototype, 2026-12-04. The headline box lifts, nudges once, and flips over at its corner to a game. */
.hg-stage { perspective: 1800px; }
.hg-card { position: relative; transform-style: preserve-3d; transition: transform 1.05s cubic-bezier(0.16, 1, 0.3, 1); }
.hg-card.flipped { transform: rotateY(180deg); }
.hg-card > .hero-panel, .hg-back {
  -webkit-backface-visibility: hidden; backface-visibility: hidden;
  box-shadow: inset 0 0 0 1px rgba(230, 241, 247, 0.06), 0 26px 50px -26px rgba(11, 28, 49, 0.55), 0 3px 8px -2px rgba(11, 28, 49, 0.14);
}
.hg-card > .hero-panel { position: relative; }
.hg-back {
  position: absolute; inset: 0; transform: rotateY(180deg); overflow: hidden; border-radius: 3px;
  background: radial-gradient(135% 130% at 50% -15%, rgba(180, 220, 240, 0.07) 0%, rgba(0, 0, 0, 0.30) 100%), var(--espresso);
}
.hg-back canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; outline: none; touch-action: none; }

/* The nudge on load: a slow lean that says the box is an object, then it settles. */
@keyframes hg-nudge {
  0% { transform: rotateY(0) rotateX(0); }
  38% { transform: rotateY(-8deg) rotateX(2.5deg); }
  70% { transform: rotateY(2.2deg) rotateX(-0.6deg); }
  100% { transform: rotateY(0) rotateX(0); }
}
.hg-card.nudge { animation: hg-nudge 1.6s cubic-bezier(0.16, 1, 0.3, 1) both; }

/* The corner. A folded-back dog-ear, nothing printed on it. */
.hg-corner {
  position: absolute; right: 0; bottom: 0; width: 64px; height: 64px; padding: 0; border: 0; background: none; cursor: pointer; z-index: 3;
  -webkit-tap-highlight-color: transparent;
}
.hg-corner::before {
  content: ""; position: absolute; right: 0; bottom: 0; width: var(--fold, 24px); height: var(--fold, 24px);
  background: linear-gradient(to top left, var(--paper) 49.5%, #C9DCE5 50.5%);
  border-top-left-radius: 2px;
  filter: drop-shadow(-3px -3px 4px rgba(0, 0, 0, 0.32));
  transition: width 0.45s cubic-bezier(0.16, 1, 0.3, 1), height 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}
.hg-corner:hover::before, .hg-corner:focus-visible::before { --fold: 34px; }
.hg-corner:focus-visible { outline: none; }
.hg-corner:focus-visible::before { outline: 2px solid var(--gold); outline-offset: 2px; }
.hg-card.nudge .hg-front-corner::before { animation: hg-fold 1.6s cubic-bezier(0.16, 1, 0.3, 1) both; }
@keyframes hg-fold { 0% { width: 24px; height: 24px; } 40% { width: 40px; height: 40px; } 100% { width: 24px; height: 24px; } }
.hg-back .hg-corner::before { background: linear-gradient(to top left, var(--paper) 49.5%, #23354A 50.5%); }

/* The shake when a drone gets through. On the stage, so it never fights the flip. */
@keyframes hg-shake { 0%,100% { transform: translate(0,0); } 20% { transform: translate(-6px, 2px); } 40% { transform: translate(5px, -3px); } 60% { transform: translate(-3px, 2px); } 80% { transform: translate(2px, -1px); } }
.hg-stage.shake { animation: hg-shake 0.42s linear; }

/* The sound switch, bottom left of the game. Off by default. A drawn speaker, nothing printed. */
.hg-sound {
  position: absolute; left: 12px; bottom: 10px; width: 34px; height: 34px; padding: 7px; border: 0; border-radius: 50%;
  background: none; color: rgba(230, 241, 247, 0.5); cursor: pointer; z-index: 3; -webkit-tap-highlight-color: transparent;
  transition: color 0.2s ease, background-color 0.2s ease;
}
.hg-sound:hover { color: rgba(230, 241, 247, 0.9); background: rgba(230, 241, 247, 0.06); }
.hg-sound[aria-pressed="true"] { color: rgb(143, 208, 224); }
.hg-sound svg { display: block; }
.hg-sound:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }

/* The pieces that fall out of the box, in front of everything, piled at the bottom of the page. Never takes a click. */
.hg-debris { position: fixed; left: 0; top: 0; pointer-events: none; z-index: 2147483000; }

/* Sparks that leave the box. Over the whole page, never takes a click. */
.hg-sky { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 80; }

@media (prefers-reduced-motion: reduce) {
  .hg-card { transition-duration: 0.25s; }
  .hg-card.nudge, .hg-card.nudge .hg-front-corner::before { animation: none; }
}
