/* ============================================================
   拾光相册 · 前端展示端样式
   ============================================================ */

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: var(--z-sticky);
  height: var(--topbar-h);
  background: var(--glass);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border-bottom: 1px solid var(--line-soft);
}
.topbar__inner {
  height: 100%;
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-4);
}
.brand { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand__mark {
  width: 34px; height: 34px; flex: 0 0 34px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px;
  background: linear-gradient(140deg, var(--accent), var(--gold));
  color: #0A0C11;
  box-shadow: 0 4px 14px rgba(124, 140, 255, .28);
}
.brand__mark svg { width: 19px; height: 19px; }
.brand__text { min-width: 0; }
.brand__title {
  font-size: var(--fs-lg); font-weight: 650; letter-spacing: -.01em;
  color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brand__sub {
  font-size: var(--fs-xs); color: var(--text-3); letter-spacing: .1em;
  text-transform: uppercase;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar__actions { display: flex; align-items: center; gap: var(--sp-1); }

/* ---------- 门禁页 ---------- */
.gate {
  min-height: calc(100vh - var(--topbar-h) - 100px);
  display: flex; align-items: center; justify-content: center;
  padding: var(--sp-10) var(--sp-4);
}
.gate__card {
  width: 100%; max-width: 400px;
  padding: var(--sp-10) var(--sp-8) var(--sp-8);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  text-align: center;
  position: relative;
  overflow: hidden;
}
.gate__card::before {
  content: "";
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--gold));
}
.gate__icon {
  width: 56px; height: 56px; margin: 0 auto var(--sp-5);
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-lg);
  background: var(--accent-soft);
  color: var(--accent);
}
.gate__icon svg { width: 26px; height: 26px; }
.gate__title { font-size: var(--fs-2xl); margin-bottom: var(--sp-2); }
.gate__desc { font-size: var(--fs-md); color: var(--text-2); margin-bottom: var(--sp-6); }
.gate__form { text-align: left; }
.gate__error {
  display: none;
  margin-top: var(--sp-3);
  font-size: var(--fs-sm);
  color: var(--danger);
  text-align: left;
}
.gate__error.is-visible { display: block; }
.gate__foot { margin-top: var(--sp-5); font-size: var(--fs-xs); color: var(--text-3); }

/* ---------- 页面头 ---------- */
.page-head { padding: var(--sp-10) 0 var(--sp-6); }
.page-head__row {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: var(--sp-6); flex-wrap: wrap;
}
.page-head__title { font-size: var(--fs-3xl); letter-spacing: -.02em; }
.page-head__desc { margin-top: var(--sp-2); color: var(--text-2); font-size: var(--fs-md); }
.page-head__meta { font-size: var(--fs-sm); color: var(--text-3); margin-top: var(--sp-4); }

/* ---------- 相册网格 ---------- */
.album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--sp-5);
  padding-bottom: var(--sp-16);
}
@media (max-width: 767px) {
  .album-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); }
}

/* 悬停仅保留底部阴影，不做位移/边框/缩放过渡（2026-10 用户确认） */
.album-card {
  position: relative;
  display: block;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  transition: box-shadow var(--t-base);
}
.album-card:hover {
  box-shadow: var(--shadow-lg);
}
.album-card__media {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--surface-3);
  overflow: hidden;
}
.album-card__media img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.album-card__scrim {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, .0) 40%, rgba(0, 0, 0, .55) 100%);
  pointer-events: none;
}
.album-card__placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-3);
  background:
    repeating-linear-gradient(45deg, var(--surface-2) 0 12px, var(--surface-3) 12px 24px);
}
.album-card__placeholder svg { width: 36px; height: 36px; opacity: .7; }

