/* ==========================================================================
   HERO 3D — "Blueprint to skyline". The WebGL canvas is the ground; this
   file styles everything laid over it: the opening gold line, the wordmark,
   the brand block, the scroll cue, the shade, and the still-image fallback.
   Driven by classes js/hero-3d.js sets on .h3d:
     is-playing  the intro has started (draws the line)
     is-ready    the 3D scene fades in, the line dissolves into it
     is-revealed the brand block arrives
     is-settled  the scroll cue arrives
   and by .is-held, which anim-videodive.js sets on .s-hero for as long as
   the dive plays over it.
   ========================================================================== */

.h3d {
  position: relative;
  height: 100vh;
  height: 100svh;
  min-height: 560px;
  overflow: hidden;
  isolation: isolate;
  background: radial-gradient(120% 80% at 50% 70%, #0f2740 0%, #071324 55%, #040d18 100%);
  color: var(--c-ivory);
}

.h3d__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  opacity: 0;
  transition: opacity 1.4s var(--ease-css);
}
.h3d.is-ready .h3d__canvas { opacity: 1; }

/* Shade: legibility for the header above and the copy below, so the picture
   itself never has to be dimmed. */
.h3d__shade {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(to bottom, rgb(var(--scrim) / .55), transparent 22%),
    linear-gradient(to top, rgb(var(--scrim) / .7), transparent 26%);
}

/* Held while the dive plays: the scene stays put under the gold line, the
   same way the still hero used to. The section box keeps its place in the
   flow, so the document height does not change. */
.s-hero.is-held .h3d__canvas,
.s-hero.is-held .h3d__shade {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100vh;
}

.s-hero.is-held .h3d__inner {
  position: fixed;
  inset-block: 0;
  inset-inline-start: 50%;
  translate: -50% 0;
  width: var(--container);
  height: 100vh;
}

