/* --- 0. SETUP & VARIABLES --- */
:root {
  /* Light Theme */
  --bg-color: #f8f9fa;
  --text-color-primary: #1a1a1a;
  --text-color-secondary: #4a4a4a;
  --card-bg-color: rgba(255, 255, 255, 0.95);
  --border-color: #e0e0e0;
  --shadow-color-soft: rgba(0, 0, 0, 0.1);
  --shadow-color-hard: rgba(0, 0, 0, 0.15);
  --accent-color: #aa80ff;
  --accent-color-darker: #8864cc;
  --paper-texture: none;

  /* Watercolor Splotch Colors */
  --splotch-color-1: #aa80ff;
  --splotch-color-2: #c8ff32;
  --splotch-color-3: #111111;

  /* Doodle Colors */
  --doodle-stroke: #ffffff;
  --doodle-heart: #aa80ff;
  --doodle-lightning: #7ab800;
  /* Darker green for light mode visibility */
  --doodle-triangle: #aa80ff;
  --doodle-cloud: #7ab800;
  /* Darker green for light mode visibility */
  --doodle-cross: #aa80ff;
  --btn-text-color: #ffffff;
  /* White text on purple buttons */

  /* Fonts */
  --font-body: 'Inter', 'Segoe UI', sans-serif;
  --font-heading: 'Caveat', cursive;

  /* Transitions & Borders */
  --transition-fast: 0.2s ease-out;
  --transition-medium: 0.4s ease-out;
  --card-radius: 40% 60% 70% 30% / 50% 50% 50% 50%;
  --card-radius-hover: 30% 70% 60% 40% / 50% 50% 50% 50%;

  /* Scroll Progress */
  --scroll-progress: 0%;
}

/* Performance optimizations */
* {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* GPU acceleration for animations */
.doodle,
.splotch,
.cursor,
.scroll-progress-bar {
  will-change: transform;
  transform: translateZ(0);
}

body.dark-mode {
  /* AMOLED Dark Theme */
  --bg-color: #000000;
  --text-color-primary: #ffffff;
  --text-color-secondary: #b7bccb;
  --card-bg-color: rgba(20, 20, 20, 0.95);
  --border-color: #2a2a2a;
  --shadow-color-soft: rgba(0, 0, 0, 0.75);
  --shadow-color-hard: rgba(0, 0, 0, 0.95);
  --accent-color: #c8ff32;
  --accent-color-darker: #a8df12;
  --paper-texture: none;
  --btn-text-color: #111111;
  /* Black text on green buttons */

  /* Doodle Colors in Dark Mode - brighter for visibility */
  --doodle-stroke: #e5f0ff;
  --doodle-lightning: #c8ff32;
  /* Bright green on dark bg */
  --doodle-cloud: #c8ff32;
  /* Bright green on dark bg */
  --doodle-heart: #c8ff32;
  --doodle-triangle: #aa80ff;
}

/* Dark mode hover fixes - black text on green background */
body.dark-mode .skills-list span:hover,
body.dark-mode .project-tags span:hover {
  color: #111111 !important;
}

/* Dark mode overrides */
body.dark-mode .see-details-btn {
  color: #111111 !important;
}

body.dark-mode .see-details-btn:hover {
  color: #111111 !important;
}

/* --- 1. BASE & TYPOGRAPHY --- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  /* Enable hardware acceleration for better scrolling */
  -webkit-transform: translate3d(0, 0, 0);
  transform: translate3d(0, 0, 0);
}

body {
  background-color: var(--bg-color);
  background-image: var(--paper-texture);
  color: var(--text-color-primary);
  font-family: var(--font-body);
  transition: background-color 0.3s ease;
  overflow-x: hidden;
  /* Optimize scrolling performance */
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: none;
}

h1,
h2,
h3 {
  font-family: var(--font-heading);
  color: var(--text-color-primary);
  font-weight: 700;
  letter-spacing: 1px;
}

p {
  line-height: 1.7;
  color: var(--text-color-secondary);
}

body,
a,
button,
.slider {
  cursor: auto !important;
}

/* --- 2. INTERACTIVE ELEMENTS & BACKGROUNDS --- */
.cursor {
  display: none !important;
}

/* Performance optimizations */
.watercolor-container,
.doodle-bg,
.scroll-progress-bar,
.paper-card,
.project-tags span,
.see-details-btn,
.modal-tech-stack span,
.skills-list span,
.social-links a {
  will-change: transform;
  contain: layout style paint;
}

