/* --- Custom Global Styling --- */
:root {
  --primary-color: #0d6efd; /* Bootstrap primary blue */
  --secondary-color: #1abc9c; /* A fresh teal/green for accent */
  --dark-text: #2c3e50;
  --light-bg: #f8f9fa;
  --card-bg: #ffffff;
  --brand-text: #2b5204;
  /* Estimated height of the sticky navbar; adjust if your navbar height changes */
  --navbar-height: 72px;
}

body {
  font-family: "Inter", "Lucida Sans Regular", "Lucida Grande",
    "Lucida Sans Unicode", Geneva, Verdana, sans-serif, sans-serif;
  color: var(--dark-text);
  background-color: #f4f6f9;
}

/* Ensure anchor jumps account for the sticky navbar so headings aren't hidden */
html {
  scroll-padding-top: var(--navbar-height);
  scroll-behavior: smooth;
}

/* Also apply a margin offset to section targets with IDs (used for nav anchors) */
section[id] {
  scroll-margin-top: calc(var(--navbar-height) + 12px);
}

.custom-navbar {
  background-color: rgba(217, 212, 191, 0.82) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  border-bottom: 3px solid var(--primary-color);
}

.custom-logo {
  font-weight: 800;
  color: var(--primary-color);
  font-size: 2.5rem;
}

/* Logo image sizing and alignment */
.custom-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.custom-logo .logo-img {
  height: 60px;
  width: auto;
  display: block;
  filter: drop-shadow(1px 1px 2px rgba(0, 0, 0, 0.4));
  transition: transform 0.3s ease;
}

@media (max-width: 576px) {
  .custom-logo .logo-img {
    height: 34px;
  }
}

.custom-logo:hover .logo-img {
  transform: scale(1.05);
}

/* Brand text to the right of the logo image */
.brand-text {
  font-weight: 700;
  color: var(--brand-text);
  margin-left: 0.5rem;
  font-size: 2.5rem;
  line-height: 1;
  display: inline-block;
}

/* Slightly smaller brand text on very small screens */
@media (max-width: 576px) {
  .brand-text {
    font-size: 0.92rem;
  }
}

/* Optionally hide text on extremely small widths to save space — uncomment if needed */
/* @media (max-width: 360px) { .brand-text { display: none; } } */

.nav-link {
  font-weight: 500;
  color: var(--dark-text);
}

.custom-btn-primary {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
  color: white;
  transition: all 0.3s;
}

.custom-btn-primary:hover {
  background-color: #0b5ed7;
  border-color: #0b5ed7;
  transform: translateY(-2px);
}

/* ------------------------------------------- */
/* Responsive navbar: improve touch targets on small screens */
/* ------------------------------------------- */
@media (max-width: 991px) {
  /* When the collapsed navbar is open (.show) make links stack and fill width */
  .navbar-collapse.show {
    position: absolute;
    background-color: #0b5ed7;
    padding: 0.5rem 1rem;
    z-index: 1050;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
  }

  .navbar-collapse.show .navbar-nav {
    width: 100%;
    display: block;
  }

  .navbar-collapse.show .navbar-nav .nav-item {
    width: 100%;
  }

  .navbar-collapse.show .navbar-nav .nav-link {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    color: var(--card-bg) !important; /* contrast on dark background */
    margin-bottom: 0.25rem;
  }

  .navbar-collapse.show .navbar-nav .nav-link:hover,
  .navbar-collapse.show .navbar-nav .nav-link:focus,
  .navbar-collapse.show .navbar-nav .nav-link.active {
    background-color: rgba(255, 255, 255, 0.08);
    color: var(--navbar-bg) !important;
  }

  /* Make the special nav button full-width inside collapsed menu */
  .navbar-collapse.show .navbar-nav .nav-link.btn.custom-btn-nav {
    display: block;
    width: 100%;
    text-align: center;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  /* Slightly larger toggler for easier tapping */
  .navbar-toggler {
    padding: 0.35rem 0.5rem;
    z-index: 1100; /* keep above the expanded menu */
  }
}

@media (max-width: 575px) {
  /* On very small screens, increase touch area and font size */
  .navbar-nav .nav-link {
    padding: 0.9rem 1rem;
    font-size: 1rem;
  }
}

.custom-btn-secondary {
  background-color: var(--secondary-color);
  border-color: var(--secondary-color);
  color: rgb(36, 18, 18);
  transition: all 0.3s;
}

.custom-btn-secondary:hover {
  background-color: #16a085;
  border-color: #16a085;
  transform: translateY(-2px);
}

.custom-btn-nav {
  background-color: var(--secondary-color);
  border-color: var(--secondary-color);
  color: white;
  font-weight: 600;
}

.hero-section {
  background: linear-gradient(135deg, #e9ecef 0%, var(--light-bg) 100%);
  padding: 8rem 0;
  position: relative; /* for absolute-positioned media */
  overflow: visible; /* keep video clipped to the hero */
  min-height: auto; /* Removed min-height to allow for more compact sizing */
  display: flex;
  align-items: center;
}

/* Hero media (video) sits behind content */
.hero-media {
  position: absolute;
  inset: 0; /* top:0; right:0; bottom:0; left:0; */
  z-index: 1;
  overflow: hidden;
}

.hero-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  display: block;
  pointer-events: none;
  transform: scale(1.02); /* slight upscaling to avoid letterboxing */
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.2) 0%,
    rgba(0, 0, 0, 0.35) 100%
  );
  z-index: 2;
  mix-blend-mode: multiply;
}

