/* Modern Premium Theme for NEGIAO.github.io */
:root {
  /* Enhanced Color Palette */
  --background: #0A0E13;
  --background-secondary: #111920;
  --surface: #1A1F2E;
  --surface-elevated: #252A3A;
  --surface-hover: #2D3748;
  --primary: #00D9FF;
  --primary-hover: #00B8E6;
  --primary-light: #33E1FF;
  --accent: #FF6B6B;
  --accent-secondary: #4ECDC4;
  --success: #51CF66;
  --warning: #FFD93D;
  --danger: #FF6B6B;
  --text: #F7FAFC;
  --text-secondary: #E2E8F0;
  --text-muted: #A0AEC0;
  --text-disabled: #718096;
  --border: #2D3748;
  --border-light: #4A5568;
  --border-focus: var(--primary);
  
  /* Enhanced Gradients */
  --gradient-primary: linear-gradient(135deg, #00D9FF 0%, #0EA5E9 50%, #3B82F6 100%);
  --gradient-accent: linear-gradient(135deg, #ff6b6b 0%, #FF8E8E 50%, #FFA8A8 100%);
  --gradient-success: linear-gradient(135deg, #4784b6 0%, #1d72cd 100%);
  --gradient-warm: linear-gradient(135deg, #FF6B6B 0%, #FFD93D 100%);
  --gradient-cool: linear-gradient(135deg, #00D9FF 0%, #4ECDC4 100%);
  --gradient-hero: linear-gradient(135deg, 
    rgba(0, 217, 255, 0.1) 0%, 
    rgba(78, 205, 196, 0.05) 35%, 
    rgba(255, 107, 107, 0.05) 65%, 
    rgba(255, 217, 61, 0.1) 100%);
  
  /* Glass Morphism */
  --glass-bg: rgba(26, 31, 46, 0.8);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.37);

  /* Typography - Enhanced */
  --font-sans: 'Inter', 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Source Code Pro', monospace;
  --font-display: 'Inter', 'SF Pro Display', sans-serif;

  /* Spacing - Improved Scale */
  --space-xs: 0.25rem;   /* 4px */
  --space-sm: 0.5rem;    /* 8px */
  --space-md: 1rem;      /* 16px */
  --space-lg: 1.5rem;    /* 24px */
  --space-xl: 2rem;      /* 32px */
  --space-2xl: 3rem;     /* 48px */
  --space-3xl: 4rem;     /* 64px */
  --space-4xl: 6rem;     /* 96px */

  /* Border Radius - Modern Scale */
  --radius-xs: 2px;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 24px;
  --radius-full: 9999px;

  /* Enhanced Shadows */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1), 0 4px 6px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.15), 0 10px 10px rgba(0, 0, 0, 0.04);
  --shadow-2xl: 0 25px 50px rgba(0, 0, 0, 0.25);
  --shadow-glow: 0 0 20px rgba(0, 217, 255, 0.3);
  --shadow-glow-accent: 0 0 20px rgba(255, 107, 107, 0.3);

  /* Transitions - Refined */
  --transition-fast: 0.05s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.1s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 0.15s cubic-bezier(0.68, -0.55, 0.265, 1.55);

  /* Z-Index Scale */
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal: 1040;
  --z-popover: 1050;
  --z-tooltip: 1060;
}

/* Reset & Enhanced Base Styles */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 4rem;
  font-size: 16px;
}

body {
  font-family: var(--font-sans);
  line-height: 1.65;
  color: var(--text);
  background: var(--background);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  min-height: 100vh;
  position: relative;
}

/* Enhanced Body Background */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    radial-gradient(ellipse at 15% 15%, rgba(0, 217, 255, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse at 85% 85%, rgba(255, 107, 107, 0.06) 0%, transparent 60%),
    radial-gradient(ellipse at 50% 50%, rgba(78, 205, 196, 0.04) 0%, transparent 70%);
  pointer-events: none;
  z-index: -2;
}

/* Enhanced Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: var(--space-md);
  color: var(--text);
  letter-spacing: -0.025em;
}

h1 { 
  font-size: clamp(2.5rem, 5vw, 4rem);
  margin-bottom: var(--space-lg);
}
h2 { 
  font-size: clamp(2rem, 4vw, 3rem);
  margin-bottom: var(--space-lg);
}
h3 { 
  font-size: clamp(1.5rem, 3vw, 2.25rem);
}
h4 { 
  font-size: clamp(1.25rem, 2.5vw, 1.75rem);
}
h5 { 
  font-size: clamp(1.125rem, 2vw, 1.5rem);
}
h6 { 
  font-size: clamp(1rem, 1.5vw, 1.25rem);
}

p {
  margin-bottom: var(--space-md);
  line-height: 1.7;
  color: var(--text-secondary);
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: all var(--transition-fast);
  position: relative;
}

a:hover {
  color: var(--primary-light);
  text-decoration: none;
}

a:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}

/* Selection Styling */
::selection {
  background: rgba(0, 217, 255, 0.3);
  color: var(--text);
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--background-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-light);
}

/* Enhanced Layout Components */
.container {
  max-width: min(1400px, calc(100vw - 2rem));
  margin: 0 auto;
  padding: 0 var(--space-md);
}

/* Notes layout: content + right-side TOC */
.note-layout {
  /* Use a single column layout, the TOC will be fixed on the right */
  display: block;
  position: relative;
}

.note-content {
  /* Content area: fill the viewport width for immersive reading; TOC will overlay */
  width: 100%;
  max-width: 100vw;
  padding: calc(var(--space-lg) * 1.25) var(--space-lg);
  margin: 0;
  min-height: 100vh;
  box-sizing: border-box;
}

/* Make media and code inside notes responsive and not overflow the viewport */
.note-content img,
.note-content iframe,
.note-content video {
  max-width: 100%;
  height: auto;
  display: block;
  margin: var(--space-md) 0;
}

