/*
 * Kbloom – video karusel V2.4
 * 3 sloty desktop + swipe a šípky na mobile
 */

:root {
  --kbv-ink: #242424;
  --kbv-muted: #6f6a6b;
  --kbv-accent: #d8889e;
  --kbv-accent-dark: #b9627b;
  --kbv-surface: #ffffff;
  --kbv-border: #eeeeee;
  --kbv-white: #ffffff;
}

.kbv-section,
.kbv-section * {
  box-sizing: border-box;
}

.kbv-section {
  position: relative;
  left: 50%;
  width: 100vw;
  margin: 56px 0;
  margin-left: -50vw;
  padding: 48px 0 42px;
  overflow: hidden;
  color: var(--kbv-ink);
  background: #ffffff;
}

.kbv-section__header {
  width: min(1170px, calc(100% - 40px));
  margin: 0 auto 26px;
  text-align: center;
}

.kbv-section__title {
  margin: 0;
  color: var(--kbv-ink);
  font: inherit;
  font-size: clamp(24px, 2.4vw, 34px);
  font-weight: 700;
  line-height: 1.2;
}

/*
 * Subtitle už nepoužívame,
 * ale pravidlo môže zostať.
 */
.kbv-section__subtitle {
  max-width: 620px;
  margin: 9px auto 0;
  color: var(--kbv-muted);
  font-size: 15px;
  line-height: 1.55;
}

.kbv-carousel {
  position: relative;
  width: min(1170px, calc(100% - 40px));
  margin: 0 auto;
  padding: 0;
}

.kbv-carousel__viewport {
  overflow: hidden;
}

.kbv-carousel__track {
  display: flex;
  gap: 16px;
  margin: 0;
  padding: 0;

  overflow-x: auto;
  overflow-y: hidden;

  overscroll-behavior-x: contain;
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;

  list-style: none;

  /*
   * Dôležité pre mobil:
   * povolený horizontálny aj vertikálny touch pohyb.
   */
  touch-action: pan-x pan-y pinch-zoom;

  -webkit-overflow-scrolling: touch;
}

.kbv-carousel__track::-webkit-scrollbar {
  display: none;
}

/* ==============================
   VIDEO KARTY – DESKTOP 3 SLOTY
   ============================== */

.kbv-card {
  position: relative;
  flex: 0 0 calc((100% - 32px) / 3);
  min-width: 0;

  overflow: hidden;

  border: 1px solid #eeeeee;
  border-radius: 18px;

  background: #ffffff;

  box-shadow:
    0 5px 18px rgba(0, 0, 0, 0.10);

  scroll-snap-align: start;
  scroll-snap-stop: always;
}

.kbv-card__button {
  position: relative;

  display: block;

  width: 100%;

  margin: 0;
  padding: 0;

  overflow: hidden;

  border: 0;
  border-radius: inherit;

  background: #f2edef;
  color: inherit;

  cursor: pointer;

  text-align: left;

  -webkit-appearance: none;
  appearance: none;
}

.kbv-card__button::after {
  content: "";

  position: absolute;
  inset: 0;

  pointer-events: none;

  background:
    linear-gradient(
      180deg,
      transparent 70%,
      rgba(28, 18, 21, 0.18) 100%
    );
}

.kbv-card__button:focus-visible {
  outline: 3px solid var(--kbv-accent-dark);
  outline-offset: -3px;
}

.kbv-card__video {
  display: block;

  width: 100%;

  aspect-ratio: 9 / 13;

  border: 0;

  background: #eee7e9;

  object-fit: cover;

  transition: transform 260ms ease;
}

.kbv-card__button:hover .kbv-card__video {
  transform: scale(1.018);
}

/* ==============================
   PLAY BUTTON
   ============================== */

.kbv-card__play {
  position: absolute;
  z-index: 2;

  top: 50%;
  left: 50%;

  display: grid;

  width: 54px;
  height: 54px;

  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 50%;

  place-items: center;

  color: var(--kbv-accent-dark);

  background: rgba(255, 255, 255, 0.9);

  box-shadow:
    0 4px 18px rgba(49, 27, 34, 0.18);

  transform: translate(-50%, -50%);

  transition:
    transform 180ms ease,
    background 180ms ease;
}

