/* ==========================================
   HI-RES DIGITAL MAPPING — LAYOUT POLISH
   Loaded AFTER darkmode.css
   ========================================== */

/* ---------- VERTICAL RHYTHM ----------
   Apply generous padding to content sections only.
   Exclude navbar, hero, and fullscreen sections so they don't break. */
section.mbr-section:not(.menu):not(.mbr-fullscreen):not(#header14-1f),
.mbr-section:not(.menu):not(.mbr-fullscreen):not(#header14-1f) {
  padding-top: 5rem;
  padding-bottom: 5rem;
}

@media (max-width: 768px) {
  section.mbr-section:not(.menu):not(.mbr-fullscreen):not(#header14-1f),
  .mbr-section:not(.menu):not(.mbr-fullscreen):not(#header14-1f) {
    padding-top: 3rem;
    padding-bottom: 3rem;
  }
}

/* ---------- HERO ---------- */
#header14-1f {
  min-height: 90vh;
  background: linear-gradient(135deg, #0b3d91 0%, #062a5e 60%, #00b8a9 100%) !important;
  padding: 6rem 0 !important;
}

#header14-1f .mbr-section-title {
  color: #ffffff !important;
  text-shadow: 0 2px 12px rgba(0,0,0,.25);
}

#header14-1f .mbr-text {
  color: rgba(255,255,255,.9) !important;
  letter-spacing: 0.15em;
  font-size: .95rem;
  font-weight: 500;
}

/* Hero image: soften edges */
#header14-1f .image-wrapper img {
  border-radius: var(--radius, 12px);
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
}

/* ---------- ABOUT US SECTION ---------- */
#header14-1j .mbr-section-title {
  color: var(--text) !important;
}

/* ---------- SECTION TITLES ---------- */
.mbr-section-title {
  letter-spacing: -0.02em;
  line-height: 1.15;
  font-weight: 800;
}

.mbr-section-subtitle {
  opacity: 0.85;
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
}

/* ---------- SERVICES / SECTORS IMAGES ---------- */
.item-img img,
.features-image img {
  aspect-ratio: 4/3;
  object-fit: cover;
  width: 100%;
  display: block;
}

/* ---------- GALLERY SLIDER IMAGES ---------- */
.slider-image img {
  aspect-ratio: 16/10;
  object-fit: cover;
  border-radius: var(--radius, 12px);
}

/* ---------- PROJECT GALLERY ---------- */
.gallery4 .item-wrapper img,
.mbr-gallery .item-wrapper img {
  aspect-ratio: 4/3;
  object-fit: cover;
  transition: transform .4s ease;
}

.gallery4 .item-wrapper:hover img,
.mbr-gallery .item-wrapper:hover img {
  transform: scale(1.05);
}

/* ---------- CLIENT LOGOS ---------- */
.clients1 .card img {
  filter: grayscale(1) opacity(.7);
  transition: filter .25s ease, transform .25s ease;
  object-fit: contain;
  width: 100%;
}

.clients1 .card img:hover {
  filter: grayscale(0) opacity(1);
  transform: scale(1.05);
}

/* ---------- SCROLL-TO-TOP BUTTON ---------- */
.scrollToTop {
  bottom: 20px !important;
  right: 20px !important;
}

/* ---------- THEME TOGGLE: keep above scroll-to-top ---------- */
#theme-toggle {
  bottom: 90px !important;
}

/* ---------- RESPONSIVE TWEAKS ---------- */
@media (max-width: 768px) {
  #header14-1f {
    min-height: auto;
    padding: 5rem 0 3rem !important;
  }

  #header14-1f .mbr-section-title {
    font-size: 1.8rem;
  }

  .mbr-section-title {
    font-size: 1.6rem;
  }
}

/* ==========================================
   GALLERY — MASONRY GRID + LIGHTBOX
   ========================================== */

/* ---------- MASONRY GRID ---------- */
.masonry-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 200px;
  grid-auto-flow: dense;
  gap: 14px;
  margin-top: 2rem;
}

.masonry-item {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius, 12px);
  background: var(--bg-alt);
  display: block;
  box-shadow: var(--shadow-sm);
  transition: transform .35s cubic-bezier(.2,.8,.2,1),
              box-shadow .35s ease;
}

/* Tall items span 2 rows */
.masonry-item.tall {
  grid-row: span 2;
}

/* Wide items span 2 columns (optional — add class "wide" if you want) */
.masonry-item.wide {
  grid-column: span 2;
}

.masonry-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .7s cubic-bezier(.2,.8,.2,1),
              filter .35s ease;
}

/* Hover: lift + zoom + dim the image slightly */
.masonry-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 40px rgba(0, 184, 169, 0.28);
  z-index: 2;
}

.masonry-item:hover img {
  transform: scale(1.08);
  filter: brightness(0.85);
}

