/* Define CSS Variables for Themes */
:root {
  --bg-color: #0A0A0A;
  --text-color: #FFFFFF;
  --subtext-color: #D3D3D3;
  --card-bg: #2A2A2A;
  --nav-bg: rgba(0, 0, 0, 0.5);
  --footer-bg: #1A1A1A;
  --hero-gradient: linear-gradient(135deg, #0A0A0A, #1E1E3A);
  --section-bg: #1E1E3A;
  --btn-bg: #FFFFFF;
  --btn-text: #000000;
  --input-bg: rgba(255, 255, 255, 0.1);
  --input-border: rgba(255, 255, 255, 0.2);
  --navbar-height: 70px;
  --navbar-height-mobile: 60px;
}

/* Light Mode Variables */
body.light-mode {
  --bg-color: #FFFFFF;
  --text-color: #1A1A1A;
  --subtext-color: #666666;
  --card-bg: #F0F0F0;
  --nav-bg: rgba(255, 255, 255, 0.5);
  --footer-bg: #E0E0E0;
  --hero-gradient: linear-gradient(135deg, #FFFFFF, #E6E6FA);
  --section-bg: #E6E6FA;
  --btn-bg: #000000;
  --btn-text: #FFFFFF;
  --input-bg: rgba(0, 0, 0, 0.05);
  --input-border: rgba(0, 0, 0, 0.2);
}

/* Reset and General Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', sans-serif;
}

body {
  background: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
  scroll-behavior: smooth;
  transition: background 0.3s, color 0.3s;
  min-height: 100vh;
}

/* Screen Reader Only Class */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Preloader */
#preloader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-color);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  transition: opacity 0.5s ease;
}

#preloader.hidden {
  opacity: 0;
  pointer-events: none;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--text-color);
  border-top: 4px solid transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Header */
.navbar-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  background: var(--nav-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.navbar {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.3s ease;
}

.logo {
  font-size: 24px;
  font-weight: 700;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 20px;
  margin: 0;
  padding: 0;
  flex-grow: 1;
  justify-content: center;
}

.nav-links a {
  color: var(--text-color);
  text-decoration: none;
  font-size: 16px;
  font-weight: 400;
  transition: color 0.3s;
}

.nav-links a:hover {
  color: #00D4FF;
}

.theme-toggle {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-color);
  transition: transform 0.3s ease, color 0.3s ease;
  height: 24px;
  display: flex;
  align-items: center;
}

.theme-toggle:hover {
  transform: scale(1.1);
  color: #00D4FF;
}

.hamburger {
  display: none;
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-color);
  cursor: pointer;
  transition: transform 0.4s ease;
}

.hamburger:hover {
  transform: scale(1.1);
}

.hamburger.active {
  transform: rotate(360deg) scale(1);
}

/* Search Bar */
.search-container {
  position: relative;
  display: flex;
  align-items: center;
  margin-right: 5px;
  height: 24px;
}

.search-input {
  padding: 8px 12px 8px 32px;
  border: 1px solid var(--input-border);
  border-radius: 20px;
  background: var(--input-bg);
  color: var(--text-color);
  font-size: 14px;
  width: 0;
  opacity: 0;
  transition: width 0.3s ease, opacity 0.2s ease;
}

.search-input.active {
  width: 150px;
  opacity: 1;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-bottom: none;
}

.search-btn {
  position: absolute;
  left: 8px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: transform 0.3s ease, opacity 0.3s ease;
  display: flex;
  align-items: center;
  height: 20px;
}

.search-icon {
  transition: stroke 0.3s ease, transform 0.3s ease;
}

.search-btn:hover .search-icon {
  stroke: #00D4FF;
  transform: scale(1.1);
}

.search-btn:active .search-icon {
  transform: scale(0.95);
}

/* Hero Section */
.hero {
  min-height: 100vh;
  background: var(--hero-gradient);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--navbar-height) 40px 0;
  overflow: hidden;
  transition: background 0.3s;
}

.hero-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--hero-gradient);
  animation: pulse 10s infinite ease-in-out;
  z-index: 1;
}

@keyframes pulse {
  0%, 100% { opacity: 0.8; }
  50% { opacity: 1; }
}

.hero-content {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 40px;
  max-width: 1200px;
  width: 100%;
  z-index: 2;
}

.hero-text {
  flex: 1;
}

.hero-text h1 {
  font-size: 48px;
  font-weight: 700;
  margin-bottom: 20px;
}

