/* Hero: animated illustration (loaded after styles.css).
   One stage box carries the picture and every overlay, so overlays stay glued to the drawing.
   All overlay coordinates are % of the stage: tune them in the two blocks below. */

/* ---- TUNING: wide art (16:9, hero-wide.png) ------------------------------ */
.section-hero-v1.hero-scene {
  --stage-ar: 16 / 9;
  --moon-x: 75%;        /* moon centre */
  --moon-y: 42.5%;
  --moon-r: 19.7%;      /* moon radius, % of stage WIDTH */
  --drone-x: 57%;       /* drone hover point (centre of the drone) */
  --drone-y: 30%;
  --drone-w: 9%;        /* drone width, % of stage width */
  --patrol-dx: 0.09;    /* patrol offset from the hover point, fraction of stage width */
  --patrol-dy: -0.09;   /* ...and of stage height (negative = up) */
  --screens-x: 64.8%;   /* the three map screens, top-left corner + size */
  --screens-y: 59.6%;
  --screens-w: 12.4%;
  --screens-h: 7.9%;
  --beacon-x: 77.9%;    /* mast top */
  --beacon-y: 13.4%;
  --dish-x: 75.3%;      /* dish centre, source of the ping ring */
  --dish-y: 18.2%;
  --ping-size: 16%;     /* ring diameter at the end of a ping, % of stage width */
  --hl1-x: 87.6%;       /* headlights */
  --hl1-y: 68.6%;
  --hl2-x: 96.2%;
  --hl2-y: 69.9%;
  --hl-size: 3.2%;
  --town-x: 1.5%;       /* band of town lights (twinkling dots are spread inside it) */
  --town-y: 76.8%;
  --town-w: 43.5%;
  --town-h: 2.4%;
  --sky-x: 3%;          /* empty sky where stars twinkle (keep it off the moon) */
  --sky-y: 5%;
  --sky-w: 45%;
  --sky-h: 47%;
  --fade-from: 80%;     /* stage-level fade to black (bottom of the art) */
}

/* ---- TUNING: tall art (9:16, hero-tall.png), portrait screens ------------ */
@media (max-aspect-ratio: 4/5) {
  .section-hero-v1.hero-scene {
    --stage-ar: 9 / 16;
    --moon-x: 49.7%;
    --moon-y: 31%;
    --moon-r: 41.8%;
    --drone-x: 28%;
    --drone-y: 14%;
    --drone-w: 22%;
    --patrol-dx: 0.42;
    --patrol-dy: -0.05;
    --screens-x: 34.6%;
    --screens-y: 46%;
    --screens-w: 23.4%;
    --screens-h: 4%;
    --beacon-x: 58.2%;
    --beacon-y: 13.4%;
    --dish-x: 52%;
    --dish-y: 17.2%;
    --ping-size: 30%;
    --hl1-x: 77.7%;
    --hl1-y: 51.4%;
    --hl2-x: 92.8%;
    --hl2-y: 51.9%;
    --hl-size: 6%;
    --town-x: 0%;
    --town-y: 52.8%;
    --town-w: 14%;
    --town-h: 1.2%;
    --sky-x: 2%;
    --sky-y: 0.5%;
    --sky-w: 96%;
    --sky-h: 6%;
    --fade-from: 60%;
  }
}

