/*
 * Card Slider: the Concierge cards from crownbridge.com.
 * Sizes and colours come from the element settings as CSS variables.
 *
 * Phone (under 768px) and tablet (768–991px): one card at a time by default,
 * at most 380px wide, arrows centred underneath. Desktop (992px and up): four
 * cards, arrows over the left and right edges.
 */

.cbt-cs {
  --cbt-cs-gap: 20px;
  --cbt-cs-row-gap: 30px;
  --cbt-cs-title-gap: 30px;
  --cbt-cs-radius: 10px;
  --cbt-cs-ratio: 280/335;
  --cbt-cs-title-size: 20;
  --cbt-cs-title-color: #fff;
  --cbt-cs-zoom: 1.1;
  --cbt-cs-dim: .4;
  --cbt-cs-arrow-bg: #6c6c6c;
  --cbt-cs-arrow-hover-bg: #5e5e5e;
  --cbt-cs-arrow-color: #fff;
  --cbt-cs-speed: 500ms;
  --cbt-cs-show: var(--cbt-cs-show-m, 1);

  position: relative;
  font-family: "Montserrat", sans-serif;
}

.cbt-cs.cbt-cs--inherit-font {
  font-family: inherit;
}

.cbt-cs *,
.cbt-cs *::before,
.cbt-cs *::after {
  box-sizing: border-box;
}

/* Cards row */

.cbt-cs__viewport {
  position: relative;
  overflow: hidden;
  margin: 0 calc(var(--cbt-cs-gap) / -2);
}

/* One card at a time: keep it card-sized and centred, like crownbridge.com. */
.cbt-cs--single .cbt-cs__viewport {
  max-width: calc(380px + var(--cbt-cs-gap));
  margin: 0 auto;
}

.cbt-cs__track {
  display: flex;
  flex-wrap: nowrap;
}

.cbt-cs__slide {
  flex: 0 0 calc(100% / var(--cbt-cs-show));
  min-width: 0;
  padding: 0 calc(var(--cbt-cs-gap) / 2);
}

/* Fade instead of slide when one card is shown. */
.cbt-cs--fade .cbt-cs__track {
  display: grid;
  transform: none !important;
}

.cbt-cs--fade .cbt-cs__slide {
  grid-area: 1 / 1;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--cbt-cs-speed) ease, visibility var(--cbt-cs-speed) ease;
}

.cbt-cs--fade .cbt-cs__slide.is-active {
  opacity: 1;
  visibility: visible;
}

/* Card */

.cbt-cs__card {
  position: relative;
  z-index: 0;
  display: block;
  overflow: hidden;
  border-radius: var(--cbt-cs-radius);
  isolation: isolate;
  color: inherit;
  text-decoration: none;
  box-shadow: none;
  -webkit-user-drag: none;
}

.cbt-cs__media {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: var(--cbt-cs-radius);
  isolation: isolate;
}

.cbt-cs__img {
  position: relative;
  display: block;
  aspect-ratio: var(--cbt-cs-ratio);
  background: #000;
  transition: transform .5s ease;
}

/* A card with no image yet keeps its shape, so it is visible while editing. */
.cbt-cs__img:empty {
  background: #2a2a2a;
}

/* Dark gradient behind the title. */
.cbt-cs__img::before {
  content: '';
  position: absolute;
  z-index: 1;
  top: 14.93%;
  right: 0;
  bottom: 0;
  left: 0;
  background: linear-gradient(0deg, rgba(0, 0, 0, .75) 0%, rgba(0, 0, 0, .3) 55%, rgba(0, 0, 0, 0) 100%);
  opacity: 1;
  transition: opacity .4s ease;
  pointer-events: none;
}

.cbt-cs--no-overlay .cbt-cs__img::before {
  display: none;
}

.cbt-cs__img img {
  display: block;
  width: 100%;
  max-width: none;
  height: 100%;
  object-fit: cover;
  object-position: center;
  margin: 0;
  border: 0;
  border-radius: 0;
  opacity: 1;
  transition: opacity .4s ease;
  -webkit-user-drag: none;
}

/* Hover: zoom in, dim the photo, drop the gradient. Every card does this,
   with or without a link, as on crownbridge.com. */
.cbt-cs__card:hover .cbt-cs__img,
.cbt-cs__card:focus-visible .cbt-cs__img {
  transform: scale(var(--cbt-cs-zoom));
}

.cbt-cs__card:hover .cbt-cs__img img,
.cbt-cs__card:focus-visible .cbt-cs__img img {
  opacity: var(--cbt-cs-dim);
}

.cbt-cs__card:hover .cbt-cs__img::before,
.cbt-cs__card:focus-visible .cbt-cs__img::before {
  opacity: 0;
}

