:root {
  /* Palette migliorata - tonalità più professionali e armoniose */
  --cream: #F5F1EA;
  --beige: #D4C5B0;
  --deep-ocean: #1E3A5F;
  --ocean-light: #2A4A73;
  --bg: var(--deep-ocean);
  --bg-alt: #152B47;
  --card-bg: #243B5A;
  --accent: #B8986E;
  --accent-hover: #C9A978;
  --accent-soft: rgba(184, 152, 110, 0.15);
  --text: var(--cream);
  --muted: #C4B5A0;
  --border: rgba(255, 255, 255, 0.1);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.15);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.35);
  --error: #E76F51;
  --success: #52B788;
  --font-body: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
}

/* Modalità chiara migliorata */
body.light-mode {
  --bg: #FDFCFA;
  --bg-alt: #F8F5F0;
  --card-bg: #FFFFFF;
  --accent: #8B6F47;
  --accent-hover: #9D7E54;
  --accent-soft: rgba(139, 111, 71, 0.1);
  --text: #1A1A1A;
  --muted: #6B6B6B;
  --border: rgba(0, 0, 0, 0.1);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.15);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-body);
  background: linear-gradient(180deg, var(--ocean-light) 0%, var(--bg) 50%, #0F1F35 100%);
  color: var(--text);
  line-height: 1.7;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.light-mode {
  background: linear-gradient(180deg, #FFFFFF 0%, var(--bg-alt) 50%, #E8E0D5 100%);
}

/* Utility screen-reader only */
.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;
}

/* Navbar migliorata */
header {
  position: relative;
  min-height: 70vh;
}

.navbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 5vw;
  background: linear-gradient(
    to bottom,
    rgba(30, 58, 95, 0.95),
    rgba(30, 58, 95, 0.85),
    rgba(30, 58, 95, 0.4),
    transparent
  );
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  border-bottom: 1px solid var(--border);
}

body.light-mode .navbar {
  background: linear-gradient(
    to bottom,
    rgba(253, 252, 250, 0.95),
    rgba(253, 252, 250, 0.85),
    rgba(253, 252, 250, 0.4),
    transparent
  );
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.logo {
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 0.9rem;
  color: var(--accent);
  transition: color 0.3s ease;
}

.logo:hover {
  color: var(--accent-hover);
}

body.light-mode .logo {
  color: var(--accent);
}

/* controls (lang + theme + burger) */
.controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Language switcher migliorato */
.lang-switcher select {
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-sm);
}

.lang-switcher select:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(184, 152, 110, 0.2);
  transform: translateY(-1px);
}

body.light-mode .lang-switcher select {
  background: #FFFFFF;
  border: 1px solid rgba(0, 0, 0, 0.12);
}

/* Theme toggle migliorato */
.theme-toggle {
  position: relative;
  width: 50px;
  height: 28px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  display: inline-flex;
  align-items: center;
  padding: 0 5px;
  cursor: pointer;
  overflow: hidden;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-sm);
}

.theme-toggle:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(184, 152, 110, 0.2);
  transform: translateY(-1px);
}

.theme-icon {
  font-size: 0.9rem;
  width: 18px;
  text-align: center;
  transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55), opacity 0.3s ease;
}

/* default: dark mode attivo (mostra luna) */
.theme-icon-light {
  opacity: 0;
  transform: translateX(-8x);
}
.theme-icon-dark {
  opacity: 1;
  transform: translateX(1px);
}

/* in light-mode mostra il sole */
body.light-mode .theme-icon-light {
  opacity: 1;
  transform: translateX(1px);
}
body.light-mode .theme-icon-dark {
  opacity: 0;
  transform: translateX(-8px);
}


.nav-links {
  list-style: none;
  display: flex;
  gap: 2rem;
  margin: 0;
  padding: 0;
}

.nav-links a {
  text-decoration: none;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding-bottom: 0.3rem;
  border-bottom: 2px solid transparent;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translateX(-50%);
}

.nav-links a:hover {
  color: var(--text);
}

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

