:root {
  --bg: #0c1a2a;
  --bg-alt: #11243a;
  --text: #e8edf2;
  --muted: #b9c6d8;
  --primary: #2ea3ff;
  --secondary: #f0b429;
  --card: #12263f;
  --border: #20364f;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
}

.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(12,26,42,0.95);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
}
.header-wrap { display: flex; align-items: center; justify-content: space-between; }
.logo { color: var(--text); text-decoration: none; font-weight: 700; letter-spacing: 0.5px; font-size: 1.6rem; line-height: 1.2; }

/* Logo SVG */
.logo-svg {
  display: block;
  line-height: 0;
}
.logo-svg img {
  height: 100px;
  width: auto;
  display: block;
}

.nav-toggle { display: none; background: none; border: 1px solid var(--border); color: var(--text); padding: 8px 10px; border-radius: 6px; }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 18px; }
.site-nav a { color: var(--text); text-decoration: none; padding: 12px 10px; border-radius: 6px; }
.site-nav a:hover { background: var(--card); }
.site-nav .active { color: var(--primary); }
.site-nav .cta { background: var(--secondary); color: #08121f; font-weight: 600; }

/* Hero */
.hero, .page-hero, .cta-band {
  position: relative;
  background: #0b1726;
  background-image: var(--hero-image);
  background-size: cover;
  background-position: center;
  color: #fff;
}
.hero { min-height: 72vh; display: grid; place-items: center; overflow: hidden; }

/* Carousel Hero */
.carousel-hero {
  background-image: none !important;
}
.carousel-track {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}
.carousel-slide {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity 1.5s ease-in-out;
  z-index: 1;
}
.carousel-slide.active {
  opacity: 1;
}
.carousel-hero .overlay {
  z-index: 2; /* Sopra le slide */
}
.hero-content {
  position: relative;
  z-index: 3; /* Sopra tutto */
}

.hero .overlay { background: none; }
.page-hero { min-height: 42vh; display: grid; place-items: center; }
.cta-band { min-height: 36vh; display: grid; place-items: center; }
.overlay { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(8,18,31,0.60), rgba(8,18,31,0.75)); }
.hero-content, .cta-content { position: relative; z-index: 2; text-align: center; }

/* Animation for CTA button */
@keyframes pulse-attention {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(240, 180, 41, 0.7);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 0 0 15px rgba(240, 180, 41, 0);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(240, 180, 41, 0);
  }
}

.cta-content .btn-secondary {
  animation: pulse-attention 2s infinite;
}
.hero h1 { font-size: 2.4rem; margin: 0 0 10px; text-shadow: 0 2px 4px rgba(0,0,0,0.5); }
.hero p { max-width: 800px; margin: 0 auto 18px; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,0.5); }
.hero-actions { display: flex; gap: 22px; justify-content: center; flex-wrap: wrap; }

