/* ==================================================
   Motion layer: page transitions, scroll reveals, hover micro-interactions
   Works together with public/js/motion.js. Everything here only switches on
   when motion.js adds .mo-js to <html>, so without the script nothing is hidden.
   Remove the motion.css and motion.js lines in views/partials/head.ejs to revert.
   ================================================== */

/* ---------- page transition curtain ----------
   three layers that move together: body::before = navy panel + logo icon,
   body::after = "SA ENGINEERING", html::after = "SERVICES PVT LTD" between amber rules */
html.mo-js body::before,
html.mo-js body::after,
html.mo-js::after {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: "Cinzel", Georgia, serif;
  font-weight: 700;
  color: #ffffff;
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: none;
  clip-path: inset(0 0 100% 0);
  transition: clip-path 0.7s cubic-bezier(0.77, 0, 0.18, 1);
}

html.mo-js body::before {
  content: "";
  z-index: 2147483000;
  background:
    url(/images/logo-sa-icon-hd.png) center calc(50% - 110px) / auto clamp(140px, 22vh, 210px) no-repeat,
    radial-gradient(ellipse 60% 45% at 50% 110%, rgba(245, 166, 35, 0.32), transparent 70%),
    radial-gradient(ellipse 50% 50% at 0% 0%, rgba(31, 86, 214, 0.35), transparent 70%),
    radial-gradient(ellipse 40% 40% at 100% 20%, rgba(109, 179, 63, 0.14), transparent 70%),
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px) 0 0 / 56px 56px,
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px) 0 0 / 56px 56px,
    linear-gradient(160deg, #0B1D3A 0%, #071328 60%, #050d1c 100%);
}

html.mo-js body::after {
  content: "SA Engineering";
  z-index: 2147483001;
  padding-top: 150px;
  /* amber-gold gradient text: full-width strip so the word is never cut, colour shifts across its centre */
  background: linear-gradient(90deg, #FFE08A calc(50% - 300px), #F5A623 50%, #FF8A1F calc(50% + 300px)) center calc(50% + 75px) / 100% 1.6em no-repeat;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-size: clamp(34px, 5.2vw, 62px);
  letter-spacing: 2px;
}

html.mo-js::after {
  content: "Services Pvt Ltd";
  z-index: 2147483002;
  padding-top: 262px;
  color: rgba(255, 255, 255, 0.8);
  font-size: clamp(13px, 1.6vw, 21px);
  letter-spacing: 6px;
  background:
    linear-gradient(#F5A623, #F5A623) calc(50% - 230px) calc(50% + 131px) / 80px 2px no-repeat,
    linear-gradient(#F5A623, #F5A623) calc(50% + 230px) calc(50% + 131px) / 80px 2px no-repeat;
}

html.mo-js.mo-entering body::before,
html.mo-js.mo-entering body::after,
html.mo-js.mo-entering::after {
  clip-path: inset(0 0 0 0);
  transition: none;
}

html.mo-js.mo-leaving body::before,
html.mo-js.mo-leaving body::after,
html.mo-js.mo-leaving::after {
  clip-path: inset(0 0 0 0);
  transition-duration: 0.45s;
}

/* narrow screens: keep the amber rules next to the smaller sub-line */
@media (max-width: 767px) {
  html.mo-js::after {
    background:
      linear-gradient(#F5A623, #F5A623) calc(50% - 150px) calc(50% + 131px) / 34px 2px no-repeat,
      linear-gradient(#F5A623, #F5A623) calc(50% + 150px) calc(50% + 131px) / 34px 2px no-repeat;
  }
}

/* ---------- scroll progress bar ---------- */
#mo-progress {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 2147482000;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--primary-color), #fff7c2 60%, var(--primary-color));
  box-shadow: 0 0 12px rgba(var(--primary-color-rgb), 0.7);
  transform: scaleX(0);
  transform-origin: left center;
  pointer-events: none;
}

/* ---------- scroll reveal (for elements the theme doesn't already animate) ---------- */
.mo-js .mo-reveal {
  opacity: 0;
  transform: translate3d(0, 28px, 0);
  transition:
    opacity 0.8s ease,
    transform 0.9s cubic-bezier(0.2, 0.7, 0.2, 1);
  transition-delay: var(--mo-delay, 0ms);
  will-change: opacity, transform;
}

.mo-js .mo-reveal.mo-in {
  opacity: 1;
  transform: none;
}

/* images wipe in from the bottom */
.mo-js img.mo-reveal {
  opacity: 1;
  transform: scale(1.06);
  clip-path: inset(100% 0 0 0);
  transition:
    clip-path 1.1s cubic-bezier(0.77, 0, 0.18, 1),
    transform 1.4s cubic-bezier(0.2, 0.7, 0.2, 1);
  transition-delay: var(--mo-delay, 0ms);
}

.mo-js img.mo-reveal.mo-in {
  transform: none;
  clip-path: inset(0 0 0 0);
}

/* ---------- centred section titles: accent line draws in ---------- */
.mo-js .section-title.text-center {
  position: relative;
  padding-bottom: 22px;
}

.mo-js .section-title.text-center::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 72px;
  height: 4px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--bg-dark-1), var(--primary-color));
  transform: translateX(-50%) scaleX(0);
  transition: transform 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) 0.3s;
}

