/* R29 生日邀请函 · 5 套主题 */

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

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background 0.4s ease, color 0.4s ease;
  padding-bottom: calc(6.5rem + env(safe-area-inset-bottom));
}

body.showcase-back-active { padding-top: calc(44px + env(safe-area-inset-top, 0)); }

img { max-width: 100%; display: block; }

.section {
  max-width: 900px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem;
}

.section__title {
  font-family: var(--font-title);
  font-size: 1.5rem;
  text-align: center;
  margin-bottom: 1.75rem;
  color: var(--primary);
  letter-spacing: 0.08em;
}

/* Themes */
body[data-theme='birthday-red'] {
  --primary: #C41E3A; --primary-light: #F2D5DB; --accent: #FDE047;
  --bg: #FFF5E6; --bg-card: #FFFFFF; --text: #4A2825; --text-light: #8B5E5A;
  --font-title: Georgia, 'Songti SC', serif;
}
body[data-theme='sweet-pink'] {
  --primary: #F472B6; --primary-light: #FBCFE8; --accent: #FBCFE8;
  --bg: #FFF8F5; --bg-card: #FFFFFF; --text: #5C3D3D; --text-light: #8B7B7B;
  --font-title: Georgia, 'Songti SC', serif;
}
body[data-theme='fresh-green'] {
  --primary: #10B981; --primary-light: #A7F3D0; --accent: #A7F3D0;
  --bg: #FAF7F2; --bg-card: #FFFFFF; --text: #3A4D40; --text-light: #6B8070;
  --font-title: 'KaiTi', 'STKaiti', serif;
}
body[data-theme='minimal-gold'] {
  --primary: #D4A853; --primary-light: #FEF3C7; --accent: #FEF3C7;
  --bg: #FFFFFF; --bg-card: #FAFAFA; --text: #2B2B2B; --text-light: #888888;
  --font-title: -apple-system, BlinkMacSystemFont, sans-serif;
}
body[data-theme='playful-rainbow'] {
  --primary: #8B5CF6; --primary-light: #C084FC; --accent: #C084FC;
  --bg: #FFF5F5; --bg-card: #FFFFFF; --text: #5C3D4A; --text-light: #9B8088;
  --font-title: 'PingFang SC', sans-serif;
}

/* Hero */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #fff;
  overflow: hidden;
}

.hero__bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  transform: scale(1.05);
}

.hero__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,.35) 0%, rgba(0,0,0,.55) 100%);
}

.hero__content {
  position: relative;
  z-index: 1;
  padding: 2rem 1.5rem;
  animation: fadeUp 0.8s ease;
}

.hero__age-badge {
  display: inline-block;
  font-size: 2rem;
  font-weight: 900;
  padding: 0.25rem 1rem;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  margin-bottom: 0.5rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.hero__tag { font-size: 0.95rem; opacity: 0.92; margin-bottom: 0.75rem; letter-spacing: 0.2em; }
.hero__names {
  font-family: var(--font-title);
  font-size: clamp(2rem, 8vw, 3rem);
  font-weight: 700;
  margin-bottom: 0.5rem;
}
.hero__date { font-size: 1.1rem; opacity: 0.95; margin-bottom: 1.25rem; }
.hero__countdown {
  display: inline-block;
  padding: 0.5rem 1rem;
  border: 1px solid rgba(255,255,255,.45);
  border-radius: 999px;
  font-size: 0.85rem;
  backdrop-filter: blur(4px);
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Detail cards */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.detail-card {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 1rem;
  text-align: center;
  box-shadow: 0 2px 12px rgba(0,0,0,.06);
}

.detail-card__icon { font-size: 1.75rem; margin-bottom: 0.35rem; }
.detail-card__label { font-size: 0.75rem; color: var(--text-light); }
.detail-card__value { font-size: 0.9rem; font-weight: 600; margin-top: 0.25rem; }

/* Timeline story */
.story-list { position: relative; padding-left: 1.25rem; }
.story-list::before {
  content: '';
  position: absolute;
  left: 0.35rem;
  top: 0.5rem;
  bottom: 0.5rem;
  width: 2px;
  background: var(--primary-light);
}

.story-item {
  position: relative;
  margin-bottom: 1.75rem;
  padding-left: 1rem;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.story-item.visible { opacity: 1; transform: translateY(0); }

.story-item::before {
  content: '';
  position: absolute;
  left: -0.95rem;
  top: 0.45rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--bg-card);
}

.story-item__date { font-size: 0.8rem; color: var(--accent); font-weight: 600; }
.story-item__title { font-family: var(--font-title); font-size: 1.15rem; margin: 0.2rem 0; }
.story-item__desc { font-size: 0.9rem; color: var(--text-light); margin-bottom: 0.6rem; }
.story-item__img {
  border-radius: 10px;
  aspect-ratio: 16/10;
  object-fit: cover;
  width: 100%;
}

/* Gallery */
.gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}

.gallery__item {
  border: none;
  padding: 0;
  background: none;
  cursor: pointer;
  border-radius: 8px;
  overflow: hidden;
  aspect-ratio: 1;
}

.gallery__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}
.gallery__item:active img { transform: scale(1.03); }

