.project-dialog {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  padding: 0;
  border: none;
  overflow: hidden;
  background-color: rgba(0, 0, 0, 0.6);
  align-items: center;
  justify-content: center;

  &[open] {
    display: flex;
  }
}

body:has(.project-dialog[open]) {
  overflow: hidden;
}

.project-dialog__inner {
  display: flex;
  align-items: stretch;
  width: min(90vw, 105vh);
  height: min(65vw, 70vh);
  overflow: hidden;
  max-width: 1440px;
  container-type: size;

  @media (max-width: 1040px) {
    position: relative;
    flex-direction: column;
    width: min(100vw, 30rem);
    height: min(100dvh, 54rem);
    background-image: url(../assets/img/mobile/dialog-paper-mobile.webp);
    background-color: var(--base-color-dark);
    background-size: 100% 120%;
    background-repeat: no-repeat;
    background-position: top center;
  }
}

.project-dialog__paper {
  width: 50%;
  height: 100%;
  background-image: url(../assets/img/backgrounds/dialog-paper.webp);
  background-color: var(--base-color-dark);
  background-size: 180% 100%;
  background-repeat: no-repeat;
  background-position: left center;
  padding: clamp(0.5rem, 2vh, 2rem);
  overflow: hidden auto;
  scrollbar-width: none;
  color: var(--base-color-dark);
  min-height: 0;

  @media (max-width: 1040px) {
    width: 100%;
    height: auto;
    background-image: none;
    background-color: transparent;
    padding: clamp(0.5rem, 1.9cqh, 1rem) 1.5rem;
  }

  & > p {
    font-size: clamp(0.7rem, 2.6cqh, 1.25rem);
    padding-top: clamp(0.25rem, 1vh, 1rem);
    padding-left: clamp(0.25rem, 2vw, 2rem);
    width: 75%;

    @media (max-width: 1040px) {
      width: 100%;
      font-size: clamp(0.72rem, 1.9cqh, 1rem);
      margin: 0 0 clamp(0.2rem, 0.95cqh, 0.5rem) 0;
      padding: 0;
    }
  }

  & > h3 {
    font-size: clamp(0.85rem, 3.6cqh, 2rem);
    padding-top: clamp(0.25rem, 1vh, 1rem);
    padding-left: clamp(0.5rem, 2vw, 2rem);

    @media (max-width: 1040px) {
      font-size: clamp(0.8rem, 1.9cqh, 1rem);
      margin: clamp(0.3rem, 1.4cqh, 0.75rem) 0 clamp(0.1rem, 0.47cqh, 0.25rem) 0;
      padding: 0;
    }
  }
}

.project-dialog__back {
  display: flex;
  border: none;
  background-color: transparent;
  font-size: 1.25rem;
  font-weight: bold;
  gap: 1rem;

  @media (max-width: 1040px) {
    position: absolute;
    left: 1.5rem;
    bottom: 1rem;
    color: var(--highlight-color-2-teal);
    font-size: 1rem;
    gap: 0.4rem;
  }

  & img {
    align-self: center;
    filter: var(--highlight-filter-color-2-teal);
  }
}

.project-dialog__title {
  font-size: clamp(1.25rem, 5cqh, 4.5rem);
  padding-top: clamp(0.25rem, 1vh, 1rem);
  padding-left: clamp(0.5rem, 2vw, 2rem);
  position: relative;
  display: inline-block;
  max-width: 75%;

  @media (max-width: 1040px) {
    padding: 0;
    font-size: clamp(1.1rem, 2.85cqh, 1.5rem);
    max-width: none;
  }

  &::before {
    content: "";
    position: absolute;
    left: -40%;
    bottom: -1.5rem;
    width: 185%;
    height: 5rem;
    background-image: url("../assets/img/scribbles/underline.png");
    filter: var(--highlight-filter-color-2-teal);
    background-repeat: no-repeat;
    background-size: 100% 100%;
    transform-origin: 24% center;
    animation: reveal-scale 4s ease-in-out infinite;
  }
}

.project-dialog__tech {
  display: flex;
  flex-wrap: wrap;
  width: 75%;
  padding-top: clamp(0.25rem, 2vh, 1rem);
  padding-left: clamp(0.5rem, 2vw, 2rem);

  & span {
    display: inline-block;
    border: 1px solid #000;
    padding: 0.25rem 0.45rem;
    border-radius: 1rem;
    margin: 0.15rem;
    font-size: clamp(0.65rem, 2cqh, 0.9rem);

    @media (max-width: 1040px) {
      background-color: var(--base-color-bright);
    }
  }

  @media (max-width: 1040px) {
    width: 100%;
  }
}

.project-dialog__preview {
  width: 50%;
  height: 100%;
  background-color: var(--base-color-dark);
  padding: clamp(0.5rem, 2vh, 2rem);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
  padding-top: clamp(1rem, 4vh, 6rem);
  padding-right: clamp(0.5rem, 2vw, 2rem);

  @media (max-width: 1040px) {
    flex: 1;
    width: 100%;
    height: auto;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background-color: transparent;
  }
}

.project-dialog__thumbnail {
  width: 100%;
  height: auto;
  border-radius: 0.5rem;

  @media (max-width: 1040px) {
    flex: 0 1 auto;
    width: auto;
    max-width: 100%;
    min-height: 0;
    margin-block: auto;
    align-self: center;
    object-fit: contain;
  }
}

.project-dialog__links {
  display: flex;
  justify-content: flex-end;
  margin-top: clamp(1rem, 10cqh, 4rem);
  margin-right: clamp(0.25rem, 3cqw, 2rem);
  gap: clamp(0.75rem, calc(17.7cqw - 4.45rem), 6rem);

  @media (max-width: 1040px) {
    justify-content: center;
    gap: 1rem;
    margin: 0;
  }
}

.project-dialog__link {
  position: relative;
  background: transparent;
  border: 2px solid var(--base-color-bright);
  color: var(--base-color-bright);
  border-radius: var(--border-radius-button);
  padding: 0.75rem clamp(0.75rem, 3cqw, 2rem);
  cursor: pointer;
  font-size: 1rem;
  white-space: nowrap;
  box-shadow: 0 4px 0 0 var(--base-color-bright);
  transition:
    background 0.3s,
    transform 0.15s ease,
    box-shadow 0.15s ease;
  text-decoration: none;

  @media (min-width: 1440px) and (max-width: 1560px) {
    padding: 0.75rem 1rem;
  }

  @media (max-width: 1040px) {
    padding: 0.5rem 1.5rem;
    box-shadow: 0 2px 0 0 var(--base-color-bright);
  }

  &:hover {
    background: var(--highlight-color-2-teal);
    transform: translateY(4px);
    box-shadow: none;
  }
  &:hover::before {
    content: "";
    position: absolute;
    inset: -6px -2px 0;
  }
}

.project-dialog__next {
  background: transparent;
  color: var(--highlight-color-2-teal);
  border: none;
  box-shadow: none;
  padding: 0;
  cursor: pointer;
  margin-top: auto;
  align-self: flex-end;
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 1.25rem;
  font-weight: bold;

  @media (max-width: 1040px) {
    margin-top: 0;
    font-size: 1rem;
    gap: 0.4rem;
  }

  & img {
    filter: var(--highlight-filter-color-2-teal);
  }
}
