/* ============================================================
   照片墙：瀑布流 + 8 种相框样式
   相框装饰一律位于「边框区」，绝不覆盖照片主体
   ============================================================ */

/* ---------------- 瀑布流容器（CSS 多列实现，真·瀑布流） ---------------- */
.masonry {
  column-count: 4;
  column-gap: 18px;
}
@media (max-width: 1560px) { .masonry { column-count: 3; } }
@media (max-width: 1080px) { .masonry { column-count: 2; } }

.ph-item {
  break-inside: avoid;
  margin-bottom: 18px;
  display: inline-block;
  width: 100%;
  animation: fadeUp .3s ease both;
}

/* ---------------- 相框通用骨架 ---------------- */
.frame {
  position: relative;
  display: block;
  border-radius: 3px;
  overflow: hidden;
  cursor: zoom-in;
  transition: transform .25s cubic-bezier(.3, 1.1, .5, 1), box-shadow .25s;
}
.ph-item:hover .frame { transform: translateY(-3px); }
.frame > .ph-img {
  display: block; width: 100%; height: auto;
  position: relative; z-index: 1;
  background: var(--dora-100);
}
/* 装饰层永远不盖住照片 */
.frame::before, .frame::after { z-index: 0; pointer-events: none; }
.frame .deco { position: absolute; z-index: 3; pointer-events: none; }

/* ===== ① 复古实木相框 ===== */
.frame.wood {
  padding: 14px;
  background:
    repeating-linear-gradient(96deg, rgba(255,255,255,.05) 0 2px, rgba(0,0,0,.05) 2px 5px),
    linear-gradient(148deg, #A9743F 0%, #8A5A2E 38%, #6E451F 72%, #A17038 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 240, 210, .22),
              inset 0 0 22px rgba(0, 0, 0, .32),
              0 5px 16px rgba(70, 42, 15, .3);
  border-radius: 4px;
}
.frame.wood > .ph-img {
  border: 3px solid #F3EADA;
  box-shadow: 0 0 0 1px rgba(90, 58, 25, .5), inset 0 0 14px rgba(0, 0, 0, .25);
}

/* ===== ② 胶片白边相框（拍立得） ===== */
.frame.film {
  padding: 13px 13px 44px;
  background: #FDFDFB;
  box-shadow: 0 2px 4px rgba(0, 0, 0, .1), 0 8px 22px rgba(0, 0, 0, .13);
  border-radius: 2px;
}
.frame.film > .ph-img { box-shadow: 0 0 0 1px rgba(0, 0, 0, .1); }
.frame.film::after {
  content: attr(data-cap);
  position: absolute; left: 13px; right: 13px; bottom: 12px; z-index: 3;
  text-align: center; font-size: 12px; color: #6B6459;
  font-family: "Bradley Hand", "Segoe Script", "Kaiti SC", cursive;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ===== ③ 磨砂浅灰相框 ===== */
.frame.matte {
  padding: 15px;
  background: linear-gradient(155deg, #F0F1F3 0%, #DCDFE3 55%, #E9EBEE 100%);
  border-radius: 6px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .9),
              inset 0 0 0 1px rgba(0, 0, 0, .05),
              0 4px 14px rgba(60, 66, 74, .16);
}
.frame.matte > .ph-img {
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .09), 0 1px 5px rgba(0, 0, 0, .12);
}

/* ===== ④ 黑色细边相框 ===== */
.frame.thin {
  padding: 5px;
  background: #17191C;
  border-radius: 2px;
  box-shadow: 0 3px 14px rgba(0, 0, 0, .3);
}
.frame.thin > .ph-img { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .1); }

