@font-face {
  font-family: "SourceHanSerif";
  /* 子集 + WOFF2（71KB），旧的 891KB TTF 仅作兜底，正常情况下不会下载 */
  src: url("../memorial/theme/SourceHanSerifSubset.woff2") format("woff2"),
       url("../memorial/theme/SourceHanSerifDefault.ttf") format("truetype");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #f7f1e6;
  --card: #fcfaf5;
  --card-2: #fdfbf6;
  --red: #6b1417;
  --red-deep: #520f12;
  --red-soft: #8d2a25;
  --gold: #c98a4b;
  --gold-soft: #e6c79a;
  --ink: #3d2e23;
  --ink-soft: #57463a;
  --muted: #8b7b6a;
  --line: #e6dccb;
  --line-soft: #eee6d8;
  --serif: "SourceHanSerif", "Source Han Serif SC", "Songti SC", "SimSun", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --shadow: 0 2px 14px rgba(92, 58, 24, .055), 0 1px 2px rgba(92, 58, 24, .04);
  --radius: 16px;
  --topbar-h: 70px;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--topbar-h) + 16px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-width: 320px;
  background-color: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 宣纸纹理：极淡地铺在页面底层 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: url("../memorial/theme/T02.webp") center top / cover no-repeat;
  opacity: .16;
}

main,
header,
footer,
.mobile-nav { position: relative; z-index: 1; }

img { max-width: 100%; }

a { color: inherit; text-decoration: none; }

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

button { cursor: pointer; }

[hidden] { display: none !important; }

::selection {
  background: rgba(201, 138, 75, .28);
  color: var(--red-deep);
}

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* ============================================================
   顶部导航
   ============================================================ */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 80;
  height: var(--topbar-h);
  background: rgba(250, 246, 238, .74);
  border-bottom: 1px solid rgba(107, 20, 23, .10);
  backdrop-filter: blur(16px) saturate(1.15);
  -webkit-backdrop-filter: blur(16px) saturate(1.15);
}

.topbar-inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
  width: 100%;
  max-width: 1180px;
  height: 100%;
  margin: 0 auto;
  padding: 0 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: .1em;
  color: var(--red);
  white-space: nowrap;
}

.brand::before {
  content: "怀";
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 5px;
  background: var(--red);
  color: #fdf6e8;
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 400;
  line-height: 1;
  box-shadow: 0 2px 6px rgba(107, 20, 23, .22);
}

.topnav {
  display: flex;
  align-items: center;
  justify-self: center;
  gap: 30px;
}

.topnav a {
  position: relative;
  padding: 6px 1px;
  font-size: 14.5px;
  letter-spacing: .07em;
  color: #5f4e40;
  transition: color .25s ease;
}

.topnav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, rgba(201, 138, 75, 0), var(--gold) 30%, var(--gold) 70%, rgba(201, 138, 75, 0));
  transform: scaleX(0);
  transition: transform .3s ease;
}

.topnav a:hover { color: var(--red); }

.topnav a.active {
  color: var(--red);
  font-weight: 600;
}

.topnav a.active::after { transform: scaleX(1); }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid rgba(107, 20, 23, .16);
  border-radius: 50%;
  background: rgba(255, 255, 255, .55);
  color: var(--red);
  transition: background-color .25s ease, color .25s ease, border-color .25s ease, box-shadow .25s ease, transform .25s ease;
}

.icon-btn svg { width: 19px; height: 19px; }

.icon-btn:hover {
  background: #fff;
  border-color: rgba(107, 20, 23, .34);
  box-shadow: 0 4px 12px rgba(92, 58, 24, .12);
}

.icon-btn:active { transform: scale(.95); }

.icon-btn[aria-pressed="true"] {
  background: var(--red);
  border-color: var(--red);
  color: #fdf6e8;
  box-shadow: 0 4px 14px rgba(107, 20, 23, .3);
}

