/* ==========================================
   BOX CAROUSEL - BASE
   ========================================== */

.box-carousel {
  width: 100%;
  position: relative;
}

.box-carousel__viewport {
  width: 100%;
  overflow: hidden;
}

.box-carousel__track {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 20px;
  margin: 0;
  padding: 0;
  transition: transform 0.6s ease;
  will-change: transform;
}

/* ==========================================
   BOOTSTRAP COLUMNS
   ========================================== */

.box-carousel__item {
  position: relative;
  flex: 0 0 calc((100% - 60px) / 4);
  width: auto;
  max-width: none;
  min-width: 0;
  height: auto;
  padding: 0;
}

/* Tablet - 2 cards */

@media (max-width: 1199px) {
  .box-carousel__item {
    flex-basis: calc((100% - 20px) / 2);
  }
}

/* Mobile - 1 card */

@media (max-width: 767px) {
  .box-carousel__item {
    flex-basis: 100%;
  }
}

/* ==========================================
   CARD DESIGN
   ========================================== */

.box-carousel__inner {
  position: relative;
  height: 100%;
  padding: 24px 24px 32px;
  background-color: #f1f1f1;
  border-radius: 20px;
  box-sizing: border-box;
  transition: background-color 0.2s ease;
  display: flex;
  flex-direction: column;
}

/* Hover - only devices with a mouse */

@media (hover: hover) and (pointer: fine) {
  .box-carousel__item:hover .box-carousel__inner {
    background-color: #e8e8e8;
  }
}

/* Keyboard focus - both variants */

.box-carousel__item:has(.box-carousel__card:focus-visible) .box-carousel__inner {
  background-color: #e8e8e8;
}

/* ==========================================
   CARD IMAGE
   ========================================== */

.box-carousel__image {
  display: block;
  width: 100px !important;
  height: 100px !important;
  object-fit: contain;
  object-position: center;
  margin-bottom: 24px;
}

/* ==========================================
   CARD HEADING
   ========================================== */

.box-carousel__inner h3 {
  font-size: 20px;
  font-weight: 600;
  line-height: 1.3;
  margin: 0 0 10px;
}

/* ==========================================
   CLICKABLE CARD
   ========================================== */

.box-carousel__card {
  display: inline;
  border: 0;
  background: transparent;
  padding: 0;
  color: inherit;
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

/* Make entire card clickable */

.box-carousel__card::after {
  content: "";
  position: absolute;
  inset: 0;
  cursor: pointer;
}

/* Remove focus style from mouse clicks */

.box-carousel__card:focus {
  outline: none;
  box-shadow: none;
}

/* Keyboard focus */

.box-carousel__card:focus-visible {
  outline: 2px solid #444;
  outline-offset: 3px;
  border-radius: 3px;
}

/* ==========================================
   CARD DESCRIPTION - MAX 3 LINES
   ========================================== */

.box-carousel__inner p {
  font-size: 15px;
  line-height: 1.5;
  color: #555;
  margin: 0;

  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
}

.box-carousel__inner > p {
    margin-bottom: auto;
}

/* ==========================================
   LINK CAROUSEL ONLY
   ========================================== */

/* Keep heading dark */

.box-carousel--links .box-carousel__card,
.box-carousel--links .box-carousel__card:hover,
.box-carousel--links .box-carousel__card:focus {
  color: inherit;
  text-decoration: none;
}

/* Arrow default */

.box-carousel--links .box-carousel__arrow i {
  color: #222;
  transition: color 0.2s ease;
}

/* Red arrow on real hover */

@media (hover: hover) and (pointer: fine) {
  .box-carousel--links .box-carousel__item:hover .box-carousel__arrow i,
  .box-carousel--links .box-carousel__item:hover .box-carousel__arrow p {
    color: #ed002f;
  }
}

/* Red arrow on keyboard focus */

.box-carousel--links .box-carousel__item:has(.box-carousel__card:focus-visible) .box-carousel__arrow i {
  color: #ed002f;
}

/* ==========================================
   CAROUSEL CONTROLS
   ========================================== */

.box-carousel__controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

.box-carousel__control {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  width: 38px;
  height: 38px;
  min-width: 38px;
  min-height: 38px;

  padding: 0;
  margin: 0;

  border: 1px solid #d5d5d5;
  border-radius: 50%;

  background: #fff;
  color: #222;

  font-family: Arial, sans-serif;
  font-size: 24px;
  font-weight: 400;
  line-height: 1;

  cursor: pointer;

  -webkit-appearance: none;
  appearance: none;

  box-sizing: border-box;
  vertical-align: middle;
}

.box-carousel__control:hover {
  background-color: #f1f1f1;
  border-color: #999;
}

.box-carousel__control:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.box-carousel__control span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 0;
  line-height: 1;
  flex: 0 0 100%;
  position: relative;
  box-sizing: border-box;
}


/* Pause button */

.box-carousel__pause span {
  position: relative;
}

.box-carousel__pause[aria-pressed="false"] span::before,
.box-carousel__pause[aria-pressed="false"] span::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 3px;
  height: 12px;
  background: currentColor;
  border-radius: 1px;
  transform: translateY(-50%);
}

.box-carousel__pause[aria-pressed="false"] span::before {
  left: calc(50% - 5px);
}

.box-carousel__pause[aria-pressed="false"] span::after {
  left: calc(50% + 2px);
}

.box-carousel__pause[aria-pressed="true"] span::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 10px solid currentColor;
  transform: translate(-40%, -50%);
}


/* ==========================================
   PREVIOUS / NEXT - CSS ICONS
   ========================================== */

