:root {
  --bg-color: #e5e5e7; /* Silver Metallic Base */
  --text-color: #1d1d1f;
  --text-muted: #636366;
  --accent-color: #007aff; /* Apple App Store Blue */
  --nav-bg: rgba(229, 229, 231, 0.72);
  --card-bg: rgba(255, 255, 255, 0.45);
  --glass-border: rgba(255, 255, 255, 0.6);
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --section-padding: 80px 20px;
  --container-width: 1200px;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

body.dark-mode {
  --bg-color: #0a0a0b; /* Deep Obsidian Base */
  --text-color: #f5f5f7;
  --text-muted: #98989d;
  --accent-color: #0a84ff; /* Apple App Store Blue (Dark Mode version) */
  --nav-bg: rgba(10, 10, 11, 0.85);
  --card-bg: rgba(28, 28, 30, 0.7);
  --glass-border: rgba(255, 255, 255, 0.08);
}

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

html {
  scroll-behavior: smooth;
}

/* Custom Selection */
::selection {
  background: rgba(0, 122, 255, 0.3);
  color: inherit;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 10px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(142, 142, 147, 0.3);
  border-radius: 10px;
  border: 2px solid var(--bg-color);
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(142, 142, 147, 0.6);
}

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

body {
  font-family: var(--font-main);
  background-color: var(--bg-color);
  background-image: 
    linear-gradient(135deg, #d1d1d6 0%, #e5e5e7 50%, #f2f2f7 100%);
  background-attachment: fixed;
  background-size: 200% 200%;
  animation: bg-animate 30s ease-in-out infinite alternate;
  color: var(--text-color);
  line-height: 1.47059;
  font-weight: 400;
  letter-spacing: -0.022em;
  overflow-x: hidden;
}

body.dark-mode {
  background-color: #0a0a0b !important;
  background-image: 
    radial-gradient(at 0% 0%, hsla(240, 5%, 15%, 1) 0, transparent 50%),
    radial-gradient(at 100% 0%, hsla(240, 5%, 10%, 1) 0, transparent 50%),
    linear-gradient(135deg, #0a0a0b 0%, #121214 100%) !important;
  background-size: 200% 200% !important;
}

@keyframes bg-animate {
  0% {
    background-position: 0% 0%;
  }

  100% {
    background-position: 100% 100%;
  }
}

.cursor-light {
  position: fixed;
  top: 0;
  left: 0;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(142, 142, 147, 0.12) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
  z-index: 1;
  transition: opacity 0.3s ease;
  mix-blend-mode: screen;
  display: none;
}

body.dark-mode .cursor-light {
  background: radial-gradient(circle, rgba(209, 209, 214, 0.08) 0%, transparent 70%);
  display: block;
}

/* Typography */
h1,
h2,
h3 {
  font-weight: 600;
  letter-spacing: -0.015em;
}

.hero-title {
  font-size: clamp(48px, 8vw, 96px);
  line-height: 1.2;
  margin-bottom: 24px;
  background: linear-gradient(180deg, var(--text-color) 0%, #636366 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  padding-bottom: 0.1em;
  animation: reveal 1.2s var(--ease) forwards;
}

.name-reveal {
  clip-path: polygon(0 0, 0 0, 0 100%, 0% 100%);
  animation: clip-reveal 1.8s var(--ease) forwards;
  animation-delay: 0.1s;
}

@keyframes clip-reveal {
  to { clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%); }
}

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

@keyframes reveal-subtitle {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero-subtitle {
  font-size: 24px;
  color: var(--text-muted);
  margin-bottom: 40px;
  opacity: 0;
  animation: reveal-subtitle 1.5s var(--ease) forwards;
  animation-delay: 0.2s;
}

.hero-cta {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin-top: 40px;
  opacity: 0;
  animation: reveal 1.2s var(--ease) forwards;
  animation-delay: 0.4s;
}

.section-title {
  font-size: clamp(32px, 5vw, 48px);
  line-height: 1.1;
  margin-bottom: 72px;
  text-align: center;
}

/* Navigation */
nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  height: 44px;
  background: var(--nav-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 1000;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  display: flex;
  justify-content: center;
  align-items: center;
}

.nav-content {
  width: 100%;
  max-width: var(--container-width);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  margin: 0 auto;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
}

.logo {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

@keyframes btn-shine {
  0% { left: -100%; }
  20% { left: 150%; }
  100% { left: 150%; }
}

.donate-btn {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--accent-color);
  color: white;
  padding: 4px 12px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.3s var(--ease);
  position: relative;
  overflow: hidden;
}

.donate-btn::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  transform: skewX(-20deg);
  animation: btn-shine 4s infinite;
}

.donate-btn:hover {
  transform: scale(1.05) translateY(-2px);
  filter: brightness(1.1);
  box-shadow: 0 4px 10px rgba(0, 122, 255, 0.3);
}

.nav-links {
  display: flex;
  gap: 30px;
  align-items: center;
}

.nav-links a {
  text-decoration: none;
  color: var(--text-color);
  font-size: 14px;
  font-weight: 500;
  opacity: 0.8;
  transition: all 0.3s var(--ease);
  position: relative;
}

.nav-links > a::after,
.nav-links > .dropdown > a::after {
  content: '';
  position: absolute;
  width: 0%;
  height: 2px;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--text-color);
  transition: width 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  border-radius: 2px;
}

.nav-links a:hover {
  opacity: 1;
}

.nav-links > a:hover::after,
.nav-links > .dropdown:hover > a::after {
  width: 100%;
}

/* Theme Toggle */
.theme-toggle {
  background: none;
  border: none;
  color: var(--text-color);
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.3s var(--ease);
  opacity: 0.8;
}

.theme-toggle:hover {
  opacity: 1;
  background: rgba(128, 128, 128, 0.1);
  transform: scale(1.1) rotate(15deg);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
  transition: transform 0.5s var(--ease);
  pointer-events: none;
}

.sun-icon {
  display: none;
}

.moon-icon {
  display: block;
}

body.dark-mode .sun-icon {
  display: block;
}

body.dark-mode .moon-icon {
  display: none;
}

body.dark-mode .theme-toggle svg {
  transform: rotate(360deg);
}

/* Dropdown Styles */
.dropdown {
  position: relative;
  display: flex;
  align-items: center;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 50%;
  transform-origin: top center;
  transform: translateX(-50%) translateY(15px) scale(0.95);
  background: var(--nav-bg);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 10px;
  min-width: 180px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s var(--ease), visibility 0.3s var(--ease), transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 1001;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.dropdown:hover .dropdown-menu,
.lang-selector.open .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0) scale(1);
}

.dropdown-menu a {
  padding: 10px 15px;
  border-radius: 10px;
  width: 100%;
  opacity: 1 !important;
  font-size: 13px !important;
}

.dropdown-menu a:hover {
  background: rgba(142, 142, 147, 0.15);
  color: var(--text-color) !important;
}

/* Language Selector */
.lang-selector {
  margin-right: 5px;
}

.lang-btn {
  background: none;
  border: none;
  color: var(--text-color);
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all 0.3s var(--ease);
  opacity: 0.8;
  font-size: 14px;
  font-weight: 700;
  min-width: 40px;
  border: 1px solid transparent;
}

.lang-btn:hover, .lang-selector.open .lang-btn {
  opacity: 1;
  background: rgba(128, 128, 128, 0.1);
  border-color: var(--glass-border);
}

.lang-selector .dropdown-menu {
  display: none;
  pointer-events: auto;
  visibility: visible;
  opacity: 1;
  transform: translateX(-50%) translateY(10px);
}

.lang-selector.open .dropdown-menu {
  display: flex;
}

.lang-dropdown {
  min-width: 140px !important;
}

.lang-dropdown a {
  padding: 10px 16px;
  color: var(--text-color);
  text-decoration: none;
  font-size: 14px;
  transition: all 0.2s var(--ease);
  display: grid !important;
  grid-template-columns: 24px 1px 1fr;
  align-items: center;
  gap: 12px;
}

.lang-dropdown a:hover {
  background: rgba(128, 128, 128, 0.1);
  transform: translateX(4px);
}

.lang-code {
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.05em;
  opacity: 0.8;
  text-align: center;
}

.lang-sep {
  height: 14px;
  width: 1px;
  background: currentColor;
  opacity: 0.2;
}

.lang-name {
  font-weight: 500;
}

.lang-dropdown a.active {
  color: var(--accent-color);
  background: rgba(0, 122, 255, 0.1);
}

.lang-dropdown a.active .lang-sep {
  opacity: 0.4;
}

.lang-dropdown span {
  font-size: 16px;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 60px;
}

.page-link {
  padding: 10px 22px;
  border-radius: 14px;
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  text-decoration: none;
  color: var(--text-color);
  font-weight: 600;
  font-size: 14px;
  transition: all 0.3s var(--ease);
  border: 1px solid var(--glass-border);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.page-link:hover {
  background: var(--text-color);
  color: var(--bg-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.page-link.active {
  background: var(--text-color);
  color: var(--bg-color);
  border-color: var(--text-color);
}

/* Hero Section */
.hero {
  min-height: 45vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 120px 20px 40px;
  background: transparent;
}

.hero-content {
  max-width: 800px;
}

.hero-subtitle {
  font-size: 24px;
  color: var(--text-muted);
  margin-bottom: 40px;
}

/* Sections */
.section {
  padding: var(--section-padding);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.container {
  width: 100%;
  max-width: var(--container-width);
}

/* About Section */
.about-text {
  font-size: 24px;
  line-height: 1.5;
  color: var(--text-muted);
  max-width: 800px;
  margin: 0 auto;
  text-align: center;
}

/* Projects Grid */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 30px;
}

.project-card {
  background: var(--card-bg);
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: 32px;
  padding: 40px;
  min-height: 320px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.8s var(--ease);
  overflow: hidden;
  position: relative;
  box-shadow:
    0 4px 24px -1px rgba(0, 0, 0, 0.05),
    inset 0 0 20px rgba(255, 255, 255, 0.1);
}

.project-card .project-info {
  transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.project-card:hover .project-info {
  transform: translateY(-6px) scale(1.02);
}

body.dark-mode .project-card {
  background: linear-gradient(145deg, rgba(28, 28, 30, 0.8), rgba(10, 10, 11, 0.9));
  box-shadow: 
    0 20px 40px rgba(0, 0, 0, 0.4),
    inset 0 0 1px rgba(255, 255, 255, 0.05);
}



@keyframes liquid-morph {
  0% { 
    border-radius: 32px; 
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.04), 0 0 15px rgba(0, 122, 255, 0.4), 0 0 5px rgba(0, 122, 255, 0.2), inset 0 0 15px rgba(0, 122, 255, 0.08); 
  }
  33% { 
    border-radius: 36px 28px 34px 30px; 
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.05), 0 0 20px rgba(0, 122, 255, 0.5), 0 0 8px rgba(0, 122, 255, 0.25), inset 0 0 20px rgba(0, 122, 255, 0.12); 
  }
  66% { 
    border-radius: 28px 36px 30px 34px; 
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.03), 0 0 12px rgba(0, 122, 255, 0.3), 0 0 4px rgba(0, 122, 255, 0.15), inset 0 0 10px rgba(0, 122, 255, 0.05); 
  }
  100% { 
    border-radius: 32px; 
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.04), 0 0 15px rgba(0, 122, 255, 0.4), 0 0 5px rgba(0, 122, 255, 0.2), inset 0 0 15px rgba(0, 122, 255, 0.08); 
  }
}

@keyframes liquid-morph-dark {
  0% { 
    border-radius: 32px; 
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25), 0 0 20px rgba(10, 132, 255, 0.5), 0 0 8px rgba(10, 132, 255, 0.3), inset 0 0 15px rgba(10, 132, 255, 0.15); 
  }
  33% { 
    border-radius: 36px 28px 34px 30px; 
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3), 0 0 25px rgba(10, 132, 255, 0.6), 0 0 12px rgba(10, 132, 255, 0.35), inset 0 0 20px rgba(10, 132, 255, 0.2); 
  }
  66% { 
    border-radius: 28px 36px 30px 34px; 
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2), 0 0 15px rgba(10, 132, 255, 0.4), 0 0 6px rgba(10, 132, 255, 0.25), inset 0 0 10px rgba(10, 132, 255, 0.1); 
  }
  100% { 
    border-radius: 32px; 
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25), 0 0 20px rgba(10, 132, 255, 0.5), 0 0 8px rgba(10, 132, 255, 0.3), inset 0 0 15px rgba(10, 132, 255, 0.15); 
  }
}

