/* Residenza Garibaldi: date range calendar of the booking form (see booking-calendar.js). */
.rg-cal-form {
  --rg-ink: #35566e;
  --rg-ink-soft: rgba(53, 86, 110, 0.55);
  --rg-line: rgba(52, 78, 99, 0.14);
  --rg-paper: #faf8f4;
  --rg-card: #fffdf8;
  --rg-lake: #e2edef;
  --rg-lake-soft: #edf3f3;
  --rg-clay: #bd7255;
  --rg-ease: cubic-bezier(0.23, 1, 0.32, 1);
  position: relative;
}

/* The native date fields stay in the form for validation and Vik Booking, out of sight. */
.rg-cal-native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
  clip-path: inset(50%) !important;
}

/* Field */
.rg-cal-trigger {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 50px;
  margin: 0;
  padding: 10px 12px;
  font: inherit;
  font-size: 16px;
  line-height: 1.4;
  color: var(--rg-ink);
  text-align: left;
  background: var(--rg-paper);
  border: 1px solid var(--rg-line);
  border-radius: 3px;
  cursor: pointer;
  transition: border-color 160ms ease, box-shadow 160ms ease;
  -webkit-tap-highlight-color: transparent;
}
.rg-cal-value { font-variant-numeric: tabular-nums; }
.rg-cal-value.is-placeholder { color: var(--rg-ink-soft); }
.rg-cal-value:first-letter { text-transform: uppercase; }
.rg-cal-trigger[aria-expanded="true"] {
  border-color: var(--rg-ink);
  box-shadow: 0 0 0 3px rgba(53, 86, 110, 0.1);
}
.rg-cal-trigger:focus-visible { outline: 2px solid var(--rg-ink); outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) {
  .rg-cal-trigger:hover { border-color: rgba(52, 78, 99, 0.34); }
}

/* Panel */
/* Opens in the form, between the dates and the guests, like the guests panel. */
.rg-cal {
  position: relative;
  grid-column: 1 / -1;
  z-index: 2;
  padding: 18px 20px 16px;
  color: var(--rg-ink);
  background: var(--rg-card);
  border: 1px solid var(--rg-line);
  border-radius: 14px;
  box-shadow: 0 28px 60px -28px rgba(36, 75, 91, 0.38), 0 2px 8px rgba(36, 75, 91, 0.06);
  opacity: 0;
  transform: translateY(-6px) scale(0.985);
  transform-origin: 50% 0;
  transition: opacity 150ms ease-out, transform 150ms var(--rg-ease);
}
.rg-cal.is-open {
  opacity: 1;
  transform: none;
  transition-duration: 220ms;
}
.rg-cal[hidden] { display: none; }

.rg-cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.rg-cal-step {
  margin: 0;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.rg-cal-step::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin: 0 8px 2px 0;
  border-radius: 50%;
  background: var(--rg-clay);
  vertical-align: middle;
}
.rg-cal-nav { display: flex; gap: 6px; }
.rg-cal-arrow {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  color: var(--rg-ink);
  background: transparent;
  border: 1px solid var(--rg-line);
  border-radius: 50%;
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, transform 120ms ease-out, opacity 160ms ease;
}
.rg-cal-arrow svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.rg-cal-arrow:active:not(:disabled) { transform: scale(0.94); }
.rg-cal-arrow:disabled { opacity: 0.3; cursor: default; }
.rg-cal-arrow:focus-visible { outline: 2px solid var(--rg-ink); outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) {
  .rg-cal-arrow:hover:not(:disabled) { background: var(--rg-lake-soft); border-color: transparent; }
}

.rg-cal-months {
  display: grid;
  grid-template-columns: repeat(var(--rg-cal-months, 2), minmax(0, 1fr));
  gap: 28px;
}
.rg-cal-title {
  margin: 4px 0 10px;
  font-family: "Clash Display", "Cabinet61", Arial, sans-serif;
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.rg-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  row-gap: 2px;
}
.rg-cal-wd {
  padding: 4px 0 8px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-align: center;
  text-transform: uppercase;
  color: var(--rg-ink-soft);
}