.note-content pre,
.note-content code {
  max-width: 100%;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.note-toc {
  /* Fixed TOC on the right, vertically centered, floating above content */
  position: fixed;
  right: 20px;
  top: 50%; /* vertically center relative to viewport */
  transform: translateY(-50%) translateZ(0); /* robust centering and preserve 3d layer */
  width: 280px;
  max-height: 70vh; /* 增加最大高度以容纳更多内容 */
  overflow-y: auto; /* 确保垂直滚动 */
  overflow-x: hidden; /* 防止水平滚动 */
  padding: calc(var(--space-lg) * 0.9);
  /* Higher-contrast opaque background so TOC stands out from page content */
  background: linear-gradient(180deg, rgba(18,22,30,1), rgba(12,14,18,1));
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: calc(var(--radius-xl) - 4px);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: 0 10px 36px rgba(0,0,0,0.6), 0 2px 6px rgba(0,0,0,0.4);
  z-index: 1050; /* Higher than navbar but not excessive */
  transition: transform 0.28s cubic-bezier(.2,.9,.2,1), right 0.25s ease, opacity 0.2s ease, box-shadow 0.2s ease;
  display: flex; /* 使用弹性布局 */
  flex-direction: column; /* 垂直排列 */
}

/* Collapsed state: slide TOC to the right, out of the way (toggle button remains) */
.note-toc.note-toc--collapsed {
  transform: translateY(-50%) translateX(120%);
  opacity: 0.98;
  pointer-events: auto; /* allow any visible parts to still receive events if needed */
}

/* Toggle button fixed at the right edge of the viewport */
#toc-toggle {
  position: fixed;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.604);
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(0,0,0,0.08));
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 100000; /* above the TOC */
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease, opacity 0.18s ease;
}

#toc-toggle:hover { transform: translateY(-50%) scale(1.05); }

/* Hide the toggle on small screens (mobile) */
@media (max-width: 768px) {
  #toc-toggle { display: none; }
  .note-toc { position: static; transform: none; right: auto; top: auto; }
}

/* Responsive adjustments */
@media (min-width: 1400px) {
  .note-content {
    /* Keep full-bleed content but increase horizontal padding on very wide screens */
    max-width: 100vw;
    padding: var(--space-lg) var(--space-3xl);
    width: 100%;
  }
  .note-toc {
    width: 300px;
    right: 30px;
  }
}

@media (max-width: 1200px) {
  .note-content {
    max-width: 100vw;
    padding: var(--space-lg) var(--space-lg);
    width: 100%;
  }
  .note-toc {
    width: 260px;
    right: 20px;
  }
}

@media (max-width: 768px) {
  /* On tablets and smaller, make TOC an inline block above the article
     by using column flex + ordering so the existing DOM (aside after article)
     will render visually before the article. */
  .note-layout {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  /* push content further below the fixed navbar on mobile; increase spacing for better visual breathing room */
  padding-top: calc(4.5rem + var(--space-2xl));
  }

  .note-toc {
    order: -1;
    position: static;
    width: 100%;
    max-height: 50vh; /* Limit height on mobile */
    top: auto;
    right: auto;
    transform: none;
  /* ensure clear spacing from the fixed navbar on mobile */
  margin: var(--space-2xl) 0 var(--space-lg) 0;
    box-shadow: var(--shadow-lg);
  }

  .note-content {
    /* Content takes full width */
    padding: var(--space-lg);
    max-width: 100%;
    min-height: auto;
  }
}

.note-toc__title {
  margin: 0 0 var(--space-sm) 0;
  flex-shrink: 0; /* 防止标题被压缩 */
  text-align: left;
  font-size: 1rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.note-toc__title .toc-accent {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--primary);
  box-shadow: 0 0 8px rgba(0,217,255,0.12);
}

/* 添加导航区域的样式 */
.note-toc__nav {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  overflow-y: auto; /* 允许导航内容溢出时滚动 */
  max-height: calc(70vh - 60px); /* 减去标题的高度 */
}

.note-toc__list {
  list-style: none;
  padding: 0;
  margin: 0;
  margin-right: 5px; /* 为滚动条留出空间 */
  flex-grow: 1; /* 允许列表区域占据剩余空间 */
}

.note-toc__item { 
  margin: var(--space-sm) 0; 
}

.note-toc__link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.92rem;
  padding: calc(var(--space-xs) * 0.9) calc(var(--space-sm) * 0.9);
  border-radius: calc(var(--radius-sm) + 2px);
  display: block;
  transition: color 0.12s ease, background 0.12s ease, transform 0.12s ease;
  padding-left: var(--space-sm);
}

/* 不同级别标题的样式差异 */
.note-toc__link.toc-level-1 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.note-toc__link.toc-level-2 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.note-toc__link.toc-level-3 {
  font-size: 0.92rem;
  font-weight: 500;
}

.note-toc__link.toc-level-4,
.note-toc__link.toc-level-5,
.note-toc__link.toc-level-6 {
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--text-muted);
}

.note-toc__link:hover { 
  color: var(--primary);
  background: linear-gradient(90deg, rgba(0,217,255,0.06), rgba(78,205,196,0.02));
  transform: translateX(6px) scale(1.01);
}

.note-toc__link.is-active {
  color: var(--primary);
  font-weight: 700;
  background: linear-gradient(90deg, rgba(0,217,255,0.12), rgba(0,217,255,0.06));
  box-shadow: inset 0 0 0 1px rgba(0,217,255,0.02);
}

/* Indentation by heading level */
.note-toc-level-h2 { margin-left: 0; }
.note-toc-level-h3 { margin-left: var(--space-md); }
.note-toc-level-h4 { margin-left: calc(var(--space-md) * 2); }
.note-toc-level-h5 { margin-left: calc(var(--space-md) * 3); }
.note-toc-level-h6 { margin-left: calc(var(--space-md) * 4); }