.hero-text p {
  font-size: 20px;
  font-weight: 300;
  color: var(--subtext-color);
  margin-bottom: 30px;
}

.hero-image {
  max-width: 50%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  transition: transform 0.3s;
}

.hero-image:hover {
  transform: scale(1.02);
}

/* Features Section (Used for Projects and Writings) */
.features {
  padding: calc(var(--navbar-height) + 80px) 40px 80px;
  text-align: center;
  background: var(--bg-color);
}

/* Adjusted for <h1> instead of <h2> in main sections */
.features h1.animate-on-scroll {
  font-size: 48px;
  font-weight: 700;
  margin-bottom: 20px;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.features h1.animate-on-scroll.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Keep h2 styling for compatibility with article titles */
.feature-card h2.animate-on-scroll {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 12px;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.feature-card h2.animate-on-scroll.visible {
  opacity: 1;
  transform: translateY(0);
}

.section-intro {
  font-size: 18px;
  font-weight: 400;
  color: var(--subtext-color);
  margin-bottom: 40px;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 30px;
  max-width: 1200px;
  margin: 0 auto;
}

/* Projects Header (for all-projects.html) */
.projects-header {
  margin-bottom: 60px;
}

/* Project Card Customizations (for all-projects.html) */
.project-title {
  color: var(--text-color);
  text-decoration: none;
  transition: color 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.project-title::after {
  content: '→';
  font-size: 16px;
  transition: transform 0.3s ease;
}

.project-title:hover {
  color: #00D4FF;
}

.project-title:hover::after {
  transform: translateX(5px);
}

.project-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--subtext-color);
  text-decoration: none;
  transition: color 0.3s ease;
}

.project-link::after {
  content: '→';
  font-size: 14px;
  transition: transform 0.3s ease;
}

.project-link:hover {
  color: #00D4FF;
}

.project-link:hover::after {
  transform: translateX(5px);
}

/* Writings Section Specific Styling */
.writings-section .section-intro {
  text-align: center;
}

.writings-section .writings-column {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 800px;
  margin: 0 auto;
}

.writings-section .feature-card {
  text-align: left;
}

/* Writings Sub-sections */
.writings-subsection {
  margin-bottom: 60px;
}

.writings-subsection h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-color);
  margin-bottom: 10px;
  text-align: left;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

.writings-subsection .subsection-description {
  font-size: 16px;
  font-weight: 400;
  color: var(--subtext-color);
  margin-bottom: 30px;
  text-align: left;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

.writings-subsection .writings-column {
  max-width: 800px;
  margin: 0 auto;
}

/* Feature Card (Now <article>) */
.feature-card {
  background: var(--card-bg);
  padding: 25px;
  border-radius: 8px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  text-align: left;
}

.feature-card:hover {
  transform: scale(1.03);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

.feature-image {
  width: 100%;
  height: auto; /* Default, overridden for specific sections below */
  margin-bottom: 20px;
  border-radius: 6px;
  transition: transform 0.3s ease;
}

#myproject .feature-card .feature-image,
.features-grid .feature-card .feature-image {
  height: 200px;
  object-fit: cover;
}

#myskills .feature-card .feature-image {
  height: 48px;
  width: 48px;
  margin: 0 auto 10px;
  display: block;
}

.feature-image:hover {
  transform: scale(1.05);
}

/* Adjusted for <article> h2 instead of <div> h3 */
.feature-card h2 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 12px;
}

.feature-card h2 a {
  color: var(--text-color);
  text-decoration: none;
  transition: color 0.3s;
}

.feature-card h2 a:hover {
  color: #00D4FF;
}

.feature-card p {
  font-size: 16px;
  font-weight: 400;
  color: var(--subtext-color);
  margin-bottom: 15px;
}

.post-date {
  display: block;
  font-size: 14px;
  font-weight: 400;
  color: var(--subtext-color);
  font-style: italic;
}

/* Article Section (for project.html and article.html) */
.article-section {
  padding: calc(var(--navbar-height) + 100px) 40px 100px;
  background: var(--bg-color);
}

.article-container {
  max-width: 800px;
  margin: 0 auto;
  text-align: left;
}

.project-header {
  margin-bottom: 40px;
}

.article-container h1 {
  font-size: 48px;
  font-weight: 700;
  margin-bottom: 15px;
  text-align: left;
}

.article-meta {
  font-size: 16px;
  font-weight: 400;
  color: var(--subtext-color);
  margin-bottom: 0;
  text-align: left;
}

.article-content {
  font-size: 18px;
  font-weight: 400;
  color: var(--text-color);
  line-height: 1.8;
}

