/* ===== 相册（Cuteen 内嵌版，瀑布流，源自 拾光·极简相册 v2.2.2） ===== */
.sg-wrap {
  --sg-card: #ffffff;
  --sg-text: var(--bs-dark, #1f2937);
  --sg-sub: #6b7280;
  --sg-light: #9ca3af;
  --sg-accent: var(--bs-primary, #3b82f6);
  --sg-shadow: 0 2px 8px rgba(0,0,0,.06);
  --sg-shadow-lg: 0 8px 24px rgba(0,0,0,.1);
  --sg-radius: 12px;

  color: var(--sg-text);
}

html.dark-mode .sg-wrap,
[data-theme="dark"] .sg-wrap,
html[data-theme="dark"] .sg-wrap,
.dark .sg-wrap,
body.dark .sg-wrap {
  --sg-card: #111827;
  --sg-text: #f1f5f9;
  --sg-sub: #94a3b8;
  --sg-light: #64748b;
  --sg-shadow: 0 2px 8px rgba(0,0,0,.2);
  --sg-shadow-lg: 0 8px 24px rgba(0,0,0,.35);
}

/* ===== 双列瀑布流（小红书风 · 自然高度） ===== */
.sg-waterfall {
  column-count: 2;
  column-gap: 6px;
}

.sg-wf-item {
  break-inside: avoid;
  margin-bottom: 6px;
  border-radius: var(--sg-radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.3s ease;
  opacity: 0;
  transform: translateY(40px);
}

.sg-wf-item.visible {
  opacity: 1;
  transform: translateY(0);
}

.sg-wf-item:hover {
  transform: translateY(-2px);
}

.sg-wf-visual {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: var(--sg-radius);
  background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
  min-height: 80px;
}

html.dark-mode .sg-wf-visual,
[data-theme="dark"] .sg-wf-visual,
body.dark .sg-wf-visual {
  background: linear-gradient(135deg, #374151, #1f2937);
}

.sg-wf-visual img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
  border-radius: var(--sg-radius);
  transition: transform 0.5s ease, opacity 0.4s ease;
}

.sg-wf-item:hover .sg-wf-visual img {
  transform: scale(1.03);
}

.sg-wf-count {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0,0,0,0.35);
  color: #fff;
  padding: 3px 8px;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 500;
  z-index: 2;
  backdrop-filter: blur(6px);
  line-height: 1;
}

.sg-wf-body {
  padding: 8px 4px 4px;
}

.sg-wf-title {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--sg-text);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.sg-wf-date {
  font-size: 0.7rem;
  color: var(--sg-light);
  margin-top: 3px;
  opacity: 0.65;
}

/* ===== 滚动入场动画 ===== */
.sg-reveal {
  transition: opacity 0.8s cubic-bezier(.4,0,.2,1), transform 0.8s cubic-bezier(.4,0,.2,1);
}

/* ===== 现代灯箱 ===== */
.sg-lightbox {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(26, 26, 26, 0.88);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
}

.sg-lightbox.active {
  display: flex;
}

.sg-lightbox-backdrop {
  position: absolute;
  inset: 0;
  z-index: 1;
  cursor: zoom-out;
}

.sg-lightbox-stage {
  position: relative;
  width: 100%;
  height: calc(100% - 140px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  opacity: 0;
  transform: scale(0.92);
  transition: all 0.5s cubic-bezier(.4,0,.2,1) 0.08s;
  padding: 24px 48px;
}

.sg-lightbox.active .sg-lightbox-stage {
  opacity: 1;
  transform: scale(1);
}

.sg-lightbox-imgbox {
  position: relative;
  max-width: 100%;
  max-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  padding: 6px;
  background: rgba(255,255,255,0.04);
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.4), 0 2px 6px rgba(0,0,0,0.2);
}

.sg-lightbox-img {
  max-width: calc(100vw - 120px);
  max-height: 64vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 12px;
  display: block;
}

.sg-lightbox-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  backdrop-filter: blur(8px);
  transition: all 0.3s;
  z-index: 30;
  padding: 0;
}

.sg-lightbox-arrow:hover {
  background: rgba(255,255,255,0.2);
  transform: translateY(-50%) scale(1.1);
}

.sg-lightbox-arrow.prev { left: 6px; }
.sg-lightbox-arrow.next { right: 6px; }

.sg-lightbox-bar {
  position: relative;
  width: 100%;
  z-index: 10;
  padding: 8px 20px 20px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.4s ease 0.15s;
}

.sg-lightbox.active .sg-lightbox-bar {
  opacity: 1;
  transform: translateY(0);
}

.sg-lightbox-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px 5px 16px;
  background: rgba(255,255,255,0.08);
  border-radius: 24px;
  backdrop-filter: blur(8px);
}