.project-card:hover {
  transform: translateY(-12px) scale(1.02);
  background: rgba(255, 255, 255, 0.3);
  border-color: var(--accent-color);
  animation: liquid-morph 4s ease-in-out infinite;
}

body.dark-mode .project-card:hover {
  background: rgba(40, 40, 44, 0.6);
  border-color: var(--accent-color);
  animation: liquid-morph-dark 4s ease-in-out infinite;
}



.project-info h3 {
  font-size: 28px;
  margin-bottom: 10px;
}

.project-info p {
  color: var(--text-muted);
  font-size: 17px;
}

/* Experience List */
.experience-list {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
}

.experience-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 30px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.exp-date {
  font-size: 14px;
  color: var(--text-muted);
  min-width: 120px;
}

.exp-info h3 {
  font-size: 20px;
  margin-bottom: 5px;
}

.exp-info p {
  font-size: 17px;
  color: var(--text-muted);
}

/* Animations */
.fade-in {
  opacity: 0;
  transform: translateY(30px) scale(0.95);
  transition: opacity 1s cubic-bezier(0.2, 0.8, 0.2, 1), transform 1s cubic-bezier(0.2, 0.8, 0.2, 1);
}

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

/* Nuove animazioni (senza sfocature) */
@keyframes pulse-soft {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

.anim-pulse {
  animation: pulse-soft 2.5s infinite ease-in-out;
  display: inline-block;
}

@keyframes gradient-shift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.anim-gradient-text {
  background: linear-gradient(270deg, var(--text-color), var(--text-muted), #8e8e93, var(--text-color));
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gradient-shift 4s ease infinite;
}

/* Staggered Delay Utilities */
.stagger-1 { transition-delay: 0.1s; }
.stagger-2 { transition-delay: 0.2s; }
.stagger-3 { transition-delay: 0.3s; }
.stagger-4 { transition-delay: 0.4s; }



/* Float Animation */
@keyframes float {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
  100% { transform: translateY(0px); }
}

.float-anim {
  animation: float 6s ease-in-out infinite;
}

/* Footer */
footer {
  padding: 80px 20px;
  background: var(--card-bg);
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
}

/* CTA Buttons */
.hero-cta {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin-top: 40px;
}

.btn-primary,
.btn-secondary {
  padding: 12px 24px;
  border-radius: 980px;
  font-size: 17px;
  font-weight: 400;
  text-decoration: none;
  transition: all 0.3s ease;
}

.btn-primary {
  background: linear-gradient(180deg, #4a4a4d 0%, #2c2c2e 100%);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  position: relative;
  overflow: hidden;
}

.btn-primary::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transform: skewX(-20deg);
  transition: left 0.7s var(--ease);
}

body.dark-mode .btn-primary {
  background: linear-gradient(180deg, #d1d1d6 0%, #8e8e93 100%);
  color: #1c1c1e;
}

.btn-primary:hover {
  filter: brightness(1.2);
  transform: scale(1.05);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.btn-primary:hover::before {
  left: 150%;
}

.btn-secondary {
  color: var(--accent-color);
  display: inline-block;
  transition: transform 0.3s var(--ease), opacity 0.3s var(--ease);
}

.btn-secondary:hover {
  text-decoration: underline;
  transform: translateX(6px);
}

/* Skills Grid */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px;
  margin-top: 20px;
}

.skill-item {
  background: var(--card-bg);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 30px;
  transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease), border-color 0.4s var(--ease);
}

.skill-item:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
  border-color: rgba(255, 255, 255, 0.8);
}

body.dark-mode .skill-item:hover {
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.skill-item h3 {
  font-size: 24px;
  margin-bottom: 10px;
}

.skill-item p {
  color: var(--text-muted);
  font-size: 17px;
}

/* Social Links */
.social-links {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin-bottom: 30px;
}

.social-links a {
  text-decoration: none;
  color: var(--text-color);
  font-size: 14px;
  transition: color 0.3s ease;
}

.social-links a svg {
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.social-links a:hover {
  color: var(--accent-color);
}

.social-links a[href*="instagram.com"]:hover {
  background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888, #515BD4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.social-links a[href*="instagram.com"]:hover svg {
  stroke: url(#ig-grad);
}

.social-links a:hover svg {
  transform: translateY(-4px) scale(1.1);
}

.footer-content {
  max-width: var(--container-width);
  margin: 0 auto;
}

/* Responsive Refinements */
@media (max-width: 1024px) {
  :root {
    --section-padding: 80px 20px;
  }
}

/* ── Hamburger Button (mobile only) ── */
.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: var(--text-color);
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  border-radius: 10px;
  transition: background 0.2s ease;
}

.hamburger:hover {
  background: rgba(128, 128, 128, 0.12);
}

.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-color);
  border-radius: 2px;
  transition: all 0.3s var(--ease);
  pointer-events: none;
}

/* ── Mobile Sidebar Overlay ── */
.mobile-nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1998;
  opacity: 0;
  transition: opacity 0.3s ease;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.mobile-nav-overlay.open {
  display: block;
  opacity: 1;
}

.mobile-nav-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: min(80vw, 320px);
  height: 100dvh;
  background: var(--nav-bg);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  border-left: 1px solid var(--glass-border);
  z-index: 1999;
  display: flex;
  flex-direction: column;
  padding: 24px 20px;
  transform: translateX(100%);
  transition: transform 0.35s var(--ease);
  overflow-y: auto;
}

