/* ==========================================================================
   BLOCK: TEXT I MEDIA (SENSE SLIDER)
   ========================================================================== */

.c-text-media {
  position: relative;
  z-index: 1;
  background-color: var(--bg-out);
  margin-top: var(--mt-d, 0px);
  margin-bottom: var(--mb-d, 0px);
  padding: var(--pt-od) var(--px-od) var(--pb-od) var(--pl-od);
  width: 100%;
}

.c-text-media--bg-always,
.c-text-media--bg-desktop {
  background: var(--bg-out);
}

.c-text-media__max-width {
  max-width: var(--max-w, 1440px);
  margin: 0 auto;
}

.c-text-media__wrap[class*="col-start-auto"] {
  margin-left: auto;
  margin-right: auto;
}

/* --------------------------------------------------------------------------
   CAIXA INTERIOR (BLANCA)
   -------------------------------------------------------------------------- */
.c-text-media__box {
  background-color: var(--bg-in);
  border-radius: var(--rad-box-d);
  padding: var(--p-in-d);
  width: 100%;
}

/* --------------------------------------------------------------------------
   GRAELLA
   -------------------------------------------------------------------------- */
.c-text-media__grid {
  display: grid;
  grid-template-columns: var(--grid-cols-d);
  gap: var(--gap-cols-d);
  align-items: var(--al-v-d, flex-start);
}

/* --------------------------------------------------------------------------
   COLUMNA TEXT I ENLLAÇOS
   -------------------------------------------------------------------------- */
.c-text-media__col-txt {
  order: var(--o-txt-d, 1);
  text-align: var(--al-txt-d, left);
  padding-top: var(--pt-col-txt-d, 0px);
}

.c-text-media__titol {
  font-family: var(--ff-tit);
  font-size: var(--fs-tit-d);
  font-weight: var(--fw-tit);
  line-height: var(--lh-tit-d);
  color: var(--c-tit);
  margin-top: var(--mt-tit-d, 0px);
  margin-bottom: var(--mb-tit-d, 24px);
}

.c-text-media__descripcio {
  font-family: var(--ff-desc);
  font-size: var(--fs-desc-d);
  font-weight: var(--fw-desc);
  line-height: var(--lh-desc-d);
  color: var(--c-desc);
  margin-top: var(--mt-desc-d, 0px);
  margin-bottom: var(--mb-desc-d, 0px);
}
.c-text-media__descripcio p { margin: 0; }
.c-text-media__descripcio p:not(:last-child) { margin-bottom: 1em; }

/* ENLLAÇOS PRINCIPALS (LLISTA) */
.c-text-media__links {
  display: flex;
  flex-direction: column;
  gap: var(--gap-lnk-d);
  margin-top: var(--mt-lnk-d, 40px);
  margin-bottom: var(--mb-lnk-d, 0px);
}

.c-text-media__link {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--c-lnk-t);
  text-decoration: none;
  padding: var(--p-lnk-d) 0;
  border-bottom: 1px solid var(--c-lnk-l);
}

.c-text-media__link-text {
  font-family: var(--ff-lnk);
  font-size: var(--fs-lnk-d);
  font-weight: var(--fw-lnk);
  line-height: var(--lh-lnk-d);
}

.c-text-media__link::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 100%;
  height: 1px;
  background-color: var(--c-lnk-h);
  transform: scaleX(0);
  transform-origin: left; 
  transition: transform 0.4s ease;
}

.c-text-media__link:hover::after {
  transform: scaleX(1);
}

/* --------------------------------------------------------------------------
   COLUMNA MEDIA (IMATGE / VÍDEO / WYSIWYG)
   -------------------------------------------------------------------------- */
.c-text-media__col-img {
  order: var(--o-img-d, 2);
  width: 100%;
  min-width: 0; 
  padding-top: var(--pt-col-img-d, 0px);
}

.c-text-media__visual-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: calc(var(--ar-d));
  border-radius: var(--rad-img);
  overflow: hidden;
  background: #E5E9FF;
  margin-bottom: 32px;
}

.c-text-media__picture,
.c-text-media__video {
  width: 100%;
  height: 100%;
  object-fit: var(--fit, cover);
  display: block;
}

.c-text-media__video {
  background: #000000;
}

.c-text-media__placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-tit);
}

/* YOUTUBE EMBED */
.c-text-media__youtube {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.c-text-media__youtube iframe {
  width: 100%;
  height: 100%;
  border: none;
  object-fit: cover;
}

/* BOTONS DE VÍDEO */
.c-text-media__btn-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80px;
  height: 80px;
  background: var(--c-btn-bg);
  color: var(--c-btn-ic);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, opacity 0.2s ease;
  z-index: 2;
}

.c-text-media__btn-play:hover {
  transform: translate(-50%, -50%) scale(1.05);
}

.c-text-media__btn-play .icon-play {
  width: 27px;
  height: 32px;
}

.c-text-media__btn-pause {
  position: absolute;
  bottom: 24px;
  right: 24px;
  width: 48px;
  height: 48px;
  background: var(--c-btn-bg);
  color: var(--c-btn-ic);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
  z-index: 2;
}

.c-text-media__btn-pause:hover {
  transform: scale(1.05);
}

.c-text-media__btn-pause .icon-pause {
  width: 16px;
  height: 20px;
}

