html {
  scroll-behavior: smooth;
}
@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/css/all.min.css');

/* Custom CSS Variables for Dark Theme */
:root {
    --primary-color: #bb86fc; /* A vibrant, light purple */
    --primary-hover: #9c27b0; /* A deeper purple for hover state */
    --secondary-color: #e0e0e0; /* A light gray for body text */
    --bg-dark: #1f142a; /* A very dark purple */
    --bg-light: #2c1e40; /* A slightly lighter dark purple */
    --card-bg: #3c2a5a; /* A medium dark purple for card backgrounds */
    --nav-bg: #1f142a; /* Matches the dark background */
    --nav-text: #e0e0e0;
}

/* Light Theme Variables */
body.light-mode {
    --primary-color: #6200ee; /* A strong purple for accents */
    --primary-hover: #3700b3; /* Darker purple for hover state */
    --secondary-color: #1e1e1e; /* Dark gray for body text */
    --bg-dark: #f0f2f5; /* Light gray background */
    --bg-light: #ffffff; /* White background for contrast */
    --card-bg: #ffffff; /* White card background */
    --nav-bg: #ffffff; /* White navigation bar */
    --nav-text: #1e1e1e;
}

/* Global Styles */
body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg-dark); /* Use variable */
    color: var(--secondary-color); /* Use variable */
    transition: background-color 0.5s ease;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--primary-color);
    font-weight: 600;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--primary-hover);
}

/* Section Styling */
section {
    padding: 5rem 0;
    transition: background-color 0.5s ease;
}

.bg-light {
    background-color: var(--bg-light) !important;
}

/* Navbar */
.navbar {
    background-color: var(--bg-dark) !important; /* Use variable */
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.light-mode .navbar {
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.navbar-brand, .nav-link {
    color: var(--secondary-color) !important;
    font-weight: 300;
}

.nav-link.active, .nav-link:hover {
    color: var(--primary-color) !important;
}

.bg-light {
    background-color: var(--bg-light) !important; /* Use variable */
}

/* Hero (About) Section */
#about {
    background-image: linear-gradient(135deg, var(--bg-dark) 0%, #1e1e1e 100%);
    padding: 8rem 0;
    text-align: center;
}

#about h1 {
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    background: -webkit-linear-gradient(45deg, #bb86fc, #9c27b0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
}

#about p.lead {
    font-size: clamp(1rem, 2vw, 1.25rem);
    max-width: 800px;
    margin: 0 auto 2rem;
}

#about img {
    border: 4px solid var(--primary-color);
    box-shadow: 0 0 15px rgba(0, 255, 200, 0.5);
    transition: transform 0.3s ease-in-out, box-shadow 0.3s ease-in-out;
}

#about img:hover {
    transform: scale(1.05);
    box-shadow: 0 0 25px rgba(0, 255, 200, 0.8);
}

/* Projects Section */
.card {
    background-color: var(--card-bg); /* Use variable */
    color: var(--secondary-color); /* Use variable */
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.light-mode .card {
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

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

.card-title {
    color: var(--primary-color);
    font-weight: 600;
}

/* Contact Section */
#contact .form-control {
    background-color: var(--card-bg);
    color: var(--secondary-color);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

#contact .form-control:focus {
    background-color: var(--card-bg);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(0, 255, 200, 0.25);
}

/* Footer */
footer {
    background-color: var(--bg-dark) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

footer a {
    color: var(--secondary-color) !important;
    transition: color 0.3s ease, transform 0.3s ease;
}

footer a:hover {
    color: var(--primary-color) !important;
    transform: translateY(-3px);
}

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

/* Media query for small devices */
@media (max-width: 768px) {
    /* Adjust spacing on the contact form */
    #contact .col-lg-8 {
        padding: 0 15px;
    }
}

/* From Uiverse.io by ShrinilDhorda */
.btn {
    font-size: 1rem;
    padding: 0.6rem 0.6rem;
    border: none;
    outline: none;
    border-radius: 0.4rem;
    cursor: pointer;
    text-transform: uppercase;
    background-color: var(--bg-dark);
    color: var(--secondary-color);
    font-weight: 700;
    transition: 0.6s;
    box-shadow: 0px 4px 15px rgba(0, 0, 0, 0.1);
    -webkit-box-reflect: below 10px linear-gradient(to bottom, rgba(0,0,0,0.0), rgba(0,0,0,0.2));
}

.btn:active {
    scale: 0.92;
}

.btn:hover {
    background: linear-gradient(270deg, var(--primary-hover) 0%, var(--primary-color) 60%);
    color: var(--bg-dark);
    box-shadow: 0px 6px 20px rgba(0, 0, 0, 0.2);
}

body.light-mode .btn {
    padding: 0.6rem 0.6rem;
    font-size: 1rem;
    background-color: var(--bg-light);
    color: var(--secondary-color);
    box-shadow: none;
    border: #9c27b0 solid;
}

body.light-mode .btn:hover {
    background: linear-gradient(270deg, var(--primary-hover) 0%, var(--primary-color) 60%);
    color: var(--bg-dark);
    box-shadow: none;
}

/* From Uiverse.io by RiccardoRapelli */ 
.switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 34px;
}