.mobile-nav-panel.open {
  transform: translateX(0);
}

.mobile-nav-close {
  background: none;
  border: none;
  color: var(--text-color);
  cursor: pointer;
  padding: 8px;
  border-radius: 10px;
  align-self: flex-end;
  margin-bottom: 16px;
  transition: background 0.2s ease;
}

.mobile-nav-close:hover {
  background: rgba(128, 128, 128, 0.12);
}

.mobile-nav-panel a {
  text-decoration: none;
  color: var(--text-color);
  font-size: 17px;
  font-weight: 500;
  padding: 14px 10px;
  border-bottom: 1px solid var(--glass-border);
  display: block;
  transition: color 0.2s ease;
}

.mobile-nav-panel a:hover {
  color: var(--accent-color);
}

.mobile-nav-panel .mobile-nav-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-color);
  padding: 20px 10px 8px;
}

.mobile-nav-panel .mobile-lang-selector {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 10px;
}

.mobile-nav-panel .mobile-lang-selector a {
  font-size: 15px;
  padding: 12px 10px;
  border-bottom: none;
  display: grid;
  grid-template-columns: 28px 1px 1fr;
  align-items: center;
  gap: 16px;
}

.mobile-nav-panel .mobile-lang-selector a .lang-sep {
  height: 16px;
}