/* custom scrollbar for TOC */
.note-toc::-webkit-scrollbar,
.note-toc__nav::-webkit-scrollbar { 
  width: 6px; 
}
.note-toc::-webkit-scrollbar-track,
.note-toc__nav::-webkit-scrollbar-track { 
  background: transparent; 
}
.note-toc::-webkit-scrollbar-thumb,
.note-toc__nav::-webkit-scrollbar-thumb { 
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.03)); 
  border-radius: 6px; 
}
.note-toc::-webkit-scrollbar-thumb:hover,
.note-toc__nav::-webkit-scrollbar-thumb:hover { 
  background: linear-gradient(180deg, rgba(255,255,255,0.09), rgba(255,255,255,0.04)); 
}

/* Collapsed state should be fully opaque (no transparency) and visible as a solid block */
.note-toc.note-toc--collapsed {
  transform: translateY(-50%) translateX(120%) !important;
  right: 12px !important;
  opacity: 1 !important;
  background: linear-gradient(180deg, rgba(14,16,18,1), rgba(10,12,14,1)) !important;
  border: 1px solid rgba(255,255,255,0.14) !important;
  box-shadow: 0 12px 40px rgba(0,0,0,0.65) !important;
}

/* Responsive: stack TOC under content on small screens */
@media (max-width: 1024px) {
  /* This is now handled by the 992px breakpoint */
}

@media (max-width: 768px) {
  .note-toc {
    /* Further adjustments for small phones if needed */
    padding: var(--space-md);
    max-height: 50vh; /* 在移动设备上限制最大高度 */
  }
  .note-toc__nav {
    max-height: calc(50vh - 20px); /* 在移动设备上调整导航区域最大高度 */
  }
  .note-content {
    padding: var(--space-md);
  }
  
  /* 目录在移动设备上的样式优化 */
  .note-toc__link.toc-level-1 {
    font-size: 1.05rem;
  }
  .note-toc__link.toc-level-2 {
    font-size: 0.95rem;
  }
  .note-toc__link.toc-level-3 {
    font-size: 0.85rem;
  }
  .note-toc__link.toc-level-4,
  .note-toc__link.toc-level-5,
  .note-toc__link.toc-level-6 {
    font-size: 0.8rem;
  }
  
  /* 减小移动设备上的缩进距离 */
  .note-toc-level-h2 { margin-left: 0; }
  .note-toc-level-h3 { margin-left: var(--space-sm); }
  .note-toc-level-h4 { margin-left: calc(var(--space-sm) * 2); }
  .note-toc-level-h5 { margin-left: calc(var(--space-sm) * 3); }
  .note-toc-level-h6 { margin-left: calc(var(--space-sm) * 4); }
}

.section {
  padding: var(--space-4xl) 0;
  position: relative;
}

.section--hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
  padding: var(--space-2xl) 0;
}

.section--hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--gradient-hero);
  opacity: 0.6;
  pointer-events: none;
  z-index: -1;
}

.section--hero::after {
  content: '';
  position: absolute;
  width: min(40vw, 600px);
  height: min(40vw, 600px);
  border-radius: 50%;
  background: 
    radial-gradient(circle, rgba(0, 217, 255, 0.1) 0%, transparent 70%),
    linear-gradient(135deg, rgba(0, 217, 255, 0.05) 0%, rgba(78, 205, 196, 0.05) 100%);
  border: 2px solid rgba(0, 217, 255, 0.15);
  top: -10%;
  right: -10%;
  z-index: -1;
  animation: heroFloat 20s infinite alternate ease-in-out;
  backdrop-filter: blur(1px);
}

/* Strong override: ensure note TOC stays fixed and on top for desktop viewports.
   This is placed late in the stylesheet to avoid accidental overrides earlier. */
@media (min-width: 769px) {
  .note-toc {
    position: fixed !important;
    right: 28px !important;
    top: 50% !important;
    transform: translateY(-50%) translateZ(0) !important;
    width: 300px !important;
    max-height: 70vh !important;
    z-index: 99999 !important;
    box-shadow: var(--shadow-2xl) !important;
    display: flex !important;
    flex-direction: column !important;
  }
  .note-toc__nav {
    display: flex !important;
    flex-direction: column !important;
    flex-grow: 1 !important;
    overflow-y: auto !important;
    max-height: calc(70vh - 60px) !important; /* 确保在桌面环境下有足够空间 */
  }
  /* Ensure collapsed class can override the important defaults above */
  .note-toc.note-toc--collapsed {
    transform: translateY(-50%) translateX(120%) !important;
    right: 12px !important;
    opacity: 0.98 !important;
  }
}

/* Ensure navbar is above all floating elements (TOC, popovers) */
.navbar {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 110000 !important; /* higher than .note-toc 99999 */
}

@keyframes heroFloat {
  0% {
    transform: translate(0, 0) rotate(0deg) scale(1);
  }
  33% {
    transform: translate(-3%, 2%) rotate(2deg) scale(1.05);
  }
  66% {
    transform: translate(2%, -3%) rotate(-1deg) scale(0.95);
  }
  100% {
    transform: translate(-1%, 1%) rotate(1deg) scale(1.02);
  }
}

/* Enhanced Grid System */
.grid {
  display: grid;
  gap: var(--space-xl);
  width: 100%;
}

.grid--auto-fit {
  grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
}

.grid--2 { 
  grid-template-columns: repeat(auto-fit, minmax(min(350px, 100%), 1fr));
}

.grid--3 { 
  grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
}

.grid--3-fixed {
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-xl);
}

.grid--responsive {
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
}

/* Enhanced Cards with Glass Morphism */
.card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl);
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  will-change: transform, box-shadow, border-color;
  transform: translateZ(0);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gradient-primary);
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.card:hover {
  border-color: rgba(0, 217, 255, 0.4);
  transform: translateY(-8px) translateZ(0);
  box-shadow: 
    var(--shadow-xl),
    0 0 30px rgba(0, 217, 255, 0.15);
}

.card:hover::before {
  opacity: 1;
}

.card--featured {
  background: linear-gradient(145deg, 
    rgba(0, 217, 255, 0.1) 0%, 
    rgba(26, 31, 46, 0.9) 50%, 
    rgba(255, 107, 107, 0.1) 100%);
  border: 1px solid rgba(0, 217, 255, 0.3);
  position: relative;
}

