/* 改善された記事ページのスタイル（パンくずリスト以外） */

/* ユーティリティクラス */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* メインコンテナ */
.improved-article-main {
    min-height: 100vh;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    position: relative;
    padding: 2rem 0;
}

/* 記事コンテナ */
.article-container {
    max-width: 800px;
    margin: 2rem auto;
    padding: 3rem;
    background: white;
    border-radius: 1.5rem;
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.1),
        0 4px 8px rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
}

.article-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6, #06b6d4, #10b981);
    animation: gradientShift 8s ease-in-out infinite;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* 記事ヘッダー */
.article-header {
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid #e2e8f0;
    position: relative;
}

.article-meta {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.article-category {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    border-radius: 2rem;
    font-size: 0.875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.article-category:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.article-category.research {
    background: linear-gradient(135deg, #06b6d4, #0891b2);
    color: white;
}

.article-category.announcement {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.article-category.event {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
}

.category-icon {
    font-size: 1.125rem;
}

.article-date {
    color: #64748b;
    font-size: 0.875rem;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
    border-radius: 2rem;
    border: 1px solid #cbd5e1;
    transition: all 0.3s ease;
}

.article-date:hover {
    background: linear-gradient(135deg, #e2e8f0, #cbd5e1);
    transform: translateY(-1px);
}

.article-title {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 800;
    line-height: 1.2;
    color: #1e293b;
    margin-bottom: 2rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
}

.article-title::after {
    content: '';
    position: absolute;
    bottom: -0.5rem;
    left: 0;
    width: 60px;
    height: 4px;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
    border-radius: 2px;
}

.article-summary-container {
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
    padding: 2rem;
    border-radius: 1rem;
    border-left: 6px solid #3b82f6;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

.article-summary-container::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.1) 0%, transparent 70%);
    border-radius: 50%;
    transform: translate(30px, -30px);
}

.article-summary {
    font-size: 1.25rem;
    line-height: 1.7;
    color: #374151;
    font-weight: 500;
    margin: 0;
    position: relative;
    z-index: 1;
}

.article-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
    padding: 1.5rem;
    background: #f8fafc;
    border-radius: 1rem;
    border: 1px solid #e2e8f0;
}

.article-info-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.info-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.info-value {
    font-size: 1rem;
    font-weight: 600;
    color: #1e293b;
}

/* 記事本文 */
.article-content {
    margin-bottom: 4rem;
}

.article-body {
    font-size: 1.125rem;
    line-height: 1.8;
    color: #374151;
    font-family: 'Georgia', 'Times New Roman', serif;
}

.article-body p {
    margin-bottom: 1.5rem;
}

.article-body h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1e293b;
    margin: 3rem 0 1.5rem 0;
    padding-bottom: 0.75rem;
    border-bottom: 3px solid #e2e8f0;
    position: relative;
}

.article-body h2::before {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    width: 80px;
    height: 3px;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
}

.article-body h3 {
    font-size: 1.375rem;
    font-weight: 600;
    color: #1e293b;
    margin: 2.5rem 0 1rem 0;
    position: relative;
    padding-left: 1rem;
}

.article-body h3::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.5rem;
    width: 4px;
    height: 1.5rem;
    background: linear-gradient(180deg, #3b82f6, #8b5cf6);
    border-radius: 2px;
}

.article-body ul, .article-body ol {
    margin: 2rem 0;
    padding-left: 2rem;
}

.article-body li {
    margin-bottom: 0.75rem;
    line-height: 1.7;
}

.article-body blockquote {
    border-left: 6px solid #3b82f6;
    padding: 2rem;
    margin: 3rem 0;
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
    border-radius: 0 1rem 1rem 0;
    font-style: italic;
    font-size: 1.125rem;
    position: relative;
}

.article-body blockquote::before {
    content: '"';
    position: absolute;
    top: -0.5rem;
    left: 1rem;
    font-size: 4rem;
    color: #3b82f6;
    opacity: 0.3;
    font-family: serif;
}

.article-body code {
    background: #f1f5f9;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.875rem;
    border: 1px solid #e2e8f0;
}

.article-body pre {
    background: #1e293b;
    color: #f1f5f9;
    padding: 2rem;
    border-radius: 1rem;
    overflow-x: auto;
    margin: 3rem 0;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.article-body pre code {
    background: none;
    border: none;
    padding: 0;
    color: inherit;
}

/* 記事フッター */
.article-footer {
    border-top: 2px solid #e2e8f0;
    padding-top: 3rem;
}

.article-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4rem;
    flex-wrap: wrap;
    gap: 2rem;
}

.back-to-list-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    text-decoration: none;
    border-radius: 1rem;
    font-weight: 700;
    font-size: 1rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
    position: relative;
    overflow: hidden;
}

