html {
  scroll-behavior: smooth;
}

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

body {
  font-family: 'Segoe UI', sans-serif;
  background: #0f1123;
  color: #fff;
  width: 100%;
}

/* =================================
   Preloader & Entry Animation
==================================== */
#preloader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background: #0f1123;
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: opacity 0.75s ease-in-out;
}

#preloader.hidden {
  opacity: 0;
  pointer-events: none;
}

.loader-logo {
  color: #7f5af0;
  text-align: center;
}

.loader-logo h2 {
  font-size: 2.5rem;
  font-weight: 700;
  margin: 0;
  display: flex; /* Allows letter spans to align correctly */
}

.loader-logo h6 {
  font-size: 1rem;
  font-weight: 400;
  color: #cbd5e1;
  margin-top: 8px;
  display: flex; /* Allows letter spans to align correctly */
  justify-content: center;
}

/* Letter animation styles */
.loader-logo span {
  display: inline-block;
  opacity: 0;
  transform: translateY(20px) scale(0.8);
  animation: wave-in 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes wave-in {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Initially hide content and prepare for entry animation */
/* Animate header and hero immediately on load */
.header, .hero {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease-out 0.4s, transform 0.6s ease-out 0.4s; /* Added delay */
}

/* When body has 'loaded' class, animate content in */
body.loaded .header, body.loaded .hero {
  opacity: 1;
  transform: translateY(0);
}

/* Prepare other sections for scroll animation */
/* Base style for all animated elements */
.anim-from-top, .anim-from-bottom, .anim-from-left, .anim-from-right {
  opacity: 0;
  transition: opacity 0.7s ease-out, transform 0.7s ease-out;
}

/* Initial positions */
.anim-from-top { transform: translateY(-30px); }
.anim-from-bottom { transform: translateY(30px); }
.anim-from-left { transform: translateX(-30px); }
.anim-from-right { transform: translateX(30px); }

/* Final (visible) state */
.animate-on-scroll.is-visible .anim-from-top,
.animate-on-scroll.is-visible .anim-from-bottom,
.animate-on-scroll.is-visible .anim-from-left,
.animate-on-scroll.is-visible .anim-from-right {
  opacity: 1;
  transform: translate(0, 0);
}

/* Staggered animation delays for a more dynamic reveal */
.about-section.is-visible .right.anim-from-right {
  transition-delay: 0.2s;
}

.skills-section.is-visible .brain-wrapper.anim-from-bottom {
  transition-delay: 0.2s;
}

#certificates.is-visible > p.anim-from-top {
  transition-delay: 0.15s;
}
#certificates.is-visible .cert-grid .card.anim-from-bottom:nth-of-type(1) {
  transition-delay: 0.3s;
}
#certificates.is-visible .cert-grid .card.anim-from-bottom:nth-of-type(2) {
  transition-delay: 0.45s;
}

.footer.is-visible .info.anim-from-right {
  transition-delay: 0.2s;
}
.footer.is-visible > p.anim-from-bottom {
  transition-delay: 0.4s;
}

.header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  padding: 1.2rem 8%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 1000;
  background: rgba(15, 17, 35, 0.5); /* Semi-transparent background for the whole header */
  backdrop-filter: blur(10px);      /* The blur effect */
  -webkit-backdrop-filter: blur(10px); /* For Safari */
  transition: padding 0.3s ease, background-color 0.3s ease, box-shadow 0.3s ease;
}

/* Style for the header when the page is scrolled */
.header.scrolled {
  padding: 0.8rem 8%;
  background: rgba(21, 24, 48, 0.8); /* Slightly more opaque background */
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.navbar {
  /* This allows us to center the navigation pill */
  flex-grow: 1;
  display: flex;
  justify-content: center;
}

.logo a {
  color: #7f5af0;
  font-size: 1.8em;
  text-decoration: none;
}

.logo a:hover{
  color: #0ea5e9;
  text-shadow: 5px 3px 10px #6a6b97;
}

.navbar ul {
  display: flex;
  list-style: none;
  /* Pill container style */
  background: rgba(25, 28, 58, 0.8); /* Made slightly more opaque to stand out */
  padding: 0.5rem;
  border-radius: 999px; /* This creates the pill shape */
  border: 1px solid rgba(255, 255, 255, 0.1);
  gap: 0.5rem; /* Space between each nav item */
}

.navbar a {
  color: #ccc;
  text-decoration: none;
  font-weight: 500;
  padding: 0.6rem 1.2rem; /* Padding inside each nav item's pill */
  border-radius: 999px;
  transition: all 0.3s ease-in-out;
  display: block;
}

.navbar a:hover,
.navbar a.active-link {
  background-color: #38bdf8;
  color: #0f1123; /* Dark text for contrast on the bright background */
  transform: translateY(-2px); /* Slight lift effect */
}
.who {
  width: 12ch;
  height: 20px;
  white-space: nowrap;
  animation: typing 2s steps(12) infinite alternate-reverse;
  overflow: hidden;
  display: inline-block;

}

@keyframes typing {
  from {
    width: 0ch;
  }
}

.hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 120px 8% 80px; /* Adjusted top padding for the fixed header */
  gap: 40px;
}

