/* =============================================
   MinDet Modern Enhancements
   Add this file AFTER your existing styles.css
   <link href="css/modern-enhancements.css" rel="stylesheet" />
   ============================================= */

/* ── Google Font additions ──────────────────── */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,600;0,9..40,700;1,9..40,400&family=Space+Grotesk:wght@400;500;700&display=swap');

/* ── CSS Custom Properties ──────────────────── */
:root {
  --accent: #57a8ff;
  --accent-glow: rgba(87, 168, 255, 0.35);
  --dark: #0d1117;
  --dark-surface: #161b22;
  --dark-border: rgba(87, 168, 255, 0.15);
  --text-primary: #e6edf3;
  --text-muted: #8b949e;
  --transition-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── Base overrides ─────────────────────────── */
body {
  font-family: 'DM Sans', sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ── Scroll reveal base ─────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity 0.7s var(--transition-smooth),
              transform 0.7s var(--transition-smooth);
}
.reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}
.reveal-left {
  opacity: 0;
  transform: translateX(-40px);
  transition: opacity 0.7s var(--transition-smooth),
              transform 0.7s var(--transition-smooth);
}
.reveal-left.revealed {
  opacity: 1;
  transform: translateX(0);
}
.reveal-right {
  opacity: 0;
  transform: translateX(40px);
  transition: opacity 0.7s var(--transition-smooth),
              transform 0.7s var(--transition-smooth);
}
.reveal-right.revealed {
  opacity: 1;
  transform: translateX(0);
}
.reveal-scale {
  opacity: 0;
  transform: scale(0.92);
  transition: opacity 0.6s var(--transition-smooth),
              transform 0.6s var(--transition-spring);
}
.reveal-scale.revealed {
  opacity: 1;
  transform: scale(1);
}

/* Stagger delays for children */
.stagger > *:nth-child(1) { transition-delay: 0ms; }
.stagger > *:nth-child(2) { transition-delay: 100ms; }
.stagger > *:nth-child(3) { transition-delay: 200ms; }
.stagger > *:nth-child(4) { transition-delay: 300ms; }
.stagger > *:nth-child(5) { transition-delay: 400ms; }
.stagger > *:nth-child(6) { transition-delay: 500ms; }

/* ── Masthead Hero ──────────────────────────── */
header.masthead {
  position: relative;
  overflow: hidden;
}

/* Particle canvas behind content */
#hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

header.masthead::before {
  background: linear-gradient(
    160deg,
    rgba(0, 0, 0, 0.72) 0%,
    rgba(13, 17, 23, 0.55) 50%,
    rgba(87, 168, 255, 0.12) 100%
  );
  backdrop-filter: blur(1px);
}

header.masthead .masthead-heading {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  letter-spacing: -0.02em;
  animation: heroFadeUp 1s var(--transition-smooth) 0.2s both;
}
header.masthead .masthead-subheading {
  animation: heroFadeUp 1s var(--transition-smooth) 0.45s both;
  font-style: normal;
  font-weight: 300;
  font-size: 1.15rem;
  line-height: 1.7;
  color: rgba(230, 237, 243, 0.9);
}
header.masthead .btn {
  animation: heroFadeUp 1s var(--transition-smooth) 0.65s both;
}

@keyframes heroFadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Glowing accent line under hero heading ─── */
header.masthead .masthead-heading::after {
  content: '';
  display: block;
  width: 4rem;
  height: 3px;
  background: var(--accent);
  margin: 0.75rem auto 0;
  border-radius: 2px;
  box-shadow: 0 0 16px var(--accent-glow);
  animation: lineGrow 0.8s var(--transition-smooth) 1.1s both;
}
@keyframes lineGrow {
  from { width: 0; opacity: 0; }
  to   { width: 4rem; opacity: 1; }
}

/* ── Navbar ─────────────────────────────────── */
#mainNav {
  transition: background-color 0.4s ease,
              backdrop-filter 0.4s ease,
              padding 0.3s ease,
              box-shadow 0.4s ease;
}
#mainNav.navbar-shrink {
  background: rgba(13, 17, 23, 0.92) !important;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 1px 0 var(--dark-border),
              0 8px 32px rgba(0, 0, 0, 0.4);
}

#mainNav .navbar-nav .nav-item .nav-link {
  position: relative;
  transition: color 0.25s ease;
}
#mainNav .navbar-nav .nav-item .nav-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
  transition: width 0.3s var(--transition-spring);
}
#mainNav .navbar-nav .nav-item .nav-link:hover::after,
#mainNav .navbar-nav .nav-item .nav-link.active::after {
  width: 100%;
}

