@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700&family=Orbitron:wght@400;500;700;900&display=swap');

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

:root {
  /* Default Dark Theme Colors */
  --bg-color: #050814;
  --text-primary: #e0f7fa;
  --text-secondary: #94a3b8;
  --accent-cyan: #00ffff;
  --accent-cyan-hover: #38bdf8;
  --nav-bg: rgba(2, 6, 23, 0.8);

  --color-finance: #C9A84C;
  --color-finance-glow: rgba(201, 168, 76, 0.5);
  --color-engineering: #C9A84C;
  --color-engineering-glow: rgba(201, 168, 76, 0.5);
  --color-personal: #C9A84C;
  --color-personal-glow: rgba(201, 168, 76, 0.5);
  --color-contact: #C9A84C;
  --color-contact-glow: rgba(201, 168, 76, 0.5);

  --card-bg: rgba(2, 6, 23, 0.5);
  --card-border: rgba(255, 255, 255, 0.1);
  --glass-blur: blur(12px);
  --shadow-base: 0 4px 30px rgba(0, 0, 0, 0.1);
}

html.light-mode,
body.light-mode {
  /* Light Theme Colors */
  --bg-color: #F9F7F2;
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --accent-cyan: #2872A1;
  --accent-cyan-hover: #1d557a;
  --nav-bg: rgba(249, 247, 242, 0.85);

  --color-finance: #2872A1;
  --color-finance-glow: rgba(40, 114, 161, 0.3);
  --color-engineering: #a88732;
  /* Oro attenuato (più scuro per risaltare sul bianco) */
  --color-engineering-glow: rgba(168, 135, 50, 0.3);
  --color-personal: #2872A1;
  --color-personal-glow: rgba(40, 114, 161, 0.3);
  --color-contact: #2872A1;
  --color-contact-glow: rgba(40, 114, 161, 0.3);

  --card-bg: rgba(255, 255, 255, 0.7);
  --card-border: rgba(40, 114, 161, 0.25);
  --border-color: rgba(40, 114, 161, 0.2);
  --glass-blur: blur(16px);
  --shadow-base: 0 4px 20px rgba(0, 0, 0, 0.05);

  background: var(--bg-color) !important;
  color: var(--text-primary) !important;
}

html {
  background: var(--bg-color);
  transition: background-color 0.45s ease;
}

body {
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  background: var(--bg-color);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  line-height: 1.7;
  transition: background-color 0.45s ease, color 0.35s ease;
}

/* ===== SMOOTH THEME TRANSITION ===== */
.card,
.cards,
.weather-widget,
.nasa-widget,
.side-widget,
.site-footer,
h1,
h2,
h3,
h4,
p,
span,
a,
li,
ul,
.cv-section-title,
.badge,
.badge-link,
.profile-photo,
.profile-name,
.profile-subtitle {
  transition: background-color 0.45s ease, color 0.35s ease, border-color 0.4s ease, box-shadow 0.4s ease;
}

h1,
h2,
h3,
.navbar-logo h1,
.digital-clock {
  font-family: 'Orbitron', sans-serif;
  letter-spacing: 0.5px;
}

p,
li,
.cv-body,
.skill-list,
.cv-list {
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  line-height: 1.7;
}

h4,
.cv-role,
.profile-subtitle {
  font-weight: 300;
  letter-spacing: 0.5px;
}

/* CYBERPUNK BACKGROUND GRID (Slightly softer) */
body::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(0, 255, 255, 0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 255, 255, 0.015) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: -1;
}

/* LAYOUT */
.layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.main {
  flex: 1;
  padding-bottom: 60px;
  /* Evita che l'ultima card tocchi il footer */
}


/* ══════════════════════════════════════════════════════
   NAVBAR — Design premium, coerente col sito
   ══════════════════════════════════════════════════════ */

/* ── Base struttura ─────────────────────────────────── */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 36px;
  height: 64px;
  background: rgba(2, 6, 23, 0.82);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: none;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  z-index: 200;
  position: sticky;
  top: 0;
}

/* Gold gradient border at bottom of navbar (dark mode) */
.navbar::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg,
      transparent 0%,
      rgba(201, 168, 76, 0.15) 10%,
      rgba(201, 168, 76, 0.7) 35%,
      rgba(201, 168, 76, 0.9) 50%,
      rgba(201, 168, 76, 0.7) 65%,
      rgba(201, 168, 76, 0.15) 90%,
      transparent 100%);
  pointer-events: none;
}

/* Light mode navbar */
html.light-mode .navbar {
  background: rgba(248, 250, 252, 0.92) !important;
  border-bottom: none !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08) !important;
}

/* Blue gradient border at bottom of navbar (light mode) */
html.light-mode .navbar::after {
  background: linear-gradient(90deg,
      transparent 0%,
      rgba(27, 46, 107, 0.1) 10%,
      rgba(27, 46, 107, 0.55) 35%,
      rgba(27, 46, 107, 0.75) 50%,
      rgba(27, 46, 107, 0.55) 65%,
      rgba(27, 46, 107, 0.1) 90%,
      transparent 100%);
}

/* ── Brand (logo + testo) ────────────────────────────── */
.navbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  flex-shrink: 0;
}

.navbar-logo-img {
  width: 38px;
  height: 38px;
  object-fit: contain;
  filter: drop-shadow(0 0 8px rgba(201, 168, 76, 0.45));
  transition: filter 0.3s ease;
}

.navbar-brand:hover .navbar-logo-img {
  filter: drop-shadow(0 0 14px rgba(201, 168, 76, 0.7));
}