.hero-text {
  flex: 1;
}

.hero-text h1 {
  font-size: 2.8em;
}
.hero-text h1 span:nth-child(1){
  color: #7054c2;
  font-size: 100PX;
  font-weight: 900;
}

.hero-text h1 span:nth-child(2){
  width: 13.5ch;
  height: 50px;
  white-space: nowrap;
  animation: typing 2s steps(22) infinite alternate-reverse;
  overflow: hidden;
  display: inline-block;

}

@keyframes typing {
  from {
    width: 0ch;
  }
}

.hero-text h1:nth-child(2) {
  color: #38bdf8;
}

.hero-text p {
  margin-top: 20px;
  font-size: 1.2em;
  color: #cbd5e1;
}

.buttons button {
  margin-top: 30px;
  margin-right: 15px;
  padding: 12px 24px;
  font-size: 1em;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: 0.3s;
}

.buttons button:hover {
  transition: 0.3s;
  transform: scale(1.08);
  box-shadow: 3px 2px 8px #6366f1;
}

.buttons a:first-child button {
  background: linear-gradient(135deg, #6366f1, #7054c2);
  color: white;
}

.buttons a:last-child button {
  background: transparent;
  border: 2px solid #7f5af0;
  color: #7f5af0;
}

.hero-image img {
  width: 350px;
  border-radius: 100px 0 100px 0;
  background: #7f5af0;
  padding: 10px;
}

.section {
  padding: 80px 60px;
  display: grid;

}


.about-section {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 60px;
  min-height: 100vh;
  gap: 40px;
}

.left {
  flex: 1;
  text-align: left;
  position: relative;
}

.left h1 {
  font-size: 48px;
  margin-bottom: 20px;
}

.brain-bg {
  position: absolute;

  left: 0;
  top: 100px;
  width: 200px;
  opacity: 0.1;
}

.right {
  flex: 2;
}

.window {
  background: #131626;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.4);
  position: relative;
}

.top-bar {
  display: flex;
  gap: 20%;
}

.top-bar .bar {
  display: flex;
  gap: 8px;
  margin-bottom: 50px;
}

.home-menu {
  display: none;
  cursor: pointer;
  flex-direction: column;
  justify-content: space-around;
  width: 28px;
  height: 24px;
}

.home-menu span {
  display: block;
  width: 100%;
  height: 3px;
  background-color: #fff;
  border-radius: 3px;
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

.home-menu.active span:nth-child(1) { transform: rotate(45deg) translate(7px, 7px); }
.home-menu.active span:nth-child(2) { opacity: 0; }
.home-menu.active span:nth-child(3) { transform: rotate(-45deg) translate(7px, -7px); }

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.red {
  background-color: #ff5f56;
}

.yellow {
  background-color: #ffbd2e;
}

.green {
  background-color: #27c93f;
}

.typing-box {
  width: 80%;
  background-color: #1d2133;
  padding: 10px;
  margin: 10px;
  border-radius: 3px;
}

.cursor {
  margin-right: 10px;
}

.domaine {
  width: 50%;
  height: 20px;
  background-color: #1d2133;
  padding: 5px;
  text-align: center;
  border-radius: 5px;
  font-size: 10px;
}

.profile-box {
  background-color: #1d2133;
  padding: 20px;
  border-radius: 10px;
  font-size: 16px;
  line-height: 1.6;
}

.skills-section {
  position: relative;
  align-items: center;
  width: 100%;
  display: flex;
  justify-content: space-between;
  padding-left: 60px;

}

.skills-section h2 {
  font-size: 2.5rem;
  margin-bottom: 40px;
}

.brain-wrapper {
  width: 50%;
  position: relative;
  display: flex;
  left: -50px;
  justify-content: center;
  padding: 0;
}

.brain-svg {
  padding: 0;
  width: 100%; 
  height: auto;
}

.brain-svg line {
  stroke: #777bff;
  stroke-width: 2;
}

.skill-node {
  cursor: pointer;
}

.brain-svg .skill-node circle {
  fill: #1e293b; /* Darker fill to make icons stand out */
  stroke: #7f5af0;
  stroke-width: 2;
  transition: transform 0.2s, fill 0.2s;
}

.brain-svg .skill-node:hover circle {
  transform: scale(1.05);
  fill: #38bdf8;
}

.brain-svg image {
  pointer-events: none; /* Ensures mouse events go to the circle below */
}

.tooltip {
  position: absolute;
  background: rgba(30, 30, 70, 0.95);
  padding: 10px 14px;
  color: white;
  font-size: 14px;
  border-radius: 8px;
  display: none;
  pointer-events: none;
  min-width: 160px;
  z-index: 100;
}

.progress-bar {
  width: 100%;
  height: 6px;
  background: #333;
  border-radius: 4px;
  margin-top: 6px;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: #7f5af0;
  border-radius: 4px;
  transition: width 0.3s ease;
}

.skills-graph img {
  width: 100%;
  max-width: 600px;
  margin-top: 30px;
}

.cert-grid {
  display: flex;
  justify-content: center;
  position: relative;
  gap: 100px;
  flex-wrap: wrap;
  margin-top: 30px;
}

.cert-grid .card {
  width: 320px;
  overflow: hidden;
  background: #1e293b;
  border-radius: 30px;
  position: relative;
}

.cert-grid .card .card-body {
  width: 100%;
  height: 100%;
  top: 0;
  right: -100%;
  color: #000000;
  position: absolute;
  background: #1f3d4738;
  backdrop-filter: blur(5px);
  border-radius: 15px;
  padding: 30px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  transition: 1.5s;
}

.cert-grid .card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 30px;
  padding: 15px;
  max-width: 400px;
}

.cert-grid .card:hover .card-body {
  transition: 0.5s;
  right: 0;
}

.cert-grid .card .card-body {
  transition: 0.5s;
}

.card-title {
  text-transform: uppercase;
  font-size: 50px;
  font-weight: 500;
}

.card-sub-title {
  text-transform: capitalize;
  font-size: 14px;
  font-weight: 300;
}

.card-btn {
  color: #fefeff;
  background: #7054c2;
  width: 120px;
  padding: 10px 20px;
  border-radius: 5px;
  text-transform: capitalize;
  border: none;
  outline: none;
  font-weight: 500;
  cursor: pointer;
  transition: 0.2s;
}

.card-btn:hover {
  transform: scale(1.05);
  box-shadow: -5px 3px 10px #131626;
  background: #6366f1;
  color: #131626;
  transition: 0.2s;
}

.bot-ui {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.bot-ui input {
  flex: 1;
  padding: 10px;
  border-radius: 10px;
  border: none;
}

.bot-ui button {
  background: #38bdf8;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 10px;
}

.bot-avatar {
  margin-top: 20px;
  width: 120px;
}

.cta {
  text-align: center;
}

.cta button {
  margin-top: 20px;
  padding: 12px 24px;
  font-size: 1em;
  background: linear-gradient(to right, #6366f1, #7f5af0);
  border: none;
  color: white;
  border-radius: 10px;
}

.footer {
  text-align: center;
  padding: 40px;
  background: #0a0c1b;
}

.social-icons {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin: 20px 0;
}

.social-icons img {
  width: 28px;
  transition: 0.3s;
}

.footer .ftr {
  display: flex;
  justify-content: space-around;
  gap: 1rem;

}

.footer .info a {
  text-decoration: none;
  color: #fff;
  transition: 0.3s;
}

.footer .info a:hover {
  color: #6366f1;
  transform: scale(1.02);
  transition: 0.3s;
}

.footer .ftr a img:hover {
  transition: 0.2s;
  transform: scale(1.1);
}

/* Contact Section */
.section.cta {
  background-color: #0f1123;
  color: white;
  padding: 60px 40px;
  border-radius: 16px;
  max-width: 600px;
  margin: 60px auto;
  box-shadow: 0 0 30px rgba(56, 189, 248, 0.2);
  font-family: 'Segoe UI', sans-serif;
}

.section.cta h2 {
  text-align: center;
  margin-bottom: 30px;
  font-size: 24px;
  color: #38bdf8;
}

#contact-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

#contact-form label {
  font-weight: 500;
  font-size: 15px;
  margin-bottom: 4px;
}

#contact-form input,
#contact-form textarea {
  padding: 12px 16px;
  border-radius: 10px;
  border: 2px solid #38bdf8;
  background-color: #1e293b;
  color: white;
  font-size: 15px;
  transition: border-color 0.3s ease;
  resize: vertical;
}

#contact-form input:focus,
#contact-form textarea:focus {
  border-color: #7054c2;
  background: #191d24;
  outline: none;
}