.scroll-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 5px;
  background: var(--accent-color);
  width: var(--scroll-progress);
  z-index: 1000;
  box-shadow: 2px 0 5px var(--accent-color);
}

.watercolor-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  z-index: -2;
  pointer-events: none;
  /* Performance optimization */
  contain: strict;
  will-change: auto;
}

.splotch {
  position: absolute;
  border-radius: 50%;
  opacity: 0.15;
  filter: blur(100px);
  will-change: transform;
  contain: layout style;
}

.splotch:nth-child(1) {
  background: var(--splotch-color-1);
  width: 60vmax;
  height: 60vmax;
  animation: move1 20s infinite alternate;
}

.splotch:nth-child(2) {
  background: var(--splotch-color-2);
  width: 50vmax;
  height: 50vmax;
  animation: move2 25s infinite alternate;
}

@keyframes move1 {
  from {
    transform: translate3d(-10vw, -10vh, 0) rotate(-90deg);
    border-radius: 24% 76% 35% 65% / 27% 36% 64% 73%;
  }

  to {
    transform: translate3d(30vw, 40vh, 0) rotate(90deg);
    border-radius: 76% 24% 33% 67% / 68% 55% 45% 32%;
  }
}

@keyframes move2 {
  from {
    transform: translate3d(50vw, -20vh, 0) rotate(45deg);
    border-radius: 47% 53% 70% 30% / 30% 50% 50% 70%;
  }

  to {
    transform: translate3d(10vw, 60vh, 0) rotate(-45deg);
    border-radius: 33% 67% 24% 76% / 46% 29% 71% 54%;
  }
}

.doodle-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 10;
  /* Performance optimization */
  contain: strict;
}

