:root {
  /* Core Colors (Dark Theme) */
  --bg: #0a0b0d;
  --panel: #12141a;
  --text: #f2f2f2;
  --muted: #9aa0a6;
  --accent: #3b82f6;
  --accent-darker: #2563eb;
  --tag-bg: rgba(59, 130, 246, 0.15);
  --panel-hover: #1a1d24;
  
  /* Gradients */
  --accent-gradient: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  --glow: 0 0 20px rgba(59, 130, 246, 0.5);
  --subtle-glow: 0 0 30px rgba(59, 130, 246, 0.15);
  
  /* Shadows & Depth */
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3),
               0 0 20px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.3),
               0 0 30px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.4),
               0 0 50px rgba(0, 0, 0, 0.2);
  
  /* Effects */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --blur: 12px;
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Typography */
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", sans-serif;
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --line-height-tight: 1.4;
  --line-height: 1.65;
  --tracking-tight: -0.025em;
  --tracking-wide: 0.025em;
}

[data-theme='light'] {
  --bg: #ffffff;
  --panel: #f3f4f6;
  --panel-hover: #e5e7eb;
  --text: #111827;
  --muted: #6b7280;
  --accent: #2563eb;
  --accent-darker: #1d4ed8;
  --tag-bg: rgba(37, 99, 235, 0.1);
  
  /* Adjust shadows for light theme */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1),
               0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.08),
               0 2px 4px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.08),
               0 4px 6px rgba(0, 0, 0, 0.04);
  
  --glow: 0 0 20px rgba(37, 99, 235, 0.4);
  --subtle-glow: 0 0 30px rgba(37, 99, 235, 0.1);
}

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

html, body {
  height: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  line-height: var(--line-height);
  color: var(--text);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background var(--transition), color var(--transition);
}

/* Smooth Theme Fade */
body.fade-theme {
  transition: background 0.6s ease, color 0.6s ease;
}

.container {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

.center {
  max-width: 960px;
  margin: 0 auto;
  text-align: left;
}

/* Scroll Progress */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: var(--accent-gradient);
  z-index: 1000;
  transition: width 0.1s;
}

/* Scroll to Top */
.scroll-top {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text);
  z-index: 100;
  box-shadow: var(--shadow-sm);
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
}

.scroll-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.scroll-top:hover {
  transform: translateY(-4px);
  background: var(--panel-hover);
  box-shadow: var(--shadow-md);
}

/* Theme Toggle */
.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text);
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.theme-toggle:hover {
  transform: scale(1.1);
  background: var(--panel-hover);
  box-shadow: var(--shadow-md);
}

.theme-toggle svg {
  transition: all var(--transition);
}

.theme-toggle .sun-icon {
  display: none;
}

[data-theme='light'] .theme-toggle .sun-icon {
  display: block;
}

[data-theme='light'] .theme-toggle .moon-icon {
  display: none;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 40px;
}

.avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent);
  box-shadow: var(--glow);
  transition: all var(--transition);
  filter: contrast(1.05);
  background: var(--panel);
  position: relative;
}

.avatar::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid transparent;
  background: var(--accent-gradient) border-box;
  -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity var(--transition);
}

.avatar:hover {
  transform: scale(1.05) rotate(2deg);
  box-shadow: var(--glow), var(--subtle-glow);
  filter: contrast(1.1) brightness(1.05);
}

.avatar:hover::after {
  opacity: 1;
}

.greeting {
  font-size: clamp(1.7rem, 4vw, 2.2rem);
  font-weight: 700;
  letter-spacing: -0.3px;
  margin-bottom: 4px;
}

.subtitle {
  font-size: 0.95rem;
  color: var(--muted);
}

/* Layout */
.content-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 36px;
  margin-bottom: 24px;
}

.section {
  margin-bottom: 28px;
}

.section h2 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent);
  margin-bottom: 10px;
  font-weight: 600;
}

.section p {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.6;
}

/* Tags */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  font-size: var(--font-size-xs);
  font-weight: 500;
  padding: 4px 8px;
  background: var(--tag-bg);
  border-radius: var(--radius-sm);
  color: var(--accent);
  backdrop-filter: blur(var(--blur));
  transition: all var(--transition-fast);
  border: 1px solid rgba(59, 130, 246, 0.1);
  letter-spacing: var(--tracking-wide);
}

