/* ============================================================
   纪念相册 · 那些被时间收藏的瞬间
   字体：标题用宋体，正文用系统无衬线；不加载外部字体。
   ============================================================ */

:root {
  --paper: #f4f0e8;
  --paper-deep: #ebe5d9;
  --ink: #211f1c;
  --ink-soft: #4a463f;
  --muted: #6d675d;
  --line: rgba(33, 31, 28, 0.14);
  --accent: #a4482f;
  --gap: 14px;

  --serif: "Songti SC", "Source Han Serif SC", "Noto Serif CJK SC", "STSong", "SimSun", serif;
  --sans: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "SFMono-Regular", "JetBrains Mono", "Cascadia Mono", Consolas, monospace;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

body.pre-entry { overflow: hidden; }
html.is-locked,
html.is-locked body { overflow: hidden; }

img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

/* 纸张颗粒 */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  opacity: 0.05;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
}

/* ============================================================
   封面
   ============================================================ */

.intro {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(20px, 3.6vw, 44px);
  color: #f7f3ea;
  overflow: hidden;
  cursor: pointer;
  transition: opacity 0.9s var(--ease), visibility 0.9s;
}

.intro.is-gone {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.intro__photo {
  position: absolute;
  inset: 0;
  background-color: #2a2521;
  background-size: cover;
  background-position: center 55%;
  transform: scale(1.04);
  animation: kenburns 30s ease-in-out infinite alternate;
}

.intro__veil {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(72% 62% at 10% 76%, rgba(12, 10, 8, 0.62) 0%, rgba(12, 10, 8, 0) 68%),
    linear-gradient(90deg, rgba(18, 15, 12, 0.58) 0%, rgba(18, 15, 12, 0.16) 46%, rgba(18, 15, 12, 0) 74%),
    linear-gradient(180deg, rgba(20, 17, 14, 0.46) 0%, rgba(20, 17, 14, 0.04) 46%, rgba(20, 17, 14, 0.9) 100%);
}

.intro__top,
.intro__body,
.intro__foot {
  position: relative;
  z-index: 2;
}

.intro__top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding-top: env(safe-area-inset-top);
}

.intro__label {
  font-size: 12px;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  opacity: 0.92;
}

.intro__label--muted { opacity: 0.6; letter-spacing: 0.26em; }

.intro__body { max-width: min(760px, 74vw); }

.intro__title {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(34px, 6.2vw, 76px);
  line-height: 1.32;
  letter-spacing: 0.06em;
  text-shadow: 0 2px 30px rgba(0, 0, 0, 0.35);
}

.intro__sub {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 22px 0 0;
  font-size: 13.5px;
  letter-spacing: 0.22em;
  opacity: 1;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95), 0 2px 20px rgba(0, 0, 0, 0.9);
  animation: breathe 3.6s ease-in-out infinite;
}

.intro__dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.8;
}

.intro__foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding-bottom: env(safe-area-inset-bottom);
}

.intro__count {
  font-size: 12px;
  letter-spacing: 0.18em;
  opacity: 0.7;
}

.intro__count b { font-weight: 500; }

.intro__enter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  border: 1px solid rgba(247, 243, 234, 0.45);
  border-radius: 999px;
  font-size: 13px;
  letter-spacing: 0.16em;
  color: #f7f3ea;
  background: rgba(247, 243, 234, 0.06);
  backdrop-filter: blur(6px);
  transition: background 0.35s var(--ease), border-color 0.35s var(--ease), transform 0.35s var(--ease);
}

.intro__enter:hover {
  background: rgba(247, 243, 234, 0.16);
  border-color: rgba(247, 243, 234, 0.8);
  transform: translateX(2px);
}

.intro__enter svg { transition: transform 0.35s var(--ease); }
.intro__enter:hover svg { transform: translateX(3px); }

/* ============================================================
   顶栏
   ============================================================ */

.bar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px clamp(14px, 4vw, 56px);
  background: rgba(244, 240, 232, 0.86);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}

.bar__brand {
  flex: none;
  margin-right: 8px;
  font-family: var(--serif);
  font-size: 15px;
  letter-spacing: 0.24em;
  text-decoration: none;
  white-space: nowrap;
}

.filters {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  margin-right: auto;
}

.filters::-webkit-scrollbar { display: none; }

.chip {
  flex: none;
  padding: 6px 13px;
  border-radius: 999px;
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--muted);
  transition: color 0.25s, background 0.25s;
  white-space: nowrap;
}

.chip:hover { color: var(--ink); background: rgba(33, 31, 28, 0.06); }

.chip[aria-pressed="true"] {
  color: var(--paper);
  background: var(--ink);
}

.chip span {
  margin-left: 6px;
  font-family: var(--mono);
  font-size: 10px;
  opacity: 0.55;
}

.sound {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 7px 13px 7px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 0.14em;
  color: var(--ink-soft);
  transition: border-color 0.3s, color 0.3s, background 0.3s;
}