/* 移动端悬浮音乐入口：桌面隐藏，≤640px 顶栏隐去后由此承担 */
.mobile-music {
  display: none;
  position: fixed;
  right: 14px;
  bottom: calc(74px + env(safe-area-inset-bottom));
  z-index: 91;
  width: 42px;
  height: 42px;
  background: rgba(252, 250, 245, .92);
  box-shadow: 0 4px 16px rgba(60, 35, 15, .18);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.mobile-music svg { width: 20px; height: 20px; }

/* ============================================================
   Hero
   ============================================================ */
.hero {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 640px;
  padding: calc(var(--topbar-h) + 46px) 24px 76px;
  overflow: hidden;
  background: linear-gradient(155deg, #e5b46c 0%, #e8cfa2 48%, var(--paper) 100%);
}

.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 28%;
}

.hero-shade {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(100deg,
      rgba(24, 12, 6, .88) 0%,
      rgba(30, 15, 8, .72) 34%,
      rgba(33, 17, 8, .38) 66%,
      rgba(28, 14, 7, .2) 100%),
    linear-gradient(180deg,
      rgba(24, 12, 6, .34) 0%,
      rgba(24, 12, 6, .04) 38%,
      rgba(247, 241, 230, .38) 88%,
      var(--paper) 100%);
}

.hero-deco {
  position: absolute;
  z-index: 2;
  pointer-events: none;
  user-select: none;
}

.deco-lotus {
  top: 86px;
  left: max(-26px, calc(50% - 728px));
  width: 148px;
  opacity: .9;
  filter: drop-shadow(0 10px 22px rgba(60, 25, 0, .34));
}

.deco-buddha {
  top: 88px;
  right: max(-6px, calc(50% - 704px));
  width: 102px;
  opacity: .8;
  filter: drop-shadow(0 8px 18px rgba(30, 15, 0, .38));
}

.hero-inner {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 64px;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
}

.portrait-frame {
  position: relative;
  flex: 0 0 auto;
  width: 260px;
  aspect-ratio: 286 / 358;
  filter: drop-shadow(0 24px 36px rgba(22, 9, 3, .55)) drop-shadow(0 4px 10px rgba(22, 9, 3, .25));
}

.portrait-frame > img:first-child {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  filter: saturate(.92) contrast(1.02);
  /* 按 B01 相框的内轮廓裁切，避免照片直角从波浪边框外露出 */
  clip-path: polygon(31.12% 2.23%, 23.78% 4.47%, 21.33% 6.70%, 12.94% 8.94%, 11.89% 11.17%, 11.54% 13.41%, 8.04% 15.64%, 5.24% 17.88%, 3.50% 20.11%, 2.10% 22.35%, 2.10% 24.58%, 2.10% 26.82%, 2.10% 29.05%, 2.10% 31.28%, 2.10% 33.52%, 2.10% 35.75%, 2.10% 37.99%, 2.10% 40.22%, 2.10% 42.46%, 2.10% 44.69%, 2.10% 46.93%, 2.10% 49.16%, 2.10% 51.40%, 2.10% 53.63%, 2.10% 55.87%, 2.10% 58.10%, 2.10% 60.34%, 2.10% 62.57%, 2.10% 64.80%, 2.10% 67.04%, 2.10% 69.27%, 2.10% 71.51%, 2.10% 73.74%, 2.10% 75.98%, 2.80% 78.21%, 3.85% 80.45%, 5.94% 82.68%, 9.44% 84.92%, 11.54% 87.15%, 11.89% 89.39%, 18.18% 91.62%, 21.68% 93.85%, 25.17% 96.09%, 30.42% 97.77%, 69.23% 97.77%, 74.48% 96.09%, 77.97% 93.85%, 81.82% 91.62%, 87.76% 89.39%, 88.11% 87.15%, 90.21% 84.92%, 94.06% 82.68%, 95.80% 80.45%, 96.85% 78.21%, 97.55% 75.98%, 97.55% 73.74%, 97.55% 71.51%, 97.55% 69.27%, 97.55% 67.04%, 97.55% 64.80%, 97.55% 62.57%, 97.55% 60.34%, 97.55% 58.10%, 97.55% 55.87%, 97.55% 53.63%, 97.55% 51.40%, 97.55% 49.16%, 97.55% 46.93%, 97.55% 44.69%, 97.55% 42.46%, 97.55% 40.22%, 97.55% 37.99%, 97.55% 35.75%, 97.55% 33.52%, 97.55% 31.28%, 97.55% 29.05%, 97.55% 26.82%, 97.55% 24.58%, 97.55% 22.35%, 96.15% 20.11%, 94.41% 17.88%, 91.26% 15.64%, 88.11% 13.41%, 87.41% 11.17%, 86.71% 8.94%, 78.32% 6.70%, 75.87% 4.47%, 68.53% 2.23%);
}

/* B01 中间透明的红框，叠加在遗像之上 */
.portrait-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: url("../memorial/theme/B01.webp") center / 100% 100% no-repeat;
  filter: drop-shadow(0 2px 4px rgba(60, 15, 10, .28));
}

