/* ===========================================
   EDOARDO CASALI - MAIN STYLES
   Professional Musician Portfolio
   Inspired by: H.E.R., Adele, Benjamin Righetti
   =========================================== */

/* ============ CSS VARIABLES ============ */
:root {
  /* Colors - Refined dark cinematic palette */
  --color-primary: #0a0a0a;
  --color-secondary: #1a1a1a;
  --color-background: #fafafa;
  --color-background-alt: #f5f5f5;
  --color-accent: #c9a227;
  --color-accent-hover: #b8922a;
  --color-text: #2d2d2d;
  --color-text-light: #6b6b6b;
  --color-text-muted: #9a9a9a;
  --color-white: #ffffff;
  --color-border: #e8e8e8;
  --color-border-light: #f0f0f0;

  /* Typography */
  --font-heading: 'Playfair Display', Georgia, serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-size-base: 16px;
  --line-height-base: 1.7;

  /* Spacing */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 2rem;
  --spacing-xl: 3rem;
  --spacing-xxl: 6rem;
  --spacing-xxxl: 8rem;

  /* Transitions */
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);

  /* Shadows - Subtle and refined */
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.1);
  --shadow-xl: 0 16px 48px rgba(0,0,0,0.12);

  /* Border radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Header height */
  --header-height: 72px;
}

/* ============ RESET & BASE ============ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: var(--font-size-base);
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: var(--line-height-base);
  color: var(--color-text);
  background-color: var(--color-background);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

::selection {
  background-color: var(--color-accent);
  color: var(--color-white);
}

/* ============ TYPOGRAPHY ============ */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 500;
  line-height: 1.2;
  color: var(--color-primary);
  margin-bottom: var(--spacing-md);
  letter-spacing: -0.02em;
}

h1 {
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 400;
}

h2 {
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  font-weight: 400;
}

h3 {
  font-size: clamp(1.25rem, 2vw, 1.5rem);
}

h4 {
  font-size: 1.125rem;
  font-family: var(--font-body);
  font-weight: 600;
}

p {
  margin-bottom: var(--spacing-md);
}

p:last-child {
  margin-bottom: 0;
}

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}

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

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ============ LAYOUT ============ */
.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--spacing-lg);
}

.container-narrow {
  max-width: 800px;
}

.section {
  padding: var(--spacing-xxxl) 0;
}

.section-alt {
  background-color: var(--color-background-alt);
}

.section-dark {
  background-color: var(--color-primary);
  color: var(--color-white);
}

.section-title {
  text-align: center;
  margin-bottom: var(--spacing-xxl);
  position: relative;
}

.section-title::after {
  content: '';
  display: block;
  width: 40px;
  height: 2px;
  background-color: var(--color-accent);
  margin: var(--spacing-lg) auto 0;
}

.section-subtitle {
  text-align: center;
  color: var(--color-text-light);
  font-size: 1.125rem;
  max-width: 600px;
  margin: calc(var(--spacing-lg) * -1) auto var(--spacing-xxl);
}

/* ============ HEADER - REFINED ============ */
.header {
  background-color: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: var(--header-height);
  border-bottom: 1px solid var(--color-border-light);
}

.header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--spacing-xl);
  gap: var(--spacing-xl);
}

.logo {
  font-family: var(--font-heading);
  font-size: 1.375rem;
  font-weight: 500;
  color: var(--color-primary);
  text-decoration: none;
  letter-spacing: -0.01em;
  white-space: nowrap;
  transition: opacity var(--transition-fast);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  height: 100%;
}

.logo:hover {
  opacity: 0.7;
  color: var(--color-primary);
}

/* Navigation - Centered with proper spacing */
.nav {
  display: none;
  flex: 1;
  justify-content: center;
  align-items: center;
  height: 100%;
}

.nav-list {
  display: flex;
  list-style: none;
  gap: clamp(0, 0.3vw, var(--spacing-sm));
  align-items: center;
  height: 100%;
  margin: 0;
  padding: 0;
}

.nav-link {
  font-size: clamp(0.625rem, 0.9vw, 0.8125rem);
  font-weight: 500;
  color: var(--color-text-light);
  text-transform: uppercase;
  letter-spacing: clamp(0.02em, 0.08vw, 0.1em);
  padding: var(--spacing-sm) clamp(0.375rem, 0.8vw, 1rem);
  position: relative;
  transition: color var(--transition-fast);
  display: flex;
  align-items: center;
  height: 100%;
  white-space: nowrap;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 1px;
  background-color: var(--color-accent);
  transition: width var(--transition-normal);
}

.nav-link:hover,
.nav-link.active {
  color: var(--color-primary);
}

.nav-link:hover::after,
.nav-link.active::after {
  width: calc(100% - var(--spacing-lg));
}

/* Language Selector - Refined */
.lang-selector {
  position: relative;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  height: 100%;
}