.card--featured::after {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: var(--gradient-primary);
  border-radius: var(--radius-xl);
  z-index: -1;
  opacity: 0.1;
}

.note-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  margin-bottom: var(--space-lg);
  transition: all var(--transition-normal);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
}

.note-card:hover {
  border-color: rgba(0, 217, 255, 0.4);
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

/* Enhanced Modern Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-xl);
  border: none;
  border-radius: var(--radius-lg);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition-normal);
  white-space: nowrap;
  will-change: transform;
  transform: translateZ(0);
  position: relative;
  overflow: hidden;
  min-height: 44px; /* Accessibility: minimum touch target */
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left var(--transition-slow);
}

.btn:hover::before {
  left: 100%;
}

.btn--primary {
  background: var(--gradient-primary);
  color: white;
  box-shadow: var(--shadow-md);
  border: 1px solid transparent;
}

.btn--primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  color: white;
  text-decoration: none;
}

.btn--primary:active {
  transform: translateY(0);
}

.btn--secondary {
  background: var(--glass-bg);
  color: var(--text);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.btn--secondary:hover {
  background: var(--surface-elevated);
  border-color: var(--primary);
  color: var(--text);
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn--outline {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}

.btn--outline:hover {
  background: var(--primary);
  color: white;
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow);
}

.btn--accent {
  background: var(--gradient-accent);
  color: white;
  box-shadow: var(--shadow-md);
}

.btn--accent:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg), var(--shadow-glow-accent);
  color: white;
  text-decoration: none;
}

.btn--small {
  padding: var(--space-sm) var(--space-lg);
  font-size: 0.8rem;
  min-height: 36px;
}

.btn--large {
  padding: var(--space-lg) var(--space-2xl);
  font-size: 1rem;
  min-height: 52px;
}

/* Enhanced Navigation with Glass Morphism */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
  z-index: var(--z-fixed);
  transition: all var(--transition-normal);
  box-shadow: var(--shadow-sm);
}

.navbar--scrolled {
  background: rgba(10, 14, 19, 0.95);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  box-shadow: var(--shadow-lg);
}

.navbar__container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xl);
  height: 4.5rem;
  position: relative;
}

.navbar__brand {
  font-size: 1.5rem;
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-decoration: none;
  transition: all var(--transition-fast);
}

.navbar__brand:hover {
  transform: scale(1.05);
  filter: drop-shadow(0 0 8px rgba(0, 217, 255, 0.5));
}

.navbar__nav {
  display: flex;
  list-style: none;
  gap: var(--space-xl);
  margin: 0 auto;
  padding: 0;
  justify-content: center;
  align-items: center;
}

.navbar__link {
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.95rem;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  position: relative;
  text-decoration: none;
}

.navbar__link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--gradient-primary);
  transition: all var(--transition-normal);
  transform: translateX(-50%);
}

.navbar__link:hover {
  color: var(--primary);
  background: rgba(0, 217, 255, 0.1);
  transform: translateY(-1px);
}

.navbar__link:hover::after {
  width: 80%;
}

.navbar__link.active {
  color: var(--primary);
  background: rgba(0, 217, 255, 0.15);
}

.navbar__link.active::after {
  width: 80%;
}

/* Mobile Navigation Enhanced */
.mobile-menu-toggle {
  display: none;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: var(--space-sm);
  color: var(--text);
  cursor: pointer;
  transition: all var(--transition-fast);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
}

.mobile-menu-toggle:hover {
  background: var(--surface-elevated);
  border-color: var(--primary);
  color: var(--primary);
  transform: scale(1.05);
}

.mobile-menu {
  display: none;
  position: fixed;
  top: 4.5rem;
  left: 0;
  right: 0;
  background: var(--glass-bg);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border-bottom: 1px solid var(--glass-border);
  z-index: var(--z-dropdown);
  transform: translateY(-100%);
  transition: all var(--transition-normal);
  box-shadow: var(--shadow-lg);
}

.mobile-menu.active {
  transform: translateY(0);
}

.mobile-menu__nav {
  list-style: none;
  padding: var(--space-lg) 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.mobile-menu__item {
  padding: 0;
  width: 100%;
  box-sizing: border-box;
}

.mobile-menu__link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: var(--text-secondary);
  padding: var(--space-md) 0;
  font-weight: 500;
  text-decoration: none;
  transition: all var(--transition-fast);
  border-bottom: 1px solid transparent;
  text-align: center;
  width: 100%;
  box-sizing: border-box;
}

.mobile-menu__link:hover {
  color: var(--primary);
  border-bottom-color: var(--primary);
  transform: translateY(-2px);
}

/* When mobile menu is open, make items and nested lists fill full width and center content */
@media (max-width: 768px) {
  .mobile-menu.active .mobile-menu__item {
    width: 100%;
    margin: var(--space-sm) 0; /* small vertical gap between items */
    box-sizing: border-box;
    display: block;
  }

  .mobile-menu.active .mobile-menu__link {
    display: flex;
    align-items: center;
    justify-content: center; /* center icon + label horizontally */
    width: 100%;
    padding: var(--space-md);
    box-sizing: border-box;
    text-align: center;
    border-radius: var(--radius-md);
    color: var(--text);
    background: transparent;
  }

  .mobile-menu.active .mobile-menu__link i {
    margin-right: var(--space-sm);
    min-width: 1.6rem;
    text-align: center;
  }

  /* Ensure nested lists inside the mobile menu also fill width and center text */
  .mobile-menu.active .mobile-menu__nav,
  .mobile-menu.active .mobile-menu__nav ul {
    width: 100%;
    padding: 0;
    margin: 0;
    list-style: none;
  }

  .mobile-menu.active .mobile-menu__nav li {
    width: 100%;
  }

  .mobile-menu.active .mobile-menu__nav li a {
    width: 100%;
    display: block;
    text-align: center;
    padding: var(--space-md);
  }
}

