/* Components: carousels, photo lightbox, share buttons and small UI states */

/* The hidden attribute always wins over component display rules */
[hidden] {
  display: none !important;
}

/* Carousels (scroll-snap tracks with arrow buttons) */
.carousel {
  position: relative;
}
.carousel-track,
.dealer-carousel,
.card-gallery,
.vehicle-gallery__main {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.carousel-track::-webkit-scrollbar,
.dealer-carousel::-webkit-scrollbar,
.card-gallery::-webkit-scrollbar,
.vehicle-gallery__main::-webkit-scrollbar {
  display: none;
}
.carousel-track > *,
.card-gallery > *,
.vehicle-gallery__main > * {
  flex: 0 0 100%;
  min-width: 0;
  scroll-snap-align: start;
}
/* Featured / recommended vehicles: three across, centered when there are fewer */
.dealer-carousel {
  gap: 20px;
  padding: 10px 0 20px;
}
.dealer-carousel > * {
  flex: 0 0 calc((100% - 40px) / 3);
  min-width: 0;
  scroll-snap-align: start;
}
.dealer-carousel > :first-child {
  margin-left: auto;
}
.dealer-carousel > :last-child {
  margin-right: auto;
}
@media (max-width: 1100px) {
  .dealer-carousel > * {
    flex-basis: calc((100% - 20px) / 2);
  }
}
@media (max-width: 600px) {
  .dealer-carousel > * {
    flex-basis: 100%;
  }
}
.carousel-arrow {
  position: absolute;
  top: 50%;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  cursor: pointer;
  transform: translateY(-50%);
  transition: background-color 0.2s ease;
}
.carousel-arrow:hover,
.carousel-arrow:focus-visible {
  background: rgba(0, 0, 0, 0.8);
}
.carousel-arrow svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.carousel-arrow--prev {
  left: 10px;
}
.carousel-arrow--next {
  right: 10px;
}
.inventory-card__media .carousel-arrow,
.vehicle-gallery .carousel-arrow {
  width: 36px;
  height: 36px;
  background: #fff;
  color: #1a1a1a;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}
.inventory-card__media .carousel-arrow:hover,
.vehicle-gallery .carousel-arrow:hover {
  background: #fff;
  color: var(--inventory-primary-color);
}

/* Photo lightbox */
.lightbox {
  width: 100vw;
  max-width: 100vw;
  height: 100vh;
  max-height: 100vh;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.92);
  color: #fff;
}
.lightbox[open] {
  display: grid;
  place-items: center;
}
.lightbox::backdrop {
  background: rgba(0, 0, 0, 0.92);
}
.lightbox__image {
  max-width: min(92vw, 1400px);
  max-height: 84vh;
  object-fit: contain;
}
.lightbox__close,
.lightbox__nav {
  position: absolute;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 44px;
  line-height: 1;
  cursor: pointer;
}
.lightbox__close {
  top: 16px;
  right: 24px;
}
.lightbox__nav {
  top: 50%;
  padding: 16px;
  transform: translateY(-50%);
}
.lightbox__nav--prev {
  left: 12px;
}
.lightbox__nav--next {
  right: 12px;
}
.lightbox__count {
  position: absolute;
  bottom: 16px;
  margin: 0;
  font-size: 14px;
}

/* Share buttons */
.share-button {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid currentColor;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  cursor: pointer;
}
.share-button .ui-icon {
  width: 16px;
  height: 16px;
}
.share-button.is-copied {
  background: currentColor;
}

/* Inventory states */
.inventory-empty {
  padding: 2em 0;
  text-align: center;
}

/* Carousel pagination dots */
.carousel-dot {
  width: 8px;
  height: 8px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #cfcfcf;
  cursor: pointer;
}
.carousel-dot.is-active {
  background: var(--inventory-primary-color);
}

/* Background video: the 16:9 frame always covers its section, with at least 80px cropped
   off the top and bottom so YouTube's title bar and logo stay out of view */
.background-video-container {
  container-type: size;
}
.background-video-container:not(.is-ready) {
  opacity: 0; /* hidden until playback starts, so the player's loading UI never shows */
}
.background-video-embed {
  --video-height: max(calc(100cqh + 160px), 56.25cqw);
  height: var(--video-height);
  width: calc(var(--video-height) * 16 / 9);
  border: 0;
}
/* Shown over the video while it's paused, in place of YouTube's pause screen */
.background-video-poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.background-video-container.is-paused .background-video-poster {
  opacity: 1;
}

/* Background video play/pause toggle (bottom-right of the section).
   The inset matches the side padding of the content sections below it, so its
   right edge lines up with their boxes at every breakpoint. */
.video-toggle {
  --video-toggle-inset: 2rem;
  position: absolute;
  right: var(--video-toggle-inset);
  bottom: var(--video-toggle-inset);
  z-index: 3;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: #fff;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}
.video-toggle:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.65);
  transform: scale(1.06);
}
.video-toggle:focus-visible {
  opacity: 1;
  outline: 2px solid #fff;
  outline-offset: 3px;
}
.video-toggle svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}
.video-toggle__play,
.video-toggle.is-paused .video-toggle__pause {
  display: none;
}
.video-toggle.is-paused .video-toggle__play {
  display: block;
}
@media (max-width: 1024px) {
  .video-toggle {
    --video-toggle-inset: 1.25rem;
  }
}
@media (max-width: 767px) {
  .video-toggle {
    --video-toggle-inset: 20px;
    width: 38px;
    height: 38px;
  }
  .video-toggle svg {
    width: 16px;
    height: 16px;
  }
}

/* A cart not yet photographed keeps its frame's shape */
.storefront-photo-placeholder {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #ebebeb;
}

/* The dealer's name where the logo goes, until they upload one */
.site-title {
  font-family: Orbitron, sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: #ffffff;
  text-transform: uppercase;
}
@media (max-width: 767px) {
  .site-title {
    font-size: 1rem;
  }
}

/* A form or message page in the site's column */
.storefront-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 3rem 0;
}
.storefront-page h1 {
  font-family: Orbitron, sans-serif;
}
.form-wrapper .validation-message {
  color: #c02b0a;
  font-size: 14px;
  margin-top: 6px;
}
