/* === Reset & Base Styles === */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth; /* Smooth scrolling for anchor links */
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  background-color: #1a1a2e; /* Dark background */
  color: #e0e0e0; /* Light text color */
  /* Improve text rendering */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* === Typography === */
h1, h2, h3, h4, h5, h6 {
  margin-bottom: 0.75rem;
  color: #a3daff; /* Lighter blue for headings */
  font-weight: 600;
}

h1#main-title {
    font-size: 3.5rem; /* Keep size for impact */
    text-align: center;
    margin-bottom: 0.5rem;
    font-weight: bold;
    color: #f5f5f5; /* Base color - slightly off-white works well */
    /* Set initial text-shadow state */
    text-shadow:
        /* --- 3D Depth (Dark Neutral/Red) --- */
        1px 1px 1px #500,
        2px 2px 1px #300,
        3px 3px 1px #100,

        /* --- Red Glow --- */
        0 0 5px #ff4d4d,  /* Lighter red */
        0 0 15px #ff0000, /* Bright red */
        0 0 25px #ff0000, /* Intense red */

        /* --- Blue Glow --- */
        0 0 5px #4da6ff,  /* Lighter blue */
        0 0 15px #007bff, /* Bright blue */
        0 0 25px #007bff, /* Intense blue */

        /* --- Sharp Edge --- */
        0 0 8px #ffffff; /* White edge */

    /* Apply the flickering animation */
    animation: electric-bicolor-flicker 1.5s infinite alternate ease-in-out;
}

/* Keyframes for the Blue/Red flicker animation */
@keyframes electric-bicolor-flicker {
    0% { /* Start state */
        text-shadow:
            /* Depth */ 1px 1px 1px #500, 2px 2px 1px #300, 3px 3px 1px #100,
            /* Red Glow */ 0 0 5px #ff4d4d, 0 0 15px #ff0000, 0 0 25px #e60000,
            /* Blue Glow */ 0 0 6px #4da6ff, 0 0 16px #007bff, 0 0 28px #0056b3,
            /* Edge */ 0 0 7px #ffffff;
    }
    50% { /* Mid state - slightly different glow intensities */
        text-shadow:
            /* Depth */ 1px 1px 1px #500, 2px 2px 1px #300, 3px 3px 1px #100,
            /* Red Glow */ 0 0 7px #ff4d4d, 0 0 18px #ff0000, 0 0 30px #e60000,
            /* Blue Glow */ 0 0 4px #4da6ff, 0 0 13px #007bff, 0 0 22px #0056b3,
            /* Edge */ 0 0 9px #ffffff;
    }
    100% { /* End state - back towards start but slightly different */
        text-shadow:
            /* Depth */ 1px 1px 1px #500, 2px 2px 1px #300, 3px 3px 1px #100,
            /* Red Glow */ 0 0 4px #ff4d4d, 0 0 13px #ff0000, 0 0 22px #e60000,
            /* Blue Glow */ 0 0 7px #4da6ff, 0 0 18px #007bff, 0 0 30px #0056b3,
            /* Edge */ 0 0 6px #ffffff;
    }
}

h2 {
    font-size: 2rem;
    border-bottom: 2px solid #3498db; /* Blue underline for section titles */
    padding-bottom: 0.3rem;
    margin-bottom: 1.5rem;
    color: #7cc5ff; /* Slightly different blue */
}

h3 {
    font-size: 1.4rem;
    color: #63b3ed; /* Another shade of blue */
}

p {
  margin-bottom: 1rem;
  color: #c0c0c0; /* Slightly dimmer text for paragraphs */
}

a {
  color: #63b3ed; /* Link color */
  text-decoration: none;
  transition: color 0.3s ease;
}

a:hover {
  color: #a3daff; /* Lighter link color on hover */
  text-decoration: underline;
}

ul {
    list-style: none; /* Remove default bullets */
    padding-left: 0; /* Remove default padding */
    margin-bottom: 1rem;
}

li {
    margin-bottom: 0.4rem;
    padding-left: 1.2em; /* Add space for custom bullet/icon */
    position: relative;
}

/* Optional: Add a custom bullet style */
li::before {
    content: '»'; /* Or use Font Awesome icons */
    position: absolute;
    left: 0;
    color: #3498db;
    font-weight: bold;
}

