:root {
  --primary-color: #0a1c2e; 
  --secondary-color: #06121f;
  --highlight: #3399ff;  
  --white: #ffffff;
  --light-gray: #f8f8f8;
  --dark-gray: #333333;
  --transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
  --shadow-sm: 0 4px 6px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
    0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1),
    0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: #fff6ec;
  color: var(--secondary-color);
  overflow-x: hidden;
  line-height: 1.6;
  margin-top: 20px;
}

.container {
  max-width: 1400px;
  font-family: "Inter";
  margin: 0 auto;
  padding: 0 2rem;
}

/* Reset CSS for consistent base layout */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Body and main container fixes */
body {
  margin: 0;
  padding: 0;
  width: 100%;
  overflow-x: hidden; /* Prevents horizontal scrolling */
}

/* Main content container with consistent spacing from navbar */
.container,
main,
.content-wrapper {
  width: 100%;
  max-width: 1200px; /* Adjust based on your design needs */
  margin: 0 auto; /* Centers the container */
  padding: 0 2rem; /* Consistent padding on left and right */
}

/* Consistent top spacing for page titles and headers */
.page-content,
main > section:first-child,
.content-wrapper > section:first-child,
.container > section:first-child,
.page-content > section:first-child,
main > .section-title:first-child,
.content-wrapper > .section-title:first-child,
.container > .section-title:first-child,
.page-content > .section-title:first-child,
main > h1:first-child,
main > h2:first-child,
.content-wrapper > h1:first-child,
.content-wrapper > h2:first-child,
.page-title,
h1.title,
.main-title,
.page-header,
.content-area > h1:first-child,
.section-title:first-child {
  margin-top: 3.5rem !important; /* Fixed exact distance from navbar */
  padding-top: 1.5rem !important; /* Additional padding for consistency */
  position: relative;
  display: block;
}

/* Section styling with consistent spacing */
section {
  padding: 2rem 0;
  width: 100%;
}

/* CSS for section title with consistent centering and spacing */
.section-title,
.page-title,
.page-header h1,
h1.title,
.main-title {
  text-align: center;
  margin-bottom: 2rem;
  font-size: 2rem;
  color: var(--primary-color);
  position: relative;
  padding-bottom: 1rem;
  font-weight: 600;
  /* Ensure consistent margins for centering */
  margin-left: auto;
  margin-right: auto;
  padding-left: 0;
  padding-right: 0;
}

/* Section titles within page content (not as page headers) */
section .section-title:not(:first-of-type),
.content-area .section-title:not(:first-of-type) {
  margin-top: 4rem; /* Larger spacing between content sections */
  margin-bottom: 1rem; /* Reduced bottom margin as specified in faculty styles */
}

/* Standardized decorative underline for all headings */
.section-title::after,
.page-title::after,
.page-header h1::after,
main > h1:first-child::after,
main > h2:first-child::after,
.content-wrapper > h1:first-child::after,
.container > h1:first-child::after,
h1.title::after,
.main-title::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 4px;
  background: linear-gradient(
    to right,
    var(--primary-color),
    var(--text-c-highlight)
  );
  border-radius: 2px;
  display: block !important; /* Ensure the element is displayed */
  visibility: visible !important; /* Make sure it's not hidden */
  opacity: 1 !important; /* Ensure full opacity */
}

/* Faculty Grid specific styles */
.faculty-section .section-title,
.staff-section .section-title {
  margin: 4rem 0 1rem; /* Preserve the faculty grid specific spacing */
  padding-bottom: 1rem; /* Ensure space for the underline */
}

/* Faculty section may need additional spacing adjustments */
.faculty-grid,
.staff-grid {
  margin-top: 2rem; /* Add space between title and grid */
}

/* Ensure consistent heading alignment across all pages */
h1,
h2,
h3,
h4,
h5,
h6,
.page-title,
.heading {
  text-align: center;
  padding-left: 0;
  padding-right: 0;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 1.5rem; /* Consistent bottom spacing for headings */
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .container,
  main,
  .content-wrapper {
    padding: 0 1rem; /* Slightly reduced padding on smaller screens */
  }

  /* Adjust top spacing for mobile */
  .page-content,
  main > section:first-child,
  .content-wrapper > section:first-child,
  .container > section:first-child,
  .page-content > section:first-child,
  main > .section-title:first-child,
  .content-wrapper > .section-title:first-child,
  .container > .section-title:first-child,
  .page-content > .section-title:first-child,
  main > h1:first-child,
  main > h2:first-child,
  .content-wrapper > h1:first-child,
  .content-wrapper > h2:first-child,
  .page-header,
  .page-title {
    margin-top: 3rem !important; /* Consistent spacing on mobile */
    padding-top: 1rem !important; /* Proportional padding for mobile */
  }

  /* Ensure the decorative line appears on mobile too */
  .section-title::after,
  .page-title::after,
  .page-header h1::after,
  main > h1:first-child::after,
  main > h2:first-child::after,
  h1.title::after,
  .main-title::after {
    display: block !important;
  }
}

