/* ============================================================
   婚礼相册 · 样式
   设计语言：温暖米白 + 墨绿点缀，中文系统字体，优雅简洁
   ============================================================ */

:root {
  --bg: #faf6f0;          /* 米白底色 */
  --ink: #3a332c;         /* 主文字（暖棕黑） */
  --muted: #9a8f80;       /* 次要文字 */
  --accent: #5c6f52;      /* 墨绿点缀 */
  --accent-soft: #e9ece1;
  --line: #e6ddcf;
  --overlay: rgba(20, 16, 12, 0.92);
}

/* 下载的手写字体（精简版，仅含相册用字，加载快） */
@font-face {
  font-family: "FontNailao";
  src: url("fonts/nailao.ttf") format("truetype");
  font-display: swap;
}
@font-face {
  font-family: "FontLike";
  src: url("fonts/like.ttf") format("truetype");
  font-display: swap;
}
@font-face {
  font-family: "FontBanana";
  src: url("fonts/banana.otf") format("opentype");
  font-display: swap;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ============ 封面区 ============ */
.hero {
  min-height: 92vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3rem 1.5rem;
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(92,111,82,0.10), transparent 60%),
    var(--bg);
}

.hero-eyebrow {
  letter-spacing: 0.55em;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 1.5rem;
}

.hero-title {
  font-size: clamp(2.2rem, 6vw, 4rem);
  font-weight: 300;
  letter-spacing: 0.15em;
  margin-bottom: 1.2rem;
}

.hero-couple {
  font-size: clamp(1rem, 2.5vw, 1.4rem);
  color: var(--muted);
  letter-spacing: 0.1em;
  margin-bottom: 2rem;
}

.hero-date {
  display: inline-block;
  padding: 0.5rem 1.6rem;
  border: 1px solid var(--accent);
  border-radius: 2rem;
  color: var(--accent);
  letter-spacing: 0.25em;
  font-size: 0.95rem;
}

.hero-scroll {
  display: inline-block;
  margin-top: 3.5rem;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  letter-spacing: 0.2em;
  transition: color 0.2s;
}
.hero-scroll:hover { color: var(--accent); }
.hero-scroll .arrow {
  display: block;
  margin-top: 0.4rem;
  font-size: 1.2rem;
  animation: float 2s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(6px); }
}

/* ============ 相册区块 ============ */
.section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 4rem 1.5rem;
}

.section-title {
  text-align: center;
  font-weight: 300;
  letter-spacing: 0.35em;
  font-size: 1.3rem;
  color: var(--accent);
  margin-bottom: 2.5rem;
}

/* 照片墙：单列纵向大图，一行一张，下滑浏览 */
.gallery {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  max-width: 860px;   /* 电脑端控制图片宽度，避免过大 */
  margin: 0 auto;
}

.gallery figure {
  margin: 0;
  overflow: hidden;
  border-radius: 10px;
  background: var(--accent-soft);
  cursor: zoom-in;
  position: relative;
}

.gallery img {
  width: 100%;
  height: auto;             /* 保持原图比例，不裁切 */
  display: block;
  transition: opacity 0.4s ease;
  will-change: transform;
  /* C方案：视差位移变量 + 预放大 12% 留出位移空间（figure 会裁切溢出部分） */
  transform: translateY(var(--py, 0px)) scale(1.12);
  /* 图片未加载完成前，保持淡出避免闪白 */
  opacity: 0;
}
.gallery img.loaded { opacity: 1; }

.gallery figcaption {
  position: absolute;
  margin: 0;
  font-family: "Kaiti SC", "STKaiti", "KaiTi", serif;  /* 楷体：不规则豪放的手写感 */
  font-weight: bold;
  letter-spacing: 0.12em;
  line-height: 1.2;
  color: #fff;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6), 0 0 2px rgba(0, 0, 0, 0.4);
  pointer-events: none;
  opacity: 0;            /* 初始隐藏，透明度由滚动逻辑控制 */
  font-size: 48px;       /* 兜底值；实际由 JS 设为照片宽度 1/9 */
}
/* 位置由 JS 随机设置（靠左或靠右 + 任意纵向），无需 CSS 类 */

/* 照片间的科技感过渡元素：随机三种（A扫描光带 / B雷达脉冲 / C十字准星） */
.photo-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 80px;
  overflow: hidden;
  position: relative;
}