.doodle {
  position: absolute;
  opacity: 0.75;
  filter: url(#sketchy-filter);
  stroke: var(--doodle-stroke);
}

body.dark-mode .doodle {
  opacity: 0.6;
}

.doodle.star {
  top: 8%;
  left: 3%;
  animation: float 8s ease-in-out infinite alternate;
}

.doodle.squiggle {
  bottom: 15%;
  right: 8%;
  animation: float 10s ease-in-out infinite alternate -2s;
}

.doodle.circle {
  top: 55%;
  left: 85%;
  animation: rotate 20s linear infinite;
}

.doodle.zigzag {
  top: 20%;
  left: 85%;
  animation: float 11s ease-in-out infinite alternate -3s;
}

.doodle.heart {
  bottom: 10%;
  left: 20%;
  stroke: var(--doodle-heart);
  animation: pulse 3s ease-in-out infinite;
}

.doodle.lightning {
  top: 70%;
  right: 12%;
  stroke: var(--doodle-lightning);
  animation: float 9s ease-in-out infinite alternate -1s;
}

.doodle.triangle {
  top: 80%;
  left: 5%;
  stroke: var(--doodle-triangle);
  animation: rotate 15s linear infinite reverse;
}

.doodle.cloud {
  top: 5%;
  right: 25%;
  stroke: var(--doodle-cloud);
  animation: float 13s ease-in-out infinite alternate;
}

.doodle.cross {
  bottom: 30%;
  left: 45%;
  stroke: var(--doodle-cross);
  animation: float 7s ease-in-out infinite alternate -4s;
}

@keyframes float {
  to {
    transform: translate3d(0, 20px, 0) rotate(5deg);
  }
}

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

@keyframes pulse {

  0%,
  100% {
    transform: scale(1) rotate(-3deg);
  }

  50% {
    transform: scale(1.1) rotate(3deg);
  }
}


/* --- 3. LAYOUT & CARDS --- */
.main-content {
  max-width: 1000px;
  margin: 0 auto;
  padding: 2rem;
  position: relative;
  z-index: 1;
  /* Performance optimization */
  contain: layout style;
  will-change: auto;
}

.paper-card {
  background: var(--card-bg-color);
  border: 2px solid var(--border-color);
  padding: 2rem;
  box-shadow: 3px 3px 0px 0px var(--shadow-color-hard), 8px 8px 24px 0px var(--shadow-color-soft);
  border-radius: var(--card-radius);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-radius var(--transition-medium);
  animation: popIn 1s cubic-bezier(.68, -0.55, .27, 1.55) 0.2s both;
}

.paper-card:hover {
  transform: translateY(-10px) rotate(-1.5deg) scale(1.02);
  box-shadow: 8px 8px 0px 0px var(--shadow-color-hard), 20px 20px 40px 0px var(--shadow-color-soft);
  border-radius: var(--card-radius-hover);
}

@keyframes popIn {
  0% {
    transform: scale(0.9) rotate(-2deg);
    opacity: 0;
  }

  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

.section-title {
  font-size: 3.5rem;
  margin-bottom: 2rem;
  text-align: center;
  position: relative;
  opacity: 0;
  transform: translateY(20px) rotate(-2deg);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.scroll-animate.visible .section-title {
  opacity: 1;
  transform: translateY(0) rotate(-1deg);
}

/* --- 4. COMPONENTS --- */

/* Header & Navigation */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
  margin-bottom: 4rem;
}

.logo {
  font-family: var(--font-heading);
  font-size: 2.5rem;
  font-weight: 700;
  transform: rotate(-5deg);
  color: var(--accent-color);
}

nav {
  display: flex;
  gap: 2rem;
}

.nav-link {
  color: var(--text-color-primary);
  text-decoration: none;
  font-weight: 500;
  font-size: 1.1rem;
  position: relative;
}

.nav-link span {
  display: inline-block;
  transition: transform var(--transition-fast);
}

.nav-link:hover span {
  transform: translateY(-2px);
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: -5%;
  width: 110%;
  height: 4px;
  background-image: url("data:image/svg+xml,%3csvg width='100%25' height='100%25' xmlns='http://www.w3.org/2000/svg'%3e%3crect width='100%25' height='100%25' fill='none' stroke='%237C5CFF' stroke-width='4' stroke-dasharray='6%2c 14' stroke-dashoffset='0' stroke-linecap='square'/%3e%3c/svg%3e");
  transform: scaleX(0);
  transform-origin: center;
  transition: transform var(--transition-medium);
}

.nav-link:hover::after {
  transform: scaleX(1);
  animation: wiggle 0.5s linear infinite;
}

@keyframes wiggle {
  0% {
    border-radius: 3px;
  }

  50% {
    transform: scaleX(1) skewX(10deg);
  }

  100% {
    border-radius: 3px;
  }
}

.nav-link:hover {
  cursor: pointer !important;
}

/* Hero Section */
.hero {
  min-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.hero-card {
  max-width: 700px;
  transform: rotate(1deg);
}

.hero-title {
  font-size: 5rem;
  line-height: 1.1;
  margin-bottom: 1rem;
}

.hero-subtitle {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  color: var(--accent-color);
  font-family: var(--font-body);
}

.hero-description {
  font-size: 1.1rem;
  margin-bottom: 2rem;
}

.cta-button {
  background-color: var(--accent-color);
  color: var(--btn-text-color);
  padding: 0.85rem 1.8rem;
  border: 2px solid var(--border-color);
  border-radius: 14px;
  text-decoration: none;
  font-weight: 700;
  transition: all var(--transition-fast);
  display: inline-block;
  box-shadow: 3px 3px 0px 0px var(--border-color);
  max-width: fit-content;
}

.cta-button:hover {
  background-color: var(--accent-color-darker);
  transform: translateY(-4px) rotate(-2deg);
  box-shadow: 5px 5px 0px 0px var(--border-color);
}

.cta-button:active {
  transform: translateY(2px) rotate(1deg);
  box-shadow: 1px 1px 0px 0px var(--border-color);
}

/* About Section */
#about,
#projects,
#contact,
#skills,
#current,
#research {
  padding-top: 6rem;
  margin-top: -4rem;
}

.about-card {
  display: flex;
  align-items: center;
  gap: 2rem;
  transform: rotate(-1deg);
}

.profile-pic {
  width: 150px;
  height: 150px;
  border-radius: 45% 55% 60% 40% / 58% 45% 55% 42%;
  object-fit: cover;
  border: 3px solid var(--border-color);
  transition: border-radius var(--transition-medium);
}

.about-card:hover .profile-pic {
  border-radius: 60% 40% 45% 55% / 45% 58% 42% 55%;
}

.about-text p {
  margin-bottom: 1rem;
}

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

.project-card {
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.project-card:nth-child(even) {
  transform: rotate(1deg);
}

.project-card:nth-child(odd) {
  transform: rotate(-1deg);
}

.project-image-wrapper {
  width: 100%;
  height: 200px;
  overflow: hidden;
  position: relative;
}

.project-image-wrapper::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.6s ease;
}

.project-card:hover .project-image-wrapper::after {
  left: 100%;
}

.project-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.project-card:hover .project-image {
  transform: scale(1.05);
}

.project-info {
  padding: 1.5rem 2rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.project-info h3 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.project-info p {
  flex-grow: 1;
  margin-bottom: 0.8rem;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin: 1rem 0;
}

.project-tags span {
  display: inline-block;
  background: rgba(171, 172, 174, 0.1);
  border-radius: 16px;
  padding: 0.8rem 1.6rem;
  margin: 0.2rem 0.3rem 0.2rem 0;
  font-size: 0.95rem;
  font-weight: 600;
  transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55), background-color 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}

.project-tags span:hover {
  transform: translateY(-6px) rotate(4deg) scale(1.08);
  background: var(--accent-color);
  color: white;
  border-color: transparent;
  box-shadow: 0 6px 18px rgba(124, 92, 255, 0.45);
}

.project-links {
  display: flex;
  gap: 1rem;
  margin-top: auto;
  align-items: center;
  flex-wrap: wrap;
}

.project-links a {
  color: var(--accent-color);
  text-decoration: none;
  font-weight: 700;
  display: inline-block;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.project-links a:hover {
  cursor: pointer !important;
}

/* Contact & Footer */
.contact-card {
  text-align: center;
}

.contact-card p {
  font-size: 1.2rem;
  margin-bottom: 2rem;
}

.social-links {
  margin-top: 2rem;
  display: flex;
  justify-content: center;
  gap: 1.5rem;
}

.social-links a {
  color: var(--text-color-primary);
  font-size: 1.8rem;
  transition: color var(--transition-fast), transform 0.4s cubic-bezier(.68, -0.55, .27, 1.55);
}

.social-links a:hover {
  color: var(--accent-color);
  transform: translateY(-8px) rotate(15deg) scale(1.2);
  cursor: pointer !important;
}

footer {
  text-align: center;
  padding: 2rem;
  margin-top: 4rem;
  opacity: 0.7;
}

footer .fa-heart {
  color: var(--doodle-heart);
  animation: pulse 2s infinite;
}

/* --- 5. UTILITIES & THEME TOGGLE --- */
.theme-switch-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.theme-switch-wrapper i {
  font-size: 1rem;
  transition: color 0.3s ease;
}

.fa-sun {
  color: #f39c12;
}

.fa-moon {
  color: #8e8e93;
}

body.dark-mode .fa-sun {
  color: #8e8e93;
}

body.dark-mode .fa-moon {
  color: #f1c40f;
}

.theme-switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 28px;
}

.theme-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: none;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #2a2a34;
  transition: .4s;
  border-radius: 28px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 4px;
  bottom: 4px;
  background-color: #f6f7fb;
  transition: .4s;
  border-radius: 50%;
}

input:checked+.slider {
  background-color: var(--accent-color);
}

input:checked+.slider:before {
  transform: translateX(22px);
}

.scroll-animate {
  opacity: 0;
  transform: translate3d(0, 40px, 0);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.scroll-animate.visible {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

.theme-switch:hover,
.theme-switch .slider:hover {
  cursor: pointer !important;
}

/* --- 6. RESPONSIVE DESIGN --- */
@media (max-width: 768px) {
  .main-content {
    padding: 1.5rem;
  }

  .hero-title {
    font-size: 3.5rem;
  }

  .section-title {
    font-size: 2.8rem;
  }

  .about-card {
    flex-direction: column;
    text-align: center;
  }

  header {
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.5rem;
  }

  .skills-list {
    grid-template-columns: 1fr !important;
  }

  /* Stack skills in a single column on smaller screens */
}

@media (max-width: 480px) {
  .hero-title {
    font-size: 2.8rem;
  }

  .project-grid {
    grid-template-columns: 1fr;
  }

  nav {
    gap: 1rem;
  }

  .nav-link {
    font-size: 1rem;
  }
}


/* --- 7. IMPROVISED & SPECIALIZED CARDS --- */

/* Currently Working On & Research Cards (Structured Card Style) */
.current-card,
.research-card {
  max-width: 700px;
  transform: rotate(0.5deg);
  border-radius: 24px;
  /* Override the blob radius with a standard card radius */
  margin: 0 auto 2rem auto;
  text-align: center;
}

.current-card:hover,
.research-card:hover {
  transform: rotate(-1deg) translateY(-8px) scale(1.01);
  border-radius: 24px;
  /* Ensure the radius stays fixed on hover */
}

/* Research buttons styling */
.research-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.research-buttons .cta-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

/* Common list styles for these cards */
.current-list,
.research-list {
  list-style: none;
  padding-left: 0;
}

.current-list li,
.research-list li {
  margin-bottom: 1.2rem;
  line-height: 1.7;
  padding-left: 1.5rem;
  position: relative;
}

.current-list li::before,
.research-list li::before {
  content: '⚡️';
  position: absolute;
  left: 0;
  top: 4px;
  color: var(--accent-color);
  font-size: 0.9rem;
}

.research-list li a {
  color: var(--accent-color);
  text-decoration: underline;
  font-weight: 600;
}

.research-list li a:hover {
  cursor: pointer !important;
}

.current-list a:hover {
  cursor: pointer !important;
}

/* Improvised Skills Section (Wobbly Style) */
.skills-card {
  transform: rotate(-1.5deg);
}

.skills-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-auto-flow: dense;
  gap: 1.5rem 2rem;
  max-width: 600px;
  margin: 0 auto;
}

.skills-list div {
  width: 100%;
  display: flex;
  flex-direction: column;
}

.skills-list strong {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  color: var(--text-color-primary);
  transform: rotate(-2deg);
  margin-bottom: 0.8rem;
}

.skills-list span {
  display: inline-block;
  background: rgba(161, 168, 183, 0.1);
  border-radius: 8px;
  padding: 0.4rem 0.8rem;
  margin: 0.2rem 0.3rem 0.2rem 0;
  font-size: 0.98rem;
  font-weight: 500;
  transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55), background-color 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), color 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.skills-list span:hover {
  transform: translateY(-4px) rotate(5deg) scale(1.08);
  background: var(--accent-color);
  color: white;
  border-color: transparent;
}


/* Improvised Contact Section (Dynamic Blob Style) */
.contact-card.blob-card {
  border-radius: 67% 33% 74% 26% / 37% 71% 29% 63%;
  animation: blob-morph 15s infinite;
}

.contact-card.blob-card:hover,
.contact-card:hover {
  transform: none !important;
}

@keyframes blob-morph {
  0% {
    border-radius: 67% 33% 74% 26% / 37% 71% 29% 63%;
  }

  25% {
    border-radius: 47% 53% 46% 54% / 53% 49% 51% 47%;
  }

  50% {
    border-radius: 33% 67% 26% 74% / 71% 37% 63% 29%;
  }

  75% {
    border-radius: 53% 47% 72% 28% / 35% 38% 62% 65%;
  }

  100% {
    border-radius: 67% 33% 74% 26% / 37% 71% 29% 63%;
  }
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.5rem;
  align-items: center;
}

.contact-form input,
.contact-form textarea {
  width: 350px;
  max-width: 95vw;
  padding: 0.8rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  font-size: 1rem;
  font-family: inherit;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-color-primary);
  transition: background 0.2s, color 0.2s, border 0.2s, box-shadow 0.2s;
}

