:root {
  --bg-main: #0f0f0f;
  --bg-section: #1c1c1c;
  --bg-section-alt: #141414;
  --text-main: #eee;
  --text-secondary: #aaa;
  --accent: #66ccff;
  --btn-bg: #007acc;
  --btn-hover: #005fa3;
  --font-main: 'Poppins', sans-serif;
  --separator-color: #333;
  
  /* Golden color palette */
  --gold-primary: #d4af37;
  --gold-secondary: #b8941f;
  --gold-light: #f4e99b;
  --gold-dark: #a67c00;
  --gold-glow: rgba(212, 175, 55, 0.3);
}

[data-theme="light"] {
  --bg-main: #ffffff;
  --bg-section: #f8f8f8;
  --bg-section-alt: #f0f0f0;
  --text-main: #111;
  --text-secondary: #555;
  --accent: #005fa3;
  --btn-bg: #005fa3;
  --btn-hover: #003f7d;
  --separator-color: #ddd;
  
  /* Golden colors adjusted for light theme */
  --gold-primary: #b8941f;
  --gold-secondary: #d4af37;
  --gold-light: #8b7355;
  --gold-dark: #9d8502;
  --gold-glow: rgba(184, 148, 31, 0.25);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  font-family: var(--font-main);
  background-color: var(--bg-main);
  color: var(--text-main);
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.03), transparent 70%),
              radial-gradient(circle at 70% 70%, rgba(255,255,255,0.03), transparent 70%);
  animation: moveBg 15s infinite linear;
  z-index: -1;
}

@keyframes moveBg {
  0% { background-position: 30% 30%, 70% 70%; }
  100% { background-position: 60% 40%, 40% 60%; }
}

nav {
  position: fixed;
  top: 50%;
  right: 2rem;
  transform: translateY(-50%);
  background-color: var(--bg-section);
  padding: 1.5rem 1rem;
  z-index: 1000;
  border-radius: 15px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: center;
  border: 2px solid transparent;
  background-image: linear-gradient(var(--bg-section), var(--bg-section)), 
                    linear-gradient(180deg, transparent, var(--gold-primary), var(--gold-light), var(--gold-primary), transparent);
  background-origin: border-box;
  background-clip: padding-box, border-box;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
}

.icon-link, nav button {
  all: unset;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  color: var(--text-secondary);
  transition: all 0.3s ease;
  border-radius: 12px;
  position: relative;
  overflow: hidden;
}

.icon-link:hover, nav button:hover { 
  color: var(--gold-primary);
  background-color: var(--gold-glow);
  transform: translateY(-1px);
}

.icon-link.active, nav button.active {
  color: var(--gold-primary);
  background-color: var(--gold-glow);
  box-shadow: 0 0 12px var(--gold-glow);
}

.icon-link.active::before, nav button.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, transparent, var(--gold-primary), transparent);
  animation: shimmer 2s ease-in-out infinite;
}

@keyframes shimmer {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

.icon-link svg, nav button svg {
  fill: currentColor;
  width: 22px;
  height: 22px;
  transition: transform 0.3s ease;
}

.icon-link:hover svg, nav button:hover svg,
.icon-link.active svg, nav button.active svg {
  transform: scale(1.1);
}

.flag-icon {
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease;
}

.icon-link:hover .flag-icon, nav button:hover .flag-icon {
  transform: scale(1.1);
}

/* Ensure flag displays properly on both desktop and mobile */
#language-toggle .flag-icon {
  font-size: 18px;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Emoji", Arial, sans-serif;
  font-style: normal;
  font-weight: normal;
}

.icon-link:hover .flag-icon, nav button:hover .flag-icon,
.icon-link.active .flag-icon, nav button.active .flag-icon {
  transform: scale(1.1);
}

/* Prevent theme and language buttons from getting golden active states but allow functionality */
#theme-toggle:hover, #language-toggle:hover {
  color: var(--text-main);
  background-color: transparent;
  box-shadow: none;
  transform: translateY(-1px);
}

#theme-toggle.active, #language-toggle.active,
#theme-toggle:active, #language-toggle:active {
  color: var(--text-secondary);
  background-color: transparent;
  box-shadow: none;
  transform: none;
}

#theme-toggle.active::before, #language-toggle.active::before,
#theme-toggle:active::before, #language-toggle:active::before {
  display: none;
}

header {
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 2rem;
  background-color: var(--bg-main);
  position: relative;
}

