.loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--black);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.5s ease;
}

.loader::after {
  content: "";
  width: 60px;
  height: 60px;
  border: 5px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Add this to hide the content until loader is gone */
body.loading {
  overflow: hidden;
}

body.loading .container {
  opacity: 0;
  visibility: hidden;
}

:root {
  --primary: #ff5733;
  --primary-light: #ff8c66;
  --primary-dark: #e04a2b;
  --secondary: #ffad33;
  --secondary-light: #ffe48be1;
  --black: #121212;
  --dark-gray: #1e1e1e;
  --medium-gray: #2a2a2a;
  --light-gray: #f5f5f5;
  --white: #ffffff;
  --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  --shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  --shadow-hover: 0 8px 25px rgba(255, 87, 51, 0.3);
  --text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

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

body {
  font-family: "Poppins", "Segoe UI", sans-serif;
  background: radial-gradient(
      circle at 20% 30%,
      rgba(255, 87, 51, 0.1) 0%,
      transparent 20%
    ),
    var(--black);
  color: var(--white);
  line-height: 1.7;
  scroll-behavior: smooth;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
}

/* Navigation */
nav {
  background: rgba(30, 30, 30, 0.95);
  padding: 1.5rem 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
  width: 100%;
  display: flex;
  justify-content: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

nav ul {
  display: flex;
  justify-content: center;
  gap: 2.5rem;
  list-style: none;
  max-width: 1100px;
  width: 100%;
}

nav a {
  color: var(--white);
  text-decoration: none;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  transition: var(--transition);
  position: relative;
  font-size: 1.05rem;
  text-shadow: var(--text-shadow);
}

@media (min-width: 768px) {
  nav a:hover {
    color: var(--primary);
    transform: translateY(-2px);
  }
}

nav a::after {
  content: "";
  position: absolute;
  width: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  bottom: -5px;
  left: 0;
  transition: var(--transition);
  border-radius: 3px;
}

@media (min-width: 768px) {
  nav a:hover::after {
    width: 100%;
  }
}

/* Container */
.container {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

section {
  padding: 5rem 0;
  scroll-margin-top: 80px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

section:not(:last-child) {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

/* Home Section */
#home {
  text-align: center;
  padding: 2rem;
  padding-top: 6rem;
  padding-bottom: 6rem;
  background: linear-gradient(
    135deg,
    rgba(30, 30, 30, 0.7),
    rgba(18, 18, 18, 0.9)
  );
  border-radius: 0 0 20px 20px;
  border-color: var(--primary);
  margin-bottom: 2rem;
  position: relative;
  overflow: hidden;
}

@media (min-width: 768px) {
  #home {
    min-height: calc(100vh - 100px); /* Adjust for nav height */
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-top: 2rem; /* Reduce top padding since we center vertically */
    padding-bottom: 2rem;
  }
}

#home::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(
    circle,
    rgba(90, 36, 24, 0.1) 0%,
    rgba(18, 18, 18, 0) 70%
  );
  z-index: -1;
}

h1 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  background: linear-gradient(to right, var(--primary), var(--primary-light));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 700;
}

h2 {
  font-size: 2.5rem;
  margin-bottom: 2rem;
  color: var(--white);
  text-align: center;
  font-weight: 600;
  position: relative;
  display: inline-block;
}

h2::after {
  content: "";
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: 2px;
}

h4 {
  font-size: 1.4rem;
  margin-bottom: 2rem;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 400;
  text-align: center;
  max-width: 700px;
}

.profile-img {
  width: 220px;
  height: 220px;
  border-radius: 50%;
  border: 5px solid var(--primary);
  margin: 2rem auto;
  object-fit: cover;
  box-shadow: 0 0 30px rgba(255, 87, 51, 0.5);
  transition: var(--transition);
  position: relative;
}

@media (min-width: 768px) {
  .profile-img:hover {
    transform: scale(1.05) rotate(5deg);
    box-shadow: 0 0 40px rgba(255, 87, 51, 0.7);
  }
}

p {
  max-width: 700px;
  margin: 0 auto 2rem;
  color: rgba(255, 255, 255, 0.85);
  text-align: center;
  font-size: 1.1rem;
  line-height: 1.8;
}

i {
  color: rgba(255, 255, 255, 0.9);
  transition: var(--transition);
}

/* Projects Section */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  justify-content: center;
  gap: 2rem;
  margin: 2rem auto 0;
  width: 100%;
  max-width: 1200px;
}

.project {
  background: linear-gradient(145deg, var(--medium-gray), var(--dark-gray));
  border-radius: 16px;
  overflow: hidden;
  transition: var(--transition);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  height: 550px; /* Increased height */
  position: relative;
  backdrop-filter: blur(10px);
}

