/* ══════════════════════════════════════════════════════════════
   LovBot Blog — Shared Styles
   Include via: <link rel="stylesheet" href="blog-shared.css">
   Also requires: <link rel="stylesheet" href="shared.css">
   ══════════════════════════════════════════════════════════════ */

/* ── Design Tokens ─────────────────────────────────────────── */
:root {
    --primary: #6366F1;
    --accent: #22D3EE;
    --dark-bg: #0F172A;
    --fg: #F8FAFC;
    --text-primary: #1E293B;
    --text-secondary: #64748B;
    --border: #E2E8F0;
    --border-light: #E2E8F0;
    --bg-secondary: #F1F5F9;
    --bg-light: #F8FAFC;
    --bg-tertiary: #F8FAFC;
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
}

/* ── Reset & Base (scoped to article content, not nav/footer) ── */
.article-layout *,
.article-layout *::before,
.article-layout *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--text-primary);
    line-height: 1.6;
    background-color: #FFFFFF;
}

/* Nav & footer — let components.js handle styling */
#footer-root {
    margin-top: 80px;
}

/* ── Blog Hero ─────────────────────────────────────────────── */
.blog-hero {
    background: linear-gradient(135deg, #F8FAFC 0%, #EEF2FF 100%);
    padding: 60px 20px;
    margin-bottom: 60px;
    position: relative;
    overflow: hidden;
}

/* Decorative branded blob — shows as visual anchor when there's no hero image.
   Automatically hidden when a .blog-hero-image element is present. */
.blog-hero::before {
    content: '';
    position: absolute;
    top: -120px;
    right: -160px;
    width: 520px;
    height: 520px;
    background:
        radial-gradient(circle at 30% 30%, rgba(99, 102, 241, 0.18) 0%, transparent 55%),
        radial-gradient(circle at 70% 65%, rgba(34, 211, 238, 0.15) 0%, transparent 50%);
    filter: blur(4px);
    pointer-events: none;
    z-index: 0;
}

.blog-hero::after {
    content: '';
    position: absolute;
    bottom: -60px;
    left: -60px;
    width: 220px;
    height: 220px;
    background: radial-gradient(circle, rgba(34, 211, 238, 0.10) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

/* When a real image lands in the hero, dial down the decoration so it
   doesn't compete with the image. */
.blog-hero:has(.blog-hero-image)::before {
    opacity: 0.45;
}
.blog-hero:has(.blog-hero-image)::after {
    display: none;
}

.blog-hero-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 48px;
    position: relative;
    z-index: 1;
}

.blog-hero-text {
    flex: 1;
    min-width: 0;
}

.blog-hero-tag {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--primary);
    background: rgba(99, 102, 241, 0.08);
    border-radius: 999px;
    padding: 5px 14px;
    margin-bottom: 16px;
}

.blog-hero h1 {
    font-family: 'Sora', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 42px;
    font-weight: 700;
    line-height: 1.2;
    color: var(--dark-bg);
    margin-bottom: 16px;
}

.blog-hero-desc {
    font-size: 17px;
    line-height: 1.7;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.blog-hero-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 4px;
}

.reading-time {
    display: inline-block;
    background: var(--primary);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.blog-hero-image {
    flex-shrink: 0;
    width: 280px;
    height: 280px;
    border-radius: 20px;
    overflow: hidden;
    /* Branded fallback when img fails to load or is missing.
       The gradient + soft shadow keeps the slot looking intentional instead of broken. */
    background:
        radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.9) 0%, transparent 55%),
        linear-gradient(135deg, #6366F1 0%, #22D3EE 100%);
    box-shadow: 0 10px 30px -10px rgba(99, 102, 241, 0.35);
    position: relative;
}

/* Tiny LovBot-style mark shown in the fallback state (hidden when img loads) */
.blog-hero-image:empty::before,
.blog-hero-image:has(img[src=""])::before,
.blog-hero-image:has(img:not([src]))::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 120'><g fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round' opacity='0.85'><circle cx='60' cy='66' r='28' fill='white' fill-opacity='0.18'/><circle cx='50' cy='62' r='3.5' fill='white'/><circle cx='70' cy='62' r='3.5' fill='white'/><path d='M 50 76 Q 60 82 70 76'/><line x1='60' y1='34' x2='60' y2='42'/><path d='M 55 30 Q 60 24 65 30 Q 60 34 55 30 Z' fill='white'/><rect x='48' y='86' width='24' height='10' rx='3' fill='white' fill-opacity='0.2'/></g></svg>");
    background-position: center;
    background-repeat: no-repeat;
    background-size: 70%;
}

.blog-hero-image img {
    width: 110%;
    height: 110%;
    object-fit: cover;
    object-position: center 10%;
    margin-left: -5%;
    display: block;
    position: relative;
    z-index: 1;
}

/* Hide broken-image icon if src 404s */
.blog-hero-image img:not([src]),
.blog-hero-image img[src=""] {
    display: none;
}

