/* ============================================
   我们的摸样 — 摄影展图文展示界面
   Exhibition Gallery for "我们的摸样"
   ============================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: #0f0f11;
  color: #e8e6e3;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Prevent any selection / drag */
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}

/* --- Navigation --- */
.nav-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(15, 15, 17, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(232, 230, 227, 0.06);
  transition: transform 0.35s ease, opacity 0.35s ease;
}

.nav-bar.hidden {
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
}

.nav-inner {
  display: flex;
  align-items: center;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 32px;
  height: 56px;
}

.nav-brand {
  font-family: 'Noto Serif SC', serif;
  font-size: 18px;
  font-weight: 600;
  color: #e8e6e3;
  text-decoration: none;
  letter-spacing: 0.05em;
  margin-right: 40px;
  white-space: nowrap;
  transition: color 0.2s;
}

.nav-brand:hover {
  color: #ffffff;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.nav-links::-webkit-scrollbar {
  display: none;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  padding: 6px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 400;
  color: rgba(232, 230, 227, 0.5);
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.25s ease;
  cursor: pointer;
  border: none;
  background: none;
  letter-spacing: 0.02em;
}

.nav-link:hover {
  color: #e8e6e3;
  background: rgba(232, 230, 227, 0.06);
}

.nav-link.active {
  color: #ffffff;
  background: rgba(232, 230, 227, 0.1);
  font-weight: 500;
}

.nav-link .nav-num {
  font-size: 11px;
  opacity: 0.4;
  margin-right: 6px;
  font-weight: 300;
}

/* --- Main Content --- */
#main-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 80px 32px 80px;
  transition: opacity 0.4s ease;
}

/* --- Chapter Header --- */
.chapter-header {
  margin-bottom: 48px;
  opacity: 0;
  animation: fadeInUp 0.6s ease forwards;
}

.chapter-title {
  font-family: 'Noto Serif SC', serif;
  font-size: 36px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
  line-height: 1.3;
}

.chapter-subtitle {
  font-size: 14px;
  font-weight: 300;
  color: rgba(232, 230, 227, 0.35);
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.chapter-desc {
  font-size: 14px;
  color: rgba(232, 230, 227, 0.5);
  margin-top: 12px;
  max-width: 600px;
  line-height: 1.7;
  font-weight: 300;
}

/* --- Share Button --- */
.card-share-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 5;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(15, 15, 17, 0.55);
  color: rgba(232, 230, 227, 0.6);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.25s ease, background 0.2s, color 0.2s, transform 0.2s;
}

.gallery-card:hover .card-share-btn {
  opacity: 1;
}

.card-share-btn:hover {
  background: rgba(15, 15, 17, 0.85);
  color: #ffffff;
  transform: scale(1.1);
}

/* --- Toast --- */
.toast {
  position: fixed;
  bottom: 48px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  z-index: 2000;
  background: rgba(232, 230, 227, 0.9);
  color: #0f0f11;
  padding: 10px 24px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* --- Gallery Grid --- */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  opacity: 0;
  animation: fadeInUp 0.6s ease 0.15s forwards;
}

/* Gallery Card */
.gallery-card {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(232, 230, 227, 0.06);
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
              box-shadow 0.35s ease;
}

.gallery-card:hover {
  transform: translateY(-4px) scale(1.01);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5),
              0 0 0 1px rgba(232, 230, 227, 0.1);
}

.gallery-card .card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s ease;
  pointer-events: none;
  -webkit-user-drag: none;
  user-select: none;
}

.gallery-card:hover .card-image {
  transform: scale(1.05);
}

.gallery-card .card-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 40px 16px 14px;
  background: linear-gradient(to top, rgba(15,15,17,0.85) 0%, transparent 100%);
  pointer-events: none;
}

.gallery-card .card-name {
  font-size: 13px;
  font-weight: 400;
  color: #e8e6e3;
  letter-spacing: 0.04em;
  line-height: 1.4;
}

.gallery-card .card-meta {
  display: block;
  font-size: 11px;
  color: rgba(232, 230, 227, 0.45);
  margin-top: 2px;
  letter-spacing: 0.03em;
  font-weight: 300;
}