.article-content h2 {
  font-size: 28px;
  font-weight: 700;
  margin: 40px 0 20px;
}

.article-content p {
  margin-bottom: 25px;
}

.article-content a {
  color: #00D4FF;
  text-decoration: none;
  transition: color 0.3s;
}

.article-content a:hover {
  color: #00A0CC;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 50px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-color);
  text-decoration: none;
  transition: color 0.3s ease;
  padding: 10px 20px;
  border-radius: 50px;
  background: rgba(255, 255, 255, 0.05);
}

.back-link::before {
  content: '←';
  font-size: 16px;
  transition: transform 0.3s ease;
}

.back-link:hover {
  color: #00D4FF;
  background: rgba(255, 255, 255, 0.1);
}

.back-link:hover::before {
  transform: translateX(-5px);
}

.project-image {
  width: 100%;
  max-width: 800px;
  height: auto;
  margin: 30px 0;
  display: block;
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
  transition: transform 0.3s ease;
}

.project-image:hover {
  transform: scale(1.02);
}

/* Contact Section */
.contact-section {
  min-height: 100vh;
  background: var(--hero-gradient);
  padding: calc(var(--navbar-height) + 100px) 40px 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.contact-container {
  max-width: 600px;
  width: 100%;
  text-align: center;
  background: rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 60px;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.contact-container h1 {
  font-size: 48px;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--text-color);
}

.contact-container .section-intro {
  font-size: 20px;
  font-weight: 300;
  color: var(--subtext-color);
  margin-bottom: 40px;
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.form-group {
  position: relative;
  text-align: left;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 15px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 8px;
  font-size: 16px;
  font-weight: 400;
  color: var(--text-color);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: #00D4FF;
  box-shadow: 0 0 8px rgba(0, 212, 255, 0.3);
  outline: none;
}

.form-group label {
  position: absolute;
  top: -10px;
  left: 15px;
  background: var(--input-bg);
  padding: 0 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--subtext-color);
  transition: color 0.3s ease;
}

.form-group input:focus + label,
.form-group textarea:focus + label {
  color: #00D4FF;
}

.submit-btn {
  background: var(--btn-bg);
  color: var(--btn-text);
  border: none;
  padding: 15px 30px;
  border-radius: 50px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 0.3s ease, color 0.3s ease, border 0.3s ease;
}

.submit-btn::after {
  content: '→';
  font-size: 16px;
  transition: transform 0.3s ease;
}

.submit-btn:hover {
  background: var(--btn-text);
  color: var(--btn-bg);
  border: 1px solid var(--btn-bg);
}

.submit-btn:hover::after {
  transform: translateX(5px);
}

.contact-emails {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.contact-emails .email-intro {
  font-size: 18px;
  font-weight: 400;
  color: var(--subtext-color);
  margin-bottom: 5px;
}

.contact-emails p {
  font-size: 18px;
  font-weight: 500;
  color: var(--subtext-color);
}

.contact-emails a {
  color: var(--text-color);
  text-decoration: none;
  transition: color 0.3s ease;
}

.contact-emails a:hover {
  color: #00D4FF;
}

.contact-social {
  margin-top: 60px;
}

.contact-social h3 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 30px;
  color: var(--text-color);
}

.social-icons {
  display: flex;
  justify-content: center;
  gap: 20px;
}

.social-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  transition: transform 0.3s ease, color 0.3s ease;
}

.social-icon:hover {
  transform: scale(1.1);
  color: #00D4FF;
}

.social-icon svg {
  transition: fill 0.3s ease;
}

.social-icon:hover svg {
  fill: #00D4FF;
}

/* Animations */
.animate-on-load {
  opacity: 0;
  transform: scale(0.98);
  animation: fadeInScale 1s ease-out forwards;
}

@keyframes fadeInScale {
  0% { opacity: 0; transform: scale(0.98); }
  100% { opacity: 1; transform: scale(1); }
}