.hero-copy {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 580px;
  text-align: left;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 16px;
  font-size: 12.5px;
  letter-spacing: .3em;
  color: #f0d6a8;
}

.eyebrow::before {
  content: "";
  width: 28px;
  height: 1px;
  background: rgba(240, 214, 168, .7);
}

.hero-copy h1 {
  margin: 0 0 14px;
  font-family: var(--serif);
  font-size: clamp(40px, 5vw, 64px);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: .1em;
  color: #fffdf6;
  text-shadow: 0 4px 26px rgba(28, 12, 4, .4);
}

.dates {
  margin: 0 0 14px;
  font-family: var(--serif);
  font-size: 16px;
  letter-spacing: .05em;
  color: #f7ecd8;
  text-shadow: 0 2px 12px rgba(28, 12, 4, .35);
}

.place {
  margin: 0 0 30px;
  font-size: 13.5px;
  line-height: 1.9;
  letter-spacing: .03em;
  color: rgba(255, 250, 241, .8);
  text-shadow: 0 1px 8px rgba(28, 12, 4, .3);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

/* ============================================================
   按钮
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 22px;
  border: 1px solid rgba(107, 20, 23, .22);
  border-radius: 999px;
  background: rgba(255, 255, 255, .72);
  color: var(--red);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: .06em;
  white-space: nowrap;
  transition: background-color .25s ease, color .25s ease, border-color .25s ease, box-shadow .25s ease, transform .2s ease;
}

.btn:hover {
  background: #fff;
  border-color: rgba(107, 20, 23, .4);
  box-shadow: 0 6px 18px rgba(92, 58, 24, .12);
}

.btn:active { transform: translateY(1px); }

.btn-primary {
  background: linear-gradient(180deg, #7a1a1d, var(--red) 55%, #5d1114);
  border-color: var(--red-deep);
  color: #fdf6e8;
  box-shadow: 0 8px 20px -6px rgba(82, 15, 18, .55), inset 0 1px 0 rgba(255, 255, 255, .14);
}

.btn-primary:hover {
  background: linear-gradient(180deg, #872023, #711619 55%, #641215);
  border-color: var(--red-deep);
  color: #fffdf7;
  box-shadow: 0 10px 24px -6px rgba(82, 15, 18, .62), inset 0 1px 0 rgba(255, 255, 255, .16);
}

/* hero 内的次级按钮走描边玻璃质感 */
.hero .btn:not(.btn-primary) {
  background: rgba(255, 252, 245, .08);
  border-color: rgba(255, 248, 236, .42);
  color: #fffdf7;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.hero .btn:not(.btn-primary):hover {
  background: rgba(255, 252, 245, .18);
  border-color: rgba(255, 248, 236, .7);
  box-shadow: 0 8px 20px rgba(20, 8, 2, .22);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 21px;
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(201, 138, 75, .92);
  color: #fffdf6;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .02em;
  line-height: 1;
}

/* ============================================================
   主体两栏
   ============================================================ */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 28px;
  align-items: start;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 46px 24px 84px;
}