/* Mobile: make top navbar brand and action button inline and sized appropriately */
@media (max-width: 768px) {
  .navbar__container {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: var(--space-sm) !important;
  }

  .navbar__brand {
    font-size: 1.125rem !important;
    font-weight: 700 !important;
    display: inline-block !important;
    margin-right: var(--space-sm) !important;
    white-space: nowrap !important;
  }

  /* Buttons in navbar should be compact on mobile and not full-width */
  .navbar__container .btn,
  .mobile-navbar .btn,
  .btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0.5rem 0.9rem !important; /* slightly smaller touch target */
    font-size: 0.95rem !important;
    min-width: 56px !important; /* accessible touch size */
    max-width: 160px !important; /* prevent overly wide buttons */
    width: auto !important;
  }

  /* Secondary buttons get a subtle outline and compact look on mobile */
  .btn--secondary {
    padding: 0.4rem 0.85rem !important;
    border-radius: calc(var(--radius-md));
  }
}

/* Floating Elements */
.floating-shapes {
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.mobile-menu.active {
  opacity: 1;
  visibility: visible;
}

.mobile-menu__nav {
  list-style: none;
  padding: 0;
  margin: 0;
  text-align: center;
}

.mobile-menu__item {
  margin: var(--space-lg) 0;
}

.mobile-menu__link {
  color: var(--text);
  font-size: 1.25rem;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.2s ease;
  padding: var(--space-sm) var(--space-lg);
  border-radius: var(--radius-md);
}

.mobile-menu__link:hover {
  color: var(--primary);
  background: rgba(88, 166, 255, 0.1);
}

/* Enhanced Hero Section */
.hero {
  text-align: center;
  position: relative;
  z-index: 1;
  max-width: 1000px;
  margin: 0 auto;
}

.hero__title {
  font-size: clamp(2.5rem, 6vw, 5rem);
  font-weight: 800;
  margin-bottom: var(--space-lg);
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 4px 8px rgba(0, 217, 255, 0.3));
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.hero__subtitle {
  font-size: clamp(1.125rem, 2.5vw, 1.5rem);
  color: var(--text-secondary);
  margin-bottom: var(--space-2xl);
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.6;
  font-weight: 400;
}

.hero__actions {
  display: flex;
  gap: var(--space-lg);
  justify-content: center;
  flex-wrap: wrap;
  margin-top: var(--space-xl);
}

/* Enhanced Avatar with Modern Design */
.avatar-container {
  position: relative;
  width: 200px;
  height: 200px;
  /* place avatar below the fixed navbar (navbar height 4.5rem) with a smaller gap on desktop */
  margin: calc(4.5rem + calc(var(--space-md) * 0.5)) auto var(--space-2xl);
}

.avatar {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  border: 3px solid transparent;
  background: 
    linear-gradient(var(--surface-elevated), var(--surface-elevated)) padding-box,
    var(--gradient-primary) border-box;
  display: block;
  transition: all var(--transition-slow);
  box-shadow: 
    var(--shadow-xl),
    0 0 40px rgba(0, 217, 255, 0.2);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 3;
  will-change: transform;
  object-fit: cover;
}

.avatar:hover {
  transform: translate(-50%, -50%) scale(1.08) rotate(2deg);
  box-shadow: 
    var(--shadow-2xl),
    0 0 60px rgba(0, 217, 255, 0.4);
  border-color: var(--primary-light);
}

.avatar-glow {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle, var(--primary) 0%, transparent 70%);
  filter: blur(20px);
  opacity: 0.2;
  z-index: 1;
  animation: avatarPulse 4s infinite alternate ease-in-out;
}

.avatar-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px solid transparent;
  background: conic-gradient(from 0deg, var(--primary), var(--accent-secondary), var(--accent), var(--primary));
  z-index: 2;
  animation: rotate 15s linear infinite;
  opacity: 0.6;
}

.avatar-ring::before {
  content: '';
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  background: var(--surface-elevated);
}

@keyframes avatarPulse {
  0% { 
    transform: scale(1); 
    opacity: 0.2; 
  }
  100% { 
    transform: scale(1.3); 
    opacity: 0.35; 
  }
}

@keyframes rotate {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Enhanced Tech Badges */
.hero-tech-badges {
  display: flex;
  justify-content: center;
  gap: var(--space-md);
  margin-bottom: var(--space-2xl);
  flex-wrap: wrap;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.tech-badge {
  background: rgba(0, 217, 255, 0.1);
  border: 1px solid rgba(0, 217, 255, 0.3);
  padding: var(--space-sm) var(--space-lg);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  transition: all var(--transition-normal);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.tech-badge::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(0, 217, 255, 0.2), transparent);
  transition: left var(--transition-slow);
}

.tech-badge:hover {
  background: rgba(0, 217, 255, 0.2);
  border-color: var(--primary);
  transform: translateY(-2px) scale(1.05);
  box-shadow: var(--shadow-md), 0 0 15px rgba(0, 217, 255, 0.3);
}

.tech-badge:hover::before {
  left: 100%;
}

.tech-badge--accent {
  background: rgba(255, 107, 107, 0.1);
  border-color: rgba(255, 107, 107, 0.3);
  color: var(--accent);
}

.tech-badge--accent:hover {
  background: rgba(255, 107, 107, 0.2);
  border-color: var(--accent);
  box-shadow: var(--shadow-md), 0 0 15px rgba(255, 107, 107, 0.3);
}

.tech-badge--success {
  background: rgba(81, 207, 102, 0.1);
  border-color: rgba(81, 207, 102, 0.3);
  color: var(--success);
}

.tech-badge--success:hover {
  background: rgba(81, 207, 102, 0.2);
  border-color: var(--success);
  box-shadow: var(--shadow-md), 0 0 15px rgba(81, 207, 102, 0.3);
}

.floating-shapes {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  overflow: hidden;
  z-index: -1;
  pointer-events: none;
}

.shape {
  position: absolute;
  border-radius: 50%;
  opacity: 0.1;
  filter: blur(40px);
}

.shape-1 {
  width: 300px;
  height: 300px;
  background-color: var(--primary);
  top: 20%;
  left: -100px;
  animation: float-1 25s infinite alternate ease-in-out;
}

.shape-2 {
  width: 200px;
  height: 200px;
  background-color: var(--accent);
  bottom: 10%;
  right: -50px;
  animation: float-2 20s infinite alternate-reverse ease-in-out;
}

.shape-3 {
  width: 150px;
  height: 150px;
  background-color: var(--success);
  top: 60%;
  left: 20%;
  animation: float-3 15s infinite alternate ease-in-out;
}

@keyframes float-1 {
  0% { transform: translate(0, 0) rotate(0deg); }
  100% { transform: translate(50px, 50px) rotate(15deg); }
}

@keyframes float-2 {
  0% { transform: translate(0, 0) rotate(0deg); }
  100% { transform: translate(-30px, -30px) rotate(-15deg); }
}

@keyframes float-3 {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(20px, -20px) scale(1.2); }
}

