/* ======================= GLOBAL STYLES ======================= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", sans-serif;
  background: #f4f8fb;
}

html {
  scroll-behavior: smooth;
}

:root {
  /* Colors */
  --color-primary: #002d72;
  --color-secondary: #0033a0;
  --color-accent: #ff7f00;
  --color-accent-hover: #e86b00;
  --color-bg: #f4f8fb;
  --color-white: #ffffff;
  --color-shadow: rgba(0, 0, 0, 0.5);
  --color-black: #000;
  --color-dark: #222;
  --color-dark-muted: #000000be;
  --color-light: #eef3f8;


  /* Fonts */
  --font-main: "Segoe UI", sans-serif;
  --font-heading: "Montserrat", sans-serif;

  /* Spacing */
  --space-xs: 8px;
  --space-sm: 16px;
  --space-md: 25px;
  --space-lg: 40px;

  /* Navbar */
  --navbar-height: 70px;
  --navbar-height-mobile: 60px;
}

/* ======================= GENERAL UTILITY ======================= */

.hidden {
  display: none;
}

/* ======================= NAVBAR ======================= */
/* --- Base --- */
.navbar {
  position: fixed;
  top: 0;
  width: 100%;
  height: var(--navbar-height);
  background: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-lg);
  z-index: 1000;
  overflow: hidden;
  transition: box-shadow 0.3s ease;
}

.navbar.scrolled {
  box-shadow: 0 5px 15px var(--color-shadow);
}

/* Gradient accents */
.navbar::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 20%;
  background: linear-gradient(135deg, #0045ae, var(--color-primary));
  clip-path: polygon(0 0, 100% 0, 85% 100%, 0 100%);
  z-index: 0;
}

.navbar::after {
  content: "";
  position: absolute;
  inset: 0 0 0 auto;
  width: 80px;
  background: var(--color-accent);
  clip-path: polygon(15% 0, 100% 0, 100% 100%, 0 100%);
  z-index: 0;
}

/* Ensure content is above accents */
.navbar > * {
  position: relative;
  z-index: 1;
}

/* Navbar capstone logo */
.nav-logo {
  height: 45px;
  filter: brightness(0.75) contrast(1.2);
}

/* --- Desktop --- */
.nav-right {
  display: flex;
  gap: var(--space-md);
}

.nav-right a {
  color: var(--color-white);
  text-decoration: none;
  transition: color 0.2s ease;
}

.nav-right a:hover,
.nav-right a:focus {
  color: var(--color-accent);
  outline: none;
}

.donate {
  color: var(--color-white);
  text-decoration: none;
  margin-left: var(--space-md);
  padding: 0.5rem 1.2rem;
  background: var(--color-accent);
  border-radius: 8px;
  font-weight: 700;
  transition: background 0.3s ease, transform 0.2s ease;
}

.donate:hover,
.donate:focus {
  color: var(--color-dark);
  background: var(--color-accent-hover);
  transform: translateY(-2px);
  outline: none;
}

/* --- Mobile --- */
.nav-toggle {
  display: none;
  font-size: 2rem;
  background: none;
  border: none;
  color: var(--color-white);
  cursor: pointer;
}

@media (max-width: 768px) {
  .navbar {
    padding: 0 var(--space-md);
    height: var(--navbar-height-mobile);
  }

  .nav-toggle {
    display: block;
  }

  /* Little crude, but moves it from the right to the left to make more sense*/
  .nav-right {
    position: fixed;
    top: var(--navbar-height-mobile);
    left: -100%;
    width: 60%;
    height: calc(100vh - var(--navbar-height-mobile));
    background: var(--color-primary);
    flex-direction: column;
    padding: var(--space-lg);
    gap: var(--space-md);
    transition: left 0.3s ease;
    z-index: 1001;
  }

  .nav-right.active {
    left: 0;
  }

  .nav-right a {
    font-size: 1.2rem;
  }
}

/* ======================= HERO ======================= */
/* --- Base Layout --- */
#hero {
  position: relative;
  height: 100vh;
  overflow: hidden;
  background: linear-gradient(rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2));
}

#buggyCanvas {
  position: absolute;
  inset: 0;
  z-index: 0;
}