/* --- the opening line ---------------------------------------------------- */
.h3d__horizon {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  width: min(56vw, 760px);
  height: 1px;
  translate: -50% -50%;
  background: linear-gradient(90deg, transparent, var(--c-gold) 18%, #f3dfae 50%, var(--c-gold) 82%, transparent);
  box-shadow: 0 0 18px rgb(208 173 103 / .55);
  transform: scaleX(0);
  opacity: 1;
  transition: opacity .9s var(--ease-css) .1s;
  pointer-events: none;
}
.h3d.is-playing .h3d__horizon { animation: h3d-line 1.1s cubic-bezier(.65, 0, .35, 1) forwards; }
.h3d.is-ready   .h3d__horizon { opacity: 0; }

@keyframes h3d-line {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

/* --- overlay ------------------------------------------------------------- */
.h3d__inner {
  position: relative;
  z-index: 3;
  height: 100%;
  display: grid;
  grid-template-rows: 1fr auto;
  pointer-events: none;
}

/* The brand block: wordmark, the slogan, a gold rule, where we build, and the call.
   Left-aligned and vertically centred on wide screens, with the site drawn
   to the right of it; centred over the sky on narrow ones. */
.h3d__brand {
  align-self: center;
  justify-self: start;
  margin-block-start: 4vh;
  display: grid;
  justify-items: start;
  gap: var(--sp-md);
  max-width: 560px;
}

.h3d__brand > :not(.h3d__wordmark) {
  opacity: 0;
  translate: 0 14px;
  transition: opacity .9s var(--ease-css), translate .9s var(--ease-css);
}
.h3d.is-revealed .h3d__brand > :not(.h3d__wordmark) { opacity: 1; translate: 0 0; }
.h3d.is-revealed .h3d__rule   { transition-delay: .35s; }
.h3d.is-revealed .h3d__places { transition-delay: .5s; }
.h3d.is-revealed .h3d__cta    { transition-delay: .65s; }

.h3d__rule {
  width: 64px;
  height: 1px;
  background: var(--c-gold);
}

/* The logo file carries ~13% clear space on each side; on the left-aligned
   layout that is pulled back so the letters line up with the copy below. */
.h3d__wordmark {
  --wm-w: clamp(240px, 30vw, 520px);
  width: var(--wm-w);
  margin-inline-start: calc(var(--wm-w) * -0.134);
  height: auto;
  opacity: 0;
  translate: 0 18px;
  filter: blur(14px);
  clip-path: inset(0 0 100% 0);
  transition: opacity 1.2s var(--ease-css), translate 1.4s var(--ease-css),
              filter 1.4s var(--ease-css), clip-path 1.3s var(--ease-css);
}
.h3d.is-revealed .h3d__wordmark { opacity: 1; translate: 0 0; filter: blur(0); clip-path: inset(0 0 -10% 0); }

/* The slogan, "Building Trust, Shaping Tomorrow": set like the site's headings
   (ivory, then gold italic) in two lines that sit under the wordmark as one
   lockup. Each line rises out of its own clip right behind the wordmark; once
   it has arrived a sheen crosses the gold line, and again every few seconds. */
.h3d__brand > .h3d__slogan { opacity: 1; translate: none; }   /* its lines arrive on their own */
.h3d__slogan {
  display: grid;
  margin-block-start: calc(var(--sp-md) * -.3);
  font-family: var(--font-display);
  font-size: clamp(26px, 2.3vw, 40px);
  font-weight: var(--fw-medium);
  line-height: 1.06;
  letter-spacing: -.005em;
  color: var(--c-ivory);
  text-shadow: 0 1px 3px rgb(4 13 24 / .55), 0 2px 18px rgb(4 13 24 / .7);   /* clear over lit windows */
}
.h3d__sl { display: block; }
/* each line rises as it is unveiled top-down (as the wordmark is); the open clip
   reaches past the line so the glow is never cut */
.h3d__sl > * {
  display: inline-block;
  opacity: 0;
  translate: 0 .55em;
  clip-path: inset(0 0 100% 0);
  transition: opacity .9s var(--ease-css), translate 1.2s cubic-bezier(.2, .75, .2, 1),
              clip-path 1.2s cubic-bezier(.2, .75, .2, 1);
}
.h3d.is-revealed .h3d__sl > * { opacity: 1; translate: 0 0; clip-path: inset(-60% -30% -60% -30%); }
.h3d.is-revealed .h3d__sl:nth-child(1) > * { transition-delay: .12s; }
.h3d.is-revealed .h3d__sl:nth-child(2) > * { transition-delay: .26s; }
.h3d__sl--gold em {
  padding-inline-end: .06em;
  font-style: italic;
  text-shadow: none;
  color: var(--c-gold);
  background-image:
    linear-gradient(105deg, transparent 42%, rgb(255 248 230 / .95) 50%, transparent 58%),
    linear-gradient(180deg, #f7e5b8 0%, #e4c582 46%, #c9a35a 100%);
  background-size: 250% 100%, 100% 100%;
  background-position: 100% 0, 0 0;
  background-repeat: no-repeat;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 1px 3px rgb(4 13 24 / .6)) drop-shadow(0 2px 12px rgb(4 13 24 / .55)) drop-shadow(0 0 16px rgb(208 173 103 / .24));
}
.h3d.is-revealed .h3d__sl--gold em { animation: h3d-sheen 7s cubic-bezier(.45, 0, .25, 1) 1.7s infinite; }
@keyframes h3d-sheen {
  0%       { background-position: 100% 0, 0 0; }
  24%, 100% { background-position: 0% 0, 0 0; }
}

.h3d__cta {
  margin-block-start: var(--sp-xs);
  pointer-events: auto;
  backdrop-filter: blur(8px);
}

.h3d__foot {
  display: grid;
  justify-items: start;
  padding-block-end: clamp(24px, 4vh, 44px);
}

.h3d__foot > * {
  opacity: 0;
  translate: 0 12px;
  transition: opacity .9s var(--ease-css), translate .9s var(--ease-css);
}
.h3d.is-settled .h3d__foot > * { opacity: 1; translate: 0 0; }

/* Scroll cue: a hairline with a gold bead travelling down it. */
.h3d__scroll {
  display: grid;
  justify-items: center;
  gap: 10px;
  font-size: var(--fs-label);
  font-weight: var(--fw-semi);
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  color: var(--c-ivory);
}
.h3d__scroll-line {
  position: relative;
  width: 1px;
  height: 44px;
  overflow: hidden;
  background: var(--rule-on-dark);
}
.h3d__scroll-line::after {
  content: "";
  position: absolute;
  left: -1.5px;
  top: -8px;
  width: 4px;
  height: 8px;
  border-radius: 2px;
  background: var(--c-gold);
  animation: h3d-bead 2.2s cubic-bezier(.65, 0, .35, 1) infinite;
}
@keyframes h3d-bead {
  from { transform: translateY(0); }
  to   { transform: translateY(56px); }
}

@media (max-width: 959px) {
  .h3d__brand {
    align-self: start;
    justify-self: center;
    justify-items: center;
    margin-block-start: clamp(92px, 13vh, 140px);
    text-align: center;
  }
  .h3d__places { justify-content: center; }
  .h3d__wordmark { --wm-w: clamp(220px, 62vw, 420px); margin-inline-start: 0; }
  .h3d__slogan { font-size: clamp(22px, 5.8vw, 32px); margin-block-start: calc(var(--sp-md) * -.2); }
}

@media (max-width: 759px) {
  .h3d__places { display: none; }
  .h3d__brand { gap: var(--sp-sm); }
  /* The call moves to the foot, under the towers, beside the scroll cue. */
  .h3d__cta { position: absolute; inset-inline-end: 0; bottom: clamp(24px, 4vh, 44px); margin: 0; min-height: 44px; }
}

/* --- fallback: no WebGL, or the module failed to load ---------------------
   A still of this same 3D scene, settled (assets/img/hero), so a visitor
   without WebGL sees the current design — never an older photograph. */
.h3d--fallback {
  background: var(--c-navy) url("../assets/img/hero/home-3d.webp") center / cover no-repeat;
}
@media (max-aspect-ratio: 3/4) {
  .h3d--fallback { background-image: url("../assets/img/hero/home-3d-portrait.webp"); background-position: center 65%; }
}
.h3d--fallback .h3d__canvas,
.h3d--fallback .h3d__horizon { display: none; }

@media (prefers-reduced-motion: reduce) {
  .h3d__horizon { display: none; }
  .h3d__wordmark,
  .h3d__brand > *,
  .h3d__sl > *,
  .h3d__foot > *,
  .h3d__canvas { transition: none; }
  .h3d__sl > * { translate: none; opacity: 1; clip-path: none; }
  .h3d.is-revealed .h3d__sl--gold em { animation: none; }
  .h3d__scroll-line::after { animation: none; top: 18px; }
}
