/* ================================
   Article Page Styles
================================ */

/* Main Article Container */
.article-main {
    max-width: 800px;
    margin: 0 auto;
    padding: 100px 20px 60px;
}

/* Article Header */
.article-header {
    margin-bottom: 40px;
    padding-bottom: 30px;
    border-bottom: 1px solid var(--border);
}

.article-date {
    display: inline-block;
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 15px;
}

.article-title {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.4;
    color: var(--text-main);
}

/* Article Content */
.article-content {
    font-size: 1rem;
    line-height: 1.9;
    color: var(--text-main);
}

.article-content h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 50px 0 25px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary);
}

.article-content h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 45px 0 20px;
    padding-left: 15px;
    border-left: 4px solid var(--primary);
}

.article-content h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 35px 0 15px;
    color: var(--primary-dark);
}

.article-content p {
    margin: 20px 0;
}

.article-content a {
    color: var(--primary);
    text-decoration: underline;
}

.article-content a:hover {
    color: var(--primary-dark);
}

/* Lists */
.article-content ul,
.article-content ol {
    margin: 20px 0;
    padding-left: 25px;
}

.article-content li {
    margin: 10px 0;
    line-height: 1.7;
}

.article-content ul {
    list-style-type: disc;
}

.article-content ol {
    list-style-type: decimal;
}

.article-content ul ul,
.article-content ol ol {
    margin: 5px 0;
}

/* Code */
.article-content code {
    background: var(--primary-light);
    color: var(--primary-dark);
    padding: 2px 8px;
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9em;
}

.article-content pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 20px;
    border-radius: var(--radius);
    overflow-x: auto;
    margin: 25px 0;
}

.article-content pre code {
    background: transparent;
    color: inherit;
    padding: 0;
    font-size: 0.9rem;
    line-height: 1.6;
}

/* Blockquote */
.article-content blockquote {
    margin: 25px 0;
    padding: 20px 25px;
    background: var(--primary-light);
    border-left: 4px solid var(--primary);
    border-radius: 0 var(--radius) var(--radius) 0;
}

.article-content blockquote p {
    margin: 0;
}

/* Images */
.article-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
    margin: 25px 0;
    box-shadow: 0 4px 20px var(--shadow);
}

/* Tables */
.article-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 25px 0;
}

.article-content th,
.article-content td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.article-content th {
    background: var(--primary-light);
    font-weight: 700;
    color: var(--primary-dark);
}

.article-content tr:hover {
    background: var(--bg-main);
}

/* Horizontal Rule */
.article-content hr {
    border: none;
    height: 1px;
    background: var(--border);
    margin: 40px 0;
}

/* Article Navigation */
.article-nav {
    margin-top: 60px;
    padding-top: 30px;
    border-top: 1px solid var(--border);
}

.back-to-home {
    display: inline-block;
    color: var(--primary);
    font-weight: 500;
    transition: color var(--transition);
}

.back-to-home:hover {
    color: var(--primary-dark);
}

/* Responsive */
@media (max-width: 768px) {
    .article-main {
        padding: 80px 15px 40px;
    }

    .article-title {
        font-size: 1.5rem;
    }

    .article-content h1 {
        font-size: 1.4rem;
    }

    .article-content h2 {
        font-size: 1.25rem;
    }

    .article-content h3 {
        font-size: 1.1rem;
    }

    .article-content pre {
        padding: 15px;
        font-size: 0.85rem;
    }
}

/* Talk Block (会話吹き出し) */
.talk-block {
    margin: 30px 0;
    padding: 25px 20px;
    background: var(--bg-main);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.talk-balloon {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 20px;
}

.talk-balloon:last-child {
    margin-bottom: 0;
}

.talk-icon {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 60px;
}

.talk-icon img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 2px 8px var(--shadow);
    margin: 0;
}

.talk-name {
    font-size: 0.7rem;
    color: var(--text-light);
    margin-top: 4px;
    text-align: center;
    line-height: 1.2;
}

.talk-text {
    position: relative;
    max-width: calc(100% - 80px);
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 0.95rem;
    line-height: 1.7;
}

.talk-text p {
    margin: 0;
}

/* 左吹き出し（管理人） */
.talk-left {
    flex-direction: row;
}

.talk-left .talk-text {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 0 16px 16px 16px;
}

.talk-left .talk-text::before {
    content: "";
    position: absolute;
    left: -8px;
    top: 12px;
    width: 0;
    height: 0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-right: 8px solid var(--border);
}

.talk-left .talk-text::after {
    content: "";
    position: absolute;
    left: -6px;
    top: 13px;
    width: 0;
    height: 0;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-right: 7px solid var(--bg-white);
}

/* 右吹き出し（アシスタント） */
.talk-right {
    flex-direction: row-reverse;
}

.talk-right .talk-text {
    background: var(--primary-light);
    border: 1px solid var(--primary);
    border-radius: 16px 0 16px 16px;
    border-color: color-mix(in srgb, var(--primary) 30%, transparent);
}

.talk-right .talk-text::before {
    content: "";
    position: absolute;
    right: -8px;
    top: 12px;
    width: 0;
    height: 0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-left: 8px solid color-mix(in srgb, var(--primary) 30%, transparent);
}

.talk-right .talk-text::after {
    content: "";
    position: absolute;
    right: -6px;
    top: 13px;
    width: 0;
    height: 0;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-left: 7px solid var(--primary-light);
}

