/* ==========================================================================
   Havana animated hero (WebGL banner + draw-on logo).
   Source: client-supplied havana-hero_3.html. Images live in ../assets/
   (hero-bg.jpg = artwork, hero-fx.png = effect mask: R water, G palms, B gold lines).
   Behaviour: js/hero.js. Needs http(s): WebGL textures are blocked from file://
   and the hero then falls back to the static artwork.
   ========================================================================== */
:root{
  --hv-ink:#0E3236;      /* letter teal */
  --hv-sun:#E5973A;      /* sun disc */
  --hv-gold:#C79446;     /* gold rule */
  --hv-wall:#F2E0C6;     /* plaster fallback */
  --hv-sea:#0F4F4C;
}

.hv-hero{
  position:relative;isolation:isolate;overflow:hidden;
  height:calc(100vh - var(--header-h));height:calc(100svh - var(--header-h));min-height:520px;
  background:var(--hv-wall) center/cover no-repeat;   /* artwork is set by hero.js only as a no-WebGL fallback */
  color:var(--hv-ink);
  /* cream 1px below the hero: at fractional zoom/DPR (resized desktop windows, 125%/150%) the hero's bottom edge lands between
     pixels and the darker plaster background shows as a faint line against the cream intro while scrolling */
  box-shadow:0 1px 0 var(--cream,#F6ECDD);
}
.hv-hero canvas{
  position:absolute;inset:0;width:100%;height:100%;display:block;z-index:0;
  opacity:0;transform:scale(1.07);transform-origin:50% 40%;
  scale:calc(1 + var(--hv-p,0) * .22);   /* scroll zoom-in (up to 22%), fading out under the cream wash; composes with the animated transform */
  /* scroll parallax: the artwork lags behind the page. The gap this opens is at the canvas top, which is
     already above the viewport (offset 30% < the hero's own scrolled-away share), so it is never seen. */
  translate:0 calc(var(--hv-p,0) * 30%);
  animation:hv-settle 2.6s cubic-bezier(.2,.7,.15,1) .05s forwards;
}
.hv-hero.no-gl canvas{display:none}

/* Bottom edge: flat sea-water waves rolling into the page cream (replaces the old gradient fade).
   Three 2x-wide seamless tiles drift sideways by half their width; wavelengths divide the 1440 shift. */
.hv-waves{
  position:absolute;left:0;bottom:-2px;height:clamp(70px,11vh,130px);
  width:max(100%,1200px);max-width:none;   /* (styles.css caps svg at max-width:100%) never squash the 2880-unit tile below ~2.4x; on phones it overflows (hero clips it) instead of turning jagged */
  z-index:3;pointer-events:none;overflow:visible;
}
.hv-waves path{animation:hv-drift linear infinite;will-change:transform}
.hv-waves .hv-wave-back{fill:rgba(92,170,196,.34);animation-duration:26s}
.hv-waves .hv-wave-mid{fill:rgba(196,226,228,.6);animation-duration:19s;animation-direction:reverse}
.hv-waves .hv-wave-front{fill:var(--cream,#F6ECDD);animation-duration:14s}
@keyframes hv-drift{to{transform:translateX(-1440px)}}
/* Scroll-out: the whole hero melts into the page cream as it scrolls away (--hv-p set by hero.js) */
.hv-hero::after{
  content:"";position:absolute;inset:0;z-index:3;pointer-events:none;
  background:var(--cream,#F6ECDD);
  opacity:calc(var(--hv-p,0) * .92);
}
/* hold every animation until the first WebGL frame is up (hero.js adds .is-ready) */
.hv-hero:not(.is-ready):not(.no-gl) *,.hv-hero:not(.is-ready):not(.no-gl) *::before{animation-play-state:paused!important}
@keyframes hv-settle{to{opacity:1;transform:none}}

@media (max-aspect-ratio:9/10){ .hv-hero{height:84vh;height:84svh;min-height:480px} }

/* soft wash of light behind the mark */
.hv-glow{
  position:absolute;z-index:1;pointer-events:none;
  left:var(--lx,50%);top:var(--ly,30%);width:var(--lw,600px);aspect-ratio:2/1.15;
  translate:-50% -46%;
  background:radial-gradient(closest-side,rgba(255,244,226,.38),rgba(255,244,226,.14) 60%,rgba(255,244,226,0));
  opacity:0;animation:hv-fade 2.4s ease .4s forwards;
}
@keyframes hv-fade{to{opacity:1}}

.hv-mark{
  position:absolute;z-index:2;margin:0;
  left:var(--lx,50%);top:var(--ly,30%);width:var(--lw,600px);
  translate:-50% calc(var(--hv-p,0) * -90px);   /* scroll: lifts away (not transitioned, so it tracks the scroll 1:1) */
  opacity:calc(1 - var(--hv-p,0) * 1.6);
  transform:translate3d(var(--px,0),var(--py,0),0);
  transition:transform 1.8s cubic-bezier(.22,.6,.2,1);
}
.hv-mark svg{display:block;width:100%;height:auto;overflow:visible}
/* phones: sit the logo a little lower on the plaster (hero.js --ly puts it near the top); the glow follows */
@media (max-width:600px){
  .hv-mark,.hv-glow{margin-top:clamp(24px,7svh,72px)}
  .hv-waves{height:56px}   /* shorter strip: the crest sits lower and less cream shows under the sea */
  /* hero runs 36px deeper so the waves end nearer the intro text, which keeps its spot (styles.css .intro padding-top 20px) */
  .hv-hero{height:calc(84vh + 36px);height:calc(84svh + 36px)}
}

/* script H + wave: thick pen strokes drawn on, clipped to the logo outline (#hv-ink-clip).
   pathLength="1" gives these dash values; hero.js swaps in real lengths for WebKit. */
.hv-pen{fill:none;stroke:var(--hv-ink);stroke-linecap:round;stroke-linejoin:round;stroke-width:19;stroke-dasharray:1 1.1;stroke-dashoffset:1.06}
mask .hv-pen{stroke:#fff}   /* archived Pa'lais page still reveals the H through a <mask id="hv-pen"> */
.hv-pen.a{animation:hv-draw 2.3s cubic-bezier(.55,.1,.35,1) .55s forwards}
.hv-pen.b{animation:hv-draw .75s cubic-bezier(.4,0,.3,1) 1.05s forwards}
@keyframes hv-draw{to{stroke-dashoffset:0}}

.hv-ink{fill:var(--hv-ink)}
.hv-lift{filter:drop-shadow(3px 5px 2.5px rgba(92,58,24,.32)) drop-shadow(9px 13px 10px rgba(92,58,24,.16))}

/* sun rises out of the wave line */
.hv-sun{transform:translateY(100px);animation:hv-rise 1.5s cubic-bezier(.2,.75,.2,1) 1.55s forwards}
@keyframes hv-rise{to{transform:none}}
.hv-sun-breathe{animation:hv-breathe 7s ease-in-out 3.2s infinite}
@keyframes hv-breathe{50%{transform:translateY(-2.5px)}}

/* wordmark letters climb in one by one */
.hv-letter{transform:translateY(86px);animation:hv-rise .95s cubic-bezier(.2,.8,.2,1) forwards;animation-delay:calc(1.95s + var(--i)*.085s)}

/* tagline unveils from the centre out (--d = distance from centre, 0..1), then the gold rule draws out */
.hv-ch{opacity:0;transform:translateY(6px);animation:hv-ch .7s cubic-bezier(.2,.7,.2,1) forwards;animation-delay:calc(2.75s + var(--d)*.75s)}
@keyframes hv-ch{to{opacity:1;transform:none}}
.hv-veil{transform-box:fill-box;transform-origin:50% 50%;transform:scaleX(0);animation:hv-open 1.1s cubic-bezier(.6,0,.2,1) 2.75s forwards}   /* archived Pa'lais tagline mask */
@keyframes hv-open{to{transform:scaleX(1)}}
.hv-rule{transform-box:fill-box;transform-origin:50% 50%;transform:scaleX(0);animation:hv-open .8s cubic-bezier(.6,0,.2,1) 3.45s forwards}
.hv-tag{font-family:"Josefin Sans","Futura","Century Gothic","Avenir Next",system-ui,sans-serif;font-size:20.5px;fill:#1C3A3C}

.hv-cue{
  position:absolute;z-index:4;left:50%;bottom:calc(78px + env(safe-area-inset-bottom,0px));translate:-50% 0;
  width:26px;height:44px;border:1.5px solid rgba(14,50,54,.6);border-radius:14px;
  opacity:0;animation:hv-fade 1s ease 4.1s forwards;
  display:grid;justify-items:center;padding-top:8px;text-decoration:none;
}
.hv-cue::before{content:"";width:3px;height:8px;border-radius:2px;background:rgba(14,50,54,.85);animation:hv-scroll 2.2s ease-in-out 4.6s infinite}
@keyframes hv-scroll{0%{transform:translateY(0);opacity:0}25%{opacity:1}80%{transform:translateY(14px);opacity:0}100%{opacity:0}}
.hv-cue:focus-visible{outline:2px solid var(--hv-gold);outline-offset:4px}
.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}

@media (prefers-reduced-motion:reduce){
  .hv-hero *, .hv-hero *::before{animation-duration:1ms!important;animation-delay:0s!important;animation-iteration-count:1!important}
  .hv-mark{transition:none}
}