/* Mobile nav */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 0.3rem;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
}

.nav-toggle span {
  width: 24px;
  height: 2.5px;
  background: var(--text);
  border-radius: 999px;
  transition: all 0.3s ease;
}

/* Hero migliorata */
.hero {
  padding: 8rem 5vw 5rem;
  display: flex;
  align-items: center;
}

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

.hero h1 {
  font-size: clamp(2.5rem, 5vw, 3.5rem);
  margin-bottom: 1.25rem;
  color: var(--text);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.hero p {
  margin: 0.5rem 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.hero-location {
  font-size: 1rem;
  color: var(--accent);
  font-weight: 500;
}

/* Buttons migliorati */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 2rem;
  padding: 0.9rem 2rem;
  background: var(--accent);
  color: #FFFFFF;
  border-radius: 12px;
  border: none;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(184, 152, 110, 0.35);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.btn-primary::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 0.5s;
}

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

.btn-primary:hover {
  transform: translateY(-2px);
  background: var(--accent-hover);
  box-shadow: 0 12px 32px rgba(184, 152, 110, 0.5);
}

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

/* Sections migliorate */
.section {
  padding: 5rem 5vw;
}

.section-alt {
  background: linear-gradient(180deg, var(--bg-alt) 0%, var(--bg) 50%, #0F1F35 100%);
  position: relative;
}

.section-alt::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
}

body.light-mode .section-alt {
  background: linear-gradient(180deg, #FFFFFF 0%, var(--bg-alt) 50%, #E8E0D5 100%);
}

.section-title h2 {
  margin: 0 0 0.75rem;
  font-size: 2rem;
  color: var(--text);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.section-title {
  margin-bottom: 2.5rem;
  border-left: 4px solid var(--accent);
  padding-left: 1rem;
}

.section-content {
  max-width: 1100px;
}

/* Layout helpers */
.two-cols {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1.3fr);
  gap: 2.5rem;
  align-items: flex-start;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
}

/* Cards migliorate */
.card {
  background: linear-gradient(
    145deg,
    rgba(36, 59, 90, 0.95),
    rgba(30, 58, 95, 0.9)
  );
  border-radius: 16px;
  border: 1px solid var(--border);
  padding: 2rem 2.25rem;
  box-shadow: var(--shadow-lg);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  opacity: 0;
  transition: opacity 0.4s ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  border-color: rgba(184, 152, 110, 0.3);
}

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

body.light-mode .card {
  background: #FFFFFF;
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(0, 0, 0, 0.08);
}

body.light-mode .card:hover {
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.15);
}

.card h3 {
  margin-top: 0;
  margin-bottom: 1rem;
  color: var(--text);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.card-subtitle {
  margin: 0 0 0.5rem;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 500;
}

.card ul {
  padding-left: 1.25rem;
  margin: 0.5rem 0 0;
  line-height: 1.8;
}

.card ul li {
  margin-bottom: 0.4rem;
}

/* Tags migliorate */
.tags {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 0 0 1.25rem;
}

.tags li {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
  background: var(--accent-soft);
  border: 1px solid rgba(184, 152, 110, 0.25);
  border-radius: 8px;
  padding: 0.45rem 0.9rem;
  color: var(--accent);
  transition: all 0.3s ease;
}

.tags li:hover {
  background: rgba(184, 152, 110, 0.25);
  transform: translateY(-1px);
}

body.light-mode .tags li {
  color: var(--accent);
  border-color: rgba(139, 111, 71, 0.3);
}

/* Timeline migliorata */
.timeline {
  display: grid;
  gap: 2rem;
  border-left: 2px solid var(--border);
  padding-left: 2rem;
  margin-left: 0.75rem;
}

.timeline-item {
  position: relative;
  padding-left: 0.5rem;
  transition: all 0.3s ease;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -2.4rem;
  top: 0.5rem;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 6px rgba(184, 152, 110, 0.2);
  transition: all 0.3s ease;
  border: 2px solid var(--bg);
}

.timeline-item:hover::before {
  box-shadow: 0 0 0 8px rgba(184, 152, 110, 0.3);
  transform: scale(1.1);
}

.timeline-item h3 {
  margin: 0 0 0.4rem;
  font-size: 1.1rem;
  color: var(--text);
  font-weight: 600;
}

.timeline-meta {
  margin: 0 0 0.5rem;
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 500;
}

.timeline-item p {
  margin: 0;
  line-height: 1.7;
}

/* Contact migliorata */
.contact-list {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0 0;
}

.contact-list li {
  margin-bottom: 0.75rem;
  font-size: 1.05rem;
}

.contact-list a {
  color: var(--accent);
  text-decoration: none;
  transition: all 0.3s ease;
  position: relative;
}

.contact-list a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width 0.3s ease;
}

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

.contact-list a:hover::after {
  width: 100%;
}

form label {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 1rem;
  color: var(--text);
  font-weight: 500;
}

input,
textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: rgba(36, 59, 90, 0.5);
  color: var(--text);
  font: inherit;
  margin-top: 0.4rem;
  transition: all 0.3s ease;
  font-size: 0.95rem;
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
  opacity: 0.6;
}