.contact-form textarea {
  min-height: 100px;
  resize: vertical;
}

body.dark-mode .contact-form input,
body.dark-mode .contact-form textarea {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-color-primary);
  border: 1px solid rgba(255, 255, 255, 0.22);
}

.contact-form button {
  align-self: center;
}

.projects-section-more {
  text-align: center;
  margin-top: 2rem;
  z-index: 2;
  position: relative;
}

/* Add this at the end of the file to ensure specificity */
button:hover,
.cta-button:hover,
input[type="submit"]:hover,
input[type="button"]:hover {
  cursor: pointer !important;
}

.research-card a:hover {
  cursor: pointer !important;
}

/* --- 8. PROJECT MODAL --- */
.project-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(8px);
  z-index: 99999;
  animation: fadeIn 0.3s ease;
  overflow-y: auto;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.project-modal.active {
  display: block;
  padding: 1rem;
  box-sizing: border-box;
  height: 100vh;
  overflow-y: scroll;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.modal-content {
  background: var(--card-bg-color);
  border: 2px solid var(--border-color);
  border-radius: 20px;
  width: min(900px, calc(100vw - 3rem));
  max-height: 90vh;
  margin: 5vh auto;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: slideUp 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
  /* Performance optimization */
  will-change: transform, opacity;
  contain: layout style paint;
  padding: 2rem;
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: var(--accent-color) transparent;
}

.modal-content::-webkit-scrollbar {
  width: 8px;
}

.modal-content::-webkit-scrollbar-track {
  background: transparent;
}

.modal-content::-webkit-scrollbar-thumb {
  background: var(--accent-color);
  border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
  background: var(--accent-color-darker);
}

@keyframes slideUp {
  from {
    transform: translate(-50%, -45%) scale(0.95);
    opacity: 0;
  }

  to {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: var(--accent-color);
  color: white;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, background 0.2s ease;
  z-index: 10;
}

.modal-close:hover {
  transform: rotate(90deg) scale(1.1);
  background: var(--accent-color-darker);
}

.modal-body {
  padding: 2rem;
}

.modal-info {
  width: 100%;
}

.modal-media {
  width: 100%;
  margin-bottom: 2rem;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.modal-project-image {
  width: 100%;
  height: auto;
  display: block;
}

.modal-title {
  font-size: 3rem;
  margin-bottom: 1rem;
  color: var(--text-color-primary);
}

.modal-description {
  font-size: 1.2rem;
  line-height: 1.8;
  margin-bottom: 2rem;
  color: var(--text-color-secondary);
}

.modal-section {
  margin-bottom: 2rem;
}

.modal-section h3 {
  font-size: 1.8rem;
  margin-bottom: 1rem;
  color: var(--accent-color);
}

.modal-features-list {
  list-style: none;
  padding: 0;
}

.modal-features-list li {
  padding: 0.6rem 0;
  padding-left: 2rem;
  position: relative;
  line-height: 1.6;
  color: var(--text-color-secondary);
}

.modal-features-list li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--accent-color);
  font-weight: bold;
  font-size: 1.2rem;
}

.modal-tech-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
}