.sg-lightbox-title {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  white-space: nowrap;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.3s;
}

.sg-lightbox-title:hover {
  color: rgba(255,255,255,0.9);
}

.sg-lightbox-close {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  border: none;
  color: rgba(255,255,255,0.6);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
  padding: 0;
  flex-shrink: 0;
}

.sg-lightbox-close:hover {
  background: rgba(255,255,255,0.2);
  color: #fff;
  transform: rotate(90deg);
}

.sg-lightbox-close svg {
  stroke: currentColor;
}

.sg-lightbox-counter {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.35);
  letter-spacing: 2px;
}

.sg-lightbox-thumbs {
  display: flex;
  gap: 6px;
  justify-content: center;
  overflow-x: auto;
  padding: 2px;
  scrollbar-width: none;
  max-width: 100%;
}

.sg-lightbox-thumbs::-webkit-scrollbar { display: none; }

.sg-lb-thumb {
  width: 44px;
  height: 32px;
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.3s;
  flex-shrink: 0;
  opacity: 0.45;
}

.sg-lb-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sg-lb-thumb.active {
  border-color: rgba(255,255,255,0.5);
  opacity: 1;
  transform: scale(1.06);
}

.sg-lb-thumb:hover {
  opacity: 0.75;
  transform: scale(1.04);
}

/* ===== 空状态 ===== */
.sg-empty {
  text-align: center;
  padding: 100px 20px;
  color: var(--sg-light);
}

.sg-empty .icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.3;
}

.sg-empty .txt {
  font-size: 0.9rem;
  color: var(--sg-sub);
}

/* ===== PC 适配（布局由 Cuteen post-ctx + col-lg-9 接管，仅微调间距） ===== */
@media (min-width: 1024px) {
  .sg-waterfall {
    column-count: 3;
    column-gap: 10px;
  }
  .sg-wf-item {
    margin-bottom: 10px;
  }
  .sg-wf-visual {
    min-height: 80px;
  }
  .sg-wf-body {
    padding: 10px 4px 6px;
  }
  .sg-wf-title {
    font-size: 0.85rem;
  }

  .sg-lightbox-stage {
    padding: 32px 56px;
  }
  .sg-lightbox-img {
    max-height: 68vh;
    max-width: calc(100vw - 140px);
    border-radius: 14px;
  }
  .sg-lightbox-imgbox {
    padding: 8px;
    border-radius: 20px;
  }
  .sg-lightbox-arrow {
    width: 44px;
    height: 44px;
  }
  .sg-lightbox-arrow.prev { left: 10px; }
  .sg-lightbox-arrow.next { right: 10px; }
  .sg-lightbox-meta {
    padding: 6px 16px 6px 18px;
  }
  .sg-lightbox-title {
    font-size: 0.85rem;
    max-width: 280px;
  }
  .sg-lightbox-close {
    width: 24px;
    height: 24px;
  }
  .sg-lightbox-bar {
    padding: 10px 24px 24px;
    gap: 8px;
  }
  .sg-lb-thumb {
    width: 52px;
    height: 38px;
  }
}

@media (min-width: 1200px) {
  .sg-waterfall {
    column-gap: 12px;
  }
}
