/* =============================================
   ポートフォリオ — スタイルシート
   ============================================= */

/* =============================================
   1. タブナビゲーション
   ============================================= */
.portfolio-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 40px;
}

.tab-btn {
  padding: 8px 22px;
  border: 2px solid #333;
  background: transparent;
  border-radius: 999px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
  transition: background 0.2s ease, color 0.2s ease;
  color: #333;
}

.tab-btn:hover,
.tab-btn.active {
  background: #333;
  color: #fff;
}

.tab-btn:focus-visible {
  outline: 3px solid #0078d4;
  outline-offset: 2px;
}

/* =============================================
   2. 投稿グリッド
   ============================================= */
.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
  margin-bottom: 48px;
}

/* タブレット */
@media (max-width: 900px) {
  .portfolio-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* スマートフォン */
@media (max-width: 560px) {
  .portfolio-grid {
    grid-template-columns: 1fr;
  }
}

/* =============================================
   3. 投稿カード
   ============================================= */
.portfolio-item {
  cursor: pointer;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #e8e8e8;
  background: #fff;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.portfolio-item:hover,
.portfolio-item:focus-visible {
  transform: translateY(-5px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.12);
  outline: none;
}

/* フィルターで非表示にするクラス */
.portfolio-item.is-hidden {
  display: none;
}

.portfolio-item__thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #f0f0f0;
}

.portfolio-item__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.portfolio-item:hover .portfolio-item__thumb img {
  transform: scale(1.04);
}

.portfolio-item__no-thumb {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #aaa;
}

.portfolio-item__title {
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
  color: #333;
}

/* 投稿なしメッセージ */
.portfolio-no-posts {
  grid-column: 1 / -1;
  text-align: center;
  color: #888;
  padding: 40px 0;
}

/* =============================================
   4. ページネーション
   ============================================= */
.portfolio-pagination {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 60px;
}

.portfolio-pagination .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 10px;
  border: 2px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  color: #333;
  text-decoration: none;
  transition: all 0.2s ease;
}

.portfolio-pagination .page-numbers:hover,
.portfolio-pagination .page-numbers.current {
  background: #333;
  border-color: #333;
  color: #fff;
}

/* =============================================
   5. モーダル — ベース
   ============================================= */
.portfolio-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  /* 初期状態：非表示 */
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.portfolio-modal.is-open {
  opacity: 1;
  visibility: visible;
}

/* オーバーレイ */
.portfolio-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
}

/* モーダル全体のラッパー（矢印ボタン含む） */
.portfolio-modal__wrapper {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  width: 100%;
  max-width: 1040px;
  padding: 0 16px;
  box-sizing: border-box;
}

/* =============================================
   6. モーダル — コンテンツ本体
   ============================================= */
.portfolio-modal__content {
  flex: 1;
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  /* 開くアニメーション */
  transform: translateY(12px);
  transition: transform 0.25s ease;
}

.portfolio-modal.is-open .portfolio-modal__content {
  transform: translateY(0);
}

/* 閉じるボタン */
.modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 36px;
  height: 36px;
  border: none;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 50%;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: background 0.2s;
  color: #333;
}

.modal-close:hover {
  background: rgba(0, 0, 0, 0.18);
}

/* =============================================
   7. モーダル — 2カラムレイアウト
   ============================================= */
.modal-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 400px;
}

@media (max-width: 640px) {
  .modal-body {
    grid-template-columns: 1fr;
  }
}

/* 左カラム */
.modal-col--left {
  padding: 40px 28px 40px 36px;
  background: #f7f7f7;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* 右カラム */
.modal-col--right {
  padding: 40px 36px 40px 28px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* タイトル */
.modal-title {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.5;
  color: #222;
  margin: 0;
}

/* アイキャッチ */
.modal-thumb img {
  width: 100%;
  border-radius: 8px;
  object-fit: cover;
  display: block;
}

/* =============================================
   8. モーダル — フィールド（dl構造）
   ============================================= */
.modal-fields {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin: 0;
}

.modal-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.modal-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #999;
}

.modal-value {
  font-size: 14px;
  line-height: 1.7;
  color: #444;
  margin: 0;
  white-space: pre-wrap; /* テキストエリアの改行を維持 */
}

/* 詳細を見るボタン */
.modal-btn-wrap {
  margin-top: 24px;
}

.modal-detail-btn {
  display: inline-block;
  padding: 12px 28px;
  background: #222;
  color: #fff;
  text-decoration: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
  transition: background 0.2s ease;
}

.modal-detail-btn:hover {
  background: #444;
  color: #fff;
}

/* =============================================
   9. モーダル — ナビゲーション矢印
   ============================================= */
.modal-nav {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  border: none;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 50%;
  cursor: pointer;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.2);
  transition: background 0.2s ease, transform 0.15s ease;
  color: #333;
}

.modal-nav:hover:not(:disabled) {
  background: #fff;
  transform: scale(1.08);
}

.modal-nav:disabled {
  opacity: 0.25;
  cursor: not-allowed;
  transform: none;
}

/* スマホでは矢印をモーダル下に移動 */
@media (max-width: 640px) {
  .portfolio-modal__wrapper {
    flex-direction: column;
    padding: 0 12px;
    gap: 12px;
  }

  .modal-nav {
    order: 2;
    width: 44px;
    height: 44px;
  }

  .portfolio-modal__content {
    order: 1;
    width: 100%;
  }

  /* スマホでは矢印を横並びに */
  .portfolio-modal__wrapper {
    position: relative;
  }

  .modal-nav--prev,
  .modal-nav--next {
    position: absolute;
    top: auto;
    bottom: -60px;
  }

  .modal-nav--prev { left: 16px; }
  .modal-nav--next { right: 16px; }
}

/* =============================================
   10. ローディングスピナー
   ============================================= */
.modal-loading {
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.85);
  align-items: center;
  justify-content: center;
  z-index: 20;
}

.modal-loading.is-active {
  display: flex;
}

.modal-loading__spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #e0e0e0;
  border-top-color: #333;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}


/* =============================================
   モーダル開放時のヘッダー制御
   ============================================= */
body.modal-is-open .l-fixHeader {
  z-index: 1 !important;
  transition: none !important; /* SWELLのtransitionを無効化 */
}