.navbar-brand-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.navbar-name {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 2.5px;
  color: var(--color-engineering, #C9A84C);
  line-height: 1;
  transition: color 0.3s;
}

.navbar-tagline {
  font-size: 0.6rem;
  letter-spacing: 1.5px;
  color: var(--text-secondary);
  text-transform: uppercase;
  line-height: 1;
  transition: color 0.3s;
}

/* ── Menu principale ─────────────────────────────────── */
.menu {
  display: flex;
  align-items: center;
  gap: 4px;
}

.menu-group {
  position: relative;
}

.menu-link,
.menu-toggle {
  all: unset;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 8px 14px;
  border-radius: 8px;
  transition: color 0.2s ease, background 0.2s ease;
  white-space: nowrap;
  position: relative;
}

.menu-link::after,
.menu-toggle::after {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 60%;
  height: 1.5px;
  background: var(--color-engineering, #C9A84C);
  border-radius: 2px;
  transition: transform 0.2s ease;
  transform-origin: center;
}

.menu-link:hover,
.menu-toggle:hover {
  color: var(--text-primary);
  background: rgba(201, 168, 76, 0.06);
}

.menu-link:hover::after,
.menu-toggle:hover::after {
  transform: translateX(-50%) scaleX(1);
}

/* Sezione attiva — pill highlight che copre tutta la label */
.menu-link.nav-active,
.menu-toggle.nav-active {
  color: var(--color-engineering, #C9A84C) !important;
  background: rgba(201, 168, 76, 0.12) !important;
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px rgba(201, 168, 76, 0.22);
}

.menu-link.nav-active::after,
.menu-toggle.nav-active::after {
  width: calc(100% - 20px);
  /* Full width minus side padding */
  transform: translateX(-50%) scaleX(1);
  background: var(--color-engineering, #C9A84C);
  opacity: 0.9;
}

html.light-mode .menu-link.nav-active,
html.light-mode .menu-toggle.nav-active {
  background: rgba(27, 46, 107, 0.1) !important;
  box-shadow: inset 0 0 0 1px rgba(27, 46, 107, 0.2);
}

html.light-mode .menu-link.nav-active::after,
html.light-mode .menu-toggle.nav-active::after {
  background: var(--color-engineering, #1B2E6B);
}

/* Bird animation */
.nav-bird {
  width: 22px;
  height: 22px;
  background: transparent;
  pointer-events: none;
  flex-shrink: 0;
}

/* Arrow */
.arrow {
  font-size: 0.55em;
  opacity: 0.6;
  transition: transform 0.25s ease;
}

.menu-group.open>.menu-toggle .arrow,
.menu-group:hover>.menu-toggle .arrow {
  transform: rotate(180deg);
}

/* ── Dropdown ────────────────────────────────────────── */
.menu-group .menu-content {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  background: rgba(2, 6, 23, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(201, 168, 76, 0.15);
  min-width: 190px;
  display: none;
  flex-direction: column;
  padding: 14px 6px 6px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(201, 168, 76, 0.05);
  border-radius: 12px;
  z-index: 300;
  opacity: 0;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

/* Invisible bridge: fills gap between toggle and panel so hover is never lost */
.menu-group .menu-content::before {
  content: '';
  position: absolute;
  top: -12px;
  left: 0;
  right: 0;
  height: 12px;
  background: transparent;
}

html.light-mode .menu-group .menu-content {
  background: rgba(248, 250, 252, 0.97) !important;
  border-color: rgba(14, 165, 233, 0.2) !important;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.12) !important;
}

.menu-group:hover>.menu-content,
.menu-group.open>.menu-content {
  display: flex;
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.menu-content .menu-link {
  padding: 9px 14px;
  font-size: 0.72rem;
  border-radius: 8px;
  letter-spacing: 0.8px;
  text-transform: none;
  color: var(--text-secondary);
  transition: background 0.15s, color 0.15s, transform 0.15s;
}

.menu-content .menu-link::after {
  display: none;
}

.menu-content .menu-link:hover {
  background: rgba(201, 168, 76, 0.1);
  color: var(--color-engineering, #C9A84C);
  transform: translateX(3px);
}

.menu-content .menu-link.finance:hover {
  color: #10b981;
  background: rgba(16, 185, 129, 0.08);
}

.menu-content .menu-link.engineering:hover {
  color: var(--color-engineering, #C9A84C);
}

.menu-content .menu-link.personal:hover {
  color: #a78bfa;
  background: rgba(139, 92, 246, 0.08);
}

/* Divider tra voci dropdown */
.menu-content .menu-link+.menu-link {
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

html.light-mode .menu-content .menu-link+.menu-link {
  border-top-color: rgba(0, 0, 0, 0.05);
}

/* ── Gruppo destra (clock + toggle) ──────────────────── */
.nav-right-group {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: 8px;
  padding-left: 12px;
  border-left: 1px solid rgba(201, 168, 76, 0.12);
}

/* ── Orologio ────────────────────────────────────────── */
.digital-clock {
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--color-engineering, #C9A84C);
  letter-spacing: 2px;
  width: 82px;
  /* Larghezza fissa per evitare tremolii */
  min-width: 82px;
  text-align: right;
  opacity: 0.85;
  font-variant-numeric: tabular-nums;
  /* Numeri tutti della stessa larghezza! */
}

html.light-mode .digital-clock {
  color: var(--color-engineering, #1B2E6B);
}

/* ── Theme toggle ────────────────────────────────────── */
.theme-toggle-btn {
  all: unset;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(201, 168, 76, 0.08);
  border: 1px solid rgba(201, 168, 76, 0.2);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
  /* SEMPRE VISIBILE */
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

.theme-toggle-btn:hover {
  background: rgba(201, 168, 76, 0.16);
  border-color: rgba(201, 168, 76, 0.45);
  transform: scale(1.08);
}

html.light-mode .theme-toggle-btn {
  background: rgba(14, 165, 233, 0.08);
  border-color: rgba(14, 165, 233, 0.25);
}

html.light-mode .theme-toggle-btn:hover {
  background: rgba(14, 165, 233, 0.15);
}

.theme-video {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  pointer-events: none;
  display: block;
}

/* ══════════════════════════════════════════════════════
   HAMBURGER
   ══════════════════════════════════════════════════════ */
.hamburger-menu {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 28px;
  height: 20px;
  background: transparent;
  border: none;
  cursor: pointer;
  z-index: 205;
  flex-shrink: 0;
}

.hamburger-menu span {
  width: 100%;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: all 0.3s ease;
  transform-origin: center;
  display: block;
}

.hamburger-menu.open span:first-child {
  transform: translateY(9px) rotate(45deg);
}

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

.hamburger-menu.open span:nth-child(3) {
  transform: translateY(-9px) rotate(-45deg);
}

/* ══════════════════════════════════════════════════════
   MOBILE ≤ 850px
   ══════════════════════════════════════════════════════ */
@media (max-width: 850px) {
  .navbar {
    padding: 0 20px;
    height: 58px;
  }

  /* Nascondi tagline su mobile per risparmiare spazio */
  .navbar-tagline {
    display: none;
  }

  .hamburger-menu {
    display: flex;
  }

  /* Menu mobile: slide-down */
  .menu {
    position: absolute;
    top: 58px;
    left: 0;
    width: 100%;
    background: rgba(2, 6, 23, 0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(201, 168, 76, 0.12);
    flex-direction: column;
    align-items: stretch;
    padding: 12px 16px 20px;
    gap: 2px;
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.5);
    transform: translateY(-8px);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s ease, opacity 0.3s ease;
    z-index: 199;
  }

  html.light-mode .menu {
    background: rgba(248, 250, 252, 0.98) !important;
    border-bottom-color: rgba(14, 165, 233, 0.15) !important;
  }

  .menu.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  /* Links nel menu mobile più grandi per tap */
  .menu-link,
  .menu-toggle {
    font-size: 0.78rem;
    padding: 12px 16px;
    border-radius: 10px;
    width: 100%;
    box-sizing: border-box;
    letter-spacing: 1px;
  }

  .menu-link::after,
  .menu-toggle::after {
    display: none;
  }

  /* Dropdown mobile: statico */
  .menu-group .menu-content {
    position: static;
    transform: none !important;
    opacity: 1;
    display: none;
    background: rgba(201, 168, 76, 0.04);
    border: 1px solid rgba(201, 168, 76, 0.08);
    border-radius: 10px;
    padding: 4px 0;
    margin: 4px 0 4px 16px;
    box-shadow: none;
    min-width: auto;
    width: calc(100% - 16px);
  }

  .menu-group.open .menu-content {
    display: flex;
  }

  .menu-content .menu-link {
    padding: 10px 16px;
    border-radius: 8px;
    border-top: none !important;
    font-size: 0.76rem;
  }

  /* Nav-right: clock + toggle nel menu mobile */
  .nav-right-group {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 10px 16px 2px;
    border-left: none;
    border-top: 1px solid rgba(201, 168, 76, 0.1);
    margin-top: 6px;
    margin-left: 0;
  }

  /* Theme toggle mobile: più grande, più facile da toccare */
  .theme-toggle-btn {
    width: 44px !important;
    height: 44px !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  .theme-video {
    width: 28px !important;
    height: 28px !important;
  }

  .digital-clock {
    font-size: 0.85rem;
    min-width: auto;
    text-align: center;
  }

  /* Nascondi il bottone fullscreen globale su mobile (Android/iOS hanno logiche proprie per i tab) */
  .global-fs-btn {
    display: none !important;
  }
}

/* Small mobile ≤ 400px */
@media (max-width: 400px) {
  .navbar-name {
    font-size: 0.68rem;
    letter-spacing: 1.5px;
  }
}



.input-label {
  color: var(--text-primary);
}

/* ========== LIGHT MODE ========== */
body.light-mode::before {
  background-image: none !important;
  /* Rimossa griglia su tema chiaro per maggiore pulizia */
}

/* Navbar logo adjustments */
body.light-mode .navbar-logo img {
  filter: drop-shadow(0 0 8px rgba(40, 114, 161, 0.3)) !important;
}

body.light-mode .navbar-name,
body.light-mode .page-title,
body.light-mode .hero-title,
body.light-mode h1,
body.light-mode h2,
body.light-mode h3 {
  color: #2872A1 !important;
}

body.light-mode p,
body.light-mode .hero-desc,
body.light-mode .nc-desc,
body.light-mode .cv-body,
body.light-mode .timeline-desc {
  color: #000000 !important;
}

/* Let the general variables handle color assignments for cards and timeline now, 
   removing redundant light-mode overrides where variables can do the job */

body.light-mode .hero-logo {
  filter: drop-shadow(0 0 20px rgba(14, 165, 233, 0.4)) drop-shadow(0 0 40px rgba(2, 132, 199, 0.2)) !important;
}

body.light-mode .card {
  background: rgba(255, 255, 255, 0.85) !important;
  backdrop-filter: blur(15px) !important;
  border-color: rgba(255, 255, 255, 0.8) !important;
  border-style: solid !important;
  border-width: 1px !important;
  border-top-width: 3px !important;
  box-shadow: 0 8px 24px rgba(44, 62, 80, 0.06) !important;
  color: #1e293b !important;
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275),
    box-shadow 0.4s ease, border-color 0.4s ease !important;
}

body.light-mode .card::before {
  background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.9), transparent) !important;
}

body.light-mode .card h3 {
  text-shadow: none !important;
  color: #2872A1 !important;
}

body.light-mode .card.finance {
  border-top-color: var(--color-finance) !important;
}

body.light-mode .card.engineering {
  border-top-color: var(--color-engineering) !important; /* Questo oro attenuato sta benissimo sul bianco */
}

body.light-mode .card.personal {
  border-top-color: var(--color-personal) !important;
}

body.light-mode .card.finance h3 {
  color: var(--color-finance) !important;
}

body.light-mode .card.engineering h3 {
  color: var(--color-engineering) !important;
}

body.light-mode .card.personal h3 {
  color: var(--color-personal) !important;
}

body.light-mode .card.contact h3 {
  color: var(--color-contact) !important;
}

body.light-mode .card p {
  color: #475569 !important;
}

body.light-mode .contact-email {
  color: #0284c7 !important;
  border-color: #0284c7 !important;
  background: rgba(2, 132, 199, 0.1) !important;
  box-shadow: 0 0 15px rgba(2, 132, 199, 0.2) !important;
}

/* Light mode hover – elegante con shadow delicata */
body.light-mode .card:hover {
  transform: translateY(-8px) scale(1.01) !important;
  border-color: #2872A1 !important;
  box-shadow: 0 16px 36px rgba(40, 114, 161, 0.15),
    0 4px 10px rgba(0, 0, 0, 0.05) !important;
}

body.light-mode .card.finance:hover,
body.light-mode .card.engineering:hover,
body.light-mode .card.personal:hover {
  border-color: #1B2E6B !important;
  box-shadow: 0 20px 40px rgba(27, 46, 107, 0.4),
    0 0 30px rgba(27, 46, 107, 0.25),
    0 8px 16px rgba(0, 0, 0, 0.1) !important;
}

body.light-mode .timeline-content {
  background: rgba(255, 255, 255, 0.7) !important;
  border: 1px solid rgba(14, 165, 233, 0.3) !important;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05) !important;
}

body.light-mode .timeline-content:hover {
  border-color: rgba(14, 165, 233, 0.8) !important;
  box-shadow: 0 10px 25px rgba(14, 165, 233, 0.2) !important;
}

body.light-mode .timeline-title {
  color: #1e293b !important;
}

body.light-mode .timeline-desc {
  color: #475569 !important;
}

body.light-mode .timeline-date {
  color: #0284c7 !important;
  text-shadow: none !important;
}

body.light-mode .timeline::after {
  background: rgba(14, 165, 233, 0.3) !important;
  box-shadow: none !important;
}

body.light-mode .timeline-item::after {
  background-color: var(--bg-color) !important;
  border-color: var(--accent-cyan-hover) !important;
  box-shadow: none !important;
}

/* ========== WIDGETS ========== */
.weather-widget,
.nasa-widget {
  position: absolute;
  top: 100px;
  background: var(--nav-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 15px;
  box-shadow: var(--shadow-base);
  backdrop-filter: var(--glass-blur);
  z-index: 40;
  display: none;
}

.weather-widget {
  left: 20px;
  min-width: 150px;
}

.nasa-widget {
  right: 20px;
  width: 220px;
  z-index: 50;
}

.widget-title {
  font-size: 0.95rem;
  margin-bottom: 15px;
  border-bottom: 1px solid var(--card-border);
  padding-bottom: 8px;
  text-align: center;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.weather-widget .widget-title {
  color: var(--accent-cyan-hover);
}

.nasa-widget .widget-title {
  color: var(--color-personal);
}

.widget-content {
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.nasa-widget .widget-content {
  align-items: center;
  text-align: center;
}

/* Fix Card Personale inline styles override in light mode */
body.light-mode .card.personal h2 {
  color: #0284c7 !important;
}

body.light-mode .card.personal h3 {
  color: #1B2E6B !important;
  text-shadow: none !important;
  border-bottom-color: rgba(27, 46, 107, 0.2) !important;
}

body.light-mode .card.personal h4 {
  color: #1e293b !important;
}

body.light-mode .card.personal p,
body.light-mode .card.personal ul {
  color: #334155 !important;
}

body.light-mode .card.personal span,
body.light-mode .card.personal a {
  color: #0284c7 !important;
  border-color: rgba(2, 132, 199, 0.3) !important;
  background: rgba(2, 132, 199, 0.1) !important;
}

body.light-mode .card.personal h4 span {
  color: #64748b !important;
  background: transparent !important;
  border: none !important;
  font-weight: normal;
}

body.light-mode .card.personal ul li strong {
  color: #0284c7 !important;
}

body.light-mode .card.personal div>span {
  color: #0284c7 !important;
  background: transparent !important;
  border: none !important;
}

body.light-mode .card.personal table {
  color: #334155 !important;
}

body.light-mode .card.personal th {
  color: #1B2E6B !important;
  border-bottom-color: rgba(27, 46, 107, 0.3) !important;
}

body.light-mode .card.personal td {
  color: #475569 !important;
  border-bottom-color: rgba(0, 0, 0, 0.05) !important;
}

body.light-mode .card.personal tr[style*="background"] td {
  background: rgba(109, 40, 217, 0.03) !important;
}

body.light-mode .card.personal td[style*="color: #38bdf8"] {
  color: #0284c7 !important;
  font-weight: bold;
}

body.light-mode .card.personal td[style*="color: #fcd34d"] {
  color: #d97706 !important;
  text-shadow: none !important;
}

body.light-mode .card.personal td[style*="-webkit-text-fill-color"] {
  background: transparent !important;
  color: #b45309 !important;
  -webkit-text-fill-color: initial !important;
  text-shadow: none !important;
}

body.light-mode .card.personal td[style*="color: #e0f7fa"] {
  color: #0f172a !important;
  font-weight: bold;
}

body.light-mode .card.personal td[style*="color: #22c55e"] {
  color: #16a34a !important;
  font-weight: bold;
}

/* Timeline Gold Highlight - DARK MODE */
.timeline-item.gold-highlight .timeline-content {
  border: 2px solid rgba(250, 204, 21, 0.6);
  box-shadow: 0 0 15px rgba(250, 204, 21, 0.3);
}

.timeline-item.gold-highlight .timeline-date {
  color: #facc15 !important;
  text-shadow: 0 0 5px rgba(250, 204, 21, 0.5) !important;
}

.timeline-item.gold-highlight .timeline-title {
  color: #fef08a !important;
  text-shadow: 0 0 8px rgba(250, 204, 21, 0.3) !important;
}

.timeline-item.gold-highlight::after {
  background-color: #facc15 !important;
  border-color: #fef08a !important;
  box-shadow: 0 0 10px rgba(250, 204, 21, 0.6) !important;
}

/* Timeline Gold Highlight - LIGHT MODE */
body.light-mode .timeline-item.gold-highlight .timeline-content {
  border: 2px solid rgba(202, 138, 4, 0.8) !important;
  box-shadow: 0 5px 15px rgba(202, 138, 4, 0.2) !important;
  background: #fefce8 !important;
  /* light yellow */
}

body.light-mode .timeline-item.gold-highlight .timeline-title {
  color: #a16207 !important;
  /* dark gold */
  text-shadow: none !important;
}

body.light-mode .timeline-item.gold-highlight .timeline-date {
  color: #ca8a04 !important;
  /* solid gold */
  font-weight: bold;
}

body.light-mode .timeline-item.gold-highlight::after {
  background-color: #facc15 !important;
  border-color: #a16207 !important;
  box-shadow: 0 0 8px rgba(202, 138, 4, 0.4) !important;
}

/* Transitions for smooth theme switching */
body,
.navbar,
.card,
.menu-content,
.timeline-content {
  transition: background-color 0.5s ease, color 0.5s ease, border-color 0.5s ease, box-shadow 0.5s ease;
}

.hero-logo,
.navbar-logo h1,
.navbar-logo img,
.menu-link,
.menu-toggle,
.digital-clock,
.card h3,
.card p,
.timeline-title,
.timeline-desc,
.timeline-date {
  transition: color 0.5s ease, text-shadow 0.5s ease, filter 0.5s ease;
}

/* ============================================================
   DARK MODE ENHANCEMENTS (solo tema scuro)
   ============================================================ */

/* 1. SURFACE ELEVATION – Card Finanza e Ingegneria
   Sfondo più chiaro del body (#161B22) con 95% opacità
   + ombra profonda per distaccarle dalla griglia */
body:not(.light-mode) .card.finance,
body:not(.light-mode) .card.engineering,
body:not(.light-mode) .card.personal {
  background: rgba(22, 27, 34, 0.95) !important;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6) !important;
}

/* 2. ACCENT BORDERS – Bordo superiore colorato unificato */
body:not(.light-mode) .card.finance,
body:not(.light-mode) .card.engineering,
body:not(.light-mode) .card.personal {
  border-top: 2px solid #C9A84C !important;
}

/* HOVER GLOW – al passaggio mouse il bordo si illumina */
body:not(.light-mode) .card.finance:hover,
body:not(.light-mode) .card.engineering:hover,
body:not(.light-mode) .card.personal:hover {
  border-top-color: #C9A84C !important;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5),
    0 0 20px rgba(201, 168, 76, 0.3) !important;
}

/* navbar glassmorphism: moved to main navbar block */

body.light-mode {
  background-color: var(--bg-color) !important;
}


body.light-mode .layout {
  background: transparent !important;
}

body.light-mode .main {
  background: transparent !important;
}

/* ========== LIGHT MODE: OVERRIDE COLORI HARDCODED DARK THEME ========== */
/* I colori chiari usati nel tema scuro non si vedono sullo sfondo azzurro.
   Questi override garantiscono la leggibilità senza toccare ogni singolo file HTML. */

/* Testi h2/h3 azzurro chiaro (#60a5fa) → colore engineering arancione */
body.light-mode h2[style*="color: #60a5fa"],
body.light-mode h3[style*="color: #60a5fa"],
body.light-mode p[style*="color: #60a5fa"],
body.light-mode span[style*="color: #60a5fa"],
body.light-mode div[style*="color: #60a5fa"] {
  color: #1e40af !important;
  /* Blu scuro leggibile */
}

/* Testi grigi chiari (#94a3b8, #64748b) → grigio scuro leggibile */
body.light-mode *[style*="color: #94a3b8"],
body.light-mode *[style*="color: #64748b"],
body.light-mode *[style*="color: #cbd5e1"],
body.light-mode *[style*="color: #e2e8f0"] {
  color: #334155 !important;
  /* Grigio scuro leggibile */
}

/* Sfondi scuri hardcoded nelle card/badge → bianco semitrasparente */
body.light-mode *[style*="background: rgba(2, 6, 23"],
body.light-mode *[style*="background: rgba(15, 23, 42"] {
  background: rgba(255, 255, 255, 0.75) !important;
  border-color: rgba(30, 64, 175, 0.2) !important;
}

/* Text-shadow azzurro (non serve in light mode) */
body.light-mode *[style*="text-shadow: 0 0 10px rgba(96, 165, 250"] {
  text-shadow: none !important;
}

/* ===== REUSABLE COMPONENT CLASSES ===== */

/* Layout: hero logo con card ai lati */
.hero-flanking {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 40px;
  margin-bottom: 40px;
  flex-wrap: wrap;
  width: 100%;
}

/* Side cards (Percorso Accademico, Progetti...) */
.side-card {
  min-width: 200px;
  max-width: 250px;
  padding: 20px;
  text-decoration: none;
  position: relative;
  z-index: 3;
}

/* Profile card layout */
.profile-card {
  max-width: 800px;
  margin: 0 auto;
  text-align: left;
}

.profile-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 20px;
}

.profile-photo {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 20%;
  border: 3px solid #0ff;
  box-shadow: 0 0 15px rgba(0, 255, 255, 0.5);
  margin-bottom: 15px;
}

.profile-name {
  color: #0ff;
  text-align: center;
}

.profile-subtitle {
  color: #a5f3fc;
  text-align: center;
  letter-spacing: 1px;
}

/* Badge row (location, email, etc.) */
.badge-row {
  display: flex;
  gap: 15px;
  justify-content: center;
  margin-bottom: 25px;
  flex-wrap: wrap;
}

.badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 255, 255, 0.1);
  padding: 5px 10px;
  border-radius: 4px;
  border: 1px solid rgba(0, 255, 255, 0.3);
  font-size: 0.9em;
  color: #e0f7fa;
}

.badge-link {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 255, 255, 0.1);
  padding: 5px 10px;
  border-radius: 4px;
  border: 1px solid rgba(0, 255, 255, 0.3);
  font-size: 0.9em;
  color: #0ff;
  text-decoration: none;
  transition: background 0.3s, box-shadow 0.3s;
}

.badge-link:hover {
  background: rgba(0, 255, 255, 0.2);
  box-shadow: 0 0 8px rgba(0, 255, 255, 0.3);
}

/* CV Sections */
.cv-section-title {
  color: var(--color-personal);
  margin-bottom: 15px;
  border-bottom: 1px solid var(--color-personal-glow);
  padding-bottom: 5px;
}

.cv-section {
  margin-bottom: 25px;
}

.cv-entry {
  margin-bottom: 15px;
}

.cv-entry-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
}

.cv-company {
  color: #e0f7fa;
  font-size: 1.05rem;
}

.cv-role {
  color: #94a3b8;
  font-size: 0.85em;
}

.cv-date {
  color: #0ff;
  font-size: 0.85rem;
  background: rgba(0, 255, 255, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
}

.cv-list {
  list-style-type: none;
  padding-left: 0;
  line-height: 1.6;
  color: #94a3b8;
  font-size: 0.9rem;
  margin-top: 5px;
}

.cv-list li::before {
  content: ">";
  color: #0ff;
  margin-right: 6px;
}

.cv-body {
  margin-bottom: 25px;
  line-height: 1.6;
  color: #cbd5e1;
  font-size: 0.95rem;
}

/* Education */
.edu-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.edu-title {
  color: #e0f7fa;
  font-size: 1rem;
}

.edu-date {
  color: #0ff;
  font-size: 0.9rem;
}

/* Skills list */
.skill-list {
  list-style-type: none;
  padding-left: 0;
  line-height: 1.6;
  color: #cbd5e1;
  font-size: 0.95rem;
}

.skill-list li {
  margin-bottom: 8px;
}

.skill-label {
  color: #0ff;
}

/* Timeline section */
.timeline-wrapper {
  width: 100%;
  max-width: 800px;
  margin: 40px auto 0;
}

.timeline-heading {
  color: var(--color-personal);
  text-align: center;
  margin-bottom: 20px;
}

/* Page section title (used across engineering/finanza pages) */
.page-title {
  text-align: center;
  margin-bottom: 10px;
  font-size: 2rem;
}

.page-title.engineering {
  color: var(--color-engineering);
}

.page-title.finance {
  color: var(--color-finance);
}

.page-title.personal {
  color: var(--color-personal);
}

/* Breadcrumbs */
.breadcrumbs {
  text-align: center;
  margin-bottom: 30px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  letter-spacing: 1px;
}

.breadcrumbs a {
  text-decoration: none;
}

.breadcrumbs a.engineering {
  color: var(--color-engineering);
}

.breadcrumbs a.finance {
  color: var(--color-finance);
}

.breadcrumbs a.personal {
  color: var(--color-personal);
}

.breadcrumbs .separator {
  margin: 0 6px;
}

.breadcrumbs .current {
  color: var(--text-primary);
}

/* Light Mode – CV/profile overrides */
body.light-mode .profile-photo {
  border-color: var(--accent-color);
  box-shadow: 0 0 10px rgba(30, 64, 175, 0.3);
}

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

body.light-mode .profile-subtitle {
  color: var(--text-secondary);
}

body.light-mode .badge {
  background: rgba(30, 64, 175, 0.08);
  border-color: rgba(30, 64, 175, 0.2);
  color: var(--text-primary);
}

body.light-mode .badge-link {
  background: rgba(30, 64, 175, 0.08);
  border-color: rgba(30, 64, 175, 0.2);
  color: var(--accent-color);
}

body.light-mode .cv-company {
  color: var(--text-primary);
}

body.light-mode .cv-date {
  background: rgba(30, 64, 175, 0.08);
  color: var(--accent-color);
}

body.light-mode .cv-list {
  color: var(--text-secondary);
}

body.light-mode .cv-list li::before {
  color: var(--accent-color);
}

body.light-mode .cv-body {
  color: var(--text-secondary);
}

body.light-mode .edu-title {
  color: var(--text-primary);
}

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

body.light-mode .skill-list {
  color: var(--text-secondary);
}

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

/* ===== FOOTER ===== */
.site-footer {
  width: 100%;
  margin-top: 0px;
  padding: 10px 20px 30px 20px;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(12px);
  border-top: none;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
  position: relative;
  z-index: 10;
}

/* Gold gradient border at top of footer (dark mode) */
.site-footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg,
      transparent 0%,
      rgba(201, 168, 76, 0.15) 10%,
      rgba(201, 168, 76, 0.7) 35%,
      rgba(201, 168, 76, 0.9) 50%,
      rgba(201, 168, 76, 0.7) 65%,
      rgba(201, 168, 76, 0.15) 90%,
      transparent 100%);
  pointer-events: none;
}

.footer-logo-link {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 60px;
  /* In grandito da 38px a 60px per dare più respiro sopra e sotto */
  overflow: hidden;
  /* Cops the empty top/bottom space of the 100px image */
}

.footer-logo-img {
  height: 100px;
  min-height: 100px;
  /* Prevents flexbox from shrinking it back down */
  width: auto;
  object-fit: contain;
}

.footer-content {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}

.footer-links {
  display: flex;
  gap: 30px;
  flex-wrap: wrap;
  justify-content: center;
}

.footer-link {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.3s, filter 0.3s;
}

.footer-link:hover {
  color: var(--accent-color, #00ffff);
  filter: drop-shadow(0 0 4px rgba(0, 255, 255, 0.4));
}

.footer-link svg {
  flex-shrink: 0;
}

.footer-copy {
  color: var(--text-secondary);
  opacity: 0.6;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
}

/* Footer Light Mode */
body.light-mode .site-footer {
  background: rgba(255, 255, 255, 0.7);
  border-top: none;
}

/* Blue gradient border at top of footer (light mode) */
html.light-mode .site-footer::before {
  background: linear-gradient(90deg,
      transparent 0%,
      rgba(27, 46, 107, 0.1) 10%,
      rgba(27, 46, 107, 0.55) 35%,
      rgba(27, 46, 107, 0.75) 50%,
      rgba(27, 46, 107, 0.55) 65%,
      rgba(27, 46, 107, 0.1) 90%,
      transparent 100%);
}

body.light-mode .footer-link:hover {
  color: var(--accent-color, #1e40af);
  filter: drop-shadow(0 0 4px rgba(30, 64, 175, 0.3));
}

/* ===== SIDE WIDGETS (engineering, finanza) ===== */
.side-widget {
  position: absolute;
  background: rgba(15, 23, 42, 0.8);
  border-radius: 8px;
  padding: 15px;
  backdrop-filter: blur(10px);
  z-index: 50;
  display: none;
  transition: background-color 0.45s ease, border-color 0.4s ease;
}

/* Color variants */
.side-widget.gold {
  border: 1px solid rgba(250, 204, 21, 0.3);
  box-shadow: 0 0 15px rgba(250, 204, 21, 0.1);
}

.side-widget.red {
  border: 1px solid rgba(239, 68, 68, 0.3);
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.1);
}

.side-widget.green {
  border: 1px solid rgba(34, 197, 94, 0.3);
  box-shadow: 0 0 15px rgba(34, 197, 94, 0.1);
}

.side-widget.blue {
  border: 1px solid rgba(14, 165, 233, 0.3);
  box-shadow: 0 0 15px rgba(14, 165, 233, 0.1);
}

.side-widget.purple {
  border: 1px solid rgba(139, 92, 246, 0.3);
  box-shadow: 0 0 15px rgba(139, 92, 246, 0.1);
}

.side-widget.amber {
  border: 1px solid rgba(245, 158, 11, 0.3);
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.1);
}

.side-widget.pink {
  border: 1px solid rgba(236, 72, 153, 0.3);
  box-shadow: 0 0 15px rgba(236, 72, 153, 0.1);
}

/* Widget positions */
.side-widget.top-left {
  top: 100px;
  left: 20px;
}

.side-widget.top-right {
  top: 100px;
  right: 20px;
}

.side-widget.mid-left {
  top: 400px;
  left: 20px;
}

.side-widget.mid-right {
  top: 290px;
  right: 20px;
}

.side-widget.bottom-left {
  top: 290px;
  left: 20px;
}

/* Widget header */
.widget-header {
  font-size: 0.9rem;
  margin-bottom: 10px;
  padding-bottom: 5px;
  text-align: center;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

.widget-header.gold {
  color: #facc15;
  border-bottom: 1px solid rgba(250, 204, 21, 0.2);
}

.widget-header.red {
  color: #f87171;
  border-bottom: 1px solid rgba(239, 68, 68, 0.2);
}

.widget-header.green {
  color: #4ade80;
  border-bottom: 1px solid rgba(34, 197, 94, 0.2);
}

.widget-header.blue {
  color: #0ea5e9;
  border-bottom: 1px solid rgba(14, 165, 233, 0.2);
}

.widget-header.purple {
  color: #a78bfa;
  border-bottom: 1px solid rgba(139, 92, 246, 0.2);
}

.widget-header.amber {
  color: #f59e0b;
  border-bottom: 1px solid rgba(245, 158, 11, 0.2);
}

.widget-header.pink {
  color: #ec4899;
  border-bottom: 1px solid rgba(236, 72, 153, 0.2);
}

/* Widget body */
.widget-body {
  font-size: 0.85rem;
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.widget-body.centered {
  align-items: center;
  text-align: center;
}

/* Widget stat display (used by ISS, NEO, Energy, Crypto etc.) */
.widget-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
}

.widget-stat-row.bordered {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 6px;
}

.widget-stat-row .stat-left {
  display: flex;
  align-items: center;
  gap: 5px;
}

.widget-stat-row .stat-right {
  text-align: right;
}

.widget-big-number {
  font-size: 2rem;
  font-weight: bold;
  margin: 5px 0;
}

.widget-small-text {
  font-size: 0.75rem;
  color: #94a3b8;
  line-height: 1.3;
}

/* ===== CARD ICON SVG ===== */
.card-icon-svg {
  filter: drop-shadow(0 0 6px var(--color-engineering-glow));
}

.card.finance .card-icon-svg,
.card.finance .card-icon svg {
  color: var(--color-finance);
  filter: drop-shadow(0 0 6px var(--color-finance-glow));
}

.card.engineering .card-icon-svg,
.card.engineering .card-icon svg {
  color: var(--color-engineering);
  filter: drop-shadow(0 0 6px var(--color-engineering-glow));
}

.card.personal .card-icon-svg,
.card.personal .card-icon svg {
  color: var(--color-personal);
  filter: drop-shadow(0 0 6px var(--color-personal-glow));
}

/* ===== HERO CTA BUTTONS ===== */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.5px;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: all 0.25s ease;
  /* Dark mode: gold filled */
  background: var(--color-engineering, #C9A84C);
  color: #050814;
  box-shadow: 0 4px 16px rgba(201, 168, 76, 0.35);
}

.btn-primary:hover {
  filter: brightness(1.12);
  box-shadow: 0 6px 22px rgba(201, 168, 76, 0.5);
  transform: translateY(-1px);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.5px;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.25s ease;
  /* Dark mode: ghost */
  background: rgba(201, 168, 76, 0.08);
  border: 1px solid rgba(201, 168, 76, 0.35);
  color: var(--color-engineering, #C9A84C);
}

.btn-secondary:hover {
  background: rgba(201, 168, 76, 0.16);
  border-color: rgba(201, 168, 76, 0.6);
  transform: translateY(-1px);
}

/* Light mode overrides */
html.light-mode .btn-primary {
  background: #4a6fa5;
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(74, 111, 165, 0.35);
}

html.light-mode .btn-primary:hover {
  background: #3d5f8f;
  box-shadow: 0 6px 22px rgba(74, 111, 165, 0.5);
}

html.light-mode .btn-secondary {
  background: rgba(74, 111, 165, 0.1);
  border-color: rgba(74, 111, 165, 0.35);
  color: #2d4a6f;
}

html.light-mode .btn-secondary:hover {
  background: rgba(74, 111, 165, 0.18);
  border-color: rgba(74, 111, 165, 0.55);
}

.contact-card {
  border-top: 3px solid var(--color-contact);
  text-align: center;
  flex-basis: 100%;
}

.contact-card h3 {
  color: var(--color-contact);
  margin-bottom: 15px;
}

.contact-card p {
  margin-bottom: 20px;
}

.contact-btn {
  display: inline-block;
  padding: 12px 24px;
  background: var(--color-contact-glow);
  border: 1px solid var(--color-contact);
  color: var(--color-contact);
  border-radius: 8px;
  text-decoration: none;
  font-weight: bold;
  font-size: 1.1rem;
  letter-spacing: 1px;
  transition: all 0.3s ease;
  box-shadow: 0 0 15px var(--color-contact-glow);
  margin-bottom: 25px;
}

.contact-btn:hover {
  filter: brightness(1.2);
  box-shadow: 0 0 25px var(--color-contact-glow);
}

.linkedin-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: #0a66c2;
  padding: 10px;
  border: 1px solid rgba(10, 102, 194, 0.5);
  border-radius: 50%;
  transition: all 0.3s ease;
  background: rgba(10, 102, 194, 0.1);
}

.linkedin-btn:hover {
  background: rgba(10, 102, 194, 0.25);
  box-shadow: 0 0 12px rgba(10, 102, 194, 0.3);
}

/* Full-width card */
.card-full {
  flex-basis: 100%;
}

/* Light mode overrides for widgets */
body.light-mode .side-widget {
  background: rgba(255, 255, 255, 0.85);
}

body.light-mode .widget-body {
  color: var(--text-secondary);
}

/* ===== LIGHT MODE: Enhanced card/nav-card/widget visibility ===== */
html.light-mode .nav-card,
html.light-mode .widget-card {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(27, 46, 107, 0.15);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

html.light-mode .dim-list {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(27, 46, 107, 0.15);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

html.light-mode .dim-item:hover {
  background: rgba(27, 46, 107, 0.06);
}

html.light-mode .dim-separator {
  background: rgba(27, 46, 107, 0.04);
  border-bottom-color: rgba(27, 46, 107, 0.1);
}

/* .main centering for pages that use card/section layouts */
.main {
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 20px;
  padding-right: 20px;
}

/* Light mode: tool page buttons (Calcola etc.) */
html.light-mode .btn-calcola {
  background: rgba(74, 111, 165, 0.15);
  border-color: #4a6fa5;
  color: #2d4a6f;
}

html.light-mode .btn-calcola:hover {
  background: rgba(74, 111, 165, 0.28);
  box-shadow: 0 0 18px rgba(74, 111, 165, 0.3);
}

/* Light mode: cards with class .card for tool pages */
html.light-mode .card.finance {
  background: rgba(255, 255, 255, 0.92) !important;
  border-color: rgba(27, 46, 107, 0.2) !important;
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.06) !important;
}

/* Light mode: stat chips */
html.light-mode .stat-chip {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(27, 46, 107, 0.18);
}

html.light-mode .stat-chip-val {
  color: #1e293b;
  text-shadow: none;
}

/* Light mode: inputs on tool pages */
html.light-mode input[type="number"],
html.light-mode input[type="text"],
html.light-mode select {
  background: rgba(255, 255, 255, 0.95) !important;
  color: #1e293b !important;
  border-color: rgba(27, 46, 107, 0.25) !important;
}

/* Light mode: footer styling */
html.light-mode .footer-brand-text .footer-name {
  color: var(--color-engineering);
}

html.light-mode .footer-brand-text .footer-sub {
  color: var(--text-secondary);
}

/* ===== CARD & CARDS BASE STYLES ===== */
.card {
  max-width: 1000px;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding: 28px 32px;
  border-radius: 16px;
  background: var(--card-bg, rgba(2, 6, 23, 0.5));
  border: 1px solid var(--card-border, rgba(255, 255, 255, 0.1));
  box-shadow: var(--shadow-base, 0 4px 30px rgba(0, 0, 0, 0.1));
  box-sizing: border-box;
}

.cards {
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 1000px;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}

@media (max-width: 700px) {
  .card {
    padding: 20px 18px;
    border-radius: 14px;
  }
}

/* ===== SPLASH SCREEN TRANSITION ===== */
.splash-overlay {
  position: fixed;
  inset: 0;
  z-index: 999999;
  background-color: var(--bg-color);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.splash-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.splash-video {
  width: 100vw;
  height: 100vh;
  object-fit: contain;
  outline: none;
  mix-blend-mode: screen;
}

/* ==============================
   AMBIENT BACKGROUND ORBS
   ============================== */
.ambient-bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  /* Dietro a tutto (ma davanti al colore base bg-color) */
  overflow: hidden;
  pointer-events: none;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.35;
  animation: floatOrb 25s infinite ease-in-out alternate;
  will-change: transform;
}

.orb-1 {
  width: 55vw;
  height: 55vw;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.3) 0%, transparent 70%);
  top: -15%;
  left: -10%;
  animation-delay: 0s;
}

.orb-2 {
  width: 65vw;
  height: 65vw;
  background: radial-gradient(circle, rgba(0, 255, 255, 0.2) 0%, transparent 70%);
  bottom: -20%;
  right: -15%;
  animation-delay: -5s;
}

.orb-3 {
  width: 45vw;
  height: 45vw;
  background: radial-gradient(circle, rgba(201, 168, 76, 0.18) 0%, transparent 70%);
  top: 40%;
  left: 35%;
  animation-delay: -12s;
}

@keyframes floatOrb {
  0% {
    transform: translate(0, 0) scale(1);
  }

  33% {
    transform: translate(8vw, -12vh) scale(1.1);
  }

  66% {
    transform: translate(-8vw, 8vh) scale(0.9);
  }

  100% {
    transform: translate(5vw, 5vh) scale(1.05);
  }
}

/* Orbs per la Light Mode */
html.light-mode .orb {
  opacity: 0.5;
  filter: blur(100px);
}

html.light-mode .orb-1 {
  background: radial-gradient(circle, rgba(14, 165, 233, 0.35) 0%, transparent 70%);
}

html.light-mode .orb-2 {
  background: radial-gradient(circle, rgba(27, 46, 107, 0.25) 0%, transparent 70%);
}

html.light-mode .orb-3 {
  background: radial-gradient(circle, rgba(2, 132, 199, 0.2) 0%, transparent 70%);
}


/* ==============================
   CUSTOM CURSOR FLUID
   ============================== */
body.has-custom-cursor,
body.has-custom-cursor * {
  cursor: none !important;
}

.custom-cursor,
.cursor-follower {
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 99999999;
  transform: translate3d(0, 0, 0);
}

/* Pulsante centrale (freccia in SVG) */
.custom-cursor {
  width: 28px;
  height: 28px;
  margin-top: -2px;
  margin-left: -2px;
  /* Allinea M2 2 del path esatto sul mouse */
  color: #38bdf8;
  /* Azzurro chiaro in dark mode */
  opacity: 1;
  /* Il cursore resta sempre visibile, non sparisce su hover */
  transition: transform 0s, color 0.3s ease, opacity 0.2s;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.5));
}

.custom-cursor svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
  stroke: rgba(255, 255, 255, 0.95);
  stroke-width: 1.5;
  stroke-linejoin: round;
  display: block;
}

/* Anello inseguitore elastico */
.cursor-follower {
  width: 32px;
  height: 32px;
  border: 1.5px solid rgba(0, 255, 255, 0.45);
  border-radius: 50%;
  margin-top: -16px;
  margin-left: -16px;
  /* Centra perfettamente M2 2 */
  transition: width 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275),
    height 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275),
    border-color 0.3s ease, margin 0.3s ease, background-color 0.3s ease;
}