#animated-title {
  font-size: 4rem;
  font-weight: 700;
  letter-spacing: 2.5px;
  line-height: 1.05;
  margin-bottom: 1.2rem;
  transition: transform 0.15s cubic-bezier(.77,0,.18,1);
  will-change: transform;
  
  /* Golden gradient text with stronger contrast - same as working version */
  background: linear-gradient(90deg, 
    var(--gold-dark) 0%, 
    var(--gold-secondary) 30%, 
    var(--gold-light) 50%, 
    var(--gold-secondary) 70%, 
    var(--gold-dark) 100%);
  background-size: 100% 100%;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

#animated-subtitle {
  font-size: 1.8rem;
  font-weight: 400;
  color: var(--text-secondary);
  margin-top: 0.8rem;
  transition: transform 0.15s cubic-bezier(.77,0,.18,1);
  will-change: transform;
}

.section-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  color: var(--text-main);
  position: relative;
}

/* Alternating section backgrounds */
#about {
  background-color: var(--bg-section);
}
#about-this {
  background-color: var(--bg-section-alt);
}
#contact {
  background-color: var(--bg-section);
}

/* Enhanced golden gradient separators */
.section-page::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, 
    transparent 0%, 
    var(--gold-dark) 20%, 
    var(--gold-primary) 35%, 
    var(--gold-light) 50%, 
    var(--gold-primary) 65%, 
    var(--gold-dark) 80%, 
    transparent 100%);
  z-index: 10;
  animation: goldShimmer 4s ease-in-out infinite;
}

@keyframes goldShimmer {
  0%, 100% { 
    opacity: 0.6; 
    transform: scaleX(0.8);
  }
  50% { 
    opacity: 1; 
    transform: scaleX(1);
  }
}

/* Add separator after header too */
header::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, 
    transparent 0%, 
    var(--gold-dark) 20%, 
    var(--gold-primary) 35%, 
    var(--gold-light) 50%, 
    var(--gold-primary) 65%, 
    var(--gold-dark) 80%, 
    transparent 100%);
  z-index: 10;
  animation: goldShimmer 4s ease-in-out infinite;
}

.section-header {
  padding: 4rem 2rem 2rem;
  text-align: center;
}

.section-content {
  flex: 1;
  padding: 2rem;
  max-width: 800px;
  margin: 0 auto;
  animation: fadeInUp 1.5s ease-out;
}

h2 {
  font-size: 2rem;
  margin-bottom: 1rem;
  color: var(--text-main);
  position: relative;
}

/* Updated: Static golden gradient for section titles when in view */
.section-header.in-view h2 {
  /* Static golden gradient background - similar to main title but simpler */
  background: linear-gradient(90deg, 
    var(--gold-dark) 0%, 
    var(--gold-secondary) 30%, 
    var(--gold-light) 50%, 
    var(--gold-secondary) 70%, 
    var(--gold-dark) 100%);
  background-size: 100% 100%;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  
  /* Keep the glow effect */
  text-shadow: 0 0 20px var(--gold-glow);
  transition: all 0.6s ease;
}

p {
  margin-bottom: 1.2rem;
  line-height: 1.6;
}

a { 
  color: var(--accent);
  transition: color 0.3s ease;
}

a:hover {
  color: var(--gold-primary);
}

form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}

input, textarea {
  padding: 0.75rem;
  border: 2px solid transparent;
  border-radius: 8px;
  font-size: 1rem;
  font-family: var(--font-main);
  width: 100%;
  background-color: var(--bg-section-alt);
  color: var(--text-main);
  transition: all 0.3s ease;
}

input:focus, textarea:focus {
  outline: none;
  border-color: var(--gold-primary);
  box-shadow: 0 0 0 3px var(--gold-glow);
}

button[type="submit"] {
  padding: 0.75rem;
  background: linear-gradient(135deg, var(--gold-primary), var(--gold-secondary));
  color: var(--bg-main);
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

button[type="submit"]:hover {
  background: linear-gradient(135deg, var(--gold-secondary), var(--gold-dark));
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--gold-glow);
}

button[type="submit"]::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  transition: left 0.5s ease;
}

button[type="submit"]:hover::before {
  left: 100%;
}

.message {
  margin-top: 1rem;
  font-size: 0.95rem;
  padding: 0.5rem;
  border-radius: 4px;
  text-align: center;
}

.message.success {
  background-color: rgba(76, 175, 80, 0.1);
  color: #4caf50;
  border: 1px solid rgba(76, 175, 80, 0.3);
}