/* A：扫描光带 —— 一道光从左到右扫过横线 */
.type-a .scan-track {
  position: relative;
  display: block;
  width: 160px;
  height: 1px;
  background: var(--line);
  overflow: hidden;
}
.type-a .scan-sweep {
  position: absolute;
  top: 0; left: 0;
  width: 60px;
  height: 100%;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0;
}
.photo-divider.visible.type-a .scan-sweep {
  animation: scanMove 1.1s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
@keyframes scanMove {
  0%   { transform: translateX(-60px); opacity: 0; }
  15%  { opacity: 1; }
  85%  { opacity: 1; }
  100% { transform: translateX(160px); opacity: 0; }
}

/* B：雷达脉冲环 —— 圆环向外扩散淡出 */
.type-b .pulse-ring {
  width: 8px;
  height: 8px;
  border: 1px solid var(--accent);
  border-radius: 50%;
  opacity: 0;
}
.photo-divider.visible.type-b .pulse-ring {
  animation: pulseExpand 1.4s ease-out infinite;
}
@keyframes pulseExpand {
  0%   { transform: scale(1); opacity: 0.9; }
  100% { transform: scale(9); opacity: 0; }
}

.empty-hint {
  text-align: center;
  color: var(--muted);
  padding: 3rem 0;
}

/* ============ 页脚 ============ */
.footer {
  text-align: center;
  padding: 3rem 1.5rem 4rem;
  color: var(--muted);
  font-size: 0.9rem;
}
.footer-love { margin-top: 0.5rem; color: var(--accent); letter-spacing: 0.2em; }

/* ============ 加载进度遮罩 ============ */
.loader {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.6s ease;
}
.loader.hidden { opacity: 0; pointer-events: none; }
.loader[hidden] { display: none; }

.loader-inner { text-align: center; padding: 0 1.5rem; }
.loader-title {
  letter-spacing: 0.5em;
  color: var(--accent);
  font-weight: 300;
  font-size: 1.2rem;
  margin-bottom: 2rem;
}
.loader-bar {
  width: 220px;
  height: 2px;
  background: var(--line);
  border-radius: 2px;
  overflow: hidden;
  margin: 0 auto 1rem;
}
.loader-fill {
  width: 0%;
  height: 100%;
  background: var(--accent);
  transition: width 0.3s ease;
}
.loader-pct {
  color: var(--muted);
  font-size: 0.9rem;
  letter-spacing: 0.15em;
}
.loader-hint {
  color: var(--muted);
  font-size: 0.75rem;
  margin-top: 0.7rem;
  letter-spacing: 0.1em;
}

/* ============ 背景音乐按钮（固定右上角）============ */
.music-btn {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 1500;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--line);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--accent);
  transition: transform 0.2s, box-shadow 0.2s;
}
.music-btn:hover { transform: scale(1.1); box-shadow: 0 4px 18px rgba(0, 0, 0, 0.2); }
.music-btn .music-note { font-size: 1.3rem; line-height: 1; }

/* 播放中：音符旋转（像唱片转动），点击即暂停 */
.music-btn.playing .music-note {
  animation: spin 3s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ 全屏查看器 ============ */
.lightbox {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.25s ease;
}

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

.lb-img {
  max-width: 92vw;
  max-height: 82vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 10px 50px rgba(0,0,0,0.5);
}

.lb-caption {
  text-align: center;
  color: rgba(255,255,255,0.85);
  margin-top: 1rem;
  letter-spacing: 0.1em;
  font-size: 0.95rem;
}

/* 关闭按钮 */
.lb-close {
  position: absolute;
  top: 1rem; right: 1.2rem;
  font-size: 2.2rem;
  color: rgba(255,255,255,0.85);
  background: none;
  border: none;
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s, transform 0.2s;
}
.lb-close:hover { color: #fff; transform: scale(1.15); }

/* 左右切换 */
.lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px; height: 52px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.35);
  background: rgba(0,0,0,0.25);
  color: #fff;
  font-size: 1.6rem;
  cursor: pointer;
  transition: background 0.2s;
  z-index: 10;
}
.lb-nav:hover { background: rgba(255,255,255,0.2); }
.lb-prev { left: 1.2rem; }
.lb-next { right: 1.2rem; }

.lightbox[hidden] { display: none; }

/* ============ 响应式 ============ */
@media (max-width: 900px) {
  .gallery { gap: 16px; }
}

@media (max-width: 560px) {
  .gallery { gap: 12px; }
  .lb-nav { width: 42px; height: 42px; }
  .lb-prev { left: 0.5rem; }
  .lb-next { right: 0.5rem; }
  .hero { min-height: 80vh; }
}