/* --- Hero Content Container --- */
.hero-content {
  position: absolute;
  top: 50%;
  right: 10%;
  transform: translateY(-50%);
  max-width: 480px;
  padding: 2.5rem 2rem;
  background: rgba(0, 31, 77, 0.85);
  border-radius: 20px;
  color: var(--color-white);
  z-index: 10;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
}

.click-prompt {
  position: absolute;
  top: 50%;
  left: 10%;
  transform: translateY(-50%);
  max-width: 480px;
  padding: 1rem 1rem;
  background: rgba(0, 31, 77, 0.85);
  border-radius: 20px;
  color: #fc0;
  z-index: 10;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
  animation: bounceUpDown 2s ease-in-out infinite;
}

@keyframes bounceUpDown {
  0%, 100% {
    transform: translateY(-50%) translateY(0);
  }
  50% {
    transform: translateY(-50%) translateY(-20px);
  }
}


/* --- Typography --- */
.hero-content h1 {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: clamp(2.2rem, 5vw, 3.5rem);
  margin-bottom: 0.75rem;
  color: #fc0;
}

.hero-content p {
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  margin-bottom: 1.25rem;
  line-height: 1.5;
  color: var(--color-white);
}

.hero-tagline {
  font-size: 1rem;
  font-style: italic;
  opacity: 0.85;
}

/* --- Call-to-Action Buttons --- */
.hero-buttons a,
.hero-buttons button {
  display: inline-block;
  margin-right: 0.9rem;
  background: var(--color-accent);
  color: var(--color-white);
  padding: 0.75rem 1.5rem;
  border-radius: 12px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
}

.hero-buttons a:hover,
.hero-buttons button:hover {
  background: var(--color-accent-hover);
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

/* --- LIDAR / Grid Toggle --- */
.hero-grid-toggle {
  position: absolute;
  top: 1.25rem;
  left: 1.25rem;
  z-index: 10;
}

.hero-grid-toggle button {
  padding: 0.5rem 1rem;
  font-size: 1rem;
  background: var(--color-primary);
  color: var(--color-white);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.hero-grid-toggle button:hover,
.hero-grid-toggle button:focus {
  background: var(--color-secondary);
  outline: none;
  transform: translateY(-1px);
}

/* --- Responsiveness ---*/
/* Medium screens */
@media (max-width: 1200px) {
  .hero-content {
    right: 5%;
    left: 5%;
    max-width: unset;
    padding: 1.875rem 1.25rem;
  }

  .click-prompt {
    top: 75%;
  }
}

/* Tablet screens */
@media (max-width: 768px) {
  .hero-content h1 {
    font-size: clamp(1.8rem, 6vw, 2.2rem);
  }

  .hero-content p {
    font-size: clamp(0.9rem, 3vw, 1rem);
  }
}

/* Mobile screens */
@media (max-width: 480px) {
  .hero-buttons a,
  .hero-buttons button {
    margin-right: 0.625rem;
    padding: 0.625rem 1.125rem;
    font-size: 0.9rem;
  }
}

/* ================= PROJECT ================= */
.project-section {
  display: grid;
  grid-template-columns: 2fr 1fr; /* left | right */
  gap: 2.5rem; /* consistent spacing */
  padding: 7.5rem 10%; /* vertical + horizontal spacing */
  background: var(--color-white);
  border-top: 6px solid var(--color-primary);
  border-bottom: 6px solid var(--color-primary);
}

.project-left h2 {
  color: var(--color-primary);
  font-size: clamp(2rem, 3vw, 2.5rem);
  margin-bottom: 0.75rem;
}

.project-right h3 {
  color: var(--color-primary);
  margin-bottom: 0.5rem;
}

.project-right ul {
  padding-left: 0; /* remove default ul padding */
  margin: 0;
}

.project-right ul li {
  margin-bottom: 0.5rem;
  list-style: none;
  position: relative;
  padding-left: 1.25rem; /* space for custom bullet */
}

.project-right ul li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--color-accent);
  font-weight: bold;
}

/* Medium screens */
@media (max-width: 1200px) {
  .project-section {
    grid-template-columns: 1fr; /* stack columns */
    padding: 5rem 5%; /* reduce padding for smaller screens */
  }

  .project-left h2 {
    text-align: center;
    margin-bottom: 1.5rem;
  }

  .project-right {
    text-align: center;
  }
}

