/* ===== BVH Canvas ===== */
.bvh-canvas-container {
  position: relative;
  overflow: hidden;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.4s ease;
  border-radius: 12px;
}

.bvh-canvas-container.loaded {
  opacity: 1;
}

.bvh-canvas-container canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

/* ===== Card Spinner ===== */
.card-spinner {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 10;
}

.card-spinner::after {
  content: '';
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255, 198, 39, 0.2);
  border-top-color: #FFC627;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.card-spinner.hidden { display: none; }

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

/* ===== Gallery Card ===== */
.gallery-card {
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  position: relative;
  border: 1px solid rgba(255, 198, 39, 0.15);
  background: #111;
}

.gallery-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 32px rgba(255, 198, 39, 0.2);
  border-color: rgba(255, 198, 39, 0.5);
}

.gallery-card .card-preview {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #000;
  position: relative;
  border-bottom: 1px solid rgba(255, 198, 39, 0.1);
}

/* ===== No-BVH card placeholder ===== */
.no-bvh-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: #0a0a0a;
}

.no-bvh-placeholder svg {
  opacity: 0.8;
}

.no-bvh-placeholder span {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 198, 39, 0.35);
}

/* ===== Detail Overlay ===== */
.detail-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.detail-overlay.active {
  display: block;
  animation: overlayIn 0.3s ease;
}

@keyframes overlayIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.detail-content {
  max-width: 800px;
  margin: 40px auto;
  padding: 32px;
  position: relative;
  background: #1a1a1a;
  border-radius: 16px;
  border: 1px solid rgba(255, 198, 39, 0.2);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 198, 39, 0.05);
}

/* BVH in detail view */
.detail-bvh-wrapper {
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 50vh;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  position: relative;
  border: 1px solid rgba(255, 198, 39, 0.15);
}

.detail-bvh-wrapper .bvh-canvas-container {
  border-radius: 0;
}

/* Fullscreen button */
.bvh-fullscreen-btn {
  position: absolute;
  bottom: 12px;
  right: 12px;
  z-index: 15;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.2s;
  opacity: 0;
}

.detail-bvh-wrapper:hover .bvh-fullscreen-btn {
  opacity: 1;
}

.bvh-fullscreen-btn:hover {
  background: rgba(255, 198, 39, 0.3);
  border-color: rgba(255, 198, 39, 0.5);
}

/* Fullscreen state */
.detail-bvh-wrapper:fullscreen {
  max-height: none;
  aspect-ratio: unset;
  border-radius: 0;
  background: #000;
}

.detail-bvh-wrapper:fullscreen .bvh-canvas-container {
  height: 100vh;
  width: 100vw;
}

.detail-bvh-wrapper:fullscreen .bvh-fullscreen-btn {
  opacity: 1;
}

/* ===== Media Thumbnails ===== */
.media-thumbs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.media-thumb {
  aspect-ratio: 16 / 9;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.media-thumb:hover {
  transform: scale(1.02);
}

/* ===== Fullscreen Media Viewer ===== */
.media-viewer {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: none;
}

.media-viewer.active {
  display: flex;
  align-items: center;
  justify-content: center;
  animation: overlayIn 0.2s ease;
}

.media-viewer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.media-viewer-topbar {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 10;
  display: flex;
  gap: 8px;
}

.media-viewer-download,
.media-viewer-close {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.2s;
  text-decoration: none;
}

.media-viewer-download:hover,
.media-viewer-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.media-viewer-prev,
.media-viewer-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  width: 48px;
  height: 48px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.2s;
}

.media-viewer-prev:hover,
.media-viewer-next:hover {
  background: rgba(255, 255, 255, 0.25);
}

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

.media-viewer-content {
  position: relative;
  z-index: 5;
  max-width: 90vw;
  max-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.media-viewer-img {
  max-width: 90vw;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 8px;
}

.media-viewer-bvh {
  width: 80vw;
  height: 70vh;
  border-radius: 8px;
  overflow: hidden;
  background: #000;
}

.media-viewer-counter {
  position: absolute;
  bottom: 48px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.6);
  padding: 4px 14px;
  border-radius: 20px;
  letter-spacing: 0.5px;
}

.media-viewer-label {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  color: rgba(255, 255, 255, 0.5);
  font-size: 12px;
  background: rgba(0, 0, 0, 0.4);
  padding: 4px 14px;
  border-radius: 20px;
  white-space: nowrap;
}

/* ===== Quill rendered content ===== */
.project-description img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 16px 0;
}

.project-description video,
.project-description audio {
  max-width: 100%;
  margin: 16px 0;
  border-radius: 8px;
}

/* ===== Filter bar ===== */
.filter-bar {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.filter-bar::-webkit-scrollbar {
  display: none;
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
  .detail-content {
    margin: 0;
    padding: 20px;
    min-height: 100vh;
    border-radius: 0;
    border: none;
  }

  .detail-bvh-wrapper {
    aspect-ratio: 1 / 1;
    border-radius: 8px;
  }

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