/*
Theme Name: WPS Video Theme
Theme URI: https://example.com/wps-video-theme
Author: Your Name
Author URI: https://example.com
Description: 轻量级、响应式 WordPress 主题，专为 WP-Script 插件导入的视频内容设计，提供类似 TikTok 的竖屏滑动体验。
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: wps-video-theme
Tags: custom-background, custom-logo, custom-menu, featured-images, full-width-template, theme-options, translation-ready, video, one-column, responsive-layout
*/

/* ==========================================================================
   CSS 变量 - 便于统一修改主题色与间距
   ========================================================================== */
:root {
  --wps-primary: #fe2c55;
  --wps-primary-dark: #d91a45;
  --wps-text: #161823;
  --wps-text-muted: #8a8a8a;
  --wps-bg: #0f0f0f;
  --wps-card-bg: #1a1a1a;
  --wps-overlay: rgba(0, 0, 0, 0.5);
  --wps-radius: 8px;
  --wps-spacing: 1rem;
}

/* ==========================================================================
   基础重置与排版
   ========================================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, sans-serif;
  color: var(--wps-text);
  background: var(--wps-bg);
  line-height: 1.5;
  overflow-x: hidden;
}

a {
  color: var(--wps-primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

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

/* ==========================================================================
   首页全屏竖屏 Swiper 容器
   ========================================================================== */
.wps-swiper-wrap {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  z-index: 1;
  background: var(--wps-bg);
}

.wps-swiper {
  width: 100%;
  height: 100%;
}

.wps-swiper .swiper-slide {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  overflow: hidden;
}

/* 每个视频 slide 内部结构 */
.wps-video-slide {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 420px;
  margin: 0 auto;
  background: #000;
}

/* 缩略图占位 / 背景 */
.wps-video-thumb {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
}

.wps-video-thumb.is-hidden {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.wps-video-thumb-placeholder {
  width: 100%;
  height: 100%;
  background: var(--wps-card-bg);
  min-height: 100%;
}

/* iframe 播放器容器 */
.wps-video-embed-wrap {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  display: none;
  background: #000;
}

.wps-video-embed-wrap.is-visible {
  display: block;
}

.wps-video-embed-wrap iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
  object-fit: cover;
}

/* 播放按钮遮罩 */
.wps-play-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--wps-overlay);
  cursor: pointer;
  transition: opacity 0.3s ease;
}

.wps-play-overlay.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.wps-play-btn {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--wps-primary);
  border: 4px solid rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 2rem;
  padding-left: 6px;
  box-shadow: 0 4px 20px rgba(254, 44, 85, 0.5);
  transition: transform 0.2s ease, background 0.2s ease;
}

.wps-play-overlay:hover .wps-play-btn {
  transform: scale(1.08);
  background: var(--wps-primary-dark);
}

/* 视频元信息叠加层 */
.wps-video-meta {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 4;
  padding: 60px 16px 24px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
  color: #fff;
  pointer-events: none;
}

.wps-video-meta .wps-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 6px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.wps-video-meta .wps-stats {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.85);
}

.wps-video-meta .wps-stats span {
  margin-right: 12px;
}

/* ==========================================================================
   单篇视频模板 single-videos.php
   ========================================================================== */
.wps-single-wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: var(--wps-spacing);
  padding-top: 2rem;
}

.wps-single-player {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  background: #000;
  border-radius: var(--wps-radius);
  margin-bottom: 1.5rem;
}

.wps-single-player iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.wps-single-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
  color: #fff;
}

.wps-single-meta {
  font-size: 0.9rem;
  color: var(--wps-text-muted);
  margin-bottom: 1rem;
}

.wps-single-content {
  color: rgba(255, 255, 255, 0.9);
  line-height: 1.6;
}

.wps-single-content p {
  margin: 0 0 1rem;
}

.wps-taxonomy-links {
  margin-top: 1rem;
}

.wps-taxonomy-links a {
  display: inline-block;
  margin-right: 8px;
  margin-bottom: 8px;
  padding: 4px 12px;
  background: var(--wps-card-bg);
  border-radius: 20px;
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.9);
}

.wps-taxonomy-links a:hover {
  background: var(--wps-primary);
  color: #fff;
  text-decoration: none;
}

/* ==========================================================================
   归档页网格 archive-videos.php / taxonomy.php
   ========================================================================== */
.wps-archive-wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--wps-spacing);
  padding-top: 2rem;
}

.wps-archive-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 1.5rem;
  color: #fff;
}

.wps-video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

@media (min-width: 600px) {
  .wps-video-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
  }
}

.wps-video-card {
  display: block;
  position: relative;
  border-radius: var(--wps-radius);
  overflow: hidden;
  aspect-ratio: 9 / 16;
  background: var(--wps-card-bg);
}

.wps-video-card:hover {
  text-decoration: none;
}

.wps-video-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.wps-video-card .wps-card-duration {
  position: absolute;
  bottom: 6px;
  right: 6px;
  font-size: 0.75rem;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  padding: 2px 6px;
  border-radius: 4px;
}

.wps-video-card .wps-card-title {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 24px 8px 8px;
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ==========================================================================
   站点头部导航（若使用菜单）
   ========================================================================== */
.wps-site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 12px 16px;
  background: rgba(15, 15, 15, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.wps-site-header .wps-nav {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.wps-site-header .wps-menu {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 1.5rem;
}

.wps-site-header .wps-menu a {
  color: rgba(255, 255, 255, 0.9);
  font-weight: 500;
}

.wps-site-header .wps-menu a:hover {
  color: var(--wps-primary);
  text-decoration: none;
}

.wps-site-header .wps-site-name {
  font-weight: 700;
  font-size: 1.125rem;
  color: #fff;
}

.wps-site-header .wps-site-name:hover {
  color: var(--wps-primary);
  text-decoration: none;
}

/* 首页全屏时给导航留出空间（可选：首页可隐藏导航） */
body.wps-front-page .wps-swiper-wrap {
  top: 0;
}

/* ==========================================================================
   页脚
   ========================================================================== */
.wps-site-footer {
  padding: 2rem var(--wps-spacing);
  text-align: center;
  color: var(--wps-text-muted);
  font-size: 0.875rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.wps-site-footer a {
  color: rgba(255, 255, 255, 0.7);
}

/* 首页全屏时隐藏页脚 */
body.wps-front-page .wps-site-footer {
  display: none;
}

/* 分页导航 */
.wps-archive-wrap .nav-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 2rem;
  padding: 1rem 0;
}

.wps-archive-wrap .nav-links a,
.wps-archive-wrap .nav-links .current {
  padding: 8px 14px;
  background: var(--wps-card-bg);
  border-radius: var(--wps-radius);
  color: rgba(255, 255, 255, 0.9);
  font-weight: 500;
}

.wps-archive-wrap .nav-links a:hover {
  background: var(--wps-primary);
  color: #fff;
  text-decoration: none;
}

.wps-archive-wrap .nav-links .current {
  background: var(--wps-primary);
  color: #fff;
}