.lang-btn {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  background: transparent;
  border: none;
  padding: var(--spacing-sm) var(--spacing-md);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text-light);
  cursor: pointer;
  transition: color var(--transition-fast);
  letter-spacing: 0.05em;
}

.lang-btn:hover {
  color: var(--color-primary);
}

.lang-btn i {
  font-size: 0.625rem;
  transition: transform var(--transition-fast);
}

.lang-selector:hover .lang-btn i {
  transform: rotate(180deg);
}

/* Flag icons using CSS */
.flag {
  display: inline-block;
  width: 20px;
  height: 14px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  border-radius: 2px;
  flex-shrink: 0;
  box-shadow: 0 0 1px rgba(0,0,0,0.2);
}

.flag-it {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 3 2'%3E%3Crect fill='%23009246' width='1' height='2'/%3E%3Crect fill='%23fff' x='1' width='1' height='2'/%3E%3Crect fill='%23ce2b37' x='2' width='1' height='2'/%3E%3C/svg%3E");
}

.flag-en {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 30'%3E%3CclipPath id='a'%3E%3Cpath d='M0 0v30h60V0z'/%3E%3C/clipPath%3E%3CclipPath id='b'%3E%3Cpath d='M30 15h30v15zv15H0zH0V0zV0h30z'/%3E%3C/clipPath%3E%3Cg clip-path='url(%23a)'%3E%3Cpath d='M0 0v30h60V0z' fill='%23012169'/%3E%3Cpath d='M0 0l60 30m0-30L0 30' stroke='%23fff' stroke-width='6'/%3E%3Cpath d='M0 0l60 30m0-30L0 30' clip-path='url(%23b)' stroke='%23C8102E' stroke-width='4'/%3E%3Cpath d='M30 0v30M0 15h60' stroke='%23fff' stroke-width='10'/%3E%3Cpath d='M30 0v30M0 15h60' stroke='%23C8102E' stroke-width='6'/%3E%3C/g%3E%3C/svg%3E");
}

.flag-de {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 5 3'%3E%3Crect fill='%23000' width='5' height='1'/%3E%3Crect fill='%23D00' y='1' width='5' height='1'/%3E%3Crect fill='%23FFCE00' y='2' width='5' height='1'/%3E%3C/svg%3E");
}

.lang-dropdown {
  position: absolute;
  top: calc(100% + var(--spacing-sm));
  right: 0;
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 160px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all var(--transition-fast);
  z-index: 100;
  overflow: hidden;
}

.lang-dropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.lang-option {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-md) var(--spacing-lg);
  color: var(--color-text);
  font-size: 0.875rem;
  transition: background var(--transition-fast);
}

.lang-option:hover {
  background-color: var(--color-background-alt);
  color: var(--color-primary);
}

/* Mobile Menu Toggle */
.menu-toggle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--spacing-sm);
  width: 40px;
  height: 40px;
}

.menu-toggle span {
  display: block;
  width: 22px;
  height: 1.5px;
  background-color: var(--color-primary);
  transition: all var(--transition-fast);
  transform-origin: center;
}

.menu-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.menu-toggle.active span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}

.menu-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* Mobile Navigation */
.mobile-nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  height: 100dvh; /* Dynamic viewport height for mobile browsers */
  background-color: var(--color-white);
  z-index: 999;
  padding: calc(var(--header-height) + var(--spacing-md)) var(--spacing-lg) var(--spacing-lg);
  transform: translateX(-100%);
  transition: transform var(--transition-normal);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

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

.mobile-nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.mobile-nav-link {
  display: block;
  padding: 0.875rem 0;
  font-size: 1.25rem;
  font-family: var(--font-heading);
  font-weight: 400;
  color: var(--color-text);
  border-bottom: 1px solid var(--color-border-light);
  transition: color var(--transition-fast);
}

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

/* Body padding for fixed header */
body {
  padding-top: var(--header-height);
}

/* ============ HERO - CINEMATIC FULLSCREEN ============ */
.hero {
  min-height: calc(100vh - var(--header-height));
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--color-white);
  position: relative;
  overflow: hidden;
  background-color: var(--color-primary);
}

/* Background Container - Full Coverage */
.hero-background-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

/* Profile Image as Background */
.hero-bg-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.hero-bg-image.hidden {
  opacity: 0;
  visibility: hidden;
  position: absolute;
}

/* Dynamic Fallback - Full Screen - Always present, hidden when image loads */
.hero-bg-fallback {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 30%, #16213e 60%, #0f0f1a 100%);
  overflow: hidden;
}

.hero-bg-fallback.hidden {
  display: none;
}

/* Dark Overlay for readability */
.hero-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.3) 0%,
    rgba(0, 0, 0, 0.5) 50%,
    rgba(0, 0, 0, 0.7) 100%
  );
  z-index: 1;
}

/* Content Container */
.hero-content {
  position: relative;
  z-index: 2;
  padding: var(--spacing-lg);
  max-width: 900px;
  width: 100%;
}