.kbv-card__button:hover .kbv-card__play {
  background: var(--kbv-white);

  transform:
    translate(-50%, -50%)
    scale(1.07);
}

.kbv-card__play svg {
  width: 18px;
  height: 20px;

  margin-left: 3px;

  fill: currentColor;
}

/*
 * Label už JS negeneruje.
 * Môže zostať pre spätnú kompatibilitu.
 */
.kbv-card__label {
  position: absolute;
  z-index: 2;

  right: 15px;
  bottom: 14px;
  left: 15px;

  overflow: hidden;

  color: var(--kbv-white);

  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;

  text-overflow: ellipsis;

  text-shadow:
    0 1px 5px rgba(0, 0, 0, 0.35);

  white-space: nowrap;
}

/* ==============================
   ŠÍPKY
   ============================== */

.kbv-carousel__arrow {
  position: absolute;
  z-index: 5;

  top: 50%;

  display: grid;

  width: 42px;
  height: 42px;

  padding: 0;

  border: 1px solid var(--kbv-border);
  border-radius: 50%;

  place-items: center;

  color: var(--kbv-accent-dark);

  background: var(--kbv-white);

  box-shadow:
    0 4px 18px rgba(77, 47, 57, 0.14);

  cursor: pointer;

  transform: translateY(-50%);

  transition:
    color 160ms ease,
    border-color 160ms ease,
    transform 160ms ease,
    opacity 160ms ease;
}

.kbv-carousel__arrow:hover:not(:disabled) {
  border-color: var(--kbv-accent);

  color: var(--kbv-accent-dark);

  transform:
    translateY(-50%)
    scale(1.05);
}

.kbv-carousel__arrow:focus-visible {
  outline:
    3px solid rgba(185, 98, 123, 0.28);

  outline-offset: 2px;
}

.kbv-carousel__arrow:disabled {
  cursor: default;
  opacity: 0.35;
}

.kbv-carousel__arrow--prev {
  left: -52px;
}

.kbv-carousel__arrow--next {
  right: -52px;
}

.kbv-carousel__arrow svg {
  width: 10px;
  height: 17px;

  fill: none;

  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

/*
 * JS automaticky skryje navigáciu,
 * ak sa všetky videá zmestia naraz.
 */
.kbv-carousel__arrow[hidden],
.kbv-dots[hidden] {
  display: none !important;
}

/* ==============================
   BODKY
   ============================== */

.kbv-dots {
  display: flex;

  justify-content: center;

  gap: 7px;

  margin: 20px 0 0;
  padding: 0;

  list-style: none;
}

.kbv-dot {
  display: block;

  width: 25px;
  height: 5px;

  padding: 0;

  border: 0;
  border-radius: 999px;

  background: #ead8dd;

  cursor: pointer;

  transition:
    width 180ms ease,
    background 180ms ease;
}

.kbv-dot.is-active {
  width: 38px;

  background: var(--kbv-accent-dark);
}

/* ==============================
   CHYBA VIDEA
   ============================== */

.kbv-card__error {
  position: absolute;
  z-index: 4;

  inset: 0;

  display: none;

  padding: 24px;

  align-items: center;
  justify-content: center;

  color: var(--kbv-muted);

  background: #f5eef0;

  font-size: 14px;

  text-align: center;
}

.kbv-card.has-error .kbv-card__error {
  display: flex;
}

/* ==============================
   MODAL
   ============================== */

.kbv-modal {
  position: fixed;
  z-index: 100000;

  inset: 0;

  display: grid;

  padding: 54px 20px 24px;

  place-items: center;

  background:
    rgba(20, 16, 17, 0.9);

  animation:
    kbv-fade-in 160ms ease both;
}

.kbv-modal[hidden] {
  display: none;
}

.kbv-modal__dialog {
  position: relative;

  display: flex;

  max-width: min(92vw, 520px);
  max-height: calc(100vh - 78px);

  flex-direction: column;

  overflow: hidden;

  border-radius: 18px;

  background: #171315;

  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.48);
}

.kbv-modal__video {
  display: block;

  width: auto;
  max-width: 100%;

  height: min(78vh, 780px);
  max-height: calc(100vh - 135px);

  aspect-ratio: 9 / 16;

  background: #111;

  object-fit: contain;
}

