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

:root {
  --tag-colors-light: #dbeafe, #fcd34d, #6ee7b7, #fde68a, #fca5a5, #a5b4fc, #f9a8d4;
}

body.dark-mode {
  --tag-colors-dark: #4a5568, #d97706, #047857, #78350f, #7f1d1d, #3730a3, #9d174d;
}

body {
  font-family: 'Inter', sans-serif;
  background: #f9fafb;
  color: #1f2937;
  scroll-behavior: smooth;
  line-height: 1.6;
  font-size: 16px;
  transition: background 0.3s ease, color 0.3s ease;
  max-width: 100vw;
  overflow-x: hidden;
}

h1, h2, h3, h4 {
  font-weight: 600;
  color: #111827;
  transition: color 0.3s ease;
}

h2 { font-size: 2.5rem; }
h3 { font-size: 1.75rem; margin-bottom: 1rem; }

header {
  background-color: #ffffff;
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 1rem 2rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

nav h1 {
  font-size: 1.25rem;
}

nav ul {
  list-style: none;
  display: flex;
  gap: 1rem;
}

nav a {
  text-decoration: none;
  color: #1f2937;
  font-weight: 500;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  transition: background 0.2s, color 0.2s;
}

nav a:hover {
  background: #e0f2fe;
  color: #0369a1;
}

#hero {
  background: linear-gradient(to right, #e0f2fe, #f0f9ff);
  color: #111827;
  padding: 5rem 1rem 3rem;
  text-align: center;
  transition: background 0.3s ease, color 0.3s ease;
}

.container {
  max-width: 960px;
  margin: 4rem auto;
  padding: 0 1rem;
}

section {
  margin-bottom: 4rem;
  scroll-margin-top: 120px; /* Account for 104px header height + 16px spacing */
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.card {
  background: #ffffff;
  padding: 1.5rem;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
  border-left: 5px solid #3b82f6;
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.3s ease, border-color 0.3s ease;
  min-height: 140px;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.1);
}

.card p {
  text-align: justify;
  margin-bottom: 4rem;
}

.skills-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding-top: 1rem;
}

.skills-grid li {
  padding: 0.4rem 0.8rem;
  font-size: 0.95rem;
  border-radius: 1rem;
  font-weight: 500;
  list-style: none;
  transition: background 0.3s ease, color 0.3s ease;
}

#contact a {
  color: #0369a1;
  text-decoration: none;
  transition: color 0.3s ease;
}

#contact a:hover {
  text-decoration: underline;
}

footer {
  background: #ffffff;
  text-align: center;
  padding: 2rem 1rem;
  margin-top: 4rem;
  color: #6b7280;
  font-size: 0.9rem;
  transition: background 0.3s ease, color 0.3s ease;
}

.exp-logo {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: auto;
  max-width: 100px;
  max-height: 40px;
  object-fit: contain;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.container > * {
  animation: fadeInUp 0.5s ease-in-out both;
}

.blog-card {
  background: #ffffff;
  padding: 1.25rem 1.5rem;
  border-left: 5px solid #14b8a6;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.3s ease, border-color 0.3s ease;
}

.blog-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.1);
}

.blog-card a {
  text-decoration: none;
  font-weight: 600;
  color: #0f766e;
  display: inline-block;
  margin-top: 0.5rem;
  transition: color 0.3s ease;
}

@media (max-width: 600px) {
  h2 { font-size: 2rem; }
  h3 { font-size: 1.5rem; }
  nav ul { flex-wrap: wrap; justify-content: center; gap: 0.75rem; }
}

#about-text {
  text-align: justify;
}

/* Dark Mode Styles */
body.dark-mode {
  background: #1a202c;
  color: #e2e8f0;
}

body.dark-mode h1,
body.dark-mode h2,
body.dark-mode h3,
body.dark-mode h4 {
  color: #f7fafc;
}

body.dark-mode header {
  background-color: #2d3748;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

body.dark-mode nav a {
  color: #cbd5e0;
}

body.dark-mode nav a:hover {
  background: #4a5568;
  color: #e2e8f0;
}

body.dark-mode #hero {
  background: linear-gradient(to right, #2d3748, #4a5568);
  color: #f7fafc;
}

body.dark-mode .card,
body.dark-mode .blog-card {
  background: #2d3748;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

body.dark-mode .card:hover,
body.dark-mode .blog-card:hover {
  box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}

body.dark-mode #contact a {
  color: #90cdf4;
}

body.dark-mode footer {
  background: #2d3748;
  color: #a0aec0;
}

body.dark-mode .blog-card a {
  color: #63b3ed;
}

#theme-toggle {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  margin-left: 1rem;
  padding: 0.5rem;
  border-radius: 50%;
  transition: background 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
}

