:root {
  /* Colori */
  --color-primary: #7d9e8c;
  --color-secondary: #dcd3c5;
  --color-accent: #a38b6d; /* Pulsante */
  --color-text: #3d4a41;
  --color-heading: #2e3b33;
  --color-background: #f5f3f0;
  --color-footer-bg: #4a5d51;
  --color-light-text-on-dark: #f0e6da; /* Testo chiaro su sfondi scuri */
  --color-dark-text-on-light: #2e3b33; /* Testo scuro su sfondi chiari */

  /* Colori di sfondo sezione (da design_preferences) */
  --section-bg-1: #f0e6da;
  --section-bg-2: #e6ded2;
  --section-bg-3: #dce8e0;
  --section-bg-4: #f8f6f3;
  --section-bg-5: #fdfbf8;
  --section-bg-6: #e0e7e1;

  /* Tipografia */
  --font-primary: 'Playfair Display', serif;
  --font-secondary: 'Open Sans', sans-serif;
  --font-size-base: 18px; /* Leggermente più grande per eleganza */
  --line-height-base: 1.7;

  /* Spaziatura */
  --spacing-unit: 8px;
  --spacing-xs: calc(var(--spacing-unit) * 1); /* 8px */
  --spacing-sm: calc(var(--spacing-unit) * 2); /* 16px */
  --spacing-md: calc(var(--spacing-unit) * 3); /* 24px */
  --spacing-lg: calc(var(--spacing-unit) * 5); /* 40px */
  --spacing-xl: calc(var(--spacing-unit) * 8); /* 64px */
  --spacing-xxl: calc(var(--spacing-unit) * 12); /* 96px */

  /* Effetti visivi */
  --border-radius-sm: 4px;
  --border-radius-md: 8px;
  --border-radius-lg: 12px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.15), 0 4px 6px rgba(0, 0, 0, 0.1);
  --transition-speed: 0.35s;
  --transition-easing: cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Base reset & body styles */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-secondary);
  font-size: var(--font-size-base);
  line-height: var(--line-height-base);
  color: var(--color-text);
  background-color: var(--color-background);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Tipografia */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-primary);
  color: var(--color-heading);
  margin-bottom: var(--spacing-md);
  line-height: 1.2;
}

h1 {
  font-size: clamp(2.5rem, 5vw + 1rem, 4.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
}

h2 {
  font-size: clamp(2rem, 4vw + 1rem, 3.5rem);
  font-weight: 600;
  letter-spacing: -0.02em;
}

h3 {
  font-size: clamp(1.6rem, 3vw + 0.8rem, 2.8rem);
  font-weight: 500;
}

h4 {
  font-size: clamp(1.3rem, 2.5vw + 0.5rem, 2rem);
  font-weight: 500;
}

h5 {
  font-size: clamp(1.1rem, 2vw + 0.3rem, 1.6rem);
  font-weight: 500;
}

h6 {
  font-size: clamp(1rem, 1.5vw + 0.2rem, 1.2rem);
  font-weight: 500;
}

p {
  margin-bottom: var(--spacing-sm);
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-speed) var(--transition-easing);
}

a:hover, a:focus {
  color: var(--color-accent);
  text-decoration: underline;
}

ul, ol {
  margin-bottom: var(--spacing-md);
  padding-left: var(--spacing-md);
}

li {
  margin-bottom: var(--spacing-xs);
}

strong {
  font-weight: 600;
  color: var(--color-heading);
}

em {
  font-style: italic;
  color: var(--color-primary);
}

/* Sezioni di sfondo */
.section-bg-1 {
  background-color: var(--section-bg-1);
  color: var(--color-dark-text-on-light) !important;
}
.section-bg-1 h1, .section-bg-1 h2, .section-bg-1 h3, .section-bg-1 h4, .section-bg-1 h5, .section-bg-1 h6, .section-bg-1 p, .section-bg-1 span, .section-bg-1 div, .section-bg-1 a {
  color: var(--color-dark-text-on-light) !important;
}

.section-bg-2 {
  background-color: var(--section-bg-2);
  color: var(--color-dark-text-on-light) !important;
}
.section-bg-2 h1, .section-bg-2 h2, .section-bg-2 h3, .section-bg-2 h4, .section-bg-2 h5, .section-bg-2 h6, .section-bg-2 p, .section-bg-2 span, .section-bg-2 div, .section-bg-2 a {
  color: var(--color-dark-text-on-light) !important;
}

.section-bg-3 {
  background-color: var(--section-bg-3);
  color: var(--color-dark-text-on-light) !important;
}
.section-bg-3 h1, .section-bg-3 h2, .section-bg-3 h3, .section-bg-3 h4, .section-bg-3 h5, .section-bg-3 h6, .section-bg-3 p, .section-bg-3 span, .section-bg-3 div, .section-bg-3 a {
  color: var(--color-dark-text-on-light) !important;
}