/* Features Grid */
.features {
  padding: var(--space-4xl) 0;
}

.feature {
  text-align: center;
}

.feature__icon {
  width: 4rem;
  height: 4rem;
  background: var(--gradient-primary);
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-lg);
  font-size: 1.75rem;
  color: white;
  box-shadow: var(--shadow-lg);
  transition: all var(--transition-normal);
}

.feature__icon:hover {
  transform: translateY(-4px) scale(1.05);
  box-shadow: var(--shadow-xl);
}

.feature__title {
  color: var(--text);
  margin-bottom: var(--space-md);
  font-size: 1.25rem;
  font-weight: 600;
}

.feature__description {
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 0;
}

/* Projects Grid */
.projects {
  padding: var(--space-4xl) 0;
}

.project__title {
  color: var(--text);
  margin-bottom: var(--space-md);
  font-size: 1.5rem;
  font-weight: 700;
}

.project__description {
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: var(--space-lg);
}

.project-badge {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  background: var(--gradient-primary);
  color: white;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-md);
  font-size: 0.75rem;
  font-weight: 600;
  z-index: 2;
}

/* Contact Styles */
.contact-icon-container {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-lg);
  transition: all var(--transition-normal);
}

.card:hover .contact-icon-container {
  transform: translateY(-4px) scale(1.1);
}

/* Footer Responsive Design */
@media (max-width: 768px) {
  .footer__navigation ul {
    flex-direction: column;
    gap: var(--space-md) !important;
  }
  
  .footer__navigation ul li a {
    display: block;
    padding: var(--space-sm) var(--space-md) !important;
    background: rgba(0, 217, 255, 0.05);
    border-radius: var(--radius-md);
    border: 1px solid rgba(0, 217, 255, 0.1);
  }
  
  .footer__navigation ul li a:hover {
    background: rgba(0, 217, 255, 0.1);
    border-color: rgba(0, 217, 255, 0.3);
    color: var(--primary);
  }
}

.project-card {
  position: relative;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  overflow: hidden;
}

.project-content {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--space-lg);
  align-items: center;
}

.project-image-container {
  position: relative;
  width: 100%;
  height: 0;
  padding-bottom: 56.25%; /* 16:9 宽高比 */
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-lg);
}

.project-image-container i {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 3.5rem;
  width: 5rem;
  height: 5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  transition: all var(--transition-normal);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.project-image-container:hover i {
  transform: translate(-50%, -50%) scale(1.1) rotate(5deg);
  background: rgba(255, 255, 255, 0.25);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

/* 移动端优化 */
@media (max-width: 768px) {
  .project-image-container {
    padding-bottom: 50%; /* 2:1 宽高比，适合移动端 */
  }
  
  .project-image-container i {
    font-size: 3rem;
    width: 4rem;
    height: 4rem;
  }
}

@media (max-width: 576px) {
  .project-image-container {
    padding-bottom: 60%; /* 更接近正方形 */
  }
  
  .project-image-container i {
    font-size: 2.5rem;
    width: 3.5rem;
    height: 3.5rem;
  }
}

.project-image-placeholder {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-alt);
}

.project-image-placeholder i {
  font-size: 2.5rem;
  color: white;
}

.project__title {
  color: var(--primary);
  margin-bottom: var(--space-sm);
  font-size: 1.5rem;
}

.project__description {
  color: var(--text-light);
  margin-bottom: var(--space-md);
  line-height: 1.6;
}

.project__tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-bottom: var(--space-md);
}

/* 添加媒体查询使项目标签在移动端居中对齐 */
@media (max-width: 768px) {
  .project__tags {
    justify-content: center;
  }
}

.project__tag {
  background: var(--surface-alt);
  color: var(--text-muted);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.project__tag:hover {
  background: var(--primary);
  color: white;
}

.project__actions {
  display: flex;
  gap: var(--space-sm);
  align-items: center;
}

/* Enhanced Responsive Design */

/* Large Tablets and Small Laptops */
@media (max-width: 1024px) {
  .container {
    padding: 0 var(--space-lg);
  }
  
  .section {
    padding: var(--space-3xl) 0;
  }
  
  .hero__title {
    font-size: clamp(2.8rem, 5vw, 4rem);
  }
  
  .navbar__container {
   padding: 0 var(--space-lg);
   /* Keep navbar items in a single row on smaller screens so the mobile toggle
     can sit to the right of the brand. Use space-between to separate brand and toggle. */
   flex-direction: row;
   justify-content: space-between;
   align-items: center;
   gap: var(--space-md);
   position: relative;
  }
  
  .grid--3-fixed {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-lg);
  }
}

