/* article.css - 記事ページ専用CSS */

/* 記事専用スタイル */
.article-title {
    font-size: 1.75rem;
    font-weight: bold;
    line-height: 1.3;
    color: #212529;
    margin-bottom: 1rem;
}

.article-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.article-content {
    line-height: 1.8;/* article.css - 記事ページ専用CSS */

/* 記事専用スタイル */
.article-title {
    font-size: 1.75rem;
    font-weight: bold;
    line-height: 1.3;
    color: #212529;
    margin-bottom: 1rem;
}

.article-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.article-content {
    line-height: 1.8;
    font-size: 1rem;
}

/* HTMLファイルから取り込んだコンテンツのスタイル */
.article-html-content {
    width: 100%;
}

.article-html-content .title,
.article-html-content h1 {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 1.5rem;
    color: #333;
}

.article-html-content .t_h {
    background: #e9ecef;
    padding: 0.75rem;
    margin: 1.5rem 0 0 0;
    font-weight: bold;
}

.article-html-content .t_b {
    padding: 0.75rem;
    margin-bottom: 1rem;
    font-size: 1.2rem;
    font-weight: bold;
    background: white;
    border-radius: 0.25rem;
}

.article-html-content .t_i {
    margin-left: 1.2rem;
    padding-left: 0.75rem;
}

.article-html-content .anchor {
    color: #007bff;
    text-decoration: none;
}

.article-html-content .anchor:hover {
    text-decoration: underline;
}

/* 記事内画像スタイル - はみ出し防止強化 */
.article-html-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1rem auto;
    border-radius: 0.375rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.article-html-content img:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

/* contenteditable="false"の画像に対する特別な処理 */
.article-html-content img[contenteditable="false"] {
    pointer-events: auto;
    user-select: none;
}

/* 段落内の画像 */
.article-html-content p img {
    margin: 0.5rem auto;
}

/* 画像が連続する場合のマージン調整 */
.article-html-content img + img {
    margin-top: 0.5rem;
}

/* 画像の最大幅制限（大きすぎる画像の対策） */
.article-html-content img {
    max-width: min(100%, 800px);
}

/* 画像読み込みエラー時の表示 */
.article-html-content img.error {
    display: none;
}

.image-error-placeholder {
    background: #f8f9fa;
    border: 2px dashed #dee2e6;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 1rem auto;
    border-radius: 0.375rem;
    color: #6c757d;
    font-size: 0.9rem;
    max-width: 800px;
}

/* 画像キャプション */
.article-html-content img[alt]:not([alt=""])::after {
    content: attr(alt);
    display: block;
    text-align: center;
    font-size: 0.8rem;
    color: #6c757d;
    margin-top: 0.5rem;
    font-style: italic;
}

/* 画像読み込み中のアニメーション */
.article-html-content img:not([src]),
.article-html-content img[src=""] {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    min-height: 100px;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* インライン広告スタイル */
.inline-ad {
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    border: 2px dashed #856404;
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin: 2rem 0;
    text-align: center;
    transition: all 0.3s ease;
}

.inline-ad:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.inline-ad-label {
    font-size: 0.8rem;
    color: #856404;
    margin-bottom: 0.75rem;
}

.inline-ad-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.inline-ad-image img {
    max-width: 200px;
    max-height: 150px;
    border-radius: 0.375rem;
    object-fit: cover;
}

.inline-ad-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #212529;
}

.inline-ad-desc {
    color: #6c757d;
    font-size: 0.9rem;
}

/* フォールバック表示 */
.article-fallback {
    padding: 2rem;
    text-align: center;
}

.fallback-content {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 0.5rem;
    padding: 2rem;
    margin-top: 1rem;
    text-align: left;
    line-height: 1.8;
}

/* シェアボタン */
.article-share {
    background: #f8f9fa;
    border-radius: 0.5rem;
    padding: 1.5rem;
    border: 1px solid #e9ecef;
}

.share-buttons {
    justify-content: flex-start;
}

.share-buttons .btn {
    transition: all 0.3s ease;
}

.share-buttons .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* 関連記事 */
.related-articles {
    background: #f8f9fa;
    border-radius: 0.5rem;
    padding: 1.5rem;
    border: 1px solid #e9ecef;
}

.related-articles .card {
    transition: all 0.3s ease;
    border: 1px solid #e9ecef;
}

.related-articles .card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-color: #007bff;
}

.related-articles .card-title {
    color: #212529;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.4;
}

.related-articles .card-title:hover {
    color: #007bff;
}

/* パンくずナビ */
.breadcrumb {
    background: none;
    padding: 0;
}

