/* ===== Variables ===== */
:root {
  --primary: #e91e63;
  --primary-soft: rgba(233, 30, 99, 0.08);
  --accent: #ff4081;
  --bg: #faf7f9;
  --bg-card: #ffffff;
  --text: #2d2a2c;
  --text-muted: #9e9599;
  --border: #f0e6ec;
  --shadow: 0 4px 20px rgba(0,0,0,0.07);
  --shadow-lg: 0 12px 48px rgba(0,0,0,0.12);
  --radius: 16px;
  --radius-sm: 10px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

h1, h2, h3 { font-family: 'ZCOOL XiaoWei', serif; }

/* ===== Navbar ===== */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 100;
  border-bottom: 1px solid var(--border);
}
.nav-content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'ZCOOL XiaoWei', serif;
  font-size: 20px;
  color: var(--primary);
}
.heart-icon { animation: heartbeat 1.8s ease-in-out infinite; display: inline-block; }
@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}
.nav-btn {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  padding: 9px 22px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: box-shadow 0.25s, transform 0.25s;
}
.nav-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(233,30,99,0.35); }

/* ===== Hero ===== */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 100px 20px 60px;
  background: linear-gradient(160deg, #fff5f8 0%, #fdf4f7 40%, #f0e8f5 100%);
  position: relative;
  text-align: center;
  overflow: hidden;
}

.hero-cover-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0;
  transition: opacity 1.2s ease;
  z-index: 0;
}

.hero-cover-bg[style] {
  opacity: 1;
}

.hero-cover-fade {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(250, 247, 249, 0.70) 0%,
    rgba(240, 228, 240, 0.55) 50%,
    rgba(250, 247, 249, 0.85) 100%
  );
  z-index: 1;
  pointer-events: none;
}

.hero > *:not(.hero-cover-bg):not(.hero-cover-fade) {
  position: relative;
  z-index: 2;
}

.hero-top {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  margin-bottom: 32px;
}

.avatar {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  overflow: hidden;
  border: 4px solid #fff;
  box-shadow: var(--shadow);
  flex-shrink: 0;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.hero-heart {
  font-size: 44px;
  animation: heartbeat 1.8s ease-in-out infinite;
}

.hero-title {
  font-size: clamp(30px, 5vw, 52px);
  color: var(--primary);
  margin-bottom: 24px;
  letter-spacing: 2px;
}

.hero-meta {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
}
.anniversary-label {
  font-size: 16px;
  color: var(--text-muted);
  margin-right: 6px;
}
.days-count {
  font-family: 'ZCOOL XiaoWei', serif;
  font-size: clamp(56px, 10vw, 96px);
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}
.days-label {
  font-size: 20px;
  color: var(--text-muted);
}

.hero-scroll-hint {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 28px;
  color: var(--primary);
  animation: bounce 2.2s ease-in-out infinite;
  opacity: 0.6;
}
@keyframes bounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-10px); }
}

/* ===== Gallery Section ===== */
.gallery-section {
  padding: 80px 20px 100px;
  max-width: 1280px;
  margin: 0 auto;
}

.gallery-header {
  text-align: center;
  margin-bottom: 60px;
}
.gallery-header h2 {
  font-size: 36px;
  color: var(--primary);
  margin-bottom: 8px;
}
.gallery-header p {
  font-size: 15px;
  color: var(--text-muted);
}

/* ===== Gallery layout + time sidebar ===== */
.gallery-layout {
  display: flex;
  gap: 36px;
  align-items: flex-start;
}

.gallery-sidebar {
  flex: 0 0 220px;
  position: sticky;
  top: 88px;
  z-index: 5;
}

.sidebar-inner {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 16px;
  box-shadow: var(--shadow);
}

