/* 唐乐遥 · 视频画廊 v2 — 暗色影院风 / ZCOOL XiaoWei / 明暗主题 / 播放器沿用 */

:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-2: #efece5;
  --fg: #22201d;
  --muted: #86817a;
  --line: #e6e1d8;
  --ac: #9a6b4f;
  --shadow: 0 6px 22px rgba(40, 36, 30, .08);
  --shadow-hover: 0 16px 40px rgba(40, 36, 30, .16);
}

html.dark {
  --bg: #0d0d10;
  --surface: #17181d;
  --surface-2: #1e2026;
  --fg: #eae7e1;
  --muted: #8f8b85;
  --line: #26272e;
  --ac: #c9a86a;
  --shadow: 0 6px 22px rgba(0, 0, 0, .35);
  --shadow-hover: 0 16px 40px rgba(0, 0, 0, .5);
}

* { box-sizing: border-box; }

body {
  margin: 0; background: var(--bg); color: var(--fg);
  font-family: "ZCOOL XiaoWei", "Songti SC", -apple-system, BlinkMacSystemFont,
               "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
               "Segoe UI", Roboto, sans-serif;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  transition: background .3s, color .3s;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
::selection { background: var(--ac); color: #fff; }

/* ---------- 明暗切换（固定右上） ---------- */

.mode-switch {
  position: fixed; top: 16px; right: 16px; z-index: 30;
  width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 50%;
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  color: var(--fg); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: border-color .2s, transform .2s;
}
.mode-switch:hover { border-color: var(--ac); transform: scale(1.06); }

/* ---------- Hero ---------- */

.hero {
  text-align: center;
  padding: clamp(52px, 11vh, 104px) 20px 6px;
  background:
    radial-gradient(720px 300px at 50% -60px, color-mix(in srgb, var(--ac) 13%, transparent), transparent 70%),
    var(--bg);
}
.hero-cap {
  margin: 0; font-size: 12px; letter-spacing: .5em;
  color: var(--muted); text-indent: .5em;
}
.hero-title {
  margin: 8px 0 6px;
  font-size: clamp(44px, 9vw, 82px);
  font-weight: 400; letter-spacing: .14em; line-height: 1.15;
  text-indent: .14em;
}
.hero-meta { margin: 0; font-size: 13.5px; color: var(--muted); }
.hero-meta b { color: var(--ac); font-weight: 600; }

.search-wrap { position: relative; max-width: 460px; margin: 26px auto 0; }
.s-ico {
  position: absolute; left: 15px; top: 50%; transform: translateY(-50%);
  color: var(--muted); pointer-events: none;
}
#search {
  width: 100%; padding: 12px 16px 12px 42px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  color: var(--fg); font-size: 14px; font-family: inherit; outline: none;
  transition: border-color .2s, box-shadow .2s;
}
#search:focus { border-color: var(--ac); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ac) 18%, transparent); }
#search::placeholder { color: var(--muted); }

/* ---------- 卡片网格（按年份分组） ---------- */

.container {
  max-width: 1200px; margin: 0 auto;
  padding: 10px 20px 60px;
  display: grid; gap: clamp(16px, 2.4vw, 24px);
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
}

.year-sep {
  grid-column: 1 / -1;
  position: sticky; top: 10px; z-index: 5;
  display: flex; align-items: center; gap: 14px;
  margin: 10px 0 -6px;
  pointer-events: none;
}
.year-sep span {
  font-size: 15px; letter-spacing: .2em; color: var(--fg);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 3px 16px;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.year-sep::after { content: ''; flex: 1; height: 1px; background: var(--line); }

.video-card {
  position: relative;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; overflow: hidden; cursor: pointer;
  transition: transform .35s cubic-bezier(.2, .7, .3, 1), box-shadow .35s, border-color .35s;
}
.video-card:hover {
  transform: translateY(-5px); border-color: var(--ac);
  box-shadow: var(--shadow-hover);
}

.thumb { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: var(--surface-2, var(--line)); }
.thumb img, .thumb video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; transition: transform .5s cubic-bezier(.2, .7, .3, 1);
}
.video-card:hover .thumb img, .video-card:hover .thumb video { transform: scale(1.05); }

.no-poster {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 46px; color: var(--ac);
  background: linear-gradient(135deg, var(--surface-2, var(--line)), var(--surface));
}

/* 标题与日期：叠在封面底部渐变上（海报风） */
.info {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  padding: 34px 14px 11px;
  background: linear-gradient(transparent, rgba(0, 0, 0, .78));
}
.v-title {
  margin: 0; font-size: 18px; font-weight: 400;
  letter-spacing: .06em; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: color .25s;
}
.video-card:hover .v-title { color: var(--ac); }
.v-date {
  margin: 0; flex: none; font-size: 11.5px;
  color: rgba(255, 255, 255, .72);
  font-variant-numeric: tabular-nums;
}

.play-icon {
  position: absolute; right: 12px; top: 12px;
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(0, 0, 0, .45); backdrop-filter: blur(4px);
  opacity: 0; transition: opacity .25s;
}
.play-icon::before {
  content: ''; position: absolute; left: 14px; top: 11px;
  border-left: 12px solid #fff; border-top: 7.5px solid transparent; border-bottom: 7.5px solid transparent;
}
.video-card:hover .play-icon, .video-card.previewing .play-icon { opacity: 1; }

/* ---------- 进场动画 ---------- */

.reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s ease, transform .6s cubic-bezier(.2, .7, .3, 1); }
.reveal.show { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* ============================================================
   弹窗播放器（沿用，交互不变）
   ============================================================ */

.modal {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(8, 8, 10, .92);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal[hidden] { display: none; }

.modal-box {
  width: min(1000px, 96vw); max-height: 94vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  position: relative;
  animation: pop .3s cubic-bezier(.2, .8, .3, 1);
}
@keyframes pop { from { opacity: 0; transform: scale(.96); } }

.m-meta {
  display: flex; justify-content: flex-end;
  font-size: 11.5px; color: var(--muted); padding: 10px 16px 14px;
  font-variant-numeric: tabular-nums;
}

/* ---------- 播放区 ---------- */

.vp { position: relative; background: #000; overflow: hidden; user-select: none; }
.vp.hidectl { cursor: none; }

#m-video { width: 100%; max-height: 64vh; display: block; background: #000; outline: none; }

.vp-bright {
  position: absolute; inset: 0; z-index: 1;
  background: #000; opacity: 0; pointer-events: none;
}

.vp-spin {
  position: absolute; inset: 0; z-index: 3;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.vp-spin[hidden] { display: none; }
.vp-spin i {
  width: 46px; height: 46px; display: block;
  border: 3px solid rgba(255, 255, 255, .25); border-top-color: #fff;
  border-radius: 50%; animation: vp-spin .9s linear infinite;
}
@keyframes vp-spin { to { transform: rotate(360deg); } }

.vp-center {
  position: absolute; inset: 0; z-index: 4;
  display: flex; align-items: center; justify-content: center;
  pointer-events: auto; cursor: pointer;
  opacity: 0; transition: opacity .25s;
}
.vp.paused .vp-center { opacity: 1; }
.vp.playing .vp-center { pointer-events: none; }
.vp-center svg {
  width: 58px; height: 58px; padding: 16px;
  border-radius: 50%; background: rgba(0, 0, 0, .5);
  color: #fff; box-sizing: content-box;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .4);
}

/* 双击涟漪 */
.vp-ripple {
  position: absolute; top: 50%; transform: translateY(-50%) scale(.6);
  padding: 12px 20px; border-radius: 999px;
  background: rgba(0, 0, 0, .55); color: #fff; font-size: 14px; letter-spacing: .1em;
  opacity: 0; pointer-events: none; z-index: 5; white-space: nowrap;
}
.vp-ripple.left { left: 7%; }
.vp-ripple.right { right: 7%; }
.vp-ripple.go { animation: ripple .6s ease; }
@keyframes ripple {
  0% { opacity: .95; transform: translateY(-50%) scale(.7); }
  100% { opacity: 0; transform: translateY(-50%) scale(1.15); }
}

/* HUD（倍速/亮度/音量提示） */
.vp-hud {
  position: absolute; top: 13%; left: 50%; transform: translateX(-50%);
  background: rgba(0, 0, 0, .58); color: #fff; font-size: 13px;
  padding: 7px 16px; border-radius: 999px;
  opacity: 0; transition: opacity .2s;
  pointer-events: none; z-index: 6; white-space: nowrap;
}
.vp-hud.on { opacity: 1; }

/* ---------- 控制层 ---------- */

.vp-ui {
  position: absolute; inset: 0; z-index: 7;
  display: flex; flex-direction: column; justify-content: space-between;
  opacity: 1; transition: opacity .25s;
}
.vp.hidectl .vp-ui { opacity: 0; pointer-events: none; }

.vp-grad.top { position: absolute; top: 0; left: 0; right: 0; height: 90px; background: linear-gradient(rgba(0, 0, 0, .55), transparent); pointer-events: none; }
.vp-grad.bottom { position: absolute; bottom: 0; left: 0; right: 0; height: 130px; background: linear-gradient(transparent, rgba(0, 0, 0, .75)); pointer-events: none; }

.vp-top {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 14px 6px;
}
.vp-vtitle {
  color: #fff; font-size: 17px; letter-spacing: .06em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.vp-bottom { position: relative; padding: 0 12px calc(10px + env(safe-area-inset-bottom)); }

.vp-seekrow { display: flex; align-items: center; gap: 10px; }
.vp-time {
  color: #fff; font-size: 12px; flex: none;
  font-variant-numeric: tabular-nums; text-shadow: 0 1px 2px rgba(0, 0, 0, .6);
}

.vp-seek {
  position: relative; flex: 1; height: 22px;
  cursor: pointer; display: flex; align-items: center; touch-action: none;
}
.vp-seek::before {
  content: ''; position: absolute; left: 0; right: 0; height: 4px;
  border-radius: 2px; background: rgba(255, 255, 255, .3);
  transition: height .15s;
}
.vp-seek:hover::before, .vp-seek.dragging::before { height: 6px; }
.vp-buf, .vp-fill { position: absolute; left: 0; height: 4px; border-radius: 2px; width: 0; transition: height .15s; }
.vp-seek:hover .vp-buf, .vp-seek:hover .vp-fill,
.vp-seek.dragging .vp-buf, .vp-seek.dragging .vp-fill { height: 6px; }
.vp-buf { background: rgba(255, 255, 255, .35); }
.vp-fill { background: var(--ac); }
.vp-knob {
  position: absolute; width: 13px; height: 13px; border-radius: 50%;
  background: var(--ac); transform: translateX(-50%) scale(0); transition: transform .15s;
}
.vp-seek:hover .vp-knob, .vp-seek.dragging .vp-knob { transform: translateX(-50%) scale(1); }

.vp-bubble {
  position: absolute; bottom: 24px; transform: translateX(-50%);
  background: rgba(0, 0, 0, .78); color: #fff; font-size: 12px;
  padding: 3px 9px; border-radius: 7px;
  opacity: 0; pointer-events: none;
  font-variant-numeric: tabular-nums; transition: opacity .15s;
}
.vp-bubble.on { opacity: 1; }

.vp-fnrow { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.vp-fnrow .sp { flex: 1; }
.vpb {
  border: 0; background: transparent; color: #fff; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 9px;
  transition: background .2s;
}
.vpb:hover { background: rgba(255, 255, 255, .16); }
.vp-play { background: var(--ac); width: 40px; height: 40px; border-radius: 50%; }
.vp-play:hover { background: var(--ac); }
.vp-play .i-pause { display: none; }
.vp.playing .vp-play .i-play { display: none; }
.vp.playing .vp-play .i-pause { display: block; }
.vpb.txt { width: auto; padding: 0 12px; font-size: 13px; }
#m-loop.on { color: var(--ac); }
#vp-vol.muted .i-vol { display: none; }
#vp-vol:not(.muted) .i-mute { display: none; }

/* ---------- 全屏铺满 ---------- */

.vp:fullscreen { border-radius: 0; }
.vp:-webkit-full-screen { border-radius: 0; }
.vp:fullscreen #m-video,
.vp:-webkit-full-screen #m-video { max-height: 100vh; height: 100vh; }

/* ---------- 页脚 ---------- */

.foot {
  text-align: center; color: var(--muted); font-size: 12.5px;
  padding: 0 20px calc(28px + env(safe-area-inset-bottom));
}
.foot a:hover { color: var(--ac); }

/* ---------- 小屏 ---------- */

@media (max-width: 640px) {
  .container { grid-template-columns: repeat(auto-fill, minmax(46vw, 1fr)); gap: 12px; padding: 6px 14px 44px; }
  .v-title { font-size: 15.5px; }
  .info { padding: 26px 10px 8px; }
  .hero { padding-top: 46px; }
  .hero-title { font-size: clamp(38px, 11vw, 60px); }
  .hero-cap { letter-spacing: .35em; }
  .mode-switch { top: 12px; right: 12px; }
  .modal { padding: 0; }
  .modal-box { width: 100vw; height: 100dvh; max-height: none; border: 0; border-radius: 0; display: flex; flex-direction: column; justify-content: center; overflow: hidden; }
  #m-video { max-height: 100dvh; }
  .vpb { width: 32px; height: 32px; }
  .vpb.txt { padding: 0 9px; font-size: 12px; }
  .m-meta { padding: 8px 16px calc(10px + env(safe-area-inset-bottom)); }
}

/* 焦点陷阱：容器本身获得焦点时不画轮廓 */
.modal:focus { outline: none; }