.project::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  opacity: 0;
  transition: var(--transition);
  z-index: 10;
}

@media (min-width: 768px) {
  .project:hover {
    /* transform: translateY(-10px); Removed vertical movement */
    box-shadow: 0 20px 40px rgba(255, 87, 51, 0.25);
    border-color: rgba(255, 87, 51, 0.4);
  }
}

@media (min-width: 768px) {
  .project:hover::before {
    opacity: 1;
  }
}

.project-image {
  width: 100%;
  height: 30%; /* Base height */
  background-size: cover;
  background-position: center;
  transition: height 0.5s cubic-bezier(0.25, 0.8, 0.25, 1);
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
}

.project-content {
  padding: 1.2rem 1.5rem;
  display: flex;
  flex-direction: column;
  position: absolute;
  top: 30%; /* Base position */
  bottom: 0;
  width: 100%;
  background: linear-gradient(145deg, var(--medium-gray), var(--dark-gray));
  transition: top 0.5s cubic-bezier(0.25, 0.8, 0.25, 1); /* Animate top position */
  z-index: 2;
  overflow-y: auto;
  scrollbar-width: none;
}

.project-content::-webkit-scrollbar {
  display: none;
}

.project-overlay {
  position: absolute;
  top: 30%; /* Match content base position */
  left: 0;
  width: 100%;
  height: 70%; /* Match content base height */
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.5s cubic-bezier(0.25, 0.8, 0.25, 1);
  z-index: 5;
  backdrop-filter: blur(3px);
}

.overlay-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transform: translateY(20px);
  transition: transform 0.4s ease;
}

/* Desktop Hover Effects */
@media (min-width: 768px) {
  .project:hover .project-image {
    height: 40%; /* Expand to 40% */
  }

  .project:hover .project-content {
    top: 40%; /* Move content down */
  }

  .project:hover .project-overlay {
    top: 40%; /* Move overlay down */
    height: 60%; /* Adjust height */
    opacity: 1;
    visibility: visible;
  }

  .project:hover .overlay-content {
    transform: translateY(0);
  }

  .mobile-buttons {
    display: none;
  }
}

/* Mobile Layout */
@media (max-width: 767px) {
  .project {
    height: auto;
    min-height: 500px;
  }

  .project-image {
    position: relative;
    height: 200px;
  }

  .project-content {
    position: relative;
    top: 0;
    height: auto;
    flex-grow: 1;
  }

  .project-overlay {
    display: none; /* Disable overlay on mobile */
  }

  .mobile-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: auto;
  }
}

.project-content h3 {
  color: var(--primary);
  margin-bottom: 0.8rem;
  font-size: 1.4rem;
  text-align: center;
  font-weight: 700;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.project-content h3 i {
  color: var(--primary); /* Ensure icon uses the primary orange color */
  margin-left: 0.5rem;
}

.project p {
  color: rgba(255, 255, 255, 0.85);
  margin-bottom: 1rem;
  text-align: center;
  font-size: 0.95rem;
  line-height: 1.6;
  flex-grow: 1;
}

.project-tech {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 1rem 0;
  justify-content: center;
}

.tech-tag {
  background: rgba(255, 87, 51, 0.12);
  color: var(--primary);
  padding: 0.4rem 1rem;
  border-radius: 25px;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid rgba(255, 87, 51, 0.25);
  transition: var(--transition);
  backdrop-filter: blur(5px);
}

@media (min-width: 768px) {
  .tech-tag:hover {
    background: rgba(255, 87, 51, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 87, 51, 0.3);
  }
}

.project-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
  transition: var(--transition);
  padding: 0.8rem 1.5rem; /* Reduced horizontal padding */
  border-radius: 30px;
  background: linear-gradient(
    135deg,
    rgba(58, 37, 32, 0.55),
    rgba(24, 16, 14, 0.5)
  );
  border: 2px solid var(--primary);
  font-size: 0.95rem;
  position: relative;
  overflow: hidden;
  width: 100%;
  max-width: 250px; /* Increased max-width */
  margin: 0 auto;
  white-space: nowrap; /* Prevent text wrapping */
}

.project-link::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.1),
    transparent
  );
  transition: left 0.5s ease;
}

@media (min-width: 768px) {
  .project-link:hover::before {
    left: 100%;
  }
}

@media (min-width: 768px) {
  .project-link:hover {
    color: var(--white);
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(255, 87, 51, 0.4);
    border-color: var(--primary-light);
  }
}

.project-link i {
  margin-left: 0.5rem;
  color: inherit;
}

/* GitHub Contributions Section Styles */
#contributions {
  background: transparent;
}

.github-chart-container {
  width: 100%;
  max-width: 900px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 1rem;
  box-sizing: border-box;
}

.github-contributions-chart {
  width: 100%;
  min-width: 720px;
  height: auto;
  display: block;
}