.sidebar-title {
  font-family: 'ZCOOL XiaoWei', serif;
  font-size: 17px;
  color: var(--primary);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.time-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.time-nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.time-nav-item:hover {
  background: var(--primary-soft);
  color: var(--primary);
}

.time-nav-item.active {
  background: linear-gradient(135deg, var(--primary-soft), rgba(255, 64, 129, 0.12));
  color: var(--primary);
  font-weight: 500;
}

.time-nav-count {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
}

.time-nav-item.active .time-nav-count {
  color: var(--primary);
  opacity: 0.85;
}

.time-nav-year {
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.time-nav-summary {
  list-style: none;
  cursor: pointer;
  padding: 10px 12px;
  font-family: 'ZCOOL XiaoWei', serif;
  font-size: 15px;
  color: var(--text);
  user-select: none;
  transition: background 0.2s, color 0.2s;
}

.time-nav-summary::-webkit-details-marker { display: none; }
.time-nav-summary::marker { content: ''; }

.time-nav-summary:hover {
  background: var(--primary-soft);
  color: var(--primary);
}

.time-nav-year[open] > .time-nav-summary {
  color: var(--primary);
}

.time-nav-months {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 4px 0 8px 8px;
  border-left: 2px solid var(--border);
  margin-left: 10px;
}

.time-nav-year-all {
  font-size: 13px;
  color: var(--text-muted);
}

.time-nav-year-all:hover { color: var(--primary); }

.time-nav-month {
  font-size: 13px;
  padding: 8px 10px;
}

.gallery-main {
  flex: 1;
  min-width: 0;
}

.media-card.filtered-hidden {
  display: none !important;
}

.gallery-filter-empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
  font-size: 15px;
}

.gallery-empty {
  text-align: center;
  padding: 80px 20px;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.gallery-empty-icon { font-size: 64px; margin-bottom: 16px; }
.gallery-empty h3 { font-size: 22px; color: var(--text); margin-bottom: 8px; }
.gallery-empty p { font-size: 14px; color: var(--text-muted); margin-bottom: 24px; }

/* ===== Media Grid (Pinterest-style) ===== */
.media-grid {
  columns: 4;
  column-gap: 20px;
}

.media-card {
  break-inside: avoid;
  margin-bottom: 20px;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.25s, box-shadow 0.25s;
  position: relative;
}
.media-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}
.media-card:hover .play-overlay { opacity: 1; }

.media-thumb {
  position: relative;
  overflow: hidden;
  background: #f5f5f5;
}

.media-element {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.35s;
}
.media-card:hover .media-element { transform: scale(1.04); }

.play-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
}
.play-overlay span {
  font-size: 48px;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.media-info {
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
}
.media-date { color: var(--primary); font-weight: 500; flex-shrink: 0; }
.media-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===== Lightbox ===== */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(10,8,10,0.96);
  z-index: 2000;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.lightbox.active { display: flex; }

.lightbox-topbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  padding: 20px 24px;
  display: flex;
  justify-content: flex-end;
  z-index: 10;
}
.lightbox-close {
  background: rgba(255,255,255,0.1);
  border: none;
  color: #fff;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 28px;
  cursor: pointer;
  line-height: 1;
  transition: background 0.2s;
}
.lightbox-close:hover { background: rgba(255,255,255,0.25); }

.lightbox-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  width: 100%;
  height: 100%;
  padding: 80px 20px 80px;
}

.lightbox-prev,
.lightbox-next {
  background: rgba(255,255,255,0.1);
  border: none;
  color: #fff;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  font-size: 32px;
  cursor: pointer;
  flex-shrink: 0;
  line-height: 1;
  transition: background 0.2s, transform 0.15s;
}
.lightbox-prev:hover,
.lightbox-next:hover { background: rgba(255,255,255,0.25); }
.lightbox-prev:hover { transform: translateX(-3px); }
.lightbox-next:hover { transform: translateX(3px); }

.lightbox-center {
  flex: 1;
  max-width: calc(100vw - 180px);
  max-height: calc(100vh - 160px);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

#lbImg,
#lbVid {
  max-width: 100%;
  max-height: calc(100vh - 160px);
  border-radius: var(--radius-sm);
  object-fit: contain;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.lightbox-footer {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 16px 28px;
  display: flex;
  align-items: center;
  gap: 24px;
  background: linear-gradient(transparent, rgba(0,0,0,0.5));
  font-size: 13px;
  color: rgba(255,255,255,0.85);
  pointer-events: none;
}
#lbCounter { opacity: 0.6; }
#lbDate { color: var(--accent); font-weight: 500; }
#lbTitle { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ===== Button ===== */
.btn-primary {
  display: inline-block;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  padding: 13px 30px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  font-family: inherit;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(233,30,99,0.4); }

/* ===== Footer ===== */
.footer {
  text-align: center;
  padding: 36px 20px;
  background: linear-gradient(135deg, var(--primary), #9c27b0);
  color: rgba(255,255,255,0.88);
}
.footer p { font-size: 13px; }

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  .media-grid { columns: 3; }
  .gallery-sidebar { flex-basis: 200px; }
}
@media (max-width: 900px) {
  .gallery-layout {
    flex-direction: column;
    gap: 20px;
  }
  .gallery-sidebar {
    flex: none;
    width: 100%;
    position: static;
  }
  .sidebar-inner { padding: 14px 14px; }
  .time-nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
  }
  .time-nav > .time-nav-item {
    width: auto;
    flex: 0 0 auto;
  }
  .time-nav-year {
    width: 100%;
  }
  .time-nav-months {
    flex-direction: row;
    flex-wrap: wrap;
    border-left: none;
    margin-left: 0;
    padding-left: 0;
    gap: 6px;
  }
  .time-nav-month,
  .time-nav-year-all {
    width: auto !important;
    flex: 0 0 auto;
  }
}
@media (max-width: 768px) {
  .media-grid { columns: 2; }
  .hero-top { gap: 14px; }
  .avatar { width: 100px; height: 100px; }
  .hero-heart { font-size: 32px; }
  .hero-meta { flex-wrap: wrap; }
  .lightbox-prev, .lightbox-next { display: none; }
  .lightbox-center { max-width: 100vw; }
}
@media (max-width: 480px) {
  .media-grid { columns: 2; column-gap: 12px; margin-bottom: 12px; }
  .media-card { margin-bottom: 12px; }
  .gallery-section { padding: 60px 12px 80px; }
}
