/* ==========================================================================
   1. VARIABLES & PALETTE
   ========================================================================== */
:root {
  --bg-body: #0a0a0c;
  --bg-card: #121217;

  --primary: #2563eb;
  --primary-glow: rgba(37, 99, 235, 0.15);
  --secondary: #14b8a6;
  --secondary-glow: rgba(20, 184, 166, 0.15);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border-color: rgba(255, 255, 255, 0.1);
}

/* ==========================================================================
   2. RESET & BASE
   ========================================================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Inter", sans-serif;
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.6;
  overflow-x: hidden;
}

a {
  text-decoration: none;
  color: inherit;
}

/* ==========================================================================
   3. UTILITIES
   ========================================================================== */
.gradient-text {
  background: linear-gradient(0deg, var(--primary) 0%, var(--secondary) 145%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.text-primary {
  color: var(--primary);
}

.section-divider {
  width: 80%;
  max-width: 1000px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
  margin: 0 auto;
  position: relative;
  z-index: 10;
  flex-shrink: 0;
}

.divider {
  display: none;
}

/* ==========================================================================
   4. LAYOUT: NAVBAR
   ========================================================================== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 1000;
  display: flex;
  justify-content: space-between;
  align-items: center;
  /* Manteniamo un po' di safe area per sicurezza */
  padding: max(1rem, env(safe-area-inset-top)) 5% 1rem 5%;
}

.navbar::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--glass-height, 100%); 
  background-color: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(8px) saturate(150%);
  -webkit-backdrop-filter: blur(8px) saturate(150%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  z-index: -1;
  opacity: 0; 
  transition: height 0.4s ease, opacity 0.4s ease;
}

.navbar.scrolled::before,
.navbar.menu-open::before {
  opacity: 1;
}

.nav-brand {
  z-index: 1;
}

.logo {
  font-weight: 700;
  font-size: 1.4rem;
}

.hamburger {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: transparent;
  border: none;
  cursor: pointer;
  z-index: 1001;
}

.hamburger-line {
  width: 22px;
  height: 1.5px;
  background-color: var(--text-main);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
              opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hamburger.active .hamburger-line:nth-child(1) {
  transform: translateY(7.5px) rotate(45deg);
}

.hamburger.active .hamburger-line:nth-child(2) {
  opacity: 0;
}

.hamburger.active .hamburger-line:nth-child(3) {
  transform: translateY(-7.5px) rotate(-45deg);
}

.nav-menu {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 0;
  gap: 1.5rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s ease;
}

.nav-menu.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nav-links {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.nav-links a {
  color: var(--text-main);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  transition: background-color 0.2s ease;
}

.nav-links a:hover {
  background-color: rgba(255, 255, 255, 0.1);
  opacity: 1;
}

.theme-toggle {
  background: transparent;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
}

/* ==========================================================================
   5. LAYOUT: FOOTER
   ========================================================================== */
.footer {
  position: relative;
  padding: 2rem 5% 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  max-width: 1500px;
  margin: 0 auto;
}

.footer::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100vw;
  max-width: 1600px;
  height: 1px;
  background-color: var(--border-color);
}

.footer-top {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.footer-left-info {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.footer-name {
  color: var(--text-main) !important;
  font-size: 1.25rem !important;
  font-weight: 700;
  line-height: 1.2;
}

.footer-text {
  color: var(--text-muted) !important;
  font-size: 1rem !important;
  line-height: 1.5;
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  width: 100%;
}

.footer-copy {
  color: var(--text-main) !important;
  font-size: 0.75rem !important;
  line-height: 1.4;
}

.mobile-br {
  display: block;
}

.social-links {
  display: flex;
  gap: 1.5rem;
  color: var(--text-muted);
}

/* ==========================================================================
   6. SECTION: HERO
   ========================================================================== */
.hero-wrapper {
  position: relative;
  width: 100%;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.bg-glow {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 20% 30%, var(--primary-glow) 0%, transparent 85%),
              radial-gradient(circle at 80% 60%, var(--secondary-glow) 0%, transparent 85%);
  filter: blur(30px);
  z-index: -1;
  pointer-events: none;
}

.hero {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  max-width: 100%;
  flex: 1;
  justify-content: center;
  padding: 8.5rem 5% 3rem; 
}

.hero-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.8rem;
  margin-bottom: 1.5rem;
  width: 100%;
}

.profile-img-container {
  position: relative;
  width: 110px;
  height: 110px;
  margin-top: 0;
  display: flex;
  justify-content: center;
}

.profile-circle {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle at center, transparent 20%, rgba(37, 99, 235, 0.4) 100%);
  border: 1px solid rgba(37, 99, 235, 0.8);
  box-shadow: inset 0 0 15px rgba(37, 99, 235, 0.6), 0 0 20px var(--primary-glow);
  z-index: 1;
}

.profile-img {
  position: absolute;
  bottom: 0;
  z-index: 2;
  width: 100%;
  height: 135%;
  object-fit: cover;
  object-position: top;
  border-radius: 0 0 55px 55px;
}

.hero-title {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.15;
}

.hero-description {
  color: var(--text-main);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
  max-width: 600px;
}

.hero-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  align-self: center;
  gap: 1.5rem;
  width: 100%;
}

