/* Nine Worlds Apart — cinematic home hero (WebGL scene + rune circle).
   Layout values --cx, --cy (centre) and --R (ring radius) are set by js/hero-gl.js,
   so the canvases and the DOM circle always line up. */

.nwa-hero {
  --cx: 50%;
  --cy: 50%;
  --R: min(44vh, 47vw);
  position: relative;
  isolation: isolate;
  height: 80svh;
  min-height: 540px;
  /* The scene runs up behind the see-through menu bar */
  margin-top: calc(-1 * var(--header));
  overflow: visible;
}
/* The section after the hero sits above the scene's fade-out */
.nwa-hero + .wrap { position: relative; z-index: 1; }

.nwa-hero canvas {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: calc(100% + var(--ext, 45vh));
  display: block;
  pointer-events: none;
}
.hg-back { z-index: 0; }
.hg-front { z-index: 2; }

/* The ancient rune circle, between the smoke layers */
.hg-ring {
  position: absolute;
  z-index: 1;
  left: var(--cx);
  top: var(--cy);
  width: calc(var(--R) * 2 / 0.97);
  height: calc(var(--R) * 2 / 0.97);
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.hg-ring img {
  width: 100%;
  height: 100%;
  display: block;
  opacity: 0.72;
  filter: brightness(0.82) saturate(0.85);
  animation: hg-turn 480s linear var(--ring-t, 0s) infinite;
}
.hg-eclipse {
  position: absolute;
  inset: 22.8%;
  border-radius: 50%;
  background: conic-gradient(from 200deg, #9ec0ff, #e7eef8 18%, #f3d7b0 40%, #e39a4a 55%, #b86a28 66%, rgba(158, 192, 255, 0.55) 85%, #9ec0ff);
  -webkit-mask: radial-gradient(closest-side, transparent 93%, #000 95%, #000 98%, transparent 100%);
  mask: radial-gradient(closest-side, transparent 93%, #000 95%, #000 98%, transparent 100%);
  filter: drop-shadow(0 0 6px rgba(227, 154, 74, 0.5)) drop-shadow(0 0 16px rgba(158, 192, 255, 0.25));
}
@keyframes hg-turn { to { transform: rotate(360deg); } }

/* Title, tagline and button, centred in the portal */
.hg-content { position: absolute; inset: 0; z-index: 3; }

.hg-title {
  position: absolute;
  left: 50%;
  top: var(--cy);
  transform: translate(-50%, -50%);
  margin: 0;
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(1.9rem, 6vw, 5.4rem);
  line-height: 1.04;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  text-align: center;
  color: #f4f7fc;
}
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .hg-title span {
    background: linear-gradient(185deg, #ffffff 12%, #e2e9f5 52%, #a8bad6 94%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
  }
}
.hg-title { filter: drop-shadow(0 0 22px rgba(3, 5, 14, 0.9)) drop-shadow(0 2px 2px rgba(3, 5, 14, 0.6)); }

.hg-tag {
  position: absolute;
  left: 50%;
  top: calc(var(--cy) + var(--R) * 0.2);
  transform: translateX(-50%);
  margin: 0;
  width: max-content;
  max-width: 90vw;
  text-align: center;
  font-size: clamp(1.05rem, 2vw, 1.45rem);
  letter-spacing: 0.02em;
  color: #dde5f2;
  text-shadow: 0 0 16px rgba(3, 5, 14, 0.95), 0 0 4px rgba(3, 5, 14, 0.9);
}
.hg-cta {
  position: absolute;
  left: 50%;
  top: calc(var(--cy) + var(--R) * 0.2 + 2.7rem);
  min-height: 40px;
  transform: translateX(-50%);
  min-width: 11rem;
}

/* Phones: two-line title, tagline and button below the circle */
@media (max-width: 640px) {
  .hg-title { font-size: clamp(1.7rem, 8.6vw, 3rem); white-space: normal; }
  .hg-title span { white-space: nowrap; }
  .hg-title span:first-child { display: block; }
  .hg-tag { top: calc(var(--cy) + var(--R) + 1.6rem); }
  .hg-cta { top: calc(var(--cy) + var(--R) + 4.4rem); }
}

/* Without WebGL: the sky as a still image */
.hg-nogl { background: #050814 url("../images/sky.jpg") center / cover no-repeat; overflow: hidden; }
.hg-nogl::after { content: ""; position: absolute; inset: 0; z-index: 0; background: radial-gradient(ellipse 75% 70% at 50% 48%, rgba(5, 8, 20, 0.2), rgba(3, 5, 14, 0.85)); }

/* ---------------- the opening ---------------- */
.nwa-hero:not(.hg-ready) .hg-ring,
.nwa-hero:not(.hg-ready) .hg-title,
.nwa-hero:not(.hg-ready) .hg-tag,
.nwa-hero:not(.hg-ready) .hg-cta { opacity: 0; }
/* Safety net: show everything after 4s even if the script never runs */
.nwa-hero:not(.hg-ready) :is(.hg-ring, .hg-title, .hg-tag, .hg-cta) { animation: hg-failsafe 0.6s 4s forwards; }
@keyframes hg-failsafe { to { opacity: 1; } }

.hg-play .hg-back { animation: hg-fade 2.6s ease-out both; }
.hg-play .hg-ring { animation: hg-ring-in 2.8s 0.4s cubic-bezier(0.16, 0.8, 0.2, 1) both; }
.hg-play .hg-eclipse { animation: hg-ignite 2.2s 1.3s ease-out both; }
.hg-play .hg-title { animation: hg-title-in 2.2s 1.1s cubic-bezier(0.16, 0.8, 0.2, 1) both; }
.hg-play .hg-tag { animation: hg-rise 1.3s 2.7s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.hg-play .hg-cta { animation: hg-rise 1.3s 3.1s cubic-bezier(0.2, 0.8, 0.2, 1) both; }

@keyframes hg-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes hg-ring-in {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.82) rotate(-30deg); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(0); }
}
@keyframes hg-ignite {
  0% { opacity: 0; transform: scale(0.8); }
  45% { opacity: 1; transform: scale(1.05); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes hg-title-in {
  from { opacity: 0; letter-spacing: 0.16em; filter: blur(12px) drop-shadow(0 0 22px rgba(3, 5, 14, 0.9)); }
  to { opacity: 1; letter-spacing: 0.08em; filter: blur(0) drop-shadow(0 0 22px rgba(3, 5, 14, 0.9)) drop-shadow(0 2px 2px rgba(3, 5, 14, 0.6)); }
}
@keyframes hg-rise {
  from { opacity: 0; transform: translate(-50%, 14px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .hg-ring img { animation: none; }
}

/* Home: the menu bar is see-through over the scene, solid once you scroll */
.header-over .site-header {
  background: linear-gradient(to bottom, rgba(3, 5, 14, 0.55), rgba(3, 5, 14, 0)) border-box no-repeat;
  /* No border at all (a transparent one let the fade repeat as a 1px dark line) */
  border-bottom: 0;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  transition: background 0.4s ease, box-shadow 0.4s ease;
}
.header-over.is-scrolled .site-header {
  background: rgba(5, 8, 20, 0.82);
  box-shadow: inset 0 -1px 0 var(--line), 0 10px 40px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

/* Home: the large, fine-line rune circle (as on the inner pages), its top just under the
   menu bar, fading out towards the bottom of the hero */
.hg-ring {
  left: 50%;
  top: calc(var(--header) + 0.6rem);
  width: min(96rem, 175vw);
  height: auto;
  aspect-ratio: 1;
  transform: translateX(-50%);
  -webkit-mask-image: linear-gradient(to bottom, #000 16%, rgba(0, 0, 0, 0.35) 34%, transparent 52%);
  mask-image: linear-gradient(to bottom, #000 16%, rgba(0, 0, 0, 0.35) 34%, transparent 52%);
}
.hg-ring img { opacity: 0.6; filter: brightness(0.94) saturate(1.1) contrast(1.04); }
.hg-play .hg-ring { animation: hg-ring-in-big 2.8s 0.4s cubic-bezier(0.16, 0.8, 0.2, 1) both; }
@keyframes hg-ring-in-big {
  from { opacity: 0; transform: translateX(-50%) scale(0.92); }
  to { opacity: 1; transform: translateX(-50%) scale(1); }
}

/* Home: a little shorter, so The Four Paths comes in sooner */
.nwa-hero { height: 76svh; min-height: 540px; }
.nwa-hero + .wrap > .block:first-child { margin-top: 0.5rem; }

/* Tagline and Contact a little further below the title */
.hg-tag { top: calc(var(--cy) + clamp(5rem, 12vh, 7.5rem)); }
.hg-cta { top: calc(var(--cy) + clamp(5rem, 12vh, 7.5rem) + 3rem); }

/* The title stands out: a dark haze behind it and a faint cool glow on the letters */
.hg-title::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -0.55em -0.3em;
  border-radius: 50%;
  background: radial-gradient(ellipse closest-side, rgba(2, 3, 9, 0.78), rgba(2, 3, 9, 0.4) 60%, transparent);
  filter: blur(10px);
}
.hg-title { isolation: isolate; filter: drop-shadow(0 0 14px rgba(190, 210, 240, 0.22)) drop-shadow(0 0 26px rgba(2, 3, 9, 0.95)) drop-shadow(0 2px 2px rgba(2, 3, 9, 0.7)); }
@media (max-width: 640px) {
  .hg-tag { top: calc(var(--cy) + var(--R) * 0.55); }
  .hg-cta { top: calc(var(--cy) + var(--R) * 0.55 + 2.8rem); }
}

/* Home title: a subtler dark haze behind it */
.hg-title::before {
  inset: -0.4em -0.15em;
  background: radial-gradient(ellipse closest-side, rgba(2, 3, 9, 0.42), rgba(2, 3, 9, 0.18) 60%, transparent);
  filter: blur(14px);
}
.hg-title { filter: drop-shadow(0 0 12px rgba(190, 210, 240, 0.16)) drop-shadow(0 0 18px rgba(2, 3, 9, 0.7)) drop-shadow(0 2px 2px rgba(2, 3, 9, 0.6)); }

/* Home title: a faint bronze-and-silver flare line beneath it, and a whisper of bronze glow */
.hg-title::after {
  content: "";
  position: absolute;
  z-index: -1;
  left: 50%;
  top: calc(100% + 0.06em);
  width: 128%;
  height: 1px;
  transform: translateX(-50%);
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(143, 163, 191, 0.25) 10%,
    rgba(185, 177, 154, 0.55) 30%,
    rgba(222, 182, 122, 0.9) 50%,
    rgba(185, 177, 154, 0.55) 70%,
    rgba(143, 163, 191, 0.25) 90%,
    transparent 100%);
  box-shadow: 0 0 10px rgba(201, 150, 90, 0.35);
  pointer-events: none;
}
.hg-title {
  filter:
    drop-shadow(0 0 10px rgba(200, 150, 92, 0.16))
    drop-shadow(0 0 18px rgba(2, 3, 9, 0.7))
    drop-shadow(0 2px 2px rgba(2, 3, 9, 0.6));
}
.hg-play .hg-title::after { animation: hg-flare-in 2.4s 2s cubic-bezier(0.16, 0.8, 0.2, 1) both, hg-flare-breathe 9s 4.4s ease-in-out infinite alternate; }
@keyframes hg-flare-in { from { opacity: 0; transform: translateX(-50%) scaleX(0); } to { opacity: 1; transform: translateX(-50%) scaleX(1); } }
@keyframes hg-flare-breathe { from { opacity: 1; } to { opacity: 0.65; } }
@media (max-width: 640px) { .hg-title::after { width: 110%; } }
@media (prefers-reduced-motion: reduce) { .hg-title::after { animation: none; } }

/* Flare, softer: a wide, hazy band of light instead of a hard line, with a soft bloom at its centre */
.hg-title::after {
  top: calc(100% + 0.04em);
  width: 140%;
  height: 0.5em;
  transform: translate(-50%, -50%);
  box-shadow: none;
  background:
    radial-gradient(ellipse 14% 50% at 50% 50%, rgba(255, 226, 186, 0.42), rgba(222, 170, 104, 0.16) 55%, transparent 100%),
    radial-gradient(ellipse 50% 22% at 50% 50%, rgba(214, 172, 114, 0.38), rgba(185, 177, 154, 0.14) 60%, transparent 100%),
    radial-gradient(ellipse 50% 9% at 50% 50%, rgba(230, 210, 176, 0.5), rgba(143, 163, 191, 0.12) 70%, transparent 100%);
  filter: blur(1.5px);
}
@keyframes hg-flare-in { from { opacity: 0; transform: translate(-50%, -50%) scaleX(0.2); } to { opacity: 1; transform: translate(-50%, -50%) scaleX(1); } }

/* Flare: a touch lower, with a little more room under the letters */
.hg-title::after { top: calc(100% + 0.2em); }

/* Flare: a gentler centre; the outer band is unchanged */
.hg-title::after {
  background:
    radial-gradient(ellipse 14% 50% at 50% 50%, rgba(255, 226, 186, 0.2), rgba(222, 170, 104, 0.08) 55%, transparent 100%),
    radial-gradient(ellipse 50% 22% at 50% 50%, rgba(214, 172, 114, 0.38), rgba(185, 177, 154, 0.14) 60%, transparent 100%),
    radial-gradient(ellipse 50% 9% at 50% 50%, rgba(230, 210, 176, 0.5), rgba(143, 163, 191, 0.12) 70%, transparent 100%);
}

/* Rune circle a little higher on the home page */
.hg-ring { top: calc(var(--header) - 3rem); }

/* Home title: its top edge at the same height as the title on Music, Mixing, Learn and Apps,
   on any screen size (a fixed distance from the top, like those pages) */
@media (min-width: 641px) {
  .nwa-hero { --tt: calc(var(--header) + 11.5rem + 2.95rem); }
  .hg-title { top: var(--tt); transform: translateX(-50%); }
  .hg-tag { top: calc(var(--tt) + clamp(8.5rem, 16vh, 10.5rem)); }
  .hg-cta { top: calc(var(--tt) + clamp(8.5rem, 16vh, 10.5rem) + 3rem); }
  /* The Four Paths start a set distance below Contact: closer than before, but still with
     more room than the inner pages leave under their titles */
  .nwa-hero { height: calc(var(--tt) + clamp(8.5rem, 16vh, 10.5rem) + 3rem + 2.6rem + 6.5rem); min-height: 0; }
}

/* The tagline as a page label above the title, in the same bronze lettering and fine
   rules as "Trailer music", "Mixing" and "Learn" on the other pages */
.nwa-hero .hg-tag {
  display: flex;
  font-family: var(--sans);
  font-weight: 500;
  text-transform: uppercase;
  line-height: 1.4;
  font-size: clamp(0.98rem, 2.5vw, 1.5rem);
  letter-spacing: 0.22em;
  white-space: nowrap;
  color: #c6a36c;
  text-shadow: none;
}
.nwa-hero .hg-tag::before,
.nwa-hero .hg-tag::after { width: clamp(1.5rem, 5vw, 3rem); }
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .nwa-hero .hg-tag {
    background-image: var(--bronze);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-mask: url("../images/wear-heavy.png?v=1") 0 0 / 220px 220px;
    mask: url("../images/wear-heavy.png?v=1") 0 0 / 220px 220px;
    filter: drop-shadow(0 1px 0 rgba(3, 5, 14, 0.9));
  }
}
.hg-play .hg-tag { animation: hg-fade 1.6s 1.3s ease-out both; }
@media (min-width: 641px) {
  .hg-tag { top: calc(var(--tt) - 3rem); }
  /* Contact moves up into the tagline's old place; the gap to The Four Paths stays the same */
  .hg-cta { top: calc(var(--tt) + clamp(8.5rem, 16vh, 10.5rem)); }
  .nwa-hero { height: calc(var(--tt) + clamp(8.5rem, 16vh, 10.5rem) + 2.6rem + 6.5rem); }
}
@media (max-width: 640px) {
  .hg-tag { top: calc(var(--cy) - 4.4rem); }
  .hg-cta { top: calc(var(--cy) + var(--R) * 0.55); }
}

/* Phones: the title as wide as the "The sound that lies beyond" label above it */
@media (max-width: 640px) {
  .hg-title { font-size: clamp(2rem, 10.6vw, 3.3rem); }
}

/* Phones: a fixed distance from the top (like the other pages), so every page's title
   sits at the same height on every phone, whatever its screen height */
@media (max-width: 640px) {
  .hg-tag { top: 9.6rem; }
  .hg-title { top: 11.35rem; transform: translateX(-50%); }
  .hg-cta { top: 20.1rem; }
  .nwa-hero { height: auto; min-height: 0; aspect-ratio: auto; }
  .nwa-hero { height: 31rem; }
}
@media (max-width: 640px) {
  /* A fraction lower (1rem), keeping every page level */
  .hg-tag { top: 10.6rem; }
  .hg-title { top: 12.35rem; }
  .hg-cta { top: 21.1rem; }
  .nwa-hero { height: 32rem; }
}