/* ---- Geometry: stage covers the hero ------------------------------------ */
.section-hero-v1.hero-scene {
  --hero-h: max(100svh, 600px);
  /* wide: cover; the stage is cropped mostly on the left so the van + moon stay in view */
  --stage-w: max(100vw, calc(var(--hero-h) * 16 / 9));
  --stage-h: calc(var(--stage-w) * 9 / 16);
  --stage-l: calc((100vw - var(--stage-w)) * 0.88);
  --stage-t: calc((var(--hero-h) - var(--stage-h)) * 0.3);
  /* left edge of the standing man (52.4% of the art): the text column stops before it */
  --man-x: calc(var(--stage-l) + var(--stage-w) * 0.524);
  /* text column inset, matching the Bootstrap .container gutters */
  --pad-x: 15px;
  --col-w: calc(var(--man-x) - var(--pad-x) - 48px);

  position: relative;
  isolation: isolate;
  display: block;
  min-height: var(--hero-h);
  padding: 0;
  overflow: hidden;
  background: #000;
}
@media (min-width: 576px) { .section-hero-v1.hero-scene { --pad-x: max(15px, calc((100vw - 540px) / 2 + 12px)); } }
@media (min-width: 768px) { .section-hero-v1.hero-scene { --pad-x: calc((100vw - 720px) / 2 + 12px); } }
@media (min-width: 992px) { .section-hero-v1.hero-scene { --pad-x: calc((100vw - 960px) / 2 + 12px); } }
@media (min-width: 1200px) { .section-hero-v1.hero-scene { --pad-x: calc((100vw - 1140px) / 2 + 12px); } }
@media (min-width: 1400px) { .section-hero-v1.hero-scene { --pad-x: calc((100vw - 1320px) / 2 + 12px); } }

@media (max-aspect-ratio: 4/5) {
  .section-hero-v1.hero-scene {
    /* tall: full width (the art's lower third is pure black, so it never needs to cover the height) */
    --stage-w: min(100vw, calc(var(--hero-h) * 0.62));
    --stage-h: calc(var(--stage-w) * 16 / 9);
    --stage-l: calc((100vw - var(--stage-w)) / 2);
    --stage-t: 0px;
    --pad-x: 20px;
  }
}

