/* =========================================================
   B&B Le Palme – Custom Styles
   Stack: Tailwind CDN + custom overrides
   ========================================================= */

/* ---- Base ---- */
*, *::before, *::after { box-sizing: border-box; }

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

body {
  min-height: 100vh;
  line-height: 1.6;
}

/* ---- Focus visible (Accessibility AA) ---- */
:focus-visible {
  outline: 2px solid #c8a058;
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---- Skip to content link (Accessibility) ---- */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  background: #1a4a2e;
  color: #fff;
  padding: 0.5rem 1rem;
  border-radius: 0 0 8px 8px;
  font-weight: 600;
  font-size: 0.875rem;
  z-index: 9999;
  transition: top 0.2s;
}
.skip-link:focus {
  top: 0;
}

/* ---- Hero pattern overlay ---- */
.hero-pattern {
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='1'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

/* ---- Smooth image loading ---- */
img {
  transition: opacity 0.4s ease;
}
img[loading="lazy"].loaded,
img.loaded {
  opacity: 1;
}

/* ---- Image placeholder (shown until image loads) ---- */
.img-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 0;
}
/* Hide placeholder once the real image is loaded */
.img-loaded + .img-placeholder,
.img-loaded ~ .img-placeholder {
  display: none;
}

/* ---- Card hover lift ---- */
.servizio-card {
  transform: translateY(0);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.servizio-card:hover {
  transform: translateY(-3px);
}

/* ---- Sticky header shadow on scroll ---- */
header.scrolled {
  box-shadow: 0 4px 20px rgba(15, 46, 26, 0.25);
}

/* ---- Fade-in on scroll (sections) ---- */
.fade-in-up {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}
.fade-in-up.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---- Form input custom ---- */
input[type="date"]::-webkit-calendar-picker-indicator {
  opacity: 0.5;
  cursor: pointer;
}
input[type="date"]::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}

/* ---- WhatsApp floating button (mobile) ---- */
.whatsapp-fab {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 3.5rem;
  height: 3.5rem;
  background: #25d366;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(37, 211, 102, 0.45);
  z-index: 40;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.whatsapp-fab:hover,
.whatsapp-fab:focus-visible {
  transform: scale(1.1);
  box-shadow: 0 6px 28px rgba(37, 211, 102, 0.55);
  outline: 2px solid #fff;
  outline-offset: 3px;
}

/* ---- Responsive typography tweaks ---- */
@media (max-width: 640px) {
  h1 { font-size: clamp(1.6rem, 6vw, 2.5rem); }
  h2 { font-size: clamp(1.4rem, 5vw, 2rem); }
}

/* ---- Print styles ---- */
@media print {
  header, footer, .whatsapp-fab, #contact-form { display: none; }
  body { font-size: 12pt; color: #000; }
  a::after { content: " (" attr(href) ")"; font-size: 0.8em; }
}