.modal-tech-stack span {
  display: inline-block;
  background: rgba(255, 255, 255, 0.08);
  border: 1px dashed rgba(255, 255, 255, 0.24);
  color: var(--text-color-primary);
  padding: 0.6rem 1.2rem;
  border-radius: 16px;
  font-weight: 600;
  font-size: 0.95rem;
  transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55), background-color 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), color 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 6px 18px rgba(124, 92, 255, 0.15);
}

.modal-tech-stack span:hover {
  transform: translateY(-5px) rotate(3deg) scale(1.08);
  background: var(--accent-color);
  color: white;
  border-color: transparent;
  box-shadow: 0 8px 22px rgba(124, 92, 255, 0.45);
}

.modal-highlights {
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--text-color-secondary);
}

.modal-links {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}

.modal-links a {
  background: var(--accent-color);
  color: white;
  padding: 0.8rem 1.8rem;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 700;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 6px 18px rgba(124, 92, 255, 0.2);
}

.modal-links a:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 26px rgba(124, 92, 255, 0.4);
  cursor: pointer !important;
}

/* See Details Button */
.see-details-btn {
  background: var(--accent-color);
  color: #ffffff !important;
  border: none;
  padding: 0.8rem 1.8rem;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.98rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55),
    background 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 6px 16px rgba(124, 92, 255, 0.22);
  white-space: nowrap;
}

