/* ==========================================================================
   FOOTER — misty fjord sign-off
   The stage keeps the sky photo's native aspect ratio (5472×3040) so every
   layer can be placed in % coordinates and stay glued to the photo at any
   viewport width. Depth sandwich, bottom to top:
     photo (sky+scene) → white blend into the section above → MARINE
     wordmark in the sky → mountain cutout (transparent sky, 5472×1985,
     bottom-anchored = bottom 65.3% of the stage) overlapping the letter
     bottoms → INSPECTION AI + tagline → legal → link columns.
   ========================================================================== */

.mia-footer {
  position: relative;
  background: #0b1420;
}

.mia-footer__stage {
  position: relative;
  width: 100%;
  aspect-ratio: 5472 / 3040;
  overflow: hidden;
}

.mia-footer__bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  user-select: none;
}

/* foreground mountain cutout — same scene with the sky knocked out.
   Bottom-anchored at the photo's native proportion, so it sits exactly
   on top of its own pixels in the bg photo; only its stacking order
   (above the wordmark) makes the peaks eat into the letters. */
.mia-footer__fg {
  position: absolute;
  z-index: 3;
  left: 0;
  bottom: 0;
  width: 100%;
  height: auto;
  display: block;
  user-select: none;
  pointer-events: none;
}

/* soft blend into the (white) section above — the sky appears to spread
   up into the page instead of starting at a hard edge */
.mia-footer__stage::before {
  content: '';
  position: absolute;
  z-index: 1;
  top: 0;
  left: 0;
  right: 0;
  height: 30%;
  background: linear-gradient(180deg,
      #ffffff 0%,
      rgba(255, 255, 255, 0.85) 22%,
      rgba(255, 255, 255, 0.45) 55%,
      rgba(255, 255, 255, 0) 100%);
  pointer-events: none;
}

/* gentle scrim across the sunlit water at the bottom — keeps the link
   columns and legal line readable without flattening the photo */
.mia-footer__stage::after {
  content: '';
  position: absolute;
  z-index: 3;
  left: 0;
  right: 0;
  bottom: 0;
  height: 30%;
  background: linear-gradient(180deg,
      rgba(8, 16, 28, 0) 0%,
      rgba(8, 16, 28, 0.28) 55%,
      rgba(8, 16, 28, 0.5) 100%);
  pointer-events: none;
}

/* ---------------- wordmark ------------------------------------------------
   The <h2> itself has NO z-index (stacking context stays open) so its two
   words can interleave with the mountain cutout: MARINE at z2 slides
   BEHIND the peaks (fg is z3), INSPECTION AI at z4 rides in front. */

.mia-footer__title {
  position: absolute;
  inset: 0;
  margin: 0;
  pointer-events: none;
  font-family: 'Outfit', 'Inter', sans-serif;
  text-transform: uppercase;
  text-align: center;
  line-height: 1;
  color: #fff;
}

.mia-footer__word {
  position: absolute;
  left: 0;
  right: 0;
  display: block;
}

.mia-footer__word--main {
  z-index: 2;   /* under the mountain cutout — peaks clip the letter bottoms */
  top: 38%;     /* letter tops in the open sky, bases dipping behind the ridge */
  font-size: 7.4vw;
  font-weight: 700;
  letter-spacing: 0.26em;
  padding-left: 0.26em; /* balance trailing letter-spacing so it centers */
  overflow: hidden;     /* masks the inner span for the rise-up reveal */
}

/* gradient lives on the INNER span (it travels with the letters) —
   ghosted white, airier at the top so the word melts into the haze */