.kbv-modal__close {
  position: absolute;
  z-index: 2;

  top: 10px;
  right: 10px;

  display: grid;

  width: 40px;
  height: 40px;

  padding: 0;

  border: 0;
  border-radius: 50%;

  place-items: center;

  color: #272124;

  background:
    rgba(255, 255, 255, 0.92);

  box-shadow:
    0 2px 12px rgba(0, 0, 0, 0.2);

  cursor: pointer;
}

.kbv-modal__close svg {
  width: 17px;
  height: 17px;

  fill: none;

  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 2;
}

.kbv-modal__footer {
  display: flex;

  align-items: center;
  justify-content: space-between;

  gap: 14px;

  min-height: 58px;

  padding: 10px 12px 10px 17px;

  color: var(--kbv-white);

  background: #211b1e;
}

.kbv-modal__footer[hidden] {
  display: none;
}

.kbv-modal__title {
  margin: 0;

  overflow: hidden;

  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;

  text-overflow: ellipsis;

  white-space: nowrap;
}

.kbv-modal__product {
  flex: 0 0 auto;

  padding: 10px 16px;

  border-radius: 999px;

  color: var(--kbv-white) !important;

  background: var(--kbv-accent-dark);

  font-size: 13px;
  font-weight: 700;
  line-height: 1;

  text-decoration: none !important;
}

.kbv-modal__product:hover {
  color: var(--kbv-white) !important;

  background: #a94f69;
}

/* ==============================
   ANIMÁCIA
   ============================== */

@keyframes kbv-fade-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* ==============================
   TABLET
   ============================== */

@media (max-width: 991px) {
  .kbv-carousel {
    width: min(100% - 40px, 900px);
  }

  .kbv-card {
    flex-basis:
      calc((100% - 32px) / 3);
  }

  .kbv-carousel__arrow--prev {
    left: -18px;
  }

  .kbv-carousel__arrow--next {
    right: -18px;
  }
}

/* ==============================
   MOBIL
   ============================== */

@media (max-width: 767px) {
  .kbv-section {
    margin: 38px 0;
    margin-left: -50vw;

    padding: 36px 0 32px;
  }

  .kbv-section__header {
    width: calc(100% - 34px);

    margin-bottom: 20px;
  }

  .kbv-section__title {
    font-size: 25px;
  }

  .kbv-carousel {
    position: relative;

    width: 100%;

    padding: 0;
  }

  /*
   * Track môže presahovať cez viewport
   * a ďalšie video bude čiastočne viditeľné.
   */
  .kbv-carousel__viewport {
    overflow: visible;
  }

  .kbv-carousel__track {
    gap: 12px;

    padding:
      0 17px 4px;

    scroll-padding-left: 17px;

    /*
     * Swipe prstom.
     */
    touch-action: pan-x pan-y pinch-zoom;

    -webkit-overflow-scrolling: touch;
  }

  /*
   * Jedna veľká karta + kúsok ďalšej.
   */
  .kbv-card {
    flex:
      0 0 82vw;

    max-width: 360px;

    border-radius: 16px;

    scroll-snap-align: start;
  }

  /*
   * Šípky ostávajú viditeľné aj na mobile.
   */
  .kbv-carousel__arrow {
    display: grid;

    width: 38px;
    height: 38px;

    z-index: 10;

    background:
      rgba(255, 255, 255, 0.94);

    box-shadow:
      0 3px 14px rgba(0, 0, 0, 0.16);
  }

  .kbv-carousel__arrow--prev {
    left: 8px;
  }

  .kbv-carousel__arrow--next {
    right: 8px;
  }

  .kbv-carousel__arrow svg {
    width: 9px;
    height: 15px;
  }

  .kbv-dots {
    margin-top: 16px;
  }

  .kbv-modal {
    padding: 18px 12px;
  }

  .kbv-modal__dialog {
    max-width: 94vw;
    max-height: 94vh;
  }

  .kbv-modal__video {
    width: 100%;
    height: auto;

    max-height:
      calc(94vh - 62px);
  }
}

/* ==============================
   REDUCED MOTION
   ============================== */

@media (prefers-reduced-motion: reduce) {
  .kbv-carousel__track {
    scroll-behavior: auto;
  }

  .kbv-card__video,
  .kbv-card__play,
  .kbv-carousel__arrow,
  .kbv-dot,
  .kbv-modal {
    animation: none;
    transition: none;
  }
}