.hero-buttons {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  max-width: 320px;
}

.btn {
  appearance: none;
  -webkit-appearance: none;
  font-family: inherit;
  padding: 0.8rem 1.2rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
  width: 100%;
}

.btn-action {
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.btn-action:hover {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: var(--text-muted);
}

/* ==========================================================================
   7. SECTION: SERVICES / CARDS
   ========================================================================== */
.services {
  padding: 6rem 5%;
  max-width: 1100px;
  margin: 0 auto;
}

.services-header {
  margin-bottom: 2.5rem;
  text-align: left;
}

.services-header h2 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.services-header p {
  color: var(--text-muted);
  font-size: 1rem;
}

.cards-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.card {
  background-color: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  padding: 1.5rem 1.8rem;
  transition: transform 0.3s ease, border-color 0.3s ease, background-color 0.3s ease;
}

.card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.12);
  background-color: rgba(255, 255, 255, 0.03);
}

.card-title {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 0.8rem;
}

.card-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.card h3 {
  font-size: 1.4rem;
}

.card-desc {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.2rem;
}

.card-list {
  list-style: none;
}

.card-list li {
  font-size: 1rem;
  margin-bottom: 0.6rem;
  position: relative;
  padding-left: 1.2rem;
  color: var(--text-main);
}

.card-list li::before {
  content: "•";
  color: var(--primary);
  font-weight: bold;
  font-size: 1.2rem;
  position: absolute;
  left: 0;
  top: -4px;
}

.card-list li strong {
  color: var(--text-main);
}

.services-actions {
  display: flex;
  justify-content: flex-end;
}

/* ==========================================================================
   8. SECTION: CONTACT
   ========================================================================== */
.contact-section {
  padding: 6rem 5%;
  max-width: 1100px;
  margin: 0 auto;
}

.contact-container {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 3rem 2rem;
  position: relative;
  overflow: hidden;
}

.contact-bg-glow {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at bottom left, var(--primary-glow) 0%, transparent 60%);
  z-index: 0;
  pointer-events: none;
}

.contact-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 3rem;
}

.contact-text h2 {
  font-size: 2rem;
  line-height: 1.2;
  margin-bottom: 1rem;
}

.contact-text p {
  color: var(--text-muted);
  font-size: 1rem;
}

.contact-form-wrapper {
  background-color: var(--bg-body);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group label {
  font-size: 0.85rem;
  color: var(--text-main);
  font-weight: 600;
}

.form-group input,
.form-group textarea {
  background-color: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.8rem 1rem;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-glow);
}

.form-group textarea {
  resize: vertical;
}

.form-submit {
  width: 100%;
  justify-content: center;
  margin-top: 0.5rem;
}


/* ==========================================================================
   9. MEDIA QUERIES (TABLET & HYBRID) - > 768px
   ========================================================================== */
