/* FILE: css/main.css */

/* ============================================================
   RESET & BASE
   Reset minimalista ispirato a Andy Bell, calibrato per GEM
   ============================================================ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  /* Scroll fluido per i link di navigazione */
  scroll-behavior: smooth;
  /* Evita zoom automatico su iOS quando si focalizza un input */
  -webkit-text-size-adjust: 100%;
  font-size: 16px;
}

body {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: var(--text-base);
  line-height: 1.7;
  color: var(--mahogany);
  background-color: var(--cream);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Impedisce lo scroll orizzontale accidentale su mobile */
  overflow-x: hidden;
}

img, svg {
  display: block;
  max-width: 100%;
}

ul, ol {
  list-style: none;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
  font-family: inherit;
  border: none;
  background: none;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
}

/* Riduce le animazioni per chi ha questa preferenza di sistema */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}


/* ============================================================
   DESIGN TOKENS — variabili CSS centralizzate
   ============================================================ */

:root {
  /* --- Palette cromatica GEM --- */
  --dusty-rose:  #e8c9bc;   /* rosa cipria — accento caldo */
  --taupe:       #c4a882;   /* taupe — elemento secondario */
  --mahogany:    #6b4c3b;   /* mogano scuro — testo principale */
  --cream:       #faf5f0;   /* crema morbida — background */
  --gold:        #c9a84c;   /* oro champagne — dettagli e divisori */

  /* Toni derivati per uso interno */
  --mahogany-light: #8a6555;   /* mogano più chiaro per hover */
  --cream-dark:     #f0e8e0;   /* crema leggermente più scura per sfondi alternati */
  --taupe-light:    #d8c4aa;   /* taupe chiaro per bordi */

  /* --- Tipografia --- */
  --font-heading: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-body:    'Lato', 'Helvetica Neue', Arial, sans-serif;

  /* Scala tipografica (mobile-first) */
  --text-xs:   0.75rem;    /*  12px */
  --text-sm:   0.875rem;   /*  14px */
  --text-base: 1rem;       /*  16px */
  --text-md:   1.125rem;   /*  18px */
  --text-lg:   1.25rem;    /*  20px */
  --text-xl:   1.5rem;     /*  24px */
  --text-2xl:  2rem;       /*  32px */
  --text-3xl:  2.5rem;     /*  40px */
  --text-4xl:  3.5rem;     /*  56px */
  --text-hero: 5rem;       /*  80px */

  /* --- Spaziatura --- */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
  --space-32: 8rem;

  /* --- Layout --- */
  --container-max:   1160px;
  --container-pad:   var(--space-6);    /* padding laterale mobile */
  --navbar-height:   72px;

  /* --- Bordi e raggio --- */
  --border-width:    1px;
  --border-color:    var(--taupe-light);
  --border-gold:     var(--gold);
  --radius-sm:       2px;
  --radius-md:       4px;
  --radius-lg:       8px;

  /* --- Ombre — volutamente molto sottili --- */
  --shadow-xs: 0 1px 3px rgba(107, 76, 59, 0.06);
  --shadow-sm: 0 2px 8px rgba(107, 76, 59, 0.08);
  --shadow-md: 0 4px 16px rgba(107, 76, 59, 0.10);

  /* --- Transizioni --- */
  --transition-fast:   150ms ease;
  --transition-base:   250ms ease;
  --transition-slow:   400ms ease;

  /* --- Z-index scale --- */
  --z-base:    10;
  --z-overlay: 20;
  --z-sticky:  30;
  --z-modal:   50;
}


/* ============================================================
   LAYOUT UTILITY — container e griglia di base
   ============================================================ */

.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-pad);
}

@media (min-width: 768px) {
  .container {
    padding-inline: var(--space-10);
  }
}

@media (min-width: 1024px) {
  .container {
    padding-inline: var(--space-12);
  }
}


/* ============================================================
   TIPOGRAFIA GLOBALE
   ============================================================ */

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 500;
  line-height: 1.2;
  color: var(--mahogany);
}

p {
  max-width: 68ch;   /* lunghezza riga ottimale per leggibilità */
  line-height: 1.75;
}


/* ============================================================
   COMPONENTE: SEZIONI — header comune
   ============================================================ */

.section {
  padding-block: var(--space-20);
}

@media (min-width: 768px) {
  .section {
    padding-block: var(--space-24);
  }
}

@media (min-width: 1024px) {
  .section {
    padding-block: var(--space-32);
  }
}

.section__header {
  text-align: center;
  margin-bottom: var(--space-16);
}

.section__label {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: var(--space-3);
  /* Annulla max-width: 68ch ereditato da p{} — senza questo il blocco
     si allinea a sinistra e text-align:center risulta off-center */
  max-width: none;
}

.section__title {
  font-size: var(--text-2xl);
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--mahogany);
}

@media (min-width: 768px) {
  .section__title {
    font-size: var(--text-3xl);
  }
}

.section__divider {
  display: block;
  width: 48px;
  height: 1px;
  background-color: var(--gold);
  margin: var(--space-5) auto;
  opacity: 0.7;
}

.section__subtitle {
  font-size: var(--text-md);
  color: var(--mahogany-light);
  max-width: 52ch;
  margin-inline: auto;
  line-height: 1.7;
}


/* ============================================================
   COMPONENTE: BOTTONI
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-8);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color var(--transition-base),
              color var(--transition-base),
              border-color var(--transition-base);
  /* Dimensione minima touch target: 44×44px */
  min-height: 44px;
}

/* Variante outline per il hero */
.btn--ghost {
  background: transparent;
  border: 1px solid rgba(250, 245, 240, 0.6);
  color: var(--cream);
}

.btn--ghost:hover,
.btn--ghost:focus-visible {
  background: rgba(250, 245, 240, 0.12);
  border-color: rgba(250, 245, 240, 0.9);
}

/* Variante piena per il form */
.btn--primary {
  background: var(--mahogany);
  color: var(--cream);
  border: 1px solid var(--mahogany);
}

.btn--primary:hover,
.btn--primary:focus-visible {
  background: var(--mahogany-light);
  border-color: var(--mahogany-light);
}

.btn--primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn__arrow {
  transition: transform var(--transition-base);
}

.btn:hover .btn__arrow {
  transform: translateY(3px);
}

/* Focus visibile per navigazione da tastiera */
.btn:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}


/* ============================================================
   ANIMAZIONE FADE-IN allo scroll
   (attivata da JS tramite la classe .is-visible)
   ============================================================ */

.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity var(--transition-slow),
              transform var(--transition-slow);
}

.fade-in.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Delay in cascata per le card della griglia */
.fade-in:nth-child(2) { transition-delay: 80ms; }
.fade-in:nth-child(3) { transition-delay: 160ms; }
.fade-in:nth-child(4) { transition-delay: 240ms; }
.fade-in:nth-child(5) { transition-delay: 320ms; }
.fade-in:nth-child(6) { transition-delay: 400ms; }
