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

body, html {
  font-family: 'Segoe UI', sans-serif;
  scroll-behavior: smooth;
  height: 100%;
}

/* Make theme switching smooth */
html[data-theme="dark"] body,
html[data-theme="light"] body {
  transition: background-color 0.25s ease, color 0.25s ease;
}

/* Header (Navigation Bar) */
header {
  position: fixed; /* Stays at the top of the viewport */
  top: 0;
  width: 100%;
  padding: 20px 60px;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100; /* Ensures it's above other content */
  background-color: transparent; /* Starts transparent */
  transition: background-color 0.3s ease, padding 0.3s ease, box-shadow 0.3s ease; /* Smooth transition for changes */
}

.header-inner {
  width: 100%;
  max-width: 1200px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

/* Header style when scrolled */
header.scrolled {
  background-color: #ffffff; /* White background when scrolled */
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); /* Subtle shadow */
  padding: 15px 60px; /* Slightly reduce padding to make it compact */
}

nav {
  display: flex;
  gap: 35px;
}

nav a {
  color: white; /* Default color for nav links (over hero) */
  text-decoration: none;
  font-size: 1.4rem;
  font-weight: 500;
  position: relative;
  transition: color 0.3s;
}

/* Nav link color when header is scrolled */
header.scrolled nav a {
  color: #333; /* Black text when scrolled */
}

nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 0%;
  height: 2px;
  background-color: #ffff; /* Default underline color (over hero) */
  transition: width 0.3s ease-in-out;
  font-weight: bold;
}

/* Underline color when header is scrolled */
header.scrolled nav a::after {
  background-color: #007bff; /* Blue underline when scrolled */
}

nav a:hover {
  color: #ffff; /* Still white on hover for default */
  font-weight: bold;
}

header.scrolled nav a:hover {
  color: #007bff; /* Blue on hover when scrolled */
}

nav a:hover::after {
  width: 100%;
}

/* Theme toggle button */
.theme-toggle {
  background-color: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #ffffff;
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  white-space: nowrap;
}

.theme-toggle:hover {
  transform: translateY(-1px);
  background-color: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.42);
}

.theme-toggle:focus-visible {
  outline: 3px solid rgba(0, 123, 255, 0.55);
  outline-offset: 2px;
}

/* Light mode defaults (JS sets html[data-theme]) */
html[data-theme="light"] body {
  background-color: #ffffff;
  color: #111827;
}

/* Header background becomes white on scroll; tune toggle for contrast */
header.scrolled .theme-toggle {
  background-color: rgba(0, 123, 255, 0.08);
  border-color: rgba(0, 123, 255, 0.25);
  color: #007bff;
}

/* Dark mode overrides */
html[data-theme="dark"] body {
  background-color: #0b1020;
  color: #ffffff;
}

html[data-theme="dark"] .hero-text {
  color: #eef3ff;
}

html[data-theme="dark"] header.scrolled {
  background-color: rgba(11, 16, 32, 0.9);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}

html[data-theme="dark"] nav a {
  color: rgba(255, 255, 255, 0.92);
}

html[data-theme="dark"] header.scrolled nav a {
  color: rgba(255, 255, 255, 0.92);
}

html[data-theme="dark"] nav a::after {
  background-color: rgba(255, 255, 255, 0.9);
}

html[data-theme="dark"] header.scrolled nav a::after {
  background-color: #4aa3ff;
}

html[data-theme="dark"] .about-detail-section,
html[data-theme="dark"] .education-card-section,
html[data-theme="dark"] .experience-section,
html[data-theme="dark"] #projects,
html[data-theme="dark"] #certifications,
html[data-theme="dark"] .contact-section {
  background-color: #0f172a;
}

