/* ==============================================
   Gallery Page — 공개 프로젝트 갤러리
   원본 www.aiapp.help-v3/css/gallery.css 이식.
   전역 로드되는 templates.css 가 이미 .gallery-page/.gallery-hero/.skeleton-card 를
   점유하고 있어(→ /templates 페이지), 모든 셀렉터를 .project-gallery 아래로 접두해
   로드 순서와 무관하게 명시도로 이기게 한다. 내부 클래스명은 원본 그대로 유지.
   ============================================== */

.project-gallery .gallery-page {
  padding-top: 9rem;
}

/* ── 히어로 ── */
.project-gallery .gallery-hero {
  text-align: center;
  padding: 10rem 3rem 6rem;
  background: linear-gradient(180deg, #f0f5ff 0%, #fff 100%);
}

.project-gallery .gallery-hero h1 {
  font-size: 5.2rem;
  font-weight: 800;
  color: #0f0e0e;
  margin-bottom: 1.8rem;
  line-height: 1.3;
  word-break: keep-all;
}

.project-gallery .gallery-hero p {
  font-size: 2.2rem;
  color: #6b7280;
  max-width: 60rem;
  margin: 0 auto;
  text-align: center;
  word-break: keep-all;
}

/* ── 카드 그리드 ── */
.project-gallery .gallery-grid-wrapper {
  max-width: 140rem;
  margin: 0 auto;
  padding: 6rem 4rem 10rem;
}

.project-gallery .gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3rem;
}

.project-gallery .gallery-card {
  cursor: pointer;
  border-radius: 1.6rem;
  overflow: hidden;
  background: #fff;
  border: 1px solid #f0f0f0;
  transition: all 0.35s cubic-bezier(0.2, 0.7, 0, 0.99);
  display: flex;
  flex-direction: column;
}

.project-gallery .gallery-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.1);
  border-color: transparent;
}

.project-gallery .gallery-card .card-thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #f3f4f6;
  position: relative;
}

/* 카드 호버 오버레이 */
.project-gallery .gallery-card .card-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  opacity: 0;
  transition: opacity 0.3s ease;
  padding: 1rem;
}

.project-gallery .gallery-card:hover .card-overlay {
  opacity: 1;
}

.project-gallery .gallery-card .card-overlay .overlay-btn {
  padding: 1rem 1.8rem;
  border-radius: 0.8rem;
  font-size: 1.4rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: transform 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  text-decoration: none;
  white-space: nowrap;
}

.project-gallery .gallery-card .card-overlay .overlay-btn:hover {
  transform: scale(1.04);
}

.project-gallery .gallery-card .card-overlay .btn-preview {
  background: #fff;
  color: #1f2937;
}

.project-gallery .gallery-card .card-overlay .btn-visit {
  background: #3b82f6;
  color: #fff;
}

.project-gallery .gallery-card .card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s ease;
}

.project-gallery .gallery-card:hover .card-thumb img {
  transform: scale(1.04);
}

.project-gallery .gallery-card .card-thumb.is-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #eef4ff 0%, #f7f9fc 100%);
  color: #a3b3c9;
}

.project-gallery .gallery-card .card-thumb.is-placeholder svg {
  width: 4.8rem;
  height: 4.8rem;
}

.project-gallery .gallery-card .card-info {
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  flex: 1;
}

.project-gallery .gallery-card .card-title {
  font-size: 1.8rem;
  font-weight: 700;
  color: #1f2937;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
}

.project-gallery .gallery-card .card-desc {
  font-size: 1.4rem;
  font-weight: 400;
  color: #6b7280;
  line-height: 1.5;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  min-height: 4.2rem;
}

.project-gallery .gallery-card .card-meta {
  display: flex;
  align-items: center;
  gap: 1.4rem;
  margin-top: auto;
  padding-top: 1rem;
  font-size: 1.3rem;
  color: #9ca3af;
}

.project-gallery .gallery-card .card-meta .meta-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.project-gallery .gallery-card .card-meta svg {
  stroke: currentColor;
}