.see-details-btn:hover {
  transform: translateY(-5px) rotate(-1deg) scale(1.05);
  background: var(--accent-color-darker);
  box-shadow: 0 10px 26px rgba(124, 92, 255, 0.45);
  color: #ffffff !important;
}

/* Modal responsive */
@media (max-width: 768px) {
  .project-modal.active {
    padding: 3rem 1rem;
  }

  .modal-content {
    padding: 1.5rem;
    max-height: calc(100vh - 4rem);
    width: min(700px, calc(100vw - 2rem));
  }

  .modal-body {
    padding: 1.2rem;
  }

  .modal-title {
    font-size: 2.2rem;
  }

  .modal-close {
    width: 35px;
    height: 35px;
    font-size: 1.3rem;
  }
}

@media (max-width: 480px) {
  .project-modal.active {
    padding: 2.5rem 0.75rem;
  }

  .modal-content {
    padding: 1.2rem;
    max-height: calc(100vh - 3rem);
    width: calc(100vw - 1.5rem);
  }

  .modal-body {
    padding: 1rem;
  }

  .modal-title {
    font-size: 1.8rem;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {

  .project-modal,
  .modal-content,
  .modal-close {
    animation: none !important;
    transition: none !important;
  }

  .splotch,
  .doodle {
    animation: none !important;
  }
}

/* ========================================
   CLICK SPARK EFFECT - VERY COOL 🎆
   ======================================== */
.spark-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  overflow: hidden;
}

.spark {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  pointer-events: none;
  animation: spark-burst 0.6s ease-out forwards;
}

.spark::before {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: inherit;
  animation: spark-glow 0.6s ease-out forwards;
}

@keyframes spark-burst {
  0% {
    transform: scale(1) translate(0, 0);
    opacity: 1;
  }

  100% {
    transform: scale(0) translate(var(--tx), var(--ty));
    opacity: 0;
  }
}

@keyframes spark-glow {
  0% {
    box-shadow: 0 0 8px 4px currentColor;
  }

  100% {
    box-shadow: 0 0 0 0 transparent;
  }
}

/* Spark line trails */
.spark-line {
  position: absolute;
  width: 3px;
  height: 20px;
  border-radius: 2px;
  pointer-events: none;
  animation: spark-line-burst 0.5s ease-out forwards;
  transform-origin: center bottom;
}

@keyframes spark-line-burst {
  0% {
    transform: scaleY(1) rotate(var(--rotation));
    opacity: 1;
  }

  100% {
    transform: scaleY(0) rotate(var(--rotation)) translateY(-40px);
    opacity: 0;
  }
}

/* ========================================
   SCATTERED SECTION DOODLES - FILLS THE PAGE
   ======================================== */
.section-doodle {
  position: absolute;
  pointer-events: none;
  opacity: 0.65;
  z-index: 1;
}

body.dark-mode .section-doodle {
  opacity: 0.75;
}

/* Doodle in About Section */
#about {
  position: relative;
}