html[data-theme="dark"] .about-card {
  background-color: rgba(15, 23, 42, 0.92);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

html[data-theme="dark"] .right-panel hr {
  background: #4aa3ff;
}

html[data-theme="dark"] .right-panel p,
html[data-theme="dark"] .right-panel a,
html[data-theme="dark"] .about-highlights li,
html[data-theme="dark"] .skills-section p,
html[data-theme="dark"] .skills-section li,
html[data-theme="dark"] .edu-info p,
html[data-theme="dark"] .experience-card p,
html[data-theme="dark"] .experience-card h3 {
  color: rgba(232, 238, 252, 0.92);
}

html[data-theme="dark"] .education-card,
html[data-theme="dark"] .experience-card,
html[data-theme="dark"] .cert-card,
html[data-theme="dark"] .project-item,
html[data-theme="dark"] .contact-card,
html[data-theme="dark"] .modal-cart {
  background-color: rgba(15, 23, 42, 0.92);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

html[data-theme="dark"] .project-button {
  background-color: #4aa3ff;
}

html[data-theme="dark"] .project-button:hover {
  background-color: #2f7fdc;
}

html[data-theme="dark"] .project-item img {
  background: transparent;
}

html[data-theme="dark"] .cert-card {
  color: rgba(232, 238, 252, 0.95);
}

html[data-theme="dark"] .cert-card .cert-logo {
  filter: saturate(1.05) contrast(1.02);
}

html[data-theme="dark"] #projects .section-heading {
  color: rgba(232, 238, 252, 0.95);
}

html[data-theme="dark"] .section-title {
  color: rgba(232, 238, 252, 0.95);
}

html[data-theme="dark"] .github-projects-status {
  color: rgba(232, 238, 252, 0.75);
}

html[data-theme="dark"] .github-repo-card .repo-name a {
  color: rgba(232, 238, 252, 0.95);
}

html[data-theme="dark"] .github-repo-card .repo-name a:hover {
  color: #4aa3ff;
}

html[data-theme="dark"] .github-repo-card .repo-description {
  color: rgba(232, 238, 252, 0.78);
}

html[data-theme="dark"] .project-feature-card h3 {
  color: rgba(232, 238, 252, 0.95);
}

html[data-theme="dark"] .project-feature-card p {
  color: rgba(232, 238, 252, 0.78);
}

html[data-theme="dark"] .project-eyebrow {
  color: #4aa3ff;
}

html[data-theme="dark"] .repo-badge {
  border-color: rgba(74, 163, 255, 0.28);
  background: rgba(74, 163, 255, 0.10);
  color: rgba(176, 215, 255, 0.95);
}

html[data-theme="dark"] .modal-overlay {
  background-color: rgba(0, 0, 0, 0.75);
}

html[data-theme="dark"] .modal-cart {
  color: rgba(232, 238, 252, 0.95);
}

html[data-theme="dark"] .modal-cart h3 {
  color: rgba(232, 238, 252, 0.95);
}

html[data-theme="dark"] .modal-cart p a {
  color: #4aa3ff;
}

html[data-theme="dark"] .modal-cart p a:hover {
  color: #2f7fdc;
}

html[data-theme="dark"] .close-modal {
  color: rgba(232, 238, 252, 0.55);
}

html[data-theme="dark"] .close-modal:hover {
  color: rgba(232, 238, 252, 0.95);
}

html[data-theme="dark"] .theme-toggle {
  background-color: rgba(255, 255, 255, 0.10);
  border-color: rgba(255, 255, 255, 0.25);
  color: rgba(255, 255, 255, 0.95);
}

@media (max-width: 768px) {
  .header-inner {
    flex-wrap: wrap;
    justify-content: center;
  }

  .theme-toggle {
    margin-top: 10px;
  }
}

/* Hero Section */
.hero {
  position: relative;
  height: 100vh;
  padding-top: 80px; /* Added padding to account for fixed header */
  background-image: url("/assets/images/bg.png");
  background-size: cover;
  background-position: center;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    120deg,
    rgba(0, 123, 255, 0.35),
    rgba(0, 0, 0, 0.55) 55%,
    rgba(74, 163, 255, 0.25)
  );
  z-index: 1;
}

.hero-text {
  position: relative;
  z-index: 2;
  color: white;
}

.hero-text h1 {
  font-size: calc(3rem + 15px);
  font-weight: 700;
}

.hero-text p {
  font-size: calc(1.25rem + 10px);
  font-weight: 400;
  margin-top: 10px;
  min-height: 30px;
  text-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}

.hero-text h1 {
  text-shadow: 0 10px 34px rgba(0, 0, 0, 0.38);
}

