/* ========== 可改主题色 ========== */
:root {
  --pink-deep: #ff4d6d;
  --pink-soft: #ffd1dc;
  --ink: #ff4d6d;
  --card-bg: #ffffff;
}

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

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: linear-gradient(120deg, var(--pink-soft), #ffffff 55%, #fff5f7);
  min-height: 100vh;
  color: #333;
}

.hidden {
  display: none !important;
}

/* —— 主体 —— */
.page-header {
  text-align: center;
  padding: 2.5rem 1.25rem 1.5rem;
  color: var(--ink);
}

.couple-title {
  margin: 0 0 0.5rem;
  font-size: clamp(1.35rem, 4vw, 1.85rem);
}

.days-line {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
}

.music-btn {
  margin-top: 1rem;
  padding: 8px 16px;
  border-radius: 999px;
  border: 2px solid var(--pink-deep);
  background: #fff;
  color: var(--pink-deep);
  font-size: 0.9rem;
  cursor: pointer;
}

.music-btn:hover {
  background: #fff0f3;
}

.load-error {
  max-width: 36rem;
  margin: 0 auto 1rem;
  padding: 0.85rem 1rem;
  background: #fff5f5;
  border: 1px solid #ffb3c0;
  border-radius: 10px;
  color: #a61e3a;
  text-align: center;
  font-size: 0.9rem;
}

.section-heading {
  text-align: center;
  color: var(--ink);
  font-size: 1.25rem;
  margin: 0 0 1.25rem;
}

/* —— 时间轴（中间竖线 + 左右卡片） —— */
.tl-wrap {
  max-width: 920px;
  margin: 0 auto;
  padding: 0 1rem 2rem;
}

.timeline {
  position: relative;
  margin: 0 auto;
  padding: 0.5rem 0 2rem;
}

.timeline::after {
  content: "";
  position: absolute;
  width: 4px;
  background: var(--pink-deep);
  top: 0;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 4px;
  opacity: 0.85;
}

.tl-item {
  position: relative;
  width: 50%;
  padding: 12px 20px 28px;
}

.tl-item.left {
  left: 0;
  text-align: right;
  padding-right: 28px;
}

.tl-item.right {
  margin-left: 50%;
  text-align: left;
  padding-left: 28px;
}

.tl-item::after {
  content: "";
  position: absolute;
  top: 28px;
  width: 14px;
  height: 14px;
  background: #fff;
  border: 3px solid var(--pink-deep);
  border-radius: 50%;
  z-index: 1;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.9);
}

.tl-item.left::after {
  right: -9px;
}

.tl-item.right::after {
  left: -9px;
}

.card {
  background: var(--card-bg);
  padding: 14px;
  border-radius: 12px;
  box-shadow: 0 6px 24px rgba(255, 77, 109, 0.12);
  display: inline-block;
  width: 100%;
  max-width: 340px;
  text-align: left;
  vertical-align: top;
  cursor: pointer;
}

.card-meta {
  margin: 0 0 8px;
  font-size: 0.85rem;
  color: #ff4d6d;
  font-weight: 600;
}

.card-title {
  margin: 0 0 6px;
  font-size: 1rem;
  color: #333;
}

.card-place {
  margin: 0 0 8px;
  font-size: 0.8rem;
  color: #888;
}

.card-cap {
  margin: 0 0 10px;
  font-size: 0.88rem;
  color: #666;
  line-height: 1.45;
}

.card img {
  width: 100%;
  border-radius: 10px;
  display: block;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.card-media {
  position: relative;
}

.card-media .video-cover-badge {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 0.75rem;
  pointer-events: none;
}

.card-badge {
  display: inline-flex;
  margin-bottom: 0.75rem;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  background: rgba(255, 77, 109, 0.12);
  color: #ff4d6d;
  font-size: 0.8rem;
  font-weight: 600;
}

.card img:hover {
  transform: scale(1.02);
}

.card-media:hover img {
  transform: scale(1.02);
}

.timeline-empty {
  text-align: center;
  color: #666;
  font-size: 0.95rem;
  padding: 1rem;
}

.timeline-empty code {
  font-size: 0.85em;
}

.timeline-empty a {
  color: var(--pink-deep);
}

@media (max-width: 700px) {
  .timeline::after {
    left: 18px;
    transform: none;
  }

  .tl-item,
  .tl-item.left,
  .tl-item.right {
    width: 100%;
    margin-left: 0;
    left: 0;
    text-align: left;
    padding-left: 48px;
    padding-right: 12px;
  }

  .tl-item.left::after,
  .tl-item.right::after {
    left: 11px;
    right: auto;
  }

  .card {
    max-width: none;
  }
}

/* —— 地图 —— */
.map-block {
  text-align: center;
  margin: 2rem auto;
  padding: 0 1rem 2rem;
}

.map-frame-wrap {
  max-width: 960px;
  margin: 0 auto;
  border-radius: 12px;
  /* overflow:hidden 已移除 —— 会裁断 Leaflet 瓦片缓冲区，导致部分区域空白 */
  box-shadow: 0 8px 28px rgba(255, 77, 109, 0.15);
  border: 3px solid #fff;
  position: relative;
  z-index: 0; /* 低于 modal(z-index:300)，防止 Leaflet 层叠到弹窗上方 */
}

.map-frame {
  display: block;
  width: 100%;
  height: 400px;
  border: 0;
  position: relative;
  border-radius: 9px;
  overflow: hidden; /* Leaflet 自身容器加 overflow:hidden 是安全的，Leaflet 以容器尺寸计算可见区域 */
}

/* —— 留言板 —— */
.guestbook-block {
  max-width: 680px;
  margin: 2rem auto 1rem;
  padding: 0 1.5rem;
}

.guestbook-block .section-heading {
  font-size: 1.1rem;
  color: var(--pink-deep);
  margin-bottom: 1rem;
  text-align: center;
}

.guestbook-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.gb-item {
  background: #fff8f9;
  border: 1px solid #f5d6de;
  border-radius: 10px;
  padding: 0.75rem 1rem;
}

.gb-header {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin-bottom: 0.35rem;
}

.gb-author {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--pink-deep);
}