.mo-js .section-title.text-center.mo-line::after {
  transform: translateX(-50%) scaleX(1);
}

/* ---------- 3D tilt + spotlight on cards (desktop pointer only) ---------- */
.service-card.mo-tilting,
.about-card.mo-tilting,
.leader-card.mo-tilting,
.home-service-card.mo-tilting,
.other-service-card.mo-tilting,
.client-card.mo-tilting,
.project-card.mo-tilting {
  transform: perspective(1000px) rotateX(var(--mo-rx, 0deg)) rotateY(var(--mo-ry, 0deg)) translateY(-10px);
  transition-property: transform, box-shadow, border-color;
  transition-duration: 0.12s, 0.45s, 0.45s;
  transition-timing-function: ease-out;
}

.service-card.mo-tilting,
.about-card.mo-tilting,
.leader-card.mo-tilting {
  background-image: radial-gradient(420px circle at var(--mo-mx, 50%) var(--mo-my, 50%), rgba(var(--primary-color-rgb), 0.16), transparent 45%);
}

/* ---------- buttons: shine sweep, glow, ripple, magnetic ---------- */
.btn-main,
a.btn-main {
  overflow: hidden;
  isolation: isolate;
  transition: box-shadow 0.35s ease, background-color 0.35s ease, color 0.35s ease, translate 0.35s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.btn-main::after,
a.btn-main::after {
  content: "";
  position: absolute;
  top: 0;
  left: -75%;
  z-index: 1;
  width: 50%;
  height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  transform: skewX(-20deg);
  pointer-events: none;
  transition: left 0.75s ease;
}

.btn-main:hover::after,
a.btn-main:hover::after {
  left: 130%;
}

a.btn-main:hover,
.btn-main:hover {
  box-shadow: 0 12px 28px rgba(var(--primary-color-rgb), 0.45);
}

.mo-ripple {
  position: absolute;
  z-index: 0;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.6);
  transform: scale(0);
  pointer-events: none;
  animation: mo-ripple 0.65s ease-out forwards;
}

@keyframes mo-ripple {
  to {
    transform: scale(28);
    opacity: 0;
  }
}

.mo-magnetic {
  transition: translate 0.35s cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* ---------- back to top ---------- */
#back-to-top {
  border-radius: 50%;
  transition: bottom 0.4s cubic-bezier(0.2, 0.7, 0.2, 1), box-shadow 0.35s ease, translate 0.35s cubic-bezier(0.2, 0.7, 0.2, 1), opacity 0.2s ease-out;
}

#back-to-top:hover {
  box-shadow: 0 0 0 8px rgba(var(--primary-color-rgb), 0.25), 0 12px 26px rgba(0, 0, 0, 0.25);
}

/* ---------- footer ---------- */
footer .widget ul li a {
  display: inline-block;
  transition: transform 0.35s cubic-bezier(0.2, 0.7, 0.2, 1), color 0.3s ease;
}

footer .widget ul li a:hover {
  transform: translateX(6px);
  color: var(--primary-color);
}

.social-icons a i {
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.3s ease, color 0.3s ease;
}

.social-icons a:hover i {
  transform: translateY(-4px) rotate(-8deg) scale(1.08);
}

/* ---------- breadcrumbs + in-text links ---------- */
.crumb li a {
  background: linear-gradient(currentColor, currentColor) left bottom / 0 1px no-repeat;
  transition: background-size 0.35s ease, color 0.3s ease;
}

.crumb li a:hover {
  background-size: 100% 1px;
}

/* ---------- forms ---------- */
.form-control {
  transition: border-color 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
}

.form-control:focus {
  border-color: var(--bg-dark-1);
  box-shadow: 0 0 0 4px rgba(var(--primary-color-rgb), 0.35);
}

/* ---------- details: selection + scrollbar ---------- */
::selection {
  background: var(--primary-color);
  color: #0b1b33;
}

html {
  scrollbar-color: var(--bg-dark-1) #eef1f6;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: #eef1f6;
}

::-webkit-scrollbar-thumb {
  background: var(--bg-dark-1);
  border: 2px solid #eef1f6;
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--bg-dark-2, #0f2647);
}

/* ---------- respect reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html.mo-js body::before,
  html.mo-js body::after,
  html.mo-js::after {
    display: none;
  }

  .mo-js .mo-reveal,
  .mo-js img.mo-reveal {
    opacity: 1;
    transform: none;
    clip-path: none;
    transition: none;
  }

  .mo-js .section-title.text-center::after {
    transform: translateX(-50%) scaleX(1);
    transition: none;
  }

  .btn-main::after,
  a.btn-main::after,
  .mo-ripple {
    display: none;
  }
}
