/* =========================================================
   Hero + shared WebGL world (piece A)
   ========================================================= */

/* ---------- The fixed world canvas (js/webgl/world.js) ---------- */
.world {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  /* static fallback / pre-WebGL backdrop: gunmetal, a studio key light, an ember low centre */
  background:
    radial-gradient(50% 40% at 50% 42%, rgba(255, 102, 0, .08), transparent 70%),
    radial-gradient(70% 60% at 22% 12%, rgba(205, 208, 212, .09), transparent 70%),
    linear-gradient(180deg, #16171a 0%, var(--gunmetal-950) 70%);
}
.world__canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; opacity: 0; transition: opacity 900ms var(--ease-out); }
.world.is-live .world__canvas { opacity: 1; }
.world.is-fallback .world__canvas { display: none; }
/* once About has covered the hero, the strip above it continues the aluminium instead of a dark band */
.world::after {
  content: ""; position: absolute; inset: 0; opacity: 0; transition: opacity 450ms var(--ease-out);
  background: var(--alu-100) url("../../assets/img/tex/brushed-light.webp") center / 512px repeat;
}
.hero-gone .world::after { opacity: 1; }
#about { transition: box-shadow 450ms var(--ease-out); }
.hero-gone #about { box-shadow: 0 -1px 0 rgba(255, 255, 255, .6); }

/* ---------- Hero shell ---------- */
.hero {
  --frame: 24px;
  /* pinned: the next section slides up over the hero like a solid panel */
  position: sticky; top: 0; z-index: 0;
  min-height: 100svh;
  transform-origin: 50% 40%;
  display: grid; grid-template-rows: 1fr auto;
  padding: calc(var(--frame) + 84px) 0 0;
  color: var(--ink-on-dark);
  overflow: clip;
}
.hero__shade {
  position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(55% 60% at 22% 52%, rgba(14, 15, 17, .55), transparent 72%),
    linear-gradient(180deg, rgba(14, 15, 17, .3) 0%, transparent 20%);
}

/* ---------- Asymmetric split: type left, the logo object right ---------- */
.hero__grid {
  /* the shared content grid: type aligns with every section's left edge (x=130 at 1440) */
  width: 100%; max-width: calc(var(--maxw) + var(--side) * 2); margin-inline: auto; padding-inline: var(--side);
  display: grid; grid-template-columns: minmax(0, 46fr) minmax(0, 54fr);
  align-items: center; column-gap: clamp(80px, 5.6vw, 96px);
}
.hero__content { position: relative; z-index: 2; will-change: transform; container-type: inline-size; }
/* the 3D logo is projected into this box by world.js; keep the logo's aspect (1035 × 624) */
.hero__stage {
  position: relative; aspect-ratio: 1035 / 624; max-height: 66vh; justify-self: start;
  /* bleeds past the 1180 grid into the right margin on wide screens, always keeping var(--side) clear */
  width: min(calc(100% + max(0px, (100vw - var(--maxw) - 2 * var(--side)) / 2)), 900px);
}
.hero__stage-fallback { display: none; position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 24px 40px rgba(0, 0, 0, .55)); }
.world-fallback .hero__stage-fallback { display: block; }

.hero__title { font-size: min(var(--fs-h1), 17.2cqi); margin: 0 0 clamp(20px, 2.4vw, 32px); font-weight: 500; letter-spacing: -0.045em; line-height: .98; text-wrap: balance; }
.hero__title em { font-style: italic; font-weight: 400; }
.hero__line-mask { display: block; overflow: hidden; padding: 0 .06em .1em 0; margin-bottom: -.1em; }
.hero__line {
  display: block; white-space: nowrap;
  transform: translateY(112%);
  transition: transform 1100ms var(--ease-out);
  transition-delay: calc(var(--intro-t, 1400ms) + var(--l) * 100ms);
}
.hero.is-in .hero__line { transform: none; }

.hero__lede { text-wrap: balance; color: var(--muted-on-dark); font-size: clamp(16px, 1.2vw, 19px); line-height: 1.5; margin-bottom: clamp(28px, 3vw, 40px); max-width: 26em; }
.hero__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 32px; }
.hero__phone { font-family: var(--font-mono); font-size: 14px; letter-spacing: .18em; text-transform: uppercase; color: var(--ink-on-dark); min-height: 44px; padding-bottom: 6px; align-items: flex-end; }
.hero .btn { min-height: 54px; }

.hero-in { opacity: 0; transform: translateY(18px); transition: opacity 900ms var(--ease-out), transform 1000ms var(--ease-out); transition-delay: calc(var(--intro-t, 1400ms) + 200ms + var(--d) * 110ms); }
.hero.is-in .hero-in { opacity: 1; transform: none; }
.hero.is-in .hero__strip { opacity: var(--chrome, 1); }

/* dims as it is covered (driven by --cover from js/sections/hero.js) */
.hero::after {
  content: ""; position: absolute; inset: 0; z-index: 5; pointer-events: none;
  background: #050506; opacity: var(--cover, 0);
}
.hero.is-covered { opacity: 0; pointer-events: none; } /* stays in the accessibility tree (h1) */
/* the section after the hero rides over it, casting a soft shadow up onto it */
#about { position: relative; z-index: 2; margin-top: -8svh; box-shadow: 0 -30px 60px rgba(0, 0, 0, .45); }
.hero { padding-bottom: 8svh; }

