/* Page styles for templates/article_detail.html (moved out of the template, issue #96) */
.header {
    padding: 2rem;
    background: linear-gradient(180deg, var(--ocean-dark) 0%, var(--ocean-abyss) 100%);
    border-bottom: 1px solid var(--card-border);
}

.main {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
}

.back-link:hover {
    color: var(--ocean-glow);
}

.article-header {
    margin-bottom: 2rem;
}

.article-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.article-category-tag {
    background: var(--ocean-glow);
    color: var(--on-accent);
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    text-decoration: none;
}

a.article-category-tag:hover {
    opacity: 0.85;
}

.article-meta-separator {
    color: var(--text-muted);
    opacity: 0.4;
}

.article-header h1 {
    font-size: 2rem;
    color: var(--text-primary);
    margin: 0 0 0.75rem 0;
    line-height: 1.3;
}

.article-excerpt {
    font-size: 1.1rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
    border-left: 3px solid var(--ocean-glow);
    padding-left: 1rem;
}

.article-featured-image {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;  /* reserves the space before the image loads (#137) */
    border-radius: 12px;
    margin-bottom: 2rem;
    max-height: 500px;
    object-fit: cover;
}

/* Article content (rendered Markdown) */
.article-content {
    line-height: 1.8;
    color: var(--text-primary);
    font-size: 1rem;
}

.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4 {
    color: var(--text-primary);
    margin-top: 2rem;
    margin-bottom: 0.75rem;
}

.article-content h2 {
    font-size: 1.5rem;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 0.5rem;
}

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

.article-content p {
    margin: 0 0 1.25rem 0;
}

.article-content a {
    color: var(--ocean-glow);
}

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

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

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

.article-content blockquote {
    border-left: 3px solid var(--ocean-glow);
    margin: 1.5rem 0;
    padding: 0.75rem 1rem;
    background: var(--card-bg);
    border-radius: 0 8px 8px 0;
    color: var(--text-secondary);
}

.article-content pre {
    background: var(--ocean-abyss);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 1rem;
    overflow-x: auto;
    margin: 1.25rem 0;
}

.article-content code {
    background: var(--ocean-abyss);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.9em;
}

.article-content pre code {
    background: none;
    padding: 0;
}

.article-content img {
    max-width: 100%;
    border-radius: 8px;
}

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

.article-content th,
.article-content td {
    border: 1px solid var(--card-border);
    padding: 0.5rem 0.75rem;
    text-align: left;
}

.article-content th {
    background: var(--card-bg);
    font-weight: 600;
}

.article-content hr {
    border: none;
    border-top: 1px solid var(--card-border);
    margin: 2rem 0;
}

/* Responsive video embeds */
.article-content .video-embed {
    position: relative;
    margin: 1.5rem 0;
}

.article-content iframe {
    max-width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 8px;
}

/* Share buttons */
.share-buttons {
    display: flex;
    gap: 0.75rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--card-border);
}

/* Tags */
.article-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 1.5rem;
}

.article-tag {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: border-color 0.2s, color 0.2s;
}

a.article-tag:hover {
    border-color: var(--ocean-glow);
    color: var(--ocean-glow);
}

/* Related articles */
.related-articles {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--card-border);
}

.related-articles h2 {
    font-size: 1.25rem;
    color: var(--text-primary);
    margin: 0 0 1.25rem 0;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.related-card {
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.2s, translate 0.2s;
    translate: 0px;  /* keeps the stacking context the same on hover (#168) */
}

.related-card:hover {
    border-color: var(--ocean-glow);
}
@media (prefers-reduced-motion: no-preference) { .related-card:hover { translate: 0 -2px; } }

.related-card-image {
    width: 100%;
    height: 120px;
    object-fit: cover;
    background: var(--ocean-dark);
}

.related-card-placeholder {
    width: 100%;
    height: 120px;
    background: linear-gradient(135deg, var(--ocean-dark), var(--ocean-abyss));
    display: flex;
    align-items: center;
    justify-content: center;
}

.related-card-placeholder svg {
    width: 32px;
    height: 32px;
    color: var(--text-muted);
    opacity: 0.4;
}

.related-card-body {
    padding: 0.75rem;
}

.related-card-category {
    background: var(--ocean-glow);
    color: var(--on-accent);
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    display: inline-block;
    margin-bottom: 0.375rem;
}

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

@media (max-width: 768px) {
    .main {
        padding: 1rem;
    }
    .article-header h1 {
        font-size: 1.5rem;
    }
    .share-buttons {
        flex-wrap: wrap;
    }
    .related-grid {
        grid-template-columns: 1fr;
    }
}

/* Keep long-form lines near 65 characters; the 800px container would otherwise
   run to about 90 on desktop (#165). */
.article-content p,
.article-content li,
.article-content blockquote {
    max-width: 65ch;
}
