/*
Theme Name: Cocoon Child
Theme URI: https://example.com/cocoon-child
Description: Child theme for Cocoon with Asagi color scheme
Author: Your Name
Author URI: https://example.com
Template: cocoon-master
Version: 1.0.0
Text Domain: cocoon-child
*/

/* Import parent theme styles */
@import url("../cocoon-master/style.css");

/* Asagi Color Scheme */
:root {
    --asagi-color: #33a6b8;
    --asagi-light: #5bbdd0;
    --asagi-dark: #2a8a9a;
    --asagi-bg: #f0f7f8;
}

/* Primary color overrides */
a {
    color: var(--asagi-color);
}

a:hover {
    color: var(--asagi-dark);
}

/* Header styling */
.header {
    background-color: var(--asagi-color);
}

.header a {
    color: #fff;
}

/* PCビューでのメインコンテンツとサイドバーのレイアウト修正 */
@media (min-width: 769px) {
    .content-in {
        display: flex;
        gap: 30px;
        align-items: flex-start;
    }
    
    .main {
        flex: 1;
        width: calc(100% - 330px);
        min-width: 0;
    }
    
    .sidebar {
        width: 300px;
        flex-shrink: 0;
    }
    
    /* Cocoonテーマのデフォルトレイアウトを上書き */
    .content-in.wrap {
        display: flex !important;
        flex-direction: row !important;
    }
    
    .main.nwa {
        width: auto !important;
        flex: 1 !important;
    }
    
    .sidebar.nwa {
        width: 300px !important;
        margin-left: 30px !important;
    }
}

/* サイドバーのタグクラウド配色修正 */
.widget-tags .tagcloud a {
    background: #f8f9fa !important;
    color: #495057 !important;
    border: 1px solid #dee2e6 !important;
    padding: 4px 10px !important;
    border-radius: 15px !important;
    text-decoration: none !important;
    transition: all 0.3s !important;
    display: inline-block !important;
    margin: 3px !important;
    font-weight: 500 !important;
}

.widget-tags .tagcloud a:hover {
    background: var(--asagi-color) !important;
    color: #fff !important;
    border-color: var(--asagi-color) !important;
    transform: translateY(-1px) !important;
}

/* サイドバーのカテゴリ別記事数デザイン改善 - より強力な指定 */
.sidebar .widget .category-stats,
.widget-categories .category-stats,
ul.category-stats {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

.sidebar .widget .category-stats li,
.widget-categories .category-stats li,
ul.category-stats li {
    margin-bottom: 8px !important;
}

.sidebar .widget .category-stats a,
.widget-categories .category-stats a,
ul.category-stats a {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    background: #f8f9fa !important;
    color: #495057 !important;
    border: 1px solid #dee2e6 !important;
    text-decoration: none !important;
    padding: 8px 12px !important;
    border-radius: 15px !important;
    transition: all 0.3s !important;
    font-weight: 500 !important;
    box-shadow: none !important;
}

.sidebar .widget .category-stats a:hover,
.widget-categories .category-stats a:hover,
ul.category-stats a:hover {
    background: var(--asagi-color) !important;
    color: #fff !important;
    border-color: var(--asagi-color) !important;
    transform: translateY(-1px) !important;
}

.sidebar .widget .count,
.widget-categories .count,
ul.category-stats .count {
    background: #6c757d !important;
    color: #fff !important;
    padding: 2px 6px !important;
    border-radius: 10px !important;
    font-size: 0.8em !important;
    font-weight: bold !important;
    min-width: 18px !important;
    text-align: center !important;
}

.sidebar .widget .category-stats a:hover .count,
.widget-categories .category-stats a:hover .count,
ul.category-stats a:hover .count {
    background: rgba(255, 255, 255, 0.9) !important;
    color: var(--asagi-color) !important;
}

/* カテゴリセクションの人気記事サブタイトル */
.popular-posts-subtitle {
    margin-top: 10px;
    margin-bottom: 0;
}

.popular-posts-subtitle h3 {
    font-size: 1.1rem;
    color: #666;
    margin: 0;
    font-weight: 500;
    text-align: center;
    padding: 5px 0;
}

/* ヒーロー記事の特別感演出デザイン */
.hero-badge {
    position: absolute;
    top: -10px;
    left: 20px;
    z-index: 10;
}

.popular-badge {
    background: linear-gradient(135deg, #ff6b35, #ff8e3c);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.3);
    display: inline-block;
}

.hero-overlay-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 5;
}

.trending-label {
    background: rgba(255, 255, 255, 0.95);
    color: #ff6b35;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: bold;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.popular-indicator {
    background: linear-gradient(135deg, #ffd700, #ffed4a);
    color: #d69e2e;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: bold;
    margin-left: 10px;
}

/* スマホ版のヒーロー記事特別デザイン */
.slide-trending-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255, 107, 53, 0.9);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}