#contact-form textarea {
  min-height: 120px;
}

#contact-form button {
  background-color: #38bdf8;
  color: #0f1123;
  font-weight: bold;
  font-size: 16px;
  padding: 14px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background-color 0.3s, color 0.3s;
  position: relative;
  overflow: hidden;
  min-height: 50px; /* Ensure consistent height during transitions */
  display: flex;
  align-items: center;
  justify-content: center;
}

#contact-form button:hover:not(:disabled) {
  background-color: #0ea5e9;
}

/* Button states for submission animation */
.button-text,
.button-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.button-loader {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
}

/* Loader (Spinner) */
.button-loader {
  transform: translateY(10px);
}

.button-loader::after {
  content: '';
  width: 20px;
  height: 20px;
  border: 2px solid #0f1123;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* When .sending is added to the button */
#contact-form button.sending .button-text {
  opacity: 0;
  transform: translateY(-10px);
}
#contact-form button.sending .button-loader {
  opacity: 1;
  transform: translateY(0);
}

/* Success Message Styling */
.form-success-message {
  text-align: center;
  display: none; /* Hidden by default */
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease-out 0.3s, transform 0.6s ease-out 0.3s; /* Add delay */
}

.form-success-message.visible {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

.form-success-message h3 {
  color: #38bdf8;
  font-size: 1.8rem;
  margin-bottom: 1rem;
}

.form-success-message p {
  color: #cbd5e1;
  line-height: 1.6;
  font-size: 1.1rem;
}

/* =================================
   Responsive Design (Tablet & Mobile)
==================================== */
@media screen and (max-width: 900px) {
  .header {
    padding: 1rem 5%; /* Adjust padding for smaller screens */
  }

  .hero{
    display: grid;
    grid-template-columns: 1fr; /* Ensure single column layout */
    padding: 120px 5% 60px; /* Adjust padding for mobile */
    text-align: center; /* Center hero text */
    gap: 30px;
  }

  .hero-text h1 {
    font-size: 2.2em; /* More responsive font size */
  }

  .hero-text h1 span:nth-child(1) {
    font-size: 80px; /* Smaller, more manageable size */
  }

  .hero-text h1 span:nth-child(2) {
    font-size: 24px; /* Adjust typing text size */
    height: 30px;
  }

  .buttons {
    display: flex;
    flex-direction: column; /* Stack buttons on mobile */
    align-items: center;
    gap: 15px;
  }

  .buttons button {
    width: 250px; /* Give buttons a consistent width */
    margin-right: 0;
  }

  .hero-image {
    position: relative;
    right: 50px;
    width: 70%; /* Adjust image size */
    max-width: 280px;
    margin: 5px auto 0; /* Center the image */
    justify-self: center;
  }

  .about-section,
  .skills-section,
  .footer .ftr {
    display: grid; /* Stacks elements vertically */
    grid-template-columns: 1fr;
    padding-left: 5%;
    padding-right: 5%;
    text-align: center;
    gap: 30px;
  }

  .skills-section h2 {
    margin-bottom: 20px;
  }

  .brain-wrapper {
    width: 100%;
    left: 0;
    height: auto;
    padding: 0;
  }

  .home-menu {
    display: flex;
    z-index: 1001; /* Ensure hamburger is above the overlay */
  }

  .navbar {
    /* Full-screen overlay style */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(15, 17, 35, 0.95);
    -webkit-backdrop-filter: blur(15px);
    backdrop-filter: blur(15px);
    
    /* Animation: Fade in/out */
    opacity: 0;
    pointer-events: none;
    transform: translateY(-15px); /* Start slightly above screen for slide effect */
    transition: opacity 0.4s ease, transform 0.4s ease;
    
    /* Center the navigation links */
    display: flex;
    justify-content: center;
    align-items: center;
  }

  .navbar.active {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0); /* Slide into view */
  }

  .navbar ul {
    flex-direction: column;
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    gap: 1.5rem; /* Increase gap between links */
    text-align: center;
  }

  .navbar a {
    padding: 0;
    border-radius: 0;
    font-size: 1.5rem; /* Make links larger and more touch-friendly */
    font-weight: 600;
    color: #fff;
  }

  .navbar a:hover, .navbar a.active-link {
    transform: none; /* Disable lift effect on mobile */
    background: none;
    color: #38bdf8;
  }

  .section.cta{
    width: 90%; /* Make contact form wider on mobile */
    padding: 40px 20px;
  }
}