.sound:hover { border-color: rgba(33, 31, 28, 0.34); }

.sound__bars {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 12px;
}

.sound__bars i {
  width: 2px;
  height: 4px;
  background: currentColor;
  border-radius: 1px;
  transition: height 0.3s var(--ease);
}

.sound[aria-pressed="true"] { color: var(--accent); border-color: rgba(164, 72, 47, 0.4); }

.sound[aria-pressed="true"] .sound__bars i {
  animation: level 1.1s ease-in-out infinite;
}

.sound[aria-pressed="true"] .sound__bars i:nth-child(2) { animation-delay: 0.18s; }
.sound[aria-pressed="true"] .sound__bars i:nth-child(3) { animation-delay: 0.34s; }

/* ============================================================
   引言
   ============================================================ */

#album {
  padding: 0 clamp(14px, 4vw, 56px);
}

.lede {
  max-width: 780px;
  padding: clamp(48px, 7vw, 92px) 0 clamp(28px, 4vw, 44px);
}

.lede__kicker {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 20px;
  font-size: 11px;
  letter-spacing: 0.34em;
  color: var(--accent);
}

.lede__kicker::after {
  content: "";
  width: 44px;
  height: 1px;
  background: currentColor;
  opacity: 0.5;
}

.lede__title {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(26px, 3.4vw, 42px);
  line-height: 1.45;
  letter-spacing: 0.05em;
}

.lede__text {
  margin: 22px 0 0;
  max-width: 34em;
  text-wrap: pretty;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 2;
  letter-spacing: 0.03em;
}

.lede__meta {
  margin: 26px 0 0;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--muted);
}

/* ============================================================
   网格（等高行，保留原始比例）
   ============================================================ */

.grid {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  padding-bottom: clamp(48px, 7vw, 96px);
}

.row {
  display: flex;
  gap: var(--gap);
}

.shot {
  position: relative;
  flex: none;
  overflow: hidden;
  border-radius: 3px;
  background: var(--paper-deep);
  box-shadow: 0 14px 30px -22px rgba(30, 24, 18, 0.65);
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease), box-shadow 0.4s var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.shot.is-in {
  opacity: 1;
  transform: none;
}

.shot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background-size: cover;
  background-position: center;
  transition: transform 0.9s var(--ease), filter 0.5s var(--ease);
  transform: scale(1.001);
}

@media (hover: hover) {
  .shot:hover img { transform: scale(1.045); }
  .shot:hover { box-shadow: 0 22px 42px -24px rgba(30, 24, 18, 0.7); }
  .shot:hover .shot__cap { opacity: 1; transform: none; }
  .shot:hover .shot__no { opacity: 1; }
}

.shot__cap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 34px 16px 14px;
  color: #f8f4ec;
  font-size: 12.5px;
  line-height: 1.6;
  letter-spacing: 0.04em;
  text-align: left;
  background: linear-gradient(180deg, rgba(18, 14, 11, 0) 0%, rgba(18, 14, 11, 0.78) 100%);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.4s var(--ease), transform 0.4s var(--ease);
  pointer-events: none;
}

.shot__no {
  position: absolute;
  top: 12px;
  left: 13px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.55);
  opacity: 0;
  transition: opacity 0.4s var(--ease);
  pointer-events: none;
}