.hero-content {
  position: relative;
  z-index: 3; /* above video and overlay */
}

/* Hide video on small screens for performance and bandwidth savings */
@media (max-width: 768px) {
  .hero-section {
    min-height: 60vh; /* Give the hero section a minimum height to ensure video is visible */
    padding-top: 4rem; /* Adjust padding to ensure content looks good over the video */
    padding-bottom: 4rem;
  }
}

/* Respect reduced motion preferences: do not show the video */
@media (prefers-reduced-motion: reduce) {
  .hero-media,
  .hero-video {
    display: none;
  }
}

/* When the video is playing, show a semi-transparent panel behind the hero text for legibility */
.hero-section.video-playing .hero-inner {
  background: rgba(0, 0, 0, 0.274);
  padding: 1.25rem 1.5rem;
  border-radius: 10px;
  display: inline-block; /* shrinkwrap to content */
  transition: background-color 250ms ease, transform 250ms ease;
}

.hero-section.video-playing .hero-inner h1,
.hero-section.video-playing .hero-inner p {
  color: #ffffff !important;
}

/* Slightly adjust buttons when over the dark panel for contrast */
.hero-section.video-playing .hero-inner .custom-btn-primary,
.hero-section.video-playing .hero-inner .custom-btn-secondary {
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

@media (max-width: 768px) {
  /* On small screens video is hidden, but keep hero-inner full width for layout */
  .hero-inner {
    display: block;
    width: 100%;
    background: transparent !important;
    padding: 0;
    border-radius: 0;
  }
}

.hero-section h1 {
  color: var(--primary-color);
}

.custom-text-primary {
  color: var(--primary-color);
}

.custom-text-secondary {
  color: var(--secondary-color);
}

.custom-card-shadow {
  border: none;
  border-radius: 12px;
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);
  transition: box-shadow 0.3s ease;
}

.custom-card-shadow-hover:hover {
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
  transform: translateY(-3px);
}

.custom-form-control {
  border-radius: 8px;
  border: 1px solid #ced4da;
  padding: 10px 15px;
}

.custom-list-icons li {
  text-align: left;
  border: none !important;
  padding: 10px 0;
  font-size: 1.1rem;
}

.custom-footer {
  background-color: var(--dark-text);
  color: white;
  padding: 20px 0;
}

.custom-footer a {
  color: var(--secondary-color);
}

/* --- Flip Card Specific CSS --- */

.flip-card-container {
  perspective: 1000px; /* 3D effect perspective */
  height: 300px; /* Fixed height for consistency */
}

.flip-card {
  position: relative;
  width: 80%;
  height: 80%;
  text-align: center;
  transition: transform 0.8s;
  transform-style: preserve-3d;
  border-radius: 12px;
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  margin: 0 auto;
}

.flip-card:hover {
  transform: rotateY(180deg);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.flip-card-front,
.flip-card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  -webkit-backface-visibility: hidden; /* Safari */
  backface-visibility: hidden;
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.flip-card-front {
  background-color: var(--card-bg);
  color: var(--dark-text);
}

/* Ensure the small muted paragraph sits fixed at the bottom of the front face */
.flip-card-front p.text-muted.small.mb-0 {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  width: calc(100% - 40px); /* respect horizontal padding */
  text-align: center;
}

@media (max-width: 576px) {
  .flip-card-front p.text-muted.small.mb-0 {
    bottom: 8px;
    font-size: 0.85rem;
  }
}

.flip-card-back {
  background: linear-gradient(
    45deg,
    var(--secondary-color),
    var(--primary-color)
  );
  color: white;
  transform: rotateY(180deg);
  font-size: 0.95rem;
  text-align: left;
}

.flip-card-back h5 {
  font-weight: 700;
  margin-bottom: 0.75rem;
  text-align: center;
  width: 100%;
}

.flip-card-back p {
  text-align: center;
}

.flip-card-front i {
  font-size: 3rem;
  margin-bottom: 1rem;
  color: var(--primary-color);
}

/* --- Impact Stats Section CSS --- */
#impact-stats {
  background-color: var(--primary-color);
}