.tag:hover {
  transform: translateY(-1px);
  background: var(--accent);
  color: #fff;
  border-color: transparent;
  box-shadow: var(--shadow-sm);
}

/* Projects */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
}

.project {
  background: var(--panel);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: all var(--transition);
  position: relative;
  backdrop-filter: blur(var(--blur));
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.project::before,
.project::after {
  content: "";
  position: absolute;
  inset: 0;
  transition: opacity var(--transition);
  opacity: 0;
  pointer-events: none;
}

.project::before {
  background: radial-gradient(
    600px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
    rgba(59, 130, 246, 0.1),
    transparent 40%
  );
}

.project {
  transform-style: preserve-3d;
  perspective: 1000px;
}

.project-content {
  transform: translateZ(0);
  transition: transform 0.3s ease-out;
}

.project.tilted {
  transform: perspective(1000px);
}

.project::after {
  background: linear-gradient(
    to bottom right,
    rgba(59, 130, 246, 0.1),
    transparent 50%
  );
}

.project:hover {
  transform: translateY(-6px) scale(1.01);
  box-shadow: var(--shadow-lg), var(--subtle-glow);
  background: var(--panel-hover);
}

.project:hover::before,
.project:hover::after {
  opacity: 1;
}

.project img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  display: block;
  filter: brightness(0.95) contrast(1.1);
  transition: all var(--transition);
  border-bottom: 1px solid rgba(255, 255, 255, 0.02);
}

.project:hover img {
  filter: brightness(1) contrast(1.05);
  transform: scale(1.02);
}

.project-info {
  padding: 20px;
}

.project-info h3 {
  font-size: var(--font-size-lg);
  margin-bottom: 8px;
  color: var(--text);
  font-weight: 600;
  letter-spacing: var(--tracking-tight);
}

.project-info p {
  font-size: var(--font-size-sm);
  color: var(--muted);
  margin-bottom: 16px;
  line-height: var(--line-height-tight);
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.project-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--accent-gradient);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  text-decoration: none;
  width: 100%;
  justify-content: center;
}

.project-button:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md), var(--glow);
  background: var(--accent);
  border-color: rgba(255, 255, 255, 0.2);
}

.project-button:hover::after {
  display: none;
}

.project-button svg {
  width: 16px;
  height: 16px;
  transition: all var(--transition-fast);
  opacity: 0.9;
}

.project-button:hover svg {
  transform: translate(2px, -2px);
  opacity: 1;
}

/* Footer */
.copyright {
  text-align: center;
  color: var(--muted);
  font-size: 0.78rem;
  margin-top: 24px;
  padding: 10px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* Links */
a {
  color: var(--accent);
  text-decoration: none;
  position: relative;
  transition: color var(--transition);
}

a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  height: 1px;
  width: 0%;
  background: var(--accent);
  transition: width var(--transition);
}

a:hover {
  color: #fff;
}

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

/* Focus States */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

/* Loading Animation */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.content-loaded {
  animation: fadeIn 0.6s ease-out forwards;
}

.loading {
  opacity: 0;
}

/* Project Card Hover Animation */
@keyframes projectHover {
  0% { transform: translateY(-6px) scale(1.01); }
  50% { transform: translateY(-8px) scale(1.02); }
  100% { transform: translateY(-6px) scale(1.01); }
}

.project:hover {
  animation: projectHover 2s ease-in-out infinite;
  box-shadow: var(--shadow-lg), var(--subtle-glow);
  background: var(--panel-hover);
}

/* Responsive */
@media (max-width: 900px) {
  .content-grid {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .project-grid {
    grid-template-columns: 1fr;
  }

  .header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .greeting {
    font-size: 1.6rem;
  }

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

@media (max-width: 500px) {
  .container {
    padding: 0 14px;
  }

  .avatar {
    width: 50px;
    height: 50px;
  }

  .project-info {
    padding: 12px 14px;
  }

  .project img {
    height: 90px;
  }
}