/* Overlay icon that fades in on hover */
.masonry-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(180deg,
              rgba(11, 61, 145, 0) 40%,
              rgba(11, 61, 145, 0.75) 100%);
  opacity: 0;
  transition: opacity .35s ease;
  font-size: 1.6rem;
  pointer-events: none;
}

.masonry-item:hover .masonry-overlay {
  opacity: 1;
}

/* ---------- RESPONSIVE GRID ---------- */
@media (max-width: 992px) {
  .masonry-grid {
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: 180px;
  }
}

@media (max-width: 640px) {
  .masonry-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: 150px;
    gap: 10px;
  }
  .masonry-item.wide {
    grid-column: span 1;
  }
}

/* ---------- LIGHTBOX ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(5, 10, 20, 0.92);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  z-index: 2000;
  padding: 2rem;
  animation: lbFade .25s ease;
}

.lightbox.open {
  display: flex;
}

@keyframes lbFade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.lightbox-img {
  max-width: 90vw;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  animation: lbZoom .3s cubic-bezier(.2,.8,.2,1);
}

@keyframes lbZoom {
  from { transform: scale(0.94); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}

.lightbox-caption {
  color: rgba(255, 255, 255, 0.85);
  margin-top: 1rem;
  font-size: 0.95rem;
  letter-spacing: 0.05em;
}

/* Close / prev / next buttons */
.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: absolute;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 1.4rem;
  transition: background .2s ease, transform .2s ease;
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
  background: var(--accent);
  color: #06241f;
  transform: scale(1.08);
}

.lightbox-close {
  top: 20px;
  right: 20px;
  font-size: 1.8rem;
  line-height: 1;
}

.lightbox-prev { left: 20px; top: 50%; transform: translateY(-50%); }
.lightbox-next { right: 20px; top: 50%; transform: translateY(-50%); }

.lightbox-prev:hover { transform: translateY(-50%) scale(1.08); }
.lightbox-next:hover { transform: translateY(-50%) scale(1.08); }

/* Mobile lightbox tweaks */
@media (max-width: 640px) {
  .lightbox-prev { left: 10px; }
  .lightbox-next { right: 10px; }
  .lightbox-close { top: 10px; right: 10px; width: 40px; height: 40px; }
  .lightbox-img { max-width: 94vw; max-height: 70vh; }
}

/* ==========================================
   HERO — Animated gradient + floating image
   ========================================== */
#header14-1f {
  min-height: 90vh;
  padding: 6rem 0 !important;
  background: linear-gradient(-45deg, #0b3d91, #062a5e, #00b8a9, #0B3D91) !important;
  background-size: 400% 400% !important;
  animation: heroGradient 18s ease infinite;
  position: relative;
  overflow: hidden;
}

@keyframes heroGradient {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Soft radial glow pulsing in the corner */
#header14-1f::before {
  content: '';
  position: absolute;
  top: -20%;
  right: -10%;
  width: 60%;
  height: 140%;
  background: radial-gradient(circle, rgba(0, 184, 169, 0.35), transparent 70%);
  pointer-events: none;
  animation: heroGlow 8s ease-in-out infinite alternate;
  z-index: 1;
}

@keyframes heroGlow {
  from { transform: translate(0, 0) scale(1); opacity: .6; }
  to   { transform: translate(-20px, 30px) scale(1.15); opacity: 1; }
}

/* Make sure content sits above the glow */
#header14-1f .container-fluid {
  position: relative;
  z-index: 2;
}

/* Floating hero image */
#header14-1f .image-wrapper img {
  border-radius: var(--radius, 12px);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
  animation: heroFloat 6s ease-in-out infinite;
}

@keyframes heroFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-14px); }
}

/* Hero text */
#header14-1f .mbr-section-title {
  color: #ffffff !important;
  text-shadow: 0 4px 30px rgba(0, 0, 0, 0.35);
  letter-spacing: -0.03em;
  font-weight: 800;
}

#header14-1f .mbr-text {
  color: rgba(255, 255, 255, 0.9) !important;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.9rem;
  font-weight: 500;
}

/* ==========================================
   NAVBAR — Shrink on scroll
   ========================================== */
.navbar {
  transition: padding .3s ease, background .3s ease, box-shadow .3s ease;
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.navbar.scrolled {
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.navbar .navbar-logo img {
  transition: height .3s ease;
}

/* ==========================================
   CLIENTS — Clean logo strip
   ========================================== */
.clients1 .row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 2.5rem;
  row-gap: 2rem;
}

.clients1 .card {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  flex: 0 0 auto;
  width: auto !important;
  max-width: 160px;
  padding: 0 !important;
}

.clients1 .card img {
  max-height: 70px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  filter: grayscale(1) opacity(0.65);
  transition: filter .3s ease, transform .3s ease;
}

.clients1 .card img:hover {
  filter: grayscale(0) opacity(1);
  transform: scale(1.1);
}