@media (max-width: 600px) {
  /* Further adjust for even smaller screens */
  .container,
  main,
  .content-wrapper {
    padding: 0 0.75rem; /* Even smaller padding for tiny screens */
  }

  .page-content,
  main > section:first-child,
  .content-wrapper > section:first-child,
  .container > section:first-child,
  .page-content > section:first-child,
  main > .section-title:first-child,
  .content-wrapper > .section-title:first-child,
  .container > .section-title:first-child,
  .page-content > .section-title:first-child,
  main > h1:first-child,
  main > h2:first-child,
  .content-wrapper > h1:first-child,
  .content-wrapper > h2:first-child,
  .page-header,
  .page-title {
    margin-top: 5.5rem !important; /* Smaller but still consistent for smallest screens */
    padding-top: 0.75rem !important; /* Minimal padding for smallest screens */
  }
}

.section-title::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 4px;
  background: linear-gradient(to right, var(--primary-color), var(--highlight));
  border-radius: 2px;
}

.faculty-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2.5rem;
  margin: 3rem 0;
}

.faculty-group {
  background-color: var(--white);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
  position: relative;
  cursor: pointer;
  transform-origin: center;
  -webkit-tap-highlight-color: transparent;
}

.faculty-group:hover {
  transform: translateY(-12px) scale(1.02);
  box-shadow: var(--shadow-lg);
}

.faculty-image {
  height: 300px;
  overflow: hidden;
  position: relative;
}

.faculty-image::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0%,
    rgba(0, 0, 0, 0.7) 100%
  );
  z-index: 1;
  opacity: 0.7;
  transition: var(--transition);
}

.faculty-group:hover .faculty-image::before {
  opacity: 0.5;
}

.faculty-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: var(--transition);
}

.faculty-group:hover .faculty-image img {
  transform: scale(1.08);
}

.faculty-title {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 2.5rem 1.5rem 1.5rem;
  color: var(--white);
  font-size: 1.8rem;
  font-weight: 600;
  z-index: 2;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  transition: var(--transition);
}

.faculty-group:hover .faculty-title {
  transform: translateY(-5px);
}

.faculty-info {
  padding: 2rem;
  text-align: center;
  position: relative;
}

.faculty-info p {
  margin-bottom: 1.5rem;
  color: var(--dark-gray);
  font-size: 1rem;
}

.faculty-count {
  display: inline-block;
  background: linear-gradient(135deg, var(--highlight) 0%, #c9a227 100%);
  color: var(--secondary-color);
  font-weight: 600;
  padding: 0.5rem 1.5rem;
  border-radius: 30px;
  font-size: 0.95rem;
  box-shadow: 0 4px 8px rgba(212, 175, 55, 0.3);
  transition: var(--transition);
}

.faculty-group:hover .faculty-count {
  transform: scale(1.05);
  box-shadow: 0 6px 12px rgba(212, 175, 55, 0.4);
}

/* Fullscreen Image Viewer */
.fullscreen-viewer {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  z-index: 9999;
  align-items: center;
  justify-content: center;
}

.fullscreen-image {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
}

.close-button {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 24px;
  cursor: pointer;
  z-index: 101;
}

/* Footer Styles */
footer {
  background: linear-gradient(135deg, var(--primary-color) 0%, #2b0000 100%);
  color: var(--white);
  padding: 4rem 0 3rem;
  text-align: center;
  margin-top: 5rem;
  position: relative;
  clip-path: polygon(0 15%, 100% 0, 100% 100%, 0% 100%);
}

.footer-content {
  max-width: 800px;
  margin: 0 auto;
  padding-top: 2rem;
}

.footer-text {
  margin-bottom: 1.5rem;
  font-size: 1.1rem;
  line-height: 1.8;
}

.footer-highlight {
  color: var(--highlight);
  font-weight: 500;
}

.social-links {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin: 2rem 0;
}

.social-link {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-size: 1.2rem;
  transition: var(--transition);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.social-link:hover {
  background: var(--highlight);
  color: var(--secondary-color);
  transform: translateY(-5px);
}

.copyright {
  margin-top: 2rem;
  opacity: 0.7;
  font-size: 0.9rem;
}

/* Animation Keyframes */
@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

/* Responsive Adjustments */
@media (max-width: 768px) {
  h1 {
    font-size: 2.5rem;
  }

  .faculty-grid {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
  }
}

@media (max-width: 480px) {
  .faculty-grid {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 2rem;
  }
}

/* Preloader */
.preloader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--primary-color);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  transition: opacity 0.5s ease, visibility 0.5s;
}

.preloader.fade-out {
  opacity: 0;
  visibility: hidden;
}

.loader {
  width: 60px;
  height: 60px;
  border: 5px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  border-top-color: var(--highlight);
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Scroll Animation */
.reveal {
  position: relative;
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal.active {
  opacity: 1;
  transform: translateY(0);
}