.breadcrumb-item + .breadcrumb-item::before {
    color: #6c757d;
}

.breadcrumb-item a {
    color: #007bff;
    text-decoration: none;
}

.breadcrumb-item a:hover {
    color: #0056b3;
    text-decoration: underline;
}

.breadcrumb-item.active {
    color: #6c757d;
}

/* 記事ヘッダー */
.article-header {
    margin-bottom: 2rem;
}

.article-meta span {
    display: inline-flex;
    align-items: center;
    margin-bottom: 0.25rem;
}

.article-meta .badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .article-title {
        font-size: 1.25rem;
    }

    .article-meta {
        font-size: 0.8rem;
        gap: 0.25rem;
        flex-direction: column;
        align-items: flex-start;
    }

    .article-meta span {
        margin-bottom: 0.25rem;
    }

    .share-buttons {
        justify-content: center;
    }

    .article-html-content img {
        margin: 0.75rem auto;
        border-radius: 0.25rem;
        max-width: 100%;
    }
    
    .image-error-placeholder {
        min-height: 150px;
        font-size: 0.8rem;
    }

    .article-share,
    .related-articles {
        padding: 1rem;
    }

    .related-articles .card-title {
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .article-html-content img {
        margin: 0.5rem auto;
    }

    .inline-ad {
        padding: 1rem;
        margin: 1.5rem 0;
    }

    .inline-ad-image img {
        max-width: 150px;
        max-height: 100px;
    }
}

/* アニメーション */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.article-section {
    animation: fadeInUp 0.6s ease;
}

.article-share {
    animation: fadeInUp 0.8s ease;
}

.related-articles {
    animation: fadeInUp 1s ease;
}

/* 印刷用スタイル */
@media print {
    .article-share,
    .related-articles,
    .inline-ad {
        display: none !important;
    }

    .article-html-content img {
        max-width: 100% !important;
        box-shadow: none !important;
        border-radius: 0 !important;
    }

    .article-title {
        color: #000 !important;
    }

    .article-meta {
        color: #666 !important;
    }
}

/* ダークモード対応（将来拡張用） */
@media (prefers-color-scheme: dark) {
    .article-title {
        color: #e2e8f0;
    }

    .article-html-content .title,
    .article-html-content h1 {
        color: #e2e8f0;
    }

    .article-html-content .t_h {
        background: #2d3748;
        color: #e2e8f0;
    }

    .article-html-content .t_b {
        background: #2d3748;
        color: #e2e8f0;
    }

    .article-share,
    .related-articles {
        background: #2d3748;
        border-color: #4a5568;
    }

    .fallback-content {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
}
    font-size: 1rem;
}

/* HTMLファイルから取り込んだコンテンツのスタイル */
.article-html-content {
    width: 100%;
}

.article-html-content .title,
.article-html-content h1 {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 1.5rem;
    color: #333;
}

.article-html-content .t_h {
    background: #e9ecef;
    padding: 0.75rem;
    margin: 1.5rem 0 0 0;
    font-weight: bold;
}

.article-html-content .t_b {
    padding: 0.75rem;
    margin-bottom: 1rem;
    font-size: 1.2rem;
    font-weight: bold;
    background: white;
    border-radius: 0.25rem;
}

.article-html-content .t_i {
    margin-left: 1.2rem;
    padding-left: 0.75rem;
}

.article-html-content .anchor {
    color: #007bff;
    text-decoration: none;
}

.article-html-content .anchor:hover {
    text-decoration: underline;
}

/* 記事内画像スタイル - はみ出し防止強化 */
.article-html-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1rem auto;
    border-radius: 0.375rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.article-html-content img:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

/* contenteditable="false"の画像に対する特別な処理 */
.article-html-content img[contenteditable="false"] {
    pointer-events: auto;
    user-select: none;
}

/* 段落内の画像 */
.article-html-content p img {
    margin: 0.5rem auto;
}

/* 画像が連続する場合のマージン調整 */
.article-html-content img + img {
    margin-top: 0.5rem;
}

/* 画像の最大幅制限（大きすぎる画像の対策） */
.article-html-content img {
    max-width: min(100%, 800px);
}

/* 画像読み込みエラー時の表示 */
.article-html-content img.error {
    display: none;
}

.image-error-placeholder {
    background: #f8f9fa;
    border: 2px dashed #dee2e6;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 1rem auto;
    border-radius: 0.375rem;
    color: #6c757d;
    font-size: 0.9rem;
    max-width: 800px;
}

/* 画像キャプション */
.article-html-content img[alt]:not([alt=""])::after {
    content: attr(alt);
    display: block;
    text-align: center;
    font-size: 0.8rem;
    color: #6c757d;
    margin-top: 0.5rem;
    font-style: italic;
}

