/* ==========================================
   1. GLOBALI & RESET
   ================================---------- */
body {
  font-family: 'Inter', sans-serif;
  color: #1e293b;
  background-color: #f8fafc;
  line-height: 1.6;
  transition: background-color 0.3s ease, color 0.3s ease;
  overflow-x: hidden;
  scroll-behavior: smooth;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  color: #0f172a;
}

a:focus-visible {
  outline: 3px solid #4f46e5;
  outline-offset: 3px;
}

.section-padding {
  padding: 5rem 0;
}

.text-primary-accent {
  color: #4f46e5;
}

.text-gradient {
  background: linear-gradient(135deg, #4f46e5, #06b6d4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.skip-link {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2000;
  background: #4f46e5;
  color: #fff;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  text-decoration: none;
}

/* ==========================================
   2. NAVBAR STICKY & LOGO FL
   ================================---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1030;
  background-color: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid #e2e8f0;
}

.site-header .navbar-brand {
  font-family: 'Plus Jakarta Sans', sans-serif;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.navbar-brand .brand-logo {
  height: 38px;
  width: auto;
  object-fit: contain;
  transition: filter 0.3s ease;
}

.site-header .nav-link {
  color: #475569;
  font-weight: 500;
  transition: all 0.25s ease-in-out;
}

.site-header .nav-link:hover,
.site-header .nav-link.active {
  color: #4f46e5;
}

/* ==========================================
   3. BOTTONI & SWITCH TEMA MANUALE
   ================================---------- */
.badge-pill {
  display: inline-block;
  background-color: rgba(79, 70, 229, 0.1);
  color: #4f46e5;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.35rem 0.85rem;
  border-radius: 50rem;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background-color: rgba(16, 185, 129, 0.1);
  color: #059669;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.4rem 1rem;
  border-radius: 50rem;
}

.status-badge .status-dot {
  width: 8px;
  height: 8px;
  background-color: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.25);
}

.btn-primary-custom {
  background-color: #4f46e5;
  color: #ffffff;
  font-weight: 600;
  padding: 0.65rem 1.4rem;
  border-radius: 0.6rem;
  border: 2px solid #4f46e5;
  box-shadow: 0 8px 20px -4px rgba(79, 70, 229, 0.45);
  transition: all 0.25s ease-in-out;
}

.btn-primary-custom:hover {
  background-color: #4338ca;
  border-color: #4338ca;
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 12px 25px -4px rgba(79, 70, 229, 0.65);
}

.btn-outline-custom {
  background-color: transparent;
  color: #0f172a;
  font-weight: 600;
  padding: 0.65rem 1.4rem;
  border-radius: 0.6rem;
  border: 2px solid #e2e8f0;
  transition: all 0.25s ease-in-out;
}

.btn-outline-custom:hover {
  border-color: #4f46e5;
  color: #4f46e5;
}

.theme-switch {
  cursor: pointer;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background-color: #f1f5f9;
  border: 1px solid #e2e8f0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all 0.25s ease-in-out;
}

.theme-switch:hover {
  border-color: #4f46e5;
  transform: rotate(12deg);
}

.theme-switch i {
  font-size: 1.1rem;
  transition: transform 0.35s ease, opacity 0.25s ease;
  position: absolute;
}

