/* ============================================
   BASE.CSS  v3.0
   Design system — slate + teal
   Font: DM Sans (heading) + Inter (body)
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;0,9..40,800;1,9..40,400&family=Inter:wght@400;500;600&display=swap');

/* ============================================
   DESIGN TOKENS
   ============================================ */

:root {

  /* --- Primario: teal --- */
  --color-primary:         #0EA5A0;
  --color-primary-dark:    #0A7E7A;
  --color-primary-deeper:  #086560;
  --color-primary-light:   #99F6E4;
  --color-primary-subtle:  #F0FDFA;
  --color-primary-muted:   rgba(14,165,160,0.10);

  /* --- Accento complementare: blu oceano --- */
  --color-accent:          #0891B2;
  --color-accent-dark:     #0772A0;

  /* --- Urgenza / emergenza --- */
  --color-urgent:          #E85D26;
  --color-urgent-dark:     #C24A1A;
  --color-urgent-light:    #FFF1EB;

  /* --- Neutrali slate --- */
  --color-white:           #FFFFFF;
  --color-gray-50:         #F8FAFC;
  --color-gray-100:        #F1F5F9;
  --color-gray-200:        #E2E8F0;
  --color-gray-300:        #CBD5E1;
  --color-gray-400:        #94A3B8;
  --color-gray-500:        #64748B;
  --color-gray-600:        #475569;
  --color-gray-700:        #334155;
  --color-gray-800:        #1E293B;
  --color-gray-900:        #0F172A;

  /* --- Semantici --- */
  --color-success:         #059669;
  --color-success-bg:      #ECFDF5;
  --color-error:           #DC2626;
  --color-error-bg:        #FEF2F2;
  --color-warning:         #D97706;
  --color-warning-bg:      #FFFBEB;

  /* --- Badge stato dashboard --- */
  --color-accettata-bg:    #D1FAE5;
  --color-accettata-text:  #065F46;
  --color-rifiutata-bg:    #FEE2E2;
  --color-rifiutata-text:  #991B1B;

  /* --- Gradienti --- */
  --gradient-primary:      linear-gradient(135deg, #0EA5A0 0%, #0891B2 100%);
  --gradient-primary-hover:linear-gradient(135deg, #0A7E7A 0%, #0772A0 100%);
  --gradient-urgent:       linear-gradient(135deg, #E85D26 0%, #DC2626 100%);
  --gradient-dark:         linear-gradient(135deg, #1E293B 0%, #0F172A 100%);
  --gradient-hero-mesh:
    radial-gradient(ellipse 80% 60% at 75% -10%, rgba(14,165,160,0.10) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at -5% 80%,  rgba(8,145,178,0.07) 0%, transparent 55%),
    radial-gradient(ellipse 40% 40% at 50% 50%,  rgba(14,165,160,0.03) 0%, transparent 70%);
  --gradient-footer:       linear-gradient(180deg, #0F172A 0%, #070E1A 100%);

  /* --- Font --- */
  --font-heading:          'DM Sans', system-ui, -apple-system, sans-serif;
  --font-body:             'Inter', system-ui, -apple-system, sans-serif;

  /* --- Scala tipografica modulare --- */
  --text-xs:   0.75rem;       /* 12px */
  --text-sm:   0.875rem;      /* 14px */
  --text-base: 1rem;          /* 16px */
  --text-lg:   1.125rem;      /* 18px */
  --text-xl:   1.375rem;      /* 22px */
  --text-2xl:  1.75rem;       /* 28px */
  --text-3xl:  2.25rem;       /* 36px */
  --text-4xl:  3rem;          /* 48px */
  --text-5xl:  3.75rem;       /* 60px */

  /* --- Spaziatura 4px grid --- */
  --space-1:   0.25rem;       /* 4px  */
  --space-2:   0.5rem;        /* 8px  */
  --space-3:   0.75rem;       /* 12px */
  --space-4:   1rem;          /* 16px */
  --space-5:   1.25rem;       /* 20px */
  --space-6:   1.5rem;        /* 24px */
  --space-8:   2rem;          /* 32px */
  --space-10:  2.5rem;        /* 40px */
  --space-12:  3rem;          /* 48px */
  --space-16:  4rem;          /* 64px */
  --space-20:  5rem;          /* 80px */
  --space-24:  6rem;          /* 96px */

  /* --- Alias semantici spaziatura --- */
  --space-xs:  var(--space-1);
  --space-sm:  var(--space-2);
  --space-md:  var(--space-4);
  --space-lg:  var(--space-6);
  --space-xl:  var(--space-8);
  --space-2xl: var(--space-12);
  --space-3xl: var(--space-16);

  /* --- Container --- */
  --container-max:     1160px;
  --container-narrow:  680px;
  --container-padding: clamp(1rem, 4vw, 2rem);

  /* --- Border radius --- */
  --radius-xs:   3px;
  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   16px;
  --radius-xl:   24px;
  --radius-2xl:  32px;
  --radius-full: 9999px;

  /* --- Ombre neutre --- */
  --shadow-xs:  0 1px 2px rgba(0,0,0,0.05);
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg:  0 8px 28px rgba(0,0,0,0.10), 0 4px 8px rgba(0,0,0,0.05);
  --shadow-xl:  0 20px 56px rgba(0,0,0,0.12), 0 8px 16px rgba(0,0,0,0.06);
  --shadow-2xl: 0 32px 72px rgba(0,0,0,0.16), 0 12px 24px rgba(0,0,0,0.08);

  /* --- Ombre colorate --- */
  --shadow-teal-sm: 0 2px 8px rgba(14,165,160,0.22);
  --shadow-teal-md: 0 4px 18px rgba(14,165,160,0.28);
  --shadow-teal-lg: 0 8px 32px rgba(14,165,160,0.32);
  --shadow-urgent:  0 4px 18px rgba(232,93,38,0.28);

  /* --- Focus ring --- */
  --shadow-focus:         0 0 0 3px rgba(14,165,160,0.32);
  --shadow-focus-urgent:  0 0 0 3px rgba(232,93,38,0.28);
  --shadow-focus-error:   0 0 0 3px rgba(220,38,38,0.20);

  /* --- Transizioni --- */
  --ease-out:        cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out:     cubic-bezier(0.45, 0, 0.55, 1);
  --ease-spring:     cubic-bezier(0.34, 1.56, 0.64, 1);
  --transition-fast: 140ms var(--ease-out);
  --transition-base: 240ms var(--ease-out);
  --transition-slow: 400ms var(--ease-out);

  /* --- Glass / blur --- */
  --glass-bg:     rgba(255,255,255,0.75);
  --glass-border: rgba(255,255,255,0.20);
  --glass-blur:   saturate(180%) blur(20px);

  /* --- Z-index scala --- */
  --z-base:    1;
  --z-raised:  5;
  --z-overlay: 10;
  --z-header:  100;
  --z-modal:   1000;
  --z-toast:   2000;

  /* ==========================================
     ALIAS LEGACY — retrocompatibilità
     ========================================== */
  --color-bg:            var(--color-gray-50);
  --color-bg-dark:       var(--color-gray-900);
  --color-text:          var(--color-gray-800);
  --color-text-light:    var(--color-white);
  --color-text-muted:    var(--color-gray-600);
  --color-secondary:     var(--color-gray-400);
  --color-border:        var(--color-gray-200);
  --color-primary-hover: var(--color-primary-dark);
  --font-main:           var(--font-body);
  --font-weight-black:   900;
  --font-weight-bold:    700;
  --font-weight-regular: 400;
  --color-warning-text:  var(--color-warning);

  /* --- Shadow: card elevations --- */
  --shadow-card:        0 2px 8px rgba(15,23,42,0.06), 0 0 0 1px rgba(15,23,42,0.04);
  --shadow-card-hover:  0 8px 24px rgba(15,23,42,0.10), 0 0 0 1px rgba(15,23,42,0.06);
  --shadow-urgent-glow: 0 0 0 1px rgba(232,93,38,0.15), 0 4px 20px rgba(232,93,38,0.22);

  /* --- Gradienti aggiuntivi --- */
  --gradient-urgent-soft: linear-gradient(135deg, #FFF1EB 0%, #FFF8F5 100%);
  --gradient-trust:       linear-gradient(135deg, #F0FDFA 0%, #F8FAFC 100%);
}

/* ============================================
   RESET MINIMALE
   ============================================ */

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-gray-800);
  background-color: var(--color-white);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

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

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

ul, ol {
  list-style: none;
}

button {
  font-family: var(--font-body);
  cursor: pointer;
  border: none;
  background: none;
  -webkit-tap-highlight-color: transparent;
}

input, textarea, select {
  font-family: var(--font-body);
}

/* Focus visibile — accessibilità */
:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
  border-radius: var(--radius-sm);
}

/* ============================================
   TIPOGRAFIA BASE
   ============================================ */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--color-gray-900);
  line-height: 1.15;
  font-weight: 600;
}

h1 {
  font-size: clamp(2rem, 5vw, 3.375rem);
  font-weight: 700;
  letter-spacing: -0.032em;
  line-height: 1.10;
}

h2 {
  font-size: clamp(1.5rem, 3.5vw, 2.25rem);
  font-weight: 600;
  letter-spacing: -0.024em;
  line-height: 1.20;
}

h3 {
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--color-gray-800);
  letter-spacing: -0.012em;
}

p {
  font-size: var(--text-base);
  line-height: 1.70;
  color: var(--color-gray-600);
}

.lead {
  font-size: var(--text-lg);
  color: var(--color-gray-500);
  line-height: 1.65;
}

strong {
  font-weight: 600;
  color: var(--color-gray-900);
}

small,
.caption {
  font-size: 0.8125rem;
  color: var(--color-gray-500);
  line-height: 1.5;
}

/* ============================================
   LAYOUT — Container
   ============================================ */

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

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

/* ============================================
   UTILITY
   ============================================ */

.visually-hidden,
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
}

.text-center { text-align: center; }
.text-muted  { color: var(--color-gray-500); }

.icon-img {
  display: inline-block;
  width: 1em;
  height: 1em;
  object-fit: contain;
  vertical-align: -0.15em;
  flex-shrink: 0;
}

.divider {
  height: 1px;
  background: var(--color-gray-100);
  border: none;
  margin: var(--space-2xl) 0;
}

/* ============================================
   ANIMAZIONI
   ============================================ */

@media (prefers-reduced-motion: no-preference) {
  .fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s var(--ease-out),
                transform 0.6s var(--ease-out);
  }

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

  .fade-in-delay-1 { transition-delay: 0.1s; }
  .fade-in-delay-2 { transition-delay: 0.2s; }
  .fade-in-delay-3 { transition-delay: 0.3s; }
}