.impact-tile {
  background: #314022; /* Changed to a darker glassmorphism effect */
  padding: 25px 20px;
  border-radius: 12px;
  transition: background 0.3s ease;
  position: relative; /* for shine overlay */
  overflow: hidden;
  /* Keep tiles perfectly square across browsers */
  aspect-ratio: 1 / 1;
  width: 100%;
  box-sizing: border-box;
}

.impact-tile:hover {
  background: rgba(0, 0, 0, 0.25); /* Darker on hover */
}

.impact-number {
  font-size: 2.75rem;
  font-weight: 700;
  color: var(--secondary-color); /* Bright accent for the number */
  margin-bottom: 0.5rem;
}

.impact-label {
  font-size: 1rem;
  font-weight: 500;
  color: #d9d4bf;
  font-weight: bold;
  margin-bottom: 0;
}

/* Shine effect using a pseudo-element that sweeps across on hover */
.impact-tile::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -75%;
  width: 50%;
  height: 200%;
  background: linear-gradient(
    120deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.6) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  transform: rotate(25deg) translateX(-150%);
  transition: transform 0.8s ease;
  pointer-events: none;
  filter: blur(6px);
  opacity: 0.95;
}

.impact-tile:hover::before {
  transform: rotate(25deg) translateX(150%);
}

/* Only apply hover-triggered shine on devices that actually support hover (mouse)
   Prevents touch devices from activating :hover styles unintentionally. */
@media (hover: hover) and (pointer: fine) {
  .impact-tile:hover::before {
    transform: rotate(25deg) translateX(150%);
  }
}

/* Respect user preference for reduced motion */
@media (prefers-reduced-motion: reduce) {
  .impact-tile::before {
    transition: none;
    transform: none;
    opacity: 0;
  }
}

/* Support touch / mobile: allow the shine to trigger on active/focus and via a JS-added class */
.impact-tile:active::before,
.impact-tile:focus-within::before,
.impact-tile.shining::before {
  transform: rotate(25deg) translateX(150%);
  transition: transform 0.8s ease;
}

/* On very small screens keep the animation a bit snappier */
@media (max-width: 576px) {
  .impact-tile:active::before,
  .impact-tile:focus-within::before,
  .impact-tile.shining::before {
    transition: transform 0.6s ease;
  }
}

/* Center content inside impact tiles both vertically and horizontally */
.impact-tile {
  display: flex;
  flex-direction: column;
  justify-content: center; /* vertical centering */
  align-items: center; /* horizontal centering */
  text-align: center;
}

/* Make numbers slightly larger on bigger screens */
@media (min-width: 992px) {
  .impact-number {
    font-size: 3rem;
  }
}

@media (max-width: 576px) {
  .impact-number {
    font-size: 1.8rem;
  }
}

/* --- Map Specific CSS --- */
#project-map {
  height: 450px; /* Set a substantial height for the map */
  width: 100%;
  border-radius: 12px;
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);
  background-color: #e9ecef; /* A light placeholder background */
  margin-bottom: 2rem;
  position: relative;
}

/* Mobile adjustment: make cards stack more cleanly */
@media (max-width: 576px) {
  .flip-card-container {
    height: 165px;
  }
}

/* Improve shine coverage on very small screens: make the pseudo-element wider
   and start it further left so the sweep isn't clipped by the small tile width. */
@media (max-width: 576px) {
  .impact-tile::before {
    top: -40%;
    left: -120%;
    width: 240%;
    height: 180%;
    transform: rotate(25deg) translateX(-100%);
    transition: transform 0.6s ease;
    filter: blur(6px);
  }

  .impact-tile:active::before,
  .impact-tile.shining::before {
    transform: rotate(25deg) translateX(100%);
  }

  /* When a tile is actively shining, elevate it above its neighbors to
     prevent visual overlap on small screens. */
  .impact-tile.shining {
    position: relative;
    z-index: 5;
  }
}