.back-to-list-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.back-to-list-btn:hover::before {
    left: 100%;
}

.back-to-list-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4);
}

.back-to-list-btn:focus {
    outline: 3px solid rgba(59, 130, 246, 0.5);
    outline-offset: 2px;
}

.btn-icon {
    font-size: 1.125rem;
    transition: transform 0.3s ease;
}

.back-to-list-btn:hover .btn-icon {
    transform: translateX(-4px);
}

.share-buttons {
    display: flex;
    gap: 1rem;
}

.share-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.25rem;
    background: white;
    border: 2px solid #e2e8f0;
    color: #64748b;
    border-radius: 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: visible; /* overflowをvisibleに変更 */
    min-height: 2.5rem; /* 最小高さを確保 */
    white-space: nowrap; /* テキストの改行を防ぐ */
}

.share-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 100%;
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
    transition: width 0.3s ease;
    z-index: 0;
    border-radius: inherit; /* 親要素のborder-radiusを継承 */
}

.share-btn:hover::before {
    width: 100%;
}

.share-btn:hover {
    border-color: #3b82f6;
    color: #1e40af;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.15);
    /* テキストが隠れないように、z-indexを調整 */
}

.share-btn:focus {
    outline: 3px solid rgba(59, 130, 246, 0.5);
    outline-offset: 2px;
}

.share-btn > * {
    position: relative;
    z-index: 2; /* z-indexを2に上げて確実にテキストが表示されるようにする */
}

.share-icon {
    font-size: 1rem;
    flex-shrink: 0; /* アイコンが縮まないようにする */
}

/* 目次 */
.table-of-contents {
    position: fixed;
    top: 50%;
    right: 2rem;
    transform: translateY(-50%);
    background: white;
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    max-width: 280px;
    max-height: 70vh;
    overflow-y: auto;
    z-index: 50;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    border: 1px solid #e2e8f0;
}

.table-of-contents.visible {
    opacity: 1;
    visibility: visible;
}

.toc-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 1.5rem;
    text-align: center;
    position: relative;
}

.toc-title::after {
    content: '';
    position: absolute;
    bottom: -0.5rem;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 2px;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
    border-radius: 1px;
}

.toc-list {
    list-style: none;
    padding: 0;
}

.toc-item {
    margin-bottom: 0.75rem;
}

.toc-link {
    display: block;
    color: #64748b;
    text-decoration: none;
    font-size: 0.875rem;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    transition: all 0.3s ease;
    line-height: 1.4;
    border: 1px solid transparent;
}

.toc-link:hover {
    color: #1e40af;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(139, 92, 246, 0.1));
    border-color: rgba(59, 130, 246, 0.2);
    transform: translateX(4px);
}

.toc-link.active {
    color: #1e40af;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(139, 92, 246, 0.15));
    border-color: #3b82f6;
    font-weight: 600;
}

/* ページトップボタン */
.scroll-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 3.5rem;
    height: 3.5rem;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.3);
    transition: all 0.3s ease;
    opacity: 0;
    visibility: hidden;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scroll-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.scroll-to-top:hover {
    transform: translateY(-4px) scale(1.1);
    box-shadow: 0 12px 35px rgba(59, 130, 246, 0.4);
}

.scroll-to-top:focus {
    outline: 3px solid rgba(59, 130, 246, 0.5);
    outline-offset: 2px;
}

.scroll-icon {
    font-size: 1.5rem;
    font-weight: bold;
}

/* レスポンシブデザイン */
@media (max-width: 1024px) {
    .table-of-contents {
        display: none;
    }
}

@media (max-width: 768px) {
    .improved-article-main {
        padding: 1rem 0;
    }
    
    .article-container {
        margin: 1rem;
        padding: 2rem;
        border-radius: 1rem;
    }
    
    .article-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .article-info {
        grid-template-columns: 1fr;
    }
    
    .article-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 1.5rem;
    }
    
    .share-buttons {
        justify-content: center;
    }
    
    .related-articles-container {
        grid-template-columns: 1fr;
    }
    
    .scroll-to-top {
        bottom: 1rem;
        right: 1rem;
        width: 3rem;
        height: 3rem;
    }
}

@media (max-width: 480px) {
    .article-container {
        margin: 0.5rem;
        padding: 1.5rem;
    }
    
    .article-body {
        font-size: 1rem;
    }
    
    .share-buttons {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .share-btn {
        justify-content: center;
    }
}

/* アニメーション */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ハイコントラストモード対応 */
@media (prefers-contrast: high) {
    .article-container {
        border: 3px solid #000;
    }
    
    .back-to-list-btn {
        background: #000;
        color: #fff;
    }
    
    .share-btn {
        border: 2px solid #000;
    }
    
    .article-category {
        border: 2px solid #000;
    }
}