.hero-actions {
  margin-top: 28px;
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 800;
  font-size: 0.98rem;
  border: 1px solid rgba(255, 255, 255, 0.22);
  transition: transform 0.15s ease, box-shadow 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
  white-space: nowrap;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.25);
}

.btn-primary {
  background: rgba(0, 123, 255, 0.95);
  border-color: rgba(0, 123, 255, 0.6);
  color: #fff;
}

.btn-primary:hover {
  background: rgba(0, 86, 179, 0.98);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.18);
}

/* Responsive adjustments for Hero and Header */
@media (max-width: 768px) {
  header {
    padding: 15px 20px; /* Slightly less padding on scroll */
  }

  nav {
    gap: 16px;
    flex-wrap: wrap;
    justify-content: center;
  }

  .hero-text h1 {
    font-size: calc(2.2rem + 5px);
  }

  .hero-text p {
    font-size: calc(1rem + 3px);
  }
}

/* Detailed About Me Section */
.about-detail-section {
  padding: 80px 40px;
  background-color: #f4f4f4;
  display: flex;
  justify-content: center;
}

.about-card {
  background-color: #fff;
  max-width: 1100px;
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
  display: flex;
  gap: 40px;
  padding: 40px;
  flex-wrap: wrap;
}

.left-panel {
  flex: 1;
  min-width: 250px;
}

.right-panel {
  flex: 2;
  min-width: 300px;
}

.profile-img {
  width: 180px;
  border-radius: 12px;
  display: block;
  margin: 0 auto 20px auto;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

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

.skills-section h4 {
  margin-bottom: 6px;
  font-weight: 600;
  border-bottom: 2px solid #007bff;
  padding-bottom: 4px;
  display: inline-block;
}

.skills-section ul {
  padding-left: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.skills-section li {
  background: rgba(0, 123, 255, 0.08);
  border: 1px solid rgba(0, 123, 255, 0.18);
  color: rgba(11, 58, 106, 0.95);
  padding: 8px 12px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.9rem;
}

.skills-section p {
  color: #333;
  line-height: 1.5;
}

.right-panel h3 {
  font-size: 1.8rem;
  margin-bottom: 10px;
}

.right-panel hr {
  border: none;
  height: 3px;
  background: #007bff;
  width: 60px;
  margin-bottom: 20px;
}

.right-panel p {
  margin-bottom: 18px;
  line-height: 1.7;
  color: #333;
}

.right-panel a {
  color: #007bff;
  font-weight: 700;
  text-decoration: none;
}

.right-panel a:hover {
  text-decoration: underline;
}

.about-highlights {
  display: grid;
  gap: 10px;
  margin: 18px 0 22px;
  padding-left: 0;
  list-style: none;
}

.about-highlights li {
  position: relative;
  padding-left: 24px;
  line-height: 1.6;
  color: #333;
}

.about-highlights li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.72em;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #007bff;
  box-shadow: 0 0 0 4px rgba(0, 123, 255, 0.12);
}

@media (max-width: 768px) {
  .about-card {
    flex-direction: column;
    padding: 30px;
  }

  .profile-img {
    margin: 0 auto 20px;
  }

  .left-panel, .right-panel {
    width: 100%;
  }
}

/* Education Section */
.education-card-section {
  background-color: #f5f5f5;
  padding: 100px 40px;
  text-align: center;
}

.section-heading {
  font-size: 3.5rem;
  font-weight: 800;
  margin-bottom: 50px;
  position: relative;
  display: inline-block;
  color: #111;
}

.section-heading::after {
  content: '';
  display: block;
  width: 60px;
  height: 4px;
  background-color: #007bff;
  margin: 8px auto 0;
  border-radius: 2px;
}

.education-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 40px;
  justify-content: center;
}

.education-card {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
  width: 320px;
  padding: 20px;
  text-align: center;
  transition: transform 0.3s ease;
}

.education-card:hover {
  transform: translateY(-8px);
}

.education-card img {
  width: 100%;
  max-height: 180px;
  object-fit: contain;
  margin-bottom: 20px;
  border-radius: 8px;
  transition: transform 0.4s ease-in-out;
}