.album-card__lock {
  position: absolute; top: var(--sp-3); right: var(--sp-3);
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 9px;
  border-radius: var(--r-full);
  background: rgba(10, 12, 17, .68);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, .14);
  color: #fff;
  font-size: var(--fs-xs);
  font-weight: 500;
}
.album-card__lock svg { width: 12px; height: 12px; }
.album-card__hidden {
  position: absolute; top: var(--sp-3); left: var(--sp-3);
  padding: 4px 9px; border-radius: var(--r-full);
  background: rgba(240, 185, 92, .9); color: #1a1206;
  font-size: var(--fs-xs); font-weight: 600;
}
.album-card__count {
  position: absolute; bottom: var(--sp-3); left: var(--sp-4);
  color: #fff; font-size: var(--fs-sm); font-weight: 500;
  text-shadow: 0 1px 6px rgba(0, 0, 0, .6);
}
.album-card__body { padding: var(--sp-4); }
.album-card__title {
  font-size: var(--fs-lg); font-weight: 600; line-height: var(--lh-snug);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: calc(2 * 1.4em);
}
.album-card__desc {
  margin-top: var(--sp-2);
  font-size: var(--fs-sm); color: var(--text-2);
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical;
  overflow: hidden;
}
.album-card__foot {
  margin-top: var(--sp-3); padding-top: var(--sp-3);
  border-top: 1px solid var(--line-soft);
  display: flex; align-items: center; justify-content: space-between;
  font-size: var(--fs-xs); color: var(--text-3);
}

/* ---------- 相册详情头 ---------- */
.album-hero {
  position: relative;
  margin-bottom: var(--sp-8);
  padding: var(--sp-8) 0 var(--sp-6);
  overflow: hidden;
}
.album-hero__bg {
  position: absolute; inset: -20px 0 0;
  background-size: cover;
  background-position: center;
  filter: blur(46px) saturate(140%);
  opacity: .38;
  transform: scale(1.12);
  pointer-events: none;
}
.album-hero__scrim {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(11, 13, 18, .5) 0%, var(--bg) 92%);
  pointer-events: none;
}
[data-theme="light"] .album-hero__scrim {
  background: linear-gradient(180deg, rgba(246, 247, 250, .5) 0%, var(--bg) 92%);
}
.album-hero__inner { position: relative; }
.album-hero__top {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-4); margin-bottom: var(--sp-6);
}
.album-hero__title { font-size: var(--fs-4xl); letter-spacing: -.02em; margin-bottom: var(--sp-3); }
.album-hero__desc { color: var(--text-2); font-size: var(--fs-md); max-width: 680px; margin-bottom: var(--sp-4); }
.album-hero__meta {
  display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4);
  font-size: var(--fs-sm); color: var(--text-3);
}
.album-hero__meta span { display: inline-flex; align-items: center; gap: 6px; }
.album-hero__actions { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }

/* 返回按钮 */
.back-btn {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  min-height: 38px; padding: 0 var(--sp-3);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--glass);
  backdrop-filter: blur(8px);
  color: var(--text);
  font-size: var(--fs-md);
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast);
}
.back-btn:hover { background: var(--surface-2); border-color: var(--accent-line); }
.back-btn svg { width: 16px; height: 16px; }

/* ---------- 照片网格 ---------- */
.pgrid { padding-bottom: var(--sp-16); }
.pgrid--masonry {
  display: grid;
  grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr));
  grid-auto-rows: 8px;
  gap: 8px;
}
.pgrid--square {
  display: grid;
  grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr));
  gap: 8px;
}

.p-item {
  position: relative;
  display: block;
  padding: 0;
  border: 0;
  border-radius: var(--r-md);
  background: var(--surface-2);
  overflow: hidden;
  cursor: zoom-in;
  transition: transform var(--t-base), box-shadow var(--t-base);
  animation: item-in var(--t-slow) both;
}
@keyframes item-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
.pgrid--masonry .p-item { grid-row-end: span var(--span, 24); }
.pgrid--square .p-item { aspect-ratio: 1 / 1; }

.p-item img {
  position: relative; z-index: 1;
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity var(--t-slow);
}
.p-item img.is-loaded { opacity: 1; }
.p-item:hover { box-shadow: var(--shadow-md); }
/* 层叠约定：ph=0 骨架 < img=1 照片 < overlay=2 遮罩 < dl=3 下载按钮。
   修复：占位层曾盖在静态 img 之上，导致照片默认显示为灰色、悬停时
   img 获得 transform 才被“顶”上来。 */
