/*
 * ATIPIX Website Stylesheet
 *
 * Questo file definisce lo stile generale del sito web di ATIPIX.
 * Il design si ispira all'estetica minimalista di Apple, con un uso
 * bilanciato del nero, del bianco e di accenti in palette CMYK. I
 * componenti sono modulati per essere completamente responsive e
 * accessibili, rispettando i requisiti WCAG di contrasto e navigazione.
 */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

/* Variabili di colore e tipografia */
:root {
  /* Palette chiara ispirata ai poster geometrici di design italiano */
  /* Colore di sfondo dell'intero sito, tonalità molto chiara */
  --color-bg: #f5f5f7;
  --color-surface: #ffffff;
  --color-text: #1a1a1a;
  --color-muted: #666666;
  /* Colori di accento: blu e rosso intensi */
  --color-accent-cyan: #0057b8; /* blu */
  --color-accent-magenta: #d71440; /* rosso */
  --color-accent-yellow: #ffd500;
  --color-accent-red: #d71440;
  /* Overlay chiaro per le hero */
  --overlay-gradient-start: rgba(255, 255, 255, 0.85);
  --overlay-gradient-end: rgba(255, 255, 255, 0.6);
  --font-main: 'Outfit', sans-serif;
}

/* ------------------------------------------------------------------ */
/* Stili personalizzati aggiuntivi */

/* Illustrazione nella pagina cookie posizionata in basso a destra */
/* Nasconde l'illustrazione decorativa della cookie policy */
.cookie-illustration {
  display: none;
}

/* Illustrazione nella pagina contatti */
.contact-illustration {
  text-align: center;
  margin-top: 2rem;
}
.contact-illustration img {
  max-width: 60%;
  height: auto;
}

/* Allinea al centro l’intestazione della sezione contatti */
.contact-section h2 {
  text-align: center;
}

/* Paragrafo alternativo di contatto centrato */
.alternative-contact {
  text-align: center;
  color: var(--color-muted);
  font-size: 0.9rem;
  margin-top: 2rem;
}

/* Reset e base */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-main);
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
  /* Gestione delle transizioni di pagina: inizialmente trasparente per effetto fade-in */
  opacity: 0;
  transition: opacity 0.5s ease-in-out;
}

/* Quando la pagina è caricata, la classe .loaded rende visibile il body */
body.loaded {
  opacity: 1;
}

/* Classe applicata al body quando l'utente clicca su un link interno per eseguire la dissolvenza in uscita */
body.fade-out {
  opacity: 0;
}

a {
  color: var(--color-accent-cyan);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  /* Rimuove la sottolineatura dai link quando l'utente passa il mouse sopra */
  text-decoration: none;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.2;
  margin-top: 0;
  margin-bottom: 0.5em;
}

p {
  margin-top: 0;
  margin-bottom: 1em;
}

/* Navbar */
header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  backdrop-filter: blur(8px);
  /* Header chiaro semi-trasparente */
  background: rgba(255, 255, 255, 0.8);
}

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
}

.logo img {
  display: block;
  /* Imposta la larghezza di base del logo a 200px mantenendo le proporzioni */
  width: 200px;
  height: auto;
}

/* Navigazione principale */
.nav-menu {
  list-style: none;
  display: flex;
  gap: 1.5rem;
  margin: 0;
  padding: 0;
}

.nav-menu li a {
  color: var(--color-text);
  font-size: 1rem;
  font-weight: 500;
}

.nav-menu li a:hover {
  color: var(--color-accent-magenta);
}

/* Toggle per mobile */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 24px;
  height: 18px;
  cursor: pointer;
  border: none;
  background: none;
}

.nav-toggle span {
  display: block;
  width: 100%;
  height: 2px;
  /* Barre del menu burger in colore testo (scuro) */
  background: var(--color-text);
}

/* Hero section */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--color-text);
  overflow: hidden;
}

.hero picture,
.hero img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -2;
}

/* Gradient overlay on heroes */
.hero::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  background: linear-gradient(var(--overlay-gradient-start), var(--overlay-gradient-end));
}

.hero .hero-content {
  max-width: 900px;
  padding: 2rem;
}

.hero h1 {
  font-size: clamp(2rem, 6vw, 4.5rem);
  margin-bottom: 1rem;
  /* Rimuove l'ombra scura per la versione chiara */
  text-shadow: 0 2px 4px rgba(255, 255, 255, 0.5);
}