/* ===== ⑤ 卡纸文艺相框（大留白双层卡纸） ===== */
.frame.paper {
  padding: 26px 22px 30px;
  background: #FAF7F0;
  border-radius: 3px;
  box-shadow: inset 0 0 0 1px #E7E0D2, 0 4px 16px rgba(120, 108, 84, .18);
}
.frame.paper::before {
  content: ''; position: absolute; inset: 14px; z-index: 0;
  border: 1px solid #D9CFB8;
}
.frame.paper > .ph-img {
  box-shadow: 0 0 0 1px #CFC6B2, 0 2px 8px rgba(0, 0, 0, .1);
}
.frame.paper::after {
  content: attr(data-cap);
  position: absolute; left: 22px; right: 22px; bottom: 9px; z-index: 3;
  text-align: center; font-size: 11px; color: #9A907C; letter-spacing: 1.2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ===== ⑥ 可爱奶油相框 ===== */
.frame.cream {
  padding: 15px;
  background: linear-gradient(160deg, #FFF6EC 0%, #FCE9D6 60%, #F8DFC8 100%);
  border-radius: 18px;
  box-shadow: inset 0 0 0 3px #fff, inset 0 0 0 4px #F2D3B4,
              0 6px 18px rgba(214, 160, 116, .28);
}
.frame.cream > .ph-img { border-radius: 11px; }
.frame.cream .deco { font-size: 15px; line-height: 1; }
.frame.cream .deco.d1 { top: 5px; right: 12px; }
.frame.cream .deco.d2 { bottom: 5px; left: 12px; }
/* 奶油圆点 */
.frame.cream::before {
  content: ''; position: absolute; inset: 0; z-index: 0; border-radius: 18px;
  background-image: radial-gradient(circle at 12px 12px, rgba(255,255,255,.85) 2.2px, transparent 2.4px),
                    radial-gradient(circle at 12px 12px, rgba(240,190,150,.5) 2.2px, transparent 2.4px);
  background-size: 22px 22px, 22px 22px;
  background-position: 0 0, 11px 11px;
  opacity: .55;
}

/* ===== ⑦ 敦煌莲花纹样相框（敦煌金 + 朱砂红 + 深灰暗纹） ===== */
.frame.dunhuang {
  padding: 26px;
  border-radius: 4px;
  background-color: #332F2B;
  /* 深灰暗纹底：细密斜格 + 微光晕 */
  background-image:
    repeating-linear-gradient(45deg, rgba(201, 162, 39, .07) 0 1px, transparent 1px 7px),
    repeating-linear-gradient(-45deg, rgba(168, 52, 42, .07) 0 1px, transparent 1px 7px),
    radial-gradient(ellipse at 50% 0%, rgba(201, 162, 39, .16), transparent 62%);
  box-shadow: inset 0 0 0 1px #6E5A1E,
              inset 0 0 26px rgba(0, 0, 0, .5),
              0 7px 22px rgba(45, 33, 12, .38);
}
/* 内圈：金线 + 朱砂细边，紧贴照片但不压图 */
.frame.dunhuang > .ph-img {
  box-shadow: 0 0 0 1.5px #A8342A, 0 0 0 3.5px #C9A227, 0 0 0 4.5px #6E5A1E,
              0 2px 10px rgba(0, 0, 0, .5);
}
/* 上下飞天飘带边饰（平铺） */
.frame.dunhuang::before {
  content: ''; position: absolute; left: 52px; right: 52px; top: 4px; height: 18px; z-index: 2;
  background: url('../assets/img/dunhuang-edge.svg') repeat-x center / auto 18px;
  opacity: .95;
}
.frame.dunhuang::after {
  content: ''; position: absolute; left: 52px; right: 52px; bottom: 4px; height: 18px; z-index: 2;
  background: url('../assets/img/dunhuang-edge.svg') repeat-x center / auto 18px;
  transform: scaleY(-1); opacity: .95;
}
/* 四角莲花 */
.frame.dunhuang .dh {
  position: absolute; width: 52px; height: 52px; z-index: 3;
  background: url('../assets/img/dunhuang-corner.svg') no-repeat center / contain;
  pointer-events: none;
}
.frame.dunhuang .dh.tl { top: 1px; left: 1px; }
.frame.dunhuang .dh.tr { top: 1px; right: 1px; transform: scaleX(-1); }
.frame.dunhuang .dh.bl { bottom: 1px; left: 1px; transform: scaleY(-1); }
.frame.dunhuang .dh.br { bottom: 1px; right: 1px; transform: scale(-1); }

/* ===== ⑧ 哆啦A梦蓝白主题相框 ===== */
.frame.doraemon, .frame.wolf {
  padding: 17px 17px 38px;
  border-radius: 10px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255,255,255,.4) 0%, transparent 60%),
    linear-gradient(158deg, #17ACEC 0%, #0B8AC9 46%, #06699C 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .32),
              inset 0 0 22px rgba(4, 60, 92, .42),
              0 6px 18px rgba(6, 72, 105, .36);
}
.frame.doraemon > .ph-img, .frame.wolf > .ph-img {
  border: 2.5px solid #FFFFFF;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .25), 0 2px 10px rgba(0, 0, 0, .25);
}
/* 铃铛角饰 */
.frame.doraemon .wf, .frame.wolf .wf {
  position: absolute; width: 38px; height: 38px; z-index: 3;
  background: url('../assets/img/dora-corner.svg') no-repeat center / contain;
  opacity: .98;
}
.frame.doraemon .wf.tl, .frame.wolf .wf.tl { top: 2px; left: 2px; }
.frame.doraemon .wf.br, .frame.wolf .wf.br { bottom: 30px; right: 2px; transform: scale(-1); }
/* 底部红项圈条 */
.frame.doraemon::before, .frame.wolf::before {
  content: ''; position: absolute; left: 18px; right: 18px; bottom: 25px; z-index: 2;
  height: 6px; border-radius: 3px;
  background: linear-gradient(180deg, #E60012 0%, #B8000E 100%);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
}
.frame.doraemon::after, .frame.wolf::after {
  content: attr(data-cap);
  position: absolute; left: 16px; right: 16px; bottom: 8px; z-index: 3;
  text-align: center; font-size: 11.5px; color: #E8F6FF; letter-spacing: .6px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  text-shadow: 0 1px 0 rgba(0, 0, 0, .3);
}

/* ---------------- 照片信息条 ---------------- */
.ph-meta { padding: 9px 3px 0; }
.ph-meta .t { font-size: 13px; font-weight: 600; }
.ph-meta .s { font-size: 11.5px; color: var(--text-3); display: flex; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.ph-meta .n { font-size: 12px; color: var(--text-2); margin-top: 4px; line-height: 1.55; }
.ph-acts { display: flex; gap: 5px; margin-top: 7px; opacity: 0; transition: opacity var(--t); }
.ph-item:hover .ph-acts { opacity: 1; }

/* ---------------- 相框选择器 ---------------- */
.frame-picker { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; }
.fp-item {
  border: 2px solid var(--border); border-radius: 8px; padding: 7px;
  cursor: pointer; text-align: center; transition: all var(--t); background: var(--bg-card);
}
.fp-item:hover { border-color: var(--dora-400); }
.fp-item.on { border-color: var(--blue-700); background: var(--blue-100); }
.fp-prev { height: 40px; border-radius: 4px; margin-bottom: 5px; }
.fp-item span { font-size: 11px; color: var(--text-2); display: block; line-height: 1.35; }
.fp-item.on span { color: var(--blue-700); font-weight: 600; }
/* 选择器缩略预览背景 */
.fp-prev.wood { background: linear-gradient(148deg, #A9743F, #6E451F); box-shadow: inset 0 0 0 4px #F3EADA; }
.fp-prev.film { background: #FDFDFB; box-shadow: inset 0 0 0 1px #E0E0DC, inset 0 -9px 0 #FDFDFB, inset 0 0 0 5px #cfd3d8; }
.fp-prev.matte { background: linear-gradient(155deg, #F0F1F3, #DCDFE3); box-shadow: inset 0 0 0 5px #C9CDD3, inset 0 0 0 6px #fff; }
.fp-prev.thin { background: #17191C; box-shadow: inset 0 0 0 3px #17191C, inset 0 0 0 4px #8b8f95; }
.fp-prev.paper { background: #FAF7F0; box-shadow: inset 0 0 0 1px #E7E0D2, inset 0 0 0 6px #FAF7F0, inset 0 0 0 7px #D9CFB8; }
.fp-prev.cream { background: linear-gradient(160deg, #FFF6EC, #F8DFC8); border-radius: 11px; box-shadow: inset 0 0 0 3px #fff, inset 0 0 0 4px #F2D3B4; }
.fp-prev.dunhuang { background-color: #332F2B; background-image: repeating-linear-gradient(45deg, rgba(201,162,39,.14) 0 1px, transparent 1px 6px); box-shadow: inset 0 0 0 1px #6E5A1E, inset 0 0 0 5px #332F2B, inset 0 0 0 6px #C9A227, inset 0 0 0 7px #A8342A; }
.fp-prev.doraemon { background: linear-gradient(158deg, #17ACEC, #06699C); box-shadow: inset 0 0 0 5px #17ACEC, inset 0 0 0 6px #FFFFFF, inset 0 0 0 7px #E60012, inset 0 0 0 9px #06699C; }

/* ---------------- 上传拖拽区 ---------------- */
.dropzone {
  border: 2px dashed var(--border-strong); border-radius: var(--radius);
  padding: 30px; text-align: center; color: var(--text-3);
  transition: all var(--t); cursor: pointer; background: var(--bg-sub);
}
.dropzone:hover, .dropzone.over { border-color: var(--blue-600); background: var(--blue-100); color: var(--blue-700); }
.dropzone b { display: block; font-size: 14px; color: var(--text-1); margin-bottom: 3px; }
.dropzone.over b { color: var(--blue-700); }

/* ---------------- 灯箱 ---------------- */
.lightbox {
  position: fixed; inset: 0; z-index: 400;
  background: rgba(20, 22, 25, .93);
  display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 14px;
  padding: 40px; animation: fadeIn .18s;
}
.lightbox img { max-width: 88vw; max-height: 76vh; object-fit: contain; border-radius: 3px; box-shadow: 0 20px 60px rgba(0,0,0,.6); }
.lightbox .lb-info { color: #DDE1E5; text-align: center; max-width: 640px; }
.lightbox .lb-info b { font-size: 15px; color: #fff; display: block; margin-bottom: 3px; }
.lightbox .lb-close { position: absolute; top: 20px; right: 26px; color: #fff; font-size: 28px; opacity: .7; }
.lightbox .lb-close:hover { opacity: 1; }