.theme-switch .icon-sun { color: #f59e0b; opacity: 1; transform: scale(1); }
.theme-switch .icon-moon { color: #0f172a; opacity: 0; transform: scale(0.5); }

/* ==========================================
   4. HERO, ABOUT, PROGETTI & GALLERY
   ================================---------- */
.hero-section {
  padding: 6rem 0;
  position: relative;
  background: radial-gradient(circle at 15% 20%, rgba(79, 70, 229, 0.08) 0%, transparent 40%),
              radial-gradient(circle at 85% 80%, rgba(6, 182, 212, 0.1) 0%, transparent 40%);
}

.hero-section .hero-flex {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3rem;
}

@media (min-width: 992px) {
  .hero-section .hero-flex {
    flex-direction: row;
    justify-content: space-between;
  }
}

.hero-section .hero-content { 
  flex: 1 1 52%; 
}

.hero-section .hero-visual { 
  flex: 1 1 44%; 
  width: 100%; 
}

.profile-frame-art {
  position: relative;
  width: 330px;
  height: 330px;
  max-width: 100%;
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  border-radius: 2.2rem;
  overflow: hidden;
  box-shadow: 0 20px 45px -12px rgba(15, 23, 42, 0.35);
  border: 3px solid rgba(79, 70, 229, 0.3);
  transition: transform 0.4s ease, box-shadow 0.4s ease;
}

.profile-frame-art:hover {
  transform: translateY(-5px);
  box-shadow: 0 25px 50px -12px rgba(79, 70, 229, 0.5);
  border-color: #4f46e5;
}

.profile-img-custom {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center top;
  filter: contrast(1.05);
}

.visual-card, .project-card, .cv-header, .cv-box, .cv-section, .contact-card, .about-card, .gallery-item {
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 1rem;
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.04);
  transition: all 0.25s ease-in-out;
}

.gallery-item img {
  transition: transform 0.5s ease;
}

.gallery-item:hover img {
  transform: scale(1.05);
}

.projects-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

@media (min-width: 768px) {
  .projects-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 992px) {
  .bento-layout { grid-template-columns: repeat(2, 1fr); }
  .bento-layout .project-card--featured {
    grid-column: span 2;
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    align-items: center;
    gap: 2rem;
  }
  .bento-layout .project-card--featured .project-card__image-wrapper {
    height: 100%;
    min-height: 280px;
    margin-bottom: 0;
  }
}

.project-card {
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.project-card:hover {
  transform: translateY(-6px);
  border-color: #4f46e5;
}

.project-card:hover .project-card__image-wrapper img {
  transform: scale(1.06);
}

.project-card__image-wrapper {
  width: 100%;
  height: 220px;
  border-radius: 0.75rem;
  overflow: hidden;
  margin-bottom: 1.25rem;
  background-color: #e2e8f0;
}

.project-card__image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s cubic-bezier(0.25, 1, 0.5, 1);
}

.project-card__body {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.project-card__tags {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.project-card__tags span {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: #4f46e5;
  background-color: rgba(79, 70, 229, 0.08);
  padding: 0.2rem 0.6rem;
  border-radius: 0.35rem;
}

.project-card .project-link {
  margin-top: auto;
  padding-top: 1rem;
  color: #4f46e5;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.25s ease-in-out;
}

.project-card .project-link:hover { gap: 0.7rem; }

/* ==========================================
   5. FOOTER
   ================================---------- */
.site-footer {
  background-color: #ffffff;
  border-top: 1px solid #e2e8f0;
  padding: 2rem 0;
  color: #475569;
}

.site-footer .social-links a {
  color: #475569;
  font-size: 1.25rem;
  transition: all 0.25s ease-in-out;
}

.site-footer .social-links a:hover { color: #4f46e5; }

/* ==========================================
   6. STILI DARK MODE MANUALE (body.dark-mode)
   ================================---------- */
body.dark-mode {
  background-color: #0b0f19;
  color: #f8fafc;
}

body.dark-mode .theme-switch {
  background-color: #1e293b;
  border-color: #334155;
}

body.dark-mode h1,
body.dark-mode h2,
body.dark-mode h3,
body.dark-mode h4,
body.dark-mode h5,
body.dark-mode h6 {
  color: #f8fafc;
}

body.dark-mode .text-secondary { color: #94a3b8 !important; }
body.dark-mode .text-primary-accent,
body.dark-mode .project-link { color: #818cf8; }

body.dark-mode .site-header {
  background-color: rgba(11, 15, 25, 0.85);
  border-bottom-color: #334155;
}

body.dark-mode .site-header .navbar-brand { color: #f8fafc; }
body.dark-mode .navbar-brand .brand-logo {
  filter: invert(1) brightness(1.2);
}

body.dark-mode .site-header .nav-link { color: #94a3b8; }
body.dark-mode .site-header .nav-link:hover,
body.dark-mode .site-header .nav-link.active { color: #818cf8; }
body.dark-mode .site-header .navbar-toggler { border-color: #334155; filter: invert(1); }

body.dark-mode .bg-light-subtle { background-color: rgba(17, 24, 39, 0.6) !important; }

body.dark-mode .visual-card,
body.dark-mode .project-card,
body.dark-mode .cv-header,
body.dark-mode .cv-box,
body.dark-mode .cv-section,
body.dark-mode .contact-card,
body.dark-mode .about-card,
body.dark-mode .gallery-item {
  background-color: #111827 !important;
  border-color: #334155 !important;
  color: #f8fafc !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

body.dark-mode .badge-pill,
body.dark-mode .timeline-item .timeline-date,
body.dark-mode .project-card__tags span {
  background-color: rgba(129, 140, 248, 0.15);
  color: #818cf8;
}

body.dark-mode .badge.bg-light {
  background-color: #1e293b !important;
  border-color: #334155 !important;
  color: #f8fafc !important;
}

body.dark-mode .btn-outline-custom {
  color: #f8fafc;
  border-color: #334155;
}

body.dark-mode .btn-outline-custom:hover {
  border-color: #818cf8;
  color: #818cf8;
}

body.dark-mode .border-bottom { border-color: #334155 !important; }
body.dark-mode .border-top { border-color: #334155 !important; }

body.dark-mode .form-control,
body.dark-mode .form-label {
  color: #f8fafc !important;
}

body.dark-mode .form-control {
  background-color: #1f2937 !important;
  border-color: #334155 !important;
}

/* Fix visibilità placeholder in Dark Mode */
body.dark-mode .form-control::placeholder {
  color: #94a3b8 !important;
  opacity: 1;
}

body.dark-mode .form-control:focus {
  background-color: #1f2937 !important;
  color: #f8fafc !important;
  border-color: #818cf8 !important;
  box-shadow: 0 0 0 0.25rem rgba(129, 140, 248, 0.25);
}

body.dark-mode .site-footer {
  background-color: #111827;
  border-top-color: #334155;
  color: #94a3b8;
}

body.dark-mode .site-footer .social-links a { color: #94a3b8; }
body.dark-mode .site-footer .social-links a:hover { color: #818cf8; }