body.light-mode input,
body.light-mode textarea {
  background: #FFFFFF;
  border-color: rgba(0, 0, 0, 0.15);
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(184, 152, 110, 0.15);
  background: rgba(36, 59, 90, 0.7);
}

body.light-mode input:focus,
body.light-mode textarea:focus {
  background: #FFFFFF;
  box-shadow: 0 0 0 3px rgba(139, 111, 71, 0.15);
}

textarea {
  resize: vertical;
  min-height: 140px;
}

.form-status {
  font-size: 0.9rem;
  margin-top: 1rem;
  min-height: 1.5em;
  font-weight: 500;
}

.form-status.error {
  color: var(--error);
}

.form-status.success {
  color: var(--success);
}

/* Misc */
.example {
  font-size: 0.9rem;
  color: var(--muted);
  margin-top: 1rem;
  font-style: italic;
  opacity: 0.9;
}

.extra-space {
  margin-top: 2.5rem;
}

/* Footer migliorato */
.footer {
  padding: 2.5rem 5vw 3rem;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.9rem;
  color: var(--muted);
  background: linear-gradient(180deg, var(--bg) 0%, #0F1F35 100%);
}

body.light-mode .footer {
  background: linear-gradient(180deg, var(--bg-alt) 0%, #E8E0D5 100%);
}

.back-to-top {
  display: inline-block;
  margin-top: 1rem;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 600;
  transition: all 0.3s ease;
  padding: 0.5rem 1rem;
  border: 1px solid var(--accent);
  border-radius: 8px;
}

.back-to-top:hover {
  background: var(--accent);
  color: #FFFFFF;
  transform: translateY(-2px);
}

/* Responsive */
@media (max-width: 800px) {
  .two-cols {
    grid-template-columns: 1fr;
  }

  .hero {
    padding-top: 6rem;
    padding-bottom: 4rem;
  }

  .navbar {
    padding-inline: 1.5rem;
  }

  .nav-links {
    position: fixed;
    inset: 4rem 1.5rem auto 1.5rem;
    padding: 1.25rem 1.5rem;
    flex-direction: column;
    gap: 1rem;
    border-radius: 16px;
    background: rgba(30, 58, 95, 0.98);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    transform-origin: top;
    transform: scaleY(0.8);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-lg);
  }

  body.light-mode .nav-links {
    background: rgba(253, 252, 250, 0.98);
  }

  .nav-links.open {
    opacity: 1;
    pointer-events: auto;
    transform: scaleY(1);
  }

  .nav-toggle {
    display: flex;
  }

  .section {
    padding: 3.5rem 1.5rem;
  }

  .cards-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .hero h1 {
    font-size: 2rem;
  }

  .section-title h2 {
    font-size: 1.6rem;
  }

  .card {
    padding: 1.5rem 1.75rem;
  }
}