/* === Layout === */
header {
  background: linear-gradient(to right, #1a1a2e, #16222a); /* Gradient background */
  color: #fff;
  padding: 2rem 1rem 1rem 1rem;
  text-align: center;
  border-bottom: 3px solid #3498db;
}

header p {
    color: #e0e0e0;
    font-size: 1.1rem;
}

/* --- Navbar Base Styles & Scroll Behavior --- */
nav#navbar {
  background-color: #1f2b38; /* Slightly lighter dark shade */
  padding: 0.8rem 0; /* Default padding for desktop */
  position: sticky; /* Make navbar sticky */
  top: 0; /* Stick to the top */
  width: 100%; /* Ensure it spans full width */
  z-index: 1000; /* Ensure it's above other content */
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
  transition: top 0.3s ease-in-out; /* Smooth transition for the 'top' property */
  /* Hint for performance */
  will-change: top;
}

/* Style for when the navbar is hidden (scrolling down) */
nav#navbar.navbar-hidden {
    top: -100px; /* Default hidden position (adjust if desktop navbar height changes) */
}

nav#navbar ul {
  list-style: none;
  display: flex;
  justify-content: center;
  margin-bottom: 0; /* Remove bottom margin for ul inside nav */
  padding-left: 0; /* Ensure no extra padding */
}

nav#navbar ul li {
  margin: 0 1.5rem; /* Default spacing for desktop */
}

nav#navbar ul li::before {
    content: none; /* Remove default bullet style in nav */
}

nav#navbar ul li a {
  color: #e0e0e0;
  text-decoration: none;
  font-weight: 500;
  padding: 0.5rem 0; /* Default padding for desktop */
  position: relative;
  transition: color 0.3s ease;
}

/* Underline effect for desktop */
nav#navbar ul li a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    background-color: #3498db;
    transition: width 0.3s ease;
}

nav#navbar ul li a:hover,
nav#navbar ul li a:focus {
  color: #ffffff;
}

nav#navbar ul li a:hover::after,
nav#navbar ul li a:focus::after {
    width: 100%;
}

/* --- Main Content Area --- */
main {
  /* Add padding to the top to prevent content from jumping under the sticky nav */
  /* This value should roughly match the visible height of the DESKTOP navbar */
  padding-top: 70px; /* Adjust based on final desktop navbar height */
}

section {
  padding: 2.5rem 2rem; /* Padding around each section */
  margin: 0 auto 1.5rem auto; /* Center sections and add bottom margin */
  max-width: 1100px; /* Optional: constrain max width of content */
  background-color: rgba(31, 43, 56, 0.5); /* Slightly transparent section background */
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

footer {
  text-align: center;
  padding: 1.5rem;
  margin-top: 1rem; /* Space above footer */
  background-color: #1f2b38; /* Match navbar */
  color: #aaa;
  font-size: 0.9rem;
  border-top: 1px solid #333;
}

/* === About Me Section === */
.about-content {
  display: flex;
  align-items: center;
  gap: 2rem; /* Space between image and text */
  perspective: 800px; /* Keep for 3D effect */
}

.profile-pic {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  object-fit: cover; /* Ensure image covers the area without distortion */
  border: 3px solid #3498db;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3), 0 0 5px rgba(52, 152, 219, 0.4);

  /* --- Optimization & Smoother Transition --- */
  will-change: transform, box-shadow; /* Hint browser about animations */
  transition: transform 0.25s ease-out, box-shadow 0.25s ease-out; /* Faster, smoother transition */
  backface-visibility: hidden; /* Prevent flickering during transform */
  /* --- End Optimization --- */

  flex-shrink: 0; /* Prevent image from shrinking */
}

.profile-pic:hover {
  /* --- Optimized Hover Effect --- */
  transform: scale(1.1) rotateY(10deg) translateZ(10px); /* Slightly simpler transform */
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.35), /* Simpler shadow */
              0 0 10px rgba(52, 152, 219, 0.6);
  /* --- End Optimized Hover Effect --- */
  cursor: pointer;
}

/* === Three.js Showcase === */
#three-showcase {
    padding: 0; /* Remove section padding */
    background-color: transparent;
    box-shadow: none;
    margin-bottom: 1.5rem;
    max-width: none; /* Allow container inside to set width */
}
#three-container {
    width: 80%; /* Default width */
    max-width: 700px; /* Default max pixel width */
    height: 300px; /* Default height */
    margin: 0 auto; /* Center the container */
    overflow: hidden;
    border-radius: 8px; /* Match section radius */
    background-color: #000; /* Add a black background */
}

#three-canvas {
    display: block; /* Remove extra space below canvas */
    width: 100%;
    height: 100%;
}

/* === Projects Section === */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

.project-card {
  background-color: #1f2b38;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
}

.project-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgb(255, 0, 0);
}

