html, body {
  height: 100%;
  min-height: 100%;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  margin: 0;
  padding: 0;
  background: radial-gradient(ellipse at top, #1f1b2e, #0a0a0a) fixed;
  background-attachment: fixed;
  background-size: cover;
  background-position: center;
  color: #f9fafb;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6; /* Improved line height for better readability */
  word-spacing: normal; /* Reset word spacing to default */
  letter-spacing: 0.01em; /* Slight letter spacing for better readability */
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html {
  font-size: 100%; /* Changed from 120% to 100% for better base scaling */
  scroll-behavior: smooth;
  overflow-x: hidden;
}

.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 999;
  background: rgba(17, 24, 39, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.8rem 0;
  font-size: 1.2rem; /* Changed from 120% to 1.2rem for better control */
}

main, section.container:first-of-type {
  padding-top: 4.25rem;
}

.nav-container {
  max-width: 1000px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 0 1.5rem; /* Restored horizontal padding */
  position: relative;
}

.nav-container .emoji {
  font-size: 1.5rem;
  margin-right: 1rem;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  transition: transform 0.3s ease-in-out;
}

.nav-container a {
  color: #a78bfa;
  text-decoration: none;
  transition: color 0.3s ease, text-shadow 0.3s ease;
  white-space: nowrap;
  padding: 0.5rem 0;
  font-size: 1.2rem; /* Added explicit font size for all nav links */
}

.nav-container a:hover {
  color: #c084fc;
  text-shadow: 0 0 5px #c084fc;
}

/* Mobile menu button */
.menu-btn {
  display: none;
  background: none;
  border: none;
  color: #a78bfa;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
  z-index: 1000;
}

/* Responsive styles */
@media screen and (max-width: 768px) {
  .menu-btn {
    display: block;
  }

  .nav-links {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: 70%;
    max-width: 300px;
    background: rgba(17, 24, 39, 0.98);
    backdrop-filter: blur(10px);
    flex-direction: column;
    justify-content: flex-start;
    padding: 5rem 2rem 2rem;
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
    will-change: transform;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.2);
  }

  .nav-links.active {
    transform: translateX(0);
  }

  .nav-container {
    justify-content: space-between;
    padding: 0.8rem 1rem;
  }

  .nav-container .emoji {
    position: static;
    transform: none;
  }
}

.hero-title {
  font-size: 3.7rem;
  font-weight: bold;
  margin-bottom: 0.5rem;
  color: #f9fafb;
}

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 8rem 1rem 12rem;
}

#home {
  margin-top: 4.3rem;
}

#about {
  scroll-margin-top: 100px; /* makes scrolling to #about offset nicely */
}

.about-layout {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  flex-wrap: nowrap;
}

.about-side-img {
  width: 160px;
  height: 160px;
  border-radius: 9999px;
  border: 4px solid #4c1d95;
  animation: pulse 2s infinite;
  flex-shrink: 0;
}

/* Responsive fallback for mobile screens */
@media (max-width: 640px) {
  .about-layout {
    flex-direction: column;
    align-items: center;
  }
}

.about-grid {
  display: flex;
  align-items: center;
  gap: 2rem;
  flex-wrap: wrap;
}

.about-img {
  width: 150px;
  height: 150px;
  border-radius: 9999px;
  border: 4px solid #4c1d95;
  animation: pulse 2s infinite;
  flex-shrink: 0;
}

.profile-img {
  width: 160px;
  height: 160px;
  border-radius: 9999px;
  border: 4px solid #4c1d95;
  margin-bottom: 1rem;
  animation: pulse 2s infinite;
}
.tagline {
  color: #a78bfa;
}

.container {
  max-width: 768px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  font-size: 1rem; /* Explicitly set base font size */
  line-height: 1.7; /* Slightly larger line height for content */
}

.glass {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 1.5rem;
  border-radius: 1rem;
}
a {
  text-decoration: none;
  color: #c084fc;
}
a:hover {
  text-shadow: 0 0 8px #c084fc;
}
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}
.skill-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid #4c1d95;
  border-radius: 1rem;
  padding: 1.5rem;
  text-align: center;
  transition: 0.3s ease;
}

.skill-card img {
  width: 40px;
  height: 40px;
  margin: 0 auto;
  display: block;
  filter: brightness(1.2); /* Optional: match the glow aesthetic */
}

.skill-card:hover {
  transform: scale(1.05);
  box-shadow: 0 0 12px #9333ea;
}
.skill-card i {
  font-size: 2.5rem;
}
.connect a {
  display: block;
  margin: 0.5rem 0;
  font-size: 1.1rem;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}
.project-card {
  padding: 1.5rem;
}

.social-icons {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 1rem;
  padding: 1.5rem 0;
}
.social-icons a {
  font-size: 1.8rem;
  color: #c084fc;
  transition: transform 0.3s ease, text-shadow 0.3s ease;
}
.social-icons a:hover {
  transform: scale(1.2);
  text-shadow: 0 0 8px #c084fc;
}

.social-inline {
  display: flex;
  gap: 1.2rem;
  margin-top: 0.75rem;
}
.social-inline a {
  font-size: 1.6rem;
  color: #c084fc;
  transition: transform 0.3s ease, text-shadow 0.3s ease;
}
.social-inline a:hover {
  transform: scale(1.15);
  text-shadow: 0 0 6px #c084fc;
}