/* General responsive improvements */
/* Make media scale nicely */
img,
picture,
video,
iframe {
  max-width: 100%;
  height: auto;
}

/* Hero responsiveness: reduce padding and font sizes on smaller screens */
@media (max-width: 1200px) {
  .hero-section {
    padding: 2.5rem 0; /* Reduced padding */
  }
}

@media (max-width: 991px) {
  .hero-section {
    padding: 2rem 0; /* Reduced padding */
    min-height: auto; /* Ensure min-height is auto */
  }
  .container-fluid.px-5 {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  .hero-section h1 {
    font-size: 2rem; /* Slightly reduced font size */
    line-height: 1.05;
  }
  .hero-section .lead {
    font-size: 1rem;
  }
}

@media (max-width: 576px) {
  .hero-section {
    padding: 1.5rem 0; /* Reduced padding */
    min-height: auto; /* Ensure min-height is auto */
  }
  .hero-section h1 {
    font-size: 1.6rem;
  }
  .hero-section .lead {
    font-size: 0.95rem;
  }
  .container-fluid.px-5 {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  /* Flip-cards: use full width inside their grid columns on small screens */
  .flip-card {
    width: 100%;
    height: 100%;
  }
  .flip-card-front,
  .flip-card-back {
    padding: 12px;
  }

  /* Impact tiles: reduce padding so tiles fit well on small screens */
  .impact-tile {
    padding: 18px 12px;
  }
}

/* Larger screens: give the map a taller presence */
@media (min-width: 992px) {
  #project-map {
    height: 420px;
  }
}

/* Tablet-ish screens */
@media (min-width: 768px) and (max-width: 991px) {
  #project-map {
    height: 340px;
  }
}

/* Improve touch targets for buttons in hero on small screens */
@media (max-width: 576px) {
  .hero-inner .btn {
    padding: 0.65rem 0.9rem;
    font-size: 0.95rem;
  }
}

/* Ensure flip card text isn't too large on small screens */
@media (max-width: 480px) {
  .flip-card-back p,
  .flip-card-back h5,
  .flip-card-front h4 {
    font-size: 0.9rem;
  }
}

/* --- Our Clients Section --- */
.client-logos-container {
  display: flex;
  flex-wrap: wrap; /* Allow wrapping on smaller screens */
  justify-content: space-evenly; /* Distribute logos with equal space around them */
  align-items: center;
  background-color: #d9d4bf;
  border-radius: 10px;
  padding: 4rem 2rem; /* Reduced vertical padding from 10rem to 4rem */
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);
}

.client-logo {
  flex-shrink: 1; /* Allow logos to shrink if needed */
}

.client-logo img {
  max-height: 80px; /* Slightly reduce max height */
  width: auto;
  max-width: 160px; /* Reduce max width to fit more logos */
  filter: grayscale(100%);
  opacity: 0.65;
  transition: filter 0.3s ease, opacity 0.3s ease, transform 0.3s ease;
}

.client-logo img:hover {
  filter: grayscale(0%);
  opacity: 1;
  transform: scale(1.05);
}

/* --- Our Team Section --- */
.team-card {
  background-color: #718c4959;
  padding: 2rem 1rem;
  border-radius: 12px;
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease;
}

.team-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
  background-color: #718c49;
  transition-delay: 0.3s;
}

.team-img-wrapper {
  position: relative;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  margin: 0 auto; /* Center the wrapper in the card */
}

/* The pseudo-element that will be our rotating border */
.team-img-wrapper::before {
  content: "";
  position: absolute;
  top: -4px;
  left: -4px;
  right: -4px;
  bottom: -4px;
  border: 4px solid var(--primary-color);
  border-radius: 50%;
  transition: transform 0.8s ease-in-out;
}

.team-card:hover .team-img-wrapper::before {
  transform: rotate(360deg);
}

.team-img {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  object-fit: cover;
  object-position: top; /* Ensure the top of the image (head) is visible */
  /* The border is now on the wrapper's pseudo-element */
}

.team-name {
  font-weight: 700;
  color: var(--dark-text);
}
/* --- Scroll Progress Bar --- */
#scroll-progress {
  position: fixed;
  top: 0; /* change to 'bottom: 0;' to move bar to bottom */
  left: 0;
  right: 0;
  height: 4px;
  background: transparent;
  z-index: 1200; /* above header */
  pointer-events: none; /* shouldn't interfere with clicks */
}