.project-preview {
  display: block; /* Ensure it behaves like a block element */
  width: 100%;
  height: 200px;
  object-fit: cover; /* Cover the area, may crop */
  margin-bottom: 1rem;
  border-radius: 4px;
  border: 1px solid #333;
  background-color: #333; /* Placeholder background */
}

.project-card h3 { /* Project Title */
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.project-card h3 + p { /* Description */
    flex-grow: 1; /* Allow description to take available space */
    margin-bottom: 1rem;
    color: #b0b0b0;
}

.project-card h3:nth-of-type(2) { /* "Technologies Used" heading */
    font-size: 1.1rem;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    color: #a3daff;
    border-top: 1px solid #333;
    padding-top: 0.8rem;
}

.project-card ul {
    margin-bottom: 1rem;
}

.project-card ul li {
    font-size: 0.9rem;
    margin-bottom: 0.2rem;
    padding-left: 1em;
}
.project-card ul li::before {
    content: '•'; /* Simple bullet */
    color: #63b3ed;
    font-size: 1.2em;
    line-height: 1;
}

.project-card p a { /* Links at the bottom */
    display: inline-block;
    margin-top: 0.5rem;
    margin-right: 1rem;
    padding: 0.3rem 0.8rem;
    border: 1px solid #3498db;
    border-radius: 4px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.project-card p a:hover {
    background-color: #3498db;
    color: #ffffff;
    text-decoration: none;
}

.project-card p a i { /* Icon inside link */
    margin-right: 0.4em;
}

/* === Resume & Skills Section === */
.resume-intro {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.resume-download {
    text-align: center;
    margin-bottom: 2.5rem;
}

.button-style, /* Generic button style */
.resume-download-link {
    display: inline-block;
    background-color: #3498db;
    color: #ffffff;
    padding: 0.8rem 1.8rem;
    border: none;
    border-radius: 5px;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    will-change: transform; /* Hint for button hover */
}

.button-style:hover,
.resume-download-link:hover {
    background-color: #2980b9; /* Darker blue on hover */
    color: #ffffff;
    transform: translateY(-2px);
    text-decoration: none;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.resume-download-link i {
    margin-right: 0.5rem;
}

#skills {
    margin-top: 2rem; /* Space above skills within resume section */
    padding-top: 2rem;
    border-top: 1px solid #333; /* Separator line */
}

.skills-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
}

.skill-category h3 {
  color: #a3daff;
  margin-bottom: 0.8rem;
  font-size: 1.2rem;
}

.skill-category ul li {
    font-size: 0.95rem;
    padding-left: 1em;
}
.skill-category ul li::before {
    content: '✓'; /* Checkmark */
    color: #63b3ed;
}

/* === Contact Section === */
.contact-intro {
    text-align: center;
    font-size: 1.1rem;
    margin-bottom: 2rem;
}

.contact-methods {
  display: flex;
  flex-direction: column; /* Stack links vertically */
  align-items: center; /* Center links horizontally */
  gap: 1rem; /* Space between contact links */
}

.contact-link {
  display: inline-flex; /* Align icon and text */
  align-items: center;
  padding: 0.6rem 1.2rem;
  border: 1px solid transparent; /* Placeholder for hover effect */
  border-radius: 5px;
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
  min-width: 250px; /* Give links a minimum width */
  justify-content: center; /* Center content within the link */
}

.contact-link i {
  margin-right: 0.8rem; /* Space between icon and text */
  font-size: 1.2em; /* Make icons slightly larger */
}

.contact-link:hover {
  background-color: rgba(52, 152, 219, 0.1); /* Subtle background on hover */
  border-color: #3498db;
  color: #a3daff;
  text-decoration: none;
}

/* Specific hover colors (optional) */
.email-link:hover { border-color: #e74c3c; color: #e74c3c; background-color: rgba(231, 76, 60, 0.1); }
.linkedin-link:hover { border-color: #0077b5; color: #0077b5; background-color: rgba(0, 119, 181, 0.1); }
.github-link-contact:hover { border-color: #ffffff; color: #ffffff; background-color: rgba(255, 255, 255, 0.1); }


/* ==========================
   Responsive Design & Performance Optimizations
   ========================== */

/* --- Disable complex hover on touch devices --- */
@media (hover: none) {
    .profile-pic:hover {
        /* Reset hover effects if true touch device detected */
        transform: none;
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3), 0 0 5px rgba(52, 152, 219, 0.4);
    }
    .button-style:hover,
    .resume-download-link:hover {
        /* Disable transform on touch */
        transform: none;
    }
    .project-card:hover {
        transform: none; /* Disable card lift */
    }
}

/* --- Medium Screens (Tablets, smaller laptops) --- */
@media (max-width: 768px) {

  /* --- General Adjustments --- */
  h1#main-title {
    font-size: 2.2rem;
    /* Option 1: Disable demanding animation */
    animation: none;
    /* Option 2: Use a simpler static shadow */
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5), 0 0 5px #4da6ff;
  }
  header {
    padding: 1rem 0.8rem; /* Slightly reduce header padding */
  }
  header p {
    font-size: 1rem; /* Adjust subtitle size */
  }
  h2 {
    font-size: 1.8rem;
  }
  section {
    padding: 2rem 1rem; /* Reduce section padding */
  }
  .about-content {
    flex-direction: column; /* Stack image and text */
    text-align: center;
  }
  .profile-pic {
    width: 120px;
    height: 120px;
    margin-bottom: 1rem;
  }
  /* Simpler hover for smaller screens (if not touch-only) */
  .profile-pic:hover {
     transform: scale(1.05); /* Just a slight scale */
     box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3), 0 0 8px rgba(52, 152, 219, 0.5);
  }

  .project-grid {
    grid-template-columns: 1fr; /* Single column layout */
  }
  .skills-container {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); /* Allow 2 columns if space */
  }
  .contact-methods {
      align-items: stretch; /* Make links full width */
  }
  .contact-link {
      min-width: unset; /* Remove min-width */
      justify-content: flex-start; /* Align text left */
      padding: 0.8rem 1rem;
  }

  /* --- Navbar Mobile Adjustments (Smaller Navbar) --- */
  nav#navbar {
      padding: 3px 0; /* Significantly reduce top/bottom padding */
      position: sticky;
      top: 0;
      z-index: 1000;
  }
  nav#navbar ul {
      justify-content: center;
      flex-wrap: wrap; /* Allow wrapping if needed */
      gap: 0.2rem; /* Add small gap if wrapping */
  }
  nav#navbar ul li {
      margin: 0 0.6rem; /* Reduce space between items */
  }
  nav#navbar ul li a {
      font-size: 0.78rem; /* Make link text smaller */
      padding: 5px 6px;  /* Reduce padding around links */
  }
  nav#navbar ul li a::after {
      content: none; /* Hide underline effect on mobile */
  }

  /* IMPORTANT: Adjust hidden position for the SMALLER mobile navbar */
  nav#navbar.navbar-hidden {
      /* Estimate the new height (e.g., maybe 35-45px) */
      top: -50px; /* Adjust this value based on the new smaller height */
  }

  /* IMPORTANT: Adjust main content padding for the SMALLER mobile navbar */
  main {
       /* Adjust this value based on the new smaller navbar height + desired spacing */
      padding-top: 45px; /* Example: 35px navbar height + 10px space */
  }

  /* --- Smaller Three.js container --- */
  #three-container {
      width: 90%; /* Slightly wider percentage */
      max-width: 400px; /* Reduce max-width */
      height: 220px; /* Reduce height */
      margin-top: 1rem;
      margin-bottom: 1rem;
  }
}

