:root {
  /* Dark Theme (Vercel inspired) */
  --bg-primary: #000000;
  --fg-primary: #ededed;
  --fg-secondary: #a1a1aa;
  --border-color: #333333;
  --accents-1: #111111;
  --accents-2: #222222;
  --accents-8: #fafafa;
  --btn-bg: #ededed;
  --btn-fg: #000000;
  --btn-hover: #ffffff;
  --link-color: #ededed;
  --card-hover: rgba(255, 255, 255, 0.04);
  --skeleton-bg: #1f1f1f;
  --skeleton-shimmer: #2e2e2e;
  --badge-bg: #1a1a1a;
  --badge-fg: #d4d4d8;
  --focus-ring: #0070f3;
  --modal-bg: rgba(0, 0, 0, 0.85);
  --spotlight-glow: rgba(255, 255, 255, 0.08);
}

[data-theme="light"] {
  /* Light Theme */
  --bg-primary: #ffffff;
  --fg-primary: #171717;
  --fg-secondary: #666666;
  --border-color: #eaeaea;
  --accents-1: #fafafa;
  --accents-2: #eaeaea;
  --accents-8: #000000;
  --btn-bg: #000000;
  --btn-fg: #ffffff;
  --btn-hover: #333333;
  --link-color: #000000;
  --card-hover: rgba(0, 0, 0, 0.03);
  --skeleton-bg: #e5e5e5;
  --skeleton-shimmer: #f5f5f5;
  --badge-bg: #f4f4f5;
  --badge-fg: #52525b;
  --focus-ring: #0070f3;
  --modal-bg: rgba(255, 255, 255, 0.85);
  --spotlight-glow: rgba(0, 0, 0, 0.04);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  background-color: var(--bg-primary);
  color: var(--fg-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
  font-size: 14px;
  transition: background-color 0.3s ease, color 0.3s ease;
  overflow-x: hidden;
}

/* Accessibility Focus States */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

/* Background Ambient Glow */
.vercel-bg {
  position: fixed; top: 0; left: 0; right: 0; height: 100vh; z-index: -1;
  background: radial-gradient(circle at 50% 0%, var(--accents-1) 0%, var(--bg-primary) 65%);
}

/* Header & Navbar */
.navbar {
  position: sticky; top: 0; width: 100%; z-index: 100;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
}
[data-theme="light"] .navbar {
  background: rgba(255, 255, 255, 0.85);
}
.nav-container {
  display: flex; justify-content: space-between; align-items: center;
  max-width: 1200px; margin: 0 auto; padding: 0.75rem 1.5rem;
}
.logo { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; font-size: 1.2rem; letter-spacing: -0.02em; }
.nav-right { display: flex; align-items: center; gap: 1.25rem; }
.nav-links { list-style: none; display: flex; gap: 1.5rem; }
.nav-links a { color: var(--fg-secondary); text-decoration: none; font-size: 0.875rem; transition: color 0.2s; font-weight: 500; }
.nav-links a:hover { color: var(--fg-primary); }

/* Command Palette Trigger Button in Navbar */
.cmd-k-btn {
  display: flex; align-items: center; gap: 0.5rem; background: var(--bg-primary); border: 1px solid var(--border-color);
  padding: 0.35rem 0.65rem; border-radius: 6px; color: var(--fg-secondary); font-size: 0.8rem; cursor: pointer; transition: all 0.2s;
}
.cmd-k-btn:hover { border-color: var(--fg-primary); color: var(--fg-primary); }
.cmd-k-kbd {
  font-family: inherit; font-size: 0.7rem; background: var(--accents-2); border: 1px solid var(--border-color);
  padding: 1px 5px; border-radius: 4px; color: var(--fg-secondary); font-weight: 600;
}

/* Theme Switcher */
.theme-switcher { position: relative; display: flex; align-items: center; }
.theme-toggle { background: transparent; border: 1px solid transparent; cursor: pointer; color: var(--fg-secondary); display: flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 6px; transition: background 0.2s, color 0.2s, border-color 0.2s; }
.theme-toggle:hover { background: var(--accents-2); color: var(--fg-primary); border-color: var(--border-color); }
.theme-dropdown { position: absolute; top: 120%; right: 0; background: var(--bg-primary); border: 1px solid var(--border-color); border-radius: 8px; padding: 0.5rem; display: none; flex-direction: column; min-width: 140px; box-shadow: 0 10px 25px rgba(0,0,0,0.2); }
.theme-dropdown.show { display: flex; }
.theme-option { display: flex; align-items: center; gap: 0.5rem; background: transparent; border: none; color: var(--fg-secondary); padding: 0.5rem 0.75rem; border-radius: 6px; cursor: pointer; text-align: left; font-size: 0.875rem; transition: background 0.2s, color 0.2s; }
.theme-option:hover, .theme-option.active { background: var(--accents-2); color: var(--fg-primary); }

.hamburger { display: none; background: transparent; border: none; cursor: pointer; color: var(--fg-primary); padding: 4px; }

.mobile-menu {
  display: none; flex-direction: column; background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  position: fixed; top: 57px; width: 100%; z-index: 99; padding: 1rem 1.5rem;
}
.mobile-menu.active { display: flex; }
.mobile-menu a { padding: 0.75rem 0; color: var(--fg-secondary); text-decoration: none; border-bottom: 1px solid var(--border-color); font-weight: 500; }
.mobile-menu a:last-child { border-bottom: none; }
.mobile-menu a:hover { color: var(--fg-primary); }

/* Layout & Scroll Animations */
.section { padding: 4rem 1.5rem; max-width: 1200px; margin: 0 auto; }
.fade-in { opacity: 0; transform: translateY(16px); transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), transform 0.6s cubic-bezier(0.16, 1, 0.3, 1); }
.fade-in.visible { opacity: 1; transform: translateY(0); }