.education-card:hover img {
  transform: scale(1.08);
}

.edu-info h3 {
  font-size: 1.1rem;
  color: #111;
  margin-bottom: 6px;
  font-weight: 600;
}

.edu-info p {
  color: #555;
  font-size: 0.95rem;
}

@media (max-width: 768px) {
  .education-grid {
    flex-direction: column;
    align-items: center;
  }

  .education-card {
    width: 90%;
  }
}

/* Contact Section */
.contact-section {
  background-image: url("/assets/images/bg2.png");
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  padding: 100px 30px;
  display: flex;
  justify-content: center;
}

.contact-card {
  background-color: #fff;
  padding: 40px;
  border-radius: 14px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
  text-align: center;
  max-width: 600px;
  width: 100%;
}

.contact-card h2 {
  font-size: 2rem;
  font-weight: 700;
  color: #222;
  margin-bottom: 8px;
}

.contact-line {
  width: 60px;
  height: 4px;
  background-color: #007bff;
  margin: 0 auto 25px auto;
  border-radius: 2px;
}

.contact-email {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-bottom: 25px;
}

.contact-email img {
  width: 20px;
  height: 20px;
}

.contact-email a {
  color: #333;
  font-size: 1rem;
  text-decoration: none;
}

.social-icons {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.social-icons a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: #fff;
  border: 2px solid #007bff;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  transition: transform 0.3s ease, background-color 0.3s;
}

.social-icons a img {
  width: 22px;
  height: 22px;
}

.social-icons a:hover {
  transform: scale(1.1);
  background-color: #e0f0ff;
}

/* Experience Section */
.experience-section {
  background-color: #f5f5f5;
  padding: 100px 40px;
  text-align: center;
}

.experience-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 40px;
  justify-content: center;
  margin-top: 40px;
}

.experience-card {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
  padding: 30px 20px;
  text-align: center;
  transition: transform 0.3s ease;
}

.experience-card:hover {
  transform: translateY(-8px);
}

.experience-card img {
  width: 100px;
  height: auto;
  object-fit: contain;
  margin-bottom: 20px;
  transition: transform 0.3s ease;
}

.experience-card:hover img {
  transform: scale(1.08);
}

.experience-card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 10px;
  color: #111;
}

.experience-card p {
  font-size: 0.95rem;
  color: #666;
  margin: 0;
}

@media (max-width: 768px) {
  .experience-grid {
    grid-template-columns: 1fr;
  }
}

/* Certifications Section */
#certifications {
  padding: 80px 40px;
  background-color: #f9f9f9;
  text-align: center;
}

.section-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 40px;
  border-bottom: 4px solid #007bff;
  display: inline-block;
  padding-bottom: 8px;
}

.certification-grid {
  display: flex; /* Changed from grid to flex */
  flex-wrap: wrap; /* Allows items to wrap */
  justify-content: center; /* Centers items in the current row */
  gap: 24px;
  max-width: 1200px; /* Optional: Sets a max width for the grid */
  margin: 0 auto; /* Centers the entire grid container */
  /* align-items: start; removed as it's not needed with flexbox here */
}

.cert-card {
  background: #ffffff;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  max-width: 320px; /* Max width for individual cards */
  flex: 1 1 250px; /* Allows cards to grow/shrink, with a preferred basis */
}

.cert-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.cert-logo {
  max-width: 120px;
  height: auto;
  margin-bottom: 16px;
  transition: transform 0.4s ease;
}

.cert-logo:hover {
  transform: scale(1.1);
}

.cert-card {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.5s ease, transform 0.5s ease, box-shadow 0.3s ease;
}

.cert-card.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Projects Section */
#projects {
  padding: 80px 40px;
  background-color: #f8f8f8;
  text-align: center;
}

#projects .section-heading {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 40px;
  position: relative;
  display: inline-block;
  color: #333;
}

#projects .section-heading::after {
  content: '';
  display: block;
  width: 60px;
  height: 4px;
  background-color: #007bff;
  margin: 8px auto 0;
  border-radius: 2px;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 30px;
  max-width: 1200px;
  margin: 0 auto;
  justify-items: center;
  align-items: start;
}

