/* ================================
   PROJECT HERO
================================ */

.project-hero__bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient-hero-overlay);
}

.project-hero__website {
  margin-top: var(--space-md);
}

/* ================================
   PROJECT SECTION (content-height)
================================ */

.proj-section--dark {
  background-color: var(--color-blue);
  color: var(--color-white);
}

/* text + media split */
.proj-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}

/* Yellow text labels are reserved for dark project surfaces. */
.proj-section--dark .label,
.proj-section--dark .proj-stat__label {
  color: var(--color-yellow);
}

.proj-split__text .label {
  margin-bottom: var(--space-sm);
}

.proj-split__text h2 {
  font-size: var(--text-5xl);
  font-weight: 600;
  line-height: 1.1;
  margin-bottom: var(--space-md);
}

.proj-split__text p {
  margin-bottom: var(--space-md);
  max-width: 520px;
}

/* no trailing margin under the last paragraph → the gap to the image is just
   the grid gap (small on mobile), not paragraph-margin + gap stacked */
.proj-split__text p:last-child { margin-bottom: 0; }

.proj-section--dark .proj-split__text p {
  color: var(--text-on-dark);
}

.proj-media {
  width: 100%;
  aspect-ratio: 3 / 2;
  max-height: 62vh;
  object-fit: cover;
  border-radius: var(--radius-lg);
  background-color: var(--color-grey);
}

.proj-split--text-only { grid-template-columns: 1fr; }

.proj-media--contain {
  object-fit: contain;
  background-color: var(--color-white);
}

.project-sdgs__media {
  position: relative;
  isolation: isolate;
  width: 100%;
  aspect-ratio: var(--sdg-media-ratio);
  min-height: calc(var(--sdg-control-height) * (var(--sdg-count, 3) + 1) + var(--space-md) + var(--space-xs));
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--color-blue);
}

.project-sdgs__image,
.project-sdgs__slides,
.project-sdgs__slide,
.project-sdgs__overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.project-sdgs__image { object-fit: cover; }

.project-sdgs__slide {
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity var(--sdg-transition-duration) ease;
  pointer-events: none;
}

.project-sdgs__slide.is-active { opacity: 1; }

.project-sdgs__overlay {
  background: var(--sdg-color);
  opacity: var(--sdg-overlay-opacity);
}

.project-sdgs__filter { position: absolute; }

.project-sdgs__icon {
  position: relative;
  display: block;
  width: var(--sdg-icon-width);
  max-width: calc(var(--space-lg) * 3);
  height: auto;
  aspect-ratio: 1;
  object-fit: contain;
}

.project-sdgs__control {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  max-width: calc(100% - var(--space-md));
  padding-inline: var(--space-sm);
  border-radius: var(--radius-pill);
  background: var(--color-white);
  color: var(--color-blue);
  box-shadow: var(--shadow-sm);
}

.project-sdgs__control[hidden] { display: none; }

.project-sdgs__media .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.project-sdgs__control input {
  flex: 1 1 auto;
  width: calc(var(--space-lg) * 2);
  min-width: 0;
  height: var(--sdg-control-height);
  margin: 0;
  cursor: pointer;
  accent-color: var(--color-blue);
}

.project-sdgs__control input:focus-visible {
  outline: 2px solid var(--color-blue);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.project-sdgs__control output {
  flex: 0 0 auto;
  min-width: 6ch;
  font-family: var(--label-font);
  font-size: var(--label-size);
  font-weight: var(--label-weight);
  text-align: right;
}

@media (prefers-reduced-motion: reduce) {
  .project-sdgs__slide { transition: none; }
}

.project-sdgs__control--dots {
  flex-direction: column;
  padding: 0;
  gap: 0;
  background: transparent;
  box-shadow: none;
}

.project-sdgs__control--dots button,
.project-sdgs__pause {
  display: grid;
  place-items: center;
  width: var(--sdg-control-height);
  height: var(--sdg-control-height);
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--color-white);
  cursor: pointer;
}