/* Tablets */
@media (max-width: 768px) {
  .container {
    padding: 0 var(--space-md);
  }
  
  .section {
    padding: var(--space-2xl) 0;
  }
  
  .section--hero {
    min-height: 90vh;
    padding: var(--space-xl) 0;
  }
  
  .hero__title {
    font-size: clamp(2.2rem, 6vw, 3.5rem);
    margin-bottom: var(--space-md);
  }
  
  .hero__subtitle {
    font-size: clamp(1rem, 3vw, 1.25rem);
    padding: 0 var(--space-sm);
    text-align: center;
    margin-bottom: var(--space-xl);
    line-height: 1.5;
  }
  
  .hero__actions {
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
    max-width: 280px;
    margin: 0 auto;
  }
  
  .btn {
    width: 100%;
    justify-content: center;
  }
  
  .navbar__nav {
    display: none;
  }
  
  .mobile-menu-toggle {
    display: block;
  }
  
  .mobile-menu {
    display: flex;
  }

  /* Center the brand and pin the mobile toggle to the right on small screens */
  .navbar__container {
    justify-content: center; /* center items horizontally */
    position: relative; /* establish containing block for absolute children */
  }

  .navbar__brand {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1050;
  }

  .mobile-menu-toggle {
    position: absolute;
    right: var(--space-md);
    top: 50%;
    transform: translateY(-50%);
    z-index: 1060;
  }
  
  .avatar-container {
    width: 160px;
    height: 160px;
  /* keep avatar under the navbar on tablet/smaller screens */
  margin: calc(4.5rem + var(--space-md)) auto var(--space-xl);
  }
  
  .avatar {
    width: 140px;
    height: 140px;
  }
  
  .hero-tech-badges {
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-xl);
    max-width: 300px;
  }
  
  .tech-badge {
    width: 100%;
    max-width: 200px;
    justify-content: center;
    padding: var(--space-sm) var(--space-md);
  }
  
  .grid--2,
  .grid--3,
  .grid--3-fixed,
  .grid--responsive {
    grid-template-columns: 1fr;
    gap: var(--space-lg);
  }
  
  .card {
    padding: var(--space-xl);
    align-items: center;
    justify-content: center;
    text-align: center;
  }
  
  .footer__content {
    flex-direction: column;
    text-align: center;
    gap: var(--space-lg);
  }
  
  h1 { font-size: clamp(1.8rem, 5vw, 2.5rem); }
  h2 { font-size: clamp(1.5rem, 4vw, 2rem); }
  h3 { font-size: clamp(1.25rem, 3vw, 1.75rem); }
}

/* Mobile Phones */
@media (max-width: 576px) {
  .container {
    padding: 0 var(--space-sm);
  }
  
  .section {
    padding: var(--space-xl) 0;
  }
  
  .section--hero {
    min-height: 85vh;
  }
  
  .hero__title {
    font-size: clamp(2rem, 8vw, 3rem);
    line-height: 1;
    margin-bottom: var(--space-sm);
  }
  
  .hero__subtitle {
    font-size: clamp(0.95rem, 4vw, 1.125rem);
    margin-bottom: var(--space-lg);
    padding: 0;
  }
  
  .avatar-container {
    width: 140px;
    height: 140px;
  /* on phones the navbar is slightly shorter (4rem) */
  margin: calc(4rem + var(--space-sm)) auto var(--space-lg);
  }
  
  .avatar {
    width: 120px;
    height: 120px;
  }
  
  .hero-tech-badges {
    margin-bottom: var(--space-lg);
  }
  
  .tech-badge {
    font-size: 0.8rem;
    padding: var(--space-xs) var(--space-sm);
  }
  
  .btn {
    padding: var(--space-sm) var(--space-lg);
    font-size: 0.85rem;
  }
  
  .btn--small {
    padding: var(--space-xs) var(--space-md);
    font-size: 0.75rem;
  }
  
  .card {
    padding: var(--space-lg);
    border-radius: var(--radius-md);
  }
  
  .navbar__container {
  height: 4rem;
  padding: 0 var(--space-sm);
  /* Keep horizontal layout on phones: brand at left, toggle at right */
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-sm);
  position: relative;
  }
  
  .navbar__brand {
    font-size: 1.25rem;
  }
  
  .floating-shapes {
    display: none; /* Hide decorative shapes on mobile for performance */
  }
  
  /* Touch-friendly interactions */
  .btn,
  .navbar__link,
  .social-link {
    min-height: 44px;
    min-width: 44px;
  }
}

/* Extra Small Phones */
@media (max-width: 375px) {
  .hero__title {
    font-size: clamp(1.75rem, 10vw, 2.5rem);
  }
  
  .hero__subtitle {
    font-size: 0.9rem;
  }
  
  .avatar-container {
    width: 120px;
    height: 120px;
  /* extra-small phones use same top offset as phones */
  margin: calc(4rem + var(--space-sm)) auto var(--space-md);
  }
  
  .avatar {
    width: 100px;
    height: 100px;
  }
  
  .tech-badge {
    font-size: 0.75rem;
    max-width: 160px;
  }
  
  .btn {
    font-size: 0.8rem;
  }
}

/* High DPI Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .avatar {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
}

/* Reduce Motion for Accessibility */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  
  .floating-shapes,
  .avatar-glow,
  .avatar-ring {
    display: none;
  }
}

/* Footer */
.footer {
  padding: var(--space-2xl) 0;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text-muted);
  background: var(--background-secondary);
}

.footer__content {
  max-width: 800px;
  margin: 0 auto;
}

.footer__navigation ul li a:hover {
  color: var(--primary);
  background: rgba(0, 217, 255, 0.1);
  transform: translateY(-2px);
  text-decoration: none;
}

.social-links {
  display: flex;
  gap: var(--space-lg);
}

.social-link {
  color: var(--text-muted);
  font-size: 1.25rem;
  transition: all var(--transition-fast);
  padding: var(--space-sm);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
}

.social-link:hover {
  color: var(--primary);
  background: rgba(0, 217, 255, 0.1);
  transform: translateY(-2px);
  text-decoration: none;
}

/* Performance optimizations */
.will-change {
  will-change: transform;
}

/* Notes Index Page Styles */
.notes-index-header {
  text-align: center;
  margin-bottom: var(--space-3xl);
}

