/* ---------------------------------------------------------------------------
 * Date range picker (progressive enhancement of .avail forms)
 * Loaded only when an availability widget is on the page.
 * ------------------------------------------------------------------------ */

/* Native inputs stay in the form for submission but hand the visible role to a
 * button, so tapping anywhere opens the calendar instead of the OS picker. */
.avail .daterange { position: relative; display: grid; gap: var(--s8); }
.avail .daterange__input {
  position: absolute; width: 1px; height: 1px; opacity: 0;
  pointer-events: none; margin: 0; padding: 0; border: 0;
}

.daterange__trigger {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s8);
  width: 100%; min-height: 3.25rem;
  padding: 0 var(--s16);
  font: inherit; font-size: 1rem; text-align: left;
  color: var(--domino-muted);
  background: #fff;
  border: 1px solid var(--domino-line);
  border-radius: var(--radius-card);
  cursor: pointer;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.daterange__trigger:hover { border-color: var(--domino-sea); }
.daterange__trigger:focus-visible {
  outline: 2px solid var(--domino-gold); outline-offset: 2px;
}
.daterange__trigger.is-filled { color: var(--domino-ink); font-weight: 600; }
.daterange__trigger::after {
  content: ""; flex: 0 0 auto; width: 1.15rem; height: 1.15rem;
  background: currentColor;
  opacity: 0.55;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round'%3E%3Crect x='3' y='5' width='18' height='16' rx='2'/%3E%3Cpath d='M3 10h18M8 3v4M16 3v4'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round'%3E%3Crect x='3' y='5' width='18' height='16' rx='2'/%3E%3Cpath d='M3 10h18M8 3v4M16 3v4'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* Popover ---------------------------------------------------------------- */

/* Fixed to the viewport: an absolutely positioned popover kept getting clipped
 * by the booking card's overflow, which cut the calendar off at the top. */
.daterange__popover {
  position: fixed; z-index: 1000;
  padding: var(--s16);
  background: #fff;
  border: 1px solid var(--domino-line);
  border-radius: var(--radius-card);
  box-shadow: 0 18px 40px rgba(10, 34, 49, 0.16);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.avail { position: relative; }

/* Flipped above the widget: the shadow points up. */
.daterange__popover--above {
  box-shadow: 0 -18px 40px rgba(10, 34, 49, 0.16);
}

/* Phones: a bottom sheet covering most of the screen. */
.daterange__popover--sheet {
  left: 0.5rem; right: 0.5rem; bottom: 0.5rem; top: auto;
  width: auto;
  border-radius: var(--radius-card) var(--radius-card) 0 0;
  box-shadow: 0 -18px 40px rgba(10, 34, 49, 0.22);
}
.daterange__popover--sheet .daterange__months { grid-template-columns: 1fr; }
.daterange__popover--sheet .daterange__month--second { display: none; }
.daterange__popover--sheet .daterange__day { min-height: 2.5rem; aspect-ratio: auto; }

.daterange__head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s8);
  margin-bottom: var(--s12);
}
.daterange__legend {
  font-family: var(--font-display); font-size: 1.1rem; color: var(--domino-sea);
}
.daterange__nav {
  width: 2.25rem; height: 2.25rem; display: grid; place-items: center;
  font-size: 1.25rem; line-height: 1;
  color: var(--domino-sea); background: transparent;
  border: 1px solid var(--domino-line); border-radius: 50%;
  cursor: pointer;
}
.daterange__nav:hover { background: var(--domino-paper); }
.daterange__nav:focus-visible { outline: 2px solid var(--domino-gold); outline-offset: 2px; }

.daterange__months { display: grid; gap: var(--s16); }
@media (min-width: 42rem) {
  .daterange__months { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 41.99rem) {
  .daterange__month--second { display: none; }
}

.daterange__month-head {
  font-size: 0.8125rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--domino-muted); margin-bottom: var(--s8);
}
.daterange__grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px;
}
.daterange__weekday {
  font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--domino-muted); text-align: center; padding-bottom: var(--s4);
}

.daterange__day {
  aspect-ratio: 1 / 1;
  display: grid; place-items: center;
  font: inherit; font-size: 0.875rem;
  color: var(--domino-ink);
  background: transparent; border: 0; border-radius: 50%;
  cursor: pointer;
  position: relative;
}
.daterange__day:hover:not(:disabled) { background: var(--domino-paper); }
.daterange__day:focus-visible { outline: 2px solid var(--domino-gold); outline-offset: -2px; }
.daterange__day.is-empty { visibility: hidden; }
.daterange__day.is-past { color: rgba(10, 34, 49, 0.28); cursor: not-allowed; }

/* Range fill uses a ::before bar so the circular ends stay round. */
.daterange__day.is-in-range::before {
  content: ""; position: absolute; inset: 0 -1px;
  background: rgba(214, 178, 106, 0.18);
}
.daterange__day.is-in-range { border-radius: 0; }
.daterange__day.is-start::before,
.daterange__day.is-end::before {
  content: ""; position: absolute; inset: 0;
  background: rgba(214, 178, 106, 0.18);
}
.daterange__day.is-start { border-radius: 50% 0 0 50%; }
.daterange__day.is-end { border-radius: 0 50% 50% 0; }
.daterange__day.is-start.is-end { border-radius: 50%; }

.daterange__day.is-start,
.daterange__day.is-end {
  background: var(--domino-sea); color: #fff; font-weight: 700;
}
.daterange__day.is-start:hover,
.daterange__day.is-end:hover { background: var(--domino-sea); }
.daterange__day.is-start::before,
.daterange__day.is-end::before { display: none; }

/* The suggested check-out (first click) is outlined, not filled, so it reads as
 * a proposal the guest can move. */
.daterange__day.is-suggested {
  box-shadow: inset 0 0 0 2px var(--domino-gold);
  border-radius: 50%;
}

.daterange__foot {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s12);
  margin-top: var(--s12); padding-top: var(--s12);
  border-top: 1px solid var(--domino-line);
}
.daterange__reset {
  font: inherit; font-size: 0.875rem; color: var(--domino-sea);
  background: transparent; border: 0; padding: 0;
  text-decoration: underline; text-underline-offset: 0.2em; cursor: pointer;
}
.daterange__hint { font-size: 0.8125rem; color: var(--domino-muted); }

/* Narrow containers: the widget must never push its submit button outside the
 * card. The Booking page renders this inside `.container--measure` (~640px), so
 * it is a fixed two-column layout — dates on row one, guests on row two, submit
 * across the full width. The front-page hero is untouched (approved design). */
.avail { max-width: 100%; }
.avail__field { min-width: 0; }

.booking-hub .avail { align-items: end; }
.booking-hub .avail .avail__field { flex: 1 1 calc(50% - var(--s12)); }
.booking-hub .avail .avail__field--guests { flex: 1 1 calc(50% - var(--s12)); }
.booking-hub .avail .avail__submit { flex: 1 1 100%; width: 100%; }

.daterange__trigger { white-space: nowrap; }

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