/**
 * AI to WP Converter - Article Template
 *
 * A reading-first blog post design. Everything here is driven by the
 * plugin's Global Colors & Fonts (--ais-color-* / --ais-font-*), so posts
 * automatically match the brand of the imported site instead of looking
 * like a different website.
 *
 * Typography choices are deliberate, not decorative:
 *  - ~68 character measure, which is the range where reading speed and
 *    comprehension hold up best over long articles
 *  - 1.75 body line-height for comfortable vertical rhythm
 *  - fluid type via clamp() so it stays readable from phone to desktop
 *  - generous spacing before headings, tight after, so sections group
 *    visually instead of floating
 *
 * By Imran Khadim - https://imrankhadim.com
 */

.ais-article-root {
    --ais-article-max: 720px;
    --ais-article-wide: 1080px;
    --ais-article-text: var(--ais-color-text, #27303f);
    --ais-article-muted: var(--ais-color-muted, #6b7280);
    --ais-article-accent: var(--ais-color-primary, #f97316);
    --ais-article-bg: var(--ais-color-background, #ffffff);
    --ais-article-border: var(--ais-color-border, #e5e7eb);
    --ais-article-surface: #f8fafc;

    background: var(--ais-article-bg);
    color: var(--ais-article-text);
    font-family: var(--ais-font-body, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);
    font-size: clamp(1.05rem, 0.98rem + 0.35vw, 1.19rem);
    line-height: 1.75;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* ==========================================================================
   Reading progress
   ========================================================================== */
.ais-reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0;
    background: var(--ais-article-accent);
    z-index: 9999;
    transition: width 0.1s linear;
}

/* ==========================================================================
   Layout
   ========================================================================== */
.ais-article-shell {
    max-width: var(--ais-article-wide);
    margin: 0 auto;
    padding: 0 20px 80px;
}

.ais-article-header {
    max-width: var(--ais-article-max);
    margin: 0 auto;
    padding: clamp(40px, 6vw, 72px) 0 0;
}

.ais-article-body {
    max-width: var(--ais-article-max);
    margin: 0 auto;
}

/* Let images and embeds break out of the text column for emphasis. */
.ais-article-body .alignwide,
.ais-article-body .alignfull {
    max-width: var(--ais-article-wide);
    width: auto;
    margin-left: calc(50% - min(var(--ais-article-wide), 100vw - 40px) / 2);
    margin-right: calc(50% - min(var(--ais-article-wide), 100vw - 40px) / 2);
}

/* ==========================================================================
   Title block
   ========================================================================== */
.ais-article-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ais-article-accent);
    margin-bottom: 18px;
}

.ais-article-title {
    font-family: var(--ais-font-h1, inherit);
    font-size: clamp(2.1rem, 1.4rem + 2.9vw, 3.4rem);
    line-height: 1.14;
    letter-spacing: -0.021em;
    font-weight: 800;
    margin: 0 0 20px;
    color: var(--ais-color-secondary, #111827);
    text-wrap: balance;
}

.ais-article-excerpt {
    font-size: clamp(1.15rem, 1.05rem + 0.45vw, 1.35rem);
    line-height: 1.6;
    color: var(--ais-article-muted);
    margin: 0 0 28px;
    text-wrap: pretty;
}

.ais-article-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 18px;
    padding-bottom: 28px;
    border-bottom: 1px solid var(--ais-article-border);
    font-size: 0.92rem;
    color: var(--ais-article-muted);
}

.ais-article-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.ais-article-meta svg {
    flex-shrink: 0;
    opacity: 0.75;
}

.ais-article-author-avatar img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: block;
}

.ais-article-featured {
    margin: 36px 0 8px;
}

.ais-article-featured img {
    width: 100%;
    height: auto;
    border-radius: 14px;
    display: block;
}

/* ==========================================================================
   Article content
   ========================================================================== */
.ais-article-body > * {
    margin-top: 1.5em;
    margin-bottom: 0;
}

.ais-article-body > *:first-child {
    margin-top: 2em;
}

.ais-article-body p {
    text-wrap: pretty;
}

.ais-article-body h2,
.ais-article-body h3,
.ais-article-body h4 {
    color: var(--ais-color-secondary, #111827);
    line-height: 1.25;
    letter-spacing: -0.014em;
    text-wrap: balance;
    /* Space above groups a heading with the section it introduces. */
    margin-top: 2.1em;
    margin-bottom: 0.55em;
    scroll-margin-top: 90px;
}

.ais-article-body h2 {
    font-family: var(--ais-font-h2, inherit);
    font-size: clamp(1.6rem, 1.35rem + 1vw, 2.1rem);
    font-weight: 750;
}

.ais-article-body h3 {
    font-family: var(--ais-font-h3, inherit);
    font-size: clamp(1.32rem, 1.2rem + 0.55vw, 1.6rem);
    font-weight: 700;
}

.ais-article-body h4 {
    font-size: 1.16rem;
    font-weight: 700;
}

.ais-article-body a {
    color: var(--ais-article-accent);
    text-decoration: underline;
    text-underline-offset: 0.18em;
    text-decoration-thickness: 0.08em;
    transition: opacity 0.15s;
}

.ais-article-body a:hover {
    opacity: 0.75;
}

.ais-article-body strong {
    font-weight: 700;
    color: var(--ais-color-secondary, #111827);
}

.ais-article-body ul,
.ais-article-body ol {
    padding-left: 1.4em;
}

.ais-article-body li {
    margin-bottom: 0.6em;
    padding-left: 0.2em;
}

.ais-article-body li::marker {
    color: var(--ais-article-accent);
}

.ais-article-body img,
.ais-article-body video,
.ais-article-body iframe {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    display: block;
}

.ais-article-body figure {
    margin-left: 0;
    margin-right: 0;
}

.ais-article-body figcaption {
    font-size: 0.88rem;
    color: var(--ais-article-muted);
    text-align: center;
    margin-top: 10px;
}

.ais-article-body blockquote {
    margin-left: 0;
    margin-right: 0;
    padding: 4px 0 4px 24px;
    border-left: 3px solid var(--ais-article-accent);
    font-size: 1.16em;
    line-height: 1.6;
    color: var(--ais-color-secondary, #111827);
}

.ais-article-body blockquote p {
    margin: 0 0 0.5em;
}

.ais-article-body blockquote cite {
    display: block;
    font-size: 0.85rem;
    font-style: normal;
    color: var(--ais-article-muted);
}

.ais-article-body pre {
    background: #111827;
    color: #e5e7eb;
    padding: 18px 20px;
    border-radius: 10px;
    overflow-x: auto;
    font-size: 0.88rem;
    line-height: 1.6;
}

.ais-article-body code {
    font-family: Consolas, Monaco, "Courier New", monospace;
    font-size: 0.88em;
    background: var(--ais-article-surface);
    padding: 0.15em 0.4em;
    border-radius: 4px;
}

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

.ais-article-body hr {
    border: none;
    border-top: 1px solid var(--ais-article-border);
    margin: 2.6em 0;
}

.ais-article-body table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
    display: block;
    overflow-x: auto;
}

.ais-article-body th,
.ais-article-body td {
    border: 1px solid var(--ais-article-border);
    padding: 10px 14px;
    text-align: left;
}

.ais-article-body th {
    background: var(--ais-article-surface);
    font-weight: 700;
}

/* ==========================================================================
   Table of contents
   ========================================================================== */
.ais-article-toc {
    background: var(--ais-article-surface);
    border: 1px solid var(--ais-article-border);
    border-radius: 12px;
    padding: 20px 24px;
    margin: 36px 0 0;
}

.ais-article-toc-title {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ais-article-muted);
    margin-bottom: 12px;
}

.ais-article-toc ol {
    margin: 0;
    padding-left: 1.1em;
    font-size: 0.96rem;
    line-height: 1.5;
}

.ais-article-toc li {
    margin-bottom: 0.45em;
}

.ais-article-toc li.is-sub {
    margin-left: 0.9em;
    list-style-type: none;
    font-size: 0.92rem;
}

.ais-article-toc a {
    color: var(--ais-article-text);
    text-decoration: none;
}

.ais-article-toc a:hover {
    color: var(--ais-article-accent);
    text-decoration: underline;
}

/* ==========================================================================
   Footer: author box + share
   ========================================================================== */
.ais-article-footer {
    max-width: var(--ais-article-max);
    margin: 56px auto 0;
    padding-top: 32px;
    border-top: 1px solid var(--ais-article-border);
}

.ais-author-box {
    display: flex;
    gap: 18px;
    align-items: flex-start;
    background: var(--ais-article-surface);
    border-radius: 14px;
    padding: 22px 24px;
}

.ais-author-box img {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    flex-shrink: 0;
}

.ais-author-name {
    font-weight: 700;
    color: var(--ais-color-secondary, #111827);
    margin-bottom: 4px;
}

.ais-author-bio {
    font-size: 0.94rem;
    color: var(--ais-article-muted);
    line-height: 1.6;
    margin: 0;
}

.ais-share-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 28px;
}

.ais-share-label {
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ais-article-muted);
    margin-right: 4px;
}

.ais-share-link {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid var(--ais-article-border);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--ais-article-muted);
    text-decoration: none;
    transition: all 0.18s;
}

.ais-share-link:hover {
    background: var(--ais-article-accent);
    border-color: var(--ais-article-accent);
    color: #ffffff;
    transform: translateY(-2px);
}

/* ==========================================================================
   Small screens
   ========================================================================== */
@media (max-width: 640px) {
    .ais-article-shell {
        padding: 0 18px 56px;
    }

    .ais-article-body blockquote {
        padding-left: 18px;
    }

    .ais-author-box {
        flex-direction: column;
        gap: 14px;
    }
}

/* Respect reduced-motion preferences. */
@media (prefers-reduced-motion: reduce) {
    .ais-reading-progress,
    .ais-share-link {
        transition: none;
    }
}

/* Print: strip the chrome, keep the words. */
@media print {
    .ais-reading-progress,
    .ais-share-row,
    .ais-article-toc {
        display: none !important;
    }

    .ais-article-root {
        font-size: 11.5pt;
    }
}
