/* ==========================================================================
   portfolio.css  —  ポートフォリオページ専用スタイル
   ========================================================================== */

/* ---------- 全体レイアウト ---------- */
.portfolio-section-flat {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 20px 60px;
}

.portfolio-header-area {
  margin-bottom: 30px;
}

.portfolio-section-flat h2 {
  font-size: 2.2rem;
  font-weight: 700;
  color: #1d2088;
  text-align: center;
  margin-bottom: 10px;
}

.portfolio-section-flat h2 span {
  display: block;
  font-size: 0.9rem;
  color: #c5a028;
  text-transform: uppercase;
  margin-top: 4px;
  letter-spacing: 0.1em;
}

.portfolio-desc {
  text-align: center;
  color: #666;
  font-size: 0.95rem;
  line-height: 1.6;
  max-width: 800px;
  margin: 0 auto;
}

/* 2カラム構成：メイン領域と右サイドバー */
.portfolio-flex-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 40px;
  align-items: start;
}

@media screen and (min-width: 960px) {
  .portfolio-flex-layout {
    grid-template-columns: 1fr 280px; /* 右サイドバー幅を280pxに固定 */
  }
}

/* ---------- ツールバー（プルダウン並び替え） ---------- */
.portfolio-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: transparent;
  padding: 12px 0;
  border-radius: 0;
  border: none;
  border-bottom: 2px solid #eef0f8;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.portfolio-sort-dropdown-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  padding: 6px 0;
}

.portfolio-sort-dropdown-wrap .sort-icon {
  color: #1d2088;
  font-size: 0.95rem;
}

.portfolio-sort-select {
  border: none;
  background: transparent;
  font-size: 0.88rem;
  color: #1d2088;
  font-weight: 700;
  outline: none;
  cursor: pointer;
  padding: 2px 4px;
}

.portfolio-count-text {
  font-size: 0.85rem;
  color: #666;
  font-weight: 500;
}

.portfolio-count-label {
  font-size: 0.8rem;
  color: #555;
  background: #eef0ff;
  padding: 2px 8px;
  border-radius: 4px;
  margin-right: 6px;
  font-weight: 600;
}

.portfolio-count-num {
  font-weight: 700;
  color: #1d2088;
}

/* ---------- ギャラリー（画像を大きく、隙間なく並べる） ---------- */
.portfolio-gallery-wrapper {
  display: flex;
  flex-direction: column;
  gap: 8px; /* 各行の間の隙間を8pxにする */
}

.portfolio-row-2,
.portfolio-row-3,
.portfolio-row-4 {
  display: grid;
  gap: 8px; /* 画像同士の隙間を8pxにする */
  width: 100%;
}

.portfolio-row-2 {
  grid-template-columns: repeat(2, 1fr);
}

.portfolio-row-3 {
  grid-template-columns: repeat(3, 1fr);
}

.portfolio-row-4 {
  grid-template-columns: repeat(4, 1fr);
}


/* 縦長画像専用のグリッド */
.portfolio-row-portrait {
  display: grid;
  /* 最小200pxを維持しつつ、余ったスペースを均等に分配して横いっぱいに広げる */
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 8px;
  width: 100%;
  margin-bottom: 8px;
}

/* ---------- アイテム ---------- */
.portfolio-item {
  border-radius: 6px;
  overflow: hidden;
  background: #fcfcfc;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  cursor: pointer;
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.22s;
  outline: none;
  position: relative;
}

.portfolio-item:hover,
.portfolio-item:focus {
  transform: translateY(-3px) scale(1.01);
  box-shadow: 0 8px 24px rgba(29,32,136,0.12);
}

.portfolio-item:focus-visible {
  outline: 3px solid #c5a028;
  outline-offset: 2px;
}

.portfolio-item.is-featured {
  box-shadow: 0 2px 8px rgba(197,160,40,0.15), 0 0 0 2px #c5a028;
}

.portfolio-item.is-featured:hover {
  box-shadow: 0 8px 24px rgba(197,160,40,0.2), 0 0 0 2px #c5a028;
}