.grid-empty {
  padding: 80px 0;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

/* ============================================================
   结尾
   ============================================================ */

.end {
  padding: clamp(64px, 10vw, 128px) 0 clamp(72px, 10vw, 120px);
  border-top: 1px solid var(--line);
  text-align: center;
}

.end__mark {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(22px, 3vw, 30px);
  letter-spacing: 0.42em;
  text-indent: 0.42em;
}

.end__text {
  margin: 18px auto 0;
  max-width: 28em;
  text-wrap: balance;
  color: var(--muted);
  font-size: 14px;
  line-height: 2;
  letter-spacing: 0.04em;
}

.end__top {
  margin-top: 34px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  letter-spacing: 0.2em;
  color: var(--ink-soft);
  transition: border-color 0.3s, color 0.3s;
}

.end__top:hover { border-color: var(--accent); color: var(--accent); }

/* ============================================================
   大图查看
   ============================================================ */

.viewer {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  grid-template-rows: 1fr auto;
  background: rgba(10, 9, 8, 0.995);
  opacity: 0;
  visibility: hidden;
  overflow: hidden;
  transition: opacity 0.45s var(--ease), visibility 0.45s;
}

/* 用照片自身的模糊版本填满空白，避免大片死黑 */
.viewer::before {
  content: "";
  position: absolute;
  inset: -12%;
  z-index: -1;
  background-image: var(--viewer-bg, none);
  background-size: cover;
  background-position: center;
  filter: blur(54px) saturate(1.25) brightness(0.38);
  opacity: 0.34;
}

.viewer.is-open { opacity: 1; visibility: visible; }

.viewer__stage {
  display: grid;
  place-items: center;
  min-height: 0;
  padding: clamp(18px, 4vw, 48px);
  overflow: hidden;
  touch-action: pan-y;
}

.viewer__img {
  max-width: min(96vw, 1680px);
  max-height: min(78vh, 1100px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 2px;
  box-shadow: 0 40px 90px -40px rgba(0, 0, 0, 0.9);
  cursor: zoom-in;
  transition: transform 0.45s var(--ease);
  will-change: transform;
  user-select: none;
  -webkit-user-drag: none;
}

.viewer__img.is-zoom {
  transform: scale(2.3);
  cursor: zoom-out;
}

.viewer__close {
  position: absolute;
  top: max(16px, env(safe-area-inset-top));
  right: clamp(14px, 3vw, 30px);
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: rgba(247, 243, 234, 0.9);
  background: rgba(247, 243, 234, 0.06);
  transition: background 0.25s;
}

.viewer__close:hover { background: rgba(247, 243, 234, 0.16); }

.viewer__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: rgba(247, 243, 234, 0.88);
  background: rgba(247, 243, 234, 0.05);
  border: 1px solid rgba(247, 243, 234, 0.12);
  transition: background 0.25s, border-color 0.25s;
}

.viewer__nav:hover { background: rgba(247, 243, 234, 0.14); border-color: rgba(247, 243, 234, 0.3); }
.viewer__nav--prev { left: clamp(10px, 2.4vw, 28px); }
.viewer__nav--next { right: clamp(10px, 2.4vw, 28px); }

.viewer__caption {
  padding: 26px clamp(20px, 4vw, 48px) max(20px, env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(8, 7, 6, 0) 0%, rgba(8, 7, 6, 0.72) 60%, rgba(8, 7, 6, 0.9) 100%);
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: baseline;
  gap: 6px 18px;
  color: #f3eee4;
}

.viewer__index {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: rgba(243, 238, 228, 0.55);
}

.viewer__text {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(15px, 1.5vw, 19px);
  letter-spacing: 0.06em;
  line-height: 1.6;
}

.viewer__hint {
  grid-column: 2;
  margin-top: 4px;
  font-size: 11px;
  letter-spacing: 0.1em;
  color: rgba(243, 238, 228, 0.36);
}

/* 触屏与鼠标的操作提示分开写 */
.hint--touch { display: none; }

/* ============================================================
   动画
   ============================================================ */

@keyframes kenburns {
  from { transform: scale(1.04) translate3d(0, 0, 0); }
  to { transform: scale(1.12) translate3d(0, -1.2%, 0); }
}

@keyframes breathe {
  0%, 100% { opacity: 0.62; }
  50% { opacity: 1; }
}

@keyframes level {
  0%, 100% { height: 4px; }
  50% { height: 12px; }
}

/* ============================================================
   响应式
   ============================================================ */

@media (max-width: 760px) {
  :root { --gap: 8px; }

  .bar { gap: 10px; padding: 10px 14px; }
  .bar__brand { font-size: 13px; letter-spacing: 0.18em; }
  .filters { gap: 2px; }
  .chip { padding: 6px 10px; font-size: 12px; }
  .chip span { display: none; }
  .sound__text { display: none; }
  .sound { padding: 8px 10px; }

  .intro__body { max-width: 100%; }
  .intro__title { font-size: clamp(30px, 9.4vw, 44px); }
  .intro__sub { margin-top: 16px; font-size: 12px; }
  .intro__enter { padding: 10px 16px; }

  .lede { padding-top: 44px; }
  .lede__text { font-size: 14.5px; line-height: 1.95; }

  .shot__cap { display: none; }

  .viewer { grid-template-rows: 1fr auto; }
  .viewer__stage { padding: 10px; }
  .viewer__img { max-height: 72vh; }
  .viewer__nav { display: none; }
  .viewer__caption { grid-template-columns: 1fr; gap: 5px; padding: 0 18px max(18px, env(safe-area-inset-bottom)); }
  .viewer__index { order: 1; font-size: 10px; }
  .viewer__text { order: 2; font-size: 16px; }
  .viewer__hint { grid-column: 1; order: 3; }
  .hint--desktop { display: none; }
  .hint--touch { display: inline; }
}

@media (max-width: 360px) {
  /* 极窄屏让筛选条独享一整行 */
  .bar__brand { display: none; }
  .filters { gap: 0; }
  .chip { padding: 6px 8px; }
}

@media (min-width: 1700px) {
  #album { padding-left: max(56px, calc((100vw - 1520px) / 2)); padding-right: max(56px, calc((100vw - 1520px) / 2)); }
  .bar { padding-left: max(56px, calc((100vw - 1520px) / 2)); padding-right: max(56px, calc((100vw - 1520px) / 2)); }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .shot { opacity: 1; transform: none; }
  .intro__photo { transform: none; }
}