.p-item__ph {
  position: absolute; inset: 0; z-index: 0;
  background: linear-gradient(140deg, var(--surface-2), var(--surface-3));
}
.p-item__overlay {
  position: absolute; inset: 0; z-index: 2;
  background: linear-gradient(180deg, transparent 55%, rgba(0, 0, 0, .6));
  opacity: 0;
  transition: opacity var(--t-base);
  pointer-events: none;
}
.p-item:hover .p-item__overlay { opacity: 1; }
.p-item__dl {
  position: absolute; top: var(--sp-2); right: var(--sp-2); z-index: 3;
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border: 0; border-radius: var(--r-sm);
  background: rgba(10, 12, 17, .62);
  backdrop-filter: blur(8px);
  color: #fff; cursor: pointer;
  opacity: 0; transform: translateY(-4px);
  transition: opacity var(--t-fast), transform var(--t-fast), background var(--t-fast);
}
.p-item__dl svg { width: 16px; height: 16px; }
.p-item:hover .p-item__dl,
.p-item__dl:focus-visible { opacity: 1; transform: none; }
.p-item__dl:hover { background: rgba(10, 12, 17, .85); }

/* 加载更多 */
.load-more { display: flex; justify-content: center; padding: var(--sp-6) 0 var(--sp-10); }

/* ---------- 灯箱 ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: var(--z-lightbox);
  background: rgba(7, 8, 11, .97);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex; flex-direction: column;
  animation: fade-in var(--t-base) both;
  touch-action: none;
  user-select: none;
}
.lightbox[hidden] { display: none; }

.lb-top {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-3) var(--sp-4);
  color: #fff;
  flex: 0 0 auto;
  background: linear-gradient(180deg, rgba(0, 0, 0, .55), transparent);
}
.lb-top__left, .lb-top__right { display: flex; align-items: center; gap: var(--sp-2); }
.lb-title { min-width: 0; }
.lb-title__album {
  font-size: var(--fs-md); font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw;
}
.lb-title__idx { font-size: var(--fs-xs); color: rgba(255, 255, 255, .6); }

.lb-btn {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border: 0; border-radius: var(--r-sm);
  background: rgba(255, 255, 255, .08);
  color: #fff; cursor: pointer;
  transition: background var(--t-fast), transform var(--t-fast);
}
.lb-btn:hover { background: rgba(255, 255, 255, .18); }
.lb-btn:active { transform: scale(.94); }
.lb-btn svg { width: 19px; height: 19px; }
.lb-btn[disabled] { opacity: .3; cursor: default; }
.lb-btn { position: relative; }
.lb-btn__badge {
  position: absolute; top: -4px; right: -4px;
  min-width: 16px; height: 16px;
  padding: 0 4px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-full);
  background: var(--accent); color: #fff;
  font-size: 10px; font-weight: 600; line-height: 1;
}

.lb-stage {
  position: relative;
  flex: 1 1 auto;
  display: flex; align-items: center; justify-content: center;
  min-height: 0;
  overflow: hidden;
}
.lb-img-wrap {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%;
  transition: transform var(--t-base);
  will-change: transform;
}
.lb-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity var(--t-base);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .6);
  border-radius: 2px;
}
.lb-img.is-loaded { opacity: 1; }
.lb-img.--zoomed { cursor: grab; }

.lb-loading {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-3);
  color: rgba(255, 255, 255, .7); font-size: var(--fs-sm);
}
.lb-loading[hidden] { display: none; }
.lb-loading .spinner { border-color: rgba(255, 255, 255, .2); border-top-color: #fff; width: 26px; height: 26px; }

.lb-nav {
  position: absolute; top: 50%;
  transform: translateY(-50%);
  width: 52px; height: 52px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 50%;
  background: rgba(20, 22, 28, .55);
  backdrop-filter: blur(10px);
  color: #fff; cursor: pointer;
  transition: background var(--t-fast), opacity var(--t-fast), transform var(--t-fast);
  z-index: 2;
}
.lb-nav:hover { background: rgba(40, 44, 54, .8); }
.lb-nav svg { width: 22px; height: 22px; }
.lb-nav--prev { left: var(--sp-4); }
.lb-nav--next { right: var(--sp-4); }

.lb-bottom {
  flex: 0 0 auto;
  padding: var(--sp-3) var(--sp-4) calc(var(--sp-3) + var(--safe-b));
  background: linear-gradient(0deg, rgba(0, 0, 0, .6), transparent);
}
.lb-strip {
  display: flex; gap: var(--sp-2);
  overflow-x: auto;
  padding: var(--sp-2) 0;
  scrollbar-width: none;
}
.lb-strip::-webkit-scrollbar { display: none; }
.lb-thumb {
  flex: 0 0 auto;
  width: 56px; height: 56px;
  padding: 0; border: 2px solid transparent;
  border-radius: var(--r-sm);
  overflow: hidden; cursor: pointer;
  background: var(--surface-3);
  opacity: .5;
  transition: opacity var(--t-fast), border-color var(--t-fast);
}
.lb-thumb img { width: 100%; height: 100%; object-fit: cover; }
.lb-thumb:hover { opacity: .85; }
.lb-thumb.is-active { opacity: 1; border-color: #fff; }

/* 信息抽屉 */
.lb-info {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: 340px; max-width: 88vw;
  background: rgba(14, 16, 21, .96);
  backdrop-filter: blur(18px);
  border-left: 1px solid rgba(255, 255, 255, .1);
  color: #fff;
  padding: var(--sp-6);
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform var(--t-base);
  z-index: 3;
}
.lb-info.is-open { transform: none; }
.lb-info__head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--sp-5);
}
.lb-info__title { font-size: var(--fs-lg); font-weight: 600; }
.lb-info__row {
  display: flex; justify-content: space-between; gap: var(--sp-4);
  padding: var(--sp-3) 0;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  font-size: var(--fs-sm);
}
.lb-info__k { color: rgba(255, 255, 255, .55); flex: 0 0 auto; }
.lb-info__v { text-align: right; word-break: break-all; }