.mia-footer__word-inner {
  display: block;
  background: linear-gradient(180deg,
      rgba(255, 255, 255, 0.55) 0%,
      rgba(255, 255, 255, 0.80) 55%,
      rgba(255, 255, 255, 0.95) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.mia-footer__word--sub {
  z-index: 4;   /* in front of the mountain cutout — always fully readable */
  top: 53.5%;
  font-size: 2.3vw;
  font-weight: 500;
  letter-spacing: 0.32em;
  padding-left: 0.32em;
  color: #ffffff;
  text-shadow: 0 1px 14px rgba(10, 20, 32, 0.35);
}

/* ---------------- scroll-driven motion -----------------------------------
   footer.js adds .is-scroll when motion is allowed, then drives every
   layer from scroll progress on each animation frame: the sky drifts
   down, the mountain cutout settles up into place, MARINE rises out of
   the ridge (clipped by its word box + visually by the peaks in front),
   then INSPECTION AI, the tagline and the link columns fade up in
   sequence. Without JS — or with reduced motion — the class is never
   added and the footer simply renders finished. */

.mia-footer.is-scroll .mia-footer__bg,
.mia-footer.is-scroll .mia-footer__fg,
.mia-footer.is-scroll .mia-footer__word-inner,
.mia-footer.is-scroll .mia-footer__word--sub,
.mia-footer.is-scroll .mia-footer__tagline,
.mia-footer.is-scroll .mia-footer__col,
.mia-footer.is-scroll .mia-footer__legal {
  transition: none;
  will-change: transform, opacity;
}

.mia-footer.is-scroll .mia-footer__bg { transform-origin: 50% 100%; }

/* ---------------- tagline + legal ---------------------------------------- */

.mia-footer__tagline {
  position: absolute;
  z-index: 4;
  left: 0;
  right: 0;
  top: 60%;
  margin: 0;
  text-align: center;
  font-family: 'Space Grotesk', 'Outfit', sans-serif;
  font-weight: 300;
  font-size: max(10px, 1.15vw);
  letter-spacing: 0.42em;
  padding-left: 0.42em;
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 1px 12px rgba(10, 20, 32, 0.45);
  pointer-events: none;
}

.mia-footer__legal {
  position: absolute;
  z-index: 5; /* above the bottom scrim (and the mobile dark fade) */
  left: 0;
  right: 0;
  bottom: 2.6%;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  column-gap: clamp(16px, 2vw, 34px);
  row-gap: 4px;
  text-align: center;
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-weight: 300;
  font-size: max(9px, 0.82vw);
  letter-spacing: 0.18em;
  color: rgba(255, 255, 255, 0.55);
}

.mia-footer__legal a {
  color: rgba(255, 255, 255, 0.72);
  text-decoration: none;
  transition: color 0.25s ease;
}

.mia-footer__legal a:hover {
  color: #ffffff;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------------- link columns + contact --------------------------------- */

.mia-footer__links {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  font-family: 'Space Grotesk', 'Inter', sans-serif;
}

.mia-footer__col {
  position: absolute;
  top: 41%; /* on the dark mountain slopes framing the fjord — high enough
               that the taller type never spills past the photo's bottom */
  display: flex;
  flex-direction: column;
  gap: clamp(16px, 2vw, 32px);
}

.mia-footer__col--left  { left: 4.5%; }
.mia-footer__col--right { right: 4.5%; }

/* each group: heading with its links beneath it — the left column reads
   flush left, the right column flush right, mirroring the page edges */
.mia-footer__group {
  display: flex;
  flex-direction: column;
  gap: clamp(7px, 0.85vw, 14px);
}

.mia-footer__col--left .mia-footer__group {
  align-items: flex-start;
  text-align: left;
}

.mia-footer__col--right .mia-footer__group {
  align-items: flex-end;
  text-align: right;
}

.mia-footer__head,
.mia-footer__link {
  position: relative;
  pointer-events: auto;
  text-decoration: none;
  width: fit-content;
  /* tight dark halo + wide soft glow lifts the type off the slopes */
  text-shadow: 0 1px 3px rgba(8, 18, 30, 0.65), 0 2px 18px rgba(8, 18, 30, 0.5);
  transition: color 0.25s ease, transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.mia-footer__head {
  font-weight: 500;
  font-size: clamp(13px, 1.1vw, 18px);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #ffffff;
  margin-bottom: 3px;
}

.mia-footer__link {
  font-weight: 400;
  font-size: clamp(13px, 1vw, 16.5px);
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.85);
}

/* hover — underline sweeps out from the centre, link lifts a touch */
.mia-footer__head::after,
.mia-footer__link::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -4px;
  height: 1.5px;
  background: linear-gradient(90deg,
      rgba(255, 255, 255, 0) 0%,
      rgba(255, 255, 255, 0.95) 50%,
      rgba(255, 255, 255, 0) 100%);
  transform: scaleX(0);
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.25s ease;
}

.mia-footer__head:hover,
.mia-footer__link:hover {
  color: #ffffff;
  transform: translateY(-1px);
  text-shadow: 0 1px 3px rgba(8, 18, 30, 0.65), 0 0 22px rgba(255, 255, 255, 0.35);
}

.mia-footer__head:hover::after,
.mia-footer__link:hover::after {
  transform: scaleX(1);
  opacity: 1;
}

/* keyboard focus mirrors hover, plus a visible ring */
.mia-footer__head:focus-visible,
.mia-footer__link:focus-visible {
  color: #ffffff;
  outline: 1.5px solid rgba(255, 255, 255, 0.85);
  outline-offset: 4px;
  border-radius: 2px;
}

.mia-footer__contact { font-style: normal; }

.mia-footer__text {
  font-weight: 400;
  font-size: clamp(13px, 1vw, 16.5px);
  letter-spacing: 0.08em;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.85);
  text-shadow: 0 1px 3px rgba(8, 18, 30, 0.65), 0 2px 18px rgba(8, 18, 30, 0.5);
}

/* ---------------- small screens ------------------------------------------ */

@media (max-width: 768px) {
  /* the photo's bottom edge dissolves into deep navy so the stacked link
     panel below starts from the same colour — no hard seam */
  .mia-footer__stage::after {
    content: '';
    position: absolute;
    z-index: 4;
    left: 0;
    right: 0;
    bottom: 0;
    height: 26%;
    background: linear-gradient(180deg,
        rgba(15, 28, 44, 0) 0%,
        rgba(15, 28, 44, 0.55) 60%,
        #0f1c2c 100%);
    pointer-events: none;
  }

  /* columns leave the photo and stack on the dark base below it */
  .mia-footer__links {
    position: static;
    pointer-events: auto;
    display: grid;
    grid-template-columns: repeat(2, max-content);
    justify-content: space-evenly;
    gap: 28px 24px;
    padding: 32px 20px 28px;
    background: linear-gradient(180deg, #0f1c2c 0%, #0b1420 70%);
  }

  .mia-footer__col {
    position: static;
    gap: 24px;
  }

  /* stacked panel: mirrored alignment looks scattered here — read
     both columns flush left instead */
  .mia-footer__col--right .mia-footer__group {
    align-items: flex-start;
    text-align: left;
  }

}

/* ---------------- small screens ------------------------------------------ */

@media (max-width: 640px) {
  /* let the photo breathe a little taller on phones; the mountain cutout
     stays glued to the bottom edge, text layers keep their % positions */
  .mia-footer__stage {
    aspect-ratio: auto;
    height: 74vw;
    min-height: 300px;
  }

  .mia-footer__word--main { font-size: 9.6vw; top: 34%; }
  .mia-footer__word--sub  { font-size: 3.4vw; top: 52%; }
  .mia-footer__tagline    { font-size: 10px; letter-spacing: 0.3em; top: 60%; }
}