.col-main,
.col-side {
  display: flex;
  flex-direction: column;
  gap: 28px;
  min-width: 0;
}

.col-side { gap: 24px; }

/* ============================================================
   卡片面板
   ============================================================ */
.panel {
  position: relative;
  padding: 30px 32px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 14px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--line-soft);
}

.panel-head h2 {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 0;
  font-family: var(--serif);
  font-size: 23px;
  font-weight: 600;
  letter-spacing: .1em;
  color: var(--red);
}

.panel-head h2::before {
  content: "";
  width: 3px;
  height: 18px;
  border-radius: 2px;
  background: var(--gold);
}

.meta {
  flex: 0 0 auto;
  font-size: 12.5px;
  letter-spacing: .05em;
  color: var(--muted);
  white-space: nowrap;
}

/* 生平传记 */
.bio {
  margin: 0;
  font-family: var(--serif);
  font-size: 16.5px;
  line-height: 2.1;
  letter-spacing: .01em;
  text-align: justify;
  color: #43342a;
}

.bio.truncated {
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  padding: 2px 0;
  border: 0;
  border-bottom: 1px dashed rgba(107, 20, 23, .34);
  background: none;
  color: var(--red);
  font-size: 13.5px;
  letter-spacing: .1em;
  transition: color .25s ease, border-color .25s ease;
}

.link-btn:hover {
  color: var(--gold);
  border-color: rgba(201, 138, 75, .6);
}

/* ============================================================
   纪念影片
   ============================================================ */
.video-wrap {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 12px;
  background: #0b0908;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06), 0 10px 26px -14px rgba(40, 20, 8, .5);
}

.video-wrap video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #0b0908;
}

.video-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 20px;
  border: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, .06) 0%, rgba(0, 0, 0, .42) 100%);
  color: #fff;
  text-align: center;
  transition: background-color .3s ease;
}

.video-overlay:hover { background-color: rgba(0, 0, 0, .14); }

/* 遮罩显示时隐藏原生控件，避免与播放按钮文案叠压 */
.video-wrap:has(.video-overlay:not([hidden])) video::-webkit-media-controls {
  display: none !important;
}

.video-wrap:has(.video-overlay:not([hidden])) video::-webkit-media-controls-enclosure {
  opacity: 0 !important;
}

.video-overlay > span {
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  padding-left: 4px;
  border-radius: 50%;
  background: rgba(252, 250, 245, .93);
  color: var(--red);
  font-size: 22px;
  line-height: 1;
  box-shadow: 0 10px 26px rgba(0, 0, 0, .35), 0 0 0 1px rgba(255, 255, 255, .5) inset;
  transition: transform .3s ease, background-color .3s ease;
}

.video-overlay:hover > span {
  transform: scale(1.06);
  background: #fff;
}

.video-overlay > em {
  font-family: var(--serif);
  font-style: normal;
  font-size: 14px;
  letter-spacing: .2em;
  color: rgba(255, 250, 241, .9);
  text-shadow: 0 2px 12px rgba(0, 0, 0, .4);
}

/* ============================================================
   相册
   ============================================================ */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}

.gallery > * {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 10px;
  background: #efe6d6;
  cursor: pointer;
}

.gallery img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .5s cubic-bezier(.2, .7, .2, 1), filter .5s ease;
}

.gallery > *:hover img,
.gallery > img:hover {
  transform: scale(1.045);
  filter: saturate(1.04);
}