.box-carousel__prev span,
.box-carousel__next span {
  position: relative;
}

.box-carousel__prev span::before,
.box-carousel__next span::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;

  width: 9px;
  height: 9px;

  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
}

/* Previous */

.box-carousel__prev span::before {
  transform: translate(-35%, -50%) rotate(-135deg);
}

/* Next */

.box-carousel__next span::before {
  transform: translate(-65%, -50%) rotate(45deg);
}


/* Remove Bootstrap focus shadow */

.box-carousel__control:focus {
  outline: none;
  box-shadow: none;
}

/* Keyboard focus */

.box-carousel__control:focus-visible {
  outline: 2px solid #444;
  outline-offset: 3px;
  border-radius: 50%;
}

/* Mobile controls */

@media (max-width: 575px) {
  .box-carousel__controls {
    margin-top: 16px;
  }

  .box-carousel__control {
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
  }
}

/* ==========================================
   MODAL CONTENT SOURCES
   ========================================== */

/* Hidden on published page */

.box-carousel-section .box-modal-source {
  display: none !important;
}

/* Visible in N1ED editor */

[contenteditable] .box-carousel-section .box-modal-source {
  display: block !important;
  visibility: visible !important;
}

/* ==========================================
   CUSTOM MODAL
   ========================================== */

.custom-modal[hidden] {
  display: none !important;
}

.custom-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 20px;
  box-sizing: border-box;
}

/* Overlay */

.custom-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}

/* Modal container */

.custom-modal__content {
  position: relative;
  z-index: 1;

  width: 100%;
  max-width: 1100px;
  max-height: calc(100dvh - 80px);

  overflow-y: auto;

  background: #fff;
  border-radius: 18px;
  padding: 80px 60px 100px;

  box-sizing: border-box;
  box-shadow: 0 15px 50px rgba(0, 0, 0, 0.2);
}

.custom-modal__close {
  -webkit-tap-highlight-color: transparent;
  -webkit-appearance: none;
  appearance: none;
}

.custom-modal__content:focus,
.custom-modal__content:focus-visible {
  outline: none;
  box-shadow: none;
}

/* Modal content width */

.custom-modal__body {
  max-width: 750px;
  margin: 0 auto;
}

/* Modal heading */

.custom-modal__body h2 {
  font-size: 36px;
  font-weight: 700;
  line-height: 1.3;
  margin: 0 0 40px;
  color: #222;
}

/* Modal paragraphs */

.custom-modal__body p {
  font-size: clamp(16px, 1.5vw, 18px);
  line-height: 1.5;
  margin: 0 0 24px;
}

.custom-modal__body p + p {
  margin-bottom: 12px;
}

.custom-modal__body p:last-child {
  margin-bottom: 0;
}

/* Modal lists */

.custom-modal__body ul,
.custom-modal__body ol {
  margin-bottom: 24px;
}

.custom-modal__body ul:not(.sv-list-style-red-checklist) {
  padding-left: 20px;
  list-style-type: disc;
  list-style-position: outside;

}

.custom-modal__body ul li,
.custom-modal__body ol li {
  padding-bottom: 12px;
  font-size: clamp(16px, 1.5vw, 18px);
  line-height: 1.5;
}

.custom-modal__body ul li:last-child,
.custom-modal__body ol li:last-child {
  padding-bottom: 0;
}


/* ==========================================
   MODAL CLOSE BUTTON - iOS FIX
   ========================================== */

.custom-modal__close {
  position: absolute;
  top: 24px;
  right: 24px;

  display: flex;
  align-items: center;
  justify-content: center;

  width: 36px;
  height: 36px;
  padding: 0;

  border: 0;
  border-radius: 50%;

  background: #222;
  color: #fff;

  font-size: 0;
  line-height: 0;

  cursor: pointer;

  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  box-sizing: border-box;
}

/* CSS-drawn X */

.custom-modal__close::before,
.custom-modal__close::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;

  width: 14px;
  height: 2px;

  background: currentColor;
  border-radius: 1px;
}

.custom-modal__close::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.custom-modal__close::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

/* Hover */

.custom-modal__close:hover {
  background: #555;
}

/* Focus */

.custom-modal__close:focus {
  outline: none;
  box-shadow: none;
}

.custom-modal__close:focus-visible {
  outline: 2px solid #444;
  outline-offset: 3px;
  box-shadow: none;
}


/* ==========================================
   MODAL RESPONSIVE - TABLET
   ========================================== */

@media (max-width: 991px) {
  .custom-modal__content {
    padding: 70px 40px;
  }

  .custom-modal__body h2 {
    font-size: 32px;
    margin-bottom: 32px;
  }

  .custom-modal__body p {
    font-size: 17px;
    margin-bottom: 28px;
  }
}

/* ==========================================
   MODAL RESPONSIVE - MOBILE
   ========================================== */

@media (max-width: 767px) {
  .custom-modal {
    padding: 16px;
  }

  .custom-modal__content {
    max-height: calc(100dvh - 32px);
    padding: 65px 24px 40px;
    border-radius: 12px;
  }

  .custom-modal__body h2 {
    font-size: 26px;
    margin-bottom: 24px;
  }

  .custom-modal__body p {
    font-size: 16px;
    margin-bottom: 24px;
  }

  .custom-modal__close {
    top: 16px;
    right: 16px;
    width: 34px;
    height: 34px;
  }
}

/* ==========================================
   REDUCED MOTION
   ========================================== */

@media (prefers-reduced-motion: reduce) {
  .box-carousel__track {
    transition: none;
  }

  .box-carousel__inner,
  .box-carousel__arrow i,
  .box-carousel__control {
    transition: none;
  }
}
