/* 1. BASE & PALETTE */
html { scroll-behavior: smooth; }
body { font-family: 'Inter', sans-serif; scroll-behavior: smooth; }
h1, h2, h3, h4 { font-family: 'Playfair Display', serif; }
section[id] { scroll-margin-top: 5.5rem; }

.bg-ottanio { background-color: #347b86; }
.text-ottanio { color: #347b86; }
.bg-cream { background-color: #fdfbf7; }
.bg-forest { background-color: #1a2f23; }
.text-forest { color: #1a2f23; }
.border-forest { border-color: #1a2f23; }
.text-shadow-strong { text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5); }

/* 2. MENU MOBILE */
#mobile-menu {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease-in-out, visibility 0.4s;
  background-color: rgba(253, 251, 247, 0.98);
}
#mobile-menu.active { opacity: 1; visibility: visible; }
.mobile-link { opacity: 0; transform: translateY(10px); transition: none; }
#mobile-menu.active .mobile-link {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

/* 3. HERO & ANIMAZIONI HOME */
.crossfade-img {
  animation: imageFadeZoom 12s infinite linear;
  opacity: 0;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.crossfade-img img { width: 100%; height: 100%; object-fit: cover; }
.crossfade-img picture { display: block; width: 100%; height: 100%; }
.crossfade-img:nth-child(1) { animation-delay: 0s; }
.crossfade-img:nth-child(2) { animation-delay: 4s; }
.crossfade-img:nth-child(3) { animation-delay: 8s; }

@keyframes imageFadeZoom {
  0% { opacity: 0; transform: scale(1); }
  8% { opacity: 1; }
  33% { opacity: 1; }
  45% { opacity: 0; }
  100% { opacity: 0; transform: scale(1.12); }
}

.hero-reveal { animation: heroReveal 1.5s cubic-bezier(0.22, 1, 0.36, 1) forwards; opacity: 0; }
@keyframes heroReveal {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.hero-delay-1 { animation-delay: 0.5s; }
.hero-delay-2 { animation-delay: 0.8s; }
.hero-delay-3 { animation-delay: 1.1s; }

.btn-shine { position: relative; overflow: hidden; z-index: 1; }
.btn-shine::after {
  content: "";
  position: absolute;
  top: 0;
  left: -150%;
  width: 80%;
  height: 100%;
  background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.6) 50%, rgba(255,255,255,0) 100%);
  transform: skewX(-25deg);
  animation: shine-once 1.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  animation-delay: 3s;
}
@keyframes shine-once {
  0% { left: -150%; }
  100% { left: 150%; }
}

.highlight-text {
  position: relative;
  display: inline-block;
  white-space: nowrap;
  font-style: italic;
  background-image: linear-gradient(rgba(52, 123, 134, 0.4), rgba(52, 123, 134, 0.4));
  background-repeat: no-repeat;
  background-size: 100% 8px;
  background-position: 0 88%;
}

/* 4. REVEAL ON SCROLL & CARD HOVER */
.reveal { opacity: 0; transform: translateY(30px); transition: all 1.2s cubic-bezier(0.22, 1, 0.36, 1); }
.reveal.active { opacity: 1; transform: translateY(0); }
.delay-1 { transition-delay: 0.1s; }
.delay-2 { transition-delay: 0.3s; }
.delay-3 { transition-delay: 0.5s; }

.service-card { transition: all 0.5s ease; }
.service-card:hover { transform: translateY(-5px); box-shadow: 0 20px 40px rgba(52, 123, 134, 0.05); }
.service-card img { transition: transform 0.8s cubic-bezier(0.22, 1, 0.36, 1); }
.service-card:hover img { transform: scale(1.1); }
.card-zoom img { transition: transform 0.8s cubic-bezier(0.25, 1, 0.5, 1); }
.card-zoom:hover img { transform: scale(1.03); }

/* 5. GRIGLIA EDITORIALE GUIDE & EVENTI */
.guide-item { grid-column: span 1 / span 1; margin-bottom: 2rem; }
.guide-item .img-wrapper {
  aspect-ratio: 16/9;
  border-radius: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
}
.guide-item .guide-title { font-size: 1.875rem; line-height: 2.25rem; margin-bottom: 0.75rem; }
.guide-item .guide-excerpt { font-size: 1rem; }
.guide-item .text-wrapper { max-width: 100%; }

@media (min-width: 768px) {
  .guide-item:nth-child(1) { grid-column: span 8 / span 8; margin-bottom: 0; }
  .guide-item:nth-child(2) { grid-column: span 4 / span 4; padding-top: 5rem; margin-bottom: 0; }
  .guide-item:nth-child(n+3) { grid-column: span 6 / span 6; margin-bottom: 0; }
  .guide-item:nth-child(1) .img-wrapper { aspect-ratio: 16/10; border-radius: 2.5rem; margin-bottom: 2rem; }
  .guide-item:nth-child(1) .guide-title { font-size: 3rem; line-height: 1; margin-bottom: 1rem; }
  .guide-item:nth-child(1) .guide-excerpt { font-size: 1.125rem; }
  .guide-item:nth-child(1) .text-wrapper { max-width: 36rem; }
  .guide-item:nth-child(2) .img-wrapper { aspect-ratio: 1/1; border-radius: 2rem; }
  .guide-item:nth-child(2) .guide-title { font-size: 1.5rem; line-height: 2rem; }
  .guide-item:nth-child(2) .guide-excerpt { font-size: 0.875rem; }
  .guide-item:nth-child(n+3) .img-wrapper { border-radius: 2rem; margin-bottom: 2rem; }
}

/* 6. TIPOGRAFIA ARTICOLI (MARKDOWN) */
article p { margin-top: 0; margin-bottom: 1.75rem; line-height: 1.85; }
article p:empty { display: none; }
article strong, article b { font-weight: 600; color: #111827; }
article a:not(.card-zoom):not(.glightbox) {
  color: #347b86;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 4px;
  text-decoration-color: rgba(52, 123, 134, 0.35);
  transition: all 0.2s ease-in-out;
}
article a:not(.card-zoom):not(.glightbox):hover { color: #1a2f23; text-decoration-color: #1a2f23; }

article h2 {
  font-size: 2rem;
  color: #347b86;
  font-style: italic;
  font-weight: 700;
  margin-top: 3.5rem;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(52, 123, 134, 0.15);
}
article h3:not(blockquote h3) {
  font-size: 1.6rem;
  color: #1a2f23;
  font-style: italic;
  font-weight: 600;
  margin-top: 2.75rem;
  margin-bottom: 1rem;
}
article h4 {
  font-size: 1.25rem;
  color: #4b5563;
  font-style: italic;
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

article ul:not(blockquote ul) { list-style-type: disc; margin: 1.5rem 0 2rem; padding-left: 1.75rem; }
article ol:not(blockquote ol) { list-style-type: decimal; margin: 1.5rem 0 2rem; padding-left: 1.75rem; }
article li { margin-bottom: 0.75rem; line-height: 1.75; padding-left: 0.35rem; }
article li::marker { color: #347b86; font-weight: 600; }

/* Immagini inserite nel testo Markdown */
article p > picture,
article p > img,
article figure {
  display: block;
  margin: 2.5rem auto;
}
article p img,
article figure img {
  width: auto;
  max-width: 100%;
  max-height: 700px;
  height: auto;
  margin: 0 auto;
  display: block;
  border-radius: 1.5rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.08);
  object-fit: contain;
}
article figure.cover-img img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  max-height: none;
}
article figcaption {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #9ca3af;
  margin-top: 0.75rem;
  text-align: center;
  font-style: italic;
}

/* Galleria dedicata (da PagesCMS) */
.gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
  margin: 3rem 0;
}
@media (max-width: 640px) {
  .gallery { grid-template-columns: 1fr; gap: 1rem; }
}
.gallery figure { margin: 0; }
.gallery img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 1.5rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.08);
  transition: transform 0.4s ease;
}
.gallery figure:hover img { transform: scale(1.03); }

/* Citazioni e Box Consigli */
article blockquote:not(:has(h3)) {
  font-style: italic;
  font-size: 1.25rem;
  color: #347b86;
  text-align: center;
  border-left: 4px solid rgba(52, 123, 134, 0.2);
  padding-left: 1.5rem;
  margin: 3rem 0;
  font-weight: 300;
}
article blockquote:has(h3) {
  background-color: white;
  padding: 2.5rem;
  border-radius: 2.5rem;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(52, 123, 134, 0.1);
  margin: 4rem 0;
  text-align: left;
  font-style: normal;
}
article blockquote:has(h3) h3 {
  font-size: 1.875rem;
  color: #347b86;
  margin-bottom: 1.5rem;
  font-style: italic;
}
article blockquote:has(h3) ul { list-style: none; padding-left: 0; }
article blockquote:has(h3) ul li { margin-bottom: 1.25rem; font-size: 1.1rem; color: #374151; }

article hr { border-top: 1px solid rgba(52, 123, 134, 0.15); margin: 4rem 0 1.5rem; }
article hr + p { font-size: 0.85rem; line-height: 1.6; color: #6b7280; font-style: italic; }
/* 7. PAGINE LEGALI (PRIVACY & COOKIE) */
.legal-content h2 {
  font-size: 1.5rem;
  color: #347b86;
  font-style: italic;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid rgba(52, 123, 134, 0.1);
  padding-bottom: 0.5rem;
}
.legal-content p { margin-bottom: 1.25rem; }
.legal-content ul { list-style-type: disc; padding-left: 1.5rem; margin-bottom: 1.5rem; }
.legal-content li { margin-bottom: 0.5rem; }

/* 8. ANIMAZIONE ARTICOLI (ALLINEATA A GUIDE/EVENTI) */
.post-reveal {
  animation: postReveal 1.2s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  opacity: 0;
}
.post-delay-1 { animation-delay: 0.15s; }
.post-delay-2 { animation-delay: 0.3s; }

@keyframes postReveal {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}