.switch #input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #2196f3;
  -webkit-transition: 0.4s;
  transition: 0.4s;
  z-index: 0;
  overflow: hidden;
}

.sun-moon {
  position: absolute;
  content: "";
  height: 26px;
  width: 26px;
  left: 4px;
  bottom: 4px;
  background-color: yellow;
  -webkit-transition: 0.4s;
  transition: 0.4s;
}

#input:checked + .slider {
  background-color: black;
}

#input:focus + .slider {
  box-shadow: 0 0 1px #2196f3;
}

#input:checked + .slider .sun-moon {
  -webkit-transform: translateX(26px);
  -ms-transform: translateX(26px);
  transform: translateX(26px);
  background-color: white;
  -webkit-animation: rotate-center 0.6s ease-in-out both;
  animation: rotate-center 0.6s ease-in-out both;
}

.moon-dot {
  opacity: 0;
  transition: 0.4s;
  fill: gray;
}

#input:checked + .slider .sun-moon .moon-dot {
  opacity: 1;
}

.slider.round {
  border-radius: 34px;
}

.slider.round .sun-moon {
  border-radius: 50%;
}

#moon-dot-1 {
  left: 10px;
  top: 3px;
  position: absolute;
  width: 6px;
  height: 6px;
  z-index: 4;
}

#moon-dot-2 {
  left: 2px;
  top: 10px;
  position: absolute;
  width: 10px;
  height: 10px;
  z-index: 4;
}

#moon-dot-3 {
  left: 16px;
  top: 18px;
  position: absolute;
  width: 3px;
  height: 3px;
  z-index: 4;
}

#light-ray-1 {
  left: -8px;
  top: -8px;
  position: absolute;
  width: 43px;
  height: 43px;
  z-index: -1;
  fill: white;
  opacity: 10%;
}

#light-ray-2 {
  left: -50%;
  top: -50%;
  position: absolute;
  width: 55px;
  height: 55px;
  z-index: -1;
  fill: white;
  opacity: 10%;
}

#light-ray-3 {
  left: -18px;
  top: -18px;
  position: absolute;
  width: 60px;
  height: 60px;
  z-index: -1;
  fill: white;
  opacity: 10%;
}

.cloud-light {
  position: absolute;
  fill: #eee;
  animation-name: cloud-move;
  animation-duration: 6s;
  animation-iteration-count: infinite;
}

.cloud-dark {
  position: absolute;
  fill: #ccc;
  animation-name: cloud-move;
  animation-duration: 6s;
  animation-iteration-count: infinite;
  animation-delay: 1s;
}

#cloud-1 {
  left: 30px;
  top: 15px;
  width: 40px;
}

#cloud-2 {
  left: 44px;
  top: 10px;
  width: 20px;
}

#cloud-3 {
  left: 18px;
  top: 24px;
  width: 30px;
}

#cloud-4 {
  left: 36px;
  top: 18px;
  width: 40px;
}

#cloud-5 {
  left: 48px;
  top: 14px;
  width: 20px;
}

#cloud-6 {
  left: 22px;
  top: 26px;
  width: 30px;
}

@keyframes cloud-move {
  0% {
    transform: translateX(0px);
  }

  40% {
    transform: translateX(4px);
  }

  80% {
    transform: translateX(-4px);
  }

  100% {
    transform: translateX(0px);
  }
}