@media (max-width: 768px) {
  .github-chart-container {
    padding: 0 0.5rem;
  }
}

/* Skills Section */
.skills-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.2rem;
  margin-top: 3rem;
  max-width: 900px;
  width: 100%;
}

.skill {
  background: linear-gradient(135deg, var(--medium-gray), var(--dark-gray));
  color: var(--primary);
  padding: 0.8rem 1.8rem;
  border-radius: 50px;
  font-size: 1rem;
  font-weight: 600;
  border: 1px solid rgba(255, 87, 51, 0.3);
  box-shadow: var(--shadow);
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

@media (min-width: 768px) {
  .skill:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: var(--white);
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
    border-color: var(--primary);
  }
}

@media (min-width: 768px) {
  .skill:hover i {
    color: var(--white);
  }
}

/* Project content adjustments */
.project-content {
  padding: 2rem;
}

.project h3 {
  font-size: clamp(1.3rem, 4vw, 1.6rem);
  margin-bottom: 1.5rem;
}

.project p {
  font-size: clamp(1rem, 3vw, 1.1rem);
  margin-bottom: 2rem;
}

.project-tech {
  margin: 1.5rem 0;
}

.indicator {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid transparent;
  cursor: pointer;
  transition: var(--transition);
}

.indicator.active {
  background: var(--primary);
  transform: scale(1.2);
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: 0 0 15px rgba(255, 87, 51, 0.7);
}

/* Contact Section */
#contact {
  background: linear-gradient(
    135deg,
    rgba(30, 30, 30, 0.7),
    rgba(18, 18, 18, 0.9)
  );
  border-radius: 20px 20px 0 0;
  margin-top: 2rem;
}

.contact-links {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-top: 3rem;
  flex-wrap: wrap;
  max-width: 900px;
  width: 100%;
}

.contact-link {
  display: inline-flex;
  align-items: center;
  color: var(--white);
  text-decoration: none;
  font-size: 1.2rem;
  padding: 1rem 2rem;
  border-radius: 50px;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.1),
    rgba(255, 255, 255, 0.05)
  );
  transition: var(--transition);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: var(--shadow);
  min-width: 200px;
  justify-content: center;
}

@media (min-width: 768px) {
  .contact-link:hover {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--white);
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
    border-color: var(--primary);
  }
}

.contact-link i {
  margin-right: 0.8rem;
  font-size: 1.3rem;
}

.back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 50px;
  height: 50px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  box-shadow: 0 4px 15px rgba(255, 87, 51, 0.4);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 99;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}

@media (min-width: 768px) {
  .back-to-top:hover {
    transform: translateY(-5px);
    background: var(--primary-dark);
  }
}

/* Footer */
footer {
  text-align: center;
  padding: 3rem 2rem;
  color: rgba(255, 255, 255, 0.6);
  font-size: 1rem;
  width: 100%;
  background: var(--dark-gray);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

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

section {
  animation: fadeIn 1s ease forwards;
}

@keyframes gradientBG {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* Responsive Design */
@media (max-width: 992px) {
  .projects-grid {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  }
}

@media (max-width: 768px) {
  nav ul {
    gap: 1.2rem;
  }

  h1 {
    font-size: 2.5rem;
  }

  h2 {
    font-size: 2rem;
  }

  h4 {
    font-size: 1.2rem;
  }

  .profile-img {
    width: 200px;
    height: 200px;
  }

  .contact-links {
    gap: 1.5rem;
  }

  .contact-link {
    font-size: 1.1rem;
    padding: 0.9rem 1.5rem;
    min-width: 160px;
  }

  .indicator {
    width: 14px;
    height: 14px;
  }
}

@media (max-width: 576px) {
  nav {
    padding: 1rem;
  }

  nav ul {
    gap: 0.8rem;
  }

  nav a {
    font-size: 0.95rem;
    padding: 0.4rem 0.8rem;
  }

  #home {
    padding-top: 4rem;
    padding-bottom: 4rem;
  }

  h1 {
    font-size: 2.2rem;
  }

  h2 {
    font-size: 1.8rem;
  }

  h4 {
    font-size: 1.1rem;
  }

  .profile-img {
    width: 160px;
    height: 160px;
  }

  .contact-links {
    flex-direction: column;
    align-items: center;
    gap: 1rem;
  }

  .contact-link {
    width: 100%;
    max-width: 280px;
  }

  .project-link {
    padding: 0.7rem 1.5rem;
    font-size: 0.95rem;
  }

  .skill {
    padding: 0.7rem 1.5rem;
    font-size: 0.95rem;
  }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 12px;
}

::-webkit-scrollbar-track {
  background: var(--black);
}

::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 6px;
  border: 3px solid var(--black);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary-light);
}