/* Small screens */
@media (max-width: 768px) {
  .project-right ul li {
    padding-left: 1rem; /* slightly smaller indent */
  }
}


/* ======================= GALLERY ======================= */

/* --- Gallery Layout --- */
.gallery-section {
  display: grid;
  grid-template-columns: 2fr 1fr 2fr; /* left | center | right */
  height: 100vh;
  padding: 0;
  border-bottom: 6px solid var(--color-primary);
}

.gallery-center {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  position: relative;
}

.gallery-center img {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  height: calc(106% + 3rem); /* scalable padding */
  width: 100%;
  object-fit: cover;
  z-index: 0;
  filter: brightness(0) saturate(100%) invert(15%) sepia(88%) saturate(3000%)
          hue-rotate(204deg) brightness(92%) contrast(105%);
}

/* --- Gallery Buttons / Columns --- */
.gallery-column {
  display: flex;
  flex-direction: column;
  background: var(--color-black);
}

.gallery-btn {
  position: relative;
  flex: 1;
  font-size: 1.5rem;
  color: var(--color-white);
  background-size: cover;
  background-position: center;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 0.25rem 0.25rem rgba(36, 36, 36, 0.2);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  z-index: 1;
}

.gallery-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  transition: background 0.3s ease, transform 0.3s ease;
}

.gallery-btn span {
  position: relative;
  z-index: 2;
  font-weight: 700;
}

.gallery-btn:hover {
  z-index: 3;
  transform: scale(1.03);
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.3);
}

.gallery-btn:active {
  transform: scale(0.97);
  box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.2);
}

/* Specific gallery button images */
.gallery-btn.brakes {
  background-image: url("Images/Gallery/Icons/GalleryIcon_Brake.webp");
}

.gallery-btn.steering {
  background-image: url("Images/Gallery/Icons/GalleryIcon_Steering.webp");
}

.gallery-btn.throttle {
  background-image: url("Images/Gallery/Icons/GalleryIcon_Throttle.webp");
}

.gallery-btn.sensors {
  background-image: url("Images/Gallery/Icons/GalleryIcon_Senors.webp");
}

.gallery-btn.navigation {
  background-image: url("Images/Gallery/Icons/GalleryIcon_EnviromentFabrication.webp");
}

.gallery-btn.electrical.design {
  background-image: url("Images/Gallery/Icons/GalleryIcon_Wiring.svg");
}

/* --- Gallery Modal --- */
.gallery-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  z-index: 2000;
  transition: opacity 0.25s ease;
}

.gallery-modal.show {
  opacity: 1;
  pointer-events: auto;
}

.gallery-modal-content {
  background: var(--color-white);
  width: 90%;
  max-width: 56.25rem; /* 900px */
  max-height: 85vh;
  border-radius: 1.25rem;
  padding: 1.875rem;
  box-shadow: 0 1.5rem 3.75rem rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
}

.gallery-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.gallery-modal-header h2 {
  font-size: 2rem;
  color: #002d72;
}

/* Back button inside modal */
.back-btn {
  background: #0033a0;
  color: white;
  border: none;
  padding: 8px 16px;
  font-size: 1rem;
  border-radius: 8px;
  cursor: pointer;
}

.back-btn:hover {
  background: #0055c8;
}

/* --- Gallery Carousel --- */
.gallery-carousel {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 900px;
  height: 70vh;
  overflow: hidden;
}

/* Carousel images */
#prevImage,
#carouselImage,
#nextImage {
  position: absolute;
  transition: all 0.3s ease;
  object-fit: contain;
}

#prevImage,
#nextImage  {
  opacity: 0.4;
  transform: translateY(-50%) scale(0.6);
  filter: brightness(0.4);
  z-index: 0;
  max-height: 250px;
}

#prevImage {
  left: 0%;
}

#nextImage {
  right: 0;
}

#carouselImage {
  transform: translate(-50%, -50%);
  max-height: 70vh;
  z-index: 1;
  width: 50%;
}

#carouselImage.selected {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(1.25);
  width: auto;
  height: 80vh;
  max-height: 80vh;
  z-index: 10;
}