/* ── 스켈레톤 ── */
.project-gallery .skeleton-card {
  border-radius: 1.6rem;
  overflow: hidden;
  background: #fff;
  border: 1px solid #f0f0f0;
}

.project-gallery .skeleton-card .skeleton-image {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: linear-gradient(90deg, #f0f0f0 25%, #e5e5e5 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: galleryShimmer 1.5s ease-in-out infinite;
}

.project-gallery .skeleton-card .skeleton-info {
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  /* templates.css 의 .skeleton-card .skeleton-info 가 space-between 을 주는데
     원본 갤러리는 이 속성을 지정하지 않아 유일하게 누수됨 → 명시적으로 차단. */
  justify-content: flex-start;
}

.project-gallery .skeleton-card .skeleton-line {
  height: 1.4rem;
  border-radius: 0.4rem;
  background: linear-gradient(90deg, #f0f0f0 25%, #e5e5e5 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: galleryShimmer 1.5s ease-in-out infinite;
}

.project-gallery .skeleton-card .skeleton-title { width: 55%; height: 1.8rem; }
.project-gallery .skeleton-card .skeleton-desc { width: 100%; }
.project-gallery .skeleton-card .skeleton-desc-short { width: 75%; }

@keyframes galleryShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── 상태 / 더보기 ── */
.project-gallery .gallery-load-more {
  text-align: center;
  margin-top: 6rem;
}

.project-gallery .gallery-load-more button {
  padding: 1.4rem 4rem;
  border-radius: 10rem;
  border: 2px solid #3b82f6;
  background: #fff;
  color: #3b82f6;
  font-size: 1.7rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
}

.project-gallery .gallery-load-more button:hover {
  background: #3b82f6;
  color: #fff;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}

.project-gallery .gallery-load-more button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.project-gallery .gallery-status {
  text-align: center;
  padding: 4rem 2rem;
  color: #9ca3af;
  font-size: 1.7rem;
}

.project-gallery .gallery-status.is-empty {
  padding: 10rem 2rem;
}

.project-gallery .gallery-status .status-cta {
  display: inline-block;
  margin-top: 2.4rem;
  padding: 1.2rem 3rem;
  border-radius: 10rem;
  background: #3b82f6;
  color: #fff;
  text-decoration: none;
  font-size: 1.6rem;
  font-weight: 600;
  transition: all 0.25s ease;
}

.project-gallery .gallery-status .status-cta:hover {
  background: #2563eb;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* ── body 스크롤 잠금 ── */
body.modal-open {
  overflow: hidden !important;
  height: 100vh !important;
  height: 100dvh !important;
}

/* ── 상세 모달 ── */
.project-gallery .gallery-detail-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  padding: 3rem;
}

.project-gallery .gallery-detail-modal.active {
  display: flex;
}

.project-gallery .detail-modal-inner {
  width: 100%;
  max-width: 110rem;
  max-height: 92vh;
  max-height: 92dvh;
  background: #fff;
  border-radius: 2rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: galleryModalUp 0.35s cubic-bezier(0.2, 0.7, 0, 0.99);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}

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

.project-gallery .detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2rem 2.8rem;
  border-bottom: 1px solid #e5e7eb;
  flex-shrink: 0;
}

.project-gallery .detail-title-area {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  min-width: 0;
  flex: 1;
}

.project-gallery .detail-header .detail-name {
  font-size: 2rem;
  font-weight: 700;
  color: #1f2937;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-gallery .detail-header .detail-badge {
  font-size: 1.2rem;
  font-weight: 500;
  color: #3b82f6;
  background: #eff6ff;
  padding: 0.4rem 1rem;
  border-radius: 10rem;
  flex-shrink: 0;
}

.project-gallery .detail-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-shrink: 0;
}

.project-gallery .detail-visit-btn {
  padding: 1rem 1.8rem;
  background: #3b82f6;
  color: #fff;
  border: none;
  border-radius: 0.8rem;
  font-size: 1.4rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}

.project-gallery .detail-visit-btn:hover {
  background: #2563eb;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.project-gallery .detail-close-btn {
  width: 3.6rem;
  height: 3.6rem;
  border-radius: 50%;
  border: 1px solid #e5e7eb;
  background: #fff;
  cursor: pointer;
  color: #6b7280;
  font-size: 2.2rem;
  line-height: 1;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.project-gallery .detail-close-btn:hover {
  background: #f3f4f6;
  color: #1f2937;
}

.project-gallery .detail-body {
  overflow-y: auto;
  flex: 1;
}

.project-gallery .detail-preview {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #f0f1f3;
  position: relative;
  overflow: hidden;
}

.project-gallery .detail-preview iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
  position: relative;
  z-index: 2;
  background: #fff;
}

.project-gallery .detail-preview-fallback {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.project-gallery .detail-preview.no-iframe iframe {
  display: none;
}

.project-gallery .detail-thumb {
  width: 100%;
  height: 100%;
  background: #f3f4f6;
  overflow: hidden;
}

.project-gallery .detail-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.project-gallery .detail-thumb.is-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #eef4ff 0%, #f7f9fc 100%);
  color: #a3b3c9;
}

.project-gallery .detail-thumb.is-placeholder svg {
  width: 6.4rem;
  height: 6.4rem;
}

.project-gallery .detail-content {
  padding: 2.8rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.project-gallery .detail-short {
  font-size: 1.7rem;
  color: #1f2937;
  font-weight: 500;
  line-height: 1.6;
  margin: 0;
}

.project-gallery .detail-description {
  font-size: 1.5rem;
  color: #4b5563;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: keep-all;
}

.project-gallery .detail-meta {
  display: flex;
  align-items: center;
  gap: 2rem;
  padding-top: 1.8rem;
  border-top: 1px solid #f0f0f0;
  font-size: 1.4rem;
  color: #6b7280;
}

.project-gallery .detail-meta .meta-item {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}

.project-gallery .detail-meta svg {
  stroke: currentColor;
}

/* ── Responsive ── */
@media (max-width: 1200px) {
  .project-gallery .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .project-gallery .gallery-hero {
    padding: 8rem 2rem 4rem;
  }

  .project-gallery .gallery-hero h1 {
    font-size: 3.4rem;
  }

  .project-gallery .gallery-hero p {
    font-size: 1.7rem;
  }

  .project-gallery .gallery-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .project-gallery .gallery-grid-wrapper {
    padding: 4rem 2rem 6rem;
  }

  .project-gallery .gallery-load-more button {
    width: 100%;
    padding: 1.4rem 2rem;
  }

  .project-gallery .gallery-detail-modal {
    padding: 0;
  }

  .project-gallery .detail-modal-inner {
    max-height: 100vh;
    max-height: 100dvh;
    height: 100%;
    border-radius: 0;
  }

  .project-gallery .detail-header {
    padding: 1.2rem 1.6rem;
    flex-wrap: wrap;
    gap: 0.8rem;
  }

  .project-gallery .detail-title-area {
    order: 1;
    flex: 1 1 auto;
  }

  .project-gallery .detail-actions {
    order: 2;
  }

  .project-gallery .detail-header .detail-name {
    font-size: 1.7rem;
  }

  .project-gallery .detail-visit-btn {
    padding: 0.8rem 1.4rem;
    font-size: 1.3rem;
  }

  .project-gallery .detail-badge {
    display: none;
  }

  .project-gallery .detail-content {
    padding: 2rem;
  }

  .project-gallery .gallery-card .card-overlay {
    opacity: 1;
    background: linear-gradient(180deg, transparent 40%, rgba(15, 23, 42, 0.6) 100%);
    align-items: flex-end;
    justify-content: flex-end;
    padding: 1.4rem;
  }

  .project-gallery .gallery-card .card-overlay .overlay-btn {
    padding: 0.6rem 1.2rem;
    font-size: 1.2rem;
  }

  .project-gallery .detail-short {
    font-size: 1.5rem;
  }

  .project-gallery .detail-description {
    font-size: 1.4rem;
  }
}