/* ============================================
   TIPOGRAFIA — classi display / overline
   ============================================ */

.text-display {
  font-family: var(--font-heading);
  font-size: clamp(2.75rem, 6vw, 4.5rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.05;
  color: var(--color-gray-900);
}

.text-overline {
  font-family: var(--font-heading);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-primary);
}

/* ============================================
   ANIMAZIONI — pulse-ring, shimmer
   ============================================ */

@keyframes pulse-ring {
  0%   { box-shadow: 0 0 0 0 rgba(232,93,38,0.4); }
  70%  { box-shadow: 0 0 0 10px rgba(232,93,38,0); }
  100% { box-shadow: 0 0 0 0 rgba(232,93,38,0); }
}

@keyframes shimmer {
  0%   { background-position: -200% center; }
  100% { background-position: 200% center; }
}

@media (prefers-reduced-motion: no-preference) {
  .pulse-urgent {
    animation: pulse-ring 2s ease-out infinite;
  }
}

/* ============================================
   BUTTON SYSTEM
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.75rem 1.5rem;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: var(--text-base);
  border-radius: var(--radius-full);
  transition: all var(--transition-base);
  cursor: pointer;
  border: none;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  text-decoration: none;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  transition: background var(--transition-fast);
}

@media (prefers-reduced-motion: no-preference) {
  .btn:hover::after { background: rgba(255,255,255,0.08); }
}

.btn-primary {
  background: var(--gradient-primary);
  color: var(--color-white);
  box-shadow: var(--shadow-teal-md);
}

@media (prefers-reduced-motion: no-preference) {
  .btn-primary:hover {
    background: var(--gradient-primary-hover);
    box-shadow: var(--shadow-teal-lg);
    transform: translateY(-1px);
  }
}

.btn-urgent {
  background: var(--gradient-urgent);
  color: var(--color-white);
  box-shadow: var(--shadow-urgent);
}

@media (prefers-reduced-motion: no-preference) {
  .btn-urgent:hover {
    box-shadow: var(--shadow-urgent-glow);
    transform: translateY(-1px);
  }
}

.btn-ghost {
  background: transparent;
  color: var(--color-gray-700);
  border: 1.5px solid var(--color-gray-200);
}

.btn-ghost:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--color-primary-subtle);
}

.btn-lg { padding: 1rem 2rem; font-size: var(--text-lg); }
.btn-sm { padding: 0.5rem 1rem; font-size: var(--text-sm); }

/* ============================================
   CARD SYSTEM
   ============================================ */

.card {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  transition: box-shadow var(--transition-base), transform var(--transition-base);
}

@media (prefers-reduced-motion: no-preference) {
  .card:hover {
    box-shadow: var(--shadow-card-hover);
    transform: translateY(-2px);
  }
}

.card--selected {
  border: 2px solid var(--color-primary);
  box-shadow: var(--shadow-teal-md);
}

.card--urgent-selected {
  border: 2px solid var(--color-urgent);
  box-shadow: var(--shadow-urgent-glow);
}

/* ============================================
   TRUST PILL
   ============================================ */

.trust-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: var(--color-white);
  border: 1px solid var(--color-gray-200);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-gray-700);
  box-shadow: var(--shadow-xs);
}

/* ============================================
   PRINT
   ============================================ */

@media print {
  body {
    background: #fff;
    color: #000;
    font-size: 12pt;
  }

  .site-header,
  .site-footer {
    display: none !important;
  }
}
