﻿/* ==========================================================================
   media.css — 照片 / 视频在成品页与编辑器里的公共样式
   · .mm-video：图集里视频卡（封面 + 播放键 + 时长）
   · .site-lightbox__inner video：视频弹层
   · .fam*：亲子款「成长记录」
   · .seg / .baby / .thumb--video：编辑器
   ========================================================================== */

/* ---------------- 图集里的视频卡 ---------------- */
.mm-video {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  background: #000;
  overflow: hidden;
  line-height: 0;
}

.mm-video > img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.95);
}

.mm-play {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 34px;
  height: 34px;
  margin: -17px 0 0 -17px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(3px);
  transition: transform 0.3s ease, background 0.3s ease;
}

.mm-play::after {
  content: "";
  position: absolute;
  left: 54%;
  top: 50%;
  width: 0;
  height: 0;
  transform: translate(-50%, -50%);
  border-left: 9px solid #fff;
  border-top: 5.5px solid transparent;
  border-bottom: 5.5px solid transparent;
}

[data-video]:hover .mm-play,
[data-video]:focus-visible .mm-play {
  transform: scale(1.08);
  background: rgba(0, 0, 0, 0.68);
}

.mm-dur {
  position: absolute;
  right: 6px;
  bottom: 6px;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
  font-family: "SF Mono", Consolas, monospace;
  font-size: 9px;
  line-height: 1.5;
  letter-spacing: 0.04em;
}

[data-video] {
  cursor: pointer;
}

/* 视频没有真实比例时，用一个稳定的 16:9 兜底 */
.mm-video:not(:has(img)) {
  aspect-ratio: 16 / 9;
}

/* ---------------- 视频弹层 ---------------- */
.site-lightbox__inner video {
  display: block;
  max-width: min(92vw, 900px);
  max-height: 76vh;
  border-radius: 6px;
  background: #000;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}

.site-lightbox__inner video[hidden],
.site-lightbox__inner img[hidden] {
  display: none !important;
}

/* ---------------- 亲子款：成长记录 ---------------- */
.fam {
  padding: 44px 20px 8px;
  display: grid;
  gap: 10px;
  color: inherit;
}

.fam-kicker {
  font-size: 9px;
  letter-spacing: 0.3em;
  opacity: 0.55;
}

.fam-title {
  font-size: 1.42rem;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.fam-lead {
  font-size: 0.88rem;
  opacity: 0.66;
  margin-bottom: 8px;
}

.fam-group {
  margin-top: 18px;
}

.fam-group__head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid currentColor;
  margin-bottom: 14px;
}

.fam-group__title {
  font-size: 1rem;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.fam-group__sub {
  font-size: 10px;
  letter-spacing: 0.08em;
  opacity: 0.6;
}

.fam-group__count {
  margin-left: auto;
  font-size: 9px;
  letter-spacing: 0.16em;
  opacity: 0.5;
}

.fam-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.fam-item {
  position: relative;
  margin: 0;
  overflow: hidden;
  border-radius: 4px;
  background: rgba(128, 128, 128, 0.12);
  cursor: zoom-in;
}

.fam-item img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.fam-item figcaption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 10px 6px 4px;
  font-size: 9.5px;
  line-height: 1.4;
  color: #fff;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.62));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (min-width: 640px) {
  .fam {
    padding-inline: 40px;
    max-width: 920px;
    margin: 0 auto;
  }

  .fam-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
  }
}

/* ==========================================================================
   编辑器：模式切换 / 宝宝列表 / 媒体缩略图
   ========================================================================== */
.seg {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.5);
}

.seg__btn {
  padding: 8px 20px;
  border: 0;
  border-radius: 999px;
  background: none;
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--ink-mute);
  cursor: pointer;
  transition: background 0.25s ease, color 0.25s ease;
}

.seg__btn.is-active {
  background: var(--ink);
  color: var(--paper);
}

.family {
  margin-top: 16px;
  display: grid;
  gap: 14px;
}

.family[hidden],
.field--inline[hidden] {
  display: none !important;
}

.babies {
  display: grid;
  gap: 10px;
}

.baby {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: end;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.55);
}

.baby__no {
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--ink-mute);
  padding-bottom: 10px;
}

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

.field--tight {
  gap: 4px;
}

.field--tight .field__label {
  font-size: 10px;
}

.ghost-btn {
  justify-self: start;
  padding: 8px 14px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: none;
  font-size: 12.5px;
  color: var(--ink-soft);
  cursor: pointer;
}

.ghost-btn:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.link-btn--danger {
  color: #b4423a;
}

.field--inline {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.field--inline .field__label {
  margin: 0;
  white-space: nowrap;
}

.field--inline .input {
  max-width: 240px;
}

/* 媒体缩略图 */
.thumb--video .thumb__img {
  background: #000;
}

.thumb__play {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 26px;
  height: 26px;
  margin: -13px 0 0 -13px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.8);
  pointer-events: none;
}

.thumb__play::after {
  content: "";
  position: absolute;
  left: 54%;
  top: 50%;
  width: 0;
  height: 0;
  transform: translate(-50%, -50%);
  border-left: 7px solid #fff;
  border-top: 4.5px solid transparent;
  border-bottom: 4.5px solid transparent;
}

.thumb__dur {
  position: absolute;
  left: 5px;
  bottom: 5px;
  padding: 0 4px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
  font-size: 9px;
  line-height: 1.6;
  pointer-events: none;
}

.thumbs-empty {
  grid-column: 1 / -1;
  padding: 18px 0;
  font-size: 12.5px;
  color: var(--ink-mute);
  text-align: center;
}


/* ============================ 个人款：编辑器 ============================ */
.solo {
  margin-top: 16px;
  display: grid;
  gap: 14px;
}

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

.solo-top {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 12px;
  align-items: start;
}

.solo-avatar {
  position: relative;
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  border: 1px dashed var(--line);
  border-radius: 50%;
  overflow: hidden;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.5);
}

.solo-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.solo-avatar span {
  font-size: 18px;
  color: var(--ink-mute);
  display: grid;
  place-items: center;
  gap: 2px;
  line-height: 1;
}

.solo-avatar em {
  font-style: normal;
  font-size: 9px;
  letter-spacing: 0.1em;
}

.solo-top__fields {
  display: grid;
  gap: 10px;
}

.solo-block {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.45);
}

.solo-block__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.solo-list {
  display: grid;
  gap: 10px;
}

.solo-row {
  display: grid;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
}

.solo-row:first-child {
  border-top: 0;
  padding-top: 0;
}

.solo-row__head {
  display: grid;
  grid-template-columns: 130px 1fr auto;
  gap: 8px;
  align-items: center;
}

.solo-row__date {
  font-size: 12px;
}

.solo-wish-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
}

.solo-check {
  position: relative;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
}

.solo-check input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.solo-check span {
  width: 18px;
  height: 18px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
}

.solo-check input:checked + span {
  background: var(--ink);
  border-color: var(--ink);
}

.solo-wish-row.is-done input {
  opacity: 0.55;
  text-decoration: line-through;
}

.solo-wish-row.is-done .link-btn {
  opacity: 0.6;
}