/* --------------------------------------------------------------------------
   WYSIWYG I CITES SOTA MEDIA
   -------------------------------------------------------------------------- */
.c-text-media__wysiwyg {
  font-family: var(--ff-txtm);
  font-size: var(--fs-txtm-d);
  font-weight: var(--fw-txtm);
  line-height: var(--lh-txtm-d);
  color: var(--c-media-txt);
}

.c-text-media__wysiwyg p { margin: 0; }
.c-text-media__wysiwyg p:not(:last-child) { margin-bottom: 1em; }

.c-text-media__wysiwyg blockquote {
  margin: 1.5rem 0;
  padding: 0 0 0 16px;
  border-left: 2px solid var(--c-quote);
}

/* ==========================================================================
   WYSIWYG LINK STYLES (Enllaços interns a la descripció)
   ========================================================================== */

/* 0. Estil Base (Text pla i alineació per defecte per a l'SVG) */
.c-text-media__descripcio a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--c-lnk-t);
  text-decoration: none;
  font-weight: var(--fw-lnk);
  transition: color 0.3s ease, border-color 0.3s ease;
}

.c-text-media__descripcio a:hover {
  color: var(--c-lnk-h);
}

/* 1. Estil: Línia animada */
.c-text-media__descripcio--link-line a {
  position: relative;
  border-bottom: 1px solid var(--c-lnk-l);
}

.c-text-media__descripcio--link-line a::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 100%;
  height: 1px;
  background-color: var(--c-lnk-h);
  transform: scaleX(0);
  transform-origin: left; 
  transition: transform 0.4s ease;
}

.c-text-media__descripcio--link-line a:hover::after {
  transform: scaleX(1);
}

/* 2. Estil: Botó amb vora */
.c-text-media__descripcio--link-btn a {
  border: 2px solid var(--c-lnk-t);
  padding: 12px 24px;
  margin-top: 12px;
}

.c-text-media__descripcio--link-btn a:hover {
  border-color: var(--c-lnk-l);
}

/* Comportament comú de l'SVG de la fletxa si existeix */
.c-text-media__descripcio a svg {
  flex-shrink: 0;
  transition: transform 0.3s ease;
}

.c-text-media__descripcio a:hover svg {
  transform: translateX(4px);
}

/* ==========================================================================
   RESPONSIVE - TABLET / MÒBIL (Fins a 1024px)
   ========================================================================== */
@media (max-width: 1024px) {
  
  .c-text-media {
    margin-top: var(--mt-m, 0px);
    margin-bottom: var(--mb-m, 0px);
    padding: var(--pt-om) var(--px-om) var(--pb-om) var(--pl-om);
  }

  .c-text-media--bg-desktop { background: transparent; }
  .c-text-media--bg-mobile { background: var(--bg-out); }

  .c-text-media__box {
    border-radius: var(--rad-box-m);
    padding: var(--p-in-m);
  }

  .c-text-media__grid {
    grid-template-columns: 1fr;
    gap: var(--gap-cols-m);
    align-items: var(--al-v-m, flex-start);
  }

  .c-text-media__col-txt { 
    order: var(--o-txt-m, 2); 
    text-align: var(--al-txt-m, left);
    padding-top: var(--pt-col-txt-m, 0px);
  }
  
  .c-text-media__col-img { 
    order: var(--o-img-m, 1); 
    padding-top: var(--pt-col-img-m, 0px);
  }

  .c-text-media__titol {
    font-size: var(--fs-tit-m);
    line-height: var(--lh-tit-m);
    margin-top: var(--mt-tit-m, 0px);
    margin-bottom: var(--mb-tit-m, 16px);
  }

  .c-text-media__descripcio {
    font-size: var(--fs-desc-m);
    line-height: var(--lh-desc-m);
    margin-top: var(--mt-desc-m, 0px);
    margin-bottom: var(--mb-desc-m, 0px);
  }

  .c-text-media__links {
    gap: var(--gap-lnk-m);
    margin-top: var(--mt-lnk-m, 40px);
    margin-bottom: var(--mb-lnk-m, 0px);
  }

  .c-text-media__link {
    padding: var(--p-lnk-m) 0;
  }

  .c-text-media__link-text {
    font-size: var(--fs-lnk-m);
    line-height: var(--lh-lnk-m);
  }

  .c-text-media__visual-wrap {
    aspect-ratio: calc(var(--ar-m));
    margin-bottom: 24px;
  }

  .c-text-media__btn-play {
    width: 48px;
    height: 48px;
  }
  .c-text-media__btn-play .icon-play {
    width: 14px;
    height: 16px;
  }

  .c-text-media__btn-pause {
    width: 32px;
    height: 32px;
    bottom: 12px;
    right: 12px;
  }
  .c-text-media__btn-pause .icon-pause {
    width: 10px;
    height: 14px;
  }

  .c-text-media__wysiwyg {
    font-size: var(--fs-txtm-m);
    line-height: var(--lh-txtm-m);
  }

}

/* ==========================================================================
   ESTILS PER A L'ENLLAÇ OPCIONAL DEL TÍTOL
   ========================================================================== */
.c-text-media__titol-link {
  color: inherit;
  text-decoration: none;
  transition: color 0.3s ease;
}

.c-text-media__titol--hover .c-text-media__titol-link:hover {
  color: var(--c-lnk-l);
}