/* --- Small Screens (Mobile Phones) --- */
@media (max-width: 480px) {

  /* --- General Adjustments --- */
  h1#main-title {
      font-size: 1.8rem;
      /* Ensure simpler shadow from 768px query is applied */
  }
  header p {
      font-size: 0.9rem;
  }
  h2 {
      font-size: 1.5rem;
  }
  .button-style,
  .resume-download-link {
      padding: 0.6rem 1.2rem;
      font-size: 0.9rem;
  }
  section {
      padding: 1.5rem 0.8rem; /* Further reduce padding */
  }
  .skills-container {
    grid-template-columns: 1fr; /* Force single column */
  }

  /* --- Navbar Mobile Adjustments (Even Smaller) --- */
  nav#navbar ul li {
      margin: 0 0.4rem; /* Even less space */
  }
  nav#navbar ul li a {
      font-size: 0.7rem; /* Even smaller text */
      padding: 4px 5px;  /* Even less padding */
  }

  /* Re-adjust hidden position if needed for very small screens */
  nav#navbar.navbar-hidden {
      top: -45px; /* Example adjustment */
  }

  /* Re-adjust main content padding if needed */
  main {
      padding-top: 40px; /* Example adjustment */
  }

  /* --- Even Smaller Three.js container --- */
  #three-container {
      height: 180px; /* Even smaller height */
      max-width: 95%; /* Allow it to be almost full width */
  }
}

