/* ==========================================================================
   Silver Sea — motion layer
   Everything here is progressive: without JavaScript or with reduced motion,
   content is fully visible and static.
   ========================================================================== */

/* ---------- Scroll progress ---------------------------------------------- */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  transform-origin: 0 50%;
  transform: scaleX(var(--p, 0));
  background: linear-gradient(to right, var(--sky-deep), var(--sky));
  z-index: 120;
  pointer-events: none;
}

/* ---------- Reveal -------------------------------------------------------- */
.js [data-reveal] {
  opacity: 0;
  transform: translate3d(0, 26px, 0);
  transition:
    opacity 0.85s var(--ease),
    transform 0.85s var(--ease);
  transition-delay: calc(var(--d, 0) * 70ms);
  will-change: opacity, transform;
}

.js [data-reveal].in {
  opacity: 1;
  transform: none;
}

.js [data-reveal="clip"] {
  opacity: 1;
  transform: none;
  clip-path: inset(0 0 100% 0);
  transition: clip-path 1.1s var(--ease);
  transition-delay: calc(var(--d, 0) * 80ms);
}

.js [data-reveal="clip"].in { clip-path: inset(0 0 0 0); }

.js [data-reveal="fade"] { transform: none; }

.js [data-reveal="right"] { transform: translate3d(-30px, 0, 0); }

.js [data-reveal="scale"] {
  transform: scale(0.96);
  opacity: 0;
}

.js [data-reveal="scale"].in { transform: none; opacity: 1; }

/* Hero headline: line-by-line rise */
.js .hero h1 .line,
.js .service-hero h1 .line {
  display: block;
  overflow: hidden;
}

.js .hero h1 .line > span,
.js .service-hero h1 .line > span {
  display: block;
  transform: translate3d(0, 108%, 0);
  animation: line-rise 1.05s var(--ease) forwards;
  animation-delay: calc(var(--i, 0) * 120ms + 200ms);
}

.js .hero .eyebrow,
.js .hero-content > p,
.js .hero .actions {
  opacity: 0;
  animation: fade-up 1s var(--ease) forwards;
}

.js .hero .eyebrow { animation-delay: 80ms; }
.js .hero-content > p { animation-delay: 460ms; }
.js .hero .actions { animation-delay: 580ms; }

.js .hero-stats {
  opacity: 0;
  animation: fade-up 1s var(--ease) 720ms forwards;
}

/* Mobile menu links stagger */
header nav.open > a {
  animation: fade-up 0.6s var(--ease) both;
}

header nav.open > a:nth-child(1) { animation-delay: 60ms; }
header nav.open > a:nth-child(2) { animation-delay: 110ms; }
header nav.open > a:nth-child(3) { animation-delay: 160ms; }
header nav.open > a:nth-child(4) { animation-delay: 210ms; }
header nav.open > a:nth-child(5) { animation-delay: 260ms; }
header nav.open > a:nth-child(6) { animation-delay: 310ms; }
header nav.open > a:nth-child(7) { animation-delay: 360ms; }

/* ---------- Parallax ------------------------------------------------------ */
[data-parallax] {
  overflow: hidden;
}

[data-parallax] > img,
[data-parallax] > picture > img {
  will-change: transform;
  transform: translate3d(0, var(--py, 0px), 0) scale(1.1);
}

/* ---------- Image loading ------------------------------------------------ */
.img-shell {
  position: relative;
  overflow: hidden;
  background: var(--bg-3);
}

.img-shell > img {
  position: relative;
  z-index: 1;
  opacity: 0;
  transition: opacity 0.7s var(--ease);
}

.img-shell > img.loaded,
.img-shell > img[data-eager] { opacity: 1; }

.img-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image: var(--lqip);
  background-size: cover;
  background-position: center;
  filter: blur(14px);
  transform: scale(1.08);
  transition: opacity 0.8s var(--ease);
}

.img-shell.loaded::before { opacity: 0; }

/* ---------- Magnetic buttons --------------------------------------------- */
.button,
.text-link {
  will-change: transform;
}

.button[data-magnetic] {
  transform: translate3d(var(--mx, 0px), var(--my, 0px), 0);
  transition: transform 0.28s var(--ease), color 0.45s var(--ease), border-color 0.45s;
}

/* ---------- Card pointer glow -------------------------------------------- */
.scope-grid article::after,
.dept-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(320px circle at var(--x, 50%) var(--y, 50%), rgba(143, 201, 240, 0.16), transparent 62%);
  transition: opacity 0.4s;
}

.scope-grid article:hover::after,
.dept-card:hover::after { opacity: 1; }

.dept-card { position: relative; }

/* ---------- FAQ open animation ------------------------------------------- */
.faq details > p {
  animation: fade-up 0.4s var(--ease) both;
}

/* ---------- Header hide on scroll down ----------------------------------- */
header {
  transform: translateY(0);
  transition: transform 0.45s var(--ease), background 0.5s var(--ease), height 0.4s var(--ease),
    color 0.4s, border-color 0.4s;
}

header.is-hidden { transform: translateY(-102%); }

/* ---------- Keyframes ----------------------------------------------------- */
@keyframes line-rise {
  from { transform: translate3d(0, 108%, 0); }
  to { transform: translate3d(0, 0, 0); }
}

@keyframes fade-up {
  from { opacity: 0; transform: translate3d(0, 18px, 0); }
  to { opacity: 1; transform: none; }
}

/* ---------- Reduced motion ------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  .js [data-reveal],
  .js [data-reveal="scale"] {
    opacity: 1;
    transform: none;
  }

  .js [data-reveal="clip"] { clip-path: none; }

  .js .hero h1 .line > span,
  .js .service-hero h1 .line > span {
    transform: none;
    animation: none;
  }

  .js .hero .eyebrow,
  .js .hero-content > p,
  .js .hero .actions,
  .js .hero-stats {
    opacity: 1;
    animation: none;
  }

  .marquee,
  .product-marquee,
  .hero-image,
  .service-hero > img,
  .corridor-map .lane,
  .corridor-map .pulse,
  .status-dot {
    animation: none !important;
  }

  [data-parallax] > img,
  [data-parallax] > picture > img {
    transform: none;
  }

  .button[data-magnetic] { transform: none; }
}