.portfolio-item-inner {
  position: relative;
  overflow: hidden;
  width: 100%;
}

.portfolio-item-img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.4s ease;
}

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

.portfolio-item-noimg {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 4 / 3;
  color: #ccc;
  font-size: 3rem;
  background: #f0f0f0;
}

/* おすすめバッジ */
.portfolio-badge-featured {
  position: absolute;
  top: 8px;
  left: 8px;
  background: linear-gradient(135deg, #c5a028, #e8c547);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 12px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 2px 6px rgba(197,160,40,0.25);
  letter-spacing: 0.02em;
}

/* オーバーレイ */
.portfolio-item-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(10,12,60,0.75) 0%, rgba(10,12,60,0.15) 60%, transparent 100%);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-end;
  padding: 10px;
  opacity: 0;
  transition: opacity 0.25s;
}

.portfolio-item:hover .portfolio-item-overlay,
.portfolio-item:focus .portfolio-item-overlay {
  opacity: 1;
}

.portfolio-item-info {
  align-self: flex-start;
  margin-top: auto;
  width: 100%;
}

.portfolio-item-cat {
  display: inline-block;
  background: rgba(197,160,40,0.95);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 2px;
  margin-bottom: 4px;
  letter-spacing: 0.01em;
}

.portfolio-item-title {
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  margin: 0 0 3px;
  line-height: 1.35;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.portfolio-item-meta {
  display: flex;
  gap: 8px;
  color: rgba(255,255,255,0.85);
  font-size: 0.68rem;
}

.portfolio-item-zoom {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.9rem;
  flex-shrink: 0;
  backdrop-filter: blur(4px);
  align-self: flex-end;
  margin-bottom: auto;
}

/* ---------- 空の状態 ---------- */
.portfolio-empty {
  text-align: center;
  padding: 60px 20px;
  color: #aaa;
}

.portfolio-empty i {
  font-size: 4rem;
  display: block;
  margin-bottom: 16px;
}

/* ---------- 右サイドバー：カテゴリーとアーカイブ共通の矢印とリスト配置 ---------- */
.portfolio-sidebar-right .sidebar-widget .widget-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.widget-cat-name-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.portfolio-sidebar-right .sidebar-widget .widget-list a i {
  font-size: 0.75rem;
  margin-right: 0.5rem;
  color: #1d2088;
  transition: transform 0.2s;
  display: inline-block;
}

.portfolio-sidebar-right .sidebar-widget .widget-list a:hover i {
  transform: translateX(3px);
}

.portfolio-sidebar-right .sidebar-widget .widget-list a.active {
  color: #1d2088;
  font-weight: 700;
  border-bottom-color: #1d2088;
}

.portfolio-sidebar-right .sidebar-widget .widget-list a.active i {
  transform: translateX(3px);
  color: #1d2088;
}

/* ==========================================================================
   モーダルウィンドウ
   ========================================================================== */
.portfolio-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.portfolio-modal[hidden] {
  display: none;
}

.portfolio-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(5, 5, 30, 0.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  cursor: pointer;
}

.portfolio-modal-inner {
  position: relative;
  z-index: 1;
  width: 94vw;
  max-width: 1060px;
  max-height: 94vh;
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 30px 80px rgba(0,0,0,0.5);
  animation: modalIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}

/* 閉じるボタン */
.portfolio-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 10;
  background: rgba(0,0,0,0.55);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 42px;
  height: 42px;
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.2s;
  backdrop-filter: blur(4px);
}

.portfolio-modal-close:hover {
  background: rgba(220, 50, 50, 0.8);
  transform: rotate(90deg);
}

/* 前へ/次へ */
.portfolio-modal-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  background: rgba(255,255,255,0.15);
  color: #fff;
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 50%;
  width: 48px;
  height: 48px;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.2s;
  backdrop-filter: blur(4px);
}

.portfolio-modal-nav:hover {
  background: rgba(255,255,255,0.35);
  transform: translateY(-50%) scale(1.1);
}

.portfolio-modal-prev { left: 10px; }
.portfolio-modal-next { right: 10px; }

