/* dialog */
.journal-dialog {
  max-width: 100%;
  max-height: 100%;
  width: 100%;
  height: 100dvh;
  margin: auto;
  padding: 0;
  border: 0;
  background: transparent;
  opacity: 0;
  transform: scale(0.95);
  transition: opacity 0.3s ease,
  transform 0.3s ease;

  &.is-open {
    opacity: 1;
    transform: scale(1);
  }

  &::backdrop {
    background: rgba(0, 0, 0, 0);
    transition: background 0.3s ease;
  }

  &.is-open::backdrop {
    background: rgba(0, 0, 0, 0.95);
  }

  .dialog-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 100dvh;
    padding: 70px 5vw;
    pointer-events: none;
  }

  .dialog-inner {
    position: relative;
    width: 100%;
    pointer-events: auto;
  }

  .dialog-close-button {
    position: absolute;
    bottom: calc(100% + 16px);
    right: 1px;
    background: #fff;
    mask: url(../images/icon_close_circle.svg) no-repeat center center/90%;
    width: min(5vw, 30px);
    height: auto;
    aspect-ratio: 1 / 1;
    border: none;
    padding: 0;
    cursor: pointer;
    z-index: 1;

    @media (width >=1000px) {
      &:hover {
        background-color: var(--color-red);
      }
    }
  }
}

/* slider */
.journal-slider {
  --swiper-scrollbar-sides-offset: 0;
  --swiper-scrollbar-size: 30px;

  @media (width >=1000px) {
    --swiper-scrollbar-sides-offset: 20%;
  }

  overflow: hidden;

  .journal-slider__container {
    container: slider / inline-size;
    position: relative;
    width: 90vw;
    max-width: 1000px;
    margin-inline: auto;
  }

  .swiper-scrollbar {
    position: relative;
    inset: unset;
    background: transparent;
    margin-top: min(2vw, 1rem);
    margin-inline: auto;

    &::before {
      content: '';
      position: absolute;
      top: 50%;
      left: 0;
      width: 100%;
      height: 2px;
      border-radius: 10px;
      background-color: #444;
      transform: translateY(-50%);

      @media (width >=1000px) {
        height: 5px;
      }
    }
  }

  .swiper-scrollbar-drag {
    background-color: transparent;
    cursor: grab;
    &:active {
      cursor: grabbing;
    }
    &::before {
      content: '';
      position: absolute;
      top: 50%;
      left: 0;
      width: 100%;
      height: 2px;
      border-radius: 10px;
      background-color: #fff;
      transform: translateY(-50%);

      @media (width >=1000px) {
        height: 5px;
      }
    }
  }

  .swiper.journal-slider__viewport {
    width: 88cqw;
    margin-inline: 0;
    overflow: visible;
    touch-action: pan-y pinch-zoom;

    @media (width >=1200px) {
      width: 100%;
    }

    .swiper-slide {
      container: slide / inline-size;
      width: 100%;
      padding-right: 3cqw;

      @media (width >=1200px) {
        padding-right: 0;
      }

      img {
        display: block;
        width: 100%;
        height: 100%;
        object-fit: cover;
        border-radius: .5rem;
      }

      p {
        color: #999;
        margin-top: min(3cqw, 1rem);
        font-size: min(3.8cqw, 1rem);
        word-break: keep-all;
        overflow-wrap: anywhere;


        span {
          display: block;

          @media (width >=768px) {
            display: inline-block;
          }
        }
      }
    }
  }
}