.hero p {
  font-size: clamp(1rem, 2.5vw, 1.5rem);
  margin-bottom: 2rem;
}

.button {
  display: inline-block;
  background: var(--color-accent-cyan);
  color: var(--color-surface);
  padding: 0.8rem 1.8rem;
  border-radius: 30px;
  font-weight: 600;
  transition: background 0.3s ease;
}

.button:hover {
  background: var(--color-accent-magenta);
  color: var(--color-surface);
}

/* Intro section */
.intro {
  padding: 4rem 1rem;
  max-width: 800px;
  margin: 0 auto;
  text-align: center;
}

.intro p {
  font-size: 1.25rem;
  color: var(--color-muted);
}

/* Servizi preview */
.services-preview {
  /* Griglia dei servizi: più spazio e dimensioni maggiori */
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 2.5rem;
  padding: 6rem 1rem;
  max-width: 1300px;
  margin: 0 auto;
}

.service-card {
  position: relative;
  /* Aumenta l'altezza per dare maggior risalto ai servizi */
  height: 380px;
  border-radius: 20px;
  overflow: hidden;
  cursor: pointer;
}

.service-card picture,
.service-card img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease;
}

.service-card:hover picture img {
  transform: scale(1.1);
}

/* Migliora le prestazioni del parallax segnalando che l'immagine cambierà trasformazioni */
.hero picture img {
  will-change: transform;
}

.service-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  /* Overlay chiaro per rendere leggibile il testo sui fondali chiari */
  background: linear-gradient(rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0.7));
  z-index: 1;
}

.service-card .service-content {
  position: relative;
  z-index: 2;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 1.2rem;

  /* Colori di testo specifici per il tema chiaro */
}

/* Testi nelle card dei servizi */
.service-card .service-content h3 {
  color: var(--color-text);
  margin-bottom: 0.3rem;
}

.service-card .service-content p {
  color: var(--color-muted);
  color: var(--color-text);
}

.service-card h3 {
  font-size: 1.4rem;
  margin: 0;
}

.service-card p {
  font-size: 0.9rem;
  margin-top: 0.25rem;
  color: var(--color-muted);
}

.service-card a {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: var(--color-accent-yellow);
  font-weight: 600;
}

/* Sezioni generiche */
.section {
  padding: 4rem 1rem;
  max-width: 900px;
  margin: 0 auto;
}

.section h2 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.section h3 {
  font-size: 1.8rem;
  margin-top: 2rem;
  margin-bottom: 0.5rem;
}

.section p {
  font-size: 1rem;
  color: var(--color-muted);
}

/* Modulo contatti */
form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 600px;
  margin: 0 auto;
}

form label {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

form input,
form textarea {
  width: 100%;
  padding: 0.8rem;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  background: var(--color-surface);
  color: var(--color-text);
}

form textarea {
  min-height: 150px;
  resize: vertical;
}

form .checkbox-group {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  flex-wrap: nowrap;
  font-size: 0.9rem;
  color: var(--color-muted);
  text-align: left;
  /* Mantiene tutto il contenuto allineato a sinistra rispetto al modulo */
  justify-content: flex-start;
}

form .checkbox-group input {
  margin-right: 0.5rem;
  margin-top: 0.2rem;
}

form button {
  align-self: flex-start;
  padding: 0.8rem 1.6rem;
  background: var(--color-accent-cyan);
  color: var(--color-surface);
  border: none;
  border-radius: 30px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s ease;
}

form button:hover {
  background: var(--color-accent-magenta);
}

/* Footer */
footer {
  background: var(--color-surface);
  color: var(--color-muted);
  padding: 3rem 1rem;
  font-size: 0.875rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
}

.footer-grid div {
  line-height: 1.4;
}

.footer-grid a {
  color: var(--color-muted);
}

.footer-grid a:hover {
  color: var(--color-accent-cyan);
}

.footer-bottom {
  margin-top: 2rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--color-muted);
}

/* Cookie banner */
.cookie-banner {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  /* riduci la larghezza del banner al 40% (60% in meno) e centrala orizzontalmente */
  width: 40%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.95);
  color: var(--color-text);
  padding: 1rem;
  display: none;
  flex-direction: column;
  gap: 1rem;
  z-index: 9999;
}