@media (max-width: 900px) {
  .lb-nav { display: none; }
  .lb-info { width: 100%; max-width: 100%; border-left: 0; top: auto; height: 62vh; border-radius: var(--r-xl) var(--r-xl) 0 0; transform: translateY(100%); }
  .lb-info.is-open { transform: none; }
  .lb-img { max-height: calc(100% - 8px); }
  .lb-comments {
    width: 100%; max-width: 100%; border-left: 0; top: auto;
    height: 66vh; border-radius: var(--r-xl) var(--r-xl) 0 0;
    transform: translateY(100%);
  }
  .lb-comments.is-open { transform: none; }
}

/* ---------- 评论抽屉（照片级） ---------- */
.lb-comments {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: 380px; max-width: 92vw;
  display: flex; flex-direction: column;
  background: rgba(14, 16, 21, .96);
  backdrop-filter: blur(18px);
  border-left: 1px solid rgba(255, 255, 255, .1);
  color: #fff;
  transform: translateX(100%);
  transition: transform var(--t-base);
  z-index: 4;
}
.lb-comments.is-open { transform: none; }
.lb-comments__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-5) var(--sp-6) var(--sp-3);
  flex: 0 0 auto;
}
.lb-comments__title { font-size: var(--fs-lg); font-weight: 600; }
.lb-comments__count { font-size: var(--fs-sm); color: rgba(255, 255, 255, .55); font-weight: 400; margin-left: 6px; }
.lb-comments__list {
  flex: 1 1 auto; min-height: 0;
  overflow-y: auto;
  padding: var(--sp-2) var(--sp-6);
}
.lb-comments__empty {
  padding: var(--sp-10) 0;
  text-align: center;
  color: rgba(255, 255, 255, .5);
  font-size: var(--fs-sm);
}
.lb-comments__form {
  flex: 0 0 auto;
  padding: var(--sp-4) var(--sp-6) calc(var(--sp-5) + var(--safe-b));
  border-top: 1px solid rgba(255, 255, 255, .08);
  display: flex; flex-direction: column; gap: var(--sp-2);
}
.lb-comments__nick {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, .06);
  color: #fff; font-size: var(--fs-sm);
}
.lb-comments__nick:focus { outline: none; border-color: var(--accent); }
.lb-comments__text {
  width: 100%;
  min-height: 72px; max-height: 160px;
  resize: vertical;
  padding: 9px 12px;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, .06);
  color: #fff; font-size: var(--fs-sm);
  font-family: inherit; line-height: 1.5;
}
.lb-comments__text:focus { outline: none; border-color: var(--accent); }
.lb-comments__foot { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.lb-comments__hint { font-size: var(--fs-xs); color: rgba(255, 255, 255, .45); }
/* 蜜罐字段：视觉隐藏但留在 DOM 中 */
.lb-comments__hp {
  position: absolute; left: -9999px; width: 1px; height: 1px;
  opacity: 0; pointer-events: none;
}

/* 评论条目 */
.cmt { display: flex; gap: var(--sp-3); padding: var(--sp-3) 0; }
.cmt + .cmt { border-top: 1px solid rgba(255, 255, 255, .06); }
.cmt__avatar {
  flex: 0 0 32px; width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: linear-gradient(140deg, var(--accent), var(--gold));
  color: #0A0C11; font-size: var(--fs-sm); font-weight: 600;
}
.cmt__main { flex: 1 1 auto; min-width: 0; }
.cmt__meta { display: flex; align-items: baseline; gap: var(--sp-2); margin-bottom: 2px; }
.cmt__nick { font-size: var(--fs-sm); font-weight: 600; }
.cmt__time { font-size: var(--fs-xs); color: rgba(255, 255, 255, .45); }
.cmt__text {
  font-size: var(--fs-sm); line-height: 1.6;
  color: rgba(255, 255, 255, .88);
  word-break: break-word; white-space: pre-wrap;
}
.cmt__reply {
  margin-top: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  border-left: 2px solid var(--accent);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  background: rgba(124, 140, 255, .1);
  font-size: var(--fs-sm); line-height: 1.6;
  color: rgba(255, 255, 255, .82);
}
.cmt__reply-k { color: var(--accent); font-weight: 600; margin-right: 6px; }

@media (max-width: 640px) {
  .album-hero__title { font-size: var(--fs-2xl); }
  .page-head__title { font-size: var(--fs-2xl); }
  .lb-title__album { max-width: 34vw; }
}

/* ---------- 页脚 ---------- */
.site-foot {
  margin-top: var(--sp-16);
  padding: var(--sp-8) 0 calc(var(--sp-8) + var(--safe-b));
  border-top: 1px solid var(--line-soft);
  text-align: center;
  color: var(--text-3);
  font-size: var(--fs-sm);
}
.site-foot__links { margin-top: var(--sp-2); display: flex; justify-content: center; gap: var(--sp-4); }

/* ---------- 阅读进度 / 回到顶部 ---------- */
.to-top {
  position: fixed; right: var(--sp-6); bottom: calc(var(--sp-6) + var(--safe-b));
  z-index: var(--z-sticky);
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--glass);
  backdrop-filter: blur(12px);
  color: var(--text);
  cursor: pointer;
  box-shadow: var(--shadow-md);
  opacity: 0; transform: translateY(12px); pointer-events: none;
  transition: opacity var(--t-base), transform var(--t-base);
}
.to-top.is-visible { opacity: 1; transform: none; pointer-events: auto; }
.to-top svg { width: 18px; height: 18px; }

/* 打印隐藏交互元素 */
@media print {
  .topbar, .to-top, .lightbox, .toast-root { display: none !important; }
}