.gb-time {
  font-size: 0.75rem;
  color: #aaa;
}

.gb-content {
  font-size: 0.9rem;
  line-height: 1.65;
  color: #444;
  white-space: pre-wrap;
  word-break: break-word;
}

.gb-empty {
  text-align: center;
  color: #bbb;
  font-size: 0.9rem;
  padding: 1rem 0;
}

.guestbook-form {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  background: #fff;
  border: 1px solid #f0dde2;
  border-radius: 10px;
  padding: 1rem;
}

.guestbook-form input[type="text"],
.guestbook-form textarea {
  border: 1px solid #e8c8d0;
  border-radius: 7px;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  font-family: inherit;
  color: #333;
  outline: none;
  transition: border-color 0.2s;
  resize: vertical;
}

.guestbook-form input[type="text"]:focus,
.guestbook-form textarea:focus {
  border-color: var(--pink-deep);
}

.gb-form-actions {
  display: flex;
  justify-content: flex-end;
}

.gb-submit {
  background: var(--pink-deep);
  color: #fff;
  border: none;
  border-radius: 7px;
  padding: 0.45rem 1.2rem;
  font-size: 0.9rem;
  cursor: pointer;
  transition: opacity 0.15s;
}

.gb-submit:hover {
  opacity: 0.85;
}

/* —— 留言 —— */
.message-block {
  text-align: center;
  margin: 2rem auto 3rem;
  padding: 0 1.5rem;
  font-size: 1.05rem;
  line-height: 1.7;
  color: #444;
}

.message-body {
  color: var(--ink);
}

.message-body p {
  margin: 0.35rem 0;
}

.custom-message-body {
  margin-top: 1.5rem;
  color: #444;
}

.custom-message-body table {
  border-collapse: collapse;
  margin: 0 auto;
}

.custom-message-body table td,
.custom-message-body table th {
  border: 1px solid #ddd;
  padding: 0.4rem 0.8rem;
}

/* —— 页脚 —— */
.page-foot {
  text-align: center;
  padding: 1rem 1rem 2rem;
  font-size: 0.8rem;
  color: #999;
}

.page-foot a {
  color: var(--pink-deep);
  text-decoration: none;
}

.page-foot a:hover {
  text-decoration: underline;
}

.page-foot .dot {
  margin: 0 0.35rem;
}

/* —— 弹窗大图 —— */
.modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal[hidden] {
  display: none !important;
}

.modal-back {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  cursor: pointer;
}

.modal-box {
  position: relative;
  z-index: 1;
  max-width: min(92vw, 900px);
  width: 100%;
  text-align: center;
}

.modal-close {
  position: absolute;
  top: -40px;
  right: 0;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.35);
}

.modal-img {
  max-width: 100%;
  max-height: min(78vh, 720px);
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  cursor: zoom-in;
  transition: transform 0.1s ease;
  transform-origin: center center;
  user-select: none;
  -webkit-user-drag: none;
}

.modal-img.is-zoomed {
  cursor: grab;
}

.modal-img.is-dragging {
  cursor: grabbing;
  transition: none;
}

.modal-zoom-hint {
  position: absolute;
  bottom: -28px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.45);
  font-size: 0.75rem;
  white-space: nowrap;
  pointer-events: none;
}

.modal-cap {
  margin: 12px 0 0;
  color: #fff;
  font-size: 0.95rem;
  line-height: 1.5;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

.modal-counter {
  margin-top: 8px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.8rem;
}

.modal-video-play {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 3;
  border: none;
  border-radius: 999px;
  padding: 0.65rem 1.2rem;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 0.9rem;
  cursor: pointer;
}

.modal-video-play:hover {
  background: rgba(0, 0, 0, 0.88);
}

.modal-nav {
  position: absolute;
  top: 50%;
  width: 44px;
  height: 44px;
  border: none;
  background: rgba(0, 0, 0, 0.3);
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  border-radius: 50%;
  transform: translateY(-50%);
  z-index: 2;
  transition: background 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.modal-nav:hover {
  background: rgba(0, 0, 0, 0.6);
}

.modal-prev {
  left: 16px;
}

.modal-next {
  right: 16px;
}

#modal-prev,
#modal-next {
  position: absolute;
  top: 50%;
  width: 44px;
  height: 44px;
  border: none;
  background: rgba(0, 0, 0, 0.3);
  color: #fff;
  font-size: 24px;
  border-radius: 50%;
  transform: translateY(-50%);
  z-index: 2;
  cursor: pointer;
}

#modal-prev {
  left: 16px;
}

#modal-next {
  right: 16px;
}

.modal-strip {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.modal-thumb {
  border: 2px solid transparent;
  border-radius: 8px;
  padding: 0;
  background: transparent;
  cursor: pointer;
  overflow: hidden;
}

.modal-thumb img {
  width: 68px;
  height: 68px;
  object-fit: cover;
  display: block;
}

.modal-thumb.is-active {
  border-color: #ff4d6d;
}