/* ── Primary Button ─────────────────────────── */
.btn-primary {
  position: relative;
  overflow: hidden;
  border-radius: 6px;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  letter-spacing: 0.04em;
  transition: transform 0.2s var(--transition-spring),
              box-shadow 0.2s ease,
              background-color 0.2s ease;
}
.btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.2s;
}
.btn-primary:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 24px rgba(87, 168, 255, 0.4);
}
.btn-primary:hover::before {
  opacity: 1;
}
.btn-primary:active {
  transform: translateY(0) scale(0.98);
}

/* ── Section headings ───────────────────────── */
.section-heading {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  letter-spacing: -0.02em;
  position: relative;
  display: inline-block;
}
.section-heading::after {
  content: '';
  display: block;
  width: 3rem;
  height: 3px;
  background: var(--accent);
  border-radius: 2px;
  margin: 0.6rem auto 0;
  box-shadow: 0 0 12px var(--accent-glow);
}

/* ── Offerings cards ────────────────────────── */
.page-section.bg-white .team-member,
.page-section.bg-light .team-member {
  background: #fff;
  border-radius: 16px;
  padding: 2rem 1.5rem 2rem;
  box-shadow: 0 2px 0 rgba(87,168,255,0.08),
              0 4px 20px rgba(0,0,0,0.06);
  transition: transform 0.3s var(--transition-spring),
              box-shadow 0.3s ease;
  border: 1px solid rgba(87, 168, 255, 0.1);
}
.page-section.bg-white .team-member:hover,
.page-section.bg-light .team-member:hover {
  transform: translateY(-6px);
  box-shadow: 0 0 0 1px var(--accent),
              0 16px 48px rgba(87, 168, 255, 0.18);
}
.page-section.bg-white .team-member img,
.page-section.bg-light .team-member img {
  transition: transform 0.4s var(--transition-spring),
              box-shadow 0.4s ease;
  border-color: rgba(87, 168, 255, 0.25) !important;
}
.page-section.bg-white .team-member:hover img,
.page-section.bg-light .team-member:hover img {
  transform: scale(1.06);
  box-shadow: 0 0 0 4px var(--accent-glow),
              0 8px 32px rgba(87, 168, 255, 0.3);
}

/* ── Products grid ──────────────────────────── */
#products .products-item {
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0,0,0,0.1);
  transition: transform 0.3s var(--transition-spring),
              box-shadow 0.3s ease;
}
#products .products-item:hover {
  transform: translateY(-8px) scale(1.01);
  box-shadow: 0 20px 60px rgba(87, 168, 255, 0.2);
}
#products .products-item .products-link .products-hover {
  background: linear-gradient(
    135deg,
    rgba(87, 168, 255, 0.92) 0%,
    rgba(13, 67, 160, 0.92) 100%
  );
  backdrop-filter: blur(4px);
  transition: opacity 0.3s ease;
}
#products .products-item .products-link .products-hover .products-hover-content i {
  filter: drop-shadow(0 0 12px rgba(255,255,255,0.6));
  transition: transform 0.3s var(--transition-spring);
}
#products .products-item .products-link:hover .products-hover .products-hover-content i {
  transform: scale(1.3) rotate(90deg);
}
#products .products-item .products-caption {
  background: linear-gradient(135deg, #ffffff 0%, #f0f6ff 100%);
  border-top: 2px solid var(--accent);
}
#products .products-item .products-caption .products-caption-heading {
  font-family: 'Space Grotesk', sans-serif;
  color: #1a2332;
}

/* ── Timeline ───────────────────────────────── */
.timeline > li .timeline-image {
  background: linear-gradient(135deg, var(--accent) 0%, #1a6fd4 100%);
  border-color: rgba(87, 168, 255, 0.3) !important;
  box-shadow: 0 0 0 4px rgba(87,168,255,0.15),
              0 8px 32px rgba(87, 168, 255, 0.25);
  transition: box-shadow 0.3s ease, transform 0.3s var(--transition-spring);
  /* Prevent the image circle from overlapping panel text on mobile */
  overflow: visible;
}
/* Only allow scale hover on larger screens where layout has room */
@media (min-width: 768px) {
  .timeline > li:hover .timeline-image {
    transform: scale(1.08);
    box-shadow: 0 0 0 6px rgba(87,168,255,0.25),
                0 12px 40px rgba(87, 168, 255, 0.4);
  }
}
.timeline > li .timeline-panel {
  background: rgba(255,255,255,0.97);
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.07);
  border: 1px solid rgba(87,168,255,0.1);
  transition: box-shadow 0.3s ease, transform 0.3s var(--transition-spring);
}
@media (min-width: 768px) {
  .timeline > li .timeline-panel {
    padding: 1.5rem 2rem !important;
  }
  .timeline > li:hover .timeline-panel {
    box-shadow: 0 8px 32px rgba(87,168,255,0.15);
    transform: translateY(-2px);
  }
}