.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 2rem;
  width: 2.5rem;
  height: 2.5rem;
  background: rgba(0, 45, 114, 0.85);
  color: var(--color-white);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 3;
}

.carousel-btn.left { left: 0; }
.carousel-btn.right { right: 0; }

.carousel-btn:hover { background: var(--color-primary); }

/* --- Scroll Fade-In Animation --- */
.fade-in {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

.project-left.fade-in {
  transition-delay: 0.1s;
}

.project-right.fade-in {
  transition-delay: 0.3s;
}

/* --- Loading Spinner --- */
.loading-spinner {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.loading-spinner.hidden {
  display: none;
}

.spinner {
  border: 8px solid #f3f3f3;
  border-top: 8px solid #ff7f00;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  animation: spin 2s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* --- Responsive Gallery --- */
/* Medium screens */
@media (max-width: 1200px) {
  .gallery-center img {
    display: none; /* hide center image for smaller screens */
  }

  .gallery-section {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    height: auto;
    padding: 1.25rem 5%;
  }

  .gallery-column {
    flex-direction: row;
    gap: 1rem;
  }

  .gallery-btn {
    flex: 1;
    height: 12.5rem;
  }
}

/* Small screens */
@media (max-width: 768px) {
  .gallery-column {
    flex-direction: column;
    height: 37.5rem;
    gap: 1rem;
  }

  .gallery-column > * {
    flex: 1 1 0;
    min-height: 15vh;
  }
}


/* ================= TEAM CTA ================= */
.team-cta {
  padding: 6.25rem 10%; /* 100px top/bottom */
  background: var(--color-light); /* subtle background */
  border-top: 0.375rem solid var(--color-primary); /* 6px */
  border-bottom: 0.375rem solid var(--color-primary);
  text-align: center;
}

.team-cta h2 {
  font-size: clamp(2rem, 4vw, 2.5rem);
  color: var(--color-primary);
  margin-bottom: 1.25rem;
}

.team-cta p {
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  max-width: 43.75rem; /* 700px */
  margin: 0 auto 2.5rem;
  color: var(--color-dark);
}

.team-cta-btn {
  display: inline-block;
  background: var(--color-accent);
  color: var(--color-white);
  padding: 0.9375rem 2.5rem; /* 15px x 40px */
  font-size: 1.2rem;
  font-weight: 600;
  border-radius: 0.625rem;
  text-decoration: none;
  transition: all 0.3s ease;
}

.team-cta-btn:hover {
  background: #e86b00; /* slightly darker accent */
  transform: translateY(-0.1875rem); /* 3px */
  box-shadow: 0 0.375rem 1.125rem rgba(0, 0, 0, 0.15); /* 6px 18px */
}


/* ================= TEAM SECTION ================= */
.team-section {
  display: grid;
  grid-template-columns: 1fr 1fr; /* Mechanical | Electrical */
  gap: 3.75rem; /* 60px */
  padding: 6.25rem 6%; /* 100px vertical */
}

.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11.25rem, 1fr)); /* 180px */
  gap: 1.875rem; /* 30px */
}

/* --- TEAM CARD --- */
.team-card {
  background: var(--color-white);
  padding: 1.5625rem; /* 25px */
  border-radius: 1rem; /* 16px */
  text-align: center;
  cursor: pointer;
  box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.18); /* 4px 12px */
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.team-card:hover {
  transform: translateY(-0.3125rem); /* 5px */
  box-shadow: 0 0.75rem 1.5rem rgba(0, 0, 0, 0.15); /* 12px 24px */
}

/* --- TEAM CARD CONTENT --- */
.team-card img {
  width: 6.875rem; /* 110px */
  height: 6.875rem;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 0.9375rem; /* 15px */
}

.team-card h3 {
  font-size: 1.2rem;
  color: var(--color-primary);
  margin-bottom: 0.3125rem; /* 5px */
}

.team-card p.role {
  font-size: 1rem;
  color: var(--color-dark-muted);
  margin-bottom: 0.625rem; /* 10px */
}

.team-card a {
  font-size: 0.9375rem; /* 15px */
  color: var(--color-accent);
  text-decoration: none;
}