/* Hero Split (Text + Image) */
.hero-split .container {
  display: grid;
  gap: 40px;
  align-items: center;
  text-align: left;
}
.hero-split .hero-text {
  max-width: 600px;
}
.hero-split .hero-image img {
  width: 100%;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

@media (min-width: 992px) {
  .hero-split .container {
    grid-template-columns: 1fr 1fr;
  }
}

/* Migliora leggibilità page-hero (es. Contatti) */
.page-hero .overlay { background: none; }
.page-hero .container { text-align: center; }

/* Uniform typography for all page heros (Case History style) */
.page-hero h1, .contacts-hero h1, .case-hero h1 { 
  font-size: 3rem; 
  margin-bottom: 20px; 
  font-weight: 800;
  text-shadow: 0 4px 10px rgba(0,0,0,0.8);
  letter-spacing: -0.5px;
  color: #ffffff;
}
.page-hero p, .contacts-hero p, .case-hero p { 
  font-size: 1.3rem; 
  line-height: 1.6; 
  font-weight: 600;
  max-width: 900px;
  margin: 0 auto;
  text-shadow: 0 2px 4px rgba(0,0,0,0.8);
  color: #ffffff;
}

/* Specific Hero Backgrounds and Overlays */
.contacts-hero .overlay { background: none; }
.contacts-hero .container { 
  background: transparent; 
  padding: 24px 20px;
}

/* Case History Hero Specifics */
.case-hero {
  background-image: url('https://images.unsplash.com/photo-1454165804606-c3d57bc86b40?auto=format&fit=crop&w=1920&q=80');
  background-size: cover;
  background-position: center;
}
.case-hero .overlay {
  background: none;
}


/* Buttons */
.btn { display: inline-block; padding: 12px 16px; border-radius: 8px; text-decoration: none; font-weight: 600; }
.btn-primary { background: var(--primary); color: #08121f; }
.btn-secondary { background: var(--secondary); color: #08121f; }
.btn:hover { filter: brightness(1.07); }

.hero .btn-primary { background: #1f78d1; color: #ffffff; }

/* Sections */
.section { padding: 60px 0; }
.section.alt { background: var(--bg-alt); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section h2 { margin-top: 0; font-size: 1.8rem; margin-bottom: 40px; text-align: center; }

/* Cards */
.grid { display: grid; gap: 30px; }
.cards { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }

@media (min-width: 992px) {
  .cards { grid-template-columns: repeat(4, 1fr); }
}

.card { 
  background: var(--card); 
  border: 1px solid var(--border); 
  border-radius: 12px; 
  overflow: hidden; 
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  display: flex;
  flex-direction: column;
  height: 100%;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
.card:hover { 
  transform: translateY(-4px); 
  border-color: var(--primary);
  box-shadow: 0 8px 30px rgba(46, 163, 255, 0.15);
}
.card img { width: 100%; height: 180px; object-fit: cover; }
.card-body { 
  padding: 20px; 
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}
.card-content {
  flex-grow: 1;
}
.grid.cards .card-body {
  min-height: 260px;
}
.card h3 { 
  margin: 0 0 10px; 
  font-size: 1.25rem; 
  color: var(--primary); 
  min-height: 5em; /* Increased to accommodate long titles (4 lines) */
  display: flex;
  align-items: flex-start; /* Align text to top */
}
.card p { margin: 0; color: var(--muted); font-size: 0.95rem; }
.card-cta {
  display: inline-block;
  margin-top: 18px;
  margin-bottom: 10px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(46,163,255,0.1);
  color: var(--primary);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.card:hover .card-cta {
  background: var(--primary);
  color: #08121f;
}

.card-link {
  text-decoration: none;
  color: inherit;
}

/* Giurisdizioni + Homepage – animazione ingresso card */
.country-card,
.home-service-card {
  opacity: 0;
  transform: translateY(32px) scale(0.94);
  box-shadow: 0 0 0 rgba(46,163,255,0);
  border-color: rgba(32,54,79,1);
  transition:
    opacity 0.6s ease,
    transform 0.6s ease,
    box-shadow 0.6s ease,
    border-color 0.6s ease;
}
.country-card.is-visible,
.home-service-card.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  box-shadow: 0 14px 40px rgba(0,0,0,0.55);
  border-color: rgba(46,163,255,0.6);
}
.countries .country-card:nth-child(1) { transition-delay: 0.00s; }
.countries .country-card:nth-child(2) { transition-delay: 0.30s; }
.countries .country-card:nth-child(3) { transition-delay: 0.60s; }
.countries .country-card:nth-child(4) { transition-delay: 0.90s; }

.home-services .home-service-card:nth-child(1) { transition-delay: 0.00s; }
.home-services .home-service-card:nth-child(2) { transition-delay: 0.35s; }
.home-services .home-service-card:nth-child(3) { transition-delay: 0.70s; }
.home-services .home-service-card:nth-child(4) { transition-delay: 1.05s; }

.home-services .home-service-card {
  opacity: 0;
  transform: translateY(-120px);
  transition:
    opacity 0.9s ease-out,
    transform 0.9s ease-out,
    box-shadow 0.75s ease,
    border-color 0.75s ease;
}

/* Removed directional overrides so all cards slide down */


.home-services .home-service-card.is-visible {
  opacity: 1;
  transform: translate(0, 0);
  box-shadow: 0 18px 50px rgba(0,0,0,0.7);
}

.case-block {
  opacity: 0;
  transform: translateX(0);
  background: var(--card);
  padding: 24px;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  margin-bottom: 80px;
  transition:
    opacity 0.6s ease-out,
    transform 0.6s ease-out,
    box-shadow 0.4s ease,
    border-color 0.4s ease;
}

.case-block:last-of-type {
  margin-bottom: 0;
}

.case-block:hover {
  border-color: var(--primary);
  box-shadow: 0 8px 30px rgba(46, 163, 255, 0.15);
}

.case-block:nth-of-type(1) { transition-delay: 0.00s; }
.case-block:nth-of-type(2) { transition-delay: 0.25s; }
.case-block:nth-of-type(3) { transition-delay: 0.50s; }
.case-block:nth-of-type(4) { transition-delay: 0.75s; }

.case-block:nth-of-type(1),
.case-block:nth-of-type(3) {
  transform: translateX(-120px);
}

.case-block:nth-of-type(2),
.case-block:nth-of-type(4) {
  transform: translateX(120px);
}

.case-block.is-visible {
  opacity: 1;
  transform: translateX(0);
}

/* FAQ Card Styling */
.faq-card .card-body { padding: 40px; }
.faq-card h2 { text-align: left; margin-top: 40px; margin-bottom: 25px; font-size: 1.5rem; border-bottom: 1px solid var(--border); padding-bottom: 10px; }
.faq-card h2:first-of-type { margin-top: 0; }
.faq-card h3 { font-size: 1.15rem; margin-top: 35px; margin-bottom: 15px; min-height: auto; }
.faq-card h3:first-of-type { margin-top: 15px; }
.faq-card p { margin-bottom: 35px; }

/* Case History Thumbnails Override */
.card .case-thumb {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 4px; /* Optional: adds slight rounding */
  margin-bottom: 1rem; /* Space between thumb and title */
}

/* Feature & Two Col Layout */
.feature { display: grid; gap: 40px; align-items: center; }
.two-col { display: grid; gap: 40px; }

@media(min-width: 768px) {
  .feature { grid-template-columns: 1fr 1fr; }
  .feature-content { order: -1; }
  .two-col { grid-template-columns: 1fr 1fr; align-items: center; }
}
.feature-media img, .img-col img { width: 100%; border-radius: 12px; border: 1px solid var(--border); box-shadow: 0 4px 20px rgba(0,0,0,0.2); }
.feature-content h2 { text-align: left; margin-bottom: 20px; }
.feature-content p { color: var(--muted); margin-bottom: 24px; font-size: 1.05rem; }

.contact { align-items: flex-start; }
.contact h2 { text-align: left; margin-bottom: 24px; }
.contact .form-row { margin-bottom: 16px; }
.contact label { display: block; margin-bottom: 6px; font-size: 0.9rem; color: var(--muted); }
.contact input,
.contact textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #08121f;
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
}
.contact textarea { resize: vertical; min-height: 140px; }
.contact input:focus,
.contact textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 1px rgba(46,163,255,0.4);
}
.form-actions { margin-top: 6px; }
.form-note { margin-top: 10px; font-size: 0.8rem; color: var(--muted); }
.contact-details { margin-top: 16px; font-size: 0.95rem; color: var(--muted); }
.contact-details p { margin: 0 0 6px; }

/* Footer */
.site-footer { background: #050b14; padding: 60px 0 20px; border-top: 1px solid var(--border); font-size: 0.9rem; }
.footer-wrap { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 20px; }
.footer-links { display: flex; gap: 20px; }
.footer-links a { color: var(--muted); text-decoration: none; font-size: 0.8rem; }
.footer-wrap strong { font-size: 1.2rem; }
.footer-links a:hover { color: var(--primary); }
.footer-social { display: flex; gap: 14px; align-items: center; }
.footer-social a { display: inline-flex; align-items: center; justify-content: center; }
.footer-social svg { width: 22px; height: 22px; fill: var(--muted); transition: fill 0.2s ease; }
.footer-social a:hover svg { fill: var(--primary); }
.footer-grid { display: grid; gap: 40px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-bottom: 40px; }
.footer-col h4 { color: #fff; margin-bottom: 16px; }
.footer-col ul { list-style: none; padding: 0; margin: 0; }
.footer-col li { margin-bottom: 10px; }
.footer-col a { color: var(--muted); text-decoration: none; }
.footer-col a:hover { color: var(--primary); }
.footer-bottom { text-align: center; color: #5a6b80; font-size: 0.85rem; border-top: 1px solid var(--border); padding-top: 20px; }

/* WhatsApp Widget */
.whatsapp-launcher {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 60px;
  height: 60px;
  background-color: #25d366;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  transition: transform 0.3s ease;
}
.whatsapp-launcher:hover {
  transform: scale(1.1);
}
.whatsapp-launcher svg {
  width: 35px;
  height: 35px;
  fill: #fff;
}

/* Mobile Menu + footer/mobile tweaks */
@media (max-width: 768px) {
  .nav-toggle { display: block; }
  .site-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 20px;
  }
  .site-nav.open { display: block; }
  .site-nav ul { flex-direction: column; gap: 10px; }
  .site-nav a { display: block; padding: 10px 0; }
  .site-nav .cta { text-align: center; margin-top: 10px; }

  .footer-wrap {
    align-items: flex-start;
    gap: 16px 0;
  }
  .footer-links {
    flex-wrap: wrap;
    row-gap: 8px;
  }
  .footer-social {
    margin-left: auto;
  }

  .whatsapp-launcher {
    left: 20px;
    right: auto;
  }

  .section {
    padding: 40px 0;
  }

  .hero h1 {
    font-size: 2rem;
  }

  .page-hero h1 {
    font-size: 1.8rem;
  }

  .hero p,
  .page-hero p {
    font-size: 0.98rem;
  }

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

  .card img {
    height: 150px;
  }

  .grid.cards .card-body {
    min-height: auto;
  }

  .card-body {
    padding: 16px;
  }

  .card h3 {
    font-size: 1.1rem;
    min-height: 0;
  }

  .card p {
    font-size: 0.9rem;
  }
}