/* ── Article Layout with Sidebar TOC ───────────────────────── */
.article-layout {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    gap: 60px;
}

.toc-sidebar {
    width: 240px;
    flex-shrink: 0;
    position: relative;
}

.toc-sidebar .toc-inner {
    position: sticky;
    top: 90px;
    padding: 20px 0;
}

.toc-sidebar .toc-back {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    margin-bottom: 12px;
    transition: color 0.2s;
}

.toc-sidebar .toc-back:hover {
    color: var(--primary);
}

.toc-sidebar .toc-inner h3 {
    font-family: 'Sora', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    margin-bottom: 16px;
    margin-top: 0;
}

.toc-sidebar .toc-inner ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.toc-sidebar .toc-inner li {
    margin-bottom: 0;
}

.toc-sidebar .toc-inner a {
    display: block;
    padding: 8px 0 8px 16px;
    font-size: 14px;
    color: var(--text-secondary);
    text-decoration: none;
    border-left: 2px solid var(--border);
    transition: all 0.2s;
    line-height: 1.4;
}

.toc-sidebar .toc-inner a:hover {
    color: var(--primary);
}

.toc-sidebar .toc-inner a.active {
    color: var(--primary);
    border-left-color: var(--primary);
    font-weight: 600;
}

.article-main {
    flex: 1;
    min-width: 0;
}

/* ── Article Typography ────────────────────────────────────── */
article {
    line-height: 1.8;
    font-size: 16px;
    color: var(--text-primary);
}

article h2,
.article-layout h2 {
    font-family: 'Sora', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 32px;
    font-weight: 700;
    margin: 50px 0 25px 0;
    color: var(--dark-bg);
    padding-top: 40px;
    scroll-margin-top: 80px;
}

.article-layout h3 {
    font-family: 'Sora', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 22px;
    font-weight: 600;
    margin: 35px 0 18px 0;
    color: var(--dark-bg);
}

.article-layout p {
    margin-bottom: 20px;
    color: var(--text-primary);
    line-height: 1.8;
}

.article-layout ul, .article-layout ol {
    margin: 20px 0 20px 30px;
}

.article-layout li {
    margin-bottom: 12px;
    color: var(--text-primary);
    line-height: 1.8;
}

.article-layout strong {
    color: var(--primary);
    font-weight: 600;
}

.article-layout a:not(.cta-button) {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s;
}

.article-layout a:not(.cta-button):hover {
    color: var(--primary);
    text-decoration: underline;
}

/* ── Callout / Highlight Boxes ─────────────────────────────── */
.callout,
.callout-box {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, rgba(34, 211, 238, 0.05) 100%);
    border-left: 4px solid var(--primary);
    padding: 25px;
    margin: 30px 0;
    border-radius: 8px;
    font-size: 15px;
    line-height: 1.7;
}

.callout strong,
.callout-box strong {
    color: var(--primary);
}

/* First heading inside a callout shouldn't add extra top space */
.callout > h3:first-child,
.callout > h4:first-child,
.callout-box > h3:first-child,
.callout-box > h4:first-child {
    margin-top: 0;
}

.callout-warning,
.callout-box.callout-warning {
    border-left-color: var(--warning);
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.05) 0%, rgba(249, 115, 22, 0.03) 100%);
}

.callout-success {
    border-left-color: var(--success);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.05) 0%, rgba(16, 185, 129, 0.03) 100%);
}

/* ── Blockquote ────────────────────────────────────────────── */
.article-layout blockquote {
    border-left: 4px solid var(--accent);
    padding-left: 25px;
    margin: 30px 0;
    font-style: italic;
    color: var(--text-secondary);
    font-size: 17px;
}

/* ── Section Backgrounds ───────────────────────────────────── */
.section-light {
    background: #FFFFFF;
}

.section-grey {
    background: var(--bg-tertiary);
    padding: 60px 20px;
    margin: 60px 0;
}

.section-grey > * {
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
}