/* Days: the cell draws the range band, the button the circle */
.rg-cal-cell {
  position: relative;
  display: grid;
  place-items: center;
  height: 42px;
}
.rg-cal-cell::before {
  content: "";
  position: absolute;
  inset: 3px 0;
  background: transparent;
  transition: background-color 120ms ease;
}
.rg-cal-cell.in-range::before { background: var(--rg-lake); }
.rg-cal-cell.is-start.has-range::before { left: 50%; background: var(--rg-lake); }
.rg-cal-cell.is-end.has-range::before { right: 50%; background: var(--rg-lake); }
.rg-cal-cell.is-start.is-end::before { background: transparent; }
.rg-cal-cell.is-preview::before { background: var(--rg-lake-soft); }
.rg-cal-cell.is-preview.is-end::before { right: 50%; }
.rg-cal-cell:nth-child(7n + 1).in-range::before { border-radius: 18px 0 0 18px; }
.rg-cal-cell:nth-child(7n).in-range::before { border-radius: 0 18px 18px 0; }
/* A range that starts on Sunday or ends on Monday has no half band outside the circle. */
.rg-cal-cell:nth-child(7n).is-start::before,
.rg-cal-cell:nth-child(7n + 1).is-end::before { background: transparent !important; }

.rg-cal-day {
  position: relative;
  z-index: 1;
  width: 36px;
  height: 36px;
  padding: 0;
  font: inherit;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  line-height: 36px;
  color: var(--rg-ink);
  background: transparent;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease, transform 120ms ease-out;
  -webkit-tap-highlight-color: transparent;
}
.rg-cal-day:active:not(:disabled) { transform: scale(0.92); }
.rg-cal-day:disabled { color: rgba(53, 86, 110, 0.26); cursor: default; }
.rg-cal-day:focus-visible { outline: 2px solid var(--rg-ink); outline-offset: 1px; }
.rg-cal-cell.is-today .rg-cal-day::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 5px;
  width: 4px;
  height: 4px;
  margin-left: -2px;
  border-radius: 50%;
  background: var(--rg-clay);
}
.rg-cal-cell.is-start .rg-cal-day,
.rg-cal-cell.is-end:not(.is-preview) .rg-cal-day {
  color: var(--rg-paper);
  background: var(--rg-ink);
}
.rg-cal-cell.is-preview.is-end .rg-cal-day { box-shadow: inset 0 0 0 1.5px var(--rg-ink); }
.rg-cal-cell.is-start .rg-cal-day::after,
.rg-cal-cell.is-end:not(.is-preview) .rg-cal-day::after { background: var(--rg-paper); }
@media (hover: hover) and (pointer: fine) {
  .rg-cal-cell:not(.is-start):not(.is-end) .rg-cal-day:hover:not(:disabled) { background: var(--rg-lake); }
}

/* Footer */
.rg-cal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--rg-line);
}
.rg-cal-summary {
  margin: 0;
  min-height: 1.4em;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.rg-cal-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.rg-cal-clear,
.rg-cal-done {
  min-height: 38px;
  padding: 0 16px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 160ms ease, color 160ms ease, transform 120ms ease-out;
}
.rg-cal-clear { color: var(--rg-ink); background: transparent; border: 0; text-decoration: underline; text-underline-offset: 3px; }
.rg-cal-clear[hidden] { display: none; }
.rg-cal-done { color: var(--rg-paper); background: var(--rg-ink); border: 0; }
.rg-cal-clear:active, .rg-cal-done:active { transform: scale(0.97); }
.rg-cal-clear:focus-visible, .rg-cal-done:focus-visible { outline: 2px solid var(--rg-ink); outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) {
  .rg-cal-done:hover { background: #2a4659; }
}

/* Narrow: one month, larger touch targets */
@media (max-width: 600px) {
  .rg-cal { padding: 14px 12px 12px; border-radius: 12px; }
  .rg-cal-cell { height: 46px; }
  .rg-cal-day { width: 42px; height: 42px; line-height: 42px; font-size: 15px; }
  .rg-cal-cell::before { inset: 2px 0; }
  .rg-cal-title { font-size: 18px; }
  .rg-cal-summary { font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  .rg-cal, .rg-cal.is-open { transform: none; transition: opacity 120ms ease; }
  .rg-cal-day, .rg-cal-arrow, .rg-cal-clear, .rg-cal-done { transition: none; }
  .rg-cal-day:active:not(:disabled), .rg-cal-arrow:active:not(:disabled) { transform: none; }
}
