/**
 * Auto Blog AI - Frontend Blog Post Styling
 *
 * Only loaded on posts with _abai_generated meta.
 * All rules scoped under .abai-post to avoid theme conflicts.
 */

/* ── Wrapper ── */
.abai-post {
    --abai-accent: #2563eb;
    --abai-accent-light: #dbeafe;
    --abai-text: #1e293b;
    --abai-text-light: #64748b;
    --abai-bg-subtle: #f8fafc;
    --abai-border: #e2e8f0;
    --abai-radius: 8px;

    font-size: 1.125rem;
    line-height: 1.8;
    color: var(--abai-text);
    max-width: 780px;
    margin: 0 auto;
}

/* ── Typography ── */
.abai-post h2 {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.3;
    margin: 2.5rem 0 1rem;
    color: var(--abai-text);
    position: relative;
    padding-bottom: 0.5rem;
}

.abai-post h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 48px;
    height: 3px;
    background: var(--abai-accent);
    border-radius: 2px;
}

.abai-post h3 {
    font-size: 1.35rem;
    font-weight: 600;
    line-height: 1.4;
    margin: 2rem 0 0.75rem;
    color: var(--abai-text);
}

.abai-post p {
    margin: 0 0 1.25rem;
}

.abai-post p:first-child {
    font-size: 1.2rem;
    color: var(--abai-text-light);
    line-height: 1.7;
}

.abai-post strong {
    font-weight: 600;
    color: var(--abai-text);
}

/* ── Links ── */
.abai-post a {
    color: var(--abai-accent);
    text-decoration: underline;
    text-decoration-color: rgba(37, 99, 235, 0.3);
    text-underline-offset: 3px;
    transition: text-decoration-color 0.2s ease;
}

.abai-post a:hover {
    text-decoration-color: var(--abai-accent);
}

/* ── Lists ── */
.abai-post ul,
.abai-post ol {
    margin: 1rem 0 1.5rem;
    padding-left: 1.5rem;
}

.abai-post ul {
    list-style: none;
    padding-left: 0;
}

.abai-post ul li {
    position: relative;
    padding-left: 1.5rem;
    margin-bottom: 0.6rem;
}

.abai-post ul li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.7em;
    width: 6px;
    height: 6px;
    background: var(--abai-accent);
    border-radius: 50%;
}

.abai-post ol li {
    margin-bottom: 0.6rem;
    padding-left: 0.25rem;
}

.abai-post ol li::marker {
    color: var(--abai-accent);
    font-weight: 600;
}

/* ── Blockquotes ── */
.abai-post blockquote {
    margin: 1.5rem 0;
    padding: 1.25rem 1.5rem;
    background: var(--abai-bg-subtle);
    border-left: 4px solid var(--abai-accent);
    border-radius: 0 var(--abai-radius) var(--abai-radius) 0;
    font-style: italic;
    color: var(--abai-text-light);
}

.abai-post blockquote p:last-child {
    margin-bottom: 0;
}

/* ── Featured Image (post thumbnail, rendered by theme outside .abai-post) ── */
.abai-generated-post .post-thumbnail img,
.abai-generated-post .wp-post-image,
.abai-generated-post article > .wp-post-image,
.abai-generated-post .entry-header img,
.abai-generated-post [class*="featured"] img,
.abai-generated-post .attachment-post-thumbnail {
    max-height: 400px;
    max-width: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    margin-left: auto;
    margin-right: auto;
    border-radius: 8px;
}

/* ── Images ── */
.abai-post img {
    max-width: 100%;
    height: auto;
    border-radius: var(--abai-radius);
    margin: 1.5rem 0;
}

.abai-post figure {
    margin: 2rem 0;
}

.abai-post figcaption {
    font-size: 0.875rem;
    color: var(--abai-text-light);
    text-align: center;
    margin-top: 0.5rem;
}

/* ── Tables ── */
.abai-post table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 1rem;
}

.abai-post th {
    background: var(--abai-bg-subtle);
    font-weight: 600;
    text-align: left;
    padding: 0.75rem 1rem;
    border-bottom: 2px solid var(--abai-border);
}

.abai-post td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--abai-border);
}

.abai-post tr:hover td {
    background: var(--abai-bg-subtle);
}

/* ── Horizontal rule ── */
.abai-post hr {
    border: none;
    height: 1px;
    background: var(--abai-border);
    margin: 2.5rem 0;
}

/* ── Table of Contents (if theme injects one) ── */
.abai-post .wp-block-table-of-contents,
.abai-post .toc,
.abai-post [class*="table-of-contents"] {
    background: var(--abai-bg-subtle);
    border: 1px solid var(--abai-border);
    border-radius: var(--abai-radius);
    padding: 1.25rem 1.5rem;
    margin: 1.5rem 0 2rem;
}

/* ── Pexels photo credit ── */
.abai-post .abai-photo-credit {
    font-size: 0.8rem;
    color: var(--abai-text-light);
    text-align: right;
    margin-top: -1rem;
    margin-bottom: 1.5rem;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .abai-post {
        font-size: 1rem;
        line-height: 1.7;
    }

    .abai-post h2 {
        font-size: 1.5rem;
        margin-top: 2rem;
    }

    .abai-post h3 {
        font-size: 1.2rem;
    }

    .abai-post p:first-child {
        font-size: 1.05rem;
    }

    .abai-post blockquote {
        padding: 1rem 1.25rem;
    }
}