.project-sdgs__control--dots [data-sdg-select]::before {
  content: "";
  width: var(--space-xs);
  height: var(--space-xs);
  border-radius: var(--radius-pill);
  background: var(--color-white);
  opacity: var(--sdg-overlay-opacity);
  transition: height var(--sdg-transition-duration) ease;
}

.project-sdgs__control--dots button[aria-pressed="true"]::before {
  height: var(--space-md);
}

.project-sdgs__control--dots button:focus-visible,
.project-sdgs__pause:focus-visible {
  outline: 2px solid var(--color-white);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.project-sdgs__pause {
  position: absolute;
  right: var(--space-sm);
  bottom: var(--space-sm);
  font-size: var(--text-lg);
  line-height: 1;
}

.project-sdgs__pause span {
  display: grid;
  place-items: center;
  width: var(--space-md);
  height: var(--space-md);
  border-radius: var(--radius-pill);
  background: var(--color-blue);
}

.project-sdgs__pause[hidden] { display: none; }

@media (prefers-reduced-motion: reduce) {
  .project-sdgs__control--dots [data-sdg-select]::before { transition: none; }
}

/* ================================
   PROJECT STATS ROW
================================ */
.proj-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: var(--space-lg);
}

.proj-stat {
  padding-left: var(--space-md);
  border-left: 1px solid rgba(35, 45, 57, 0.2);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.proj-section--dark .proj-stat {
  border-left-color: rgba(255,255,255,0.25);
}

.proj-stat__value {
  font-size: var(--text-4xl);
  font-weight: 600;
  line-height: 1;
}

.proj-stat__label {
  font-family: var(--label-font);
  font-size: var(--label-size);
  font-weight: var(--label-weight);
  line-height: 150%;
  letter-spacing: var(--label-spacing);
  text-transform: uppercase;
  color: var(--color-blue);
}

/* ================================
   MILESTONES
================================ */
/* Top-align content so the sticky left column has room to travel */
.proj-section.milestones {
  align-items: start;
}

.milestones__inner {
  width: 100%;
  max-width: var(--max-width-wide);
  margin-inline: auto;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: var(--space-xl);
  align-items: start;
}

/* Left column stays put; the timeline (any length, data-driven) scrolls past it */
.milestones__intro {
  position: sticky;
  top: calc(var(--header-height) + var(--space-sm) + var(--space-xs));
  align-self: start;
}

.milestones__head > .label {
  margin-bottom: var(--space-sm);
}

.milestones__intro h2 {
  margin-bottom: var(--space-md);
}

.milestones__meta > p {
  margin-bottom: var(--space-md);
  max-width: 380px;
}

.milestones__meta {
  width: 100%;
  container-type: inline-size;
}

.milestones__social {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

#milestones-contact > .btn {
  margin-bottom: var(--space-md);
}

.milestones__social a {
  color: var(--color-blue);
  transition: color 0.15s;
}

.milestones__social a:hover {
  color: var(--color-yellow);
}

.project-teamleads {
  width: 100%;
  margin-top: var(--space-md);
  color: var(--color-blue);
}

.project-teamleads__title {
  margin-bottom: var(--space-md);
  color: var(--color-blue);
  font-size: var(--text-xl);
  font-weight: 600;
}

.project-teamleads__list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--board-portrait-width)), 1fr));
  gap: var(--space-md);
}

.project-teamleads__person {
  display: flex;
  min-width: 0;
  max-width: calc(var(--max-width-contact) / 2);
  flex-direction: column;
  align-items: flex-start;
}

/* The portrait keeps its existing grid position and dimensions when interactive. */
.gustav-easter-egg {
  position: relative;
  display: block;
  padding: 0;
  border: 0;
  overflow: hidden;
  cursor: pointer;
  touch-action: manipulation;
}

.gustav-easter-egg:focus-visible {
  outline: calc(var(--space-xs) / 2) solid var(--color-yellow);
  outline-offset: calc(var(--space-xs) / 2);
}

.gustav-easter-egg[aria-busy="true"] { cursor: progress; }

.gustav-easter-egg img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

.gustav-easter-egg img[hidden] { display: none; }

