
/* project/_home_fragment.html — every Proyecto sub-section (Descripción,
   Objetivos, Equipo, Colaboradores, Entidades de apoyo): the sub-section
   pills, the content included from project/_<sub-section>.html (text pages,
   photo + name and logo + name cards) and the previous/next links.
   Pills and grids wrap instead of ever scrolling sideways. */

.project__eyebrow {
  margin: 0 0 0.25rem;
  color: var(--color-accent-text);
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* --- Sub-section pills ------------------------------------------------------------ */

.project-subnav {
  margin-bottom: var(--space-3);
}

.project-subnav__list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.project-subnav__link {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap-size);
  padding: 0.4rem 1rem;
  border: 1px solid var(--color-main);
  border-radius: 999px;
  color: var(--color-main);
  font-weight: 600;
  line-height: 1.25;
  text-decoration: none;
}

.project-subnav__link:hover {
  background: var(--color-main-soft);
}

/* Current sub-section: filled, not just a colour change. */
.project-subnav__link[aria-current="page"],
.project-subnav__link[aria-current="page"]:hover {
  background: var(--color-main);
  color: var(--color-on-main);
}

/* Phones: a little tighter, so more pills fit on each line. */
@media (max-width: 39.99rem) {
  .project-subnav__list {
    gap: 0.4rem;
  }

  .project-subnav__link {
    padding: 0.35rem 0.8rem;
    font-size: 0.9375rem;
  }
}

/* --- Content: as wide as the page ------------------------------------------------ */

/* Opening paragraph of Descripción / Objetivos: a tinted panel across the
   whole width, with the teal rule of the section heading at its side. */
.project-lead {
  margin: 0 0 var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-left: 4px solid var(--color-accent);
  border-radius: var(--radius);
  background: var(--color-main-soft);
  font-size: clamp(1.0625rem, 1rem + 0.25vw, 1.25rem);
}

/* Long texts are justified; hyphenation uses the page's language, or the
   text's own lang=, to keep word spacing more even in narrow columns. */
.project-prose p,
.project-lead,
.objective__text {
  text-align: justify;
  -webkit-hyphens: auto;
  hyphens: auto;
}

/* The rest of Descripción: one column, as wide as the page. */
.project-prose p {
  margin: 0 0 1rem;
}

.project-prose p:last-child {
  margin-bottom: 0;
}

.project-prose .project-lead {
  margin-bottom: var(--space-3);
}

/* --- Objetivos: four numbered cards, 2 × 2 from tablet width --------------------- */

.objectives {
  display: grid;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 48rem) {
  .objectives {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.objective {
  padding: var(--space-3);
  border-radius: var(--radius);
  background: var(--color-accent-soft);
  box-shadow: var(--shadow-card);
}

.objective__title {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
  margin: 0 0 0.75rem;
  color: var(--color-text);
  font-size: 1.125rem;
}

.objective__number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: var(--color-main);
  color: var(--color-on-main);
  line-height: 1;
}

.objective__text {
  margin: 0;
}

/* --- Equipo / Entidades de apoyo: photo (or logo) + name cards -------------------
   People and standard entities use a responsive grid. */

.people,
.entities {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 8rem), 1fr));
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 40rem) {
  .people,
  .entities {
    grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
    gap: var(--space-2);
  }
}

.person,
.entity {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: var(--space-2) var(--space-1);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  overflow-wrap: break-word;
  text-align: center;
}

.person {
  background: var(--color-main-soft);
}

.entity {
  background: var(--color-accent-soft);
}

/* --- Team entities: combine person colours with entity logos ---------------------
   These cards are centred below the team, with the same main-colour background
   as people cards and the white logo container used by standard entities. */

.entities--team {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: stretch;
  gap: var(--space-2);
  width: 100%;
  max-width: 58rem;
  margin: var(--space-3) auto 0;
}

/* Compact cards on phones; wider cards on larger screens. */
.entities--team .entity {
  box-sizing: border-box;
  flex: 0 1 8.5rem;
  min-width: 0;
  background: var(--color-main-soft);
}

@media (min-width: 40rem) {
  .entities--team .entity {
    flex-basis: 13rem;
  }
}

/* Keep the logos inside a white 3:2 frame, with the same white edge
   and subtle outline used on the team photos. */
.entities--team .entity__logo {
  box-sizing: border-box;
  width: 100%;
  max-width: 9.5rem;
  aspect-ratio: 3 / 2;
  border: 3px solid var(--color-bg);
  box-shadow: 0 0 0 1px var(--color-main-tint);
  background: var(--color-bg);
}

/* Prevent long institution names from stretching the cards. */
.entities--team .entity__name {
  max-width: 100%;
  overflow-wrap: anywhere;
  font-weight: 700;
  line-height: 1.3;
}

/* Round photo with the white edge of the news-card images. Until there is
   one, the initials fill the same circle; the name follows. */
.person__photo {
  width: min(9.5rem, 100%);
  height: auto;
  aspect-ratio: 1;
  margin-bottom: 0.5rem;
  border: 3px solid var(--color-bg);
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--color-main-tint);
  object-fit: cover;
}

.person__photo--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg);
  color: var(--color-main);
  font-size: clamp(1.5rem, 1.1rem + 1.5vw, 2.25rem);
  font-weight: 700;
  letter-spacing: 0.04em;
}

.person__name,
.entity__name {
  margin: 0;
  font-weight: 700;
  line-height: 1.3;
}

.person__institution {
  margin: 0;
  color: var(--color-muted);
  font-size: 0.875rem;
  line-height: 1.35;
}

/* Standard logo container: the whole logo is visible, never cropped.
   Fixed 3:2 proportions keep all entity cards visually consistent. */
.entity__logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 3 / 2;
  margin-bottom: 0.5rem;
  padding: 0.75rem;
  box-sizing: border-box;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--color-bg);
}

.entity__logo img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
}

.entity__icon {
  width: 2.5rem;
  height: 2.5rem;
  color: var(--color-accent-text);
  flex-shrink: 0;
}

/* --- Colaboradores: "Proyecto financiado por" + "Con la colaboración de" -------- */

.project-group + .project-group {
  margin-top: var(--space-4);
}

.project-group__title {
  margin: 0 0 var(--space-2);
  color: var(--color-main);
  font-size: clamp(1.2rem, 1.1rem + 0.4vw, 1.4rem);
}

/* The funder stands out: one card about twice as wide as a collaborator's,
   with a bigger logo and name. */
.entities--featured {
  grid-template-columns: minmax(0, 34rem);
}

.entities--featured .entity {
  padding: var(--space-3);
}

.entities--featured .entity__logo {
  aspect-ratio: 5 / 2;
  padding: var(--space-2);
}

.entities--featured .entity__name {
  font-size: clamp(1.1rem, 1rem + 0.4vw, 1.3rem);
}

/* --- Previous / next sub-section ------------------------------------------------- */

.project-pager {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border);
}

.project-pager__link {
  display: flex;
  flex: 1 1 14rem;
  flex-direction: column;
  gap: 0.1rem;
  max-width: 24rem;
  min-height: var(--tap-size);
  padding: 0.75rem 1rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  text-decoration: none;
}

.project-pager__link:hover {
  border-color: var(--color-main);
  background: var(--color-main-soft);
}

/* "Siguiente" stays on the right, even when it is the only link. */
.project-pager__link--next {
  align-items: flex-end;
  margin-left: auto;
  text-align: right;
}

.project-pager__hint {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--color-muted);
  font-size: 0.875rem;
}

.project-pager__icon {
  width: 1rem;
  height: 1rem;
}

.project-pager__label {
  font-weight: 700;
}