:root {
  --carousel-gumb-sirina: 3rem;
  --carousel-gumb-visina: 6rem;
}

.carousel {
  position: relative;
}

.carousel[skrij-nav] .carousel-kosi,
.carousel[skrij-nav] .carousel-gumb {
  display: none;
}

.carousel-view {
  display: flex;
  scroll-snap-type: x mandatory;
  overflow-x: scroll;
  scroll-behavior: smooth;
  scrollbar-width: none;
  width: calc(100% + 2 * var(--grid-gutter));
  margin-left: calc(var(--grid-gutter) * -1);
}
.carousel-view::-webkit-scrollbar {
  display: none;
}

.carousel-view > div {
  padding-left: var(--grid-gutter);
  padding-right: var(--grid-gutter);
  width: 25%;
  flex-shrink: 0;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  position: relative;
  /*background: var(--main-bg-color);*/
  z-index: 0;
  overflow: hidden;
}
/* @TODO js scroll na oddaje gube! */
.carousel-view > div:after {
  content: '';
  width: var(--grid-half-gutter);
  background: linear-gradient(to right, var(--main-bg-trans), var(--main-bg-color) 50%);
  height: 100%;

  position: absolute;
  right: calc(var(--grid-half-gutter) * -1);
  top: 0;
  z-index: -1;
}

@media screen and (max-width: 960px) {
  .carousel-view > div {
    width: 33.3%;
  }
}
@media screen and (max-width: 640px) {
  .carousel-view > div {
    width: 50%;
  }
}
@media screen and (max-width: 480px) {
  .carousel-view > div {
    width: 100%;
  }
}

.carousel-kosi {
  display: flex;
  flex-direction: row;
}
@media screen and (min-width: 640px) {
  .carousel-kosi {
    position: absolute;
    top: -4.5rem;
    right: 0;
  }
}

.view .carousel-kosi .kos {
  position: relative;
  display: block;
  width: 1.25rem;
  height: 1.25rem;
}
.view .carousel-kosi .kos:before {
  content: '';
  position: absolute;
  right: 0;
  bottom: 0;
  width: 14px;
  height: 14px;
  border: var(--stroke-width) solid var(--main-separator-color);
  border-radius: 2rem;
}
.view .carousel-kosi .kos.izbran:before {
  background-color: var(--main-separator-color);
}

@media screen and (min-width: 480px) and (max-width: 639px) {
  .view .carousel-kosi .kos:nth-child(2n) {
    display: none;
  }
}
@media screen and (min-width: 640px) and (max-width: 959px) {
  .view .carousel-kosi .kos:nth-child(3n),
  .view .carousel-kosi .kos:nth-child(3n-1) {
    display: none;
  }
}
@media screen and (min-width: 960px) {
  .view .carousel-kosi .kos:nth-child(4n),
  .view .carousel-kosi .kos:nth-child(4n-1),
  .view .carousel-kosi .kos:nth-child(4n-2) {
    display: none;
  }
}

.carousel-gumb {
  position: absolute;
  width: var(--carousel-gumb-sirina);
  height: var(--carousel-gumb-visina);
  top: calc(25% - 3rem);
  left: calc(var(--carousel-gumb-sirina) / 3 * -1);
}
.carousel-gumb:before {
  content: '';
  background-image: url('../icons/Carusel Puščica.svg');
  background-repeat: no-repeat;
  background-position: center;
  cursor: pointer;

  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
}

.carousel-gumb.desno {
  left: auto;
  right: 0;
}
.carousel-gumb.desno:before {
  transform: scaleX(-1);
  right: calc(var(--carousel-gumb-sirina) / 2 * -1 + .5rem);
  left: unset;
}

.carousel .contextual {
  display: none;
}

@media screen and (max-width: 640px) {
  .carousel {
    padding-bottom: 4rem;
  }

  .carousel-gumb {
    position: absolute;
    top: auto;
    bottom: 0;
    left: 0;

    --carousel-gumb-visina: 2.5rem;
  }

  .carousel-gumb::before {
    position: relative;
    display: block;
    top: 0;
    left: 0;
  }

  .carousel-gumb.desno {
    right: 0;
    left: auto;
  }

  .carousel-gumb.desno::before {
    background-image: url("../icons/puscica.svg");
    transform: rotate(0deg);
    right: 0;
  }
  .carousel-gumb.desno::after {
    content: '';
    clear: both;
    display: table;
  }
  .carousel-gumb.levo::before {
    background-image: url("../icons/puscica.svg");
    transform: rotate(180deg);
  }
  [temna-tema] .carousel-gumb::before {
    filter: invert(1);
  }

  .carousel-kosi {
    position: absolute;
    bottom: 0;
    width: 100%;
    justify-content: center;
  }
  .view .carousel-kosi .kos {
    width: 2rem;
    height: 2rem;
    margin-bottom: .4rem;
  }
  .view .carousel-kosi .kos:before {
    width: 50%;
    height: 50%;
    right: 25%;
    bottom: 25%;
  }
}

@media screen and (max-width: 480px) {
  .view .carousel-kosi .kos {
    width: 1.8rem;
    height: 1.8rem;
    margin-bottom: .3rem;
  }
  .view .carousel-gumb {
    --carousel-gumb-visina: 2.5rem;
    --carousel-gumb-sirina: 2rem;
  }
  .view .carousel-gumb:before {
    background-size: contain;
  }
}
