/*
 * /events/ listing. Source: design/…/Events.dc.html.
 * Values come from the theme's tokens.css.
 */

.rv-events-head {
  padding-bottom: 20px;
}

/* ---- Night chips + search: a bar that stays under the header ------- */

/* The theme's chrome.js publishes the header's height as --header-h.
   The bar wears the header's glass, which only shows once flyers pass
   beneath it. */
.rv-events-bar {
  position: sticky;
  top: var(--header-h, 70px);
  z-index: 40; /* under the header (50) and its open menu */
  padding: 12px var(--gutter);
  background: var(--bg-header);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  container-type: scroll-state;
}

.rv-events-bar::after {
  position: absolute;
  inset: auto 0 0;
  height: 1px;
  content: "";
}

/* A hairline like the header's, only while the bar is stuck (browsers
   without scroll-state queries simply show none). */
@container scroll-state(stuck: top) {

  .rv-events-bar::after {
    background: var(--hairline);
  }
}

.rv-events-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 40px;
  align-items: flex-end;
  justify-content: space-between;
}

.rv-events-tools .rv-chips {
  margin-top: 0;
}

/* An underline, like the reserve band's fields: the line turns gold and
   doubles while the guest is typing. */
.rv-search {
  display: flex;
  flex: 1 1 280px;
  align-items: center;
  border-bottom: 1px solid var(--hairline-outline);
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.rv-search:hover {
  border-color: var(--gold);
}

.rv-search:focus-within {
  border-color: var(--gold);
  box-shadow: 0 1px 0 0 var(--gold);
}

@media (min-width: 600px) {

  .rv-search {
    max-width: 360px;
  }
}

/*
 * Phones: the chips and the search share one row, the search folded to
 * its magnifier. Tapping it focuses the field (stretched, invisible, over
 * the glass), which unfolds onto a row of its own; it stays unfolded
 * while it holds text or a search is applied. Browsers without :has()
 * skip this rule and keep the two rows.
 */
@media (max-width: 599px) {

  .rv-events-tools {
    gap: 8px;
    align-items: center;
  }

  .rv-events-tools .rv-chips {
    gap: 6px;
  }

  .rv-events-tools .rv-chip {
    padding: 12px 10px;
  }

  .rv-search:not(.is-active, :focus-within, :has(.rv-search__input:not(:placeholder-shown))) {
    position: relative;
    flex: 0 0 auto;
    margin-left: auto;
    border-bottom-color: transparent;
  }

  .rv-search:not(.is-active, :focus-within, :has(.rv-search__input:not(:placeholder-shown))) .rv-search__input {
    position: absolute;
    inset: 0 -12px 0 0;
    width: auto;
    padding: 0;
    opacity: 0;
    cursor: pointer;
  }

  .rv-search:not(.is-active, :focus-within, :has(.rv-search__input:not(:placeholder-shown))) .rv-search__submit {
    pointer-events: none;
  }
}

.rv-search__input {
  flex: 1;
  min-width: 0;
  padding: 11px 0;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 16px; /* 16px stops iOS zooming into the field */
  font-weight: var(--fw-light);
  color-scheme: dark;
  appearance: none;
}

/* The form's underline shows the focus. */
.rv-search__input:focus {
  outline: none;
}

.rv-search__input::placeholder {
  color: var(--text-faint);
  font-size: var(--fs-label);
  font-weight: var(--fw-regular);
  letter-spacing: var(--track-nav);
  text-transform: uppercase;
  opacity: 1;
}

/* "Clear" is ours, so the browser's own cross goes. */
.rv-search__input::-webkit-search-cancel-button,
.rv-search__input::-webkit-search-decoration {
  appearance: none;
}

.rv-search__clear {
  padding: 14px 10px;
  color: var(--text-faint);
  font-size: var(--fs-label);
  letter-spacing: var(--track-nav);
  text-transform: uppercase;
}

.rv-search__clear:hover {
  color: var(--gold-light);
}

.rv-search__submit {
  display: grid;
  width: 44px;
  height: 44px;
  margin-right: -12px; /* the glass, not its tap area, meets the line's end */
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--gold);
  cursor: pointer;
  place-items: center;
}

.rv-search__submit:hover {
  color: var(--gold-light);
}

.rv-events-result {
  margin: 0 0 32px;
  color: var(--text-faint);
  font-size: var(--fs-label);
  letter-spacing: var(--track-nav);
  text-transform: uppercase;
}

.rv-events-body {
  padding-top: 40px;
}

.rv-event-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 40px 28px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rv-events-empty {
  display: grid;
  gap: 20px;
  justify-items: start;
  padding: 40px 0;
  border-top: 1px solid var(--rule);
}

.rv-events-empty p {
  max-width: 520px;
  margin: 0;
  color: var(--text-muted);
  font-size: var(--fs-lead);
  font-weight: var(--fw-light);
  line-height: var(--lh-body);
}