/* Talk Block Responsive */
@media (max-width: 768px) {
    .talk-block {
        padding: 15px 12px;
    }

    .talk-icon {
        width: 48px;
    }

    .talk-icon img {
        width: 40px;
        height: 40px;
    }

    .talk-name {
        font-size: 0.65rem;
    }

    .talk-text {
        max-width: calc(100% - 60px);
        padding: 10px 14px;
        font-size: 0.9rem;
    }
}

/* Article Card Link Styles */
.article-card a {
    display: block;
    text-decoration: none;
    color: inherit;
}

.article-card a:hover {
    color: inherit;
}

/* Breadcrumb Navigation */
.breadcrumb {
    margin-bottom: 25px;
    padding: 10px 0;
}

.breadcrumb-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0;
    font-size: 0.85rem;
}

.breadcrumb-list li {
    display: flex;
    align-items: center;
}

.breadcrumb-list li:not(:last-child)::after {
    content: "›";
    margin: 0 10px;
    color: var(--text-light);
    font-size: 1.1em;
}

.breadcrumb-list a {
    color: var(--text-light);
    text-decoration: none;
    transition: color 0.2s ease;
}

.breadcrumb-list a:hover {
    color: var(--primary);
    text-decoration: underline;
}

.breadcrumb-list li:last-child span {
    color: var(--text-main);
    font-weight: 500;
}

/* Article Meta (Date + Updated) */
.article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 15px;
    font-size: 0.9rem;
}

.article-date,
.article-updated {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--text-light);
}

.date-label {
    font-weight: 500;
}

/* Table of Contents */
.toc {
    background: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin: 30px 0;
    overflow: hidden;
}

.toc-details {
    margin: 0;
}

.toc-title {
    display: block;
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-main);
    padding: 15px 20px;
    cursor: pointer;
    background: var(--primary-light);
    transition: background 0.2s ease;
}

.toc-title:hover {
    background: var(--border);
}

.toc-content {
    padding: 15px 20px 20px;
}

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

.toc-item {
    margin-bottom: 8px;
    line-height: 1.5;
}

.toc-h2 {
    counter-increment: toc-counter;
}

.toc-h2::before {
    content: counter(toc-counter) ". ";
    color: var(--primary);
    font-weight: 600;
}

.toc-h3 {
    padding-left: 25px;
    font-size: 0.9em;
}

.toc-link {
    color: var(--text-main);
    text-decoration: none;
    transition: color 0.2s ease;
}

.toc-link:hover {
    color: var(--primary);
    text-decoration: underline;
}

/* Author Info in Header */
.article-author {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.author-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    flex-shrink: 0;
}

.author-info {
    display: flex;
    flex-direction: column;
}

.author-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-main);
}

/* Share Section */
.share-section {
    margin: 50px 0;
    padding: 30px;
    background: var(--bg-main);
    border-radius: var(--radius);
    text-align: center;
}

.share-title {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 20px;
    color: var(--text-main);
}

.share-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 25px;
    color: #fff !important;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.85rem;
    transition: transform 0.2s ease, opacity 0.2s ease;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.share-btn:hover {
    transform: translateY(-2px);
    opacity: 0.9;
    color: #fff;
    text-decoration: none;
}

.share-btn svg {
    flex-shrink: 0;
}

.share-twitter { background: #000; }
.share-facebook { background: #1877F2; }
.share-hatena { background: #00A4DE; }
.share-line { background: #00B900; }
.share-copy {
    background: var(--text-light);
    color: #fff;
}

/* Related Articles */
.related-articles {
    margin-top: 50px;
    padding-top: 40px;
    border-top: 1px solid var(--border);
}

.related-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 25px;
    padding-left: 15px;
    border-left: 4px solid var(--primary);
    color: var(--text-main);
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.related-card {
    display: block;
    text-decoration: none;
    color: inherit;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.related-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px var(--shadow);
}

.related-card-date {
    font-size: 0.8rem;
    color: var(--text-light);
    display: block;
    margin-bottom: 8px;
}

.related-card-title {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.5;
    color: var(--text-main);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.no-related {
    color: var(--text-light);
    font-size: 0.9rem;
    text-align: center;
    padding: 20px;
}

/* Article CTA */
.article-cta {
    margin: 40px 0;
    padding: 25px 30px;
    background: var(--primary-light);
    border: 2px solid var(--primary);
    border-radius: var(--radius);
    text-align: center;
}

.article-cta p {
    margin: 5px 0;
    font-size: 0.95rem;
    color: var(--text-main);
}

.article-cta a {
    color: var(--primary);
    font-weight: 600;
    text-decoration: underline;
}

.article-cta a:hover {
    color: var(--primary-dark);
}

/* Responsive adjustments for new features */
@media (max-width: 768px) {
    .breadcrumb-list {
        font-size: 0.8rem;
    }

    .article-meta {
        flex-direction: column;
        gap: 5px;
    }

    .toc-title {
        padding: 12px 15px;
    }

    .toc-content {
        padding: 12px 15px 15px;
    }

    .share-section {
        padding: 20px 15px;
    }

    .share-buttons {
        gap: 8px;
    }

    .share-btn {
        padding: 8px 14px;
        font-size: 0.8rem;
    }

    .share-btn span {
        display: none;
    }

    .related-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .article-author {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
}