/* Hero Section */
.hero { min-height: 55vh; display: flex; align-items: center; justify-content: center; text-align: center; }
.hero-content { display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.avatar-container { width: 96px; height: 96px; border-radius: 50%; border: 1px solid var(--border-color); padding: 4px; background: var(--bg-primary); box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15); }
.avatar-container img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; opacity: 0; transition: opacity 0.5s ease; }
.avatar-container img.loaded { opacity: 1; }
.hero h1 { font-size: 3.25rem; font-weight: 700; letter-spacing: -0.05em; line-height: 1.1; margin-top: 0.5rem; }
.subtitle { font-size: 1.125rem; color: var(--fg-secondary); max-width: 540px; margin: 0 auto; line-height: 1.6; }
.hero-actions { display: flex; gap: 1rem; margin-top: 1.5rem; flex-wrap: wrap; justify-content: center; }
.btn {
  padding: 0.6rem 1.25rem; border-radius: 6px; font-size: 0.875rem; font-weight: 500;
  text-decoration: none; transition: all 0.2s ease; display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; border: 1px solid transparent; cursor: pointer;
}
.btn-primary { background: var(--btn-bg); color: var(--btn-fg); border: 1px solid var(--btn-bg); }
.btn-primary:hover { background: var(--btn-hover); border-color: var(--btn-hover); transform: translateY(-1px); }
.btn-secondary { background: var(--bg-primary); color: var(--fg-primary); border: 1px solid var(--border-color); }
.btn-secondary:hover { background: var(--accents-1); border-color: var(--fg-primary); transform: translateY(-1px); }

/* Skills / Tech Stack Section */
.skills-grid { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.skill-chip {
  background: var(--bg-primary); border: 1px solid var(--border-color); padding: 0.5rem 1rem; border-radius: 20px;
  font-size: 0.875rem; font-weight: 500; color: var(--fg-primary); transition: all 0.2s ease; display: inline-flex; align-items: center; gap: 0.5rem;
}
.skill-chip:hover { border-color: var(--fg-primary); transform: translateY(-2px); background: var(--accents-1); }

/* Stats Section */
.section-header { margin-bottom: 2rem; }
.section-header h2 { font-size: 1.5rem; font-weight: 600; letter-spacing: -0.03em; margin-bottom: 0.25rem; }
.section-header p { color: var(--fg-secondary); font-size: 0.875rem; }
.metrics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1.25rem; }
.metric-card { background: var(--bg-primary); border: 1px solid var(--border-color); border-radius: 8px; padding: 1.25rem; text-align: left; transition: border-color 0.2s ease, transform 0.2s ease; }
.metric-card:hover { border-color: var(--fg-primary); transform: translateY(-2px); }
.metric-card h3 { font-size: 0.85rem; color: var(--fg-secondary); font-weight: 500; margin-bottom: 0.5rem; }
.metric-value { font-size: 2rem; font-weight: 700; color: var(--fg-primary); line-height: 1; letter-spacing: -0.05em; }

