/* HMVC logo – 3D hero. Loaded only on the Home Page template.
 *
 * Size rule: the hero is as wide as possible (up to --hmvc-max-w) BUT never taller than the
 * visible screen height minus a small gap. So it shrinks automatically on short screens
 * (phones turned sideways, small laptop windows) and stays full size on a normal desktop.
 * "svh" = the screen height with the browser bars showing, so nothing is hidden behind
 * Safari's toolbars on iPhone.
 *
 * Tuning knobs (all optional):
 *   --hmvc-max-w   biggest width on large screens
 *   --hmvc-gap     free space kept above and below the hero
 *   --hmvc-nudge   moves the hero down (+) or up (-)
 */
.home-logo .hmvc-logo-3d {
  --hmvc-max-w: 1000px;
  --hmvc-gap: 24px;
  --hmvc-nudge: 0px;
  --hmvc-ratio: 1.684;                         /* width / height = 16 / 9.5 */

  position: relative;
  aspect-ratio: 16 / 9.5;
  width: min(94vw, var(--hmvc-max-w), calc((100vh - var(--hmvc-gap) * 2) * var(--hmvc-ratio)));
  margin: 0 auto;
  transform: translateY(var(--hmvc-nudge));
}
@supports (height: 100svh) {
  .home-logo .hmvc-logo-3d {
    width: min(94vw, var(--hmvc-max-w), calc((100svh - var(--hmvc-gap) * 2) * var(--hmvc-ratio)));
  }
}

/* Phone held upright: nudge up a little (it looked slightly low) */
@media (max-width: 767px) and (orientation: portrait) {
  .home-logo .hmvc-logo-3d { --hmvc-nudge: -3svh; }
}

/* Phone / short screen held sideways: use almost the full height */
@media (orientation: landscape) and (max-height: 500px) {
  .home-logo .hmvc-logo-3d { --hmvc-gap: 8px; --hmvc-nudge: 0px; }
}

.hmvc-logo-3d canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  display: block;
}

/* Static logo = fallback (no WebGL / script blocked / before the 3D scene starts).
   Old fade-in motion is switched off here. */
.home-logo .hmvc-logo-3d .hmvc-logo-fallback {
  position: absolute; inset: 0;
  width: 100%; height: 100%; max-width: none;
  object-fit: contain;
  opacity: 1 !important;
  animation: none !important;
  transition: opacity .5s ease;
}
.home-logo .hmvc-logo-3d.is-3d-ready .hmvc-logo-fallback { opacity: 0 !important; }
