/* --- Base & Variables --- */
:root {
  --primary-bg: #232323; /* Dark Grey / Off-black */
  --secondary-bg: #3b3b3b;
  --text-light: #f0f0f0; /* Off-white */
  --text-dark: #1a1a1a;
  --accent-color: #ffd700; /* Gold/Yellow */
  --font-family: "Poppins", sans-serif;
  /* Add a subtle background pattern URL */
  --bg-pattern-url: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 80 80" width="20" height="20"><path fill="%23555555" fill-opacity="0.2" d="M0 0h40v40H0zM40 40h40v40H40z"></path></svg>');
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  background-color: var(--primary-bg); /* Fallback color */
  color: var(--text-light);
  line-height: 1.6;
  position: relative; /* Needed for background layering */
  z-index: 0; /* Establish stacking context */
}

/* --- Scrolling Background --- */
.background-layer {
  position: fixed; /* Fixed position */
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: var(--bg-pattern-url),
    linear-gradient(rgba(26, 26, 26, 0.95), rgba(26, 26, 26, 0.98)); /* Pattern on top of gradient/solid */
  background-repeat: repeat, no-repeat; /* Repeat pattern */
  background-attachment: fixed, fixed; /* Keep both fixed */
  background-size: auto, cover; /* Pattern size auto, gradient cover */
  z-index: -1; /* Behind all content */
  opacity: 0.6; /* Make pattern subtle */
}
/* Alternative - Simple fixed background image:
 body::before {
     content: '';
     position: fixed;
     top: 0; left: 0;
     width: 100%; height: 100%;
     background: url('your-background-image.jpg') no-repeat center center fixed;
     background-size: cover;
     opacity: 0.1; // Adjust opacity
     z-index: -1;
 }
 */

/* --- Layout & Sections --- */
header {
  background-color: rgba(
    26,
    26,
    26,
    0.85
  ); /* Slightly more transparent maybe */
  padding: 1rem 5%;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
}

nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

nav .logo {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--accent-color);
}

nav ul {
  list-style: none;
  display: flex;
}

nav ul li {
  margin-left: 2rem;
}

nav ul li a {
  text-decoration: none;
  color: var(--text-light);
  font-weight: 400;
  transition: color 0.3s ease;
  cursor: pointer; /* Indicate clickable for modal triggers */
}

nav ul li a:hover {
  color: var(--accent-color);
}

main {
  padding: 0 5%;
}

section {
  padding: 4rem 0;
  text-align: center;
  min-height: 70vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative; /* Needed for z-index stacking */
  z-index: 1; /* Above background */
}

section h1 {
  font-size: 3rem;
  margin-bottom: 1rem;
  color: var(--accent-color);
}

section h2 {
  font-size: 2.5rem;
  margin-bottom: 2rem;
  position: relative;
  padding-bottom: 0.5rem;
}

section h2::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 3px;
  background-color: var(--accent-color);
}

section p {
  max-width: 600px;
  margin: 0 auto 1.5rem auto;
  font-size: 1.1rem;
}

/* --- Buttons --- */
.cta-button,
.details-button {
  display: inline-block;
  background-color: var(--accent-color);
  color: var(--text-dark);
  padding: 0.8rem 1.8rem;
  border: none;
  border-radius: 5px;
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.3s ease, transform 0.2s ease;
  text-align: center;
}

.cta-button:hover,
.details-button:hover {
  background-color: #e6c300;
  transform: translateY(-2px);
}

/* --- Projects Section (Horizontal Scroll) --- */
#projects {
  /* Allow content to potentially overflow section bounds for scroll */
  overflow: hidden;
  width: 100%; /* Occupy full width */
  padding-left: 5%; /* Match main padding */
  padding-right: 5%;
  box-sizing: border-box; /* Include padding in width */
}

.project-scroll-container {
  width: 100%; /* Take full width of section */
  overflow-x: auto; /* Enable horizontal scroll */
  padding-bottom: 1.5rem; /* Space for scrollbar */
  margin-top: 2rem;
}

/* Optional: Styling the scrollbar */
.project-scroll-container::-webkit-scrollbar {
  height: 8px;
}
.project-scroll-container::-webkit-scrollbar-track {
  background: var(--secondary-bg);
  border-radius: 4px;
}
.project-scroll-container::-webkit-scrollbar-thumb {
  background-color: var(--accent-color);
  border-radius: 4px;
}
.project-scroll-container::-webkit-scrollbar-thumb:hover {
  background-color: #e6c300;
}

.project-grid {
  display: flex; /* Changed from grid to flex */
  flex-wrap: nowrap; /* Prevent wrapping */
  gap: 1.5rem; /* Space between flex items */
  width: max-content; /* Allow grid to grow horizontally */
  padding: 0 5px; /* Small padding so shadow isn't clipped */
}

.project-card {
  background-color: var(--secondary-bg);
  border-radius: 8px;
  padding: 1.5rem;
  text-align: left;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: pointer;
  overflow: hidden;
  width: 300px; /* Fixed width for consistency */
  flex: 0 0 auto; /* Prevent shrinking/growing */
  display: flex; /* Use flex for internal layout */
  flex-direction: column; /* Stack content vertically */
}

