﻿/*
Theme Name: ClipCollect Theme
Theme URI: 
Author: AI Engineer
Author URI: 
Description: 動画キュレーションメディア用テーマ。サムネイル自動取得、ランキング機能などを搭載。
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: clip-collect
Tags: custom-background, custom-colors, custom-menu, featured-images, threaded-comments, translation-ready
*/

:root {
    --primary-color: #ff0033;
    /* アングラ感ネオンレッド */
    --primary-hover: #ff3366;
    --bg-color: #0a0a0a;
    /* 完全なダーク背景 */
    --card-bg: #1a1a1a;
    /* 少し明るい黒 */
    --text-main: #f5f5f5;
    /* 白に近いグレー */
    --text-muted: #888888;
    --header-bg: #000000;
    --border-color: #333333;
    --radius: 8px;
    /* 少し尖らせてアングラ感を */
    --shadow-sm: 0 4px 6px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 10px 20px rgba(0, 0, 0, 0.8);
    --transition: all 0.3s ease;
}

body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
}

/* =========================================
 * ヘッダー・ナビゲーション・検索
 * ========================================= */
.site-header {
    background: var(--header-bg);
    color: #fff;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.site-header a {
    color: #fff;
    text-decoration: none;
}

.site-title {
    margin: 0;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: 1px;
}

.site-description {
    margin: 5px 0 0;
    font-size: 13px;
    color: #a4b0be;
}

.header-search-wrap {
    display: flex;
    align-items: center;
}

/* 検索フォーム */
.header-search {
    display: flex;
}

.search-form {
    display: flex;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 30px;
    padding: 5px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.search-field {
    background: transparent;
    border: none;
    color: #fff;
    padding: 8px 15px;
    outline: none;
    width: 200px;
    font-size: 14px;
}

.search-field::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.search-submit {
    background: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 20px;
    padding: 8px 20px;
    cursor: pointer;
    font-weight: bold;
    transition: var(--transition);
}

.search-submit:hover {
    background: var(--primary-hover);
}

/* スマホ用メニューボタン（PCでは隠す） */
.menu-toggle {
    display: none;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    padding: 5px 10px;
}

/* =========================================
 * メインレイアウト
 * ========================================= */
.site-content {
    display: flex;
    flex-wrap: wrap;
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
    gap: 30px;
}

.site-main {
    flex: 1;
    min-width: 0;
}

.widget-area {
    width: 320px;
}

.page-title {
    font-size: 24px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 10px;
    display: inline-block;
}

.page-title span {
    color: var(--primary-color);
}

/* =========================================
 * 動画グリッド・カードデザイン
 * ========================================= */
.video-grid {
    display: grid;
    /* PC表示時に横3列固定（gap込みで3等分） */
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    width: 100%;
}

.video-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    position: relative;
}

.video-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-md);
}