.notes-subtitle {
  font-size: 1.25rem;
  color: var(--text-secondary);
  margin-top: var(--space-md);
}

.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--space-xl);
  margin-bottom: var(--space-3xl);
}

.note-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  transition: all var(--transition-normal);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  position: relative;
  overflow: hidden;
}

.note-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-primary);
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.note-card:hover {
  transform: translateY(-8px);
  border-color: rgba(0, 217, 255, 0.4);
  box-shadow: var(--shadow-xl), 0 0 30px rgba(0, 217, 255, 0.15);
}

.note-card:hover::before {
  opacity: 1;
}

.note-card__header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.note-icon {
  font-size: 2.5rem;
  line-height: 1;
  flex-shrink: 0;
}

.note-card__header h3 {
  margin: 0 0 var(--space-xs) 0;
  color: var(--text);
  font-size: 1.25rem;
}

.note-badge {
  display: inline-block;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.note-badge--template {
  background: rgba(255, 217, 61, 0.2);
  color: var(--warning);
  border: 1px solid rgba(255, 217, 61, 0.3);
}

.note-badge--tech {
  background: rgba(0, 217, 255, 0.2);
  color: var(--primary);
  border: 1px solid rgba(0, 217, 255, 0.3);
}

.note-badge--data {
  background: rgba(81, 207, 102, 0.2);
  color: var(--success);
  border: 1px solid rgba(81, 207, 102, 0.3);
}

.note-card__description {
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: var(--space-lg);
}

.note-card__meta {
  margin-bottom: var(--space-lg);
}

.note-meta__item {
  color: var(--text-muted);
  font-size: 0.875rem;
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
}

.note-card__actions {
  margin-top: auto;
}

.notes-info {
  margin-bottom: var(--space-3xl);
}

.notes-info h2 {
  text-align: center;
  margin-bottom: var(--space-xl);
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--space-xl);
}

.info-item {
  text-align: center;
  padding: var(--space-lg);
  background: rgba(0, 217, 255, 0.05);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(0, 217, 255, 0.1);
}

.info-icon {
  font-size: 2rem;
  margin-bottom: var(--space-md);
}

.info-item h4 {
  color: var(--primary);
  margin-bottom: var(--space-sm);
}

.info-item p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin: 0;
}

.notes-stats {
  display: flex;
  justify-content: center;
  gap: var(--space-3xl);
  margin-bottom: var(--space-3xl);
}

.stats-item {
  text-align: center;
}

.stats-item h3 {
  font-size: 2.5rem;
  color: var(--primary);
  margin-bottom: var(--space-xs);
}

.stats-item p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0;
}

@media (max-width: 768px) {
  .notes-grid {
    grid-template-columns: 1fr;
    gap: var(--space-lg);
  }
  
  .info-grid {
    grid-template-columns: 1fr;
    gap: var(--space-lg);
  }
  
  .notes-stats {
    gap: var(--space-xl);
  }
  
  .stats-item h3 {
    font-size: 2rem;
  }
}

/* Utility Classes */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }

.hidden { display: none; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.gradient-text {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
}

/* Loading States */
.loading {
  position: relative;
  overflow: hidden;
}

.loading::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% { left: -100%; }
  100% { left: 100%; }
}

/* Focus States for Better Accessibility */
.focus-ring {
  transition: box-shadow var(--transition-fast);
}

.focus-ring:focus {
  outline: none;
  box-shadow: 
    0 0 0 2px var(--background),
    0 0 0 4px var(--primary);
}

/* Dark Mode Toggle (if needed) */
.theme-toggle {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-full);
  padding: var(--space-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle:hover {
  background: var(--surface-elevated);
  transform: rotate(180deg);
}

/* Custom Scrollbar for WebKit */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border) var(--background-secondary);
}

/* Improved focus indicators */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}

/* Print Styles */
@media print {
  .navbar,
  .mobile-menu,
  .floating-shapes,
  .hero::before,
  .hero::after {
    display: none !important;
  }
  
  body {
    background: white !important;
    color: black !important;
  }
  
  .card {
    border: 1px solid #ccc !important;
    background: white !important;
  }
}

.gpu-accelerated {
  transform: translateZ(0);
}

/* Notes Page Header */
.notes-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-xl);
  flex-wrap: wrap;
  gap: var(--space-md);
}

.notes-header .back-link {
  margin-bottom: 0; /* Override default margin */
}

/* Contact section styles */
.contact-card-container {
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
}

.contact-method {
  display: flex;
  align-items: center;
  padding: var(--space-md);
  transition: transform 0.2s ease, background-color 0.2s ease;
  border-radius: var(--radius-md);
}

.contact-method:hover {
  background-color: var(--surface-alt);
  transform: translateX(5px);
}

.contact-icon-container {
  background: rgba(88, 166, 255, 0.1);
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: var(--space-lg);
  transition: all 0.3s ease;
}

.contact-method:hover .contact-icon-container {
  background: var(--primary);
}

.contact-icon {
  font-size: 1.75rem;
  color: var(--primary);
  transition: all 0.3s ease;
}

.contact-method:hover .contact-icon {
  color: white;
  transform: scale(1.1);
}

.contact-details {
  flex: 1;
}

.contact-details h4 {
  margin-bottom: var(--space-xs);
  font-size: 1.1rem;
  color: var(--text);
}

.contact-link {
  font-size: 1rem;
  font-weight: 500;
  display: block;
  margin-bottom: var(--space-xs);
}

.contact-description {
  color: var(--text-light);
  font-size: 0.9rem;
  margin: 0;
}

@media (max-width: 576px) {
  .contact-method {
    flex-direction: column;
    text-align: center;
    padding: var(--space-lg) var(--space-md);
  }
  
  .contact-icon-container {
    margin-right: 0;
    margin-bottom: var(--space-md);
  }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Focus styles for keyboard navigation */
*:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Loading states */
.loading {
  opacity: 0.6;
  pointer-events: none;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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