/* Schedule */
.schedule-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 0;
  border-bottom: 1px dashed var(--primary-light);
}
.schedule-item:last-child { border-bottom: none; }
.schedule-item__time {
  flex-shrink: 0;
  font-weight: 700;
  color: var(--primary);
  min-width: 3.2rem;
}
.schedule-item__icon { font-size: 1.25rem; }
.schedule-item__body h4 { font-size: 1rem; }
.schedule-item__body p { font-size: 0.85rem; color: var(--text-light); }

/* RSVP */
.rsvp-form {
  background: var(--bg-card);
  border-radius: 14px;
  padding: 1.25rem;
  box-shadow: 0 2px 12px rgba(0,0,0,.06);
}

.rsvp-form label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-light);
  margin-bottom: 0.25rem;
  margin-top: 0.75rem;
}
.rsvp-form label:first-of-type { margin-top: 0; }

.rsvp-form input,
.rsvp-form textarea {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--primary-light);
  border-radius: 8px;
  font-size: 1rem;
  background: var(--bg);
  color: var(--text);
}

.rsvp-form textarea { min-height: 4.5rem; resize: vertical; }

.btn {
  display: inline-block;
  width: 100%;
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  border: none;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}

.rsvp-result {
  margin-top: 1rem;
  padding: 0.85rem;
  background: var(--primary-light);
  border-radius: 8px;
  font-size: 0.9rem;
  word-break: break-all;
  display: none;
}
.rsvp-result.show { display: block; }

.rsvp-hint { font-size: 0.8rem; color: var(--text-light); text-align: center; margin-top: 0.75rem; }

.wish-wall {
  margin-top: 1rem;
  max-height: 200px;
  overflow-y: auto;
  padding: 0.5rem;
  background: var(--accent);
  border-radius: 12px;
}
.wish-wall__empty {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-light);
  padding: 0.75rem;
}
.wish-item {
  padding: 0.5rem;
  border-bottom: 1px dashed rgba(0,0,0,0.1);
  animation: wishFadeIn 0.3s ease;
  font-size: 0.9rem;
}
.wish-item:last-child { border-bottom: none; }
@keyframes wishFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.wish-ticker {
  margin-top: 0.75rem;
  overflow: hidden;
  border-radius: 999px;
  background: var(--primary-light);
  padding: 0.35rem 0;
}
.wish-ticker[hidden] { display: none !important; }
.wish-ticker__track {
  display: flex;
  gap: 2rem;
  width: max-content;
  animation: wishScroll 24s linear infinite;
}
.wish-ticker__item {
  white-space: nowrap;
  font-size: 0.8rem;
  color: var(--text);
}
@keyframes wishScroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* Footer CTA */
.footer-cta {
  background: var(--primary);
  color: #fff;
  padding: 2.5rem 1.25rem calc(2.5rem + env(safe-area-inset-bottom));
  text-align: center;
}