.section-bg-4 {
  background-color: var(--section-bg-4);
  color: var(--color-dark-text-on-light) !important;
}
.section-bg-4 h1, .section-bg-4 h2, .section-bg-4 h3, .section-bg-4 h4, .section-bg-4 h5, .section-bg-4 h6, .section-bg-4 p, .section-bg-4 span, .section-bg-4 div, .section-bg-4 a {
  color: var(--color-dark-text-on-light) !important;
}

.section-bg-5 {
  background-color: var(--section-bg-5);
  color: var(--color-dark-text-on-light) !important;
}
.section-bg-5 h1, .section-bg-5 h2, .section-bg-5 h3, .section-bg-5 h4, .section-bg-5 h5, .section-bg-5 h6, .section-bg-5 p, .section-bg-5 span, .section-bg-5 div, .section-bg-5 a {
  color: var(--color-dark-text-on-light) !important;
}

.section-bg-6 {
  background-color: var(--section-bg-6);
  color: var(--color-dark-text-on-light) !important;
}
.section-bg-6 h1, .section-bg-6 h2, .section-bg-6 h3, .section-bg-6 h4, .section-bg-6 h5, .section-bg-6 h6, .section-bg-6 p, .section-bg-6 span, .section-bg-6 div, .section-bg-6 a {
  color: var(--color-dark-text-on-light) !important;
}

/* Pulsanti */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-sm) var(--spacing-lg);
  border-radius: var(--border-radius-md);
  font-family: var(--font-secondary);
  font-size: calc(var(--font-size-base) * 0.95);
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-speed) var(--transition-easing);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-decoration: none;
}

.btn-primary {
  background-color: var(--color-accent);
  color: white;
  box-shadow: var(--shadow-sm);
  border-color: var(--color-accent);
}

.btn-primary:hover, .btn-primary:focus {
  background-color: darken(var(--color-accent), 5%); /* Simulate darken */
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.btn-secondary {
  background-color: transparent;
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.btn-secondary:hover, .btn-secondary:focus {
  background-color: var(--color-primary);
  color: white;
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

/* Campi modulo */
.input, .textarea, .select {
  width: 100%;
  padding: var(--spacing-sm);
  margin-bottom: var(--spacing-md);
  border: 1px solid var(--color-secondary);
  border-radius: var(--border-radius-sm);
  font-family: var(--font-secondary);
  font-size: var(--font-size-base);
  color: var(--color-text);
  background-color: white;
  transition: border-color var(--transition-speed) var(--transition-easing), box-shadow var(--transition-speed) var(--transition-easing);
}

.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(var(--color-primary), 0.2); /* Simulate with rgba */
}

/* Card */
.card {
  background-color: white;
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-md);
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-xl);
  border: 1px solid var(--color-secondary);
  transition: transform var(--transition-speed) var(--transition-easing), box-shadow var(--transition-speed) var(--transition-easing);
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}

/* Navigazione (se non gestita interamente da Tailwind) */
nav {
  background-color: rgba(255, 255, 255, 0.95);
  padding: var(--spacing-sm) var(--spacing-lg);
  border-bottom: 1px solid var(--color-secondary);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: var(--shadow-sm);
}

nav a {
  font-family: var(--font-secondary);
  font-weight: 500;
  color: var(--color-heading);
  margin: 0 var(--spacing-sm);
  padding: var(--spacing-xs) 0;
  position: relative;
}

nav a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 2px;
  background-color: var(--color-accent);
  transform: scaleX(0);
  transition: transform var(--transition-speed) var(--transition-easing);
}

nav a:hover::after,
nav a:focus::after {
  transform: scaleX(1);
}

/* Footer elegance */
.footer {
  background-color: var(--color-footer-bg);
  color: var(--color-light-text-on-dark);
  padding: var(--spacing-xl) var(--spacing-lg);
  text-align: center;
  font-size: calc(var(--font-size-base) * 0.9);
}

.footer h3 {
  color: var(--color-light-text-on-dark);
  margin-bottom: var(--spacing-md);
}

.footer a {
  color: var(--color-light-text-on-dark);
  opacity: 0.8;
}

.footer a:hover {
  color: var(--color-accent);
  opacity: 1;
}

/* Utilities (per complementare Tailwind, se necessario) */
.text-primary { color: var(--color-primary); }
.text-secondary { color: var(--color-secondary); }
.text-accent { color: var(--color-accent); }
.text-heading { color: var(--color-heading); }
.text-text { color: var(--color-text); }