.animate-on-scroll {
  opacity: 0; /* Start hidden */
  transform: translateY(20px); /* Start offset */
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.animate-on-scroll.visible {
  opacity: 1;
  transform: translateY(0);
}

/* View All Button */
.cta-container {
  margin-top: 40px;
  text-align: center;
}

.writings-section .cta-container {
  text-align: center;
}

.view-all-btn {
  background: var(--btn-bg);
  color: var(--btn-text);
  border: none;
  padding: 10px 20px;
  border-radius: 50px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 0.3s ease, color 0.3s ease, border 0.3s ease;
  position: relative;
}

.view-all-btn::after {
  content: '→';
  font-size: 16px;
  transition: transform 0.3s ease;
}

.view-all-btn:hover {
  background: var(--btn-text);
  color: var(--btn-bg);
  border: 1px solid var(--btn-bg);
}

.view-all-btn:hover::after {
  transform: translateX(5px);
}

/* Footer */
.footer {
  background: var(--footer-bg);
  padding: 40px;
  text-align: center;
  transition: background 0.3s;
  position: relative;
  z-index: 1;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
  flex-wrap: wrap;
  gap: 20px;
}

.footer-copyright {
  font-size: 16px;
  font-weight: 400;
  color: var(--subtext-color);
}

.footer-links {
  display: flex;
  gap: 20px;
}

.footer-link {
  position: relative;
  color: var(--subtext-color);
  text-decoration: none;
  font-size: 16px;
  font-weight: 400;
  transition: color 0.3s ease;
}

.footer-link::after {
  content: '';
  position: absolute;
  width: 0;
  height: 1px;
  bottom: -4px;
  left: 0;
  background-color: #00D4FF;
  transition: width 0.3s ease;
}

.footer-link:hover::after {
  width: 100%;
}

.footer-link:hover {
  color: #00D4FF;
}

.footer-social {
  display: flex;
  gap: 15px;
  align-items: center;
}

.footer-social .footer-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  transition: transform 0.3s ease, color 0.3s ease;
}

.footer-social .footer-link:hover {
  transform: scale(1.1);
  color: #00D4FF;
}

.footer-social .footer-link svg {
  transition: fill 0.3s ease;
}

.footer-social .footer-link:hover svg {
  fill: #00D4FF;
}

/* Back to Top Button */
.back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 40px;
  height: 40px;
  background: var(--btn-bg);
  color: var(--btn-text);
  border: none;
  border-radius: 50%;
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
  z-index: 1000;
}

.back-to-top.visible {
  opacity: 0.8;
  transform: scale(1);
}