.footer-cta__title { font-family: var(--font-title); font-size: 1.35rem; margin-bottom: 0.5rem; }
.footer-cta__sub { font-size: 0.9rem; opacity: 0.9; margin-bottom: 1.25rem; }
.footer-cta__btns { display: flex; flex-direction: column; gap: 0.65rem; max-width: 320px; margin: 0 auto; }
.footer-cta .btn-outline { color: #fff; border-color: rgba(255,255,255,.7); background: rgba(255,255,255,.12); }
.footer-cta__contact { margin-top: 1.25rem; font-size: 0.85rem; opacity: 0.88; }

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0,0,0,.92);
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox[hidden] { display: none !important; }

.lightbox__img { max-width: 92vw; max-height: 85vh; object-fit: contain; }
.lightbox__close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 2;
  background: rgba(255,255,255,.15);
  border: none;
  color: #fff;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  font-size: 1.25rem;
  cursor: pointer;
}
.lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,.15);
  border: none;
  color: #fff;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  font-size: 1.75rem;
  cursor: pointer;
}
.lightbox__prev { left: 0.75rem; }
.lightbox__next { right: 0.75rem; }

/* 标准底栏三按钮 */
.contact-footer {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 950;
  padding: 0.625rem 0.75rem;
  padding-bottom: calc(0.625rem + env(safe-area-inset-bottom));
  background: #1a2744;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.contact-footer__btns {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  max-width: 28rem;
  margin: 0 auto;
}

.contact-footer__cta,
.contact-footer__btn {
  flex: 1;
  border: none;
  border-radius: 999px;
  padding: 0.625rem 0.5rem;
  font-size: 0.875rem;
  text-align: center;
  text-decoration: none;
  line-height: 1.25;
  cursor: pointer;
}

.contact-footer__cta {
  background: #c41e1e;
  color: #fff;
  font-weight: 600;
}

.contact-footer__btn {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.contact-footer__brand {
  margin-top: 0.375rem;
  text-align: center;
  font-size: 10px;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.6);
}

html.has-contact-footer .zw-root .zw-fab {
  bottom: calc(5.75rem + env(safe-area-inset-bottom));
}

/* Theme panel */
.theme-panel {
  position: fixed;
  right: 1rem;
  bottom: calc(6.25rem + env(safe-area-inset-bottom));
  z-index: 900;
}

.theme-panel__toggle {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: #fff;
  font-size: 1.1rem;
  box-shadow: 0 4px 14px rgba(0,0,0,.18);
  cursor: pointer;
}

.theme-panel__list {
  position: absolute;
  bottom: 3.25rem;
  right: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.5rem;
  background: var(--bg-card);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,.12);
}

.theme-panel__list[hidden] { display: none !important; }

.theme-panel__list button {
  border: 2px solid transparent;
  border-radius: 8px;
  padding: 0.35rem 0.65rem;
  font-size: 0.75rem;
  cursor: pointer;
  white-space: nowrap;
  background: var(--swatch, #ccc);
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,.35);
}
.theme-panel__list button.active { border-color: var(--text); }

.back-top {
  position: fixed;
  right: 1rem;
  bottom: calc(10rem + env(safe-area-inset-bottom));
  z-index: 890;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  border: none;
  background: var(--bg-card);
  color: var(--primary);
  box-shadow: 0 2px 12px rgba(0,0,0,.12);
  cursor: pointer;
  font-size: 1.1rem;
}
.back-top[hidden] { display: none !important; }

.music-btn {
  position: fixed;
  top: calc(1rem + env(safe-area-inset-top, 0));
  right: 1rem;
  z-index: 880;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,.85);
  box-shadow: 0 2px 10px rgba(0,0,0,.12);
  cursor: pointer;
  font-size: 1.1rem;
}
body.showcase-back-active .music-btn { top: calc(3.25rem + env(safe-area-inset-top, 0)); }
.music-btn[hidden] { display: none !important; }
.music-btn.playing { animation: spin 3s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (min-width: 768px) {
  .detail-grid { grid-template-columns: repeat(4, 1fr); }
  .gallery { grid-template-columns: repeat(3, 1fr); gap: 0.65rem; }
  .footer-cta__btns { flex-direction: row; max-width: 480px; }
  .footer-cta__btns .btn { width: auto; flex: 1; }
}

@media (max-width: 767px) {
  .detail-grid { grid-template-columns: 1fr 1fr; }
}