#scroll-progress .bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(
    90deg,
    var(--secondary-color),
    var(--primary-color)
  );
  /* Make the background gradient wider than the bar */
  background-size: 200% 100%;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
  /* Animate both width and background position */
  transition: width 120ms linear, background-position 0.3s ease;
  /* Link the animation to the keyframes below */
  -webkit-animation: shimmer-progress 4s linear infinite; /* For Safari/Chrome */
  animation: shimmer-progress 4s linear infinite;
}

/* Thicker bar option for large screens */
@media (min-width: 992px) {
  #scroll-progress {
    height: 6px;
  }
}

/* Keyframes with vendor prefix for wider compatibility */
@-webkit-keyframes shimmer-progress {
  from {
    background-position: 200% 0; /* Start from the right */
  }
  to {
    background-position: -200% 0; /* Move to the left */
  }
}

/* Keyframes for the shimmering background animation is now the last custom style */
@keyframes shimmer-progress {
  from {
    background-position: 200% 0;
  }
  to {
    background-position: -200% 0;
  }
}

/* --- Accordion Carousel Sizing --- */
.accordion .carousel-item {
  max-height: 500px; /* <-- Reduced from 350px to make images smaller */
  /* max-height is removed to allow the container to fit the image height */
  background-color: #e9ecef; /* Adds a background color for images that might not load instantly */
}

.accordion .carousel-item img {
  width: 100%;
  height: 500px; /* Match the new max-height of the item */
  object-fit: cover; /* Ensures the image covers the area without distortion, cropping if necessary */
  height: auto; /* Allow the image's natural height to be used */
  object-fit: contain; /* Ensures the entire image is visible without being cropped */
  object-position: center; /* Centers the image within the frame */
}

/* Responsive adjustment for smaller screens */
@media (max-width: 768px) {
  .accordion .carousel-item,
  .accordion .carousel-item img {
    height: 220px; /* Reduced height for mobile devices */
    height: auto; /* Allow natural height on mobile */
    max-height: 300px; /* Set a max-height for mobile devices to avoid overly large images */
  }
}

/* --- Accordion Custom Styling --- */
.accordion-button {
  transition: background 0.3s ease, color 0.3s ease;
}

/* Style for the collapsed (default) state */
.accordion-button.collapsed {
  background: linear-gradient(135deg, #ffffff, #e9ecef);
  color: var(--dark-text);
  font-weight: 600;
}

/* Style for the expanded (active) state */
.accordion-button:not(.collapsed) {
  background: linear-gradient(
    135deg,
    var(--secondary-color),
    var(--primary-color)
  );
  color: white;
  font-weight: 600;
  box-shadow: inset 0 -3px 5px rgba(0, 0, 0, 0.15);
}

/* Change the color of the default Bootstrap icon to white when expanded */
.accordion-button:not(.collapsed)::after {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23ffffff'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e");
}

/* Ensure custom icons and spinners also turn white when expanded */
.accordion-button:not(.collapsed) i,
.accordion-button:not(.collapsed) .spinner-border {
  color: white !important;
}

/* --- Custom color for the accordion title text --- */
.accordion-button.collapsed .flex-grow-1 {
  color: var(
    --primary-color
  ); /* Custom color for the title in collapsed state */
}

.accordion-button:not(.collapsed) .flex-grow-1 {
  color: #314022; /* Ensure title remains white for contrast in expanded state */
}

/* Responsive styles for team member images on mobile */
@media (max-width: 767.98px) {
  .team-img-wrapper {
    max-width: 100px; /* Smaller width for the image container */
    height: 100px; /* Smaller height to maintain the circle shape */
    margin-left: auto; /* Center the smaller image container */
    margin-right: auto; /* Center the smaller image container */
  }
  .team-img {
    width: 100%; /* Ensure image fills the wrapper's width */
    height: 100%; /* Ensure image fills the wrapper's height */
    object-fit: cover; /* Scale image to cover the container without distortion */
  }
  .team-card .team-name {
    font-size: 1rem; /* Adjust name font size for mobile */
  }
  .team-card .team-designation {
    font-size: 0.875rem; /* Adjust designation font size for mobile */
  }
  /* Adjust client logo size for mobile to fit three in a row */
  .client-logo {
    flex: 0 1 25%; /* Allows three logos per row with spacing */
  }
  /* Reduce map height on mobile devices */
  #project-map {
    height: 350px !important; /* A more suitable height for mobile screens */
  }
  /* Adjust flip card title font size for mobile */
  .flip-card-front i {
    font-size: 2.5rem; /* Reduced icon size for mobile */
  }
  .flip-card-front .card-title {
    font-size: 0.9rem; /* A more appropriate size for mobile titles */
  }
}