.stars {
  transform: translateY(-32px);
  opacity: 0;
  transition: 0.4s;
}

.star {
  fill: white;
  position: absolute;
  -webkit-transition: 0.4s;
  transition: 0.4s;
  animation-name: star-twinkle;
  animation-duration: 2s;
  animation-iteration-count: infinite;
}

#input:checked + .slider .stars {
  -webkit-transform: translateY(0);
  -ms-transform: translateY(0);
  transform: translateY(0);
  opacity: 1;
}

#star-1 {
  width: 20px;
  top: 2px;
  left: 3px;
  animation-delay: 0.3s;
}

#star-2 {
  width: 6px;
  top: 16px;
  left: 3px;
}

#star-3 {
  width: 12px;
  top: 20px;
  left: 10px;
  animation-delay: 0.6s;
}

#star-4 {
  width: 18px;
  top: 0px;
  left: 18px;
  animation-delay: 1.3s;
}

@keyframes star-twinkle {
  0% {
    transform: scale(1);
  }

  40% {
    transform: scale(1.2);
  }

  80% {
    transform: scale(0.8);
  }

  100% {
    transform: scale(1);
  }
}

/* New Preloader & Body visibility CSS */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-dark);
    display: flex; /* Centering the content */
    justify-content: center; /* Horizontally centers content */
    align-items: center; /* Vertically centers content */
    z-index: 1000;
    transition: opacity 0.5s ease-out;
}

#preloader.fade-out {
    opacity: 0;
}

.welcome-message {
    text-align: center; /* Ensures text inside is centered */
}

.welcome-message-text {
    /* Use a responsive clamp value */
    font-size: clamp(2.5rem, 6vw, 5rem);
    animation: welcomeFadeIn 1.5s ease-in-out forwards;
}

@keyframes welcomeFadeIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

body.hidden {
    overflow: hidden;
}

body.fade-in {
    animation: contentFadeIn 1s ease-in-out forwards;
}

@keyframes contentFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Styling for the Spline 3D Scene */
.spline-container {
    width: 100%;
    max-width: 950px; /* This keeps it from getting too wide on large screens */
    aspect-ratio: 16 / 9; /* This is the fix! It maintains a 16:9 aspect ratio */
    margin: 0 auto;
    border-radius: 15px;
    overflow: hidden;
}

#canvas3d {
    width: 100%;
    height: 100%;
}

/* Media query for tablets and mobile devices */
@media (max-width: 768px) {
    /* Adjust spacing on sections */
    section {
        padding: 3rem 0;
    }

    /* Reduce font sizes for better readability */
    h1 {
        font-size: 2.5rem !important;
    }

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

    .lead {
        font-size: 1rem !important;
    }

    /* Center text on all devices */
    #about .col-lg-6 {
        text-align: center !important;
    }
}

/* Project Card - Key Technologies Styling */

.key-tech-section h6 {
    /* Ensures the heading color stands out but is not the primary color */
    color: var(--secondary-color);
    font-size: 0.9rem;
    letter-spacing: 0.5px;
    opacity: 0.8;
}

.tech-badges .badge {
    /* Style for the individual technology badges */
    padding: 0.4em 0.7em;
    margin: 2px;
    font-size: 0.75rem;
    font-weight: 500;
    
    /* Use theme variables for color consistency */
    background-color: var(--primary-color) !important;
    color: var(--bg-dark) !important; /* Dark text on the badge */
    border-radius: 5px;
}

/* Light Mode specific badge styling */
body.light-mode .tech-badges .badge {
    background-color: var(--primary-color) !important;
    color: var(--bg-light) !important; /* Lighter text on the badge */
}

/* Override default Bootstrap primary color for badges in dark mode */
.bg-primary {
    background-color: var(--primary-color) !important;
}

/* Certificates Section */
.certificate-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.certificate-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
}

.certificate-img {
  height: 220px;
  object-fit: contain;
  padding: 1rem;
  background-color: var(--bg-light);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Light mode fix */
body.light-mode .certificate-img {
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

/* Certificate badges */
.badge-cert {
  background-color: var(--primary-color);
  color: var(--bg-dark);
  font-size: 0.7rem;
  padding: 0.4em 0.6em;
  border-radius: 4px;
}
