/* ============================================
   product-analysis/styles.css
   Combined styles for listing and article pages
   ============================================ */

/* ---------- Listing styles (pa-container, cards, filters, pagination) ---------- */
.pa-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 0;
}

h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: var(--primary-black);
}

.subhead {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border-soft);
    padding-bottom: 1rem;
}

.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.article-card {
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    padding: 20px;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid var(--border-soft);
}

.article-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Hero image inside card */
.article-card-image {
    margin: -20px -20px 16px -20px;
    overflow: hidden;
    border-radius: 12px 12px 0 0;
}

.article-card-image img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
}

.article-card h2 {
    font-size: 1.3rem;
    margin: 0 0 12px 0;
}

.article-card h2 a {
    text-decoration: none;
    color: var(--primary-black);
}

.article-card h2 a:hover {
    color: var(--accent-gold);
}

.meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.excerpt {
    color: var(--primary-black);
    line-height: 1.5;
    margin-bottom: 16px;
    opacity: 0.8;
}

.read-more {
    color: var(--accent-gold);
    text-decoration: none;
    font-weight: 600;
}

.read-more:hover {
    text-decoration: underline;
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 32px;
}

.pagination a,
.pagination span {
    padding: 8px 12px;
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    text-decoration: none;
    color: var(--primary-black);
    background: white;
}

.pagination .current {
    background: var(--accent-gold);
    color: white;
    border-color: var(--accent-gold);
}

.pagination a:hover {
    background: var(--bg-cream);
}

.category-filter {
    margin-bottom: 24px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.category-filter a {
    display: inline-block;
    background: var(--bg-card);
    padding: 6px 14px;
    border-radius: 20px;
    text-decoration: none;
    color: var(--primary-black);
    border: 1px solid var(--border-soft);
    transition: all 0.2s;
}

.category-filter a.active {
    background: var(--accent-gold);
    color: white;
    border-color: var(--accent-gold);
}

.category-filter a:hover {
    background: var(--bg-cream);
}

.footer-note {
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid var(--border-soft);
    text-align: center;
    color: var(--text-secondary);
}

/* ---------- Article-specific styles (wrapper, TOC, excerpt, related) ---------- */
.article-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px;
}

/* Dashed container for excerpt */
.excerpt-container {
    border: 3px dashed #009688;
    padding: 16px 20px;
    margin-bottom: 24px;
    font-style: italic;
    color: var(--text-secondary);
    background: transparent;
    border-radius: 0;
}

/* Desktop layout: sidebar + content */
.article-layout {
    display: flex;
    gap: 40px;
    position: relative;
}

/* Table of Contents Sidebar (Desktop) */
.toc-sidebar {
    flex: 0 0 260px;
    position: sticky;
    top: 20px;
    align-self: start;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}

.toc-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 16px;
    letter-spacing: -0.2px;
}

.toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.9rem;
}

.toc-list li {
    margin-bottom: 8px;
    line-height: 1.4;
}

.toc-list a {
    text-decoration: none;
    color: inherit;
    display: inline-block;
    padding: 2px 0;
}

.toc-list a:hover {
    text-decoration: underline;
}

/* Active TOC item: bold + underline */
.toc-list a.active {
    font-weight: bold;
    text-decoration: underline;
}

/* Indentation for h3 items */
.toc-list .toc-h3 {
    margin-left: 16px;
}

/* Main content area */
.article-main {
    flex: 1;
    min-width: 0;
}

h1 {
    font-size: 2.2rem;
    margin-bottom: 16px;
    color: var(--primary-black);
}

.article-meta {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-soft);
    padding-bottom: 16px;
}

.article-content {
    color: var(--primary-black);
}

/* Restore spacing for content elements overridden by global reset */
.article-content h2 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1.3;
    scroll-margin-top: 20px;
}

.article-content h3 {
    margin-top: 1.75rem;
    margin-bottom: 0.75rem;
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.3;
    scroll-margin-top: 20px;
}

.article-content h4 {
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    font-size: 1.25rem;
    font-weight: 600;
    scroll-margin-top: 20px;
}

.article-content p {
    margin-bottom: 1.5rem;
    line-height: 1.7;
}

.article-content ul,
.article-content ol {
    margin-bottom: 1.5rem;
    padding-left: 2rem;
}

.article-content li {
    margin-bottom: 0.5rem;
}

.article-content blockquote {
    margin: 2rem 0;
    padding: 1.5rem 2rem;
    background-color: #3aff42;
    border: 4px dashed #000000;
}

.article-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 2rem 0;
    display: block;
}

.article-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
}

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

.article-content th {
    background: var(--bg-cream);
}

.back-link {
    display: inline-block;
    margin-bottom: 20px;
    color: var(--accent-gold);
    text-decoration: none;
}

.back-link:hover {
    text-decoration: underline;
}

/* Related articles section – plain, no borders/shadows */
.related-articles {
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid var(--border-soft);
}

.related-articles h3 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    font-weight: 600;
}

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

.related-item {
    background: transparent;
    padding: 0;
}

.related-item a {
    text-decoration: none;
    color: var(--primary-black);
    font-weight: 500;
    display: block;
    margin-bottom: 6px;
}

.related-item a:hover {
    color: var(--accent-gold);
    text-decoration: underline;
}

.related-date {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Mobile TOC (collapsible) - hidden on desktop */
.mobile-toc {
    display: none;
    margin-bottom: 24px;
}

.mobile-toc-toggle {
    background: none;
    border: none;
    font-size: 1rem;
    font-weight: 600;
    padding: 10px 0;
    cursor: pointer;
    width: 100%;
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--primary-black);
}

.mobile-toc-toggle:after {
    content: "▼";
    font-size: 0.8rem;
    transition: transform 0.2s;
}

.mobile-toc-toggle.collapsed:after {
    transform: rotate(-90deg);
}

.mobile-toc-list {
    list-style: none;
    padding: 0 0 0 16px;
    margin: 12px 0 0 0;
    border-left: none;
    max-height: 300px;
    overflow-y: auto;
}

.mobile-toc-list li {
    margin-bottom: 8px;
}

.mobile-toc-list a {
    text-decoration: none;
    color: inherit;
    display: block;
    padding: 4px 0;
}

.mobile-toc-list a.active {
    font-weight: bold;
    text-decoration: underline;
}

.mobile-toc-list .toc-h3 {
    margin-left: 16px;
}

/* ---------- Responsive (mobile) ---------- */
@media (max-width: 768px) {
    .articles-grid {
        grid-template-columns: 1fr;
    }
    .article-card-image img {
        height: 160px;
    }
    .article-wrapper {
        padding: 20px;
    }
    .article-layout {
        flex-direction: column;
        gap: 0;
    }
    .toc-sidebar {
        display: none;
    }
    .mobile-toc {
        display: block;
    }
    h1 {
        font-size: 1.6rem;
    }
    .article-content h2 {
        font-size: 1.5rem;
    }
    .article-content h3 {
        font-size: 1.3rem;
    }
    .related-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}