/* Frosted Glass Box */
.hero-glass-box {
  background: rgba(10, 10, 10, 0.6);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  padding: var(--spacing-xl) var(--spacing-lg);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.hero-title {
  font-size: clamp(2.5rem, 8vw, 5rem);
  color: var(--color-white);
  margin-bottom: var(--spacing-sm);
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 1;
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.5);
}

.hero-subtitle {
  font-size: clamp(0.875rem, 2vw, 1.125rem);
  font-weight: 300;
  color: var(--color-accent);
  margin-bottom: var(--spacing-lg);
  letter-spacing: 0.25em;
  text-transform: uppercase;
}

.hero-description {
  font-size: clamp(0.9rem, 1.5vw, 1.0625rem);
  color: rgba(255, 255, 255, 0.85);
  max-width: 550px;
  margin: 0 auto var(--spacing-lg);
  line-height: 1.8;
}

/* Dynamic Orbs Animation - Full Screen */
.dynamic-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.6;
  animation: orbFloat 15s ease-in-out infinite;
  will-change: transform;
}

.orb-1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, var(--color-accent) 0%, rgba(201, 162, 39, 0.3) 70%);
  top: -15%;
  left: -10%;
  animation-delay: 0s;
  animation-duration: 18s;
}

.orb-2 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(100, 120, 180, 0.5) 0%, rgba(60, 80, 140, 0.2) 70%);
  top: 20%;
  right: -10%;
  animation-delay: -4s;
  animation-duration: 20s;
}

.orb-3 {
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, rgba(201, 162, 39, 0.5) 0%, rgba(180, 140, 30, 0.15) 70%);
  bottom: -20%;
  left: 15%;
  animation-delay: -8s;
  animation-duration: 22s;
  opacity: 0.4;
}

.orb-4 {
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.15) 0%, rgba(200, 200, 220, 0.05) 70%);
  top: 50%;
  left: 50%;
  animation-delay: -12s;
  animation-duration: 16s;
}

.orb-5 {
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, rgba(201, 162, 39, 0.35) 0%, rgba(160, 130, 40, 0.1) 70%);
  top: 5%;
  right: 20%;
  animation-delay: -6s;
  animation-duration: 19s;
}

/* Additional decorative elements for fallback */
.hero-bg-fallback::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% 40%, rgba(201, 162, 39, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse 60% 40% at 80% 60%, rgba(100, 120, 180, 0.06) 0%, transparent 50%);
  pointer-events: none;
}

.hero-bg-fallback::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.3) 100%);
  pointer-events: none;
}

@keyframes orbFloat {
  0%, 100% {
    transform: translate(0, 0) scale(1);
  }
  20% {
    transform: translate(30px, -40px) scale(1.08);
  }
  40% {
    transform: translate(-25px, 30px) scale(0.95);
  }
  60% {
    transform: translate(40px, 20px) scale(1.05);
  }
  80% {
    transform: translate(-35px, -25px) scale(0.98);
  }
}

/* ============ FOOTER - ELEGANT ============ */
.footer {
  background-color: var(--color-primary);
  color: var(--color-white);
  padding: var(--spacing-xl) 0;
  margin-top: auto;
}

.footer > .container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
}

.footer-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-md);
  text-align: center;
  width: 100%;
}

.footer-logo {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--color-white);
  letter-spacing: -0.01em;
}

.footer-social {
  display: flex;
  gap: var(--spacing-md);
  justify-content: center;
}

.footer-social a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 50%;
  color: var(--color-white);
  font-size: 1rem;
  transition: all var(--transition-normal);
}

.footer-social a:hover {
  background-color: var(--color-accent);
  border-color: var(--color-accent);
  transform: translateY(-2px);
}

.footer-copyright {
  font-size: 0.8125rem;
  color: rgba(255,255,255,0.4);
  letter-spacing: 0.02em;
}

/* ============ UTILITIES ============ */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

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

.mb-0 { margin-bottom: 0; }
.mb-sm { margin-bottom: var(--spacing-sm); }
.mb-md { margin-bottom: var(--spacing-md); }
.mb-lg { margin-bottom: var(--spacing-lg); }
.mb-xl { margin-bottom: var(--spacing-xl); }

.mt-0 { margin-top: 0; }
.mt-sm { margin-top: var(--spacing-sm); }
.mt-md { margin-top: var(--spacing-md); }
.mt-lg { margin-top: var(--spacing-lg); }
.mt-xl { margin-top: var(--spacing-xl); }

/* Fade in animation */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade-in {
  animation: fadeInUp 0.6s ease-out forwards;
}

.animate-delay-1 { animation-delay: 0.1s; }
.animate-delay-2 { animation-delay: 0.2s; }
.animate-delay-3 { animation-delay: 0.3s; }
.animate-delay-4 { animation-delay: 0.4s; }
