/* =========================================================
   Dì Salute Video Editoriali
   Card verticali click-to-play: nessun iframe finché l'utente non clicca.
   ========================================================= */

.dsyv-section {
  width: 100%;
  padding: clamp(38px, 5vw, 72px) 0 clamp(48px, 5.6vw, 82px);
  background: var(--color-bg-primary, #ffffff);
}

.dsyv-section *,
.dsyv-section *::before,
.dsyv-section *::after {
  box-sizing: border-box;
}

.dsyv-section .screen-reader-text,
.dsyv-modal .screen-reader-text {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.dsyv-section__container {
  width: min(100%, var(--ds-home-max, 1380px));
  margin-inline: auto;
  padding-inline: var(--ds-home-gutter, clamp(18px, 5vw, 80px));
}

.dsyv-section__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md, 1rem);
  margin: 0 0 clamp(22px, 2.7vw, 36px);
}

.dsyv-section__header--empty {
  display: none;
}

.dsyv-section__title {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 24px;
  margin: 0;
  padding: 0.24rem 0.62rem;
  border: 1px solid var(--color-border, #d9d9d9);
  border-radius: 999px;
  background: #ffffff;
  font-family: var(--font-ui, SourceSansPro, Arial, sans-serif);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.08em;
  color: var(--color-brand-primary, #174795);
  text-transform: uppercase;
}

.dsyv-section__badge-dot {
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--color-accent, #86b62f);
}

/* Controlli manuali: visibili su desktop solo quando i video sono più di 5. */
.dsyv-nav {
  display: none;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.dsyv-section--desktop-scroll .dsyv-nav {
  display: flex;
}

.dsyv-nav__button {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--color-border, #d9d9d9);
  border-radius: 999px;
  background: #ffffff;
  color: var(--color-brand-primary, #174795);
  font-family: var(--font-ui, SourceSansPro, Arial, sans-serif);
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  box-shadow: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
}

.dsyv-nav__button:hover,
.dsyv-nav__button:focus-visible {
  border-color: var(--color-brand-primary, #174795);
  background: #ffffff;
  color: var(--color-brand-primary, #174795);
}

.dsyv-nav__button:focus-visible {
  outline: 3px solid var(--color-focus, #2c4e97);
  outline-offset: 3px;
}

.dsyv-nav__button:disabled {
  opacity: 0.38;
  cursor: default;
}

.dsyv-scroller {
  width: 100%;
  overflow: visible;
  scroll-behavior: smooth;
}

.dsyv-scroller:focus-visible {
  outline: 3px solid var(--color-focus, #2c4e97);
  outline-offset: 6px;
}

.dsyv-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: clamp(18px, 2vw, 28px);
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}

.dsyv-item {
  min-width: 0;
  margin: 0;
  padding: 0;
}

/* Desktop: più di 5 video = riga orizzontale manuale. */
.dsyv-section--desktop-scroll .dsyv-scroller {
  overflow-x: auto;
  overflow-y: hidden;
  margin-inline: -8px;
  padding: 0 8px 18px;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.dsyv-section--desktop-scroll .dsyv-list {
  display: flex;
  width: max-content;
  min-width: 100%;
}

.dsyv-section--desktop-scroll .dsyv-item {
  flex: 0 0 clamp(190px, 17.6vw, 254px);
  scroll-snap-align: start;
}

.dsyv-card {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: #ffffff;
  color: inherit;
  text-align: left;
  cursor: pointer;
  appearance: none;
  box-shadow: none;
  -webkit-tap-highlight-color: transparent;
}

.dsyv-card:hover,
.dsyv-card:focus,
.dsyv-card:focus-visible,
.dsyv-card:active {
  border: 0;
  background: #ffffff !important;
  color: inherit;
  box-shadow: none;
}

.dsyv-card:focus-visible {
  outline: 3px solid var(--color-focus, #2c4e97);
  outline-offset: 5px;
  border-radius: 18px;
}

.dsyv-thumb {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 9 / 16;
  overflow: hidden;
  border-radius: 16px;
  background: var(--color-bg-secondary, #f6f6f6);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.12);
  isolation: isolate;
  contain: paint;
  clip-path: inset(0 round 16px);
  transform: translateZ(0);
  -webkit-mask-image: -webkit-radial-gradient(#ffffff, #000000);
}

.dsyv-thumb__image,
.dsyv-thumb__placeholder {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.dsyv-thumb__image {
  object-fit: cover;
  object-position: center center;
  transform: scale(1.001) translateZ(0);
  transform-origin: center center;
  backface-visibility: hidden;
  will-change: transform;
  transition: transform 180ms ease, filter 180ms ease;
}

.dsyv-thumb__placeholder {
  background:
    linear-gradient(135deg, rgba(23, 71, 149, 0.42), rgba(134, 182, 47, 0.2)),
    #111111;
}

.dsyv-card:hover .dsyv-thumb__image,
.dsyv-card:focus-visible .dsyv-thumb__image {
  transform: scale(1.035) translateZ(0);
  filter: saturate(1.04);
}

.dsyv-play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.dsyv-play::before {
  content: "";
  display: block;
  width: clamp(54px, 4.2vw, 68px);
  height: clamp(54px, 4.2vw, 68px);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
}

.dsyv-play::after {
  content: "";
  position: absolute;
  width: 0;
  height: 0;
  margin-left: 6px;
  border-top: clamp(10px, 0.8vw, 13px) solid transparent;
  border-bottom: clamp(10px, 0.8vw, 13px) solid transparent;
  border-left: clamp(16px, 1.2vw, 21px) solid #111111;
}

.dsyv-duration {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.76);
  color: #ffffff;
  font-family: var(--font-ui, SourceSansPro, Arial, sans-serif);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
}

.dsyv-card__title {
  display: -webkit-box;
  width: 100%;
  margin: 18px 0 0;
  padding: 0 0 0.18em;
  overflow: hidden;
  background: #ffffff;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  font-family: var(--font-heading, Lora, Georgia, serif);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--color-heading, #000000);
  text-wrap: balance;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.14em;
}

.dsyv-card:hover .dsyv-card__title,
.dsyv-card:focus-visible .dsyv-card__title {
  color: var(--color-brand-primary, #174795);
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.dsyv-card:hover .dsyv-card__title,
.dsyv-card:focus .dsyv-card__title,
.dsyv-card:focus-visible .dsyv-card__title,
.dsyv-card:active .dsyv-card__title {
  background: #ffffff !important;
}

.dsyv-error {
  max-width: min(100%, 1380px);
  margin: 2rem auto;
  padding: 0.85rem 1rem;
  border: 1px solid #cc0000;
  background: #fff5f5;
  color: #660000;
  font-family: var(--font-ui, Arial, sans-serif);
  font-size: 0.95rem;
  line-height: 1.45;
}

/* =========================================================
   Modal player verticale
   ========================================================= */

body.dsyv-modal-open {
  overflow: hidden;
}

.dsyv-modal[hidden] {
  display: none;
}

.dsyv-modal {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: grid;
  place-items: center;
  padding: 20px;
}

.dsyv-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
}

.dsyv-modal__dialog {
  position: relative;
  z-index: 1;
  width: min(420px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
}

.dsyv-modal__close {
  position: absolute;
  top: -14px;
  right: -14px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  color: #000000;
  font-family: Arial, sans-serif;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.25);
}

.dsyv-modal__close:hover,
.dsyv-modal__close:focus-visible {
  background: #ffffff;
  color: var(--color-brand-primary, #174795);
}

.dsyv-modal__close:focus-visible {
  outline: 3px solid var(--color-focus, #2c4e97);
  outline-offset: 3px;
}

.dsyv-player {
  width: 100%;
  aspect-ratio: 9 / 16;
  overflow: hidden;
  border-radius: 18px;
  background: #000000;
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.42);
}

.dsyv-player iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

/* =========================================================
   Responsive
   ========================================================= */

@media (max-width: 1180px) {
  .dsyv-section__container {
    width: min(100%, 960px);
    padding-inline: 32px;
  }

  .dsyv-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .dsyv-section--desktop-scroll .dsyv-item {
    flex-basis: clamp(190px, 23vw, 224px);
  }
}

@media (max-width: 900px) {
  .dsyv-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dsyv-section--desktop-scroll .dsyv-item {
    flex-basis: clamp(190px, 29vw, 238px);
  }
}

@media (max-width: 760px) {
  .dsyv-section {
    padding: 40px 0 58px;
  }

  .dsyv-section__container {
    width: 100%;
    padding-inline: 16px;
  }

  .dsyv-section__header {
    align-items: flex-start;
    margin-bottom: 26px;
  }

  .dsyv-section--has-scroll-controls .dsyv-nav {
    display: flex;
  }

  .dsyv-nav__button {
    width: 38px;
    height: 38px;
    font-size: 26px;
  }

  .dsyv-scroller,
  .dsyv-section--desktop-scroll .dsyv-scroller {
    overflow-x: auto;
    overflow-y: hidden;
    margin-inline: -16px;
    padding: 0 16px 12px 26px;
    scroll-padding-inline: 26px 16px;
    scroll-snap-type: x mandatory;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }

  .dsyv-list,
  .dsyv-section--desktop-scroll .dsyv-list {
    display: flex;
    gap: 16px;
    width: max-content;
    min-width: 100%;
    padding: 0;
  }

  .dsyv-item,
  .dsyv-section--desktop-scroll .dsyv-item {
    flex: 0 0 min(72vw, 300px);
    scroll-snap-align: start;
  }

  .dsyv-thumb {
    border-radius: 15px;
    clip-path: inset(0 round 15px);
  }

  .dsyv-modal {
    padding: 16px;
  }

  .dsyv-modal__dialog {
    width: min(420px, calc(100vw - 32px));
    max-height: calc(100vh - 32px);
  }

  .dsyv-modal__close {
    top: -10px;
    right: -10px;
  }
}

@media (max-width: 420px) {
  .dsyv-item,
  .dsyv-section--desktop-scroll .dsyv-item {
    flex-basis: 78vw;
  }

  .dsyv-duration {
    right: 9px;
    bottom: 9px;
    min-height: 23px;
    font-size: 0.75rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dsyv-scroller {
    scroll-behavior: auto;
  }

  .dsyv-thumb__image {
    transition: none;
  }

  .dsyv-card:hover .dsyv-thumb__image,
  .dsyv-card:focus-visible .dsyv-thumb__image {
    transform: none;
    filter: none;
  }
}