.slide-popular-label {
    margin-bottom: 5px;
}

.popular-tag {
    background: linear-gradient(135deg, #ff6b35, #ff8e3c);
    color: white;
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: bold;
    display: inline-block;
}

.rank-badge {
    background: linear-gradient(135deg, #ffd700, #ffed4a);
    color: #d69e2e;
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: bold;
    margin-left: 8px;
}

/* レスポンシブ調整 */
@media (max-width: 768px) {
    .hero-badge {
        top: -8px;
        left: 15px;
    }
    
    .popular-badge {
        font-size: 0.75rem;
        padding: 4px 8px;
    }
    
    .trending-label {
        font-size: 0.6rem;
        padding: 3px 6px;
    }
}

/* Button styling */
.btn-primary,
.wp-block-button__link {
    background-color: var(--asagi-color);
    border-color: var(--asagi-color);
}

.btn-primary:hover,
.wp-block-button__link:hover {
    background-color: var(--asagi-dark);
    border-color: var(--asagi-dark);
}

/* Category sections */
.category-section {
    margin-bottom: 3rem;
    padding: 2rem;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.category-section h2 {
    color: var(--asagi-color);
    border-bottom: 2px solid var(--asagi-color);
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
}

/* Post grid */
.post-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.post-card {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.post-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(51, 166, 184, 0.3);
}

.post-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.post-card-content {
    padding: 1rem;
}

.post-card h3 {
    margin: 0 0 0.5rem;
    font-size: 1.1rem;
}

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

.post-card h3 a:hover {
    color: var(--asagi-color);
}

/* Recent viewed posts widget */
.recent-viewed-widget {
    background: var(--asagi-bg);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.recent-viewed-widget h3 {
    color: var(--asagi-color);
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.recent-viewed-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.recent-viewed-list li {
    margin-bottom: 0.8rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid rgba(51, 166, 184, 0.2);
}

.recent-viewed-list li:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.recent-viewed-list a {
    text-decoration: none;
    display: block;
    transition: color 0.3s ease;
}

.recent-viewed-list a:hover {
    color: var(--asagi-dark);
}

/* Popular posts widget */
.popular-posts-widget {
    background: #fff;
    border: 1px solid rgba(51, 166, 184, 0.2);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.popular-posts-widget h3 {
    color: var(--asagi-color);
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.6s ease-out;
}

/* Responsive */
@media (max-width: 768px) {
    .wrap, .content-in {
        width: 100% !important;
        padding: 0 15px !important;
        box-sizing: border-box !important;
        display: block !important;
        flex-direction: column !important;
    }
    
    .main {
        width: 100% !important;
        margin-bottom: 20px;
    }
    
    .sidebar {
        width: 100% !important;
        margin-left: 0 !important;
    }

    .post-grid {
        grid-template-columns: 1fr;
    }
    
    .category-section {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    html {
        overflow-x: hidden;
    }
    body {
        word-wrap: break-word;
        overflow-wrap: break-word;
        overflow-x: hidden;
    }
    
    .main {
        padding: 10px 0;
    }
    
    .horizontal-entry-card-title a {
        font-size: 1.1rem;
    }
}

/* --- Single Post Styles --- */

@media (max-width: 768px) {
    .single-post .entry-title {
        font-size: 1.8rem; /* スマホ用のフォントサイズに調整 */
    }
    .single-post {
        padding: 0 8px; /* 両サイドにわずかな余白を追加 */
    }
}

.single-post .entry-header {
    margin-bottom: 2rem;
}

.single-post .entry-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.3;
}

.single-post .entry-meta {
    margin-top: 1rem;
    color: #64748b;
    font-size: 0.9rem;
}

.single-post .post-thumbnail {
    margin-bottom: 2rem;
    border-radius: 12px;
    overflow: hidden;
}

.single-post .entry-content {
    line-height: 1.8;
}

.related-posts .post-card {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid #e2e8f0;
}

.related-posts .post-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(51, 166, 184, 0.2);
}

.related-posts .post-card img {
    width: 100%;
    height: 160px;
    object-fit: cover;
}

.related-posts .post-card-content {
    padding: 1rem;
}

.related-posts .post-card h3 {
    margin: 0 0 0.5rem;
    font-size: 1rem;
    font-weight: 600;
}

.related-posts .post-card h3 a {
    color: #333;
    text-decoration: none;
}

.related-posts .post-card h3 a:hover {
    color: var(--asagi-color);
}

.related-posts .post-meta {
    font-size: 0.8rem;
    color: #64748b;
}

/* Tag styling */
.tags-links {
    margin-top: 1rem;
}

.tags-label {
    font-weight: bold;
    margin-right: 0.5rem;
}

.tag {
    display: inline-block;
    background: rgba(51, 166, 184, 0.1);
    color: #33a6b8;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    margin-right: 0.5rem;
    text-decoration: none;
    transition: all 0.3s ease;
}

.tag:hover {
    background: var(--asagi-color);
    color: #fff;
}

/* Post Navigation */
.post-navigation {
    margin-top: 2rem;
    border-top: 1px solid #e2e8f0;
    padding-top: 2rem;
}

.nav-links {
    display: flex;
    justify-content: space-between;
}

.nav-previous a,
.nav-next a {
    display: inline-block;
    padding: 12px 24px;
    background: linear-gradient(135deg, #33a6b8, #2891a0);
    color: white;
    text-decoration: none;
    border-radius: 25px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
}

.nav-previous a:hover,
.nav-next a:hover {
    background: linear-gradient(135deg, #2891a0, #1f7a87);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(51, 166, 184, 0.3);
}

.nav-subtitle {
    display: block;
    font-size: 0.8rem;
    opacity: 0.8;
}

.nav-title {
    font-weight: bold;
}

/* 枠線と背景の調整 */
body, #page, .content, .content-in {
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

#content {
    background: #f0f7f8 !important; /* 全体の背景色 */
}

.wrap {
    max-width: 100% !important;
}

/* メインカラムとサイドバーの間の余白を調整 */
.main {
    margin-right: 0 !important;
}

@media (min-width: 1025px) {
    .main {
        padding-right: 20px !important;
    }
}

/* 記事カードのスタイル調整 */
.article-card, .hero-slide {
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05) !important;
}

/* スマホ表示での不要な余白を削除 */
@media (max-width: 768px) {
    .content-in {
        padding: 0 !important;
    }
    
    .main {
        padding: 0 !important;
    }
    
    .hero-section {
        padding: 16px 0 !important;
    }
    
    .category-sections {
        padding: 24px 0 !important;
    }

    .category-section {
        padding: 1rem 0; /* 上下の余白のみ */
        border: none !important; /* 枠線を消す */
        box-shadow: none !important; /* 影を消す */
    }

    .articles-grid {
        padding: 0 16px; /* 左右に少し余白を持たせる */
        margin: 0; /* ネガティブマージンをリセット */
    }

    .hero-carousel {
        padding: 1rem 16px; /* 左右に余白を追加 */
        margin: 0; /* ネガティブマージンをリセット */
    }
}

/* --- Table of Contents (TOC) Styles --- */
.toc-box {
    background: #f7fcfd;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 0;
    margin: 2rem 0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    overflow: hidden; /* for border-radius */
}

.toc-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    background: var(--asagi-color);
    padding: 12px 20px;
    display: flex;
    align-items: center;
}

.toc-title:before {
    content: '\f0ca'; /* Font Awesome list icon */
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    margin-right: 10px;
}

.toc-list {
    padding: 10px 20px 20px 20px;
    line-height: 1.8;
}

.toc-list ol,
.toc-list ul {
    padding-left: 25px; /* Adjust indentation */
}

.toc-list li a {
    color: #374151;
    text-decoration: none;
    transition: color 0.3s ease;
}

.toc-list li a:hover {
    color: var(--asagi-dark);
}

/* Adjust list markers */
.toc-list > li {
    list-style-type: decimal;
}

.toc-list > li > ul > li {
    list-style-type: disc;
}

.toc-list > li > ul > li > ul > li {
    list-style-type: circle;
}

/* --- Entry Content Heading Styles --- */
.entry-content h2 {
    font-size: 1.8rem;
    font-weight: 700;
    color: #1e293b;
    padding-left: 1rem;
    border-left: 5px solid var(--asagi-color);
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 0.5rem;
    margin: 2.5rem 0 1.5rem;
}

.entry-content h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #2d3748;
    border-bottom: 2px solid;
    border-image: linear-gradient(to right, var(--asagi-light), transparent) 1;
    padding-bottom: 0.4rem;
    margin: 2rem 0 1.2rem;
}

.entry-content h4 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--asagi-dark);
    margin: 1.8rem 0 1rem;
    display: flex;
    align-items: center;
}

.entry-content h4:before {
    content: "";
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--asagi-color);
    border-radius: 50%;
    margin-right: 0.8rem;
}

