/* ┌────────────────────────────────────────────┐
 * │ 7.1  弹窗打开时锁定页面滚动                   │
 * └────────────────────────────────────────────┘ */

/* 锁定状态：禁止页面滚动 */
body.modal-open {
  overflow: hidden;
  /* 补偿滚动条宽度，防止内容跳动 */
  padding-right: var(--scrollbar-width, 0px);
  /* 防止 iOS Safari 弹性滚动穿透 */
  position: fixed;
  inset: 0;
  width: 100%;
  /* 保留当前滚动位置，由 JS 设置 */
  top: var(--scroll-top, 0px);
}

/* ┌────────────────────────────────────────────┐
 * │ 7.2  图片弹窗（亮色毛玻璃）                  │
 * └────────────────────────────────────────────┘ */

/* ── 弹窗遮罩层 ── */
.photo-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.35s ease,
    visibility 0.35s ease;
}

/* ── 弹窗激活状态 ── */
.photo-modal-overlay.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition:
    opacity 0.15s ease,
    visibility 0.15s ease;
}

/* ── 弹窗主体 ── */
.photo-modal {
  position: relative;
  display: flex;
  max-height: 88vh;
  background: transparent;
  border-radius: 20px;
  overflow: hidden;
  box-shadow:
    0 40px 80px rgba(0, 0, 0, 0.25),
    0 0 0 1px rgba(255, 255, 255, 0.1);
  transform: scale(0.92) translateY(30px);
  transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

.photo-modal-overlay.is-active .photo-modal {
  transform: scale(1) translateY(0);
}

/* ── 子元素淡入动画 ── */
.photo-modal__close,
.photo-modal__img-wrap,
.photo-modal__info {
  opacity: 0;
  transition: opacity 0.35s ease;
}

.photo-modal-overlay.is-active .photo-modal__close,
.photo-modal-overlay.is-active .photo-modal__img-wrap,
.photo-modal-overlay.is-active .photo-modal__info {
  opacity: 1;
}

/* ── 弹窗内容体 ── */
.photo-modal__body {
  display: flex;
  max-height: 88vh;
  flex: 1 1 100%;
  min-width: 0;
  width: 100%;
}

/* ── 关闭按钮 ── */
.photo-modal__close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 20;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition:
    transform 0.5s ease,
    background 0.3s ease;
}

.photo-modal__close:hover {
  background: rgba(0, 0, 0, 0.75);
  transform: rotate(90deg) scale(1.1);
}

.photo-modal__close:active {
  transform: rotate(90deg) scale(0.95);
}

/* ── 图片包裹层 ── */
.photo-modal__img-wrap {
  background: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  min-width: 0;
}

/* ── 图片本体 ── */
.photo-modal__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ── 信息面板（毛玻璃） ── */
.photo-modal__info {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 20px;
  overflow-y: auto;
  position: relative;
  z-index: 1;
  min-width: 0;
  background: rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-left: 1px solid rgba(255, 255, 255, 0.8);
  padding: 40px 32px;
}

/* ── 顶部高光线条 ── */
.photo-modal__info::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.8),
    transparent
  );
  pointer-events: none;
}

/* ── 标题 ── */
.photo-modal__title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  color: #1f2937;
  line-height: 1.3;
}

/* ── 描述 ── */
.photo-modal__desc {
  margin: 0;
  font-size: 14px;
  line-height: 1.8;
  color: #4b5563;
}

/* ── 标签区 ── */
.photo-modal__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

/* ── 单个标签 ── */
.photo-modal__tag {
  display: inline-block;
  font-size: 12px;
  color: #555;
  background: rgba(255, 255, 255, 0.5);
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid rgba(0, 0, 0, 0.05);
  white-space: nowrap;
}

/* ┌────────────────────────────────────────────┐
 * │ 7.3  图片弹窗布局变体                        │
 * └────────────────────────────────────────────┘ */

/* ── 布局 A：左右排布（横向图片） ── */
.photo-modal--landscape .photo-modal__body {
  flex-direction: row;
}

.photo-modal--landscape {
  width: min(88vw, 860px);
}

.photo-modal--landscape .photo-modal__img-wrap {
  flex: 1 1 62%;
  min-width: 0;
}

.photo-modal--landscape .photo-modal__info {
  flex: 1 1 38%;
  padding: 32px 24px;
}

/* ── 布局 B：上下排布（竖向图片） ── */
.photo-modal--portrait .photo-modal__body {
  flex-direction: column;
}

.photo-modal--portrait {
  width: clamp(280px, 70vw, 680px);
}

.photo-modal--portrait .photo-modal__img-wrap {
  width: 100%;
  max-height: 50vh;
}

.photo-modal--portrait .photo-modal__img {
  width: 100%;
  height: 100%;
  max-height: 50vh;
  object-fit: cover;
}

.photo-modal--portrait .photo-modal__info {
  padding: 24px 32px 28px;
  border-left: none;
  border-top: 1px solid rgba(255, 255, 255, 0.8);
}

/* ┌────────────────────────────────────────────┐
 * │ 图片弹窗：横向图片窄屏适配（≤640px）           │
 * └────────────────────────────────────────────┘ */
@media (max-width: 640px) {
  .photo-modal--landscape .photo-modal__body {
    flex-direction: column;
  }

  .photo-modal--landscape .photo-modal__img-wrap {
    max-height: 45vh;
  }

  .photo-modal--landscape .photo-modal__info {
    padding: 24px 20px;
    border-left: none;
    border-top: 1px solid rgba(255, 255, 255, 0.8);
  }
}
