@charset "utf-8";

.work_main {
  padding-top: 160px;
  margin-bottom: 3rem;
}

.title {
  font-family: poppins;
  margin-bottom: 4rem;
  margin-left: 5%;
  font-size: 3rem;
}

.cont_box {
  width: 90%;
  max-width: 1460px;
  margin: 0 auto;
}

/*.work_line {
  column-count: 2;
  gap: 3rem;
  width: 80%;
  margin: 0 auto;
}*/

.work_line {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-auto-rows: 10px;
  grid-auto-flow: dense;
  gap: 4rem;
  width: 80%;
  margin: 0 auto;
}

/*
@media (min-width: 769px) {
  .work_line li {
    margin-bottom: 1rem;
  }

  .work_line li:nth-child(3) {
    transform: translateY(-2rem);
  }

  .work_line li:nth-child(5) {
    transform: translateY(-4rem);
  }

  .work_line li:nth-child(6) {
    transform: translateY(-26rem);
  }

  .work_line li:nth-child(7) {
    transform: translateY(-31rem);
  }

  .work_line li:nth-child(8) {
    transform: translateY(-28rem);
  }

  .work_line li:nth-child(9) {
    transform: translateY(-34rem);
  }

  .work_line li:nth-child(10) {
    transform: translateY(-65rem);
  }
}
*/

.work_image {
  overflow: hidden;
  z-index: 1;
}

.work_modal_img {
  display: block;
  width: 100%;
}

.work_list_item {
  position: relative;
  align-self: start;
}

.work_item_inner {
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity 0.8s ease,
    transform 0.8s ease;
}

.work_item_inner.is-show {
  opacity: 1;
  transform: translateY(0);
}

.work_image_title {
  overflow: visible;
  position: absolute;
  top: -1.5rem;
  left: -1rem;
  padding: 1rem;
  border-radius: 50%;
  background-color: #a7d28d;
  outline: 2px solid #363636;
  outline-offset: -0.5rem;
  font-family: poppins;
  font-weight: 600;
  font-size: 1.2rem;
  z-index: 2;
  pointer-events: none;
}

@media (hover: hover) {
  .work_modal_img {
    transition: transform 0.4s ease;
  }

  .work_modal_img:hover {
    transform: scale(1.08);
  }
}

.sub_title {
  margin-top: 2rem;
  margin-bottom: 1rem;
}

.skill {
  margin-bottom: 0.5rem;
}

.read_last {
  margin-bottom: 0.5rem;
}

/*js*/

.js-title-slide {
  opacity: 0;
  transform: translateX(-40px);
  transition:
    opacity 0.8s ease,
    transform 0.8s ease;
}

.js-title-slide.is-show {
  opacity: 1;
  transform: translateX(0);
}

.work_item_inner {
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity 0.8s ease,
    transform 0.8s ease;
}

.work_item_inner.is-show {
  opacity: 1;
  transform: translateY(0);
}

/* Responsive */
@media (max-width: 768px) {
  .top_main_line {
    grid-template-columns: 1fr;
    gap: 3rem;
  }
}

/* ===============================
   モーダル全体
=============================== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  visibility: hidden;
  /* 最初は隠す */
}

/* 開いている時だけクリックを有効にする */
.modal.is-open {
  visibility: visible;
  pointer-events: auto;
}

.modal_bg {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 9998;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.4s ease,
    visibility 0.4s ease;
}

.modal_bg.is-visible {
  opacity: 1;
  visibility: visible;
}

.modal_inner {
  display: flex;
  gap: 3rem;
  align-items: center;
  width: 100%;
  height: 100%;
}

.modal_img {
  width: auto;
  height: auto;
  max-width: 65%;
  max-height: 100%;
  object-fit: contain;
}

.modal_text {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow-y: auto;
}

.modal_text p {
  line-height: 1.5;
  margin-bottom: 1.6rem;
}

/* ===============================
   モーダルコンテンツ
=============================== */
.modal_content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  opacity: 0;
  transition:
    transform 0.4s ease,
    opacity 0.4s ease;
  width: 90vw;
  height: 80vh;
  max-width: 1200px;
  max-height: 800px;
  display: flex;
  flex-direction: column;
  padding: 4rem;
  background: #f5f5f5;
  overflow-y: hidden;
}

/* 開いた状態：大きく、不透明に */
.modal.is-open .modal_content {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* 閉じている最中：小さく、透明に */
.modal.is-closing .modal_content {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.8);
}

/* ===============================
   閉じるボタン
=============================== */
.modal_close {
  position: absolute;
  top: 10px;
  right: 20px;
  background: none;
  border: none;
  font-size: 3rem;
  cursor: pointer;
  z-index: 10;
}

/* ===============================
   ナビボタン
=============================== */
.modal_prev,
.modal_next {
  position: absolute;
  top: 50%;
  border: none;
  background-color: transparent;
  width: 2vw;
  min-width: 20px;
  max-width: 30px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  /* 重なり順を一番上に */
  padding: 0;
  opacity: 0;
  transition:
    opacity 0.4s ease,
    transform 0.4s ease,
    background 0.3s;
  /* 最初は共通で中央寄せ */
  transform: translateY(-50%) scale(0.8);
}

/* --- 左ボタン専用（反転のみ） --- */
.modal_prev {
  left: 20px;
  transform: translateY(-50%) scaleX(-1) scale(0.8);
}

/* --- 右ボタン専用 --- */
.modal_next {
  right: 20px;
  transform: translateY(-50%) scale(0.8);
}

/* --- 開いた時の表示（rotateを削除） --- */
.modal.is-open .modal_prev {
  opacity: 1;
  transform: translateY(-50%) scaleX(-1) scale(1);
}

.modal.is-open .modal_next {
  opacity: 1;
  transform: translateY(-50%) scale(1);
}

/* --- 閉じる時のアニメーション --- */
.modal.is-closing .modal_prev {
  opacity: 0;
  transform: translateY(-50%) scaleX(-1) scale(0.8);
}

.modal.is-closing .modal_next {
  opacity: 0;
  transform: translateY(-50%) scale(0.8);
}

/* モバイル: 少しはみ出す */
@media (max-width: 768px) {
  .modal_content {
    /* はみ出しを許可する（hiddenを解除） */
    overflow: visible !important;
    height: 90dvh;
    max-height: none;
    /* その代わり、スクロールしたい場合は inner 側で制御する */
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .modal_inner {
    height: auto;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2rem;
  }

  .modal_prev {
    left: -4%;
    /* 外側に半分はみ出す */
    transform: translateY(-50%) scaleX(-1) scale(1);
  }

  .modal_next {
    right: -4%;
    transform: translateY(-50%) scale(1);
  }

  .modal_content {
    padding: 2rem 2rem;
  }

  .modal_inner {
    flex-direction: column;
  }

  .modal_text {
    justify-content: flex-start;
    height: auto;
  }

  .modal_img,
  .modal_text {
    width: 100%;
  }
}

/* Responsive */
@media (max-width: 768px) {
  .work_line {
    grid-template-columns: 1fr;
    grid-auto-rows: auto;
  }
  
  .work_list_item {
    grid-row-end: auto;
  }

  .work_line section {
    max-width: 36em;
    margin: 0 auto;
  }

  .work_line li {
    transform: none;
  }

  .modal_inner {
    flex-direction: column;
  }

  .modal_img,
  .modal_text {
    width: 100%;
  }
}
