/*
Theme Name: Cocoon Child Theme
Description: Cocoonテーマの子テーマ。WP User Frontend用にアイキャッチ画像が無い場合に最初の投稿画像を表示する機能を追加。
Version: 1.0.0
Author: Your Name
Template: cocoon-master
*/

/* リセットCSS */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #fff;
}

/* サイト構造 */
.site {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ヘッダー */
.site-header {
    background-color: #fff;
    border-bottom: 1px solid #eee;
    padding: 20px 0;
    margin-bottom: 30px;
}

.site-branding {
    text-align: center;
    margin-bottom: 20px;
}

.site-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.site-title a {
    color: #333;
    text-decoration: none;
}

.site-title a:hover {
    color: #0073aa;
}

.site-description {
    color: #666;
    font-size: 1.1rem;
}

/* ナビゲーション */
.main-navigation {
    text-align: center;
}

.main-navigation ul {
    list-style: none;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
}

.main-navigation li {
    margin: 0 15px;
}

.main-navigation a {
    color: #333;
    text-decoration: none;
    font-weight: 500;
    padding: 10px 15px;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.main-navigation a:hover {
    background-color: #f0f0f0;
    color: #0073aa;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 10px;
}

/* コンテンツエリア */
.site-content {
    margin-bottom: 50px;
}

/* 投稿一覧 */
.posts-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 50px;
}

.post-item {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.post-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
}

/* アイキャッチ画像のスタイル */
.post-thumbnail {
    width: 100%;
    height: 200px;
    overflow: hidden;
    position: relative;
}

.post-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.post-item:hover .post-thumbnail img {
    transform: scale(1.05);
}

/* フォールバック画像のスタイル */
.wpuf-fallback-image {
    opacity: 0.9;
}

.wpuf-default-image {
    opacity: 0.7;
    background-color: #f8f9fa;
}

/* Cocoonテーマ用の追加スタイル */
.wpuf-processing {
    position: relative;
}

.wpuf-processing::after {
    content: "読み込み中...";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 5px 10px;
    border-radius: 3px;
    font-size: 12px;
    z-index: 10;
}

.wpuf-replaced {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* デバッグ用スタイル */
.wpuf-debug-info {
    border: 2px solid #ff6b6b;
    background: #ffe0e0;
    padding: 10px;
    margin: 10px 0;
    border-radius: 5px;
}

.wpuf-debug-info h4 {
    color: #d63031;
    margin: 0 0 10px 0;
}

.wpuf-debug-info p {
    margin: 5px 0;
    font-size: 14px;
}

/* WP Show Posts専用スタイル */
.wpuf-wpsp-processing {
    position: relative;
    min-height: 150px;
}

.wpuf-wpsp-processing::after {
    content: "WP Show Posts: 読み込み中...";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,115,170,0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    z-index: 10;
    white-space: nowrap;
}

.wpuf-wpsp-replaced {
    animation: wpspFadeIn 0.4s ease-in;
}

@keyframes wpspFadeIn {
    from { 
        opacity: 0; 
        transform: scale(0.95);
    }
    to { 
        opacity: 1; 
        transform: scale(1);
    }
}

/* WP Show Postsの画像コンテナ用スタイル */
.wpsp-post-thumbnail,
.wpsp-thumbnail,
.wpsp-post-image,
.wpsp-card-thumbnail {
    overflow: hidden;
    border-radius: 4px;
}

.wpsp-post-thumbnail img,
.wpsp-thumbnail img,
.wpsp-post-image img,
.wpsp-card-thumbnail img {
    width: 100%;
    height: auto;
    transition: transform 0.3s ease;
}

.wpsp-post-thumbnail:hover img,
.wpsp-thumbnail:hover img,
.wpsp-post-image:hover img,
.wpsp-card-thumbnail:hover img {
    transform: scale(1.05);
}

/* 投稿内容 */
.post-content {
    padding: 20px;
}

.post-title {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 10px;
    line-height: 1.4;
}

.post-title a {
    color: #333;
    text-decoration: none;
}

.post-title a:hover {
    color: #0073aa;
}

.post-excerpt {
    color: #666;
    margin-bottom: 15px;
    line-height: 1.6;
}

.post-meta {
    font-size: 0.9rem;
    color: #999;
    border-top: 1px solid #eee;
    padding-top: 15px;
}

.post-date {
    margin-right: 15px;
}

.post-author {
    margin-right: 15px;
}

/* 単一投稿ページ */
.single-post {
    max-width: 800px;
    margin: 0 auto;
}

.single-post .post-thumbnail {
    height: 400px;
    margin-bottom: 30px;
}

.single-post .post-content {
    padding: 0;
}

.single-post .post-title {
    font-size: 2rem;
    margin-bottom: 20px;
}

.single-post .post-meta {
    margin-bottom: 30px;
    padding-bottom: 20px;
}

/* WP User Frontendフォームのスタイル */
.wpuf-form {
    max-width: 600px;
    margin: 0 auto;
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.wpuf-fields {
    margin-bottom: 20px;
}

.wpuf-fields label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
    color: #333;
}

.wpuf-fields input[type="text"],
.wpuf-fields input[type="email"],
.wpuf-fields input[type="url"],
.wpuf-fields textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.wpuf-fields input:focus,
.wpuf-fields textarea:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 2px rgba(0,115,170,0.1);
}

.wpuf-featured-image-desc {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
    font-style: italic;
}

/* ボタン */
.wpuf-submit {
    background-color: #0073aa;
    color: #fff;
    padding: 12px 30px;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.wpuf-submit:hover {
    background-color: #005a87;
}

/* レスポンシブデザイン */
@media (max-width: 768px) {
    .site {
        padding: 0 15px;
    }
    
    .site-title {
        font-size: 2rem;
    }
    
    .main-navigation ul {
        flex-direction: column;
        align-items: center;
    }
    
    .main-navigation li {
        margin: 5px 0;
    }
    
    .menu-toggle {
        display: block;
    }
    
    .posts-list {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .single-post .post-thumbnail {
        height: 250px;
    }
    
    .single-post .post-title {
        font-size: 1.5rem;
    }
    
    .wpuf-form {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .site-title {
        font-size: 1.5rem;
    }
    
    .post-thumbnail {
        height: 150px;
    }
    
    .single-post .post-thumbnail {
        height: 200px;
    }
    
    .post-content {
        padding: 15px;
    }
}

/* ユーティリティクラス */
.text-center {
    text-align: center;
}

.mb-20 {
    margin-bottom: 20px;
}

.mb-30 {
    margin-bottom: 30px;
}

.hidden {
    display: none;
}

.screen-reader-text {
    clip: rect(1px, 1px, 1px, 1px);
    position: absolute !important;
    height: 1px;
    width: 1px;
    overflow: hidden;
}