/* ============================================================
   SINGLE PROJECT — ESTILS GENERAL
============================================================ */

.single-project .project {
  max-width: 90%;
  margin: 0 auto;
  padding: 2rem 1rem 4rem;
  color: #222;
}

/* Hero */
.project-hero {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 40px;
  align-items: start;
  margin-top: 8rem;
}

.project-hero__left {
  max-width: 605px;
}
.project-hero__media {
  width: 950px;
  height: 650px;
}

/* Project Tags */
.project-hero__tags {
  display: flex;
  gap: 12px;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.project-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #dcd6cc;
  color: #383131 !important;
  border-radius: 30px;
  padding: 0 14px;
  height: 32px;
  font-weight: 500;
  font-size: 15px;
  text-transform: capitalize;
  text-decoration: none !important;
}

.project-tag:hover {
  background: #fff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* Ajustar tags per a pantalles mitjanes (tablets/laptops petits) */
@media (min-width: 961px) and (max-width: 1562px) {
  .project-hero__tags {
    gap: 8px;
  }

  .project-tag {
    padding: 4px 12px;
    font-size: 14px;
    height: auto;
    white-space: nowrap;
  }
}

/* Title + Subtitle */
.project-hero__title {
  font-size: 48px;
  font-weight: 700;
  line-height: 1.1;
  margin: 0;
  color: #383131;
}

.project-hero__subtitle {
  margin-top: 1rem;
  font-weight: 400;
  font-size: 24px;
  line-height: 36px;
}

/* Researchers */
.project-hero__titulin {
  margin-top: 1rem;
  font-weight: 700;
  font-size: 16px;
  line-height: 24px;
  text-transform: uppercase;
}

.project-hero__researchers {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Researcher card */
.ra-resp {
  display: flex;
  gap: 16px;
  align-items: center;
}

.ra-resp__photo {
  width: 82px;
  height: 82px;
  border-radius: 50%;
  object-fit: cover;
  transition: 0.25s ease;
}

.ra-resp__photo-link:hover .ra-resp__photo {
  transform: scale(1.05);
  opacity: 0.9;
}

.ra-resp__name a {
  font-weight: 600;
  font-size: 16px;
  line-height: 24px;
  color: #383131;
  text-decoration: none;
}

.ra-resp__position {
  font-weight: 400;
  font-size: 14px;
  margin-top: -1rem;
  color: #383131;
}

/* Hero media */
.project-hero__media img,
.project-hero__media video {
  width: 950px;
  height: 650px;
  object-fit: cover;
  border-radius: 12px;
}

@media (max-width: 960px) {
  .project-hero__media img,
  .project-hero__media video {
    width: 100% !important;
    height: auto !important;
    max-height: 380px;
  }

  .project-hero__media {
    width: 100% !important;
    height: auto !important;
  }
}

/* ============================================================
   SUMMARY + PROJECT DATA
============================================================ */

.project-flex {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 40px;
  margin-top: 4rem;
  align-items: start;
}

/* Afegir marge superior a la columna dreta en desktop */
@media (min-width: 961px) {
  .project-flex__right {
    margin-top: 0;
  }
}

.project__section-title {
  font-weight: 700;
  font-size: 40px;
  line-height: 48px;
  letter-spacing: -0.3px;
}

.project__summary {
  font-size: 16px;
  line-height: 24px;
  overflow-x: hidden;
  width: 100%;
}

.project__summary > * {
  max-width: 100%;
}

/* Limitar mida de mitjans dins del summary */
.project__summary img,
.project__summary video {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Contenidor responsive per a vídeos embeguts (YouTube, Vimeo, etc.) */
.project__summary iframe {
  max-width: 100%;
  width: 100%;
  aspect-ratio: 16 / 9;
  display: block;
  border: none;
}

/* Fallback per a navegadors sense suport d'aspect-ratio */
@supports not (aspect-ratio: 16 / 9) {
  .project__summary iframe {
    height: 450px;
  }

  @media (max-width: 768px) {
    .project__summary iframe {
      height: 250px;
    }
  }

  @media (max-width: 480px) {
    .project__summary iframe {
      height: 200px;
    }
  }
}

.project__summary video {
  max-height: 500px;
  width: 100%;
  object-fit: cover;
}

/* Contenidors de figures/divs amb vídeo */
.project__summary figure,
.project__summary .wp-block-video,
.project__summary .wp-block-embed,
.project__summary .wp-video {
  margin: 1rem 0;
  max-width: 100% !important;
  width: 100% !important;
  height: auto !important;
}

.project__summary figure video,
.project__summary .wp-block-video video,
.project__summary .wp-video video {
  width: 100%;
  max-height: 500px;
  object-fit: cover;
}

/* Contenidor d'imatges de WordPress */
.project__summary .wp-block-image,
.project__summary .wp-caption {
  max-width: 100% !important;
  height: auto !important;
}

.project__summary .wp-block-image img,
.project__summary .wp-caption img {
  width: 100%;
  height: auto;
}

/* Data Box */
.project__info-box {
  padding: 1.5rem;
}

.project__data-list {
  display: grid;
  gap: 1rem;
}

.project__data-item dt {
  font-weight: 700;
  font-size: 16px;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.project__data-item dd {
  font-size: 16px;
  margin: 0;
}

/* Files */
.project-files {
  margin-top: 3rem;
}
.project-files__btn {
  display: inline-block;
  padding: 10px 18px;
  border-radius: 6px;
  background: #383131;
  color: #fff;
  text-decoration: none;
}

.project-data-list {
  list-style: none;
  display: contents;
}

.project-data-list a {
  color: #222 !important;
}

/* Responsive */
@media (max-width: 960px) {
  .project-hero {
    grid-template-columns: 1fr;
  }
  .project-hero__right {
    order: -1;
  }
  .project-flex {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .project-flex__left {
    overflow-x: hidden;
    max-width: 100%;
    width: 100%;
  }

  .project__summary video,
  .project__summary figure video,
  .project__summary .wp-block-video video,
  .project__summary .wp-video video {
    max-height: 250px;
    width: 100%;
  }

  .project__summary .wp-video,
  .project__summary .wp-block-image,
  .project__summary .wp-caption {
    max-width: 100% !important;
    width: 100% !important;
  }

  .project__info-box {
    order: 2;
  }
}

@media (max-width: 640px) {
  .project-flex {
    gap: 16px;
  }

  .project__section-title {
    font-size: 28px;
    line-height: 36px;
  }

  .project__summary video,
  .project__summary figure video,
  .project__summary .wp-block-video video,
  .project__summary .wp-video video {
    max-height: 180px;
    width: 100%;
  }

  .project__summary img {
    width: 100%;
    height: auto;
  }

  .project__summary figure,
  .project__summary .wp-block-video,
  .project__summary .wp-video,
  .project__summary .wp-block-image {
    margin: 0.5rem 0;
    max-width: 100% !important;
    width: 100% !important;
  }
}

@media (max-width: 640px) {
  .project-hero__title {
    font-size: 32px;
  }
  .project-hero__subtitle {
    font-size: 18px;
  }
  .ra-resp__photo {
    width: 64px;
    height: 64px;
  }
}

/* ============================================================
   RA CAROUSEL (MEDIA GALLERY + RELATED PROJECTS)
============================================================ */

.ra-carousel {
  position: relative;
  width: 100%;
  margin-top: 2rem;
}

/* VIEWPORT (scroll horitzontal) */
.ra-carousel__viewport {
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  display: flex;
  gap: 24px;
  padding-bottom: 12px;
  scroll-behavior: smooth;
}

.ra-carousel__viewport::-webkit-scrollbar {
  height: 6px;
}
.ra-carousel__viewport::-webkit-scrollbar-thumb {
  background: #cfcfcf;
  border-radius: 4px;
}

/* TRACK */
.ra-carousel__track {
  display: flex;
  gap: 24px;
}

/* SLIDE BASE */
.ra-carousel__slide {
  flex: 0 0 360px;
  scroll-snap-align: start;
}

/* ============================================================
   MEDIA GALLERY — ONE IMAGE CAROUSEL
============================================================ */

/* Contenidor general */
.project-media-gallery {
  margin-top: 2rem;
  clear: both;
}

/* Viewport: ara només es veu UNA slide */
.project-media-gallery .ra-carousel__viewport {
  overflow: hidden; /* amaguem les altres */
  padding-bottom: 0;
  margin-top: -4rem;
}

/* TRACK — fa scroll suau */
.project-media-gallery .ra-carousel__track {
  display: flex;
  transition: transform 0.4s ease;
}

/* SLIDE: ocupa tot l’ample */
.project-media-gallery .ra-carousel__slide {
  flex: 0 0 100%;
  scroll-snap-align: center;
  display: flex;
}

/* Imatges */
.project-media-gallery .ra-carousel__slide img {
  width: 100%;
  max-width: 880px;
  height: 500px;
  object-fit: cover;
  border-radius: 18px;
  border: 1px solid #ddd;
  background: #f4f4f4;
}

/* ---- Controls avall ---- */
.project-media-gallery .ra-carousel__controls {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

/* Dots centrats */
.project-media-gallery .ra-carousel__dots {
  display: flex;
  gap: 10px;
  justify-content: flex-start;
}

/* Fletxes posicionades baix */
.project-media-gallery .ra-carousel__arrows {
  display: flex;
  gap: 20px;
  justify-content: center;
}

.project-media-gallery .ra-carousel__arrow {
  position: relative;
  transform: none;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid #73edff;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  backdrop-filter: blur(6px);
  font-size: 22px;
  transition: 0.25s ease;
}

.project-media-gallery .ra-carousel__arrow--prev {
  top: 533px;
  left: 780px;
}
.project-media-gallery .ra-carousel__arrow--next {
  top: 490px;
  left: 830px;
}

.project-media-gallery .ra-carousel__arrow:hover {
  background: transparent;
  transform: scale(1.08);
}

/* Icones */
.ra-carousel__arrow--prev::before {
  content: "‹";
}
.ra-carousel__arrow--next::before {
  content: "›";
}

.project-media-gallery .ra-carousel__dots {
  display: flex;
  justify-content: flex-start;
  gap: 10px;
  margin-top: 30px;
}

.project-media-gallery .ra-carousel__dot {
  width: 10px;
  height: 10px;
  background: #c9c9c9;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  transition: 0.25s ease;
}

.project-media-gallery .ra-carousel__dot.is-active {
  background: #383131;
  transform: scale(1.2);
}
*/

/* Quan només hi ha 1 slide → ocultar controls */
.project-media-gallery .ra-carousel--no-controls .ra-carousel__dots,
.project-media-gallery .ra-carousel--no-controls .ra-carousel__arrow {
  display: none !important;
}

/* Ajustar botons entre 860px i 960px */
@media (min-width: 861px) and (max-width: 960px) {
  .project-media-gallery .ra-carousel__arrow--prev {
    left: 65%;
  }
  .project-media-gallery .ra-carousel__arrow--next {
    left: calc(65% + 50px);
  }
}

/* -------------------------- */
@media (max-width: 960px) {
  .project-media-gallery {
    margin-top: 2rem !important; /* abans -16rem */
  }

  .project-flex {
    margin-bottom: 4rem; /* evitar solapament */
  }
}

/* ============================================================
   MEDIA GALLERY — IMAGE / VIDEO 
============================================================ */

.project-media-slide__img,
.project-media-slide__video {
  width: 100%;
  max-width: 860px;
  height: 500px;
  border-radius: 18px;
  object-fit: cover;
  background: #000;
}

/* ============================================================
   MEDIA GALLERY — BASE STYLE FOR FILE BLOCKS (PDF, AUDIO, DOCS…)
============================================================ */

.project-media-file,
.project-media-audio,
.project-media-pdf {
  width: 860px;
  height: 500px;
  border-radius: 18px;
  border: 2px dashed #bbb;
  background: #f6f6f6;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;

  padding: 20px;
}

/* ICONA (PDF, DOC, AUDIO…) */
.project-media-file__icon,
.project-media-pdf__icon,
.project-media-audio__icon {
  font-size: 64px;
  margin-bottom: 12px;
}

/* TÍTOL (nom del fitxer) */
.project-media-file__title,
.project-media-pdf__title,
.project-media-audio__title {
  font-size: 18px;
  margin-bottom: 12px;
  color: #383131;
  max-width: 80%;
}

/* BOTÓ (mateix estil que el teu PDF) */
.project-media-file__btn,
.project-media-pdf__btn,
.project-media-audio__btn {
  display: inline-block;
  padding: 16px 16px;
  background: #f9f3e7;
  border: 1px solid #575252;
  border-radius: 32px;
  color: black !important;
  text-decoration: none !important;
  font-size: 16px;
  min-width: 160px;
}

/* ============================================================
   AUDIO BLOCK
============================================================ */

.project-media-file__audio {
  width: 70%;
  margin-top: 16px;
}

/* ================================
   FIX CONFLICTE AUDIO / VÍDEO / PDF
   ================================ */

/* El slide NO rep events de pointer */
.project-media-slide {
  pointer-events: none;
}

/* Però els elements interactius SÍ */
.project-media-slide video,
.project-media-slide audio,
.project-media-file,
.project-media-audio,
.project-media-pdf,
.project-media-file__btn {
  pointer-events: auto;
}

.project-media-slide video,
.project-media-slide audio {
  touch-action: none;
}

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

@media (max-width: 900px) {
  .project-media-slide__img,
  .project-media-slide__video,
  .project-media-file,
  .project-media-audio,
  .project-media-pdf {
    width: 100%;
    height: 360px;
  }
}

@media (max-width: 600px) {
  .project-media-slide__img,
  .project-media-slide__video,
  .project-media-file,
  .project-media-audio,
  .project-media-pdf {
    height: 260px;
  }

  .project-media-file__icon {
    font-size: 52px;
  }
}
/* ============================================================
   FILES SECTION (Simple download buttons)
============================================================ */

.project-files-download {
  margin-top: 3rem;
  margin-bottom: 3rem;
}

.project-files-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: flex-start; /* evitar que s'estiren */
}

/* Botó d'arxiu */
.project-file-btn {
  width: auto;
  display: inline-flex;
  align-items: center;
  gap: 50px;
  padding: 14px 30px;
  background: #f9f3e7;
  border: 1px solid #575252;
  border-radius: 32px;
  text-decoration: none !important;
  color: #575252 !important;
  font-size: 16px;
  line-height: 1.4;
  transition: 0.25s ease;
  cursor: pointer;
}

.project-file-btn:hover {
  background: #73edff;
  color: #575252 !important;
  border: none;
  gap: 5px;
  transition: gap 0.3s ease;
}
/* Animació de la icona cap al text en hover */
.project-file-btn:hover .project-file-btn__icon {
  transform: translateX(-10x);
  transition: transform 0.25s ease;
}

/* Una miqueta de suavitat extra perquè no quede enganxat del tot */
.project-file-btn:hover .project-file-btn__icon {
  margin-right: 8px;
  transition: margin-right 0.3s ease;
}

.project-file-btn__icon {
  font-size: 28px;
  min-width: 32px;
}

.project-file-btn__name {
  flex-grow: 1;
  word-break: break-word;
  font-weight: 600;
  font-style: Semi Bold;
  font-size: 16px;
  line-height: 24px;
  letter-spacing: 0px;
}

.project-file-btn__ext {
  opacity: 0.8;
  font-weight: 500;
}

/* ============================================================
   RELATED PROJECTS
============================================================ */

.project-related .project__section-title {
  margin-bottom: 2rem;
}

.project-related-carousel.ra-carousel {
  margin-top: 0 !important;
}

/* Reduir el marge negatiu en tablet i mòbil */
@media (max-width: 960px) {
  .project-related .project__section-title {
    margin-bottom: 2rem;
  }

  .project-related-carousel.ra-carousel {
    margin-top: 0.5rem !important;
  }
}

.project-related-carousel .ra-carousel__slide {
  flex: auto !important;
  width: 610px;
  border-radius: 6px;
  overflow: hidden;
  transition: background-color 0.2s ease;
  height: auto;
  min-height: 540px;
}

/* Targeta */
.project-card {
  width: 100%;
  max-width: 100%;
  border-radius: 6px;
  overflow: hidden;
  transition: background-color 0.2s ease;
  height: auto;
  min-height: 540px; /* equilibrat */
}

.latest-project__tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #38313126;
  color: #383131;
  border-radius: 30px;
  padding: 0 14px;
  height: 32px;
  margin-bottom: 14px;
  font-weight: 500;
  font-size: 16px;
}

.project-card__link {
  display: block;
  text-decoration: none !important;
  color: inherit;
}

/* Imatge */
.project-card__img {
  width: 100%;
  height: 300px;
  object-fit: cover;
  border-radius: 16px;
}

/* Borde per a imatges placeholder */
.project-card__img--ph {
  border: 1px solid #ddd;
}

/* Contingut */
.project-card__content {
  padding: 0.75rem 1rem;
}

/* Títol */
.project-card__title {
  font-weight: 600;
  font-size: 32px;
  line-height: 40px;
  color: #383131;
  margin-top: 0;
}

/* Extracte */
.project-card__excerpt {
  font-size: 16px;
  line-height: 24px;
  margin-top: -15px;
  color: #383131;
}

/* Anys */
.project-card__years {
  font-weight: 500;
  font-size: 16px;
  color: #383131;
}

/* Botó READ MORE */
.project-card__more-wrapper {
  margin-top: auto;
  padding: 0 1rem 1rem;
}

.project-card__more {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
  color: #575252 !important;
  text-decoration: none !important;
  font-weight: 600;
  position: relative;
  padding-bottom: 4px;
  transition:
    gap 0.25s ease,
    transform 0.25s ease;
}

.project-card__more::after {
  content: "→";
}

.project-card__more::before {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
}

.project-card__more:hover {
  gap: 0.3rem;
  transform: translateX(6px);
}
.project-card__more:hover::before {
  transform: scaleX(1);
}

@media (max-width: 640px) {
  .project-related-carousel.ra-carousel {
    margin-top: 0;
  }
  .project-related-carousel .ra-carousel__slide {
    width: 80vw;
  }
}

/* ============================================================
   DOTS (PUNTS)
============================================================ */

.ra-carousel__dots {
  display: flex;
  gap: 10px;
  justify-content: flex-start;
  margin-top: 25px;
}

.ra-carousel__dot {
  width: 10px;
  height: 10px;
  background: #c9c9c9;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  transition: 0.25s ease;
}

.ra-carousel__dot.is-active {
  background: #383131;
  transform: scale(1.2);
}

/* Quan només hi ha 1 slide → ocultar controls */
.ra-carousel--no-controls .ra-carousel__dots,
.ra-carousel--no-controls .ra-carousel__arrow {
  display: none !important;
}

/* ============================================================
   CONTROLS (DOTS + FLETXES)
============================================================ */

.ra-carousel__controls {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin-top: 2rem;
}

.ra-carousel__arrows {
  display: flex;
  gap: 20px;
  margin-left: 60%;
}

/* ============================================================
   FLETXES (LEFT / RIGHT)
============================================================ */

.ra-carousel__arrow {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid #73edff;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  backdrop-filter: blur(6px);
  font-size: 22px;
  transition: 0.25s ease;
}

.ra-carousel__arrow:hover {
  background: transparent;
  transform: scale(1.08);
}

/* Icones unicode */
.ra-carousel__arrow--prev::before {
  content: "‹";
}
.ra-carousel__arrow--next::before {
  content: "›";
}

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

@media (max-width: 860px) {
  .ra-carousel__arrow {
    display: none;
  }

  .ra-carousel__slide {
    flex: 0 0 80%;
  }

  .project-media-gallery .ra-carousel__slide img {
    height: 240px;
  }
}

@media (max-width: 560px) {
  .project-tag {
    height: auto;
  }

  .latest-project__tag {
    height: auto;
  }

  .ra-carousel__slide {
    flex: 0 0 88%;
  }

  .project-media-gallery .ra-carousel__slide img {
    height: 200px;
  }

  .ra-carousel__dots {
    gap: 6px;
  }

  .ra-carousel__dot {
    width: 8px;
    height: 8px;
  }
}

/* ============================================================
   MOBILE ARROWS UNDER DOTS (NO BREAKING ANYTHING)
============================================================ */

/* Ocultar les fletxes originals en mòbil */
@media (max-width: 860px) {
  .project-media-gallery .ra-carousel {
    margin-top: 7rem;
  }
  .project-media-gallery .ra-carousel__arrow {
    display: none !important;
  }
}

/* Contenidor de fletxes mòbils */
.ra-carousel__arrows-mobile {
  display: none; /* ocult per defecte */
}

@media (max-width: 860px) {
  .ra-carousel__arrows-mobile {
    display: flex;
    justify-content: flex-start;
    gap: 20px;
    margin-top: 16px;
  }

  .ra-carousel__arrow-mobile {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid #73edff;
    background: transparent;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 22px;
    cursor: pointer;
    backdrop-filter: blur(6px);
    transition: 0.25s ease;
  }

  .ra-carousel__arrow-mobile:hover {
    transform: scale(1.08);
  }
}
