/* The events home: the photo hero, the search bar and the pill the header shrinks it into, the slice links and
   the event tiles. From docs/design/client/b-montra.html; tokens come from theme.css. */

/* Hero: a race photo, darkened on the left where the words sit. The photo is a demo picture, replaced
   before production. */
.home-hero {
  position: relative;
  color: #fff;
  background: #1d2a30 url(../img/home-hero.jpg) center 30% / cover;
}

.home-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(6, 18, 25, .72) 0%, rgba(6, 18, 25, .35) 55%, rgba(6, 18, 25, .1) 100%);
}

.home-hero__inner {
  position: relative;
  min-height: clamp(420px, 62vh, 640px);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding-top: 96px;
  padding-bottom: 132px;
}

.home-hero__title {
  font-size: clamp(2.25rem, 5vw, 4.5rem);
  line-height: 1.04;
  letter-spacing: -.03em;
  max-width: 12em;
  margin: 0;
  text-shadow: 0 1px 12px rgba(0, 0, 0, .25);
}

.home-hero__lead {
  color: #e4ebee;
  font-size: clamp(1rem, 1.4vw, 1.125rem);
  max-width: 32em;
  margin: .875rem 0 0;
}

/* The search bar, behaving like Airbnb's: a field greys on hover; the field in use becomes a raised white
   pill on a grey bar, and the button widens to say what it does. */
.searchbar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  width: min(960px, calc(100% - 2 * var(--ysi-gutter)));
  height: 72px;
  margin: -40px auto 0;
  background: #fff;
  border: 1px solid #dde3e6;
  border-radius: 999px;
  box-shadow: 0 3px 12px rgba(0, 0, 0, .08), 0 1px 2px rgba(0, 0, 0, .06);
  transition: background .2s;
}

.searchbar.is-active { background: #ebeef0; }

.searchbar__field {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin: 0;
  padding: 0 1.625rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background .2s, box-shadow .2s;
}

.searchbar__field:first-child { flex-grow: 1.5; }

.searchbar__field + .searchbar__field::before {
  content: "";
  position: absolute;
  left: 0;
  top: 26%;
  height: 48%;
  width: 1px;
  background: #dde3e6;
  transition: opacity .2s;
}

.searchbar__field:hover { background: #ebeef0; }
.searchbar.is-active .searchbar__field:hover { background: #dde3e6; }

.searchbar__field:hover::before,
.searchbar__field:hover + .searchbar__field::before,
.searchbar.is-active .searchbar__field::before { opacity: 0; }

.searchbar__field.is-active,
.searchbar__field.is-active:hover {
  background: #fff;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .14);
}

.searchbar__label {
  font-size: .75rem;
  font-weight: 700;
  color: var(--ysi-ink);
}

.searchbar__input {
  width: 100%;
  padding: 2px 0 0;
  border: 0;
  background: none;
  font-size: .9375rem;
  color: var(--ysi-ink-2);
  outline: none;
  appearance: none;
  cursor: pointer;
  text-overflow: ellipsis;
}

.searchbar__input::placeholder { color: var(--ysi-ink-3); }

.searchbar__go {
  flex: none;
  display: flex;
  align-items: center;
  gap: .5rem;
  height: 50px;
  min-width: 50px;
  margin-right: 10px;
  padding: 0 15px;
  border: 0;
  border-radius: 999px;
  background: var(--ysi-cyan);
  color: #fff;
  font-weight: 600;
  transition: background .2s;
}

.searchbar__go:hover { background: var(--ysi-cyan-hover); }
.searchbar__go svg { flex: none; width: 18px; height: 18px; }

.searchbar__go span {
  max-width: 0;
  overflow: hidden;
  white-space: nowrap;
  transition: max-width .3s cubic-bezier(.2, .8, .2, 1);
}

.searchbar.is-active .searchbar__go span { max-width: 90px; }

/* Which slice of the calendar, and the way back from a search. */
.home-slices {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .5rem;
  margin-top: 1.25rem;
  padding-inline: var(--ysi-gutter);
}

.home-slices__link {
  padding: .45rem .9rem;
  border: 1px solid var(--ysi-line);
  border-radius: 999px;
  font-size: .875rem;
  font-weight: 600;
  color: var(--ysi-ink-2);
}

.home-slices__link:hover { text-decoration: none; border-color: var(--ysi-cyan); color: var(--ysi-cyan-text); }

.home-slices__link[aria-current="page"] {
  border-color: var(--ysi-cyan);
  color: var(--ysi-cyan-text);
}

.home-slices__link--clear { border-style: dashed; }

/* The pill in the header, and the copy of the bar that opens under it. */
.site-header .navbar > .site-wrap { position: relative; }

.site-pill {
  position: absolute;
  left: 50%;
  top: 50%;
  display: none;
  align-items: center;
  height: 48px;
  padding: 0 7px 0 8px;
  background: #fff;
  border: 1px solid #dde3e6;
  border-radius: 999px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 4px 12px rgba(0, 0, 0, .05);
  font-size: .875rem;
  font-weight: 600;
  color: var(--ysi-ink);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 46px) scale(1.5);
  transition: opacity .2s, transform .35s cubic-bezier(.2, .8, .2, 1);
}

.site-pill__part { padding: 0 .875rem; white-space: nowrap; max-width: 11em; overflow: hidden; text-overflow: ellipsis; }
.site-pill__part + .site-pill__part { border-left: 1px solid #dde3e6; }
.site-pill__part:not(.is-set) { color: var(--ysi-ink-2); font-weight: 500; }

.site-pill__go {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--ysi-cyan);
  color: #fff;
}

.site-pill__go svg { width: 14px; height: 14px; }

.site-header .navbar-nav { transition: opacity .2s; }

@media (min-width: 992px) {
  .site-pill { display: flex; }
  .site-header.is-compact .site-pill { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%) scale(1); }
  .site-header.is-compact .navbar-nav.me-auto { opacity: 0; pointer-events: none; }
}

.site-header.is-open .site-pill { opacity: 0; pointer-events: none; transform: translate(-50%, 40px) scale(1.6); }

.site-dock {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  display: grid;
  grid-template-rows: 0fr;
  background: #fff;
  transition: grid-template-rows .35s cubic-bezier(.2, .8, .2, 1);
}

.site-dock__inner { overflow: hidden; }
.site-header.is-open .site-dock { grid-template-rows: 1fr; border-bottom: 1px solid var(--ysi-line); }

.site-dock .searchbar {
  margin: 6px auto 22px;
  opacity: 0;
  transform: translateY(-36px) scale(.5);
  transition: opacity .2s, transform .35s cubic-bezier(.2, .8, .2, 1), background .2s;
}

.site-header.is-open .site-dock .searchbar { opacity: 1; transform: none; }

.site-scrim {
  position: fixed;
  inset: 0;
  z-index: 1020;
  background: rgba(6, 18, 25, .28);
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s;
}

.site-scrim.is-on { opacity: 1; pointer-events: auto; }

/* The listing */
.home-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .75rem 1rem;
  margin: clamp(3rem, 6vw, 5rem) 0 1.75rem;
}