a.cbt-cs__card {
  cursor: pointer;
}

.cbt-cs__title {
  position: absolute;
  z-index: 1;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 0 min(2.778vw, 10px) min(4.167vw, 15px);
  text-align: center;
  pointer-events: none;
}

.cbt-cs__title > span {
  display: block;
  overflow: hidden;
  color: var(--cbt-cs-title-color);
  font-family: inherit;
  font-size: min(calc(var(--cbt-cs-title-size) * .27025vw), calc(var(--cbt-cs-title-size) * 1px));
  font-weight: 600;
  line-height: 1;
  letter-spacing: .02em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

/* Grid: rows of cards instead of a slider (cards per row = cards visible). */

.cbt-cs--grid .cbt-cs__viewport {
  overflow: visible;
  margin: 0;
}

.cbt-cs--grid .cbt-cs__track {
  display: grid;
  grid-template-columns: repeat(var(--cbt-cs-show), minmax(0, 1fr));
  column-gap: var(--cbt-cs-gap);
  row-gap: var(--cbt-cs-row-gap);
  transform: none !important;
}

.cbt-cs--grid .cbt-cs__slide {
  padding: 0;
}

/* Title under the photo instead of on it. */

.cbt-cs--title-below .cbt-cs__card {
  overflow: visible;
  border-radius: 0;
  isolation: auto;
}

.cbt-cs--title-below .cbt-cs__img::before {
  display: none;
}

.cbt-cs.cbt-cs--title-below .cbt-cs__title {
  position: static;
  display: block;
  padding: var(--cbt-cs-title-gap) 10px 0;
}

.cbt-cs--title-below .cbt-cs__title > span {
  overflow: visible;
  line-height: 1.15;
  text-overflow: clip;
  white-space: normal;
}

/* Arrows */

.cbt-cs__arrows {
  display: flex;
  flex-flow: row wrap;
  align-items: center;
  justify-content: center;
  gap: 30px;
  margin: 30px 0 0;
}

.cbt-cs--no-arrows .cbt-cs__arrows,
.cbt-cs--static .cbt-cs__arrows {
  display: none;
}

.cbt-cs .cbt-cs__arrow {
  -webkit-appearance: none;
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 4.167em;
  height: 4.167em;
  margin: 0;
  padding: 0;
  border: 1px solid var(--cbt-cs-arrow-bg);
  border-radius: 50%;
  background: var(--cbt-cs-arrow-bg);
  color: var(--cbt-cs-arrow-color);
  font-size: 12px;
  line-height: 1;
  box-shadow: none;
  cursor: pointer;
  pointer-events: auto;
  transition: background-color .4s ease, border-color .4s ease, color .4s ease;
}

.cbt-cs .cbt-cs__arrow:hover,
.cbt-cs .cbt-cs__arrow:focus-visible {
  border-color: var(--cbt-cs-arrow-hover-bg);
  background: var(--cbt-cs-arrow-hover-bg);
  color: var(--cbt-cs-arrow-color);
}

.cbt-cs__arrow svg {
  display: block;
  width: 1.25em;
  height: 1.25em;
}

.cbt-cs.is-dragging .cbt-cs__card {
  cursor: grabbing;
}

@media (prefers-reduced-motion: reduce) {
  .cbt-cs__img,
  .cbt-cs__img img,
  .cbt-cs__img::before,
  .cbt-cs--fade .cbt-cs__slide {
    transition: none;
  }
}

/* Tablet */

@media only screen and (min-width: 768px) {
  .cbt-cs {
    --cbt-cs-show: var(--cbt-cs-show-t, 1);
  }
}

/* Desktop */

@media only screen and (min-width: 992px) {
  .cbt-cs {
    --cbt-cs-show: var(--cbt-cs-show-d, 4);
  }

  .cbt-cs__title {
    padding: 0 10px min(1.231vw, 16px);
  }

  .cbt-cs__title > span {
    font-size: min(calc(var(--cbt-cs-title-size) * .0769vw), calc(var(--cbt-cs-title-size) * 1px));
  }

  .cbt-cs__arrows {
    position: absolute;
    z-index: 2;
    top: 0;
    right: max(-1.618vw, -25px);
    bottom: 0;
    left: max(-1.618vw, -25px);
    justify-content: space-between;
    margin: 0;
    pointer-events: none;
  }

  .cbt-cs .cbt-cs__arrow {
    font-size: min(.923vw, 12px);
  }
}

/* Only logged-in editors see this, when the slider has no cards yet. */
.cbt-cs-notice {
  padding: 12px 16px;
  border-left: 4px solid #d63638;
  background: #fff;
  color: #1d2327;
  font-size: 14px;
}
