/* ============================================================
   我们的小窝 — 照片墙
   按日期叠放的相册 / 详情网格 / 灯箱
   风格与生活记录页一致：柔和蓝绿渐变、弹簧手感
   ============================================================ */

:root {
  --font: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB",
          "Segoe UI", system-ui, sans-serif;
  --white-accent: #7aa6d4;
  --brown-accent: #d49356;
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  min-height: 100vh;
  font-family: var(--font);
  color: #4a4f5c;
  background: linear-gradient(172deg, #d3e8f4 0%, #e7f0d6 72%, #eef4e1 100%);
  background-attachment: fixed;
}

.is-hidden { display: none !important; }

/* ---- 背景云朵装饰 ---- */
.pw-bg { position: fixed; inset: 0; overflow: hidden; pointer-events: none; }
.pw-cloud {
  position: absolute;
  background: rgba(255, 255, 255, 0.55);
  border-radius: 50%;
  filter: blur(2px);
}
.pw-cloud::before, .pw-cloud::after {
  content: "";
  position: absolute;
  background: inherit;
  border-radius: 50%;
}
.pw-cloud::before { width: 60%; height: 150%; top: -40%; left: 14%; }
.pw-cloud::after  { width: 46%; height: 130%; top: -26%; right: 16%; }
.pw-cloud--1 {
  width: 150px; height: 54px; top: 9%; left: -40px;
  animation: pw-drift 95s linear infinite;
}
.pw-cloud--2 {
  width: 110px; height: 42px; top: 30%; right: -30px;
  animation: pw-drift 122s linear infinite reverse;
}
.pw-cloud--3 {
  width: 130px; height: 48px; top: 70%; left: -50px;
  animation: pw-drift 108s linear infinite;
}
@keyframes pw-drift {
  from { transform: translateX(0); }
  to   { transform: translateX(125vw); }
}

/* ---- 返回主页 ---- */
.pw-back {
  position: fixed;
  top: 18px; left: 18px;
  z-index: 20;
  padding: 9px 16px;
  background: rgba(255, 255, 255, 0.82);
  border-radius: 999px;
  color: #5b6478;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(70, 80, 110, 0.16);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: transform 0.15s ease, background 0.2s ease;
}
.pw-back:hover { transform: translateY(-2px); background: #ffffff; }

/* ---- 主体 ---- */
.pw-main {
  position: relative;
  z-index: 1;
  max-width: 1080px;
  margin: 0 auto;
  padding: 116px 24px 96px;
}

.pw-header { text-align: center; }
.pw-title {
  font-size: 30px;
  font-weight: 650;
  color: #3f5a72;
}
.pw-subtitle {
  margin-top: 6px;
  font-size: 14px;
  color: #7a8aa0;
}

/* ---- 工具栏 ---- */
.pw-toolbar {
  display: flex;
  justify-content: center;
  margin: 20px 0 46px;
}
.pw-upload-btn {
  padding: 11px 26px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, #8fc7e8, #9fdcc5);
  color: #ffffff;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(80, 130, 150, 0.3);
  transition: transform 0.18s var(--spring), box-shadow 0.2s ease;
}
.pw-upload-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 11px 24px rgba(80, 130, 150, 0.36);
}
.pw-upload-btn:active { transform: translateY(-1px) scale(0.97); }

/* ============================================================
   照片墙 — 一摞摞按日期叠放的照片
   ============================================================ */
.pw-stacks {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 30px 52px;
}

.pw-empty {
  width: 100%;
  text-align: center;
  padding: 64px 16px;
  color: #8a93a4;
  font-size: 14px;
}

.pw-stack-cell {
  width: 232px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* 一摞照片 */
.pw-stack {
  position: relative;
  width: 232px;
  height: 188px;
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  transition: transform 0.42s var(--spring);
}
.pw-stack:hover { transform: translateY(-12px); }
.pw-stack:focus-visible {
  outline: 3px solid var(--white-accent);
  outline-offset: 6px;
  border-radius: 12px;
}

/* 叠放的每一层照片 */
.pw-stack__layer {
  position: absolute;
  left: 50%; top: 50%;
  width: 206px;
  height: 156px;
  margin: -78px 0 0 -103px;
  background: #ffffff;
  border-radius: 10px;
  padding: 7px;
  box-shadow: 0 6px 16px rgba(70, 80, 110, 0.22);
  transform: rotate(var(--rot, 0deg)) translate(var(--tx, 0), var(--ty, 0));
  transition: transform 0.45s var(--spring), box-shadow 0.25s ease;
}
.pw-stack__layer img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 5px;
  display: block;
  background: #eef2f6;
}
/* 悬停：整摞弹起、角度摆开 */
.pw-stack:hover .pw-stack__layer {
  transform: rotate(calc(var(--rot, 0deg) * 2.1))
             translate(calc(var(--tx, 0px) * 1.9), calc(var(--ty, 0px) * 1.4));
  box-shadow: 0 14px 30px rgba(70, 80, 110, 0.3);
}

/* 张数徽标 */
.pw-stack__count {
  position: absolute;
  right: 12px; bottom: 12px;
  z-index: 6;
  padding: 4px 12px;
  background: linear-gradient(135deg, #57b6ea, #3f9bd6);
  color: #ffffff;
  font-size: 12px;
  font-weight: 650;
  border-radius: 999px;
  box-shadow: 0 3px 9px rgba(40, 110, 160, 0.42);
}

/* 摞下方的日期 / 作者 */
.pw-stack__meta {
  margin-top: 18px;
  text-align: center;
}
.pw-stack__name {
  font-size: 17px;
  font-weight: 650;
  color: #3f5a72;
}
.pw-stack__sub {
  margin-top: 5px;
  font-size: 12px;
  color: #8a93a4;
  letter-spacing: 0.3px;
}

/* ============================================================
   详情视图 — 某天的照片网格
   ============================================================ */
.pw-detail__bar {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 30px;
  flex-wrap: wrap;
}
.pw-back-btn {
  padding: 9px 17px;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  color: #5b6478;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(70, 80, 110, 0.16);
  transition: transform 0.15s ease, background 0.2s ease;
}
.pw-back-btn:hover { transform: translateY(-2px); background: #ffffff; }
.pw-detail__date {
  font-size: 22px;
  font-weight: 650;
  color: #3f5a72;
}
.pw-detail__count {
  margin-left: 10px;
  font-size: 13px;
  color: #8a93a4;
}

.pw-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(206px, 1fr));
  gap: 32px 24px;
  justify-items: center;
}

/* 单张照片卡 */
.pw-photo {
  position: relative;
  width: 206px;
  background: #ffffff;
  border-radius: 12px;
  padding: 9px;
  box-shadow: 0 6px 16px rgba(70, 80, 110, 0.2);
  transform: rotate(var(--tilt, 0deg));
  transition: transform 0.5s var(--spring), box-shadow 0.25s ease;
  cursor: pointer;
}
.pw-photo:hover {
  transform: rotate(0deg) translateY(-7px) scale(1.035);
  box-shadow: 0 16px 32px rgba(70, 80, 110, 0.3);
  z-index: 5;
}
.pw-photo__img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 7px;
  display: block;
  background: #eef2f6;
}
/* 顶部胶带，按作者分色 */
.pw-photo__tape {
  position: absolute;
  top: -9px; left: 50%;
  width: 62px; height: 20px;
  transform: translateX(-50%) rotate(-5deg);
  border-radius: 3px;
  opacity: 0.78;
}
.pw-photo--white .pw-photo__tape { background: rgba(122, 166, 212, 0.6); }
.pw-photo--brown .pw-photo__tape { background: rgba(212, 147, 86, 0.6); }
.pw-photo__cap {
  margin-top: 9px;
  font-size: 12px;
  font-weight: 650;
  text-align: center;
}
.pw-photo--white .pw-photo__cap { color: var(--white-accent); }
.pw-photo--brown .pw-photo__cap { color: var(--brown-accent); }

