/* ==========================================================================
   SILVERISE WORLD TRADE LLP - Preloader, Image Galleries & Motion Helpers
   Theme-agnostic: uses the colour tokens from corporate.css / theme file.
   Animations are driven by assets/js/motion-effects.js (Motion library).
   ========================================================================== */

/* --------------------------------------------------------------------------
   Preloader
   -------------------------------------------------------------------------- */
.site-preloader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at 50% 40%, var(--mv-petrol) 0%, var(--mv-petrol-dark) 70%);
  color: #FFFFFF;
  /* Safety net: never block the page if scripts fail */
  animation: pl-failsafe 0.4s ease 7s forwards;
}
html:not(.js) .site-preloader { display: none; }
@keyframes pl-failsafe { to { opacity: 0; visibility: hidden; } }

.pl-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  text-align: center;
  padding: 0 24px;
}
.pl-emblem {
  position: relative;
  width: 96px;
  height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pl-emblem::before,
.pl-emblem::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid transparent;
}
.pl-emblem::before {
  border-top-color: var(--mv-cyan);
  border-right-color: var(--mv-cyan);
  animation: pl-spin 1.4s linear infinite;
}
.pl-emblem::after {
  inset: 10px;
  border-bottom-color: var(--mv-orange);
  border-left-color: var(--mv-orange);
  animation: pl-spin 2s linear infinite reverse;
}
.pl-globe {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  color: var(--mv-cyan);
}
@keyframes pl-spin { to { transform: rotate(360deg); } }

.pl-brand {
  font-family: var(--font-heading);
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1;
}
.pl-sub {
  font-family: var(--font-heading);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--mv-cyan);
  margin-top: 6px;
}
.pl-route {
  position: relative;
  width: min(280px, 70vw);
  margin-top: 8px;
}
.pl-bar {
  height: 3px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}
.pl-bar span {
  display: block;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--mv-cyan), var(--mv-orange));
  transform-origin: left center;
  transform: scaleX(0);
  animation: pl-progress 2.4s cubic-bezier(0.2, 0.7, 0.3, 1) forwards;
}
@keyframes pl-progress { to { transform: scaleX(0.86); } }
.pl-ports {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  font-family: var(--font-heading);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--mv-on-dark-muted);
}
.pl-ports i { color: var(--mv-cyan); margin-right: 5px; }
html.is-loading { overflow: hidden; }

/* Scope-of-work object cards: stack the action button on small screens */
@media (max-width: 640px) {
  .scope-object {
    grid-template-columns: 52px 1fr !important;
    gap: 14px !important;
    padding: 20px !important;
  }
  .scope-object > div:first-child { width: 52px !important; height: 52px !important; font-size: 1.3rem !important; }
  .scope-object > :last-child { grid-column: 1 / -1; }
  .scope-object > :last-child .btn { width: 100%; }
}

/* Keep anchored sections clear of the sticky navbar */
[id] { scroll-margin-top: 100px; }

/* --------------------------------------------------------------------------
   Scroll progress bar
   -------------------------------------------------------------------------- */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 1200;
  background: linear-gradient(90deg, var(--mv-cyan), var(--mv-orange));
  transform-origin: left center;
  transform: scaleX(0);
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   Product / logistics image galleries
   -------------------------------------------------------------------------- */
.seg-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}
.seg-gallery figure {
  position: relative;
  margin: 0;
  height: 220px;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.seg-gallery img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
.seg-gallery figure:hover img { transform: scale(1.06); }
.seg-gallery figcaption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 36px 18px 14px;
  background: linear-gradient(180deg, transparent 0%, rgba(var(--mv-petrol-dark-rgb), 0.85) 100%);
  color: #FFFFFF;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.98rem;
}

@media (prefers-reduced-motion: reduce) {
  .pl-emblem::before, .pl-emblem::after, .pl-bar span { animation: none; }
}