#galleryGrid:empty::before {
  content: "照片整理中…";
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  min-height: 220px;
  border: 1px dashed #d9cbb4;
  border-radius: 12px;
  background: rgba(247, 241, 230, .55);
  color: var(--muted);
  font-size: 13.5px;
  letter-spacing: .14em;
}

/* ============================================================
   天堂信箱
   ============================================================ */
.bless-form { margin: 0; }

.form-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.form-row input { flex: 1 1 auto; min-width: 0; }

.bless-form input,
.bless-form textarea {
  width: 100%;
  border: 1px solid #e3d8c6;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font-size: 15px;
  letter-spacing: .01em;
  transition: border-color .25s ease, box-shadow .25s ease;
}

.bless-form input {
  height: 46px;
  padding: 0 14px;
}

.bless-form textarea {
  display: block;
  min-height: 132px;
  margin-top: 12px;
  padding: 12px 14px;
  line-height: 1.75;
  resize: vertical;
}

.bless-form input::placeholder,
.bless-form textarea::placeholder {
  color: #b4a58f;
}

.bless-form input:focus,
.bless-form textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201, 138, 75, .15);
}

.char-count {
  flex: 0 0 auto;
  font-size: 12px;
  letter-spacing: .04em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.form-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 14px;
}

.muted {
  font-size: 12.5px;
  line-height: 1.9;
  color: var(--muted);
}

.bless-list {
  margin-top: 26px;
  border-top: 1px solid var(--line-soft);
}

.bless-list:empty::before {
  content: "还没有祝福，写下第一句思念吧。";
  display: block;
  padding: 26px 0 6px;
  text-align: center;
  font-size: 13.5px;
  letter-spacing: .06em;
  color: var(--muted);
}

.bless-list > * {
  padding: 17px 0;
  border-bottom: 1px dashed var(--line);
}

.bless-list > *:last-child { border-bottom: 0; }

.bless-list .bless-item,
.bless-list > .bless-item { padding: 17px 0; }

.bless-item-head,
.bless-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--gold);
}

.bless-list .name,
.bless-name {
  color: var(--gold);
  font-weight: 600;
}

.bless-list time,
.bless-list .time,
.bless-time {
  font-size: 12px;
  color: var(--muted);
}

.bless-item p,
.bless-msg,
.bless-text {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.85;
  color: var(--ink-soft);
  overflow-wrap: anywhere;
}

.bless-meta small { color: var(--muted); }

.bless-avatar,
.bless-item img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}

/* ============================================================
   侧栏
   ============================================================ */
.side-card h2 {
  position: relative;
  margin: 0 0 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-soft);
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: .12em;
  color: var(--red);
}

.side-card h2::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 30px;
  height: 2px;
  border-radius: 2px;
  background: var(--gold);
}

.side-card .muted {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.95;
}

.info-list {
  display: grid;
  gap: 0;
  margin: 0;
}

.info-list > div {
  display: grid;
  grid-template-columns: 62px 1fr;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--line-soft);
  font-size: 14px;
}

.info-list > div:last-child { border-bottom: 0; padding-bottom: 0; }

.info-list dt {
  color: var(--muted);
  letter-spacing: .06em;
}

.info-list dd {
  margin: 0;
  color: var(--ink);
}

.mini-gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.mini-gallery > * {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 8px;
  background: #efe6d6;
  cursor: pointer;
}

.mini-gallery img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .4s ease;
}

.mini-gallery > *:hover img { transform: scale(1.06); }

#miniGallery:empty::before {
  content: "暂无相片";
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  min-height: 96px;
  border: 1px dashed #d9cbb4;
  border-radius: 10px;
  background: rgba(247, 241, 230, .55);
  color: var(--muted);
  font-size: 12.5px;
  letter-spacing: .12em;
}

.side-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.side-actions .btn {
  width: 100%;
  height: 42px;
  padding: 0 10px;
  border-radius: 10px;
  font-size: 13.5px;
  letter-spacing: .04em;
}