.project-item {
  background-color: #ffffff;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: 100%;
  max-width: 280px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.project-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

.project-item img {
  width: 100%;
  max-width: 180px;
  height: auto;
  margin-bottom: 20px;
  border-radius: 8px;
  object-fit: contain;
}

.project-button {
  display: inline-block;
  background-color: #007bff;
  color: white;
  padding: 10px 25px;
  border-radius: 5px;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: background-color 0.3s ease;
  white-space: nowrap;
}

.project-button:hover {
  background-color: #0056b3;
  cursor: pointer;
}

@media (max-width: 768px) {
  .projects-grid {
    grid-template-columns: 1fr;
  }

  .project-item {
    max-width: 90%;
  }
}

/* GitHub Projects Additions */
.projects-subtitle {
  max-width: 900px;
  margin: -20px auto 40px auto;
  color: #444;
  font-size: 1.05rem;
  line-height: 1.6;
}

.projects-subheading {
  font-size: 1.8rem;
  font-weight: 800;
  margin: 70px 0 25px;
  position: relative;
  display: inline-block;
  color: #111;
}

.projects-subheading::after {
  content: '';
  display: block;
  width: 60px;
  height: 4px;
  background-color: #007bff;
  margin: 10px auto 0;
  border-radius: 2px;
}

.github-projects-status {
  color: #666;
  font-weight: 700;
  margin: 0 0 22px;
  min-height: 22px;
}

.projects-grid--highlights {
  margin-bottom: 10px;
}

.project-feature-card {
  align-items: flex-start;
  max-width: 360px;
  min-height: 310px;
  padding: 26px;
  text-align: left;
}

.project-feature-card h3 {
  color: #111;
  font-size: 1.15rem;
  line-height: 1.3;
  margin-bottom: 12px;
}

.project-feature-card p {
  color: #555;
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 20px;
}

.project-feature-card .project-button {
  margin-top: auto;
}

.project-eyebrow {
  color: #007bff;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
  text-transform: uppercase;
}

.github-repo-card {
  max-width: 300px;
}

.github-repo-card img {
  width: 64px;
  max-width: 64px;
  height: 64px;
  padding: 10px;
  border-radius: 14px;
  background: #f3f6ff;
  box-shadow: 0 2px 8px rgba(0, 123, 255, 0.12);
  object-fit: contain;
  margin-bottom: 12px;
}

.github-repo-card .repo-name {
  font-size: 1rem;
  font-weight: 900;
  margin-bottom: 8px;
}

.github-repo-card .repo-name a {
  color: #111;
  text-decoration: none;
}

.github-repo-card .repo-name a:hover {
  color: #007bff;
}

.github-repo-card .repo-description {
  color: #555;
  font-size: 0.9rem;
  line-height: 1.5;
  min-height: 4.5em; /* keeps cards same height-ish */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.repo-bottom {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.repo-badge {
  border: 1px solid rgba(0, 123, 255, 0.25);
  background: rgba(0, 123, 255, 0.08);
  color: #0b3a6a;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 800;
}

.github-projects-footer {
  margin-top: 18px;
}

.github-projects-link {
  color: #007bff;
  text-decoration: none;
  font-weight: 800;
}

.github-projects-link:hover {
  text-decoration: underline;
  color: #0056b3;
}

@media (max-width: 768px) {
  .projects-subtitle {
    margin: -10px auto 28px auto;
  }

  .projects-subheading {
    margin: 50px 0 20px;
    font-size: 1.5rem;
  }
}

/* Modal Styling */
.modal-overlay {
  display: none; /* Hidden by default */
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.7); /* Darker, more prominent overlay */
  z-index: 1000;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(5px); /* Optional: adds a blur effect to background */
}

body.modal-open {
  overflow: hidden;
}

.modal-overlay.active {
  display: flex; /* Show when active */
}

.modal-cart {
  background-color: #fefefe;
  padding: 30px;
  border-radius: 12px;
  width: 80%; /* Adjust width for better display */
  max-width: 800px; /* Max width for larger screens */
  max-height: 90vh; /* Allow vertical scroll for long content */
  overflow-y: auto; /* Enable scrolling within the modal content */
  position: relative;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3); /* Stronger shadow */
  text-align: center;
  animation: fadeInScale 0.3s ease-out; /* Add animation */
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.close-modal {
  appearance: none;
  background: transparent;
  border: 0;
  position: absolute;
  top: 15px;
  right: 20px;
  font-size: 30px; /* Larger close button */
  color: #888;
  cursor: pointer;
  transition: color 0.2s ease;
}

.close-modal:hover {
  color: #333;
}

.modal-content-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px; /* Space between elements */
}

.modal-img {
  width: 95%; /* Adjust width within modal */
  max-height: 450px; /* Limit image height */
  object-fit: contain; /* Ensure whole image is visible */
  border: 2px solid #333; /* Darker border for image */
  border-radius: 8px;
  margin-bottom: 10px; /* Space below image */
}

.modal-cart h3 {
  font-size: 1.8rem;
  color: #222;
  margin-bottom: 10px;
}

.modal-cart p a {
  color: #007bff;
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s ease;
}

.modal-cart p a:hover {
  color: #0056b3;
}

/* Modal Navigation Buttons */
.modal-navigation {
  display: flex;
  justify-content: space-between;
  width: 100%; /* Take full width of modal content */
  margin-top: 25px;
}

.nav-button {
  background-color: #007bff;
  color: white;
  padding: 10px 20px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 1rem;
  transition: background-color 0.3s ease;
}

.nav-button:hover {
  background-color: #0056b3;
}

.nav-button:disabled {
  background-color: #cccccc;
  cursor: not-allowed;
}

/* Media queries for modal on smaller screens */
@media (max-width: 768px) {
  .modal-cart {
    width: 95%;
    padding: 20px;
  }

  .modal-cart h3 {
    font-size: 1.4rem;
  }

  .modal-img {
    max-height: 250px;
  }

  .modal-navigation {
    flex-direction: column;
    gap: 10px;
  }
}

/* Responsive adjustments for Certifications grid on smaller screens */
@media (max-width: 768px) {
  .certification-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); /* Adjust min-width for more columns if desired */
  }
}

