/* ================================================
   Photo Gallery — Light Stylish + Masonry Layout
   ================================================ */

/* --------------------------------------------------
   セクション
   -------------------------------------------------- */
.pg-section {
  background: #f7f7f8;
  padding: 48px 0 56px;
}

.pg-section .container {
  max-width: 1280px;
  padding-left: 24px;
  padding-right: 24px;
}

/* --------------------------------------------------
   フィルター
   -------------------------------------------------- */
.pg-filter-wrap {
  margin-bottom: 32px;
}

.pg-filter {
  background: #fff;
  border-radius: 12px;
  padding: 20px 24px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.pg-filter__toggle {
  display: none;
}

.pg-filter__body {
  /* PCでは常に表示 */
}

.pg-filter__row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 16px;
}

.pg-filter__group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 140px;
}

.pg-filter__label {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 12px;
  color: #6b7280;
  font-weight: 500;
  white-space: nowrap;
}

.pg-filter__label .material-icons {
  font-size: 14px;
}

.pg-filter__select {
  padding: 7px 28px 7px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 13px;
  background-color: #f9fafb;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239ca3af' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  color: #1f2937;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
}

.pg-filter__select:hover {
  border-color: #9ca3af;
  background-color: #fff;
}

.pg-filter__select:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
  background-color: #fff;
  outline: none;
}

.pg-filter__divider {
  width: 1px;
  height: 40px;
  background: #e5e7eb;
  flex-shrink: 0;
  align-self: flex-end;
  margin-bottom: 4px;
}

.pg-filter__clear {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  color: #9ca3af;
  font-size: 12px;
  cursor: pointer;
  padding: 8px 0 0;
  transition: color 0.15s;
}

.pg-filter__clear .material-icons {
  font-size: 14px;
}

.pg-filter__clear:hover {
  color: #374151;
}

/* --------------------------------------------------
   グリッド — Masonry
   -------------------------------------------------- */
.pg-grid {
  margin: 0 auto 40px;
}

/* --------------------------------------------------
   カード
   -------------------------------------------------- */
.pg-card {
  margin-bottom: 16px;
  width: 250px;
}

@media (max-width: 560px) {
  .pg-card {
    width: calc(50% - 8px);
  }
}

@media (max-width: 400px) {
  .pg-card {
    width: 100%;
  }
}

.pg-card__img-wrap {
  position: relative;
  overflow: hidden;
  background: #fff;
  border-radius: 8px;
  box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.06),
    0 2px 8px rgba(0, 0, 0, 0.06);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.pg-card:hover .pg-card__img-wrap {
  transform: translateY(-4px);
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.1),
    0 8px 24px rgba(0, 0, 0, 0.08);
}

.pg-card__img {
  width: 100%;
  height: auto;
  display: block;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.pg-card__img.is-loaded {
  animation: pg-fade-in 0.4s ease;
}

@keyframes pg-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.pg-card__img.is-fallback {
  object-fit: contain;
  background: #f9fafb;
  padding: 16px;
  aspect-ratio: 4 / 3;
}

.pg-card:hover .pg-card__img {
  transform: scale(1.03);
}

/* タグ（モーダル用） */
.pg-tag {
  font-size: 11px;
  padding: 2px 8px;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 100px;
  color: #ddd;
  line-height: 1.6;
}

/* いいねボタン（モーダル用） */
.pg-card__like {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: #9ca3af;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: color 0.15s;
  line-height: 1;
}

.pg-card__like .material-icons {
  font-size: 16px;
  transition: transform 0.15s;
}

.pg-card__like:hover {
  color: #ef4444;
}

.pg-card__like.is-liked {
  color: #ef4444;
}

.pg-card__like.is-liked .material-icons {
  transform: scale(1.2);
}

/* --------------------------------------------------
   ローディング
   -------------------------------------------------- */
.pg-loading {
  text-align: center;
  padding: 32px 0;
}

.pg-loading__dots {
  display: inline-flex;
  gap: 6px;
}

.pg-loading__dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d1d5db;
  animation: pg-dot-pulse 1.2s ease-in-out infinite;
}

.pg-loading__dots span:nth-child(2) {
  animation-delay: 0.15s;
}

