/**
 * Frontend styles for posts generated by AI Post Generator.
 * Loaded only on singular posts flagged with _wp_ai_post_generated.
 *
 * Scopes:
 *   - .wp-ai-post-inline-image : mid-post AI-generated figure
 *   - .wp-ai-post-toc          : auto table of contents
 *   - .wp-ai-post-cta          : closing call-to-action block
 */

/* ---- Inline image (mid-post) ---- */
.wp-ai-post-inline-image {
    margin: 2.25em auto;
    max-width: 100%;
    text-align: center;
}

.wp-ai-post-inline-image img {
    display: block;
    margin: 0 auto;
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 6px 24px rgba(15, 23, 42, 0.12);
}

.wp-ai-post-inline-image figcaption {
    margin-top: 0.75em;
    font-size: 0.9em;
    color: #64748b;
    font-style: italic;
    line-height: 1.4;
}

/* ---- Table of contents ---- */
.wp-ai-post-toc {
    margin: 1.5em 0 2em;
    padding: 1.1em 1.3em;
    background: #f8fafc;
    border-left: 4px solid #2563eb;
    border-radius: 6px;
}

.wp-ai-post-toc__title {
    margin: 0 0 0.5em;
    font-size: 1.05em;
    font-weight: 600;
    color: #0f172a;
    letter-spacing: 0.01em;
    text-transform: uppercase;
}

.wp-ai-post-toc ol,
.wp-ai-post-toc ul {
    margin: 0;
    padding-left: 1.2em;
}

.wp-ai-post-toc li {
    margin: 0.2em 0;
    line-height: 1.45;
}

.wp-ai-post-toc a {
    color: #1e40af;
    text-decoration: none;
    border-bottom: 1px dotted rgba(30, 64, 175, 0.4);
    transition: color 0.15s ease;
}

.wp-ai-post-toc a:hover,
.wp-ai-post-toc a:focus {
    color: #1d4ed8;
    border-bottom-color: #1d4ed8;
}

/* ---- Call-to-action block ---- */
.wp-ai-post-cta {
    margin: 2.5em 0 1em;
    padding: 1.6em 1.75em;
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    color: #f8fafc;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(37, 99, 235, 0.25);
}

.wp-ai-post-cta__title {
    margin: 0 0 0.5em;
    font-size: 1.35em;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.25;
}

.wp-ai-post-cta__body {
    margin: 0;
    font-size: 1em;
    line-height: 1.55;
    color: rgba(248, 250, 252, 0.94);
}

/* Smooth scrolling for TOC anchors */
html {
    scroll-behavior: smooth;
}

/* ---- General post typography ---- */
.wp-ai-post-generated h2 {
    margin: 2.5em 0 1.2em;
    font-size: 1.75em;
    font-weight: 700;
    line-height: 1.25;
    color: #0f172a;
    position: relative;
    padding-bottom: 0.5em;
}

.wp-ai-post-generated h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, #2563eb, #1e40af);
    border-radius: 2px;
}

.wp-ai-post-generated ul,
.wp-ai-post-generated ol {
    margin: 1.5em 0;
    padding-left: 1.8em;
}

.wp-ai-post-generated li {
    margin: 0.6em 0;
    line-height: 1.6;
}

.wp-ai-post-generated blockquote {
    margin: 2em 0;
    padding: 1em 1.5em;
    border-left: 5px solid #2563eb;
    background: #f8fafc;
    font-style: italic;
    color: #475569;
    border-radius: 0 6px 6px 0;
}

.wp-ai-post-generated code {
    background: #f1f5f9;
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    font-size: 0.9em;
    color: #1e293b;
}

.wp-ai-post-generated pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 1.2em;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1.5em 0;
}

.wp-ai-post-generated pre code {
    background: transparent;
    padding: 0;
    color: inherit;
}

.wp-ai-post-generated table {
    width: 100%;
    border-collapse: collapse;
    margin: 2em 0;
    font-size: 0.95em;
}

.wp-ai-post-generated th,
.wp-ai-post-generated td {
    padding: 0.8em 1em;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.wp-ai-post-generated th {
    background: #f8fafc;
    font-weight: 600;
    color: #374151;
}

.wp-ai-post-generated tbody tr:hover {
    background: #f8fafc;
}

/* Respect reduced-motion */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}