/* ============================================================
   上传弹窗
   ============================================================ */
.pw-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.pw-modal__mask {
  position: absolute;
  inset: 0;
  background: rgba(40, 50, 70, 0.5);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.pw-modal__card {
  position: relative;
  width: min(384px, 100%);
  background: #ffffff;
  border-radius: 20px;
  padding: 28px 26px 20px;
  box-shadow: 0 24px 60px rgba(40, 50, 80, 0.4);
}
.pw-modal__title {
  font-size: 19px;
  font-weight: 650;
  color: #3f5a72;
  text-align: center;
  margin-bottom: 22px;
}

.pw-field { margin-bottom: 17px; }
.pw-field__label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #6b7385;
  margin-bottom: 8px;
}
.pw-who { display: flex; gap: 10px; }
.pw-who__btn {
  flex: 1;
  padding: 10px;
  border: 2px solid #e3e9f0;
  border-radius: 12px;
  background: #f7f9fc;
  color: #6b7385;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}
.pw-who__btn[data-who="white"].is-active {
  border-color: #8fc7e8;
  background: #eef7fd;
  color: #3f7aa0;
}
.pw-who__btn[data-who="brown"].is-active {
  border-color: #e3b483;
  background: #fdf3e8;
  color: #b6783c;
}
.pw-date {
  width: 100%;
  padding: 9px 12px;
  border: 2px solid #e3e9f0;
  border-radius: 12px;
  font-family: var(--font);
  font-size: 13px;
  color: #4a4f5c;
}
.pw-date:focus { outline: none; border-color: #8fc7e8; }

.pw-filebtn {
  display: block;
  margin-top: 4px;
  padding: 15px;
  text-align: center;
  border: 2px dashed #b9cfe0;
  border-radius: 14px;
  background: #f4f9fd;
  color: #5a87a8;
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease;
}
.pw-filebtn:hover { background: #e9f4fc; border-color: #8fc7e8; }

.pw-modal__status {
  min-height: 18px;
  margin-top: 12px;
  text-align: center;
  font-size: 12px;
  color: #8a93a4;
}
.pw-modal__close {
  display: block;
  margin: 4px auto 0;
  padding: 8px 22px;
  border: none;
  background: none;
  color: #9aa3b2;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.pw-modal__close:hover { color: #6b7385; }

/* ============================================================
   灯箱
   ============================================================ */
.pw-lb {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px;
  background: rgba(26, 32, 46, 0.88);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}
.pw-lb__stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 88vw;
  max-height: 90vh;
  overflow-y: auto;
}
.pw-lb__img {
  max-width: 100%;
  max-height: 64vh;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 20px 54px rgba(0, 0, 0, 0.55);
}
.pw-lb__cap {
  margin-top: 14px;
  color: #e9edf4;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.3px;
}
/* 灯箱里的当天生活记录 */
.pw-lb__diary {
  margin-top: 12px;
  max-width: min(100%, 540px);
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 13px;
  text-align: left;
}
.pw-lb__diary-head {
  font-size: 12px;
  font-weight: 650;
  color: #ffe2ad;
  margin-bottom: 5px;
}
.pw-lb__diary-text {
  font-size: 13px;
  line-height: 1.72;
  color: #eef1f6;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 16vh;
  overflow-y: auto;
}
.pw-lb__close {
  position: absolute;
  top: 20px; right: 24px;
  z-index: 120;
  width: 42px; height: 42px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  font-size: 17px;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.15s ease;
}
.pw-lb__close:hover { background: rgba(255, 255, 255, 0.3); transform: scale(1.08); }
.pw-lb__nav {
  position: absolute;
  top: 50%;
  z-index: 120;
  transform: translateY(-50%);
  width: 50px; height: 50px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.15s ease;
}
.pw-lb__nav:hover { background: rgba(255, 255, 255, 0.32); }
.pw-lb__nav--prev { left: 22px; }
.pw-lb__nav--next { right: 22px; }
.pw-lb__nav--prev:hover { transform: translateY(-50%) scale(1.1); }
.pw-lb__nav--next:hover { transform: translateY(-50%) scale(1.1); }
.pw-lb__delete {
  position: absolute;
  bottom: 24px; left: 50%;
  z-index: 120;
  transform: translateX(-50%);
  padding: 9px 20px;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: #ffd2cf;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s ease;
}
.pw-lb__delete:hover { background: rgba(232, 96, 88, 0.85); color: #ffffff; }

/* ============================================================
   灯箱 3D 切片翻转（Slicebox）
   切换照片时，当前图被切成 3~8 条竖条 / 横条（每隔一次则整张
   不分块）。每条是一个有厚度的 3D 长方体，正面贴当前图、相邻
   侧面贴下一张，绕自身中心轴翻转 90°；翻转中正 / 侧面叠加明暗
   阴影来强化体积感，方向整次统一、由上 / 下一张决定。
   几何尺寸、景深与背景偏移都在 photos.js 里按图片实际尺寸算。
   ============================================================ */
.pw-slicebox {
  position: fixed;
  z-index: 105;
  perspective: 1500px;
  pointer-events: none;
}
.pw-slice {
  position: absolute;
  transform-style: preserve-3d;
  will-change: transform;
}
.pw-slice__face {
  position: absolute;
  inset: 0;
  background-repeat: no-repeat;
  background-color: #1c2231;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
/* 单面的明暗层：翻转时正面渐暗、侧面渐亮，模拟体块受光 */
.pw-slice__shade {
  position: absolute;
  inset: 0;
  background: #080b12;
  opacity: 0;
}

/* ---- 响应式 ---- */
@media (max-width: 560px) {
  .pw-main { padding: 104px 14px 80px; }
  .pw-title { font-size: 25px; }
  .pw-stacks { gap: 24px 30px; }
  .pw-stack-cell, .pw-stack { width: 200px; }
  .pw-stack { height: 168px; }
  .pw-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 24px 16px; }
  .pw-photo { width: 100%; }
  .pw-lb__nav { width: 40px; height: 40px; font-size: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .pw-cloud { animation: none; }
  .pw-stack, .pw-stack__layer, .pw-photo, .pw-upload-btn { transition: none; }
}