.message.error {
  background-color: rgba(244, 67, 54, 0.1);
  color: #f44336;
  border: 1px solid rgba(244, 67, 54, 0.3);
}

footer {
  text-align: center;
  padding: 2rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
  background-color: var(--bg-section-alt);
  position: relative;
}

footer::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-primary), transparent);
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(30px);}
  to { opacity: 1; transform: translateY(0);}
}

#home-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: linear-gradient(135deg, var(--gold-primary), var(--gold-secondary));
  color: var(--bg-main);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1001;
  box-shadow: 0 4px 20px var(--gold-glow);
  transition: all 0.3s ease;
  border: 2px solid var(--gold-primary);
}

#home-btn:hover {
  transform: scale(1.1) translateY(-2px);
  box-shadow: 0 6px 25px var(--gold-glow);
  background: linear-gradient(135deg, var(--gold-secondary), var(--gold-dark));
}

#home-btn svg {
  fill: currentColor;
  width: 20px;
  height: 20px;
  transition: transform 0.3s ease;
}

#home-btn:hover svg {
  transform: scale(1.1);
}

@media (max-width: 768px) {
  nav { 
    top: 0;
    left: 0;
    right: 0;
    transform: none;
    width: 100%;
    padding: 1rem 2rem; 
    gap: 20px;
    border-radius: 0;
    flex-direction: row;
    justify-content: space-evenly;
    background-image: linear-gradient(var(--bg-section), var(--bg-section)), 
                      linear-gradient(90deg, transparent, var(--gold-primary), transparent);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  }
  
  /* Add top padding to body to account for fixed nav */
  body {
    padding-top: 80px;
  }
  
  /* Ensure all sections start below the nav */
  .section-page {
    padding-top: 0;
  }
  
  .section-header {
    padding-top: 2rem;
  }
  
  .icon-link, nav button {
    width: 40px;
    height: 40px;
    border-radius: 10px;
  }
  
  .icon-link svg, nav button svg {
    width: 20px;
    height: 20px;
  }
  
  /* Smaller flag on mobile */
  .flag-icon {
    font-size: 18px;
  }
  
  .icon-link.active::before, nav button.active::before {
    left: 0;
    right: 0;
    top: auto;
    bottom: 0;
    width: auto;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--gold-primary), transparent);
  }
  
  /* Ensure theme and language buttons NEVER get golden active styles on mobile */
  #theme-toggle:hover, #language-toggle:hover {
    color: var(--text-main);
    background-color: transparent;
    box-shadow: none;
    transform: translateY(-1px);
  }
  
  #theme-toggle.active, #language-toggle.active,
  #theme-toggle:active, #language-toggle:active {
    color: var(--text-secondary);
    background-color: transparent;
    box-shadow: none;
    transform: none;
  }
  
  #theme-toggle.active::before, #language-toggle.active::before,
  #theme-toggle:active::before, #language-toggle:active::before {
    display: none;
  }
  
  /* Adjust header height on mobile to account for nav */
  header {
    height: calc(100vh - 80px);
    padding-top: 0;
  }
  
  #animated-title { font-size: 2.2rem;}
  #animated-subtitle { font-size: 1rem;}

  #home-btn {
    display: none; /* Hide on mobile since nav is always visible */
  }

  /* Mobile-friendly table with horizontal scroll */
  .section-content table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    font-size: 0.75rem;
    margin: 1rem auto;
    width: 100%;
  }

  .section-content table th,
  .section-content table td {
    padding: 0.4rem !important;
    font-size: 0.75rem;
    min-width: 80px;
  }

  /* Adjust section content padding on mobile */
  .section-content {
    padding: 1rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }

  .section-content p {
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
  }

  /* Smaller text on mobile */
  .section-content {
    font-size: 0.95rem;
    line-height: 1.5;
  }

  /* Smaller list margins on mobile */
  .section-content ul {
    margin-left: 0.5rem !important;
    padding-left: 0.8rem !important;
    font-size: 0.9rem;
  }

  .section-content h3 {
    font-size: 1.3rem;
    word-wrap: break-word;
  }

  /* Make section headers more compact */
  .section-header {
    padding: 2rem 1rem 1rem;
  }

  .section-header h2 {
    font-size: 1.6rem;
    word-wrap: break-word;
  }

  /* Ensure form elements fit on mobile */
  form {
    width: 100%;
  }

  input, textarea, button[type="submit"] {
    font-size: 0.95rem;
    width: 100%;
  }
}