/* ============================================
   CirFarm — Custom Styles
   East African Tech Aesthetic
   ============================================ */

/* --- Base & Scroll --- */
html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', sans-serif;
  overflow-x: hidden;
}

/* --- Scroll-Triggered Reveal Animations --- */
.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

.reveal-left {
  opacity: 0;
  transform: translateX(-60px);
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal-left.active {
  opacity: 1;
  transform: translateX(0);
}

.reveal-right {
  opacity: 0;
  transform: translateX(60px);
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal-right.active {
  opacity: 1;
  transform: translateX(0);
}

.reveal-scale {
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal-scale.active {
  opacity: 1;
  transform: scale(1);
}

/* Stagger children */
.stagger-children > * {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.stagger-children.active > *:nth-child(1) { transition-delay: 0.05s; }
.stagger-children.active > *:nth-child(2) { transition-delay: 0.15s; }
.stagger-children.active > *:nth-child(3) { transition-delay: 0.25s; }
.stagger-children.active > *:nth-child(4) { transition-delay: 0.35s; }
.stagger-children.active > *:nth-child(5) { transition-delay: 0.45s; }
.stagger-children.active > *:nth-child(6) { transition-delay: 0.55s; }

.stagger-children.active > * {
  opacity: 1;
  transform: translateY(0);
}

/* --- Circuit Board Pattern (for Kukulezi AI Section) --- */
.circuit-pattern {
  background-image:
    radial-gradient(circle, rgba(61, 107, 53, 0.15) 1px, transparent 1px),
    linear-gradient(rgba(61, 107, 53, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(61, 107, 53, 0.06) 1px, transparent 1px);
  background-size: 20px 20px, 40px 40px, 40px 40px;
  background-position: 0 0, -1px -1px, -1px -1px;
}

.circuit-lines {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(0deg, transparent 24%,
      rgba(61, 107, 53, 0.04) 25%,
      rgba(61, 107, 53, 0.04) 26%,
      transparent 27%, transparent 74%,
      rgba(61, 107, 53, 0.04) 75%,
      rgba(61, 107, 53, 0.04) 76%,
      transparent 77%, transparent),
    linear-gradient(90deg, transparent 24%,
      rgba(61, 107, 53, 0.04) 25%,
      rgba(61, 107, 53, 0.04) 26%,
      transparent 27%, transparent 74%,
      rgba(61, 107, 53, 0.04) 75%,
      rgba(61, 107, 53, 0.04) 76%,
      transparent 77%, transparent);
  background-size: 60px 60px;
  pointer-events: none;
}

/* --- Animated Gradient for Hero --- */
.hero-gradient {
  background: linear-gradient(
    135deg,
    #1a1a2e 0%,
    #16213e 25%,
    #1a3a1a 50%,
    #2d1810 75%,
    #1a1a2e 100%
  );
  background-size: 400% 400%;
  animation: heroShift 12s ease-in-out infinite;
}

@keyframes heroShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* --- Floating Particles (Hero) --- */
.particle {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  animation: particleFloat linear infinite;
}

@keyframes particleFloat {
  0% {
    transform: translateY(0) translateX(0) scale(1);
    opacity: 0;
  }
  10% { opacity: 0.6; }
  90% { opacity: 0.6; }
  100% {
    transform: translateY(-100vh) translateX(50px) scale(0.3);
    opacity: 0;
  }
}

/* --- Product Card Slide-In --- */
.product-card {
  opacity: 0;
  transform: translateY(50px) scale(0.95);
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.product-card.slide-in {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.product-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

/* --- Partner Logo Grayscale Effect --- */
.partner-logo {
  filter: grayscale(100%) opacity(0.5);
  transition: filter 0.4s ease, transform 0.4s ease;
}

.partner-logo:hover {
  filter: grayscale(0%) opacity(1);
  transform: scale(1.1);
}

/* --- Navbar Scroll Effect --- */
.navbar {
  transition: background-color 0.3s ease,
              backdrop-filter 0.3s ease,
              box-shadow 0.3s ease;
}

.navbar.scrolled {
  background-color: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.navbar.scrolled .nav-link {
  color: #1a1a1a;
}

.navbar.scrolled .nav-logo-text {
  color: #2B5528;
}

/* --- Mobile Menu --- */
.mobile-menu {
  transform: translateX(100%);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.mobile-menu.open {
  transform: translateX(0);
}

.mobile-menu-overlay {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.mobile-menu-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

/* --- Counter Animation --- */
.counter {
  display: inline-block;
  min-width: 2ch;
}

/* --- PTD Card Connector Lines --- */
.ptd-connector {
  position: relative;
}

.ptd-connector::after {
  content: '';
  position: absolute;
  top: 50%;
  right: -1.5rem;
  width: 3rem;
  height: 2px;
  background: linear-gradient(90deg, #3D6B35, #D4882A);
}

@media (max-width: 767px) {
  .ptd-connector::after {
    display: none;
  }
}

/* --- Glowing Dot Pulse --- */
.glow-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #3D6B35;
  box-shadow: 0 0 10px #3D6B35, 0 0 20px rgba(61, 107, 53, 0.4);
  animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% {
    box-shadow: 0 0 10px #3D6B35, 0 0 20px rgba(61, 107, 53, 0.4);
  }
  50% {
    box-shadow: 0 0 20px #3D6B35, 0 0 40px rgba(61, 107, 53, 0.6);
  }
}

/* --- Custom Scrollbar --- */
::-webkit-scrollbar {
  width: 8px;
}

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

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #3D6B35, #2B5528);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #5A9A3B, #3D6B35);
}

/* --- Stat Bar Animation --- */
.stat-bar {
  width: 0%;
  transition: width 1.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.stat-bar.animated {
  width: var(--target-width);
}

/* --- Selection Color --- */
::selection {
  background: rgba(61, 107, 53, 0.2);
  color: #1a1a1a;
}

/* --- African-Inspired Kente Border Pattern --- */
.kente-border {
  background-image:
    repeating-linear-gradient(
      90deg,
      #3D6B35 0px, #3D6B35 8px,
      #D4882A 8px, #D4882A 16px,
      #6D4C41 16px, #6D4C41 24px,
      #E07060 24px, #E07060 32px
    );
  height: 4px;
}

.kente-border-thin {
  background-image:
    repeating-linear-gradient(
      90deg,
      #3D6B35 0px, #3D6B35 6px,
      #D4882A 6px, #D4882A 12px,
      #6D4C41 12px, #6D4C41 18px,
      #E07060 18px, #E07060 24px
    );
  height: 3px;
}

/* --- African Mudcloth-Inspired Subtle Texture --- */
.mudcloth-bg {
  background-image:
    radial-gradient(circle at 25% 25%, rgba(61, 107, 53, 0.03) 2px, transparent 2px),
    radial-gradient(circle at 75% 75%, rgba(212, 136, 42, 0.03) 2px, transparent 2px);
  background-size: 30px 30px;
}

/* --- Navbar Logo Swap --- */
.nav-logo-dark { display: none; }
.nav-logo-light { display: block; }
.navbar.scrolled .nav-logo-dark { display: block; }
.navbar.scrolled .nav-logo-light { display: none; }

/* --- Hero Image Overlay for FM/MP labels --- */
.hero-split-img {
  position: relative;
}

.hero-split-img::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    transparent 40%,
    rgba(0, 0, 0, 0.45) 100%
  );
  border-radius: inherit;
  pointer-events: none;
}

/* --- Product Section: Floating Collage Background --- */
.product-collage-bg {
  position: absolute;
  top: -60px;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  max-width: 90vw;
  height: auto;
  opacity: 0.04;
  pointer-events: none;
  z-index: 0;
  filter: grayscale(100%);
  mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, black 0%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, black 0%, transparent 70%);
}

@media (min-width: 768px) {
  .product-collage-bg {
    width: 800px;
    top: -80px;
    opacity: 0.05;
  }
}

@media (min-width: 1024px) {
  .product-collage-bg {
    width: 1000px;
    top: -100px;
    opacity: 0.06;
  }
}
