/* ==========================================================================
   Hotel Kapriol — Calendario di prenotazione (selezione arrivo → partenza)
   Un solo calendario per entrambe le date, con intervallo evidenziato.
   ========================================================================== */

/* I due campi diventano di sola lettura: si compilano dal calendario */
.date-field input[readonly] {
  cursor: pointer;
  background: #fff;
}
.date-field input[readonly]:focus {
  outline: none;
  border-color: var(--pine);
  box-shadow: 0 0 0 3px rgba(58, 87, 67, .15);
}
.date-field.is-active input[readonly] {
  border-color: var(--pine);
  box-shadow: 0 0 0 3px rgba(58, 87, 67, .15);
}

/* --- Contenitore popup --- */
.cal-wrap { position: relative; }

.cal {
  position: absolute;
  z-index: 60;
  top: calc(100% + 8px);
  left: 0;
  width: max-content;
  max-width: min(680px, calc(100vw - 32px));
  padding: 18px;
  background: var(--cream);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 24px 60px -22px rgba(46, 36, 24, .5);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  /* quando si porta in vista: sotto l'header fisso e sopra la barra offerta */
  scroll-margin-top: 100px;
  scroll-margin-bottom: calc(var(--offer-bar-h, 0px) + 16px);
  transition: opacity 220ms var(--ease-out), transform 220ms var(--ease-out), visibility 0s 220ms;
}
.cal.is-open {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity 220ms var(--ease-out), transform 220ms var(--ease-out);
}

/* --- Intestazione: mese e navigazione --- */
.cal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.cal__nav {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  background: transparent;
  border: 1.5px solid var(--border);
  border-radius: 50%;
  color: var(--ink);
  cursor: pointer;
  transition: background-color 200ms ease, border-color 200ms ease;
}
.cal__nav:hover:not(:disabled) { background: var(--linen); border-color: var(--honey); }
.cal__nav:disabled { opacity: .3; cursor: default; }
.cal__nav svg { width: 18px; height: 18px; }
.cal__months { display: flex; gap: 26px; }
.cal__month { min-width: 252px; }
.cal__title {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  text-align: center;
  margin: 0 0 10px;
  text-transform: capitalize;
}

/* --- Griglia giorni --- */
.cal__grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal__dow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-align: center;
  padding-bottom: 6px;
}
.cal__day {
  position: relative;
  height: 38px;
  display: flex; align-items: center; justify-content: center;
  background: transparent;
  border: 0;
  border-radius: 4px;
  font-family: var(--font-body);
  font-size: 14.5px;
  color: var(--ink);
  cursor: pointer;
  transition: background-color 160ms ease, color 160ms ease;
}
.cal__day:hover:not(:disabled) { background: var(--linen); }
.cal__day:disabled {
  color: #C9BEA9;
  cursor: not-allowed;
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}
.cal__day--empty { visibility: hidden; }

/* Intervallo selezionato */
.cal__day--in-range { background: rgba(58, 87, 67, .12); border-radius: 0; }
.cal__day--start, .cal__day--end {
  background: var(--pine);
  color: #fff;
  font-weight: 700;
}
.cal__day--start { border-radius: 4px 0 0 4px; }
.cal__day--end { border-radius: 0 4px 4px 0; }
.cal__day--start.cal__day--end { border-radius: 4px; }
.cal__day--start:hover, .cal__day--end:hover { background: var(--pine-deep); }
/* anteprima dell'intervallo mentre si sceglie la partenza */
.cal__day--preview { background: rgba(58, 87, 67, .12); border-radius: 0; }

/* Oggi */
.cal__day--today::after {
  content: "";
  position: absolute;
  bottom: 5px; left: 50%;
  transform: translateX(-50%);
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--honey);
}
.cal__day--start.cal__day--today::after,
.cal__day--end.cal__day--today::after { background: #fff; }

/* --- Piè di pagina: suggerimento + stagioni --- */
.cal__foot {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 14px;
}
.cal__hint { font-size: 13px; color: var(--ink-soft); margin: 0; }
.cal__hint strong { color: var(--pine); font-weight: 700; }
.cal__clear {
  background: none;
  border: 0;
  padding: 6px 8px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
  cursor: pointer;
  text-decoration: underline;
}
.cal__clear:hover { color: var(--ink); }
.cal__seasons {
  width: 100%;
  margin: 0;
  font-size: 12.5px;
  color: var(--ink-soft);
  line-height: 1.5;
}

/* --- Mobile: un mese solo, celle più grandi, popup largo quanto il campo ---
   (niente position:fixed: le sezioni .reveal hanno un transform che creerebbe
   un containing block e sposterebbe il popup fuori dallo schermo) */
@media (max-width: 720px) {
  .cal {
    left: 0; right: 0;
    width: auto;
    max-width: none;
    padding: 14px;
  }
  .cal__months { gap: 0; }
  .cal__month { min-width: 0; width: 100%; }
  .cal__grid { gap: 1px; }
  .cal__day { height: 44px; font-size: 16px; }
  /* su telefono le due scritte più piccole del calendario restano leggibili */
  .cal__dow { font-size: 12.5px; }
  .cal__seasons { font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  .cal { transition: none; }
}