/* ============================================================
   页脚
   ============================================================ */
.footer {
  position: relative;
  max-width: 1180px;
  margin: 0 auto;
  padding: 38px 24px 56px;
  overflow: hidden;
  border-top: 1px solid rgba(107, 20, 23, .12);
  text-align: center;
}

.footer::before,
.footer::after {
  content: "";
  position: absolute;
  bottom: -18px;
  width: 168px;
  height: 120px;
  pointer-events: none;
  background: center / contain no-repeat;
}

.footer::before {
  left: -18px;
  background-image: url("../memorial/theme/IB05.webp");
  opacity: .2;
}

.footer::after {
  right: -26px;
  width: 200px;
  height: 128px;
  background-image: url("../memorial/theme/IB04.webp");
  opacity: .14;
}

.footer p {
  position: relative;
  z-index: 1;
  margin: 4px 0;
  font-family: var(--serif);
  font-size: 15px;
  letter-spacing: .14em;
  color: #6b5a4a;
}

.footer p.muted {
  font-family: var(--sans);
  font-size: 12.5px;
  letter-spacing: .08em;
  color: var(--muted);
}

.footer a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.footer a:hover { color: var(--red); }

/* ============================================================
   移动端底部导航
   ============================================================ */
.mobile-nav { display: none; }

/* ============================================================
   Lightbox
   ============================================================ */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 56px 72px;
  background: rgba(22, 13, 8, .95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.lightbox[hidden] { display: none; }

#lbImg {
  display: block;
  width: auto;
  height: auto;
  max-width: min(90vw, 1080px);
  max-height: 82vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
  user-select: none;
}

.lb-close,
.lb-prev,
.lb-next {
  position: absolute;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .32);
  border-radius: 50%;
  background: rgba(20, 13, 8, .55);
  color: #fdf6e8;
  line-height: 1;
  text-shadow: 0 1px 6px rgba(0, 0, 0, .4);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .28);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: background-color .25s ease, border-color .25s ease, transform .2s ease;
}

.lb-close:hover,
.lb-prev:hover,
.lb-next:hover {
  background: rgba(20, 13, 8, .8);
  border-color: rgba(255, 255, 255, .55);
}

.lb-close {
  top: 20px;
  right: 24px;
  width: 44px;
  height: 44px;
  font-size: 26px;
}

.lb-prev,
.lb-next {
  top: 50%;
  width: 48px;
  height: 48px;
  margin-top: -24px;
  padding-bottom: 4px;
  font-size: 32px;
}

.lb-prev { left: 20px; }
.lb-next { right: 20px; }

.lb-count {
  position: absolute;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  font-size: 13px;
  letter-spacing: .22em;
  color: rgba(253, 246, 232, .7);
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   Toast
   ============================================================ */
.toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  z-index: 300;
  max-width: calc(100vw - 40px);
  padding: 10px 20px;
  border-radius: 999px;
  background: rgba(43, 26, 18, .94);
  color: #fdf6e8;
  font-size: 13.5px;
  letter-spacing: .04em;
  text-align: center;
  box-shadow: 0 10px 30px rgba(30, 15, 5, .28);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity .3s ease, transform .3s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ============================================================
   入场动画
   ============================================================ */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero-inner > .portrait-frame {
  animation: fadeUp .85s cubic-bezier(.2, .7, .2, 1) .05s both;
}

.hero-inner > .hero-copy {
  animation: fadeUp .85s cubic-bezier(.2, .7, .2, 1) .16s both;
}

.panel {
  animation: fadeUp .7s cubic-bezier(.2, .7, .2, 1) both;
}

.col-main > .panel:nth-child(2) { animation-delay: .05s; }
.col-main > .panel:nth-child(3) { animation-delay: .1s; }
.col-main > .panel:nth-child(4) { animation-delay: .15s; }
.col-side > .panel:nth-child(2) { animation-delay: .05s; }
.col-side > .panel:nth-child(3) { animation-delay: .1s; }
.col-side > .panel:nth-child(4) { animation-delay: .15s; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 1100px) {
  .hero-inner { gap: 48px; }
  .portrait-frame { width: 230px; }
  .topnav { gap: 22px; }
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
    padding: 38px 22px 68px;
  }

  .col-side {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 22px;
    align-items: start;
  }

  .hero {
    min-height: 560px;
    padding: calc(var(--topbar-h) + 40px) 22px 64px;
  }

  .hero-inner { gap: 40px; }

  .portrait-frame { width: 208px; }

  .deco-lotus { width: 118px; top: 82px; }
  .deco-buddha { width: 84px; top: 86px; }

  .hero-copy h1 { letter-spacing: .08em; }

  .panel { padding: 26px 26px; }

  .gallery { gap: 12px; }
}