/* Projects & Filter Bar */
.projects-header { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 1rem; }
.controls-bar { display: flex; gap: 0.75rem; flex-wrap: wrap; width: 100%; max-width: 600px; }
.search-box { flex: 2; min-width: 180px; position: relative; display: flex; align-items: center; }
.search-box svg { position: absolute; left: 0.75rem; color: var(--fg-secondary); pointer-events: none; }
.search-box input {
  width: 100%; padding: 0.5rem 0.75rem 0.5rem 2.25rem; background: var(--bg-primary); border: 1px solid var(--border-color);
  border-radius: 6px; color: var(--fg-primary); font-size: 0.875rem; transition: border-color 0.2s;
}
.search-box input:focus { border-color: var(--fg-primary); outline: none; }
.language-select, .sort-select {
  flex: 1; min-width: 130px; padding: 0.5rem 0.75rem; background: var(--bg-primary); border: 1px solid var(--border-color);
  border-radius: 6px; color: var(--fg-primary); font-size: 0.875rem; cursor: pointer; transition: border-color 0.2s;
}
.language-select:focus, .sort-select:focus { border-color: var(--fg-primary); outline: none; }

/* Language Distribution Bar */
.lang-dist-container { margin-bottom: 2rem; background: var(--bg-primary); border: 1px solid var(--border-color); border-radius: 8px; padding: 1rem 1.25rem; }
.lang-dist-bar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: var(--accents-2); margin-bottom: 0.75rem; }
.lang-segment { height: 100%; transition: width 0.6s ease; }
.lang-dist-legend { display: flex; flex-wrap: wrap; gap: 1.25rem; font-size: 0.75rem; color: var(--fg-secondary); }
.legend-item { display: flex; align-items: center; gap: 0.4rem; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; }

/* Repos Grid & Mouse Spotlight */
.repos-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
}
.repo-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.25rem;
  transition: border-color 0.2s ease, transform 0.2s ease, background-color 0.2s ease;
  display: flex; flex-direction: column; position: relative; overflow: hidden;
}
/* Mouse Spotlight Aura */
.repo-card::before {
  content: ""; position: absolute; top: var(--mouse-y, -100px); left: var(--mouse-x, -100px);
  width: 250px; height: 250px; background: radial-gradient(circle, var(--spotlight-glow) 0%, transparent 70%);
  transform: translate(-50%, -50%); pointer-events: none; transition: opacity 0.3s; opacity: 0;
}
.repo-card:hover::before { opacity: 1; }
.repo-card:hover { border-color: var(--fg-primary); background-color: var(--card-hover); transform: translateY(-3px); }