.modal-cart img.modal-img {
  width: 100%;
  max-height: 300px;
  object-fit: contain;
  margin-bottom: 20px;
  border-radius: 10px;
  border: 4px solid #000; /* Black border */
}

/* =========================
   Global UI/UX polish
   ========================= */
:root {
  --bg0: #f6f8ff;
  --text: #0f172a;
  --muted: rgba(15, 23, 42, 0.72);
  --card-bg: rgba(255, 255, 255, 0.82);
  --card-border: rgba(2, 6, 23, 0.08);
  --card-shadow: 0 16px 50px rgba(2, 6, 23, 0.10);
  --primary: #007bff;
  --primary-hover: #0056b3;
  --focus: rgba(0, 123, 255, 0.55);
}

html[data-theme="dark"] {
  --bg0: #0b1020;
  --text: #ffffff;
  --muted: rgba(255, 255, 255, 0.78);
  --card-bg: rgba(15, 23, 42, 0.72);
  --card-border: rgba(255, 255, 255, 0.12);
  --card-shadow: 0 22px 70px rgba(0, 0, 0, 0.45);
  --primary: #4aa3ff;
  --primary-hover: #2f7fdc;
  --focus: rgba(74, 163, 255, 0.55);
}

body {
  background: radial-gradient(1200px 520px at 15% 0%, rgba(0, 123, 255, 0.12), transparent 60%),
    radial-gradient(900px 440px at 90% 12%, rgba(74, 163, 255, 0.12), transparent 55%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.65), rgba(255, 255, 255, 0.85)),
    var(--bg0);
  color: var(--text);
}

.hero-text {
  color: #ffffff;
}

header.scrolled {
  background-color: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(12px);
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.12);
}

/* Glass cards */
.about-card,
.education-card,
.experience-card,
.cert-card,
.project-item,
.contact-card,
.modal-cart {
  border-radius: 16px;
  border: 1px solid var(--card-border);
  background-color: var(--card-bg);
  box-shadow: var(--card-shadow);
  backdrop-filter: blur(12px);
}

