/* Ember, live on the homepage (read with forgeos-ember-home.js; the 3D body is
   forgeos-ember-3d.js, the face forgeos-guide.js, the look forgeos-ember-studio.js).

   Owner, 2026-10-19: "Ember should be better than Muse with looks and design.
   This page should be interactive/3D." The band's still picture becomes the
   real Ember: lit in 3D, following the pointer, showing its moods on a press,
   and opening its studio on a tap. The still stays as the fallback wherever
   the 3D body is not drawn (no WebGL, Save-Data, a low-power device). */

.em-stage { position: relative; margin: 0; display: grid; justify-items: center; gap: 14px; perspective: 1100px; }
.em-scene {
  position: relative; width: min(100%, 440px); aspect-ratio: 1; display: grid; place-items: center;
  isolation: isolate; transform-style: preserve-3d;
}
/* The light Ember throws: a warm bloom, a slow ring of light, and the floor it stands over. */
.em-scene::before {
  content: ""; position: absolute; inset: 6%; border-radius: 50%; z-index: -2;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--ember-flame-b, #ff6a1f) 42%, transparent), transparent 72%);
  filter: blur(18px); animation: em-bloom 6s ease-in-out infinite;
}
.em-scene::after {
  content: ""; position: absolute; left: 18%; right: 18%; bottom: 7%; height: 9%; z-index: -1; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 130, 50, .45), rgba(255, 90, 20, .12) 60%, transparent);
  filter: blur(4px);
}
.em-ring {
  position: absolute; inset: 12%; z-index: -1; border-radius: 50%; pointer-events: none;
  border: 1px solid color-mix(in srgb, var(--ember-flame-a, #ffe9a8) 30%, transparent);
  box-shadow: 0 0 18px -2px color-mix(in srgb, var(--ember-flame-b, #ff6a1f) 45%, transparent);
  transform: rotateX(72deg) translateZ(-40px); animation: em-orbit 14s linear infinite;
}
.em-ring::before {
  content: ""; position: absolute; top: -4px; left: 50%; width: 8px; height: 8px; margin-left: -4px; border-radius: 50%;
  background: var(--ember-flame-a, #ffe9a8); box-shadow: 0 0 12px 3px var(--ember-flame-b, #ff6a1f);
}
.em-face { position: relative; display: grid; place-items: center; border-radius: 50%; cursor: pointer; }
.em-face .fg-face { width: clamp(150px, 26vw, 230px); height: clamp(150px, 26vw, 230px); }
.em-face:focus-visible { outline: 2px solid #ffb877; outline-offset: 10px; }
/* The still picture until the live body is drawn, and wherever it cannot be. */
.em-still { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; z-index: 0; pointer-events: none;
  -webkit-mask-image: radial-gradient(closest-side, #000 72%, transparent); mask-image: radial-gradient(closest-side, #000 72%, transparent);
  transition: opacity .5s ease; }
.em-scene .em-face { opacity: 0; transition: opacity .5s ease; }
.em-stage[data-live="1"] .em-face { opacity: 1; }
.em-stage[data-live="1"] .em-still { opacity: 0; }
/* The face alone (no 3D here) is still Ember; it sits over the picture's glow. */
.em-stage[data-live="face"] .em-still { opacity: 0; }
.em-stage[data-live="face"] .em-face { opacity: 1; }

.em-moods { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 0; padding: 0; }
.em-moods[hidden] { display: none; }
.em-mood {
  font: inherit; font-size: var(--m19-text-base); line-height: 1; padding: 9px 14px; border-radius: var(--m19-radius-pill); cursor: pointer;
  color: var(--n-ink); background: color-mix(in srgb, #fff 7%, transparent);
  border: 1px solid color-mix(in srgb, #fff 16%, transparent);
  transition: background .2s ease, border-color .2s ease, transform .2s ease;
}
.em-mood:hover { background: color-mix(in srgb, #fff 13%, transparent); transform: translateY(-1px); }
.em-mood[aria-pressed="true"] {
  background: linear-gradient(180deg, #fff6ee, #f6e1d2); color: #1d0f09; border-color: transparent;
  box-shadow: 0 8px 22px -10px rgba(255, 110, 40, .7);
}
.em-mood:focus-visible { outline: 2px solid #ffb877; outline-offset: 3px; }
.em-hint { margin: 0; text-align: center; font-size: var(--m19-text-sm); color: var(--n-ink-3); }
.em-hint a { color: #ffd2a6; }

@keyframes em-bloom { 0%, 100% { opacity: .8; transform: scale(1); } 50% { opacity: 1; transform: scale(1.06); } }
@keyframes em-orbit { to { transform: rotateX(72deg) translateZ(-40px) rotateZ(360deg); } }

@media (max-width: 900px) { .em-scene { width: min(100%, 320px); } }
@media (prefers-reduced-motion: reduce) {
  .em-scene::before, .em-ring { animation: none; }
  .em-mood, .em-still, .em-scene .em-face { transition: none; }
}