/* コンテンツ */
.portfolio-modal-content {
  display: grid;
  grid-template-columns: 1fr 320px;
  height: 100%;
  overflow: hidden;
}

/* 画像エリア */
.portfolio-modal-img-wrap {
  background: #0a0c1e;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 300px;
  overflow: hidden;
}

.portfolio-modal-img {
  max-width: 100%;
  max-height: 94vh;
  object-fit: contain;
  display: block;
  transition: opacity 0.25s;
}

.portfolio-modal-loading {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.6);
  font-size: 2.5rem;
}

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

/* 情報エリア */
.portfolio-modal-info {
  padding: 28px 24px 24px;
  overflow-y: auto;
  display: flex !important;
  flex-direction: column !important;
  gap: 12px !important;
  border-left: 1px solid #eee;
}

.portfolio-modal-badges {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 6px !important;
  position: relative !important;
  height: auto !important;
  margin-bottom: 6px !important;
}

.portfolio-modal-badge {
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
  padding: 3px 10px !important;
  border-radius: 20px !important;
  font-size: 0.75rem !important;
  font-weight: 700 !important;
  position: relative !important;
}

.portfolio-modal-badge.featured {
  background: linear-gradient(135deg, #c5a028, #e8c547) !important;
  color: #fff !important;
}

.portfolio-modal-title {
  font-size: 1.05rem !important;
  font-weight: 700 !important;
  color: #1d2088 !important;
  margin: 0 !important;
  margin-top: 4px !important;
  line-height: 1.5 !important;
  position: relative !important;
  display: block !important;
  clear: both !important;
}

.portfolio-modal-caption {
  font-size: 0.875rem;
  color: #555;
  line-height: 1.7;
  margin: 0;
  white-space: pre-wrap;
}

.portfolio-modal-meta {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid #f0f0f0;
  padding-top: 12px;
}

.portfolio-modal-meta-row {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 8px;
  align-items: start;
}

.portfolio-modal-meta dt {
  font-size: 0.8rem;
  color: #888;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
}

.portfolio-modal-meta dd {
  font-size: 0.875rem;
  color: #333;
  margin: 0;
  font-weight: 500;
}

/* ダウンロードボタン */
.portfolio-modal-dl-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, #1d2088, #2a31b5);
  color: #fff;
  text-decoration: none;
  border-radius: 8px;
  padding: 12px 20px;
  font-size: 0.9rem;
  font-weight: 700;
  transition: opacity 0.2s, transform 0.15s;
  margin-top: auto;
  letter-spacing: 0.03em;
  box-shadow: 0 4px 14px rgba(29,32,136,0.25);
}

.portfolio-modal-dl-btn:hover {
  opacity: 0.88;
  transform: translateY(-1px);
  color: #fff;
}

.portfolio-modal-nav-hint {
  text-align: center;
  font-size: 0.75rem;
  color: #bbb;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

/* ==========================================================================
   レスポンシブ
   ========================================================================== */
@media screen and (max-width: 900px) {
  .portfolio-modal-content {
    grid-template-columns: 1fr;
    grid-template-rows: 60% 1fr;
    overflow-y: auto;
  }

  .portfolio-modal-img-wrap {
    min-height: 240px;
  }

  .portfolio-modal-img {
    max-height: 55vw;
  }

  .portfolio-modal-info {
    border-left: none;
    border-top: 1px solid #eee;
  }

  .portfolio-modal-nav {
    top: 30%;
  }
}

@media screen and (max-width: 600px) {
  .portfolio-row-2,
  .portfolio-row-3,
  .portfolio-row-4,
  .portfolio-row-portrait {
    grid-template-columns: 1fr; /* スマホでは1列にして画像を大きく見せる */
    gap: 8px;
  }

  .portfolio-modal-inner {
    width: 100vw;
    max-height: 100dvh;
    border-radius: 16px 16px 0 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    margin: auto;
    max-width: 100%;
    animation: modalInMobile 0.3s ease;
  }

  @keyframes modalInMobile {
    from { transform: translateY(30px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
  }

  .portfolio-modal-meta-row {
    grid-template-columns: 110px 1fr;
  }
}