.gallery-card .card-group-badge {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(232, 230, 227, 0.1);
  font-size: 11px;
  color: rgba(232, 230, 227, 0.6);
  letter-spacing: 0.05em;
}

/* --- Image Viewer Modal --- */
.viewer {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.viewer.active {
  opacity: 1;
  visibility: visible;
}

.viewer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 0;
}

.viewer-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  z-index: 1;
  overflow-y: auto;
  overflow-x: hidden;
  background: rgba(0, 0, 0, 0.92);
  scrollbar-width: thin;
  scrollbar-color: rgba(232,230,227,0.2) transparent;
}

.viewer-container::-webkit-scrollbar {
  width: 5px;
}

.viewer-container::-webkit-scrollbar-track {
  background: transparent;
}

.viewer-container::-webkit-scrollbar-thumb {
  background: rgba(232, 230, 227, 0.2);
  border-radius: 3px;
}

/* --- Image Section (top portion of viewer) --- */
.viewer-image-section {
  flex: 1;
  min-height: 50vh;
  position: relative;
  overflow: hidden;
}

/* Anti-download transparent cover - blocks drag-to-save while allowing clicks through */
.viewer-protect {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;  /* clicks pass through to underlying controls */
  /* But it still intercepts drag operations in most browsers */
}

/* Viewer image wrapper */
.viewer-image-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 80px 100px;
  overflow: hidden;
  cursor: grab;
}

.viewer-image-wrap:active {
  cursor: grabbing;
}

#viewer-image {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: transform 0.15s ease;
  transform-origin: center center;
  pointer-events: none;
  -webkit-user-drag: none;
  user-select: none;
  -webkit-user-select: none;
  will-change: transform;
  /* Apply transform via JS */
}

/* Viewer controls */
.viewer-close {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 10;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.06);
  color: #e8e6e3;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.2s;
}

.viewer-close:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: scale(1.08);
}

.viewer-close.hidden {
  display: none;
}

/* When close button is hidden, shift info button right */
.viewer-close.hidden ~ .viewer-info-btn {
  right: 20px;
}

.viewer-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.06);
  color: #e8e6e3;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.2s;
  opacity: 0;
}

.viewer.active .viewer-nav {
  opacity: 1;
}

.viewer-prev { left: 24px; }
.viewer-next { right: 24px; }

.viewer-nav:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-50%) scale(1.08);
}

.viewer-nav.hidden {
  opacity: 0 !important;
  pointer-events: none;
}

/* Viewer footer */
.viewer-footer {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 16px;
  z-index: 10;
  background: rgba(15, 15, 17, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 10px 20px;
  border-radius: 24px;
  border: 1px solid rgba(232, 230, 227, 0.08);
  max-width: 90vw;
}

.viewer-footer-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: center;
  flex: 1;
  min-width: 0;
}

.viewer-caption {
  font-size: 13px;
  color: #e8e6e3;
  font-weight: 400;
  letter-spacing: 0.03em;
  text-align: center;
}

.viewer-meta {
  font-size: 11px;
  color: rgba(232, 230, 227, 0.35);
  font-weight: 300;
  letter-spacing: 0.02em;
  max-width: 400px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}

.viewer-counter {
  font-size: 12px;
  color: rgba(232, 230, 227, 0.4);
  font-weight: 300;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Zoom controls */
.viewer-zoom-controls {
  position: absolute;
  bottom: 32px;
  right: 32px;
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 10;
  background: rgba(15, 15, 17, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 6px 12px;
  border-radius: 24px;
  border: 1px solid rgba(232, 230, 227, 0.08);
}

.viewer-zoom-controls button {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: rgba(232, 230, 227, 0.6);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.viewer-zoom-controls button:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #e8e6e3;
}

.zoom-level {
  font-size: 11px;
  color: rgba(232, 230, 227, 0.4);
  min-width: 36px;
  text-align: center;
  font-weight: 300;
  letter-spacing: 0.03em;
}

/* --- Loading State --- */
.loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
}

.loading-spinner {
  width: 32px;
  height: 32px;
  border: 2px solid rgba(232, 230, 227, 0.08);
  border-top-color: #e8e6e3;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* --- Empty State --- */
.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40vh;
  color: rgba(232, 230, 227, 0.3);
  font-size: 15px;
  font-weight: 300;
}

/* --- Animations --- */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- Info Toggle Button --- */
.viewer-info-btn {
  position: absolute;
  top: 20px;
  right: 76px;
  z-index: 10;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.06);
  color: #e8e6e3;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.2s;
}

