/* =========================================================
   LLIBRE CAROUSEL BLOCK
   ========================================================= */

.c-llibre-carousel {
  margin-top: var(--mar-t, 4rem);
  margin-bottom: var(--mar-b, 4rem);
  padding-top: var(--pad-t, 0);
  padding-bottom: var(--pad-b, 0);
  position: relative;
  overflow-x: clip;
  z-index: 1;
}

.c-llibre-carousel:hover {
  z-index: 50;
}

.c-llibre-carousel.is-hidden {
  display: none;
}

.c-llibre-carousel__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: var(--mb-head, 2rem);
  padding-left: var(--grid-margin, 40px);
  padding-right: var(--grid-margin, 40px);
}

.c-llibre-carousel__titol {
  font-size: var(--fs-tit-bloc, 36px);
  font-weight: var(--fw-tit-bloc, 500);
  color: var(--c-tit-bloc, #1e1348);
  margin: 0;
}

.c-llibre-carousel__nav {
  display: flex;
  gap: var(--nav-gap, 12px);
}

.c-llibre-carousel__btn {
  width: 44px;
  height: 44px;
  border-radius: var(--br-nav, 50%);
  background-color: var(--bg-nav, #1e1348);
  color: var(--c-nav, #ffffff);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.c-llibre-carousel__btn--prev svg {
  transform: rotate(180deg);
}

.c-llibre-carousel__btn:disabled {
  cursor: not-allowed;
  pointer-events: none;
  background-color: #b2a4d2;
}

.c-llibre-carousel__btn:not(:disabled):hover {
  background-color: var(--bg-nav-h, #1e1348);
  color: var(--c-nav-h, #ffffff);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

/* --- CARRUSEL FULL-BLEED --- */
.c-llibre-carousel__wrapper {
  width: 100vw;
  position: relative;
  left: 50%;
  transform: translateX(-50%);
}

.c-llibre-carousel__track-outer {
  width: 100%;
  padding-left: var(--grid-margin, 40px);
  overflow: visible;
  padding-bottom: var(--pb-track, 0px);
}

.c-llibre-carousel__track {
  display: flex;
  gap: var(--gap, 20px);
  list-style: none;
  margin: 0;
  padding: 0 0 20px 0;
  transition: transform 0.4s ease-in-out;
  will-change: transform;
}

.c-llibre-carousel__track.is-loading {
  opacity: 0.4;
  pointer-events: none;
}

/* --- TARGETA --- */
.c-llibre-carousel__card {
  flex: 0 0 var(--card-w, 205px);
  position: relative;
  background: transparent;
  z-index: 1;
}

.c-llibre-carousel__card:hover {
  z-index: 10;
}

.c-llibre-carousel__card-inner {
  display: flex;
  flex-direction: column;
  background-color: var(--bg-card, #ffffff);
  border-radius: var(--br-card, 20px);
  position: relative;
  text-decoration: none;
  height: 100%;
}

.c-llibre-carousel__card:hover .c-llibre-carousel__card-inner {
  transform: translateY(-5px);
  transition: transform 0.3s ease;
}

.c-llibre-carousel__card-image {
  width: 100%;
  aspect-ratio: var(--img-ratio, 4/5);
  border-radius: var(--br-img, 20px 20px 0 0);
  overflow: hidden;
  position: relative;
  z-index: 2;
}

.c-llibre-carousel__card-image img {
  width: 100%;
  height: 100%;
  object-fit: var(--img-fit, cover);
  display: block;
}

.c-llibre-carousel__card-body {
  padding: 2.5rem 1.25rem 1.25rem;
  background: var(--bg-body, #f5f7fa);
  border-radius: var(--br-body, 0 0 20px 20px);
  margin-top: -24px;
  position: relative;
  z-index: 1;
  flex-grow: 1;
}

.c-llibre-carousel__card-colleccio {
  font-size: var(--fs-col, 16px);
  color: var(--c-col, #1e1348);
  font-weight: var(--fw-col, 400);
  margin-bottom: var(--mb-col, 0.25rem);
}

.c-llibre-carousel__card-title {
  font-size: var(--fs-tit, 16px);
  font-weight: var(--fw-tit, 600);
  color: var(--c-tit, #1e1348);
  margin: 0;
  line-height: 1.3;
}

.c-llibre-carousel__card-hover {
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: absolute;
  top: 100%;
  left: 4px;
  right: 4px;
  background-color: var(--bg-hover, #ffffff);
  padding: 30px 12px 12px;
  margin-top: -15px;
  border-radius: var(--br-hover, 0 0 20px 20px);
  box-shadow: 0 15px 20px -5px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--bd-hover, #f0f0f0);
  border-top: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s ease;
  z-index: -1;
}

.c-llibre-carousel__card:hover .c-llibre-carousel__card-hover {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.c-llibre-carousel__divider {
  width: 100%;
  height: 2px;
  background-color: var(--bd-hover, #f0f0f0);
  margin: 4px 0;
}

.c-llibre-carousel__cta {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  color: var(--c-link, #5d4d9b);
  font-weight: var(--fw-link, 600);
  font-size: var(--fs-link, 16px);
  text-decoration: none;
  transition: color 0.2s ease;
  gap: 8px;
}

.c-llibre-carousel__cta:first-child {
  border-top: none;
  padding-top: 0;
}

.c-llibre-carousel__cta:hover {
  color: var(--c-link-h, #b2a4d2);
}

/* =========================================================
     RESPONSIVE
     ========================================================= */

@media (max-width: 768px) {
  .c-llibre-carousel {
    display: flex;
    flex-direction: column;
    margin-top: var(--mar-t-mob, 2rem);
    margin-bottom: var(--mar-b-mob, 2rem);
    padding-top: var(--pad-t-mob, 0);
    padding-bottom: var(--pad-b-mob, 0);
  }

  .c-llibre-carousel__header {
    display: contents;
  }

  .c-llibre-carousel__titol {
    order: 1;
    font-size: var(--fs-tit-bloc-mob, 28px);
    padding: 0 var(--grid-margin);
    margin-bottom: var(--mb-head-mob, 24px);
  }

  .c-llibre-carousel__wrapper {
    order: 2;
  }

  .c-llibre-carousel__track-outer {
    padding-bottom: var(--pb-track-mob, 20px);
  }
  
  .c-llibre-carousel__card-image img {
    object-fit: var(--img-fit-mob, cover);
  }

  .c-llibre-carousel__nav {
    order: 3;
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 var(--grid-margin);
    margin-bottom: var(--mb-nav-mob, 60px);
  }

  .c-llibre-carousel__card {
    flex: 0 0 var(--card-w-mob, 205px);
  }
}