.project-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.4);
}

.project-card img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 4px;
  margin-bottom: 1rem;
}

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

.project-card p {
  font-size: 0.95rem;
  margin-bottom: 1rem;
  flex-grow: 1; /* Allow description to take available space */
}

.details-button {
  font-size: 0.9rem;
  padding: 0.5rem 1rem;
  margin-top: auto; /* Push button to bottom */
}

#about {
  overflow: hidden;
  width: 100%; /* Occupy full width */
  padding-left: 5%; /* Match main padding */
  padding-right: 5%;
  box-sizing: border-box; /* Include padding in width */
}

/* --- Footer --- */
footer {
  text-align: center;
  padding: 2rem 5%;
  margin-top: 3rem;
  border-top: 1px solid #333;
  font-size: 0.9rem;
  color: #aaa;
  position: relative; /* Needed for z-index stacking */
  z-index: 1; /* Above background */
}

.footer-contact-link {
  color: var(--accent-color);
  text-decoration: none;
  font-weight: 600;
  margin-bottom: 0.5rem;
  display: inline-block;
}
.footer-contact-link:hover {
  text-decoration: underline;
}
footer p:last-child {
  margin-top: 1rem;
}

/* --- Modal Popups --- */
.modal {
  display: none;
  position: fixed;
  z-index: 1001;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 90vw;
  max-width: 600px;
  background-color: var(--secondary-bg);
  border-radius: 8px;
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.5);
  padding: 2rem;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.modal.active {
  display: block;
  opacity: 1;
  transform: translate(-50%, -50%);
}

.modal-content {
  position: relative;
}

.close-button {
  position: absolute;
  top: -10px; /* Adjust if padding changed */
  right: 0px; /* Adjust if padding changed */
  font-size: 2rem;
  font-weight: bold;
  color: var(--text-light);
  cursor: pointer;
  transition: color 0.2s ease;
  line-height: 1; /* Prevent extra spacing */
}

.close-button:hover {
  color: var(--accent-color);
}

.modal h2 {
  margin-top: 0; /* Remove potential top margin */
  margin-bottom: 1rem;
  text-align: left;
  color: var(--accent-color);
}
.modal h2::after {
  display: none;
}

.modal p {
  text-align: left;
  font-size: 1rem;
  margin-bottom: 1.5rem;
}

.modal .cta-button {
  display: block;
  width: 100%; /* Make buttons fill width in modal */
  margin-bottom: 0.8rem; /* Space between buttons */
}
.modal .cta-button:last-child {
  margin-bottom: 0;
}

/* Specific styles for modal images */
.modal-img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  margin-bottom: 15px;
  display: block; /* Prevent extra space below */
}

.modal-video {
  width: 100%;
  max-width: 40vh;
  height: auto;
  display: block;

  border-radius: 8px;
  overflow: hidden;
  object-fit: contain;

  margin: 2rem auto;
}

/* Contact Modal Specific Styles */
#contact-modal .contact-links {
  list-style: none;
  padding: 0;
  margin-top: 1.5rem;
}

#contact-modal .contact-links li {
  margin-bottom: 1rem;
}

#contact-modal .cta-button {
  display: block; /* Ensure buttons are block level */
  width: 100%;
  text-align: center;
}
#contact-modal .email-button {
  /* Optional: Style email differently */
}
#contact-modal .social-button {
  /* Optional: Style social links differently */
  background-color: #444; /* Example */
  color: var(--text-light);
}
#contact-modal .social-button:hover {
  background-color: #555;
  transform: translateY(-2px); /* Keep hover effect */
}

.modal-overlay {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8); /* Slightly darker overlay */
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  display: block;
  opacity: 1;
}

/* --- Animations --- */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  opacity: 0;
  animation: fadeIn 0.8s ease-out forwards;
}

/* Staggered fade-in for project cards (still works with flex) */
.project-card:nth-child(1) {
  animation-delay: 0.1s;
}
.project-card:nth-child(2) {
  animation-delay: 0.2s;
}
.project-card:nth-child(3) {
  animation-delay: 0.3s;
}
.project-card:nth-child(4) {
  animation-delay: 0.4s;
}
/* Add more if needed */

#hero {
  animation-delay: 0.1s;
}
#projects h2 {
  animation-delay: 0.3s;
}
.project-scroll-container.fade-in {
  animation-delay: 0.4s;
} /* Delay container itself */

/* --- Responsiveness --- */
@media (max-width: 768px) {
  nav ul {
    display: none; /* Still hidden - burger menu needed for access */
  }
  nav {
    justify-content: center;
  }
  section h1 {
    font-size: 2.5rem;
  }
  section h2 {
    font-size: 2rem;
  }
  /* Horizontal scroll works on mobile, but cards might be wide */
  .project-card {
    width: 260px; /* Slightly smaller cards on mobile */
  }
  .modal {
    width: 95%;
    padding: 1.5rem;
  }
  .close-button {
    top: -5px;
    right: 5px;
  }
}