.bg-primary { background-color: var(--color-primary); }
.bg-secondary { background-color: var(--color-secondary); }
.bg-accent { background-color: var(--color-accent); }
.bg-background { background-color: var(--color-background); }

.shadow-custom-sm { box-shadow: var(--shadow-sm); }
.shadow-custom-md { box-shadow: var(--shadow-md); }
.shadow-custom-lg { box-shadow: var(--shadow-lg); }

.rounded-sm { border-radius: var(--border-radius-sm); }
.rounded-md { border-radius: var(--border-radius-md); }
.rounded-lg { border-radius: var(--border-radius-lg); }

/* Animazioni per Alpine.js (esempi) */
[x-cloak] { display: none !important; }

/* Fade In */
.fade-in-enter-active, .fade-in-leave-active {
  transition: opacity var(--transition-speed) var(--transition-easing);
}
.fade-in-enter, .fade-in-leave-to {
  opacity: 0;
}

/* Slide Up */
.slide-up-enter-active, .slide-up-leave-active {
  transition: all var(--transition-speed) var(--transition-easing);
}
.slide-up-enter, .slide-up-leave-to {
  opacity: 0;
  transform: translateY(20px);
}

/* Scale In */
.scale-in-enter-active, .scale-in-leave-active {
  transition: all var(--transition-speed) var(--transition-easing);
}
.scale-in-enter, .scale-in-leave-to {
  opacity: 0;
  transform: scale(0.95);
}

/* Media Queries per la reattività */
@media (max-width: 768px) {
  h1 { font-size: clamp(2rem, 6vw + 1rem, 3.5rem); }
  h2 { font-size: clamp(1.8rem, 5vw + 0.8rem, 3rem); }
  h3 { font-size: clamp(1.4rem, 4vw + 0.6rem, 2.2rem); }

  .btn {
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: calc(var(--font-size-base) * 0.9);
  }

  nav {
    padding: var(--spacing-sm) var(--spacing-md);
  }
}

@media (min-width: 768px) {
  /* Assicurati che la nav sia visibile sui desktop se gestita con Alpine.js per il mobile */
  nav.hidden {
    display: flex !important; /* Sovrascrive display: none se Alpine.js lo applica */
  }
}

@media (min-width: 1024px) {
  body {
    font-size: 19px;
  }
  h1 { font-size: clamp(3rem, 4vw + 2rem, 5.5rem); }
  h2 { font-size: clamp(2.5rem, 3vw + 1.5rem, 4.5rem); }
  h3 { font-size: clamp(2rem, 2vw + 1rem, 3.5rem); }

  .card {
    padding: var(--spacing-xl);
  }
}

/* Linea sottile dorata come decorazione */
.line-decoration {
  display: block;
  width: 80px;
  height: 2px;
  background-color: var(--color-accent);
  margin: var(--spacing-md) auto;
  opacity: 0.7;
}

/* Effetto sottile di "grana" per lo sfondo generale (per un tocco naturale) */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAYAAABytg0gAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnIughAAAAEJJREFUGFdjZmD4z8Dwx4ACgAAD/wJ85u1WAAAAAElFTkSuQmCC'); /* Texture di grana sottile */
  opacity: 0.05;
  z-index: -1;
  mix-blend-mode: multiply;
}

/* Stile per sezioni con bordo sottile e spaziatura generosa */
.section-wrapper {
  padding: var(--spacing-xxl) var(--spacing-lg);
  border-bottom: 1px solid var(--color-secondary);
}
.section-wrapper:last-of-type {
  border-bottom: none;
}

/* Stile per immagini con angoli morbidi e ombre sottili */
img {
  max-width: 100%;
  height: auto;
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-sm);
  display: block; /* Rimuove lo spazio extra sotto le immagini */
}

/* Input con bordo inferiore dorato al focus */
.input-underline {
  border: none;
  border-bottom: 1px solid var(--color-secondary);
  background-color: transparent;
  padding: var(--spacing-sm) 0;
  border-radius: 0;
}
.input-underline:focus {
  border-color: var(--color-accent);
  box-shadow: none;
}
.input-underline::placeholder {
  color: var(--color-text);
  opacity: 0.6;
}

/* Animazione per link con icona (es. freccia) */
.link-with-icon {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  color: var(--color-primary);
  font-weight: 500;
}
.link-with-icon svg {
  transition: transform var(--transition-speed) var(--transition-easing);
}
.link-with-icon:hover svg {
  transform: translateX(5px);
}


/* Cookie Banner Additional Styles for Tailwind */
.cookie-banner-hover-effect:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.cookie-banner-text {
    color: #ffffff;
}

.cookie-banner-button {
    color: #ffffff;
}

@media (prefers-reduced-motion: reduce) {
    .cookie-banner-hover-effect:hover {
        transform: none;
    }
}