.project-teamleads__photo {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  margin-bottom: var(--space-sm);
  border-radius: var(--radius-lg);
  background-color: var(--color-grey);
  object-fit: cover;
}

.project-teamleads__role {
  margin-bottom: var(--space-sm);
  color: var(--color-blue);
  font-size: var(--text-sm);
}

.project-teamleads__name {
  margin-bottom: var(--space-xs);
  color: var(--color-blue);
  font-size: var(--text-lg);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.project-teamleads__person .btn {
  max-width: 100%;
  min-width: 0;
  white-space: normal;
}

.project-teamleads__person .btn svg { flex-shrink: 0; }

/* ================================
   TIMELINE
================================ */
.timeline {
  position: relative;
  border-left: 2px solid var(--color-yellow);
  padding-left: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.timeline__item {
  position: relative;
}

.timeline__item::before {
  content: '';
  position: absolute;
  left: calc(-1 * var(--space-lg) - 6px);
  top: 4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--color-yellow);
}

.timeline__year {
  font-family: var(--label-font);
  font-size: var(--label-size);
  font-weight: var(--label-weight);
  letter-spacing: var(--label-spacing);
  text-transform: uppercase;
  color: var(--color-blue);
  margin-bottom: var(--space-xs);
}

.timeline__title {
  font-size: var(--text-lg);
  font-weight: 600;
  margin-bottom: var(--space-xs);
}

.timeline__desc {
  font-size: var(--text-sm);
  color: var(--color-blue);
  max-width: 460px;
}

.timeline__image {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius-md);
  background-color: var(--color-grey);
  margin-top: var(--space-md);
}

.timeline__image--portrait {
  aspect-ratio: var(--timeline-portrait-ratio);
}

.timeline__image--natural {
  aspect-ratio: auto;
}

/* ================================
   RESPONSIVE
================================ */
@media (max-width: 900px) {
  .project-hero__content {
    padding-inline: var(--space-md);
  }

  .proj-split,
  .milestones__inner {
    grid-template-columns: 1fr;
    gap: var(--space-sm);
  }

  .proj-split__text h2 { font-size: var(--text-3xl); margin-bottom: var(--space-sm); }

  /* tighter heading→text and paragraph spacing on mobile */
  .proj-split__text p { margin-bottom: var(--space-sm); }

  /* smaller gap between milestone entries */
  .timeline { gap: var(--space-md); }

  .project-teamleads { margin-top: var(--space-md); }

  .project-teamleads__list {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-sm);
  }

  .project-teamleads__person {
    display: grid;
    max-width: none;
    grid-template-columns: calc(var(--space-lg) + var(--space-md)) minmax(0, 1fr);
    grid-template-rows: auto auto 1fr;
    align-items: end;
    column-gap: var(--space-sm);
  }

  .project-teamleads__photo {
    grid-column: 1;
    grid-row: 1 / -1;
    margin: 0;
  }

  .project-teamleads__person .btn {
    justify-self: start;
    max-width: 100%;
    min-width: 0;
    min-height: var(--space-md);
    gap: calc(var(--space-xs) / 2);
    padding: calc(var(--space-xs) / 2) var(--space-xs);
    font-size: var(--text-xs);
    white-space: normal;
  }

  .project-teamleads__person .btn svg {
    width: var(--space-sm);
    height: var(--space-sm);
  }

  /* Mobile milestones order: heading → timeline → intro text/socials → team lead.
     display:contents lifts the intro's head/meta out so they're siblings of the
     timeline in the flex column, then `order` interleaves them. */
  .milestones__inner {
    display: flex;
    flex-direction: column;
  }

  .milestones__intro {
    position: static;
    display: contents;
  }

  .milestones__head { order: 1; }
  .timeline { order: 2; }
  .milestones__meta { order: 3; }

  /* heading sits directly on the timeline — flex gap owns the spacing */
  .milestones__intro h2 { margin-bottom: 0; }

  .proj-stats {
    grid-template-columns: 1fr;
    gap: var(--space-sm);
    margin-top: var(--space-md);
  }

  .proj-stat {
    padding-left: 0;
    border-left: none;
  }
}
