/* Apply Inter font globally */
body {
  font-family: 'Inter', sans-serif;
  overscroll-behavior-y: none;
  background-color: #111827; /* Ensure body bg matches */
}

/* --- Animations --- */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
@keyframes fadeInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
/* Headline Reveal Animation */
@keyframes reveal {
  0% {
    clip-path: inset(0 100% 0 0);
  }
  100% {
    clip-path: inset(0 0 0 0);
  }
}
.headline-reveal span {
  display: inline-block; /* Needed for clip-path */
  animation: reveal 1.5s cubic-bezier(0.25, 1, 0.5, 1) forwards;
  opacity: 0; /* Start hidden until animation runs */
  animation-delay: 0.3s; /* Slight delay */
}
/* Ensure animation runs */
.headline-reveal span {
  animation-fill-mode: forwards;
}

/* Base state for scroll animations */
.animate-on-scroll {
  opacity: 0;
  transition: opacity 0.9s ease-out, transform 0.9s ease-out;
}
.animate-fade-in {
  animation: fadeIn 1.2s ease-out forwards;
}
.animate-fade-in-up {
  animation: fadeInUp 0.9s ease-out forwards;
}
.animate-fade-in-left {
  animation: fadeInLeft 0.9s ease-out forwards;
}
.animate-fade-in-right {
  animation: fadeInRight 0.9s ease-out forwards;
}

/* --- Hover & Micro-interactions --- */
.glossy-hover {
  transition: all 0.3s ease;
}
.glossy-hover:hover {
  box-shadow: 0 0 25px rgba(59, 130, 246, 0.7), 0 0 10px rgba(96, 165, 250, 0.5);
  transform: translateY(-4px) scale(1.03);
}
/* Navigation Link Hover/Active */
nav a:not(.brand):not(.contact-btn),
footer a {
  position: relative;
  transition: color 0.3s ease;
  padding-bottom: 6px; /* Space for underline */
}
nav a:not(.brand):not(.contact-btn)::after,
footer a::after {
  content: '';
  position: absolute;
  width: 0;
  height: 2px;
  bottom: 0; /* Position underline at the bottom */
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--primary-color, #3b82f6); /* Use CSS variable */
  transition: width 0.4s cubic-bezier(0.23, 1, 0.32, 1); /* Smoother transition */
}
nav a:not(.brand):not(.contact-btn):hover::after,
footer a:hover::after,
nav a:not(.brand):not(.contact-btn).active::after {
  width: 70%; /* Underline doesn't span full width */
}
nav a:not(.brand):not(.contact-btn).active {
  color: #f3f4f6; /* Active link color */
}
nav a:hover {
  color: #f3f4f6;
}

/* Project Card Hover Effect */
.project-card {
  position: relative; /* Needed for absolute positioning of overlay */
  overflow: hidden; /* Keep overlay contained */
  transition: transform 0.4s ease, box-shadow 0.4s ease;
}
.project-card:hover {
  transform: translateY(-6px) scale(1.01);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
}
.project-card .overlay {
  position: absolute;
  inset: 0; /* Cover the entire card */
  background: linear-gradient(
    to top,
    rgba(17, 24, 39, 0.95) 0%,
    rgba(17, 24, 39, 0.7) 60%,
    rgba(17, 24, 39, 0) 100%
  );
  opacity: 0;
  transition: opacity 0.4s ease-in-out;
  display: flex;
  flex-direction: column;
  justify-content: flex-end; /* Align content to bottom */
  padding: 1.5rem;
  pointer-events: none; /* Allow clicks to pass through initially */
}
.project-card:hover .overlay {
  opacity: 1;
  pointer-events: auto; /* Enable interaction on hover */
}
.project-card .overlay-content {
  transform: translateY(20px); /* Start slightly lower */
  transition: transform 0.4s ease-out 0.1s; /* Delayed transition */
}
.project-card:hover .overlay-content {
  transform: translateY(0);
}
.project-card img {
  transition: transform 0.4s ease;
}
.project-card:hover img {
  transform: scale(1.05); /* Subtle zoom on image */
}