/* carousel */
.journal-carousel {
  --swiper-scrollbar-sides-offset: 0;
  --swiper-scrollbar-size: 30px;

  @media (width >= 1000px) {
    --swiper-scrollbar-sides-offset: 20%;
  }

  overflow: hidden;

  /* 親コンテナ（cqwの基準） */
  .journal-carousel__container {
    container: carousel / inline-size;
    position: relative;
    width: 90vw;
    max-width: 1000px;
    margin-inline: auto;
  }

  .swiper-scrollbar {
    position: relative;
    inset: unset;
    background: transparent;
    margin-top: min(2vw, 1rem);
    margin-inline: auto;

    &::before {
      content: '';
      position: absolute;
      top: 50%;
      left: 0;
      width: 100%;
      height: 2px;
      border-radius: 10px;
      background-color: #444;
      transform: translateY(-50%);

      @media (width >=1000px) {
        height: 5px;
      }
    }
  }

  .swiper-scrollbar-drag {
    background-color: transparent;
    cursor: grab;
    &:active {
      cursor: grabbing;
    }
    &::before {
      content: '';
      position: absolute;
      top: 50%;
      left: 0;
      width: 100%;
      height: 2px;
      border-radius: 10px;
      background-color: #fff;
      transform: translateY(-50%);

      @media (width >=1000px) {
        height: 5px;
      }
    }
  }

  .swiper.journal-carousel__viewport {
    width: 88cqw;
    margin-inline: 0;
    overflow: visible;
    touch-action: pan-y pinch-zoom;

    @media (width >= 640px) {
      width: 70cqw;
    }

    @media (width >= 1200px) {
      width: 100%;
    }

    .swiper-slide {
      width: 100%;
      height: auto;
      padding-right: 3cqw;

      @media (width >= 1200px) {
        padding-right: 0;
      }
    }
  }

  .journal-carousel__item {
    display: flex;
    flex-direction: column;
    border-radius: .5rem;
    height: 100%;
    padding-bottom: 1px;
    text-decoration: none;
    text-align: left;
    color: #fff;
    border: none;
    background: #1c1c1c;
    overflow: hidden;

    &:is(a, button) {
      cursor: pointer;
    }

    .journal-carousel__item-image {
      position: relative;
      width: 100%;
      height: auto;
      aspect-ratio: 3 / 2;
      overflow: hidden;

      img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        transition: .3s;
      }

      &::after {
        content: '';
        position: absolute;
        bottom: -1px;
        left: 0;
        width: 100%;
        height: 40%;
        background: linear-gradient(transparent, #1c1c1c);
      }
    }

    @media (width >= 1000px) {
      &:is(a, button):hover .journal-carousel__item-image {
        img {
          transform: scale(1.05);
        }
      }
    }

    .journal-carousel__item-body {
      padding: 5cqw;
      margin-bottom: 1cqw;
      margin-inline: auto;
      max-width: calc(800px + 10cqw);

      @media (width >= 640px) {
        padding-block: 3cqw;
      }
    }

    .journal-carousel__item-title {
      margin-bottom: 3cqw;
      line-height: 1.4;
      font-size: min(5cqw, 1.5rem);
      font-family: var(--font-bold);
      font-weight: bold;
      word-break: keep-all;
      overflow-wrap: anywhere;

      @media (width >= 640px) {
        margin-bottom: 2cqw;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        overflow: hidden;
      }
    }

    .journal-carousel__item-description {
      line-height: 1.8;
      font-size: min(3.8cqw, 1.1rem);
      display: -webkit-box;
      -webkit-box-orient: vertical;
      -webkit-line-clamp: 3;
      overflow: hidden;

      @media (width >= 640px) {
        -webkit-line-clamp: 2;
      }
    }

    .journal-carousel__item-content {
      line-height: 1.8;
      font-size: min(3.8cqw, 1.1rem);

      p+p {
        margin-top: 1.5em;
      }
    }

    .journal-carousel__item-readmore {
      display: flex;
      align-items: center;
      justify-content: center;
      text-align: center;
      width: fit-content;
      min-width: 8em;
      margin-top: auto;
      margin-bottom: 6cqw;
      margin-inline: auto;
      padding: .5em 1em;
      background: #fff;
      border: 0;
      border-radius: 3em;
      color: #000;
      line-height: 1.2;
      font-size: min(3.8cqw, 1rem);
      font-family: var(--font-bold);
      font-weight: bold;
      transition: .3s;
      cursor: pointer;

      @media (width >= 640px) {
        margin-bottom: 4cqw;
      }

      &::after {
        content: '';
        display: block;
        width: .8em;
        height: .8em;
        background-color: currentColor;
        mask: url(../images/icon_chevron.svg) no-repeat center center/cover;
        transform: translateX(60%);
        transition: .3s;
      }
    }

    @media (width >= 1000px) {
      :is(a, button)&:hover .journal-carousel__item-readmore,
      .journal-carousel__item-readmore:hover {
        background-color: var(--color-red);

        &::after {
          transform: translateX(80%);
        }
      }
    }
  }
}

/* gallery */
.gallery-dialog {
  --swiper-scrollbar-sides-offset: 0;
  --swiper-scrollbar-size: 30px;

  /* Swiperコンテナ */
  .swiper {
    width: 100%;
    height: auto;
    margin-bottom: -4vw;
    padding-bottom: 4vw;
    touch-action: pan-y pinch-zoom;
  }

  .swiper-slide img {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 85vh;
    display: block;
    margin-inline: auto;
    border-radius: .5rem;
  }

  .swiper-button-prev,
  .swiper-button-next {
    width: min(10vw, 60px);
    height: 100%;
    top: 0;
    bottom: 0;
    margin: 0;
    color: #fff;

    &::before,
    &::after {
      content: '';
      position: absolute;
      top: 50%;
      transform: translateY(-50%) translateZ(0);
      will-change: transform;
      left: auto;
      right: auto;
      width: min(5vw, 30px);
      height: auto;
      aspect-ratio: 1 / 1;
      display: block;
    }

    &::before {
      border-radius: 50%;
      background-color: #000;
      transform: translateY(-50%) scale(.8);
    }

    &::after {
      background-color: currentColor;
      mask: url(../images/icon_chevron_circle.svg) no-repeat center center/cover;
    }

    @media (width >=1000px) {
      &:hover {
        color: var(--color-red);
      }
    }

    svg {
      display: none;
    }
  }

  .swiper-button-prev {
    &::after {
      transform: translateY(-50%) rotate(180deg);
    }
  }

  .swiper-scrollbar {
    width: 100%;
    left: 0;
    top: calc(100% + 10px);
    bottom: unset;
    background: transparent;

    &::before {
      content: '';
      position: absolute;
      top: 50%;
      left: 0;
      width: 100%;
      height: 2px;
      border-radius: 10px;
      background: color-mix(in srgb, transparent, #fff 20%);
      transform: translateY(-50%);

      @media (width >=1000px) {
        height: 5px;
      }
    }
  }

  .swiper-scrollbar-drag {
    background-color: transparent;
    cursor: grab;
    &:active {
      cursor: grabbing;
    }
    &::before {
      content: '';
      position: absolute;
      top: 50%;
      left: 0;
      width: 100%;
      height: 2px;
      border-radius: 10px;
      background-color: #fff;
      transform: translateY(-50%);

      @media (width >=1000px) {
        height: 5px;
      }
    }
  }

}