/**
 * Character Archive Page Styles
 */

/* Remove custom H1 style to use SWELL default */
/* .fp-character-archive .c-postTitle__h1 styles removed */

/* Character List Container */
.fp-character-list {
    margin: 40px 0;
}

/* Character Item */
.fp-character-item {
    margin-bottom: 60px;
    padding-bottom: 40px;
    border-bottom: 1px solid #e5e5e5;
}

.fp-character-item:last-child {
    border-bottom: none;
}

/* Character H2 Heading */
.fp-character-item h2 {
    font-size: 1.8em;
    margin-bottom: 20px;
    font-weight: bold;
}

/* Character Image */
.fp-character-image {
    margin-bottom: 20px;
    text-align: center;
}

.fp-character-image img {
    max-width: 100%;  /* 親要素を超えない */
    height: auto;     /* アスペクト比維持 */
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    object-fit: contain;
}

/* 画像引用元のスタイル */
.fp-character-image .fp-image-source {
    font-size: 12px;
    color: #666;
    text-align: right;
    margin-top: 5px;
}

.fp-character-image .fp-image-source a {
    color: #666;
    text-decoration: none;
}

.fp-character-image .fp-image-source a:hover {
    text-decoration: underline;
}

/* PC表示での画像サイズ制限 */
@media (min-width: 1200px) {
    .fp-character-image,
    .single-fp_character .fp-character-image,
    .single-fp_character .fp-character-featured-image {
        max-width: 400px !important;
        margin: 0 auto 30px !important;
    }
    
    .fp-character-image img,
    .single-fp_character .fp-character-image img,
    .single-fp_character .fp-character-featured-image img {
        max-height: 500px !important;
        width: auto !important;
        height: auto !important;
        object-fit: contain !important;
    }
}

/* タブレット表示での画像サイズ制限 */
@media (min-width: 768px) and (max-width: 1199px) {
    .fp-character-image,
    .single-fp_character .fp-character-image,
    .single-fp_character .fp-character-featured-image {
        max-width: 350px !important;
        margin: 0 auto 25px !important;
    }
    
    .fp-character-image img,
    .single-fp_character .fp-character-image img,
    .single-fp_character .fp-character-featured-image img {
        max-height: 400px !important;
        width: auto !important;
        height: auto !important;
        object-fit: contain !important;
    }
}

/* スマホ表示での画像サイズ制限 */
@media (max-width: 767px) {
    .fp-character-image,
    .single-fp_character .fp-character-image,
    .single-fp_character .fp-character-featured-image {
        max-width: 100% !important;
        margin: 0 auto 20px !important;
    }
    
    .fp-character-image img,
    .single-fp_character .fp-character-image img,
    .single-fp_character .fp-character-featured-image img {
        max-height: 300px !important;
        width: auto !important;
        height: auto !important;
        object-fit: contain !important;
        margin: 0 auto !important;
        display: block !important;
    }
}

/* Character Summary */
.fp-character-summary {
    margin-top: 20px;
}

/* Character Link */
.fp-character-link {
    display: inline-block;
    margin-top: 15px;
    color: #333;
    text-decoration: none;
    font-weight: bold;
    transition: color 0.3s ease;
}

.fp-character-link:hover {
    color: #0073aa;
}

/* Intro/Outro Blog Parts */
.fp-archive-intro,
.fp-archive-outro {
    margin: 30px 0;
}

/* Single Character Page Styles */
.single-fp_character .c-postTitle {
    margin-bottom: 3rem !important;
}

.single-fp_character .c-postTitle__ttl {
    margin-bottom: 0;
}

/* First element spacing */
.single-fp_character .post_content > *:first-child {
    margin-top: 0;
}

.single-fp_character .post_content > h2:first-child {
    margin-top: 1.5rem;
}

/* Table of Contents Styles */
.fp-character-toc {
    background: #f7f7f7;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    padding: 20px;
    margin: 30px 0;
}

.fp-toc-header {
    font-weight: bold;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
}

.fp-toc-title {
    font-size: 1.1em;
    color: #333;
}

.fp-toc-content {
    position: relative;
}

.fp-toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
    column-count: 2;
    column-gap: 30px;
}

.fp-toc-item {
    margin-bottom: 8px;
    break-inside: avoid;
    position: relative;
    padding-left: 15px;
}

.fp-toc-item::before {
    content: "・";
    position: absolute;
    left: 0;
    color: #666;
}

.fp-toc-item.fp-toc-hidden {
    display: none;
}

.fp-toc-item.fp-toc-shown {
    display: list-item;
}

.fp-toc-link {
    color: #0073aa;
    text-decoration: none;
    transition: color 0.3s ease;
}

.fp-toc-link:hover {
    color: #005177;
    text-decoration: underline;
}

.fp-toc-toggle {
    display: block;
    width: 100%;
    margin-top: 15px;
    padding: 8px 15px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 3px;
    color: #666;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.fp-toc-toggle:hover {
    background: #f0f0f0;
    border-color: #ccc;
}

.fp-toc-toggle-icon {
    display: inline-block;
    margin-left: 5px;
    transition: transform 0.3s ease;
}

.fp-toc-toggle[data-expanded="true"] .fp-toc-toggle-icon {
    transform: rotate(180deg);
}

.fp-toc-toggle[data-expanded="true"] .fp-toc-toggle-text {
    content: "閉じる";
}

/* Responsive Design */
@media (max-width: 768px) {
    .fp-character-item h2 {
        font-size: 1.5em;
    }
    
    .fp-character-image img {
        max-width: 100%;
    }
    
    .single-fp_character .c-postTitle {
        margin-bottom: 2rem !important;
    }
    
    /* TOC responsive */
    .fp-toc-list {
        column-count: 1;
    }
    
    .fp-character-toc {
        padding: 15px;
        margin: 20px 0;
    }
}