.back-to-top:hover {
  opacity: 1;
  transform: scale(1.05);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

/* Title with Button Container */
.title-with-button {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

/* Download CV Button */
.download-cv-btn {
  background: var(--btn-bg);
  color: var(--btn-text);
  border: none;
  padding: 10px 20px;
  border-radius: 50px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 0.3s ease, color 0.3s ease, border 0.3s ease, transform 0.3s ease;
}

.download-cv-btn::after {
  content: '↓';
  font-size: 16px;
  transition: transform 0.3s ease;
}

.download-cv-btn:hover {
  background: var(--btn-text);
  color: var(--btn-bg);
  border: 1px solid var(--btn-bg);
  transform: scale(1.05);
}

.download-cv-btn:hover::after {
  transform: translateY(3px);
}

/* Search Dropdown */
.search-dropdown {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  width: 100%;
  max-height: 250px;
  overflow-y: scroll;
  background: var(--nav-bg);
  border: none;
  border-radius: 0 0 12px 12px;
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  display: none;
  z-index: 1000;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.search-dropdown::-webkit-scrollbar {
  display: none;
}

.search-dropdown.active {
  display: block;
  opacity: 0.8;
  transform: translateY(0);
}

.search-dropdown-item {
  padding: 10px 15px;
  color: var(--subtext-color);
  font-size: 14px;
  font-weight: 400;
  text-decoration: none;
  display: block;
  transition: background 0.3s ease, color 0.3s ease, padding-left 0.3s ease;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.search-dropdown-item:last-child {
  border-bottom: none;
}

.search-dropdown-item:hover {
  background: rgba(0, 212, 255, 0.1);
  color: #00D4FF;
  padding-left: 20px;
}

/* Highlight for Search Results */
mark {
  background: #00D4FF;
  color: var(--btn-text);
  padding: 0 2px;
  border-radius: 2px;
}

/* Tech Slider Wrapper */
.tech-slider-wrapper {
  max-width: 900px;
  margin: 0 auto;
  overflow: hidden;
  padding: 20px 0;
}

.tech-slider {
  display: flex;
  transition: transform 0.5s ease-in-out;
}

.tech-slide {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  width: 200px;
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.tech-slide.visible {
  opacity: 1;
  transform: translateX(0);
}

.tech-logo {
  width: 64px;
  height: 64px;
  transition: transform 0.3s ease;
}

.tech-slide span {
  font-size: 18px;
  font-weight: 500;
  color: var(--text-color);
  transition: color 0.3s ease;
}

.tech-slide:hover .tech-logo {
  transform: scale(1.1);
}

.tech-slide:hover span {
  color: #00D4FF;
}

/* Responsive Design */
@media (max-width: 1024px) and (min-width: 769px) {
  .navbar {
      padding: 20px 30px;
  }
}

@media (max-width: 768px) {
  .navbar-container {
      padding: 0 20px;
  }

  .navbar {
      padding: 15px 20px;
      display: flex;
      justify-content: space-between;
      align-items: center;
  }

  .logo {
      order: 1;
      margin-right: auto;
  }

  .nav-links {
      display: block;
      position: absolute;
      top: calc(100% - 1px);
      left: 0;
      width: 100%;
      background: transparent;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      padding: 15px 0;
      height: 0;
      opacity: 0;
      transform: scaleY(0);
      transform-origin: top;
      overflow: hidden;
      transition: height 0.4s ease-in-out, padding 0.4s ease-in-out, opacity 0.4s ease-in-out, transform 0.4s ease-in-out, background 0.4s ease-in-out;
      z-index: 999;
      text-align: center;
      order: 2;
  }

  .nav-links.active {
      height: auto;
      max-height: 250px;
      padding: 15px 0;
      opacity: 1;
      transform: scaleY(1);
      background: #000000;
      border-radius: 0 0 12px 12px;
      box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  }

  body.light-mode .nav-links.active {
      background: #FFFFFF;
  }

  .nav-links li {
      margin: 12px 0;
      opacity: 0;
      transform: translateY(-10px);
      transition: opacity 0.3s ease, transform 0.3s ease;
  }

  .nav-links.active li {
      opacity: 1;
      transform: translateY(0);
  }

  .nav-links.active li:nth-child(1) { transition-delay: 0.1s; }
  .nav-links.active li:nth-child(2) { transition-delay: 0.15s; }
  .nav-links.active li:nth-child(3) { transition-delay: 0.2s; }
  .nav-links.active li:nth-child(4) { transition-delay: 0.25s; }
  .nav-links.active li:nth-child(5) { transition-delay: 0.3s; }

  .search-container {
      order: 3;
      margin-right: 8px;
      margin-left: 0;
      height: 24px;
      display: flex;
      align-items: center;
  }

  .search-input.active {
      width: 120px;
  }

  .search-btn {
      height: 20px;
  }

  .theme-toggle {
      order: 4;
      margin-right: 8px;
      margin-left: 0;
      height: 24px;
      display: flex;
      align-items: center;
      line-height: 1;
  }

  .hamburger {
      display: block;
      order: 5;
      margin-right: 0;
      margin-left: 0;
      height: 24px;
      display: flex;
      align-items: center;
  }

  @keyframes glowPulse {
      0% { text-shadow: 0 0 2px rgba(255, 255, 255, 0.3); }
      50% { text-shadow: 0 0 8px rgba(0, 212, 255, 0.6), 0 0 12px rgba(0, 212, 255, 0.4); }
      100% { text-shadow: 0 0 2px rgba(255, 255, 255, 0.3); }
  }

  .theme-toggle:hover {
      animation: glowPulse 1.5s infinite ease-in-out;
      transform: rotate(15deg) scale(1.1);
      color: #00D4FF;
  }

  .hero {
      padding: 10px 20px;
      padding-top: calc(var(--navbar-height-mobile) + 10px);
  }

  .hero-content {
      flex-direction: column;
      text-align: center;
      gap: 20px;
      padding-top: 0;
  }

  .hero-text h1 {
      font-size: clamp(28px, 5vw, 48px);
  }

  .hero-text p {
      font-size: clamp(16px, 3vw, 20px);
      margin-bottom: 30px;
  }

  .hero-image {
      max-width: 80%;
  }

  .features {
      padding: calc(var(--navbar-height-mobile) + 40px) 20px 40px;
  }

  .features h1 {
      font-size: clamp(28px, 5vw, 48px);
  }

  .features h2 {
      font-size: clamp(24px, 4vw, 36px); /* Original size for subheadings */
  }

  .section-intro {
      font-size: clamp(14px, 2.5vw, 18px);
  }

  .features-grid {
      grid-template-columns: 1fr;
      gap: 20px;
  }

  .feature-card h2 {
      font-size: clamp(16px, 3vw, 20px);
  }

  .feature-card p {
      font-size: clamp(14px, 2.5vw, 16px);
  }

  .writings-section .writings-column {
      max-width: 100%;
  }

  .writings-section h1 {
      font-size: clamp(24px, 4vw, 36px);
  }

  .writings-section .section-intro {
      font-size: clamp(14px, 2.5vw, 18px);
  }

  .writings-section .feature-card {
      padding: 15px;
  }

  .writings-subsection {
      margin-bottom: 40px;
  }

  .writings-subsection h1 {
      font-size: clamp(22px, 3.5vw, 28px);
  }

  .writings-subsection .subsection-description {
      font-size: clamp(14px, 2.5vw, 16px);
      margin-bottom: 20px;
  }

  .post-date {
      font-size: clamp(12px, 2vw, 14px);
  }

  .article-section {
      padding: calc(var(--navbar-height-mobile) + 60px) 20px 60px;
  }

  .article-container h1 {
      font-size: clamp(28px, 5vw, 48px);
  }

  .article-content {
      font-size: clamp(16px, 2.5vw, 18px);
  }

  .article-content h2 {
      font-size: clamp(22px, 3.5vw, 28px);
  }

  .project-image {
      margin: 20px 0;
  }

  .contact-section {
      padding: calc(var(--navbar-height-mobile) + 60px) 20px 60px;
  }

  .contact-container {
      padding: 40px 20px;
  }

  .contact-container h1 {
      font-size: clamp(28px, 5vw, 48px);
  }

  .contact-container .section-intro {
      font-size: clamp(16px, 3vw, 20px);
  }

  .form-group input,
  .form-group textarea {
      padding: 12px;
      font-size: clamp(14px, 2.5vw, 16px);
  }

  .form-group label {
      font-size: clamp(12px, 2vw, 14px);
  }

  .submit-btn {
      padding: 12px 24px;
      font-size: clamp(14px, 2.5vw, 16px);
  }

  .contact-emails {
      margin-top: 15px;
      gap: 10px;
  }

  .contact-emails .email-intro {
      font-size: clamp(14px, 2.5vw, 18px);
  }

  .contact-emails p {
      font-size: clamp(14px, 2.5vw, 18px);
  }

  .contact-social {
      margin-top: 40px;
  }

  .contact-social h3 {
      font-size: clamp(20px, 3vw, 24px);
  }

  .social-icons {
      gap: 15px;
  }

  .social-icon {
      width: 40px;
      height: 40px;
  }

  .footer {
      padding: 30px 20px;
  }

  .footer-content {
      flex-direction: column;
      text-align: center;
      gap: 15px;
  }

  .footer-copyright {
      font-size: clamp(14px, 2.5vw, 16px);
  }

  .footer-links {
      gap: 15px;
  }

  .footer-social {
      gap: 10px;
      flex-wrap: wrap;
      justify-content: center;
  }

  .footer-link {
      font-size: clamp(14px, 2.5vw, 16px);
  }

  .footer-social .footer-link {
      width: 20px;
      height: 20px;
  }

  .back-link {
      font-size: clamp(14px, 2.5vw, 16px);
      margin-top: 30px;
      padding: 8px 16px;
  }

  .view-all-btn {
      font-size: clamp(14px, 2.5vw, 16px);
      padding: 8px 16px;
  }

  .projects-header {
      margin-bottom: 40px;
  }

  .back-to-top {
      bottom: 20px;
      right: 20px;
      width: 36px;
      height: 36px;
      font-size: 18px;
  }

  .title-with-button {
      justify-content: space-between;
      padding: 0 10px;
  }

  .title-with-button h1 {
      font-size: clamp(28px, 5vw, 48px);
  }

  .download-cv-btn {
      padding: 8px 16px;
      font-size: clamp(12px, 2.5vw, 16px);
  }

  .search-dropdown {
      width: 100%;
      left: 0;
  }

  .tech-slide {
      width: 150px; /* Smaller width for mobile */
  }

  .tech-logo {
      width: 48px;
      height: 48px;
  }

  .tech-slide span {
      font-size: 16px;
  }
}

/* Remove underlining and add premium animations for navbar logo */
.logo-link {
  text-decoration: none;
  color: var(--text-color);
  transition: transform 0.3s ease, color 0.3s ease;
}

.logo-link:hover {
  transform: scale(1.05);
  color: #00D4FF;
}

/* Remove underlining and add premium animations for footer logo */
.footer-logo-link {
  text-decoration: none;
  color: var(--subtext-color);
  transition: transform 0.3s ease, color 0.3s ease;
}

.footer-logo-link:hover {
  transform: scale(1.05);
  color: #00D4FF;
}