.mobile-nav-panel .mobile-lang-selector a .lang-code {
  font-size: 12px;
}

.mobile-nav-panel .mobile-theme-toggle {
  margin-top: auto;
  padding-top: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-color);
}

.mobile-nav-panel .mobile-theme-toggle button {
  background: rgba(128, 128, 128, 0.12);
  border: none;
  color: var(--text-color);
  cursor: pointer;
  padding: 10px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s var(--ease);
}

.mobile-nav-panel .mobile-theme-toggle button:hover {
  background: var(--accent-color);
  color: white;
}

@media (max-width: 768px) {
  nav {
    height: 52px;
    padding: 0;
  }

  .nav-content {
    flex-direction: row;
    justify-content: space-between;
    gap: 0;
  }

  .nav-links {
    display: none !important;
  }

  .hamburger {
    display: flex;
  }

  .hero {
    height: auto;
    min-height: 80vh;
    padding: 100px 20px 60px;
  }

  .hero-title {
    font-size: clamp(36px, 12vw, 56px);
    margin-bottom: 16px;
    line-height: 1.1;
  }

  .hero-subtitle {
    font-size: 18px;
    margin-bottom: 30px;
  }

  .section {
    padding: 60px 20px;
  }

  .section-title {
    font-size: 26px;
    margin-bottom: 32px;
  }

  .about-text {
    font-size: 17px;
    line-height: 1.6;
  }

  .projects-grid,
  .skills-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .project-card {
    padding: 24px;
    height: auto;
    min-height: 240px;
    border-radius: 24px;
  }

  .project-info h3 {
    font-size: 22px;
  }

  .hero-cta {
    flex-direction: column;
    width: 100%;
    padding: 0 20px;
    gap: 12px;
  }

  .btn-primary,
  .btn-secondary {
    width: 100%;
    text-align: center;
    padding: 14px 24px;
  }

  /* Fix for R&S Centered Card on Mobile */
  [style*="grid-column: 1 / span 2"] {
    grid-column: auto !important;
    max-width: 100% !important;
  }
}