/* Effetto Magnetico su Hover */
.custom-cursor.active {
  /* Al posto di sparire, magari diventa leggermente d'oro o resta com'è per non perderlo di vista */
  color: var(--color-engineering);
}

.cursor-follower.active {
  width: 48px;
  height: 48px;
  margin-top: -24px;
  margin-left: -24px;
  border-width: 1.5px;
  border-color: rgba(201, 168, 76, 0.6);
  background-color: rgba(201, 168, 76, 0.1);
}

/* Colori Custom Cursor per la Light Mode */
html.light-mode .custom-cursor {
  color: #1B2E6B;
  /* Blu scuro indicato */
}

html.light-mode .cursor-follower {
  border-color: rgba(27, 46, 107, 0.3);
}

html.light-mode .cursor-follower.active {
  border-color: #0284c7;
  background-color: rgba(2, 132, 199, 0.1);
}

/* ==============================
   MAGNETIC BUTTON / HOVER PHYSICS
   ============================== */
.magnetic {
  will-change: transform;
}

/* ==============================
   PRINT / PDF BROCHURE MODE
   ============================== */
@media print {

  /* Hide elements useless for PDF */
  #main-navbar,
  .site-footer,
  .theme-toggle-btn,
  .global-fs-btn,
  canvas,
  video,
  .ambient-bg,
  .splash-overlay,
  .hamburger-menu {
    display: none !important;
  }

  /* Reset colors to black and white for sharp printing */
  body,
  .layout,
  .main,
  html.light-mode body {
    background: #ffffff !important;
    color: #000000 !important;
    min-height: auto !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  /* Remove blur and heavy card borders */
  .card,
  .nav-card,
  .widget-card,
  .dim-item,
  .home-hero,
  .page-hero,
  .contact-inline,
  .side-widget {
    background: transparent !important;
    border: 1px solid #d1d5db !important;
    box-shadow: none !important;
    color: #000000 !important;
    break-inside: avoid !important;
    margin-bottom: 12px !important;
    page-break-inside: avoid !important;
  }

  /* Crisp headings */
  h1,
  h2,
  h3,
  h4,
  .hero-name,
  .hero-title,
  .wc-title,
  .dim-title,
  .nc-title,
  .cv-role,
  .cv-company,
  .edu-title {
    color: #0f172a !important;
    text-shadow: none !important;
  }

  p,
  span,
  div,
  .dim-desc,
  .nc-desc,
  .hero-role,
  .hero-desc,
  .cv-body,
  .cv-date {
    color: #334155 !important;
  }
}