/* ── Timeline mobile fix ────────────────────── */
@media (max-width: 767px) {
  /* Circle is 80px wide + 7px border each side = ~94px.
     Push panel content well past it. */
  .timeline > li .timeline-panel {
    padding: 0.75rem 0.75rem 0.75rem 110px !important;
    border-radius: 10px;
    background: rgba(255,255,255,0.97);
    box-shadow: 0 2px 10px rgba(0,0,0,0.07);
    border: 1px solid rgba(87,168,255,0.1);
    /* Hard-reset ALL transforms and transitions — no translateX, no scale */
    transform: none !important;
    transition: box-shadow 0.3s ease !important;
  }

  /* Lock circle to left rail, kill every transform variant */
  .timeline > li .timeline-image,
  .timeline > li .timeline-image.reveal-scale,
  .timeline > li .timeline-image.reveal-scale.revealed {
    left: 0 !important;
    margin-left: 0 !important;
    opacity: 1 !important;
    transform: none !important;
    transition: box-shadow 0.3s ease !important;
    z-index: 2;
  }

  /* Kill translateX reveals on panels */
  .timeline > li .timeline-panel.reveal-left,
  .timeline > li .timeline-panel.reveal-right,
  .timeline > li .timeline-panel.reveal-left.revealed,
  .timeline > li .timeline-panel.reveal-right.revealed {
    opacity: 1 !important;
    transform: none !important;
    transition: box-shadow 0.3s ease !important;
  }

  /* Heading sits below the circle top edge — add top padding so it
     doesn't start at the very same y-position as the circle */
  .timeline > li .timeline-panel .timeline-heading {
    padding-top: 0.25rem;
  }
}

/* ── Key Features grid ──────────────────────── */
.key-features-items {
  padding: 1rem;
  border-radius: 10px;
  transition: background 0.25s ease, transform 0.25s var(--transition-spring);
  align-items: center;
}
.key-features-items:hover {
  background: rgba(87, 168, 255, 0.07);
  transform: translateX(4px);
}
.key-features-items img {
  border-radius: 8px;
  flex-shrink: 0;
  transition: transform 0.3s var(--transition-spring),
              filter 0.3s ease;
}
.key-features-items:hover img {
  transform: scale(1.1) rotate(-2deg);
  filter: drop-shadow(0 4px 12px var(--accent-glow));
}
.key-features-items p {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.5;
}

/* ── Contact section ────────────────────────── */
section#contact {
  background: linear-gradient(160deg, #0d1117 0%, #121820 60%, #0f1924 100%) !important;
  position: relative;
  overflow: hidden;
}
section#contact::before {
  content: '';
  position: absolute;
  top: -30%;
  right: -10%;
  width: 60%;
  height: 80%;
  background: radial-gradient(ellipse, rgba(87,168,255,0.07) 0%, transparent 70%);
  pointer-events: none;
}
section#contact .form-control {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(87,168,255,0.2);
  color: #e6edf3;
  border-radius: 8px;
  transition: border-color 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}
section#contact .form-control:focus {
  background: rgba(87,168,255,0.06);
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px rgba(87,168,255,0.15) !important;
  color: #e6edf3;
}
section#contact .form-control::placeholder {
  color: #5a6880 !important;
  font-weight: 400 !important;
}

/* ── Footer ─────────────────────────────────── */
.footer {
  background: #0a0e14 !important;
  color: #8b949e;
  border-top: 1px solid rgba(87,168,255,0.1);
}
.footer a {
  color: var(--accent);
  transition: color 0.2s ease;
}
.footer a:hover {
  color: #fff;
}

/* ── Modal enhancements ─────────────────────── */
.products-modal .modal-content {
  border-radius: 16px;
  border: 1px solid rgba(87,168,255,0.15);
  box-shadow: 0 32px 80px rgba(0,0,0,0.3),
              0 0 0 1px rgba(87,168,255,0.1);
}

/* ── Scroll progress bar ────────────────────── */
#scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), #a8d4ff);
  box-shadow: 0 0 8px var(--accent-glow);
  z-index: 9999;
  width: 0%;
  transition: width 0.1s linear;
  border-radius: 0 2px 2px 0;
}

