/* ==============================
   post-modal（インテグレーション詳細モーダル）
============================== */
.post-modal {
  --modal-blue: #1682DA;
  --modal-navy: #00467F;
  --modal-text: #2F3B4B;
  --modal-heading: #111827;

  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.post-modal.is-open {
  display: flex;
}

.post-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.68);
}

.post-modal__dialog {
  position: relative;
  width: min(1200px, 100%);
}

.post-modal__content {
  position: relative;
  z-index: 1;
  box-sizing: border-box;
  width: 100%;
  max-height: 80vh;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 80px 6% 70px;
  color: var(--modal-text);
  background: #fff;
  border: 1px solid rgba(148, 163, 184, 0.22);
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.22);
}

/* ---------- 中身 ---------- */
.post-modal__content .title {
  padding-bottom: 20px;
  font-size: 1.8rem;
  font-weight: bold;
  color: var(--modal-blue);
  border-bottom: 1px dotted var(--modal-blue);
}

/* ワークロードのアイコン */
.post-modal__content .tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
}
.post-modal__content .tag img {
  display: block;
  width: 100%;
  max-width: 105px;
  height: auto;
  min-height: 17px;
}

.post-modal__content h2 {
  margin: 15px 0 30px;
  font-size: 2rem;
}
.post-modal__content h3 {
  margin: 0 0 18px;
  font-size: 1.8rem;
  line-height: 1.4;
  color: var(--modal-heading);
}
.post-modal__content h5 {
  padding: 30px 0 20px;
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--modal-heading);
}

/* 対応課題・実施内容 */
.post-modal__content .challenge,
.post-modal__content .implement {
  display: flex;
  align-items: flex-start;
  margin: 30px 0;
  padding: 0;
}
.post-modal__content .challenge h4,
.post-modal__content .implement h4 {
  box-sizing: border-box;
  flex: 0 0 200px;
  padding: 18px 15px;
  font-size: 1.6rem;
  font-weight: 600;
  text-align: center;
  color: #fff;
  background: var(--modal-blue);
}
.post-modal__content .challenge p,
.post-modal__content .implement p {
  padding-left: 2rem;
}

/* 詳細（WYSIWYG） */
.post-modal__content .detail {
  padding: 30px 0;
  border-top: 1px dotted var(--modal-blue);
  border-bottom: 1px dotted var(--modal-blue);
}
.post-modal__content .detail p:not(:last-child) {
  padding: 0 0 10px;
}
.post-modal__content .detail img {
  display: block;
  max-width: 100%;
  height: auto;
  margin-inline: auto;
}

/* 関連リンク */
.post-modal__content .links {
  margin: 0;
  padding: 0;
  list-style: none;
}
.post-modal__content .links a {
  position: relative;
  display: block;
  margin-bottom: 12px;
  padding: 16px 44px 16px 24px;
  font-size: 1.6rem;
  font-weight: bold;
  color: #fff;
  text-decoration: none;
  background: var(--modal-navy);
  transition: opacity 0.3s ease;
}
.post-modal__content .links a:hover {
  opacity: 0.8;
}
/* 別窓アイコン */
.post-modal__content .links a::before,
.post-modal__content .links a::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 10px;
  height: 8px;
  border: 1.5px solid #fff;
}
.post-modal__content .links a::before {
  right: 18px;
  transform: translateY(-30%);
}
.post-modal__content .links a::after {
  right: 21px;
  transform: translateY(-70%);
  background: var(--modal-navy);
}

/* ---------- 閉じるボタン（×） ---------- */
.post-modal__close {
  position: absolute;
  z-index: 2;
  top: -44px;
  right: 0;
  width: 32px;
  height: 32px;
  padding: 0;
  font-size: 0;
  background: none;
  border: none;
  cursor: pointer;
  border: none;
}
.post-modal__close::before,
.post-modal__close::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 28px;
  height: 2px;
  background: #fff;
  transition: transform 0.3s ease;
}
.post-modal__close::before {
  transform: translate(-50%, -50%) rotate(45deg);
}
.post-modal__close::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}
@media (hover: hover) {
  .post-modal__close:hover::before {
    transform: translate(-50%, -50%) rotate(135deg);
  }
  .post-modal__close:hover::after {
    transform: translate(-50%, -50%) rotate(45deg);
  }
}
.post-modal__close:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 4px;
}

/* ---------- 読み込み中 ---------- */
.post-modal__loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  font-weight: 600;
  color: #475569;
}
.post-modal__loading::before {
  content: "";
  display: inline-block;
  width: 22px;
  height: 22px;
  margin-right: 12px;
  border: 3px solid rgba(148, 163, 184, 0.35);
  border-top-color: var(--modal-blue);
  border-radius: 50%;
  animation: modal-spin 0.8s linear infinite;
}
@keyframes modal-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- SP ---------- */
@media (max-width: 640px) {
  .post-modal {
    padding: 48px 12px 12px;
  }
  .post-modal__content {
    max-height: calc(100vh - 80px);
    max-height: calc(100dvh - 80px); /* iOSのアドレスバー対策 */
    padding: 30px 3%;
  }
  .post-modal__content .title {
    font-size: 1.6rem;
  }
  .post-modal__content h2 {
    margin: 15px 0 20px;
    font-size: 1.8rem;
    line-height: 1.3;
  }
  .post-modal__content .challenge,
  .post-modal__content .implement {
    display: block;
    margin: 20px 0;
  }
  .post-modal__content .challenge h4,
  .post-modal__content .implement h4 {
    padding: 15px 3%;
    font-size: 1.4rem;
    text-align: left;
  }
  .post-modal__content .challenge p,
  .post-modal__content .implement p {
    padding: 20px 5px 0;
    font-size: 1.4rem;
  }
  .post-modal__content .links a {
    padding: 14px 44px 14px 24px;
    font-size: 1.4rem;
  }
  .post-modal__close {
    top: -40px;
  }
  .post-modal__content .detail p {
    font-size: 1.4rem;
  }
}