.hero-scene .hero-viewport {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.hero-scene .hero-stage {
  position: absolute;
  left: var(--stage-l);
  top: var(--stage-t);
  width: var(--stage-w);
  aspect-ratio: var(--stage-ar);
}
@media (max-aspect-ratio: 4/5) and (min-width: 600px) {
  /* tablets in portrait: the stage is narrower than the screen, so soften its side edges */
  .hero-scene .hero-stage {
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
  }
}
.hero-scene .hero-plate {
  position: absolute;
  inset: 0;
  transform-origin: var(--moon-x) var(--moon-y);
}
.hero-scene .hero-plate picture,
.hero-scene .hero-art {
  display: block;
  width: 100%;
  height: 100%;
}
.hero-scene .hero-art {
  object-fit: cover;
}
.hero-scene .hero-dim {
  position: absolute;
  inset: 0;
  background: #000;
  opacity: 0;
}
.hero-scene .hero-stage-fade {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent var(--fade-from), #000 calc(var(--fade-from) + 13%));
}

/* ---- Overlays (all in % of the stage) ----------------------------------- */
.hero-scene .hero-fx {
  position: absolute;
  pointer-events: none;
  mix-blend-mode: screen;
}
.hero-scene .hero-moonglow {
  left: var(--moon-x);
  top: var(--moon-y);
  width: calc(var(--moon-r) * 2.7);
  aspect-ratio: 1;
  translate: -50% -50%;
  border-radius: 50%;
  /* moon edge sits at 1/1.35 = 74% of the radius */
  background: radial-gradient(closest-side, transparent 70%, rgb(150 160 255 / 0.34) 75%, rgb(110 120 255 / 0.12) 86%, transparent 100%);
  opacity: 0.75;
}
.hero-scene .hero-screens {
  left: var(--screens-x);
  top: var(--screens-y);
  width: var(--screens-w);
  height: var(--screens-h);
  background: radial-gradient(ellipse at 50% 50%, rgb(200 212 255 / 0.5), rgb(140 155 255 / 0.18) 55%, transparent 75%);
  opacity: 0.9;
  animation: hero-screens 4.6s ease-in-out infinite;
}
.hero-scene .hero-headlight {
  width: var(--hl-size);
  aspect-ratio: 1;
  translate: -50% -50%;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgb(215 225 255 / 0.7), rgb(140 155 255 / 0.2) 50%, transparent);
  opacity: 0.8;
  animation: hero-breathe 5.2s ease-in-out infinite;
}
.hero-scene .hl-1 { left: var(--hl1-x); top: var(--hl1-y); }
.hero-scene .hl-2 { left: var(--hl2-x); top: var(--hl2-y); animation-delay: -1.7s; }
.hero-scene .hero-beacon {
  left: var(--beacon-x);
  top: var(--beacon-y);
  width: max(5px, 0.45%);
  aspect-ratio: 1;
  translate: -50% -50%;
  border-radius: 50%;
  background: radial-gradient(closest-side, #fff 35%, rgb(190 205 255 / 0.6) 60%, transparent);
  opacity: 0.2;
  mix-blend-mode: normal;
  animation: hero-beacon 2.4s linear infinite;
}
.hero-scene .hero-ping {
  left: var(--dish-x);
  top: var(--dish-y);
  width: var(--ping-size);
  aspect-ratio: 1;
  translate: -50% -50%;
  border-radius: 50%;
  border: 1px solid rgb(205 215 255 / 0.55);
  opacity: 0;
  transform: scale(0.06);
  animation: hero-ping 5s cubic-bezier(0.16, 1, 0.3, 1) 1.5s infinite;
}
.hero-scene .hero-town,
.hero-scene .hero-sky {
  position: absolute;
  pointer-events: none;
}
.hero-scene .hero-town {
  left: var(--town-x);
  top: var(--town-y);
  width: var(--town-w);
  height: var(--town-h);
}
.hero-scene .hero-sky {
  left: var(--sky-x);
  top: var(--sky-y);
  width: var(--sky-w);
  height: var(--sky-h);
}
.hero-scene .hero-town i,
.hero-scene .hero-sky i {
  position: absolute;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: #e6ebff;
  opacity: 0.35;
  animation: hero-twinkle 3.2s ease-in-out infinite;
}
.hero-scene .hero-sky i { width: 1.5px; height: 1.5px; animation-duration: 5.5s; }
/* hand-placed, random-looking positions and phases */
.hero-scene .hero-town i:nth-child(1)  { left: 4%;  top: 30%; animation-delay: -0.4s; }
.hero-scene .hero-town i:nth-child(2)  { left: 12%; top: 70%; animation-delay: -2.1s; animation-duration: 2.6s; }
.hero-scene .hero-town i:nth-child(3)  { left: 21%; top: 40%; animation-delay: -1.3s; }
.hero-scene .hero-town i:nth-child(4)  { left: 29%; top: 85%; animation-delay: -2.8s; animation-duration: 4.1s; }
.hero-scene .hero-town i:nth-child(5)  { left: 37%; top: 20%; animation-delay: -0.9s; }
.hero-scene .hero-town i:nth-child(6)  { left: 46%; top: 60%; animation-delay: -1.9s; animation-duration: 2.9s; }
.hero-scene .hero-town i:nth-child(7)  { left: 53%; top: 35%; animation-delay: -3.1s; }
.hero-scene .hero-town i:nth-child(8)  { left: 61%; top: 75%; animation-delay: -0.2s; animation-duration: 3.7s; }
.hero-scene .hero-town i:nth-child(9)  { left: 69%; top: 45%; animation-delay: -2.5s; }
.hero-scene .hero-town i:nth-child(10) { left: 77%; top: 15%; animation-delay: -1.1s; animation-duration: 2.4s; }
.hero-scene .hero-town i:nth-child(11) { left: 86%; top: 65%; animation-delay: -3.4s; }
.hero-scene .hero-town i:nth-child(12) { left: 94%; top: 40%; animation-delay: -1.6s; animation-duration: 4.4s; }
.hero-scene .hero-sky i:nth-child(1) { left: 6%;  top: 12%; animation-delay: -1.2s; }
.hero-scene .hero-sky i:nth-child(2) { left: 22%; top: 58%; animation-delay: -3.9s; }
.hero-scene .hero-sky i:nth-child(3) { left: 37%; top: 26%; animation-delay: -0.6s; animation-duration: 7s; }
.hero-scene .hero-sky i:nth-child(4) { left: 81%; top: 70%; animation-delay: -2.4s; }
.hero-scene .hero-sky i:nth-child(5) { left: 91%; top: 18%; animation-delay: -4.6s; animation-duration: 6.4s; }
.hero-scene .hero-sky i:nth-child(6) { left: 64%; top: 44%; animation-delay: -1.8s; }
@media (max-aspect-ratio: 4/5) {
  /* tall art: keep stars near the side edges, clear of the moon top */
  .hero-scene .hero-sky i:nth-child(3) { left: 12%; }
  .hero-scene .hero-sky i:nth-child(6) { left: 88%; }
}

/* ---- Drone -------------------------------------------------------------- */
.hero-scene .hero-drone-anchor {
  position: absolute;
  left: var(--drone-x);
  top: var(--drone-y);
  width: var(--drone-w);
  translate: -50% -50%;
}
.hero-scene .hero-drone-bob { position: relative; }
.hero-scene .hero-drone-bob img {
  display: block;
  width: 100%;
  height: auto;
}
/* rotor discs inside the drone image (640x259) */
.hero-scene .hero-rotor {
  position: absolute;
  width: 36%;
  height: 20%;
  translate: -50% -50%;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgb(225 232 255 / 0.55), transparent);
  mix-blend-mode: screen;
  opacity: 0.4;
  animation: hero-rotor 0.42s steps(3, jump-none) infinite alternate;
}
.hero-scene .r1 { left: 18%; top: 11%; }
.hero-scene .r2 { left: 80%; top: 10%; animation-delay: -0.13s; }
.hero-scene .r3 { left: 20%; top: 52%; animation-delay: -0.27s; }
.hero-scene .r4 { left: 82%; top: 51%; animation-delay: -0.35s; }
.hero-scene .hero-navlight {
  position: absolute;
  left: 21%;
  top: 27%;
  width: max(3px, 2.4%);
  aspect-ratio: 1;
  translate: -50% -50%;
  border-radius: 50%;
  background: radial-gradient(closest-side, #fff 40%, rgb(180 195 255 / 0.5) 70%, transparent);
  opacity: 0.25;
  animation: hero-beacon 1.6s linear 0.5s infinite;
}

/* ---- Scrims ------------------------------------------------------------- */
.hero-scene .overlay {
  z-index: 1;
  height: 28%;
}
.hero-scene .hero-scrim {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(90deg, rgb(0 0 0 / 0.5) 0%, rgb(0 0 0 / 0.22) 32%, transparent 52%);
}
.hero-scene .hero-shade {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: #000;
  opacity: 0;
  pointer-events: none;
}
@media (max-aspect-ratio: 4/5) {
  .hero-scene .hero-scrim {
    /* keeps the header logo/menu readable over the moon top */
    background: linear-gradient(180deg, rgb(0 0 0 / 0.55) 0, transparent 110px);
  }
}

/* ---- Text --------------------------------------------------------------- */
.hero-scene .content-wrap { z-index: 2; }
.hero-scene .hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 32px;
  min-height: var(--hero-h);
  padding: 120px var(--pad-x) clamp(40px, 7svh, 76px);
}
@media (max-width: 1199px) {
  .hero-scene .hero-copy { padding-top: 96px; }
}
.hero-scene .hero-main { max-width: max(var(--col-w), 280px); }
.hero-scene .hero-by {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  font-size: 12px;
  font-weight: 500;
  line-height: 16px;
  letter-spacing: 0.08em;
  color: var(--white-64);
}
.hero-scene .hero-by img {
  display: block;
  width: auto;
  height: 32px;
}
.hero-scene .hero-status {
  margin: 0 0 20px;
  color: var(--white);
}
.hero-scene h1.davies-large {
  font-size: clamp(44px, calc(var(--col-w) / 4.9), 136px);
  line-height: 0.92;
  letter-spacing: -0.04em;
  text-wrap: balance;
  margin: 0 0 clamp(20px, 3svh, 32px);
}
.hero-scene .desc {
  max-width: 46ch;
  margin: 0 0 28px;
  font-size: 16px;
  line-height: 1.5;
  color: rgb(255 255 255 / 0.74);
  text-wrap: pretty;
}
.hero-scene .tf-btn {
  height: 48px;
  padding-inline: 28px;
}