@media (min-width: 768px) {
  /* GLOW */
  .bg-glow {
    background: radial-gradient(circle at 35% 30%, var(--primary-glow) 0%, transparent 60%),
                radial-gradient(circle at 65% 50%, var(--secondary-glow) 0%, transparent 65%);
  }

  /* HERO HYBRID (Desktop style) */
  .hero {
    align-items: flex-start;
    text-align: left;
    max-width: 1000px;
    margin: 0 auto;
    padding: 6rem 5% 3rem;
    justify-content: center;
  }

  .hero-header {
    flex-direction: row;
    align-items: center;
    gap: 2.5rem;
    margin-bottom: 2rem;
  }

  .profile-img-container {
    width: 120px;
    height: 120px;
    margin-top: 0;
    transform: translateY(-5px);
    flex-shrink: 0;
  }

  .profile-img {
    border-radius: 0 0 60px 60px;
  }

  .hero-title {
    font-size: 3.3rem;
  }

  .hero-description {
    font-size: 1.2rem;
    max-width: 700px;
  }

  .hero-actions {
    flex-direction: row;
    align-items: center;
    gap: 3rem; 
  }

  .hero-buttons {
    flex-direction: row;
    width: auto;
    max-width: none;
    gap: 1.5rem; 
  }

  .hero-actions .social-links {
    gap: 2rem; 
  }

  .btn {
    width: auto;
  }

  .divider {
    display: block;
    color: var(--border-color);
  }

  /* SERVICES HYBRID */
  .cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  /* LA MAGIA: L'ultima card riempie il vuoto occupando due colonne */
  .card:first-child {
    grid-column: span 2; 
  }
}

/* ==========================================================================
   10. MEDIA QUERIES (DESKTOP) - > 900px
   ========================================================================== */
@media (min-width: 900px) {
  /* NAVBAR DESKTOP */
  .navbar {
    max-width: 1500px;
    margin: 0 auto;
    padding: max(1rem, env(safe-area-inset-top)) 5% 1rem 5%;
  }

  .navbar::before {
    width: 100vw;
    left: 50%;
    transform: translateX(-50%);
    height: 100% !important; 
  }

  .hamburger {
    display: none;
  }

  .nav-menu {
    position: static;
    flex-direction: row;
    background-color: transparent;
    border: none;
    padding: 0;
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    flex: 1;
    justify-content: space-between;
    margin-left: 4rem;
    margin-top: 0.15rem;
  }

  .nav-links {
    flex-direction: row;
    gap: 4rem;
  }

  /* HERO DESKTOP */
  .hero-title {
    font-size: 3.5rem;
  }

  .hero-description {
    font-size: 1.25rem;
    max-width: 800px;
  }

  /* SERVICES DESKTOP */
  .services {
    max-width: 1500px;
    padding: 6rem 5%;
  }

  .cards-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .card:first-child {
    grid-column: span 1; 
  }

  /* CONTACT DESKTOP */
  .contact-section {
    max-width: 1500px;
    padding: 6rem 5%;
  }

  .contact-content {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 5rem;
  }

  .contact-text {
    flex: 1;
  }

  .contact-text h2 {
    font-size: 2.8rem;
  }

  .contact-form-wrapper {
    flex: 1;
    max-width: 550px;
    padding: 2.5rem;
  }

  .form-submit {
    width: auto;
    align-self: flex-end;
  }

  /* FOOTER DESKTOP */
  .footer {
    padding: 2.5rem 5% 1.5rem;
    gap: 1.5rem;
    max-width: 1500px;
  }

  .footer-top {
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
  }

  .footer-right-info {
    max-width: 350px;
    text-align: left;
    margin-top: 0.15rem;
  }

  .mobile-br {
    display: none;
  }
}

/* ==========================================================================
   11. MEDIA QUERIES (LARGE DESKTOP) - > 1200px
   ========================================================================== */
@media (min-width: 1200px) {
  .navbar {
    padding: 1rem 2%;
  }

  .services {
    padding: 6rem 2%;
  }

  .contact-section {
    padding: 6rem 2%;
  }

  .footer {
    padding: 2.5rem 2% 1.5rem;
  }
}