.home-head__title { font-size: clamp(1.625rem, 3vw, 2.25rem); margin: 0; }
.home-head .btn-sm { --bs-btn-padding-y: .4rem; --bs-btn-padding-x: 1rem; }
.home-head__count { margin: 0 0 0 auto; color: var(--ysi-ink-3); font-size: .875rem; }

/* The foot of the front page: the classifications that came out last, on a grey band across the whole page,
   then a word to organisers. The band reaches the page's edges with a shadow rather than by breaking out of
   the page box, which keeps the page from scrolling sideways. */
.home-latest {
  margin-top: clamp(3rem, 6vw, 5rem);
  padding: clamp(3rem, 6vw, 5rem) 0;
  background: var(--ysi-soft);
  box-shadow: 0 0 0 100vmax var(--ysi-soft);
  clip-path: inset(0 -100vmax);
}

.home-latest .home-head { margin-top: 0; }

.result-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.5rem;
}

@media (max-width: 1060px) { .result-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 575px) { .result-cards { grid-template-columns: minmax(0, 1fr); } }

.result-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--ysi-line);
  border-radius: .75rem;
}

.result-card__cover {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--ysi-soft);
}

.result-card__body { padding: 1rem 1.125rem 1.125rem; }
.result-card__name { font-size: 1rem; font-weight: 700; margin: 0 0 .25rem; }
.result-card__meta { margin: 0; font-size: .875rem; color: var(--ysi-ink-2); }
.result-card__go { display: inline-block; margin-top: .75rem; font-size: .875rem; font-weight: 600; }

.home-organisers {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(1.75rem, 5vw, 4rem);
  align-items: center;
  margin: 4.5rem 0 1.5rem;
}

@media (max-width: 767px) { .home-organisers { grid-template-columns: minmax(0, 1fr); } }

.home-organisers__photo {
  aspect-ratio: 16 / 9;
  border-radius: .875rem;
  background: var(--ysi-line) url(../img/home-organisers.jpg) center / cover;
}

.home-organisers__title { font-size: clamp(1.75rem, 3.4vw, 2.5rem); margin: 0 0 .75rem; }
.home-organisers__text { color: var(--ysi-ink-2); font-size: 1.0625rem; max-width: 32em; margin: 0 0 1.5rem; }

/* Phones and tablets */
@media (max-width: 991.98px) {
  .home-hero__inner { min-height: 360px; padding-top: 64px; padding-bottom: 112px; }
  .home-latest, .home-organisers { margin-top: 3rem; }
}

/* Below 768px the bar is a card: the name across the top, the other fields two to a row, then the button. */
@media (max-width: 767.98px) {
  .home-hero__inner { min-height: 300px; padding-bottom: 96px; }
  .home-hero__title { font-size: 2.125rem; }

  .searchbar {
    flex-wrap: wrap;
    height: auto;
    margin-top: -56px;
    padding: .5rem;
    border-radius: 1.25rem;
  }

  .searchbar__field {
    flex: 1 1 calc(50% - .25rem);
    height: 60px;
    padding: 0 1rem;
    border-radius: .875rem;
  }

  .searchbar__field:first-child { flex-basis: 100%; }
  .searchbar__field + .searchbar__field::before { display: none; }

  .searchbar__go {
    flex: 1 1 100%;
    justify-content: center;
    height: 48px;
    margin: .375rem 0 0;
  }

  .searchbar__go span { max-width: none; }

  .home-head { margin-top: 2rem; }
  .home-latest { padding: 2.5rem 0; }
}