.project-item {
  overflow: hidden;
}

/* Buttons */
.project-button,
.btn-primary,
.btn-ghost {
  border-radius: 999px;
  box-shadow: 0 10px 30px rgba(0, 123, 255, 0.18);
}

.project-button {
  background-color: var(--primary);
}

.project-button:hover {
  background-color: var(--primary-hover);
}

/* Section headings */
.section-heading,
.section-title,
.projects-subheading,
.projects-subheading * {
  text-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

/* Dark-mode hero background adjustments */
html[data-theme="dark"] .hero-text {
  color: #eef3ff;
}

html[data-theme="dark"] header.scrolled {
  background-color: rgba(11, 16, 32, 0.86);
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.35);
}

html[data-theme="dark"] .project-button {
  box-shadow: 0 14px 46px rgba(74, 163, 255, 0.18);
}

/* Typography fallbacks for remaining hardcoded dark greys */
html[data-theme="dark"] .contact-email a {
  color: rgba(255, 255, 255, 0.95);
}

html[data-theme="dark"] .contact-email a:hover {
  color: #4aa3ff;
}

html[data-theme="dark"] .contact-card h2 {
  color: rgba(255, 255, 255, 0.98);
}

html[data-theme="dark"] .edu-info h3 {
  color: rgba(255, 255, 255, 0.96);
}

html[data-theme="dark"] .edu-info p {
  color: rgba(255, 255, 255, 0.82);
}

html[data-theme="dark"] .projects-subtitle {
  color: rgba(255, 255, 255, 0.78);
}

html[data-theme="dark"] .projects-subheading {
  color: rgba(255, 255, 255, 0.98);
}

html[data-theme="dark"] .section-heading {
  color: rgba(255, 255, 255, 0.98);
}

html[data-theme="dark"] .section-title {
  color: rgba(255, 255, 255, 0.98);
}

/* Skills pills dark override */
html[data-theme="dark"] .skills-section li {
  background: rgba(74, 163, 255, 0.10);
  border-color: rgba(74, 163, 255, 0.24);
  color: rgba(232, 238, 252, 0.92);
}

/* =========================
   Gallery
   ========================= */
#gallery {
  padding: 100px 40px;
  background-color: #f8f8f8;
  text-align: center;
}

.gallery-subtitle {
  max-width: 900px;
  margin: -20px auto 40px auto;
  color: #444;
  font-size: 1.05rem;
  line-height: 1.6;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 26px;
  max-width: 1200px;
  margin: 0 auto;
  align-items: stretch;
}

.gallery-card {
  margin: 0;
  border-radius: 16px;
  border: 1px solid rgba(0, 123, 255, 0.18);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 16px 50px rgba(2, 6, 23, 0.10);
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.gallery-card img {
  width: 100%;
  height: 190px;
  padding: 16px;
  object-fit: contain;
  background: rgba(0, 123, 255, 0.05);
  transition: transform 0.35s ease;
}

.gallery-card figcaption {
  padding: 14px 16px 18px;
  font-weight: 900;
  color: #111;
}

.gallery-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 22px 70px rgba(2, 6, 23, 0.18);
  border-color: rgba(0, 123, 255, 0.28);
}

.gallery-card:hover img {
  transform: scale(1.04);
}

@media (max-width: 768px) {
  #gallery {
    padding: 70px 20px;
  }

  .gallery-subtitle {
    margin: -10px auto 28px auto;
    font-size: 1rem;
  }

  .gallery-card img {
    height: 160px;
  }
}

html[data-theme="dark"] #gallery {
  background-color: #0f172a;
}

html[data-theme="dark"] .gallery-subtitle {
  color: rgba(232, 238, 252, 0.78);
}

html[data-theme="dark"] .gallery-card {
  background: rgba(15, 23, 42, 0.72);
  border-color: rgba(74, 163, 255, 0.22);
}

html[data-theme="dark"] .gallery-card figcaption {
  color: rgba(232, 238, 252, 0.95);
}

html[data-theme="dark"] .gallery-card img {
  background: rgba(74, 163, 255, 0.08);
}

/* =========================
   Scroll Reveal (leader-level polish)
   ========================= */