.pg-loading__dots span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes pg-dot-pulse {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1.1); }
}

/* --------------------------------------------------
   空状態
   -------------------------------------------------- */
.pg-empty {
  text-align: center;
  padding: 64px 0;
  color: #9ca3af;
  font-size: 14px;
}

/* --------------------------------------------------
   もっと見る
   -------------------------------------------------- */
.pg-more {
  text-align: center;
  padding: 8px 0 40px;
}

.pg-more__btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 10px 28px;
  border: none;
  border-radius: 100px;
  background: #fff;
  color: #374151;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  transition: all 0.25s ease;
}

.pg-more__btn .material-icons {
  font-size: 18px;
  transition: transform 0.25s ease;
}

.pg-more__btn:hover {
  background: #1f2937;
  color: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.pg-more__btn:hover .material-icons {
  transform: translateY(2px);
}

/* --------------------------------------------------
   モーダル
   -------------------------------------------------- */
.pg-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.pg-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
}

.pg-modal__inner {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 92vw;
  max-height: 92vh;
}

.pg-modal__close {
  position: absolute;
  top: -44px;
  right: 0;
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  opacity: 0.7;
  transition: opacity 0.15s;
}

.pg-modal__close:hover {
  opacity: 1;
}

.pg-modal__close .material-icons {
  font-size: 28px;
}

.pg-modal__nav {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  transition: background 0.15s;
}

.pg-modal__nav:hover {
  background: rgba(255, 255, 255, 0.25);
}

.pg-modal__nav.is-hidden {
  visibility: hidden;
  pointer-events: none;
}

.pg-modal__nav .material-icons {
  font-size: 28px;
}

.pg-modal__content {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: calc(92vw - 120px);
  max-height: 92vh;
}

.pg-modal__img {
  display: block;
  max-width: 100%;
  max-height: calc(92vh - 80px);
  object-fit: contain;
  border-radius: 4px;
}

.pg-modal__img.is-fallback {
  object-fit: contain;
  background: #1a1a1a;
  aspect-ratio: 4 / 3;
  width: min(80vw, calc((92vh - 80px) * 4 / 3));
  max-height: calc(92vh - 80px);
  padding: 32px;
}

.pg-modal__caption {
  padding: 12px 0 0;
  text-align: center;
}

.pg-modal__caption-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  margin-bottom: 6px;
}

.pg-modal__caption-info {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.pg-modal__caption-date {
  font-size: 12px;
  color: #9ca3af;
}

.pg-modal__caption-views {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: #9ca3af;
}

.pg-modal__caption-views .material-icons {
  font-size: 16px;
}

.pg-modal__caption-info .pg-card__like {
  color: #9ca3af;
}

.pg-modal__caption-info .pg-card__like:hover {
  color: #ef4444;
}

.pg-modal__caption-info .pg-card__like.is-liked {
  color: #ef4444;
}

body.pg-modal-open {
  overflow: hidden;
}

.pg-card--clickable {
  cursor: pointer;
}

/* --------------------------------------------------
   レスポンシブ — フィルター
   -------------------------------------------------- */
@media (max-width: 768px) {
  .pg-section {
    padding: 32px 0 40px;
  }

  .pg-section .container {
    padding-left: 16px;
    padding-right: 16px;
  }

  .pg-filter__toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 10px;
    border: none;
    background: none;
    color: #374151;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
  }

  .pg-filter__toggle .material-icons {
    font-size: 18px;
    transition: transform 0.25s;
  }

  .pg-filter__toggle.is-open .material-icons {
    transform: rotate(180deg);
  }

  .pg-filter {
    padding: 0;
    border-radius: 10px;
  }

  .pg-filter__body {
    display: none;
    padding: 12px 16px 16px;
  }

  .pg-filter__body.is-open {
    display: block;
  }

  .pg-filter__row {
    gap: 12px;
  }

  .pg-filter__group {
    min-width: 100%;
  }

  .pg-filter__divider {
    display: none;
  }

  .pg-modal__content {
    max-width: calc(100vw - 24px);
  }

  .pg-modal__nav {
    width: 36px;
    height: 36px;
  }

  .pg-modal__nav .material-icons {
    font-size: 24px;
  }
}