/* ── Stats counter row ──────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  background: linear-gradient(135deg, #0d1117 0%, #161b22 100%);
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--dark-border);
  margin: 4rem 0 2rem;
  box-shadow: 0 8px 40px rgba(0,0,0,0.3);
}
.stats-row .stat-item {
  padding: 2.5rem 2rem;
  text-align: center;
  border-right: 1px solid var(--dark-border);
  position: relative;
  overflow: hidden;
}
.stats-row .stat-item::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 2px;
  background: var(--accent);
  border-radius: 1px 1px 0 0;
  opacity: 0;
  transition: opacity 0.3s ease, width 0.3s ease;
}
.stats-row .stat-item:hover::before {
  opacity: 1;
}
.stats-row .stat-item:last-child {
  border-right: none;
}
.stats-row .stat-number {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 2.8rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  display: block;
}
.stats-row .stat-label {
  color: #8b949e;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 0.4rem;
  display: block;
}

/* ── Floating badge on offerings section ────── */
.offering-badge {
  display: inline-block;
  background: rgba(87,168,255,0.12);
  color: var(--accent);
  border: 1px solid rgba(87,168,255,0.25);
  border-radius: 99px;
  padding: 0.3rem 0.9rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 1rem;
}

/* ── Responsive ─────────────────────────────── */
@media (max-width: 576px) {
  .stats-row {
    grid-template-columns: 1fr;
  }
  .stats-row .stat-item {
    border-right: none;
    border-bottom: 1px solid var(--dark-border);
  }
  .stats-row .stat-item:last-child {
    border-bottom: none;
  }
}

/* ── Page load overlay ──────────────────────── */
#page-loader {
  position: fixed;
  inset: 0;
  background: #0d1117;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}
#page-loader.hidden {
  opacity: 0;
  visibility: hidden;
}
#page-loader .loader-logo {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.1em;
  animation: loaderPulse 1s ease infinite;
}
#page-loader .loader-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), #a8d4ff);
  animation: loaderBar 0.8s var(--transition-smooth) forwards;
}
@keyframes loaderPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
@keyframes loaderBar {
  from { width: 0; }
  to { width: 100%; }
}

/* ── Smooth image hover zoom for product pages ─ */
.modal-body img {
  border-radius: 10px;
  transition: transform 0.4s var(--transition-smooth),
              box-shadow 0.4s ease;
}
.modal-body img:hover {
  transform: scale(1.02);
  box-shadow: 0 12px 40px rgba(87,168,255,0.15);
}

/* ── Masthead CTA button glow pulse ─────────── */
@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(87,168,255,0); }
  50% { box-shadow: 0 0 0 10px rgba(87,168,255,0.18); }
}
header.masthead .btn-primary {
  animation: heroFadeUp 1s var(--transition-smooth) 0.65s both,
             glowPulse 3s ease 2s infinite;
}

/* ── Mobile scroll focus glow ───────────────────
   Applied by JS when element scrolls into centre
   of viewport on touch devices (no hover available)
─────────────────────────────────────────────────── */
@media (hover: none) and (pointer: coarse) {

  .team-member.mobile-focus,
  .page-section.bg-white .team-member.mobile-focus,
  .page-section.bg-light .team-member.mobile-focus {
    transform: translateY(-6px);
    box-shadow: 0 0 0 1px var(--accent),
                0 16px 48px rgba(87, 168, 255, 0.22);
    border-color: var(--accent) !important;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.4s ease,
                border-color 0.4s ease;
  }

  .products-item.mobile-focus {
    transform: translateY(-8px) scale(1.01);
    box-shadow: 0 20px 60px rgba(87, 168, 255, 0.22);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.4s ease;
  }

  .key-features-items.mobile-focus {
    background: rgba(87, 168, 255, 0.09);
    transform: translateX(4px);
    transition: background 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  .timeline > li .timeline-panel.mobile-focus {
    box-shadow: 0 8px 32px rgba(87, 168, 255, 0.18);
    border-color: rgba(87, 168, 255, 0.35) !important;
    transition: box-shadow 0.4s ease, border-color 0.4s ease;
  }

  /* Smooth out when focus leaves */
  .team-member,
  .products-item,
  .key-features-items,
  .timeline > li .timeline-panel {
    transition: transform 0.5s ease,
                box-shadow 0.5s ease,
                border-color 0.5s ease,
                background 0.5s ease;
  }
}