.viewer-info-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: scale(1.08);
}

.viewer-info-btn.active {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

/* --- Info Drawer --- */
.viewer-info-drawer {
  position: relative;
  z-index: 5;
  background: rgba(15, 15, 17, 0.96);
  border-top: 1px solid rgba(232, 230, 227, 0.08);
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.viewer-info-drawer.open {
  max-height: 40vh;
}

.viewer-info-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 0 6px;
  cursor: pointer;
  flex-shrink: 0;
}

.viewer-info-scroll {
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 32px 32px;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(232,230,227,0.15) transparent;
}

.viewer-info-scroll::-webkit-scrollbar {
  width: 4px;
}

.viewer-info-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.viewer-info-scroll::-webkit-scrollbar-thumb {
  background: rgba(232, 230, 227, 0.15);
  border-radius: 2px;
}

.viewer-info-title {
  font-family: 'Noto Serif SC', serif;
  font-size: 22px;
  font-weight: 600;
  color: #ffffff;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
  line-height: 1.4;
}

.viewer-info-author {
  font-size: 13px;
  font-weight: 300;
  color: rgba(232, 230, 227, 0.5);
  letter-spacing: 0.05em;
  margin-bottom: 16px;
}

.viewer-info-caption {
  font-size: 14px;
  font-weight: 300;
  color: rgba(232, 230, 227, 0.75);
  line-height: 1.85;
  letter-spacing: 0.02em;
  max-height: 28vh;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(232,230,227,0.15) transparent;
}

.viewer-info-caption::-webkit-scrollbar {
  width: 4px;
}

.viewer-info-caption::-webkit-scrollbar-track {
  background: transparent;
}

.viewer-info-caption::-webkit-scrollbar-thumb {
  background: rgba(232, 230, 227, 0.15);
  border-radius: 2px;
}

.viewer-info-caption p {
  margin-bottom: 10px;
}

.viewer-info-caption p:last-child {
  margin-bottom: 0;
}

/* --- Responsive --- */
@media (max-width: 1024px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
  }

  .chapter-title {
    font-size: 30px;
  }

  .viewer-image-wrap {
    padding: 80px 60px;
  }
}

@media (max-width: 768px) {
  #main-content {
    padding: 72px 16px 48px;
  }

  .nav-inner {
    padding: 0 16px;
  }

  .nav-brand {
    font-size: 16px;
    margin-right: 20px;
  }

  .nav-link {
    font-size: 12px;
    padding: 6px 12px;
  }

  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
  }

  .chapter-header {
    margin-bottom: 28px;
  }

  .chapter-title {
    font-size: 24px;
  }

  .chapter-subtitle {
    font-size: 12px;
  }

  .gallery-card {
    border-radius: 6px;
  }

  .gallery-card .card-name {
    font-size: 12px;
  }

  .viewer-image-wrap {
    padding: 60px 12px;
  }

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

  .viewer-nav {
    width: 40px;
    height: 40px;
  }

  .viewer-footer {
    bottom: 12px;
    left: 12px;
    transform: none;
    padding: 6px 14px;
    max-width: calc(100vw - 170px);
  }

  .viewer-zoom-controls {
    bottom: 12px;
    right: 12px;
  }

  .viewer-close {
    top: 10px;
    right: 10px;
    width: 38px;
    height: 38px;
  }

  .viewer-info-btn {
    top: 10px;
    right: 56px;
    width: 38px;
    height: 38px;
  }

  .viewer-close.hidden ~ .viewer-info-btn {
    right: 10px;
  }

  .viewer-info-scroll {
    padding: 0 16px 24px;
  }

  .viewer-info-title {
    font-size: 18px;
  }

  .viewer-image-section {
    min-height: 40vh;
  }

  .viewer-info-drawer.open {
    max-height: 50vh;
  }
}

@media (max-width: 480px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .chapter-title {
    font-size: 20px;
  }

  .viewer-image-wrap {
    padding: 60px 8px;
  }
}