@media (max-width: 480px) {
  .nav-links {
    gap: 8px;
  }

  .nav-links a {
    font-size: 10px;
  }

  .logo {
    font-size: 12px;
  }

  .donate-btn {
    padding: 3px 8px;
    font-size: 9px;
  }

  .cursor-light {
    display: none;
    /* Hide cursor light on mobile as it's for mouse */
  }
}

/* Dark Mode Variables applied via class */
body.dark-mode {
  --bg-color: #000000;
  --text-color: #f5f5f7;
  --text-muted: #86868b;
  --nav-bg: rgba(0, 0, 0, 0.72);
  --card-bg: rgba(28, 28, 30, 0.7);
  --glass-border: rgba(255, 255, 255, 0.15);
}

/* Base dark mode styles */
body.dark-mode {
  background-color: #000000 !important;
  background-image:
    radial-gradient(at 0% 0%, hsla(210, 30%, 15%, 1) 0, transparent 50%),
    radial-gradient(at 50% 0%, hsla(220, 30%, 10%, 1) 0, transparent 50%),
    radial-gradient(at 100% 0%, hsla(240, 30%, 15%, 1) 0, transparent 50%),
    radial-gradient(at 50% 50%, #000000 0, transparent 100%) !important;
  background-attachment: fixed !important;
  animation: bg-animate-dark 20s infinite alternate linear;
}

body.dark-mode .cursor-light {
  background: radial-gradient(circle, rgba(0, 188, 212, 0.1) 0%, transparent 70%) !important;
}

/* Targeted element dark mode styles */
body.dark-mode .skill-item,
body.dark-mode .experience-item,
body.dark-mode .dropdown-menu,
body.dark-mode .game-row,
body.dark-mode .beta-row,
body.dark-mode .guide-section,
body.dark-mode .modal-box {
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.8) !important;
}

body.dark-mode .project-card {
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.8);
}

/* Secondary elements dark mode */
body.dark-mode .app-logo {
  background: rgba(255, 255, 255, 0.1) !important;
}

body.dark-mode .disclaimer,
body.dark-mode .tip-box {
  background: rgba(0, 188, 212, 0.1) !important;
}

body.dark-mode .modal-overlay {
  background: rgba(0, 0, 0, 0.7) !important;
}

body.dark-mode .modal-box {
  background: #1c1c1e !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
}

@keyframes bg-animate-dark {
  0% {
    background-position: 0% 0%;
  }
}