.education-card,
.experience-card,
.project-item,
.gallery-card {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.education-card.visible,
.experience-card.visible,
.project-item.visible,
.gallery-card.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }

  .cert-card,
  .education-card,
  .experience-card,
  .project-item,
  .gallery-card {
    opacity: 1;
    transform: none;
  }
}

/* Better focus ring */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* =========================
   Mobile Responsiveness
   ========================= */
img {
  max-width: 100%;
}

@media (max-width: 900px) {
  body {
    overflow-x: hidden;
  }

  header,
  header.scrolled {
    padding: 12px 18px;
  }

  .header-inner {
    max-width: 100%;
    align-items: stretch;
    gap: 10px;
  }

  nav {
    width: 100%;
    gap: 10px;
    overflow-x: auto;
    padding: 4px 0 8px;
    justify-content: flex-start;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  nav::-webkit-scrollbar {
    display: none;
  }

  nav a {
    flex: 0 0 auto;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    padding: 8px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
  }

  header.scrolled nav a {
    background: rgba(0, 123, 255, 0.08);
  }

  .theme-toggle {
    align-self: flex-end;
    padding: 8px 12px;
    font-size: 0.82rem;
  }

  .hero {
    min-height: 100svh;
    height: auto;
    padding: 150px 20px 80px;
  }

  .hero-text h1 {
    font-size: clamp(2.35rem, 11vw, 4rem);
    line-height: 1.05;
  }

  .hero-text p {
    font-size: clamp(1.1rem, 5vw, 1.6rem);
  }

  .section-heading,
  #projects .section-heading,
  .section-title {
    font-size: clamp(2rem, 9vw, 2.7rem);
    margin-bottom: 32px;
  }

  .about-detail-section,
  .education-card-section,
  .experience-section,
  #projects,
  #certifications,
  #gallery,
  .contact-section {
    padding: 70px 20px;
  }

  .about-card {
    gap: 28px;
    padding: 28px;
  }

  .left-panel,
  .right-panel {
    min-width: 0;
  }

  .education-card,
  .experience-card,
  .project-item,
  .github-repo-card,
  .cert-card {
    max-width: 100%;
  }

  .projects-grid,
  .experience-grid,
  .gallery-grid {
    grid-template-columns: 1fr;
  }

  .modal-cart {
    width: min(96vw, 760px);
    max-height: calc(100svh - 24px);
    padding: 22px;
  }

  .modal-cart img.modal-img,
  .modal-img {
    max-height: 42svh;
    border-width: 2px;
  }
}

@media (max-width: 640px) {
  .header-inner {
    flex-direction: column;
  }

  .theme-toggle {
    align-self: center;
  }

  .hero-actions {
    width: 100%;
  }

  .btn,
  .project-button {
    width: 100%;
    max-width: 320px;
  }

  .about-card,
  .contact-card {
    padding: 22px;
  }

  .profile-img {
    width: min(170px, 70vw);
  }

  .skills-section ul,
  .about-highlights {
    gap: 8px;
  }

  .skills-section li {
    width: 100%;
    border-radius: 14px;
  }

  .contact-email {
    flex-direction: column;
    text-align: center;
  }

  .contact-email a {
    overflow-wrap: anywhere;
  }

  .social-icons a {
    width: 48px;
    height: 48px;
  }

  .modal-cart {
    width: calc(100vw - 20px);
    padding: 18px;
  }

  .close-modal {
    top: 8px;
    right: 12px;
    min-width: 44px;
    min-height: 44px;
  }
}

@media (max-width: 420px) {
  header,
  header.scrolled {
    padding: 10px 12px;
  }

  nav a {
    font-size: 0.72rem;
    padding: 7px 9px;
  }

  .hero {
    padding-top: 165px;
  }

  .about-detail-section,
  .education-card-section,
  .experience-section,
  #projects,
  #certifications,
  #gallery,
  .contact-section {
    padding: 58px 14px;
  }

  .about-card,
  .education-card,
  .experience-card,
  .project-item,
  .cert-card,
  .contact-card {
    border-radius: 14px;
  }

  .gallery-card img {
    height: 145px;
  }
}