/* ── Table ─────────────────────────────────────────────────── */
.article-layout table {
    width: 100%;
    border-collapse: collapse;
    margin: 30px 0;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.article-layout table th {
    background: var(--primary);
    color: white;
    padding: 15px;
    text-align: left;
    font-weight: 600;
    font-family: 'Sora', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.article-layout table td {
    padding: 15px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    color: var(--text-primary);
}

.article-layout table tr:last-child td {
    border-bottom: none;
}

.article-layout table tr:nth-child(even) {
    background: var(--bg-tertiary);
}

.table-box {
    background-color: #FFFFFF;
    border-radius: 8px;
    overflow: hidden;
    margin: 24px 0;
    border: 1px solid var(--border);
}

.table-box table {
    box-shadow: none;
    margin: 0;
}

/* ── Checklist ─────────────────────────────────────────────── */
.checklist {
    background: var(--bg-secondary);
    padding: 30px;
    border-radius: 8px;
    margin: 30px 0;
}

.checklist-item {
    display: flex;
    gap: 16px;
    margin-bottom: 15px;
    align-items: flex-start;
}

.checklist-item:last-child {
    margin-bottom: 0;
}

.checklist-check,
.checklist-number {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    margin-top: 2px;
}

.checklist-text,
.checklist-content {
    flex: 1;
}

.checklist-text strong,
.checklist-content strong {
    color: var(--dark-bg);
}

.checklist-text p,
.checklist-content p {
    margin: 5px 0;
    font-size: 15px;
}

/* ── CTA Section ───────────────────────────────────────────── */
.cta-section,
.cta-box {
    background: linear-gradient(135deg, #EEF2FF 0%, #F0F9FF 100%);
    color: var(--dark-bg);
    padding: 50px 30px;
    border-radius: 12px;
    text-align: center;
    margin: 60px 0;
}

.cta-section h3,
.cta-box h3 {
    color: var(--dark-bg);
    margin-top: 0;
    font-size: 28px;
}

.cta-section h2,
.cta-box h2 {
    color: var(--dark-bg);
    margin-top: 0;
}

.cta-section p,
.cta-box p {
    font-size: 16px;
    margin: 15px 0 25px 0;
    color: var(--text-primary);
}

.cta-button {
    display: inline-block;
    background: var(--primary);
    color: white;
    padding: 14px 32px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: transform 0.2s, box-shadow 0.2s;
    border: none;
    cursor: pointer;
    font-size: 16px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(99, 102, 241, 0.3);
    text-decoration: none;
    color: white;
}

/* ── SVG Icons ─────────────────────────────────────────────── */
.svg-icon {
    display: inline-block;
    width: 24px;
    height: 24px;
    vertical-align: middle;
}

.svg-section {
    width: 100%;
    max-width: 500px;
    margin: 30px auto;
    display: flex;
    justify-content: center;
}

/* ── Author Info ───────────────────────────────────────────── */
.author-info {
    background: var(--bg-secondary);
    padding: 30px;
    border-radius: 8px;
    margin-top: 60px;
    border-left: 4px solid var(--accent);
}

.author-info strong {
    color: var(--dark-bg);
    display: block;
    margin-bottom: 8px;
}

.author-info p {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 5px 0;
}

/* ── CTA Badges (feature badges in CTA sections) ─────────── */
.cta-badge-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin: 24px 0;
}

.cta-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(99, 102, 241, 0.08);
    border-radius: 999px;
    padding: 8px 16px;
    font-size: 14px;
    color: var(--text-primary);
}

.cta-badge svg {
    flex-shrink: 0;
}

/* ── Inline checkbox list (no bullets) ─────────────────────── */
.checkbox-list {
    list-style: none;
    padding-left: 0;
}

.checkbox-list li {
    padding-left: 4px;
}

/* ── Article Disclaimer ───────────────────────────────────── */
.article-disclaimer {
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-secondary);
    text-align: center;
    font-style: italic;
}

/* ── Info Callout (blue variant) ──────────────────────────── */
.callout-info,
.callout-box.callout-info {
    border-left-color: #3B82F6;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.05) 0%, rgba(59, 130, 246, 0.03) 100%);
}

/* ── Skip to Content (accessibility) ─────────────────────── */
.skip-to-content {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary);
    color: white;
    padding: 8px 16px;
    z-index: 100;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 0 0 8px 0;
    transition: top 0.2s;
}

.skip-to-content:focus {
    top: 0;
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .article-layout {
        flex-direction: column;
        gap: 0;
    }
    .toc-sidebar {
        width: 100%;
        margin-bottom: 30px;
    }
    .toc-sidebar .toc-inner {
        position: static;
        background: var(--bg-secondary);
        border-left: 4px solid var(--primary);
        padding: 24px;
        border-radius: 8px;
    }
}

@media (max-width: 768px) {
    .blog-hero-inner {
        flex-direction: column;
        text-align: center;
        gap: 32px;
    }
    .blog-hero h1 {
        font-size: 32px;
    }
    .blog-hero-meta {
        justify-content: center;
    }
    .blog-hero-image {
        width: 200px;
        height: 200px;
        order: -1;
    }

    article h2, h2 {
        font-size: 26px;
    }

    article h3, h3 {
        font-size: 20px;
    }

    article {
        font-size: 15px;
    }

    .cta-section, .cta-box {
        padding: 40px 20px;
    }

    .section-grey {
        padding: 40px 20px;
    }
}

@media (max-width: 480px) {
    .blog-hero {
        padding: 40px 16px;
    }

    .blog-hero h1 {
        font-size: 26px;
    }

    article h2, h2 {
        font-size: 22px;
    }

    .article-wrapper {
        padding: 0 16px;
    }

    .toc-sidebar .toc-inner {
        padding: 16px;
    }

    .callout-box, .key-point {
        padding: 16px;
    }
}