/* 画像読み込み中のアニメーション */
.article-html-content img:not([src]),
.article-html-content img[src=""] {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    min-height: 100px;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* インライン広告スタイル */
.inline-ad {
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    border: 2px dashed #856404;
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin: 2rem 0;
    text-align: center;
    transition: all 0.3s ease;
}

.inline-ad:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.inline-ad-label {
    font-size: 0.8rem;
    color: #856404;
    margin-bottom: 0.75rem;
}

.inline-ad-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.inline-ad-image img {
    max-width: 200px;
    max-height: 150px;
    border-radius: 0.375rem;
    object-fit: cover;
}

.inline-ad-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #212529;
}

.inline-ad-desc {
    color: #6c757d;
    font-size: 0.9rem;
}

/* フォールバック表示 */
.article-fallback {
    padding: 2rem;
    text-align: center;
}

.fallback-content {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 0.5rem;
    padding: 2rem;
    margin-top: 1rem;
    text-align: left;
    line-height: 1.8;
}

/* シェアボタン */
.article-share {
    background: #f8f9fa;
    border-radius: 0.5rem;
    padding: 1.5rem;
    border: 1px solid #e9ecef;
}

.share-buttons {
    justify-content: flex-start;
}

.share-buttons .btn {
    transition: all 0.3s ease;
}

.share-buttons .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* 関連記事 */
.related-articles {
    background: #f8f9fa;
    border-radius: 0.5rem;
    padding: 1.5rem;
    border: 1px solid #e9ecef;
}

.related-articles .card {
    transition: all 0.3s ease;
    border: 1px solid #e9ecef;
}

.related-articles .card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-color: #007bff;
}

.related-articles .card-title {
    color: #212529;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.4;
}

.related-articles .card-title:hover {
    color: #007bff;
}

/* パンくずナビ */
.breadcrumb {
    background: none;
    padding: 0;
}

.breadcrumb-item + .breadcrumb-item::before {
    color: #6c757d;
}

.breadcrumb-item a {
    color: #007bff;
    text-decoration: none;
}

.breadcrumb-item a:hover {
    color: #0056b3;
    text-decoration: underline;
}

.breadcrumb-item.active {
    color: #6c757d;
}

/* 記事ヘッダー */
.article-header {
    margin-bottom: 2rem;
}

.article-meta span {
    display: inline-flex;
    align-items: center;
    margin-bottom: 0.25rem;
}

.article-meta .badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .article-title {
        font-size: 1.25rem;
    }

    .article-meta {
        font-size: 0.8rem;
        gap: 0.25rem;
        flex-direction: column;
        align-items: flex-start;
    }

    .article-meta span {
        margin-bottom: 0.25rem;
    }

    .share-buttons {
        justify-content: center;
    }

    .article-html-content img {
        margin: 0.75rem auto;
        border-radius: 0.25rem;
        max-width: 100%;
    }
    
    .image-error-placeholder {
        min-height: 150px;
        font-size: 0.8rem;
    }

    .article-share,
    .related-articles {
        padding: 1rem;
    }

    .related-articles .card-title {
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .article-html-content img {
        margin: 0.5rem auto;
    }

    .inline-ad {
        padding: 1rem;
        margin: 1.5rem 0;
    }

    .inline-ad-image img {
        max-width: 150px;
        max-height: 100px;
    }
}

/* アニメーション */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.article-section {
    animation: fadeInUp 0.6s ease;
}

.article-share {
    animation: fadeInUp 0.8s ease;
}

.related-articles {
    animation: fadeInUp 1s ease;
}

/* 印刷用スタイル */
@media print {
    .article-share,
    .related-articles,
    .inline-ad {
        display: none !important;
    }

    .article-html-content img {
        max-width: 100% !important;
        box-shadow: none !important;
        border-radius: 0 !important;
    }

    .article-title {
        color: #000 !important;
    }

    .article-meta {
        color: #666 !important;
    }
}

/* ダークモード対応（将来拡張用） */
@media (prefers-color-scheme: dark) {
    .article-title {
        color: #e2e8f0;
    }

    .article-html-content .title,
    .article-html-content h1 {
        color: #e2e8f0;
    }

    .article-html-content .t_h {
        background: #2d3748;
        color: #e2e8f0;
    }

    .article-html-content .t_b {
        background: #2d3748;
        color: #e2e8f0;
    }

    .article-share,
    .related-articles {
        background: #2d3748;
        border-color: #4a5568;
    }

    .fallback-content {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
}