/*
 * Homes landing search: destination dropdown (desktop) and full-screen
 * destination search (mobile). Behaviour: js/homes-landing-search.js.
 * Everything is namespaced hls-. Uses the landing page's own tokens
 * (--accent, --ink-3, --font-sans) with fallbacks.
 */

/* The legacy Hotels autosuggest box is never used for Homes. */
.desktop-search-bar #suggestBox { display: none !important; }

/* ───────────────────────── shared: suggestion rows ───────────────────────── */

.hls-heading {
  margin: 0;
  padding: 8px 20px 6px;
  font: 700 0.75rem/1.2 var(--font-sans, system-ui, sans-serif);
  letter-spacing: 0.02em;
  color: var(--ink-3, #717173);
}

.hls-list { margin: 0; padding: 0; list-style: none; }

.hls-item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 56px;
  padding: 8px 20px;
  margin: 0;
  background: none;
  border: 0;
  border-radius: 0;
  text-align: left;
  font-family: var(--font-sans, system-ui, sans-serif);
  color: #0f172a;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.hls-item:hover,
.hls-item[aria-selected="true"] { background: #f4f5f7; }
.hls-item:focus-visible { outline: 2px solid var(--accent, #ff5a5f); outline-offset: -2px; }

.hls-item__icon {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: #fff1f1;
  color: #d9444a;
}
.hls-item__icon svg { width: 22px; height: 22px; display: block; }
.hls-item--locality .hls-item__icon { background: #eef5ea; color: #4a7a3a; }
.hls-item--sublocality .hls-item__icon { background: #eef1f8; color: #4a5f8a; }

.hls-item__text { min-width: 0; display: block; }
.hls-item__name {
  display: block;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}
.hls-item__sub {
  display: block;
  margin-top: 1px;
  font-size: 0.8125rem;
  font-weight: 400;
  line-height: 1.3;
  color: var(--ink-3, #717173);
  overflow-wrap: anywhere;
}

.hls-status {
  margin: 0;
  padding: 14px 20px;
  font: 500 0.875rem/1.4 var(--font-sans, system-ui, sans-serif);
  color: var(--ink-3, #717173);
}
.hls-status:empty { display: none; }
.hls-status--alert { color: #b42318; }
.hls-retry {
  margin-left: 6px;
  padding: 0;
  background: none;
  border: 0;
  font: inherit;
  font-weight: 700;
  color: inherit;
  text-decoration: underline;
  cursor: pointer;
}

/* ───────────────────────────── desktop dropdown ───────────────────────────── */

.hls-panel {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  width: min(440px, 100%);
  max-height: min(440px, 62vh);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 10px 0;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.14), 0 0 0 1px rgba(0, 0, 0, 0.06);
  z-index: 2500;
  font-weight: 400;
}
.hls-panel[hidden] { display: none; }

/* ───────────────────── mobile: full-screen destination search ───────────────────── */

html.hls-lock,
html.hls-lock body { overflow: hidden; }

.hls-overlay {
  position: fixed;
  top: var(--hls-top, 0px);
  left: 0;
  right: 0;
  height: var(--hls-vh, 100vh);
  height: var(--hls-vh, 100dvh);
  z-index: 3000;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  background: #f1f1ef;
  color: #0f172a;
  font-family: var(--font-sans, system-ui, sans-serif);
  overscroll-behavior: contain;
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
  animation: hls-rise 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.hls-overlay[hidden] { display: none; }
.hls-overlay:focus { outline: none; }
@keyframes hls-rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .hls-overlay { animation: none; }
}

.hls-top {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(10px, env(safe-area-inset-top, 0px)) 16px 8px;
  min-height: 56px;
}
.hls-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px 8px;
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 700;
  border-bottom: 2px solid #0f172a;
}
.hls-tab svg { width: 22px; height: 22px; display: block; }
.hls-close {
  position: absolute;
  right: max(16px, env(safe-area-inset-right, 0px));
  top: max(10px, env(safe-area-inset-top, 0px));
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  background: #fff;
  border: 0;
  border-radius: 50%;
  color: #0f172a;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.18);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.hls-close svg { width: 18px; height: 18px; display: block; }
.hls-close:focus-visible,
.hls-back:focus-visible,
.hls-row:focus-visible,
.hls-clear:focus-visible,
.hls-go:focus-visible { outline: 2px solid var(--accent, #ff5a5f); outline-offset: 2px; }

.hls-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 8px 16px 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* On a short screen the sheet scrolls; cards never squash to fit. */
.hls-body > .hls-card { flex: 0 0 auto; }

.hls-card {
  background: #fff;
  border-radius: 24px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(0, 0, 0, 0.04);
}

/* Where */
.hls-where { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.hls-where__title {
  margin: 0;
  padding: 20px 20px 12px;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.hls-field {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 16px 8px;
  padding: 0 14px;
  min-height: 52px;
  border: 1px solid #8b95a8;
  border-radius: 14px;
  background: #fff;
}
.hls-field:focus-within { border-color: #0f172a; box-shadow: 0 0 0 1px #0f172a; }
.hls-field svg { flex: 0 0 auto; width: 20px; height: 20px; display: block; }
.hls-input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 12px 0;
  border: 0;
  background: transparent;
  font-family: inherit;
  font-size: 1rem; /* 16px: iOS does not zoom the page on focus */
  font-weight: 500;
  color: #0f172a;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.hls-input::placeholder { color: #8b95a8; font-weight: 400; }
.hls-back,
.hls-wipe {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 50%;
  color: #0f172a;
  cursor: pointer;
}
.hls-wipe[hidden], .hls-back[hidden] { display: none; }
.hls-back svg, .hls-wipe svg { width: 18px; height: 18px; }
.hls-where__list {
  flex: 1 1 auto;
  min-height: 0;
  max-height: 44vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 8px;
}

/* Where: summary row once a place is chosen */
.hls-where[data-mode="summary"] .hls-where__title,
.hls-where[data-mode="summary"] .hls-field,
.hls-where[data-mode="summary"] .hls-where__list,
.hls-where[data-mode="summary"] .hls-status { display: none; }
.hls-where[data-mode="open"] .hls-back { display: none; }

/* Where: expanded, full screen */
.hls-overlay[data-state="where"] .hls-body { overflow: hidden; padding-bottom: max(16px, env(safe-area-inset-bottom, 0px)); }
.hls-overlay[data-state="where"] .hls-tab { visibility: hidden; }
.hls-overlay[data-state="where"] .hls-when,
.hls-overlay[data-state="where"] .hls-who,
.hls-overlay[data-state="where"] .hls-actions { display: none; }
.hls-overlay[data-state="where"] .hls-where { flex: 1 1 auto; }
.hls-overlay[data-state="where"] .hls-where__title { display: none; }
.hls-overlay[data-state="where"] .hls-field { margin-top: 16px; }
.hls-overlay[data-state="where"] .hls-where__list { max-height: none; }

/* When / Who rows */
.hls-section { overflow: hidden; }
.hls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 60px;
  padding: 0 20px;
  background: none;
  border: 0;
  font-family: inherit;
  font-size: 0.9375rem;
  color: #0f172a;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.hls-row__label { font-weight: 500; color: var(--ink-3, #717173); }
.hls-row__value { font-weight: 700; text-align: right; }
.hls-where[data-mode="summary"] .hls-row { display: flex; }
.hls-where:not([data-mode="summary"]) .hls-row--where { display: none; }
.hls-fold { display: none; padding: 0 20px 18px; }
.hls-section[data-open="true"] .hls-fold { display: block; }
.hls-section[data-open="true"] .hls-row { min-height: 52px; }

/*
 * Check-in / Check-out: two equal columns with a fixed gap, both fields
 * inside the card. iOS Safari gives <input type="date"> a native intrinsic
 * width (about 210px) that "width: 100%" and "min-width: 0" do not override
 * while the native appearance is on, so the two fields grew past their
 * columns, touched at the centre and ran out of the card. appearance: none
 * hands sizing back to CSS; display: block and max-width keep the box in its
 * column; the inner value is told not to push the box wider.
 */
.hls-dates {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 10px;
  row-gap: 0;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.hls-date {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink-3, #717173);
}
.hls-date input {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 46px;
  margin: 0;
  padding: 8px 10px;
  box-sizing: border-box;
  border: 1px solid #c4cad6;
  border-radius: 12px;
  background: #fff;
  font-family: inherit;
  font-size: 1rem;
  color: #0f172a;
  text-align: center;
  overflow: hidden;
  /* An empty native date input collapses to no height without this. */
  line-height: 1.25;
}
.hls-date input::-webkit-date-and-time-value {
  min-width: 0;
  margin: 0;
  text-align: center;
}
.hls-date input::-webkit-datetime-edit { min-width: 0; padding: 0; }
.hls-count { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; }
.hls-count__name { font-size: 0.9375rem; font-weight: 600; }
.hls-count__hint { display: block; font-size: 0.75rem; font-weight: 400; color: var(--ink-3, #717173); }
.hls-count__ctl { display: flex; align-items: center; gap: 14px; }
.hls-count__ctl button {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid #8b95a8;
  border-radius: 50%;
  background: #fff;
  font-size: 1.25rem;
  line-height: 1;
  color: #0f172a;
  cursor: pointer;
}
.hls-count__ctl button:disabled { opacity: 0.35; cursor: default; }
.hls-count__ctl output { min-width: 1.5em; text-align: center; font-weight: 700; }

/* Bottom action bar */
.hls-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px max(12px, env(safe-area-inset-bottom, 0px));
  background: #fff;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}
.hls-clear {
  padding: 10px 4px;
  background: none;
  border: 0;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 700;
  text-decoration: underline;
  color: #0f172a;
  cursor: pointer;
}
.hls-go {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 26px;
  border: 0;
  border-radius: 14px;
  background: var(--accent, #ff5a5f);
  color: #fff;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(255, 90, 95, 0.35);
}
.hls-go svg { width: 18px; height: 18px; display: block; }
.hls-go:active { transform: scale(0.98); }

@media (min-width: 768px) {
  /* Never shown at tablet/desktop width; the dropdown is used there. */
  .hls-overlay { display: none !important; }
}
@media (min-width: 560px) and (max-width: 767.98px) {
  .hls-body { width: 100%; max-width: 560px; margin: 0 auto; box-sizing: border-box; }
  .hls-actions { padding-left: max(20px, calc((100% - 520px) / 2)); padding-right: max(20px, calc((100% - 520px) / 2)); }
}
