.project-modal .modal-dialog {
  max-width: calc(100% - 32px);
  margin-inline: auto;
}

.project-modal .modal-content {
  position: relative;
  border: 0;
  border-radius: 24px;
  background: var(--brand-off-white);
  color: var(--brand-retro-black);
}

.project-modal__close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--brand-retro-black);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.3s;
}

.project-modal__close:hover,
.project-modal__close:focus-visible {
  background: var(--brand-cerulean-blue);
}

/* .modal-body scrolls (modal-dialog-scrollable) and keeps the padding; the grid
   is on .project-modal__inner, since a scrolling grid drops its bottom padding. */
.project-modal .modal-body {
  padding: 56px 20px 24px;
}

.project-modal__inner {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
}

.project-modal__content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 32px;
  hyphens: none;
}

.project-modal .section-title {
  margin-bottom: 0;
}

.project-modal .section-title__subtitle,
.project-modal .section-title__heading {
  color: var(--brand-retro-black);
}

.project-modal__body {
  font: 400 18px/150% var(--font-ideal-sans-regular), sans-serif;
}

.project-modal__body p {
  font-size: inherit;
}

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

/* button.style 'link': an underlined link instead of the blue button. */
.project-modal__link {
  align-self: flex-start;
  text-decoration: underline;
  color: var(--brand-cerulean-blue);
}

/* Status tag and country, between the subtitle and the title. Same look as
   on project-list-card. */
.project-modal__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.project-modal__tag {
  width: fit-content;
  padding: 4px 10px;
  background: var(--brand-blue-ivy);
  color: #fff;
  font-size: 16px;
}

.project-modal__country {
  font: 500 16px/150% var(--font-ideal-sans-medium), sans-serif;
  color: var(--brand-neutral-8);
}

.project-modal__details {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.project-modal__details .item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.project-modal__details .detail-label {
  font: 500 14px/140% var(--font-ideal-sans-medium), sans-serif;
  color: var(--brand-neutral-8);
}

.project-modal__details .detail-value {
  margin-left: 0;
  font: 400 14px/140% var(--font-ideal-sans-regular), sans-serif;
  color: var(--brand-neutral-8);
}

/* Officer is formatted text and may come wrapped in <p>. */
.project-modal__details .detail-value p {
  margin-bottom: 0;
  font-size: inherit;
}

.project-modal .project-modal__button {
  width: fit-content;
}

.project-modal__media {
  aspect-ratio: 11 / 10;
  border-radius: 48px;
  overflow: hidden;
  background: var(--brand-oxford-blue);
}

.project-modal__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.modal-dialog-scrollable .modal-body {
	--sb-gap: 6px;
	--sb-radius: 4.5px;
}

.modal-dialog-scrollable .modal-body::-webkit-scrollbar {
	width: 15px;
	background-color: transparent;
}

.modal-dialog-scrollable .modal-body::-webkit-scrollbar-track,
.modal-dialog-scrollable .modal-body::-webkit-scrollbar-thumb {
	border-right: var(--sb-gap) solid transparent;
	background-clip: padding-box;
	border-radius:
		var(--sb-radius) calc(var(--sb-radius) + var(--sb-gap)) calc(var(--sb-radius) + var(--sb-gap)) var(--sb-radius)
		/ var(--sb-radius);
}

.modal-dialog-scrollable .modal-body::-webkit-scrollbar-track {
	margin-block: 24px;
	-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
	background-color: #F5F5F5;
}

.modal-dialog-scrollable .modal-body::-webkit-scrollbar-thumb {
	-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,.3);
	background-color: var(--brand-poseidon);
}

@media (min-width: 640px) {
  .project-modal__details {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 768px) {
  .project-modal .modal-body {
    padding: 64px 40px 40px;
  }

  .project-modal__content {
    gap: 40px;
  }

  /* No image column: the content takes the full width. */
  .project-modal--no-image .project-modal__inner {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 992px) {
  .project-modal .modal-dialog {
    max-width: calc(100% - 150px);
  }

  .project-modal .modal-body {
    padding: 80px 50px;
  }

  .project-modal__details {
    grid-template-columns: 1fr;
  }

  .project-modal__inner {
    grid-template-columns: repeat(2, 1fr);
    gap: 40px;
  }

  .project-modal__media {
    flex: 1;
    align-self: stretch;
    aspect-ratio: auto;
    min-height: 480px;
  }

  .project-modal__close {
    top: 20px;
    right: 20px;
  }
}

@media (min-width: 1200px) {
  .project-modal .modal-body {
    padding: 80px;
  }

  .project-modal__close {
    top: 40px;
    right: 40px;
  }

  .project-modal__details {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1700px) {
  .project-modal .modal-body {
    padding: 100px 120px;
  }

  .project-modal .modal-dialog {
    max-width: 1600px;
  }

  .project-modal__content {
    padding: 40px 56px;
  }

  .project-modal__details {
    grid-template-columns: repeat(3, 1fr);
  }
}
