:root {
  /* Colors - Luxury Industrial Palette */
  --bg-darker: oklch(12% 0.01 260);
  --bg-dark: oklch(16% 0.02 260);
  --accent-gold: oklch(78% 0.12 85);
  --accent-amber: oklch(62% 0.18 45);
  --text-primary: oklch(95% 0.01 260);
  --text-secondary: oklch(75% 0.02 260);
  --text-muted: oklch(50% 0.02 260);
  --border-subtle: oklch(25% 0.02 260);
  --border-bright: oklch(78% 0.12 85 / 0.3);

  /* Spacing Scale */
  --space-xs: clamp(0.5rem, 1vw, 0.75rem);
  --space-sm: clamp(1rem, 2vw, 1.25rem);
  --space-md: clamp(1.5rem, 3vw, 2rem);
  --space-lg: clamp(2.5rem, 5vw, 4rem);
  --space-xl: clamp(4rem, 8vw, 8rem);

  /* Fluid Typography */
  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --text-lg: clamp(1.125rem, 1.05rem + 0.35vw, 1.25rem);
  --text-xl: clamp(1.25rem, 1.15rem + 0.5vw, 1.5rem);
  --text-2xl: clamp(1.5rem, 1.35rem + 0.75vw, 2rem);
  --text-3xl: clamp(2rem, 1.75rem + 1vw, 2.5rem);
  --text-hero: clamp(2.5rem, 2rem + 4vw, 5rem);

  /* Transitions & Motion */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --duration-slow: 0.8s;
  --duration-base: 0.4s;
  --duration-fast: 0.2s;
}

@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;
  }
}

html {
  scroll-behavior: smooth;
  background-color: var(--bg-darker);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background-color: var(--bg-darker);
  color: var(--text-primary);
  line-height: 1.6;
  font-size: var(--text-base);
  selection-background-color: var(--accent-gold);
  selection-color: var(--bg-darker);
}

h1 { font-size: var(--text-hero); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }

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

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-darker);
}
::-webkit-scrollbar-thumb {
  background: color-mix(in oklch, var(--bg-darker), var(--text-muted) 20%);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent-gold);
}

/* Typography & Hierarchy */
.text-gold { color: var(--accent-gold); }
.text-amber { color: var(--accent-amber); }
.text-muted { color: var(--text-muted); }

.font-serif { font-family: 'Playfair Display', serif; }
.font-sans { font-family: 'Outfit', sans-serif; }

/* Refined Headlines */
h1, h2, h3, h4 {
  text-wrap: balance;
}

/* Reveal Animations */
.reveal-up {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity var(--duration-slow) var(--ease-out-expo), 
              transform var(--duration-slow) var(--ease-out-expo);
  will-change: transform, opacity;
}
.reveal-up.active {
  opacity: 1;
  transform: translateY(0);
}

.stagger-item {
  opacity: 0;
  transform: translateY(15px);
  will-change: transform, opacity;
}
.active .stagger-item {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.6s var(--ease-out-expo), 
              transform 0.6s var(--ease-out-expo);
}

/* Header & Glass Effect */
.glass {
  background: color-mix(in oklch, var(--bg-darker), transparent 10%);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
}

/* Interactive Elements */
.nav-link {
  transition: color var(--duration-fast) var(--ease-out-expo);
}
.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--accent-gold);
  transition: width var(--duration-base) var(--ease-out-expo);
}
.nav-link:hover::after {
  width: 100%;
}

.menu-tab {
  position: relative;
  transition: color var(--duration-base) var(--ease-out-expo),
              opacity var(--duration-base) var(--ease-out-expo);
}
.menu-tab::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent-gold);
  transition: width var(--duration-base) var(--ease-out-expo);
}
.menu-tab:hover {
  opacity: 1;
}
.menu-tab.active {
  color: var(--accent-gold) !important;
}
.menu-tab.active::after {
  width: 100%;
}

.menu-item {
  position: relative;
  transition: all var(--duration-base) var(--ease-out-expo);
  border-bottom: 1px solid var(--border-subtle);
  padding: var(--space-sm) 0;
}
.menu-item:hover {
  border-bottom-color: color-mix(in oklch, var(--accent-gold), transparent 50%);
  padding-left: 0.25rem;
}

/* Language Toggle Logic */
.lang-en { display: none !important; }
html[lang="en"] .lang-it { display: none !important; }
html[lang="en"] .lang-en { display: inline-block !important; }
html[lang="en"] div.lang-en,
html[lang="en"] p.lang-en,
html[lang="en"] section.lang-en { display: block !important; }

/* Signature Animation */
.animated-signature {
  background: linear-gradient(to right, var(--text-primary) 50%, transparent 50%);
  background-size: 200% auto;
  background-position: 100% 0;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  transition: background-position 1.5s var(--ease-out-expo);
  transition-delay: 0.1s;
}
.active .animated-signature,
.active.animated-signature {
  background-position: 0% 0;
}

/* Hero Background Animation */
@keyframes slowZoom {
  from { transform: scale(1.05); }
  to { transform: scale(1); }
}
.hero-image-bg {
  animation: slowZoom 30s var(--ease-out-expo) forwards;
}

/* Hamburger Menu */
.hamburger-line {
  transition: transform 0.3s var(--ease-out-expo), 
              opacity 0.3s var(--ease-out-expo),
              background-color 0.3s var(--ease-out-expo);
}
#mobile-menu-btn.open .hamburger-line:nth-child(1) { transform: translateY(8px) rotate(45deg); }
#mobile-menu-btn.open .hamburger-line:nth-child(2) { opacity: 0; }
#mobile-menu-btn.open .hamburger-line:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

/* Buttons & CTA */
.btn-primary {
  transition: background-color var(--duration-base) var(--ease-out-expo),
              color var(--duration-base) var(--ease-out-expo),
              transform var(--duration-base) var(--ease-out-expo);
}
.btn-primary:active {
  transform: scale(0.95);
}

.hero-image-bg {
  background-image: url("img/hero-bg.jpg");
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  filter: brightness(0.4) contrast(1.2);
}

@media (max-width: 768px) {
  .hero-image-bg {
    background-attachment: scroll; /* Better performance on mobile */
  }
}

@media (max-width: 768px) {
  body {
    padding-bottom: 5rem; /* Space for mobile bottom nav */
  }
  
  .menu-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    justify-content: flex-start;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-left: 1rem;
    padding-right: 1rem;
    margin-left: -1.5rem;
    margin-right: -1.5rem;
  }
  .menu-tabs::-webkit-scrollbar {
    display: none;
  }
  
  .menu-tab {
    flex-shrink: 0;
    white-space: nowrap;
  }
}

.header-shrunk {
  padding-top: 1rem !important;
  padding-bottom: 1rem !important;
}

section {
  content-visibility: auto;
  contain-intrinsic-size: 1px 1000px;
}

#hero {
  content-visibility: visible;
}