.video-card a {
    text-decoration: none;
    color: inherit;
    display: block;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.video-thumbnail {
    position: relative;
    overflow: hidden;
    background: #000;
}

.video-thumbnail img {
    width: 100%;
    height: auto;
    display: block;
    aspect-ratio: 16/9;
    object-fit: cover;
    transition: transform 0.5s ease;
    opacity: 0.9;
}

.video-card:hover .video-thumbnail img {
    transform: scale(1.05);
    opacity: 1;
}

.entry-header {
    padding: 15px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.video-title {
    font-size: 15px;
    font-weight: 700;
    margin: 0 0 10px 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* メタ情報（日付・タグ） */
.video-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
    padding-top: 10px;
    margin-top: auto;
}

.video-date {
    display: flex;
    align-items: center;
    gap: 5px;
}

.video-tags a {
    background: var(--bg-color);
    color: var(--primary-color);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 5px;
    transition: var(--transition);
}

.video-tags a:hover {
    background: var(--primary-color);
    color: #fff;
}

/* =========================================
 * ページネーション
 * ========================================= */
.pagination {
    grid-column: 1 / -1;
    text-align: center;
    margin-top: 40px;
    padding: 20px 0;
}

.pagination .page-numbers {
    display: inline-block;
    padding: 8px 16px;
    margin: 0 4px;
    background: var(--card-bg);
    color: var(--text-main);
    border-radius: 8px;
    text-decoration: none;
    font-weight: bold;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.pagination .page-numbers:hover,
.pagination .page-numbers.current {
    background: var(--primary-color);
    color: #fff;
    transform: translateY(-2px);
}

/* =========================================
 * シングルページ (詳細)
 * ========================================= */
.single-video-content {
    background: var(--card-bg);
    padding: 30px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    width: 100%;
    margin-bottom: 30px;
}

.single-thumbnail img {
    width: 100%;
    max-width: 800px;
    height: auto;
    border-radius: 8px;
    display: block;
    margin: 0 auto;
}

.external-link-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: var(--primary-color);
    color: #fff;
    padding: 15px 40px;
    font-size: 18px;
    font-weight: bold;
    text-decoration: none;
    border-radius: 30px;
    margin-top: 30px;
    transition: var(--transition);
    box-shadow: 0 5px 15px rgba(255, 71, 87, 0.4);
}

.external-link-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(255, 71, 87, 0.6);
}

/* =========================================
 * ランキングウィジェット / サイドバー
 * ========================================= */
.ranking-widget-area {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 25px;
    box-shadow: var(--shadow-sm);
}

.widget-title {
    font-size: 18px;
    margin-top: 0;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.widget-title::before {
    content: '\f080';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    color: var(--primary-color);
}

.ranking-tabs {
    display: flex;
    margin-bottom: 20px;
    background: var(--bg-color);
    border-radius: 8px;
    padding: 5px;
}

.ranking-tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    padding: 8px 5px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    border-radius: 6px;
    transition: var(--transition);
}

.ranking-tab-btn:hover {
    color: var(--text-main);
}

.ranking-tab-btn.active {
    background: var(--card-bg);
    color: var(--primary-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.ranking-tab-content {
    display: none;
    animation: fadeIn 0.3s;
}

.ranking-tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ranking-list {
    list-style: none;
    padding: 0;
    margin: 0;
    counter-reset: ranking-counter;
}

.ranking-list li {
    margin-bottom: 15px;
    position: relative;
    padding-left: 35px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.ranking-list li:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.ranking-list li::before {
    counter-increment: ranking-counter;
    content: counter(ranking-counter);
    position: absolute;
    left: 0;
    top: 2px;
    width: 24px;
    height: 24px;
    background: var(--text-muted);
    color: #fff;
    border-radius: 50%;
    text-align: center;
    line-height: 24px;
    font-size: 12px;
    font-weight: bold;
}

.ranking-list li:nth-child(1)::before {
    background: #ffcc00;
    /* よりギラついたゴールド */
    color: #333;
    box-shadow: 0 0 10px rgba(255, 204, 0, 0.8);
}

/* Silver */
.ranking-list li:nth-child(2)::before {
    background: #cccccc;
    color: #222;
    box-shadow: 0 0 10px rgba(204, 204, 204, 0.5);
}

/* Bronze */
.ranking-list li:nth-child(3)::before {
    background: #cc6633;
    color: #fff;
    box-shadow: 0 0 10px rgba(204, 102, 51, 0.5);
}

.ranking-list a {
    text-decoration: none;
    color: var(--text-main);
    display: block;
    line-height: 1.4;
    transition: var(--transition);
}

.ranking-list a:hover {
    color: var(--primary-color);
}

.ranking-item-title {
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 5px;
}

.ranking-item-views {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 5px;
}

.ranking-item-views::before {
    content: '\f06e';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
}

.no-ranking-data {
    color: var(--text-muted);
    font-size: 14px;
    text-align: center;
    padding: 30px 0;
    background: var(--bg-color);
    border-radius: 8px;
}

/* =========================================
 * フッター
 * ========================================= */
.site-footer {
    background: #1e272e;
    color: #808e9b;
    text-align: center;
    padding: 30px 20px;
    margin-top: 60px;
    font-size: 14px;
}

/* =========================================
 * スマホ用レスポンシブ
 * ========================================= */
@media (max-width: 768px) {
    .site-header {
        flex-wrap: wrap;
    }

    /* スマホ時は検索部分を隠し、ボタンでトグル式にする */
    .menu-toggle {
        display: block;
    }

    .menu-toggle-icon::before {
        content: '\f002';
        /* 検索アイコン */
        font-family: 'Font Awesome 6 Free';
        font-weight: 900;
    }

    .header-search {
        display: none;
        width: 100%;
        margin-top: 15px;
        order: 3;
    }

    .header-search-wrap.toggled {
        flex-wrap: wrap;
        width: 100%;
    }

    .header-search-wrap.toggled .header-search {
        display: flex;
        animation: fadeIn 0.3s;
    }

    .search-form {
        width: 100%;
    }

    .search-field {
        width: 100%;
    }

    .site-content {
        flex-direction: column;
        margin-top: 20px;
    }

    .widget-area {
        width: 100%;
        margin-top: 10px;
    }

    .video-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 15px;
    }

    .video-title {
        font-size: 14px;
    }

    .video-meta {
        font-size: 11px;
        flex-wrap: wrap;
        gap: 5px;
    }
}

/* =========================================
 * 記事詳細（シングルページ）hvideos風拡張
 * ========================================= */
.single-post-wrapper {
    background: var(--card-bg);
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 30px;
}

.article-header {
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
}

.article-header .entry-title {
    font-size: 22px;
    margin: 0 0 10px 0;
    color: #fff;
    line-height: 1.4;
}

.video-meta-top {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.video-meta-top strong {
    color: var(--text-main);
}

.video-tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 12px;
}

.video-tags-list a {
    background: #2a2a2a;
    color: var(--primary-color);
    padding: 4px 10px;
    border-radius: 4px;
    border: 1px solid #444;
    transition: var(--transition);
}

.video-tags-list a:hover {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

/* プレイヤーダミーエリア */
.player-container {
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}

.player-play-btn {
    font-size: 60px;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: 0.3s;
}

.player-play-btn:hover {
    color: var(--primary-color);
    transform: scale(1.1);
}

.post-description {
    font-size: 14px;
    color: #ddd;
    line-height: 1.8;
    padding: 10px 0;
}

/* 関連動画タブ */
.tab-menu {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0 0 20px 0;
    border-bottom: 2px solid var(--border-color);
}

.tab-menu li {
    padding: 10px 25px;
    background: #111;
    color: var(--text-muted);
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
    border-top-left-radius: 6px;
    border-top-right-radius: 6px;
    margin-right: 5px;
    transition: var(--transition);
}

.tab-menu li.active {
    background: var(--primary-color);
    color: #fff;
}

.related-video-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
}

.related-card {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
    transition: var(--transition);
}

.related-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.8);
}

.related-card a {
    text-decoration: none;
    color: inherit;
    display: block;
}

.related-thumb {
    width: 100%;
    aspect-ratio: 16/9;
    background: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.related-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.8;
    transition: var(--transition);
}

.related-card:hover .related-thumb img {
    opacity: 1;
    transform: scale(1.05);
}

.related-info {
    padding: 8px;
}

.related-title {
    font-size: 12px;
    font-weight: bold;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 5px;
    line-height: 1.3;
}

.related-meta {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
}

@media (max-width: 900px) {
    .related-video-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .related-video-grid {
        grid-template-columns: 1fr;
    }
}


/* 追加: サイドバーランキングのサムネイル調整 (修正版) */
.ranking-widget-area .ranking-list li {
    padding-left: 0;
    padding-bottom: 15px;
    margin-bottom: 15px;
    border-bottom: 1px dashed var(--border-color);
    position: relative;
    display: block;
    /* li自体はブロック */
}

.ranking-widget-area .ranking-item-link {
    text-decoration: none;
    color: var(--text-main);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    line-height: 1.4;
    transition: var(--transition);
}

.ranking-widget-area .ranking-item-link:hover {
    color: var(--primary-color);
}

.ranking-widget-area .ranking-item-thumb {
    width: 100px;
    height: 56px;
    flex-shrink: 0;
    border-radius: 4px;
    overflow: hidden;
    background: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.ranking-widget-area .ranking-item-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ranking-widget-area .ranking-item-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 56px;
}

.ranking-widget-area .ranking-item-title {
    font-weight: 700;
    font-size: 13px;
    margin-bottom: 5px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--text-main);
}

.ranking-widget-area .ranking-item-link:hover .ranking-item-title {
    color: var(--primary-color);
}

.ranking-widget-area .ranking-item-views {
    font-size: 11px;
    color: var(--text-muted);
}

/* サムネイル追加に伴うランキング順位バッジの位置調整 */
.ranking-widget-area .ranking-list li::before {
    top: -5px;
    left: -5px;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
    font-size: 11px;
    width: 20px;
    height: 20px;
    line-height: 20px;
}