@media (max-width: 720px) {
  .topbar-inner { gap: 14px; padding: 0 16px; }
  .topnav { gap: 14px; }
  .topnav a { font-size: 13px; letter-spacing: .04em; }
  .brand { font-size: 15px; gap: 8px; }
  .brand::before { width: 22px; height: 22px; font-size: 13px; }
  .icon-btn { width: 34px; height: 34px; }
  .icon-btn svg { width: 17px; height: 17px; }
}

@media (max-width: 640px) {
  :root { --topbar-h: 0px; }

  body { padding-bottom: calc(58px + env(safe-area-inset-bottom)); }

  .topbar { display: none; }

  .mobile-music {
    display: grid;
    width: 42px;
    height: 42px;
  }
  .mobile-music svg { width: 20px; height: 20px; }

  .mobile-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 90;
    display: flex;
    align-items: stretch;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    background: rgba(252, 250, 245, .94);
    border-top: 1px solid rgba(107, 20, 23, .12);
    box-shadow: 0 -6px 24px rgba(60, 35, 15, .08);
    backdrop-filter: blur(14px) saturate(1.1);
    -webkit-backdrop-filter: blur(14px) saturate(1.1);
  }

  .mobile-nav a {
    position: relative;
    flex: 1 1 0;
    padding: 9px 0 6px;
    text-align: center;
    font-size: 11.5px;
    letter-spacing: .06em;
    color: var(--muted);
    transition: color .25s ease;
  }

  .mobile-nav a::before {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    width: 16px;
    height: 2px;
    border-radius: 2px;
    background: var(--red);
    transform: translateX(-50%) scaleX(0);
    transition: transform .25s ease;
  }

  .mobile-nav a.active {
    color: var(--red);
    font-weight: 600;
  }

  .mobile-nav a.active::before { transform: translateX(-50%) scaleX(1); }

  html { scroll-padding-top: 16px; }

  .hero {
    align-items: flex-start;
    min-height: 0;
    padding: 94px 20px 50px;
  }

  .hero-bg { object-position: center 34%; }

  .hero-shade {
    background:
      linear-gradient(180deg,
        rgba(24, 12, 6, .60) 0%,
        rgba(24, 12, 6, .56) 52%,
        rgba(28, 14, 7, .5) 80%,
        var(--paper) 100%);
  }

  .deco-lotus {
    top: 12px;
    left: -16px;
    width: 86px;
    opacity: .82;
  }

  .deco-buddha {
    top: 20px;
    right: 0;
    width: 66px;
    opacity: .72;
  }

  .hero-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 26px;
  }

  .portrait-frame { width: 190px; }

  .hero-copy { max-width: 100%; }

  .eyebrow {
    margin-bottom: 12px;
    font-size: 11.5px;
    letter-spacing: .24em;
  }

  .eyebrow::before { width: 20px; }

  .hero-copy h1 {
    margin-bottom: 12px;
    letter-spacing: .08em;
  }

  .dates {
    margin-bottom: 10px;
    font-size: 14px;
    line-height: 1.75;
  }

  .place {
    margin-bottom: 24px;
    font-size: 12.5px;
    line-height: 1.85;
  }

  /* 移动端首屏底部渐入浅米色，白字对比度不足 —— 实色底衬规则放在文件末尾，
     因为基础 .hero-note 在样式末尾定义，写在媒体块里会被它覆盖 */

  .hero-actions { gap: 10px; }

  .btn {
    height: 42px;
    padding: 0 16px;
    font-size: 13.5px;
  }

  .layout {
    gap: 20px;
    padding: 28px 16px 46px;
  }

  .col-main { gap: 20px; }
  .col-side { grid-template-columns: 1fr; gap: 20px; }

  .panel {
    padding: 24px;
    border-radius: 16px;
  }

  .panel-head {
    gap: 10px;
    padding-bottom: 12px;
    margin-bottom: 18px;
  }

  .panel-head h2 {
    gap: 9px;
    font-size: 20px;
  }

  .panel-head h2::before { height: 16px; }

  .meta { font-size: 11.5px; }

  .bio { font-size: 15.5px; line-height: 2; }

  .video-wrap { border-radius: 10px; }

  .video-overlay > span {
    width: 56px;
    height: 56px;
    font-size: 18px;
  }

  .video-overlay > em { font-size: 12px; letter-spacing: .16em; }

  .gallery { gap: 8px; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }

  .form-row { gap: 10px; }

  .form-foot {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .form-foot .btn { width: 100%; }

  .side-card h2 { font-size: 17px; }

  .footer {
    padding: 32px 20px 40px;
  }

  .footer::before { width: 120px; opacity: .14; left: -28px; }
  .footer::after { width: 140px; opacity: .1; right: -34px; }

  .footer p { font-size: 13.5px; letter-spacing: .1em; }

  .lightbox { padding: 64px 12px; }

  #lbImg { max-width: 94vw; max-height: 76vh; }

  .lb-close {
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
  }

  .lb-prev,
  .lb-next {
    width: 40px;
    height: 40px;
    margin-top: -20px;
    font-size: 26px;
  }

  .lb-prev { left: 8px; }
  .lb-next { right: 8px; }

  .lb-count { bottom: 18px; font-size: 12px; }

  .toast { bottom: calc(76px + env(safe-area-inset-bottom)); }
}