.team-card a:hover {
  text-decoration: underline;
}

/* --- Team Modal --- */
.teamRoles {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  width: 100%;
  margin: 0 auto;
}

#teamRoleOne {
  text-align: right;
  padding-right: 12px;
  font-weight: 600;
  margin: 0;
}

#teamRoleTwo {
  text-align: left;
  padding-left: 12px;
  font-weight: 600;
  margin: 0;
}

.divider {
  width: 1px;
  height: 20px;
  background-color: #000;
}


/* --- TEAM COLUMN --- */
.team-column {
  border-right: 0.125rem solid #e0e6ef; /* 2px */
  padding-right: 2.5rem; /* 40px */
}

.team-column:last-child {
  border-right: none;
}

/* --- RESPONSIVE --- */
@media (max-width: 768px) {
  .team-section {
    grid-template-columns: 1fr; /* stack columns */
    padding: 3.75rem 5%; /* reduce spacing */
  }

  .team-column {
    border-right: none;
    border-bottom: 0.125rem solid #e0e6ef; /* separate stacked columns */
    padding: 1.25rem 0;
    margin-bottom: 1.875rem;
  }

  .team-column:last-child {
    border-bottom: none;
  }

  .team-cta {
    padding: 5rem 5%;
  }

  .team-cta h2 {
    font-size: clamp(1.75rem, 6vw, 2rem);
  }

  .team-cta p {
    font-size: clamp(1rem, 3vw, 1.1rem);
  }
}


/* ================= DOCUMENTS ================= */
.documents-section {
  padding: 120px 10%;
  background: #f4f8fb;
  min-height: 100vh;
}

.documents-section h1 {
  font-size: 3rem;
  color: #002d72;
  margin-bottom: 50px;
}

.docs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 25px;
}

.doc-card-section {
  background: #0033a0;
  color: white;
  font-size: 1.4rem;
  padding: 25px 20px;
  border-radius: 16px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: transform 0.2s ease, background 0.2s ease;
}

.doc-card-section:hover {
  background: #0055c8;
  transform: translateX(5px);
}

.arrow {
  font-size: 1.6rem;
}

/* ================= BACKGROUND PANEL ================= */
.overlay {
  position: fixed;
  top: 0;
  right: -100%;
  width: 90%;
  max-width: 1000px;
  height: 100%;
  background: white;
  box-shadow: -5px 0 25px rgb(0 0 0 / 30%);
  z-index: 2000;
  transition: right 0.4s ease;
  overflow-y: auto;
}

.overlay.show {
  right: 0;
}

.overlay.hidden {
  display: none;
}

.overlay-content {
  padding: 40px;
}

.overlay-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
}

.overlay-header h2 {
  font-size: 2rem;
  color: #002d72;
}

#overlayClose {
  background: #0033a0;
  color: white;
  border: none;
  padding: 8px 15px;
  font-size: 1rem;
  border-radius: 8px;
  cursor: pointer;
}

.overlay-docs {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

.overlay-docs .doc-card-horizontal {
  display: flex;
  align-items: center;
  background: #f4f8fb;
  padding: 15px 20px;
  border-radius: 12px;
}

.overlay-docs .doc-card-horizontal img.file-icon {
  width: 50px;
  height: 50px;
  margin-right: 20px;
}

.overlay-docs .doc-card-horizontal .doc-details h3 {
  font-size: 1.2rem;
  color: #002d72;
  margin-bottom: 5px;
}

.overlay-docs .doc-card-horizontal .doc-details p {
  font-size: 0.9rem;
  color: #555;
}

.overlay-docs .doc-card-horizontal a.download-btn {
  margin-left: auto;
  background: #0033a0;
  color: white;
  padding: 6px 12px;
  border-radius: 6px;
  text-decoration: none;
  font-size: 0.9rem;
}

.overlay-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.overlay-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

/* ================= FOOTER ================= */
footer {
  background: #002d72;
  color: white;
  padding: 60px 10%;
  text-align: center;
}

footer h2 {
  font-size: 1.8rem;
  margin-bottom: 20px;
}

footer p {
  font-size: 1rem;
  margin-bottom: 15px;
  color: #ccc;
}

footer a {
  color: #ff7f00;
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}