/* Su schermi piccoli, allarga il banner per garantire la leggibilità */
@media (max-width: 768px) {
  .cookie-banner {
    width: 90%;
    left: 50%;
    transform: translateX(-50%);
  }
}

.cookie-banner.show {
  display: flex;
}

.cookie-banner p {
  margin: 0;
  font-size: 0.875rem;
}

.cookie-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.cookie-actions button {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-weight: 600;
  flex: 1 0 auto;
}

/* Bottone accetta: nero con testo bianco */
.cookie-accept {
  background: #000000;
  color: #ffffff;
}

/* Bottone rifiuta: grigio scuro con testo bianco */
.cookie-reject {
  background: #4d4d4d;
  color: #ffffff;
}

/* Bottone gestisci: grigio chiaro con testo nero */
.cookie-manage {
  background: #d3d3d3;
  color: #000000;
}

/* Cookie modal */
.cookie-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.cookie-modal.show {
  display: flex;
}

.cookie-modal .modal-content {
  background: #ffffff;
  color: #000000;
  padding: 2rem;
  border-radius: 10px;
  max-width: 500px;
  width: 90%;
}

.cookie-modal h3 {
  margin-top: 0;
  margin-bottom: 1rem;
}

.cookie-modal .preferences {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.cookie-modal .preferences label {
  font-size: 0.9rem;
  display: flex;
  align-items: center;
}

.cookie-modal input[type="checkbox"] {
  margin-right: 0.5rem;
}

.cookie-modal .modal-buttons {
  margin-top: 1.5rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* Video background for the homepage hero */
.hero .video-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: -3;
}

/* Stili condivisi per iframe e video all'interno del contenitore video-bg */
.hero .video-bg iframe,
.hero .video-bg video {
  width: 100%;
  height: 100%;
  pointer-events: none;
  /* Il video copre interamente l'area della hero */
  object-fit: cover;
}

/* Adattamento del video su dispositivi mobili: l’altezza copre il 100% del contenitore */
@media (max-width: 768px) {
  .hero .video-bg iframe,
  .hero .video-bg video {
    height: 100%;
  }
}

.cookie-modal button {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 5px;
  font-weight: 600;
  cursor: pointer;
}

/* Animazioni per i testi principali nelle sezioni hero
   Le frasi con dimensioni maggiori (come titoli e sottotitoli) verranno animate con un effetto di fade in + movimento verso l'alto. */
/* Reset delle animazioni sui contenitori dei testi hero. Le animazioni verranno applicate parola per parola tramite le classi .fade-word. */
.hero-content h1,
.hero-content p {
  opacity: 1;
  transform: none;
  animation: none;
}

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* WhatsApp button styling */
.whatsapp-btn {
  display: inline-block;
  background: #25D366;
  color: #ffffff;
  padding: 0.8rem 1.6rem;
  border-radius: 30px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.3s ease;
  margin-top: 1.5rem;
}

.whatsapp-btn:hover {
  background: #1ebe57;
}

/* Animazione parola per parola per i testi delle sezioni hero */
.fade-word {
  opacity: 0;
  transform: translateY(20px);
  display: inline-block;
  /* Aggiunge margine a destra per evitare che le parole risultino attaccate */
  margin-right: 0.25rem;
  /* Durata dell'animazione estesa di 1 secondo rispetto alla versione precedente */
  animation: fadeInWord 1.6s ease-out forwards;
}

@keyframes fadeInWord {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.cookie-modal .save-btn {
  background: var(--color-accent-cyan);
  color: var(--color-bg);
}

.cookie-modal .close-btn {
  background: #444444;
  color: #ffffff;
}

/* Responsiveness */
@media (max-width: 768px) {
  .navbar {
    padding: 0.5rem 1rem;
  }
  .nav-menu {
    position: fixed;
    top: 60px;
    right: -100%;
    width: 240px;
    height: calc(100vh - 60px);
    flex-direction: column;
    background: var(--color-bg);
    padding: 1.5rem;
    gap: 1rem;
    transition: right 0.3s ease;
  }
  .nav-menu.open {
    right: 0;
  }
  .nav-toggle {
    display: flex;
  }
  .hero h1 {
    font-size: clamp(2rem, 10vw, 3.2rem);
  }
  .hero p {
    font-size: clamp(1rem, 4vw, 1.2rem);
  }
  .service-card h3 {
    font-size: 1.2rem;
  }
}