.mansysvideo-section {
  --mansysvideo-gap: 14px;
  width: 100%;
  max-width: 1180px;
  margin: 36px auto;
}

.mansysvideo-heading {
  max-width: 760px;
  margin: 0 auto 22px;
  text-align: center;
}

.mansysvideo-section-title {
  margin: 0;
  font-size: clamp(1.25rem, 1.7vw, 1.65rem);
  font-weight: 700;
  line-height: 1.2;
}

.mansysvideo-section-description {
  margin-top: 7px;
  font-size: 0.94rem;
  line-height: 1.45;
  opacity: 0.72;
  white-space: pre-line;
}

.mansysvideo-grid {
  display: grid;
  grid-template-columns: repeat(var(--mansysvideo-cols-desktop, 4), minmax(0, 1fr));
  gap: var(--mansysvideo-gap);
  align-items: start;
}

.mansysvideo-card {
  min-width: 0;
  text-align: center;
}

.mansysvideo-player {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 8px;
  background: #111;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  isolation: isolate;
}

.mansysvideo-player-loaded {
  cursor: default;
}

.mansysvideo-player:focus-visible {
  outline: 3px solid currentColor;
  outline-offset: 3px;
}

.mansysvideo-thumbnail,
.mansysvideo-player iframe {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.mansysvideo-thumbnail {
  object-fit: cover;
  transition: transform 0.4s ease, filter 0.3s ease;
}

.mansysvideo-player-shade {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: rgba(0, 0, 0, 0.06);
  transition: background-color 0.3s ease;
}

.mansysvideo-play {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  width: 58px;
  height: 58px;
  transform: translate(-50%, -50%);
  transition: transform 0.25s ease;
  filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.45));
}

.mansysvideo-play svg {
  display: block;
  width: 100%;
  height: 100%;
}

.mansysvideo-play-circle {
  fill: rgba(0, 0, 0, 0.18);
  stroke: #fff;
  stroke-width: 3;
  transition: fill 0.25s ease, stroke-width 0.25s ease;
}

.mansysvideo-play-icon {
  fill: #fff;
}

.mansysvideo-player:hover .mansysvideo-thumbnail {
  transform: scale(1.035);
  filter: brightness(0.9);
}

.mansysvideo-player:hover .mansysvideo-player-shade {
  background: rgba(0, 0, 0, 0.12);
}

.mansysvideo-player:hover .mansysvideo-play {
  transform: translate(-50%, -50%) scale(1.06);
}

.mansysvideo-player:hover .mansysvideo-play-circle {
  fill: rgba(0, 0, 0, 0.3);
  stroke-width: 3.5;
}

.mansysvideo-content {
  padding: 9px 5px 0;
}

.mansysvideo-title {
  margin: 0 0 3px;
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.25;
}

.mansysvideo-description {
  max-width: 95%;
  margin: 0 auto;
  font-size: 0.82rem;
  line-height: 1.35;
  opacity: 0.72;
  white-space: pre-line;
}

@media (max-width: 991.98px) {
  .mansysvideo-section {
    --mansysvideo-gap: 13px;
  }

  .mansysvideo-grid {
    grid-template-columns: repeat(var(--mansysvideo-cols-tablet, 2), minmax(0, 1fr));
  }
}

@media (max-width: 575.98px) {
  .mansysvideo-section {
    --mansysvideo-gap: 16px;
    margin: 28px auto;
  }

  .mansysvideo-grid {
    grid-template-columns: repeat(var(--mansysvideo-cols-mobile, 1), minmax(0, 1fr));
  }

  .mansysvideo-heading {
    margin-bottom: 18px;
    text-align: center;
  }

  .mansysvideo-play {
    width: 52px;
    height: 52px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mansysvideo-thumbnail,
  .mansysvideo-player-shade,
  .mansysvideo-play,
  .mansysvideo-play-circle {
    transition: none;
  }
}

body.mansysvideo-lightbox-open {
  overflow: hidden;
}

.mansysvideo-lightbox {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(18px, 4vw, 48px);
  background: rgba(0, 0, 0, 0.82);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.mansysvideo-lightbox.is-visible {
  opacity: 1;
  visibility: visible;
}

.mansysvideo-lightbox-dialog {
  position: relative;
  width: min(1120px, 100%);
  transform: translateY(12px) scale(0.985);
  transition: transform 0.2s ease;
}

.mansysvideo-lightbox.is-visible .mansysvideo-lightbox-dialog {
  transform: translateY(0) scale(1);
}

.mansysvideo-lightbox-video {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 12px;
  background: #000;
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.5);
}

.mansysvideo-lightbox-iframe {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.mansysvideo-lightbox-close {
  position: absolute;
  top: -48px;
  right: 0;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.25);
  color: #fff;
  font: 300 34px/1 Arial, sans-serif;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.mansysvideo-lightbox-close span {
  display: block;
  transform: translateY(-1px);
}

.mansysvideo-lightbox-close:hover {
  background: rgba(255, 255, 255, 0.18);
  transform: scale(1.05);
}

.mansysvideo-lightbox-close:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}

@media (max-width: 575.98px) {
  .mansysvideo-lightbox {
    padding: 58px 10px 18px;
  }

  .mansysvideo-lightbox-dialog {
    width: 100%;
  }

  .mansysvideo-lightbox-video {
    border-radius: 8px;
  }

  .mansysvideo-lightbox-close {
    top: -48px;
    right: 4px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mansysvideo-lightbox,
  .mansysvideo-lightbox-dialog,
  .mansysvideo-lightbox-close {
    transition: none;
  }
}

/* Format miniatur wybierany w konfiguracji modułu. */
.mansysvideo-player.mansysvideo-ratio-16-9 {
  aspect-ratio: 16 / 9;
}

.mansysvideo-player.mansysvideo-ratio-4-3 {
  aspect-ratio: 4 / 3;
}

.mansysvideo-player.mansysvideo-ratio-3-2 {
  aspect-ratio: 3 / 2;
}

.mansysvideo-player.mansysvideo-ratio-1-1 {
  aspect-ratio: 1 / 1;
}

.mansysvideo-player.mansysvideo-ratio-4-5 {
  aspect-ratio: 4 / 5;
}

.mansysvideo-player.mansysvideo-ratio-2-3 {
  aspect-ratio: 2 / 3;
}