@media (max-aspect-ratio: 4/5) {
  .hero-scene .hero-copy {
    justify-content: flex-end;
    gap: 20px;
    /* text starts below the van, in the black lower part of the tall art */
    padding-top: calc(var(--stage-h) * 0.62);
    padding-bottom: 32px;
  }
  .hero-scene .hero-main { max-width: none; }
  .hero-scene .hero-by img { height: 28px; }
  .hero-scene .hero-status { margin-bottom: 14px; }
  .hero-scene h1.davies-large {
    font-size: clamp(34px, 10.4vw, 64px);
    margin-bottom: 16px;
  }
  .hero-scene .desc {
    font-size: 15px;
    margin-bottom: 22px;
  }
  .hero-scene .tf-btn {
    display: flex;
    width: 100%;
    max-width: 420px;
    height: 50px;
  }
}

/* ---- Loops -------------------------------------------------------------- */
@keyframes hero-screens {
  0%, 100% { opacity: 0.85; }
  45% { opacity: 1; }
  88% { opacity: 0.9; }
  89% { opacity: 0.55; }
  90% { opacity: 0.95; }
  91% { opacity: 0.7; }
  92% { opacity: 0.92; }
}
@keyframes hero-breathe {
  0%, 100% { opacity: 0.72; }
  50% { opacity: 0.92; }
}
@keyframes hero-beacon {
  0%, 84%, 100% { opacity: 0.2; }
  88%, 92% { opacity: 1; }
}
@keyframes hero-ping {
  0% { opacity: 0; transform: scale(0.06); }
  4% { opacity: 0.9; }
  45% { opacity: 0; transform: scale(1); }
  100% { opacity: 0; transform: scale(1); }
}
@keyframes hero-twinkle {
  0%, 100% { opacity: 0.25; }
  50% { opacity: 1; }
}
@keyframes hero-rotor {
  from { opacity: 0.28; }
  to { opacity: 0.55; }
}

/* off-screen or hidden tab (set by hero.js) */
.hero-scene.is-paused .hero-fx,
.hero-scene.is-paused .hero-town i,
.hero-scene.is-paused .hero-sky i,
.hero-scene.is-paused .hero-rotor,
.hero-scene.is-paused .hero-navlight {
  animation-play-state: paused;
}

@media (prefers-reduced-motion: reduce) {
  .hero-scene .hero-fx,
  .hero-scene .hero-town i,
  .hero-scene .hero-sky i,
  .hero-scene .hero-rotor,
  .hero-scene .hero-navlight {
    animation: none;
  }
  .hero-scene .hero-beacon,
  .hero-scene .hero-navlight { opacity: 0.8; }
  .hero-scene .hero-town i,
  .hero-scene .hero-sky i { opacity: 0.6; }
}

/* ---- Section illustrations (same screenprint style as the hero) ---------- */
.section-selected-work .slick-for .image img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  object-fit: cover;
}
@media (min-width: 1200px) {
  .wg-service-2 .main-image .image img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 3 / 4;
    object-fit: cover;
  }
}
.wg-process .img-icon img {
  display: block;
  width: 120px;
  max-width: 100%;
  height: auto;
  aspect-ratio: 1;
  border-radius: 50%;
}