/* Mobile touch device support for project cards */
@media (hover: none) and (pointer: coarse) {
  .project-card .overlay {
    opacity: 1;
    background: linear-gradient(
      to top,
      rgba(17, 24, 39, 0.95) 0%,
      rgba(17, 24, 39, 0.7) 60%,
      rgba(17, 24, 39, 0.3) 100%
    );
    pointer-events: auto;
  }
  .project-card .overlay-content {
    transform: translateY(0);
  }
}

/* --- 3D Canvas --- */
#three-canvas {
  position: fixed; /* Keep background fixed */
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh; /* Full viewport height */
  z-index: -1; /* Ensure it's behind everything */
  display: block;
}
#home {
  position: relative; /* Ensure content is above canvas */
  z-index: 1;
  background: transparent; /* Let canvas show through */
}
/* Add subtle gradient overlay to sections on top of canvas */
#about,
#skills,
#projects,
#articles,
#contact,
footer {
  position: relative;
  z-index: 1;
}
#about {
  background: linear-gradient(
    to bottom,
    rgba(31, 41, 55, 0.95),
    rgba(31, 41, 55, 1)
  );
}
#skills {
  background: linear-gradient(
    to bottom,
    rgba(17, 24, 39, 1),
    rgba(17, 24, 39, 0.95)
  );
}
#projects {
  background: linear-gradient(
    to bottom,
    rgba(31, 41, 55, 0.95),
    rgba(31, 41, 55, 1)
  );
}
#articles {
  background: linear-gradient(
    to bottom,
    rgba(17, 24, 39, 1),
    rgba(17, 24, 39, 0.95)
  );
}
#contact {
  background: linear-gradient(
    to bottom,
    rgba(31, 41, 55, 0.95),
    rgba(31, 41, 55, 1)
  );
}
footer {
  background: #111827;
} /* Solid footer */

/* --- Custom Scrollbar --- */
::-webkit-scrollbar {
  width: 10px;
}
::-webkit-scrollbar-track {
  background: #1f2937;
}
::-webkit-scrollbar-thumb {
  background: #4f46e5;
  border-radius: 5px;
} /* Changed to secondary accent */
::-webkit-scrollbar-thumb:hover {
  background: #6366f1;
}

/* --- Mobile Menu --- */
.mobile-menu {
  transition: transform 0.4s cubic-bezier(0.23, 1, 0.32, 1),
    opacity 0.4s ease-in-out;
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
}
.mobile-menu.active {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* Improved Mobile Responsiveness */
@media (max-width: 768px) {
  .headline-reveal span {
    font-size: 2.5rem;
  }

  .project-card {
    margin-bottom: 2rem;
  }

  .skill-card {
    padding: 1.5rem;
  }

  .article-card {
    padding: 1.25rem;
  }

  /* Ensure proper spacing on mobile */
  section {
    padding-top: 3rem;
    padding-bottom: 3rem;
  }

  /* Improve form elements on mobile */
  input,
  textarea,
  button {
    font-size: 16px; /* Prevents iOS zoom on focus */
  }
}

/* Small mobile devices */
@media (max-width: 480px) {
  .headline-reveal span {
    font-size: 2rem;
  }

  h2 {
    font-size: 1.75rem !important;
  }

  .space-x-5 > * {
    margin-right: 0.5rem;
    margin-left: 0.5rem;
  }

  /* Stack buttons on very small screens */
  #home .space-x-5 {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
  }

  #home .space-x-5 a {
    margin: 0;
    width: 100%;
    max-width: 250px;
  }
}

/* --- Section Specific Styles --- */
#skills {
  /* Subtle background pattern */
  background-image: radial-gradient(
    rgba(255, 255, 255, 0.03) 1px,
    transparent 1px
  );
  background-size: 15px 15px;
}
.skill-card i {
  transition: transform 0.3s ease;
}
.skill-card:hover i {
  transform: scale(1.1) rotate(-5deg);
}
.article-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.article-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

/* --- Utility --- */
.text-gradient {
  background: linear-gradient(
    to right,
    var(--primary-color, #3b82f6),
    var(--secondary-accent, #8b5cf6)
  ); /* Use CSS vars */
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-fill-color: transparent;
}