.about-doodle-1 {
  top: 10%;
  right: -30px;
  animation: float 8s ease-in-out infinite alternate;
}

.about-doodle-2 {
  bottom: 15%;
  left: -40px;
  animation: float 10s ease-in-out infinite alternate -3s;
}

/* Doodle in Skills Section */
#skills {
  position: relative;
}

.skills-doodle-1 {
  top: 5%;
  left: -50px;
  animation: rotate 20s linear infinite;
}

.skills-doodle-2 {
  bottom: 10%;
  right: -35px;
  animation: pulse 4s ease-in-out infinite;
}

/* Doodle in Projects Section */
#projects {
  position: relative;
}

.projects-doodle-1 {
  top: 8%;
  right: -45px;
  animation: float 9s ease-in-out infinite alternate -2s;
}

.projects-doodle-2 {
  bottom: 5%;
  left: -40px;
  animation: float 11s ease-in-out infinite alternate -4s;
}

/* Doodle in Research Section */
#research {
  position: relative;
}

.research-doodle-1 {
  top: 15%;
  left: -35px;
  animation: rotate 18s linear infinite reverse;
}

/* Doodle in Contact Section */
#contact {
  position: relative;
}

.contact-doodle-1 {
  top: 10%;
  right: -40px;
  animation: float 7s ease-in-out infinite alternate;
}

.contact-doodle-2 {
  bottom: 20%;
  left: -30px;
  animation: pulse 5s ease-in-out infinite;
}

/* Extra wiggle animation for interactive elements */
@keyframes wiggle-fun {

  0%,
  100% {
    transform: rotate(-2deg);
  }

  25% {
    transform: rotate(2deg);
  }

  50% {
    transform: rotate(-2deg);
  }

  75% {
    transform: rotate(2deg);
  }
}

/* Fluid blob decoration */
.fluid-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(40px);
  opacity: 0.15;
  pointer-events: none;
  animation: blob-float 15s ease-in-out infinite;
}

body.dark-mode .fluid-blob {
  opacity: 0.1;
}

@keyframes blob-float {

  0%,
  100% {
    transform: translate(0, 0) scale(1);
    border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
  }

  25% {
    transform: translate(30px, -20px) scale(1.05);
    border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%;
  }

  50% {
    transform: translate(-20px, 20px) scale(0.95);
    border-radius: 40% 60% 60% 40% / 60% 30% 70% 40%;
  }

  75% {
    transform: translate(10px, -10px) scale(1.02);
    border-radius: 60% 40% 30% 70% / 40% 50% 60% 50%;
  }
}