#theme-toggle:hover {
  background: rgba(0, 0, 0, 0.1);
}

body.dark-mode #theme-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
}

#theme-toggle .emoji {
  filter: grayscale(1);
  transition: filter 0.3s ease;
}

body.dark-mode #theme-toggle .emoji {
  filter: none;
}

/* Project Button Styles */
.project-button {
  display: inline-block;
  background-color: #3b82f6;
  color: #ffffff !important;
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  position: absolute;
  bottom: 1.5rem;
  left: 1.5rem;
}

.project-button:hover {
  background-color: #2563eb;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

body.dark-mode .project-button {
  background-color: #63b3ed;
  color: #1a202c !important;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

body.dark-mode .project-button:hover {
  background-color: #4299e1;
  box-shadow: 0 4px 8px rgba(0,0,0,0.4);
}

/* Scroll Progress Indicator */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: linear-gradient(90deg, #3b82f6, #10b981);
  z-index: 1000;
  transition: width 0.1s ease;
}

/* Back to Top Button */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 50px;
  height: 50px;
  background: #3b82f6;
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.25rem;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  background: #2563eb;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

body.dark-mode .back-to-top {
  background: #4f46e5;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

body.dark-mode .back-to-top:hover {
  background: #4338ca;
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.4);
}

/* Loading Animation */
.loading-animation {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(59, 130, 246, 0.3);
  border-radius: 50%;
  border-top-color: #3b82f6;
  animation: spin 1s ease-in-out infinite;
}

.loading-spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid rgba(59, 130, 246, 0.3);
  border-radius: 50%;
  border-top-color: #3b82f6;
  animation: spin 1s ease-in-out infinite;
  margin-right: 0.5rem;
}

.loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
}

.loading-state p {
  color: #6b7280;
  font-style: italic;
}

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

/* Smooth Scroll Animation for Sections */
.section-fade-in {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.section-fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Enhanced Card Hover Effects */
.card {
  transition: all 0.3s ease;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

body.dark-mode .card:hover {
  box-shadow: 0 8px 25px rgba(0,0,0,0.4);
}

.blog-card {
  transition: all 0.3s ease;
}

.blog-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}

body.dark-mode .blog-card:hover {
  box-shadow: 0 6px 20px rgba(0,0,0,0.35);
}

/* GitHub card styles */
.github-pill-container {
  margin-top: 2rem;
  width: 100%;
}

.github-pill {
  display: block;
  width: 100%;
  padding: 1rem 2rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white !important;
  text-decoration: none;
  border-radius: 50px;
  text-align: center;
  font-size: 0.95rem;
  font-weight: 500;
  transition: all 0.3s ease;
  border: 2px solid transparent;
}

.github-pill:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
  border-color: rgba(255, 255, 255, 0.3);
  text-decoration: none;
  color: white !important;
}

body.dark-mode .github-pill {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
}

body.dark-mode .github-pill:hover {
  box-shadow: 0 8px 20px rgba(79, 70, 229, 0.3);
}

/* Help Dialog Styles */
.help-dialog {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1002;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.help-dialog.visible {
  opacity: 1;
}

.help-content {
  background: #ffffff;
  border-radius: 12px;
  padding: 2rem;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.help-dialog.visible .help-content {
  transform: scale(1);
}

.help-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid #e5e7eb;
}

.help-header h3 {
  margin: 0;
  color: #1f2937;
  font-size: 1.25rem;
}

.help-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #6b7280;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.help-close:hover {
  background: #f3f4f6;
  color: #1f2937;
}

.help-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.help-item {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.help-item kbd {
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  padding: 0.25rem 0.5rem;
  font-family: monospace;
  font-size: 0.875rem;
  font-weight: bold;
  color: #374151;
  min-width: 2rem;
  text-align: center;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.help-item span {
  color: #4b5563;
  font-size: 0.9rem;
}

/* Dark mode help dialog */
body.dark-mode .help-content {
  background: #2d3748;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

body.dark-mode .help-header {
  border-bottom-color: #4a5568;
}

body.dark-mode .help-header h3 {
  color: #f7fafc;
}

body.dark-mode .help-close {
  color: #a0aec0;
}

body.dark-mode .help-close:hover {
  background: #4a5568;
  color: #f7fafc;
}

body.dark-mode .help-item kbd {
  background: #4a5568;
  border-color: #718096;
  color: #e2e8f0;
}

body.dark-mode .help-item span {
  color: #cbd5e0;
}