/* Blog post content styling */
.blog-post-content {
  font-size: 1.1rem;
  line-height: 1.7;
  color: #e5e7eb; /* Slightly lighter text for better contrast */
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
  line-height: 1.3;
  margin-top: 1.5em;
  margin-bottom: 0.5em;
  color: #f9fafb;
}

h1 { font-size: 2.2rem; }
h2 { font-size: 1.8rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.3rem; }
h5 { font-size: 1.1rem; }

/* Paragraphs */
p {
  margin: 0 0 1.5rem 0;
  word-spacing: normal;
  letter-spacing: 0.01em;
}

/* Responsive typography */
@media screen and (max-width: 768px) {
  html {
    font-size: 100%;
  }
  
  .container {
    padding: 1.5rem 1rem;
  }
  
  h1 { font-size: 1.8rem; }
  h2 { font-size: 1.6rem; }
  h3 { font-size: 1.4rem; }
  h4 { font-size: 1.2rem; }
  h5 { font-size: 1.1rem; }
  
  .blog-post-content {
    font-size: 1rem;
    line-height: 1.7;
  }
}

/* For very small devices */
@media screen and (max-width: 480px) {
  .container {
    padding: 1.25rem 0.75rem;
  }
  
  h1 { font-size: 1.6rem; }
  h2 { font-size: 1.4rem; }
  h3 { font-size: 1.3rem; }
  
  p {
    margin-bottom: 1.25rem;
  }
}

/* Loading and Error States */
.loading {
  text-align: center;
  padding: 2rem;
  color: var(--text-color);
}

.error-message {
  text-align: center;
  padding: 1rem;
  background: rgba(255, 0, 0, 0.1);
  border: 1px solid rgba(255, 0, 0, 0.3);
  border-radius: 10px;
  margin: 1rem 0;
  color: #ff6b6b;
}

/* Post Meta Styling */
.post-meta {
  margin-top: 1rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.post-meta small {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.8rem;
}

/* Enhanced Project Card for Blog Posts */
.project-card ul {
  margin: 1rem 0;
  padding-left: 1.5rem;
}

.project-card ul li {
  margin: 0.5rem 0;
  color: rgba(255, 255, 255, 0.8);
}

/* Theme toggle button */
.theme-toggle {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #f9fafb;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.45rem 0.6rem;
  border-radius: 999px;
  margin-left: 0.25rem;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.25);
}

.theme-toggle--fixed {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1100;
}

/* Light theme overrides */
:root[data-theme="light"] body {
  background: radial-gradient(ellipse at top, #f3f4f6, #ffffff) fixed;
  color: #111827;
}
:root[data-theme="light"] .navbar {
  background: rgba(255, 255, 255, 0.85);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(10px);
}
:root[data-theme="light"] .nav-container a {
  color: #6b21a8;
}
:root[data-theme="light"] .nav-container a:hover {
  color: #7c3aed;
  text-shadow: 0 0 5px rgba(124, 58, 237, 0.45);
}
:root[data-theme="light"] .menu-btn {
  color: #6b21a8;
}
:root[data-theme="light"] .theme-toggle {
  color: #111827;
  border-color: rgba(0, 0, 0, 0.12);
}
:root[data-theme="light"] .theme-toggle:hover {
  background: rgba(0,0,0,0.06);
  border-color: rgba(0, 0, 0, 0.2);
}
:root[data-theme="light"] .glass {
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.08);
}
:root[data-theme="light"] a {
  color: #7c3aed;
}
:root[data-theme="light"] a:hover {
  text-shadow: 0 0 8px rgba(124, 58, 237, 0.35);
}
:root[data-theme="light"] .tagline,
:root[data-theme="light"] .loading,
:root[data-theme="light"] .post-meta small {
  color: #4b5563;
}
:root[data-theme="light"] .error-message {
  background: rgba(255, 0, 0, 0.08);
  border-color: rgba(255, 0, 0, 0.25);
  color: #b91c1c;
}
:root[data-theme="light"] .skill-card {
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid rgba(124, 58, 237, 0.35);
}
:root[data-theme="light"] .skill-card:hover {
  box-shadow: 0 0 12px rgba(124, 58, 237, 0.35);
}
:root[data-theme="light"] .skills-grid i,
:root[data-theme="light"] .social-icons a,
:root[data-theme="light"] .social-inline a {
  color: #7c3aed;
}

:root[data-theme="light"] body { color: #111827; }
:root[data-theme="light"] h1,
:root[data-theme="light"] h2,
:root[data-theme="light"] h3,
:root[data-theme="light"] .post-title {
  color: #1f2937;
}
:root[data-theme="light"] .post-meta,
:root[data-theme="light"] .post-meta small { color: #374151; }
:root[data-theme="light"] a { color: #6d28d9; }
:root[data-theme="light"] a:hover { color: #5b21b6; }

:root[data-theme="light"] .glass { background: rgba(255, 255, 255, 0.65); border: 1px solid rgba(0,0,0,0.06); }
:root[data-theme="light"] .project-card { border: 1px solid rgba(0,0,0,0.06); }

@media screen and (max-width: 768px) {
  :root[data-theme="light"] .nav-links {
    background: rgba(255, 255, 255, 0.98);
    box-shadow: -5px 0 15px rgba(0,0,0,0.15);
  }
}

/* Ensure post page content isn't hidden under fixed navbar */
.post-container {
  padding-top: 4.25rem;
}

/* Avoid overlap between theme toggle and mobile menu button */
@media screen and (max-width: 768px) {
  .theme-toggle--fixed {
    left: 1rem !important;
    right: auto !important;
    top: 0.75rem;
  }
}