.repo-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.5rem; margin-bottom: 0.5rem; }
.repo-title { font-size: 1rem; font-weight: 600; display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.repo-title a { color: var(--fg-primary); text-decoration: none; }
.repo-title a:hover { text-decoration: underline; }
.fork-tag { font-size: 0.7rem; padding: 2px 6px; border: 1px solid var(--border-color); border-radius: 10px; color: var(--fg-secondary); font-weight: normal; }
.repo-actions-top { display: flex; align-items: center; gap: 0.35rem; }

.repo-desc { color: var(--fg-secondary); font-size: 0.875rem; margin-bottom: 1rem; flex-grow: 1; line-height: 1.5; }

/* Topic Badges & Buttons */
.repo-topics { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 1rem; }
.topic-badge { background: var(--badge-bg); color: var(--badge-fg); font-size: 0.7rem; padding: 2px 8px; border-radius: 12px; font-weight: 500; }
.icon-btn {
  background: transparent; border: 1px solid var(--border-color); border-radius: 4px; padding: 3px 6px; color: var(--fg-secondary);
  cursor: pointer; transition: all 0.2s; display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { color: var(--fg-primary); border-color: var(--fg-primary); background: var(--accents-1); }
.demo-btn { font-size: 0.75rem; padding: 2px 8px; border-radius: 4px; border: 1px solid var(--border-color); text-decoration: none; color: var(--fg-primary); display: inline-flex; align-items: center; gap: 4px; transition: border-color 0.2s; }
.demo-btn:hover { border-color: var(--fg-primary); background: var(--accents-1); }

.repo-meta { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; font-size: 0.75rem; color: var(--fg-secondary); margin-top: auto; padding-top: 0.5rem; border-top: 1px dashed var(--border-color); }
.repo-meta-left { display: flex; align-items: center; gap: 0.65rem; flex-wrap: wrap; }
.meta-item { display: flex; align-items: center; gap: 0.25rem; }
.language-dot { width: 8px; height: 8px; border-radius: 50%; }
.time-badge { font-size: 0.7rem; color: var(--fg-secondary); white-space: nowrap; }

/* Skeleton Loaders */
.skeleton-card { background: var(--bg-primary); border: 1px solid var(--border-color); border-radius: 8px; padding: 1.25rem; display: flex; flex-direction: column; gap: 0.75rem; }
.skeleton { background: var(--skeleton-bg); background-image: linear-gradient(90deg, var(--skeleton-bg) 0px, var(--skeleton-shimmer) 40px, var(--skeleton-bg) 80px); background-size: 600px 100%; animation: shimmer 1.5s infinite linear; border-radius: 4px; }
.skeleton-title { height: 20px; width: 60%; }
.skeleton-text { height: 14px; width: 100%; }
.skeleton-text.short { width: 40%; }
.skeleton-meta { height: 12px; width: 80%; margin-top: auto; }

@keyframes shimmer { 0% { background-position: -200px 0; } 100% { background-position: 400px 0; } }

/* Command Palette Modal */
.cmd-palette-modal {
  position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: 1000; display: none;
  align-items: flex-start; justify-content: center; padding-top: 10vh;
}
.cmd-palette-modal.show { display: flex; }
.cmd-palette-backdrop { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: var(--modal-bg); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.cmd-palette-box {
  position: relative; width: 90%; max-width: 600px; background: var(--bg-primary); border: 1px solid var(--border-color);
  border-radius: 12px; box-shadow: 0 20px 40px rgba(0,0,0,0.4); overflow: hidden; display: flex; flex-direction: column; max-height: 70vh; animation: slideUp 0.2s ease-out;
}
.cmd-palette-header { display: flex; align-items: center; gap: 0.75rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border-color); }
.cmd-palette-header svg { color: var(--fg-secondary); }
.cmd-palette-header input {
  flex: 1; background: transparent; border: none; color: var(--fg-primary); font-size: 1rem; outline: none; font-family: inherit;
}
.cmd-palette-results { overflow-y: auto; padding: 0.5rem; display: flex; flex-direction: column; gap: 2px; }
.cmd-item {
  display: flex; align-items: center; justify-content: space-between; padding: 0.75rem 1rem; border-radius: 6px;
  color: var(--fg-primary); cursor: pointer; font-size: 0.875rem; text-decoration: none; transition: background 0.15s;
}
.cmd-item:hover, .cmd-item.selected { background: var(--accents-2); }
.cmd-item-left { display: flex; align-items: center; gap: 0.75rem; }
.cmd-item-desc { color: var(--fg-secondary); font-size: 0.75rem; }
.cmd-palette-footer { padding: 0.6rem 1.25rem; border-top: 1px solid var(--border-color); font-size: 0.75rem; color: var(--fg-secondary); background: var(--accents-1); }

/* Toast Notifications */
.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 1100; display: flex; flex-direction: column; gap: 10px; }
.toast-item {
  background: var(--bg-primary); border: 1px solid var(--border-color); color: var(--fg-primary);
  padding: 0.75rem 1.25rem; border-radius: 8px; box-shadow: 0 10px 25px rgba(0,0,0,0.3); font-size: 0.875rem;
  display: flex; align-items: center; gap: 0.6rem; animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes toastIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* Back to Top Floating Button */
.back-to-top-btn {
  position: fixed; bottom: 24px; right: 24px; width: 42px; height: 42px; border-radius: 50%;
  background: var(--bg-primary); border: 1px solid var(--border-color); color: var(--fg-primary);
  display: flex; align-items: center; justify-content: center; cursor: pointer; opacity: 0;
  transform: scale(0.8); transition: all 0.3s ease; z-index: 90; box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}
.back-to-top-btn.visible { opacity: 1; transform: scale(1); }
.back-to-top-btn:hover { border-color: var(--fg-primary); background: var(--accents-1); transform: scale(1.08); }

/* Footer */
footer { text-align: center; padding: 2.5rem 1.5rem; border-top: 1px solid var(--border-color); color: var(--fg-secondary); font-size: 0.875rem; margin-top: 3rem; }

/* Interactive Terminal Modal */
.terminal-modal {
  position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: 1000; display: none;
  align-items: center; justify-content: center; padding: 1.5rem;
}
.terminal-modal.show { display: flex; }
.terminal-backdrop { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: var(--modal-bg); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.terminal-box {
  position: relative; width: 100%; max-width: 720px; height: 480px; background: #0d1117; border: 1px solid #30363d;
  border-radius: 10px; box-shadow: 0 25px 50px rgba(0,0,0,0.5); overflow: hidden; display: flex; flex-direction: column; font-family: 'Fira Code', 'Courier New', monospace; font-size: 0.85rem; color: #c9d1d9;
}
.terminal-bar { display: flex; align-items: center; justify-content: space-between; padding: 0.6rem 1rem; background: #161b22; border-bottom: 1px solid #30363d; }
.terminal-dots { display: flex; gap: 8px; }
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; cursor: pointer; }
.dot.red { background: #ff5f56; }
.dot.yellow { background: #ffbd2e; }
.dot.green { background: #27c93f; }
.terminal-title { font-size: 0.75rem; color: #8b949e; font-weight: 500; }
.terminal-body { flex: 1; padding: 1rem; overflow-y: auto; display: flex; flex-direction: column; gap: 0.5rem; }
.terminal-welcome { color: #8b949e; margin-bottom: 0.5rem; line-height: 1.6; }
.term-highlight { color: #58a6ff; font-weight: 600; }
.term-prompt { color: #7ee787; font-weight: 600; margin-right: 0.5rem; }
.term-cmd { color: #f0883e; }
.term-out { color: #c9d1d9; white-space: pre-wrap; line-height: 1.5; margin-bottom: 0.5rem; }
.term-error { color: #ff7b72; }
.term-success { color: #7ee787; }
.terminal-input-line { display: flex; align-items: center; }
.terminal-input-line input {
  flex: 1; background: transparent; border: none; outline: none; color: #58a6ff; font-family: inherit; font-size: 0.85rem;
}

/* Responsive Media Queries */
@media (max-width: 1100px) {
  .repos-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px) {
  .repos-grid { grid-template-columns: repeat(2, 1fr); }
  .projects-header { flex-direction: column; align-items: flex-start; gap: 1.25rem; }
  .controls-bar { max-width: 100%; flex-direction: column; gap: 0.75rem; }
  .search-box, .language-select, .sort-select { width: 100%; flex: none; }
}
@media (max-width: 600px) {
  .nav-container { padding: 0.6rem 1rem; }
  .nav-right { gap: 0.4rem; }
  .nav-links { display: none; }
  .cmd-k-btn { padding: 0.4rem 0.6rem; font-size: 0.75rem; }
  .cmd-k-text { display: none; }
  .cmd-k-kbd { display: none; }
  .hamburger { display: flex; }
  
  .hero { min-height: auto; padding: 3rem 1.25rem 2rem 1.25rem; }
  .hero h1 { font-size: 2.1rem; }
  .subtitle { font-size: 0.95rem; }
  .hero-actions { flex-direction: column; width: 100%; }
  .hero-actions .btn { width: 100%; padding: 0.75rem 1rem; }
  
  .section { padding: 2.5rem 1rem; }
  .metrics-grid { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
  .metric-card { padding: 1rem; }
  .metric-value { font-size: 1.5rem; }
  .repos-grid { grid-template-columns: 1fr; gap: 1rem; }
  .repo-card { padding: 1rem; }
  
  /* Modals on Mobile */
  .cmd-palette-modal { padding-top: 5vh; }
  .cmd-palette-box { width: 94vw; max-height: 82vh; }
  .cmd-item { padding: 0.65rem 0.75rem; flex-direction: column; align-items: flex-start; gap: 0.2rem; }
  .cmd-item-desc { font-size: 0.7rem; }
  
  .terminal-modal { padding: 0.5rem; }
  .terminal-box { width: 100%; height: 85vh; font-size: 0.78rem; }
  .terminal-body { padding: 0.75rem 0.5rem; }
  .term-prompt { margin-right: 0.25rem; font-size: 0.75rem; }

  /* Toast & Floating Button */
  .toast-container { left: 12px; right: 12px; bottom: 12px; }
  .toast-item { width: 100%; justify-content: center; }
  .back-to-top-btn { bottom: 16px; right: 16px; width: 38px; height: 38px; }
}

@media (max-width: 400px) {
  .metrics-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 1.8rem; }
  .logo span { font-size: 1rem; }
}