/* プロフィールウィジェットのアイコン修正 - □を非表示にする */
.widget-profile .widget-title::before {
    display: none !important;
}

/* スマホ用プロフィール表示 */
.mobile-profile-section {
    display: none;
}

@media (max-width: 768px) {
    /* スマホでのみモバイル用プロフィールを表示 */
    .mobile-profile-section {
        display: block;
        margin: 30px 0;
        padding: 0 16px;
    }
    
    .mobile-profile-section .widget-profile {
        background: #fff;
        border-radius: 10px;
        box-shadow: 0 2px 10px rgba(0,0,0,0.1);
        padding: 20px;
        margin: 0;
    }
    
    .mobile-profile-section .profile-box {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .mobile-profile-section .profile-image {
        margin-bottom: 15px;
    }
    
    .mobile-profile-section .profile-social {
        margin-top: 15px;
        display: flex;
        gap: 15px;
        justify-content: center;
    }
    
    .mobile-profile-section .profile-social a {
        font-size: 20px;
        color: var(--asagi-color);
        transition: opacity 0.3s;
    }
    
    .mobile-profile-section .profile-social a:hover {
        opacity: 0.7;
    }
}

/* スマホ用カテゴリ別記事数とタグ */
.mobile-category-stats-section,
.mobile-tags-section {
    display: none;
}

@media (max-width: 768px) {
    .mobile-category-stats-section,
    .mobile-tags-section {
        display: block;
        margin: 30px 0;
        padding: 0 16px;
    }
    
    .mobile-category-stats-section .widget,
    .mobile-tags-section .widget {
        background: #fff;
        border-radius: 10px;
        box-shadow: 0 2px 10px rgba(0,0,0,0.1);
        padding: 20px;
        margin: 0;
    }
    
    /* カテゴリ別記事数のスタイル - 改善版・より強力な指定 */
    .mobile-category-stats-section .category-stats,
    .mobile-category-stats-section ul.category-stats {
        list-style: none !important;
        padding: 0 !important;
        margin: 0 !important;
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
    }
    
    .mobile-category-stats-section .category-stats li,
    .mobile-category-stats-section ul.category-stats li {
        margin-bottom: 0 !important;
        flex: none !important;
    }
    
    .mobile-category-stats-section .category-stats a,
    .mobile-category-stats-section ul.category-stats a {
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
        background: #f8f9fa !important;
        color: #495057 !important;
        border: 1px solid #dee2e6 !important;
        text-decoration: none !important;
        padding: 8px 12px !important;
        border-radius: 20px !important;
        transition: all 0.3s !important;
        font-weight: 500 !important;
        white-space: nowrap !important;
        box-shadow: none !important;
    }
    
    .mobile-category-stats-section .category-stats a:hover,
    .mobile-category-stats-section ul.category-stats a:hover {
        background: var(--asagi-color) !important;
        color: #fff !important;
        border-color: var(--asagi-color) !important;
        transform: translateY(-2px) !important;
    }
    
    .mobile-category-stats-section .count,
    .mobile-category-stats-section ul.category-stats .count {
        background: #6c757d !important;
        color: #fff !important;
        padding: 2px 6px !important;
        border-radius: 10px !important;
        font-size: 0.8em !important;
        font-weight: bold !important;
        min-width: 18px !important;
        text-align: center !important;
    }
    
    .mobile-category-stats-section .category-stats a:hover .count,
    .mobile-category-stats-section ul.category-stats a:hover .count {
        background: rgba(255, 255, 255, 0.9) !important;
        color: var(--asagi-color) !important;
    }
    
    /* タグクラウドのスタイル */
    .mobile-tags-section .tagcloud {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .mobile-tags-section .tagcloud a {
        background: #f8f9fa;
        color: #495057;
        border: 1px solid #dee2e6;
        padding: 6px 12px;
        border-radius: 20px;
        text-decoration: none;
        transition: all 0.3s;
        display: inline-block;
        font-weight: 500;
    }
    
    .mobile-tags-section .tagcloud a:hover {
        background: var(--asagi-color);
        color: #fff;
        border-color: var(--asagi-color);
        transform: translateY(-2px);
    }
    
    /* スマホでのヘッダーロゴ・タイトル調整 */
    .custom-logo-link {
        max-width: 200px;
    }
    
    .custom-logo {
        max-height: 45px;
    }
    
    .site-title,
    .header .site-title {
        font-size: 1.4rem !important;
    }
    
    /* スマホでの記事タイトルサイズ調整 */
    .entry-title {
        font-size: 1.6rem !important;
        line-height: 1.4 !important;
    }
    
    .article-title,
    .article-title a {
        font-size: 0.95rem !important;
    }
    
    .hero-title {
        font-size: 1.4rem !important;
    }
}