/* 样板提示 */
.hero-note {
  margin: 14px 0 0;
  max-width: 520px;
  color: rgba(255, 255, 255, .78);
  font-size: 12.5px;
  letter-spacing: .02em;
  line-height: 1.8;
  text-shadow: 0 1px 3px rgba(20, 10, 4, .55);
}


/* 图片待补充占位 */
.gallery-empty {
  min-height: 280px;
  margin: 4px 0 2px;
  padding: 28px 24px;
  border: 1px dashed var(--line-2, #d7c7b4);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  background: rgba(255, 255, 255, .35);
}
.gallery-empty p {
  margin: 0;
  font-family: var(--serif);
  font-size: 21px;
  color: var(--ink);
  letter-spacing: .08em;
}
.gallery-empty span {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.8;
}
.mini-empty {
  min-height: 132px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line-2, #d7c7b4);
  border-radius: 10px;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: .08em;
  background: rgba(255, 255, 255, .3);
}

/* 移动端首屏底部渐变落到浅米色纸面，白色免责声明对比度不足 2:1 —— 加实色底衬
   （必须放在文件末尾：基础 .hero-note 定义在末尾，媒体查询内的同名规则会被它覆盖） */
@media (max-width: 640px) {
  .hero-note {
    margin-top: 20px;
    padding: 10px 13px;
    border-radius: 10px;
    background: rgba(32, 17, 9, .82);
    color: #fff8ee;
    font-size: 12.5px;
    line-height: 1.75;
    text-shadow: none;
    box-shadow: 0 2px 10px rgba(20, 10, 4, .28);
  }
}