/* ---------- Bottom strip ---------- */
.hero__strip {
  position: relative; z-index: 3;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  height: 64px; width: 100%; max-width: calc(var(--maxw) + var(--side) * 2); margin-inline: auto; padding-inline: var(--side);
  font-family: var(--font-mono); font-size: var(--fs-eyebrow); letter-spacing: .18em; text-transform: uppercase; font-weight: 500; color: var(--muted-on-dark);
}
.hero__strip-r { justify-self: end; text-align: right; }
.hero__strip-c { display: inline-flex; align-items: center; gap: 12px; min-height: 44px; color: var(--ink-on-dark); }
.hero.is-in .hero__strip-c { transition: opacity 900ms var(--ease-out), transform 1000ms var(--ease-out), color var(--dur-hover) var(--ease-out); transition-delay: calc(var(--intro-t, 1400ms) + 160ms + var(--d) * 110ms), calc(var(--intro-t, 1400ms) + 160ms + var(--d) * 110ms), 0ms; }
.hero__strip-c:hover { color: var(--ember-400); }
.hero__scrollcue { position: relative; width: 1px; height: 22px; background: var(--rule-dark); overflow: hidden; }
.hero__scrollcue i { position: absolute; left: 0; top: 0; width: 1px; height: 9px; background: var(--alu-400); animation: hero-cue 2.2s var(--ease-inout) infinite; }
@keyframes hero-cue { 0% { transform: translateY(-10px); } 60%, 100% { transform: translateY(24px); } }

/* ---------- Intro curtain ---------- */
.hero-loader {
  position: fixed; inset: 0; z-index: 800;
  display: grid; place-items: center; align-content: center; gap: 28px;
  background: var(--gunmetal-950) url("../../assets/img/tex/brushed-dark.webp") center / 1024px repeat;
  clip-path: inset(0 0 0 0);
  transition: clip-path 900ms var(--ease-inout);
  animation: hero-loader-failsafe 600ms linear 5s forwards;
}
.hero-loader__mark { width: 132px; height: auto; overflow: visible; }
.hero-loader__mark path, .hero-loader__mark circle { stroke: var(--ember-500); stroke-width: 2.2; }
.hero-loader__mark .hm-cloud { stroke: var(--alu-200); stroke-dasharray: 1 1; stroke-dashoffset: 1; animation: hm-draw 800ms var(--ease-inout) 60ms forwards; }
.hero-loader__mark .hm-trace { stroke-dasharray: 1 1; stroke-dashoffset: 1; animation: hm-draw 560ms var(--ease-out) forwards; animation-delay: calc(300ms + var(--i) * 80ms); filter: drop-shadow(0 0 3px rgba(255, 102, 0, .7)); }
.hero-loader__mark .hm-node { opacity: 0; transform-box: fill-box; transform-origin: center; transform: scale(.2); animation: hm-node 480ms var(--ease-out) forwards; animation-delay: calc(620ms + var(--i) * 60ms); filter: drop-shadow(0 0 4px rgba(255, 102, 0, .85)); }
.hero-loader__mark .hm-dot { fill: var(--ember-500); stroke: none; }
.hero-loader__label { display: flex; align-items: center; gap: 10px; font-family: var(--font-mono); font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--muted-on-dark); }
.hero-loader__count { color: var(--ink-on-dark); font-variant-numeric: tabular-nums; min-width: 3ch; }
@keyframes hm-draw { to { stroke-dashoffset: 0; } }
@keyframes hm-node { to { opacity: 1; transform: none; } }
@keyframes hero-loader-failsafe { to { opacity: 0; visibility: hidden; } }
.hero-loader.is-out { clip-path: inset(0 0 100% 0); }
.hero-loader.is-gone { display: none; }
@keyframes hero-failsafe { to { opacity: 1; transform: none; } }
html:not(.hero-js) .hero__line, html:not(.hero-js) .hero-in { animation: hero-failsafe 1ms linear 5.1s forwards; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .hero__grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 80px; }
}
@media (max-width: 820px) {
  .hero { --frame: 16px; padding: 92px 0 8svh; }
  .hero__grid { grid-template-columns: 1fr; row-gap: 48px; align-content: center; }
  .hero__stage { order: -1; width: min(calc(100vw - 2 * var(--side) - 24px), 520px); justify-self: center; max-height: none; }
  .hero__lede { font-size: 16px; }
  .hero__actions { gap: 8px 24px; }
  .hero__strip { grid-template-columns: 1fr 1fr; height: 56px; }
  .hero__strip-c { display: none; }
  .hero-loader__mark { width: 104px; }
}
@media (max-width: 520px) {
  .hero__long { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .hero__line, .hero-in { opacity: 1 !important; transform: none !important; }
  .hero-loader { display: none; }
  .hero__scrollcue i { animation: none; transform: translateY(6px); }
}
.hero__strip { margin-bottom: var(--frame); }

/* No-WebGL fallback: the recorded loop of the same scene. Its black ground screens away into the hero;
   scaled so the cloud fills the stage the way the live 3D logo does. */
.hero__stage-fallback { overflow: visible; filter: none; object-fit: unset; }
.hero__fallback-loop { position: absolute; left: 50%; top: 50%; width: 172%; height: auto; max-width: none; transform: translate(-50%, -46%); mix-blend-mode: screen; }
/* in fallback the stage shows the recorded loop on pure black, so the backdrop goes black to match it */
.world.is-fallback { background: #000; }
.hero__fallback-loop { mix-blend-mode: normal; }
