/* ═══════════════════════════════════════════════════════════
   ElectroCAD — Blog & Long-form content stylesheet
   Typography, callouts, tables, code blocks, TOC
   Charge-le APRÈS style.css : <link rel="stylesheet" href="/css/blog.css?v=1.0">
   ═══════════════════════════════════════════════════════════ */

/* ═══ BLOG ARTICLE CONTAINER ═══ */
article.blog-article,
section.blog-page {
    max-width: 820px;
    margin: 0 auto;
    padding: 120px 24px 60px;
    line-height: 1.75;
    font-size: 1.05rem;
    color: var(--text2);
}

/* ═══ HEADER ═══ */
.blog-article > header,
.blog-page > header {
    margin-bottom: 48px;
    padding-bottom: 32px;
    border-bottom: 1px solid var(--border);
}

.blog-meta {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 6px 14px;
    border-radius: 20px;
    background: var(--accent-glow);
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    margin-bottom: 16px;
}

.blog-meta i { font-size: 0.85rem; }

.blog-article h1,
.blog-page h1 {
    font-size: clamp(1.9rem, 4vw, 2.8rem);
    line-height: 1.15;
    color: var(--text);
    margin: 0 0 20px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.blog-lead {
    font-size: 1.2rem;
    line-height: 1.6;
    color: var(--text3);
    margin: 0;
    font-weight: 400;
}

/* ═══ HEADINGS DANS L'ARTICLE ═══ */
.blog-article h2,
.blog-page h2 {
    font-size: 1.7rem;
    line-height: 1.3;
    color: var(--text);
    margin: 56px 0 20px;
    font-weight: 700;
    position: relative;
    padding-bottom: 12px;
}

.blog-article h2::after,
.blog-page h2::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 48px;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), var(--purple));
    border-radius: 2px;
}

.blog-article h3,
.blog-page h3 {
    font-size: 1.3rem;
    line-height: 1.4;
    color: var(--text);
    margin: 36px 0 14px;
    font-weight: 600;
}

.blog-article h4,
.blog-page h4 {
    font-size: 1.1rem;
    color: var(--text);
    margin: 28px 0 12px;
    font-weight: 600;
}

/* ═══ PARAGRAPHS & LISTS ═══ */
.blog-article p,
.blog-page p {
    margin: 0 0 20px;
}

.blog-article ul,
.blog-article ol,
.blog-page ul,
.blog-page ol {
    margin: 0 0 24px;
    padding-left: 28px;
}

.blog-article li,
.blog-page li {
    margin-bottom: 10px;
    line-height: 1.7;
}

.blog-article li::marker,
.blog-page li::marker {
    color: var(--accent);
}

.blog-article strong,
.blog-page strong {
    color: var(--text);
    font-weight: 600;
}

.blog-article em,
.blog-page em {
    font-style: italic;
    color: var(--text);
}

/* Liens INLINE uniquement — exclure les boutons .btn */
.blog-article a:not(.btn),
.blog-page a:not(.btn) {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid rgba(59, 130, 246, 0.3);
    transition: all 0.2s;
}

.blog-article a:not(.btn):hover,
.blog-page a:not(.btn):hover {
    border-bottom-color: var(--accent);
    background: rgba(59, 130, 246, 0.08);
}

/* Les boutons gardent leur style natif de style.css — on neutralise juste les */
/* résidus possibles venant de la cascade des règles de lien blog-article      */
.blog-article .btn,
.blog-page .btn {
    border-bottom: none;
}

/* ═══ CODE BLOCKS ═══ */
.blog-article code,
.blog-page code {
    font-family: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
    font-size: 0.9em;
    background: var(--bg3);
    border: 1px solid var(--border);
    padding: 2px 8px;
    border-radius: 6px;
    color: var(--accent);
    font-weight: 500;
}

.blog-article pre,
.blog-page pre {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: 10px;
    padding: 20px 24px;
    overflow-x: auto;
    margin: 24px 0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.88rem;
    line-height: 1.6;
    color: var(--text);
    position: relative;
}

.blog-article pre code,
.blog-page pre code {
    background: none;
    border: none;
    padding: 0;
    color: inherit;
    font-size: inherit;
    font-weight: normal;
}

.blog-article pre::before,
.blog-page pre::before {
    content: attr(data-lang);
    position: absolute;
    top: 8px;
    right: 12px;
    font-size: 0.7rem;
    color: var(--text2);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ═══ CALLOUTS (info, warning, tip, danger) ═══ */
.callout {
    margin: 32px 0;
    padding: 20px 24px;
    border-radius: 12px;
    border-left: 4px solid;
    background: var(--bg2);
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 16px;
    align-items: start;
}

.callout-icon {
    font-size: 1.4rem;
    margin-top: 2px;
}

.callout-body {
    min-width: 0;
}

.callout-title {
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--text);
    font-size: 1.05rem;
}

.callout p { margin-bottom: 8px; }
.callout p:last-child { margin-bottom: 0; }
.callout ul, .callout ol { margin-bottom: 0; }

/* Variantes */
.callout-info    { border-color: var(--accent);  background: rgba(59, 130, 246, 0.08); }
.callout-info    .callout-icon { color: var(--accent); }

.callout-tip     { border-color: #10b981;        background: rgba(16, 185, 129, 0.08); }
.callout-tip     .callout-icon { color: #10b981; }

.callout-warning { border-color: #f59e0b;        background: rgba(245, 158, 11, 0.08); }
.callout-warning .callout-icon { color: #f59e0b; }

.callout-danger  { border-color: #ef4444;        background: rgba(239, 68, 68, 0.08); }
.callout-danger  .callout-icon { color: #ef4444; }

.callout-pro     { border-color: var(--purple);  background: rgba(139, 92, 246, 0.08); }
.callout-pro     .callout-icon { color: var(--purple); }

/* ═══ TABLES ═══ */
.blog-article table,
.blog-page table {
    width: 100%;
    border-collapse: collapse;
    margin: 28px 0;
    font-size: 0.95rem;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.blog-article thead,
.blog-page thead {
    background: var(--bg3);
}

.blog-article th,
.blog-page th {
    text-align: left;
    padding: 14px 16px;
    color: var(--text);
    font-weight: 600;
    font-size: 0.88rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border);
}

.blog-article td,
.blog-page td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-subtle);
    vertical-align: top;
}

.blog-article tbody tr:hover,
.blog-page tbody tr:hover {
    background: var(--bg3);
}

.blog-article tbody tr:last-child td,
.blog-page tbody tr:last-child td {
    border-bottom: none;
}

.blog-article td code,
.blog-page td code {
    font-size: 0.85em;
}

/* ═══ BLOCKQUOTES ═══ */
.blog-article blockquote,
.blog-page blockquote {
    margin: 32px 0;
    padding: 20px 28px;
    border-left: 4px solid var(--purple);
    background: var(--bg2);
    border-radius: 0 10px 10px 0;
    font-style: italic;
    color: var(--text2);
    position: relative;
}

.blog-article blockquote::before,
.blog-page blockquote::before {
    content: '"';
    position: absolute;
    top: -8px;
    left: 18px;
    font-size: 3rem;
    color: var(--purple);
    opacity: 0.3;
    font-family: Georgia, serif;
}

.blog-article blockquote p,
.blog-page blockquote p {
    margin-bottom: 8px;
}

.blog-article blockquote cite,
.blog-page blockquote cite {
    display: block;
    font-size: 0.85rem;
    color: var(--text3);
    font-style: normal;
    margin-top: 8px;
}

/* ═══ KEY FACT BOXES (pour les valeurs importantes) ═══ */
.key-fact {
    display: inline-block;
    padding: 4px 12px;
    background: var(--accent-glow);
    border: 1px solid var(--accent);
    border-radius: 6px;
    color: var(--accent);
    font-weight: 600;
    font-size: 0.95em;
}

/* ═══ FIGURES & CAPTIONS ═══ */
.blog-article figure,
.blog-page figure {
    margin: 32px 0;
}

.blog-article figure img,
.blog-page figure img {
    width: 100%;
    border-radius: 12px;
    border: 1px solid var(--border);
    display: block;
}

.blog-article figcaption,
.blog-page figcaption {
    text-align: center;
    margin-top: 12px;
    font-size: 0.85rem;
    color: var(--text3);
    font-style: italic;
}

/* ═══ STEP-BY-STEP LIST ═══ */
.steps {
    counter-reset: step-counter;
    list-style: none;
    padding: 0;
    margin: 28px 0;
}

.steps > li {
    counter-increment: step-counter;
    padding: 20px 24px 20px 64px;
    margin-bottom: 16px;
    position: relative;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.steps > li::before {
    content: counter(step-counter);
    position: absolute;
    left: 20px;
    top: 18px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--purple));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
}

.steps > li strong {
    display: block;
    font-size: 1.05rem;
    margin-bottom: 4px;
}

/* ═══ TABLE OF CONTENTS (TOC) ═══ */
.blog-toc {
    position: sticky;
    top: 100px;
    max-height: calc(100vh - 140px);
    overflow-y: auto;
    padding: 20px 24px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 32px;
}

.blog-toc-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text3);
    margin-bottom: 12px;
    font-weight: 700;
}

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

.blog-toc li {
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.blog-toc a {
    color: var(--text2);
    text-decoration: none;
    border-bottom: none;
    transition: color 0.2s;
    display: block;
    padding: 4px 0;
}

.blog-toc a:hover {
    color: var(--accent);
    background: none;
}

/* ═══ BREADCRUMB ═══ */
.blog-breadcrumb {
    font-size: 0.85rem;
    color: var(--text3);
    margin-bottom: 24px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.blog-breadcrumb a {
    color: var(--text2);
    text-decoration: none;
    border-bottom: none;
}

.blog-breadcrumb a:hover {
    color: var(--accent);
    background: none;
}

.blog-breadcrumb-sep {
    color: var(--border);
}

/* ═══ CTA BLOCK ═══ */
.blog-cta {
    margin: 60px 0 0;
    padding: 40px;
    background: linear-gradient(135deg, var(--bg2), var(--bg3));
    border: 1px solid var(--border);
    border-radius: 16px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.blog-cta::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), var(--purple));
}

.blog-cta h2 {
    margin: 0 0 12px !important;
    padding-bottom: 0 !important;
}
.blog-cta h2::after { display: none !important; }

.blog-cta p {
    color: var(--text2);
    margin-bottom: 24px;
}

.blog-cta .btn {
    margin: 4px;
}

/* ═══ KBD (keyboard shortcuts) ═══ */
.blog-article kbd,
.blog-page kbd {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85em;
    padding: 3px 8px;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-bottom-width: 2px;
    border-radius: 6px;
    color: var(--text);
    font-weight: 600;
    white-space: nowrap;
}

/* ═══ DEFINITION LIST (pour glossaires) ═══ */
.blog-article dl,
.blog-page dl {
    margin: 24px 0;
    padding: 24px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.blog-article dt,
.blog-page dt {
    font-weight: 700;
    color: var(--text);
    margin-top: 16px;
    margin-bottom: 4px;
    font-size: 1.05rem;
}

.blog-article dt:first-child,
.blog-page dt:first-child {
    margin-top: 0;
}

.blog-article dd,
.blog-page dd {
    margin-left: 0;
    color: var(--text2);
    padding-bottom: 8px;
}

/* ═══ HR (séparateur) ═══ */
.blog-article hr,
.blog-page hr {
    border: none;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border), transparent);
    margin: 48px 0;
}

/* ═══ RESPONSIVE ═══ */
@media (max-width: 768px) {
    article.blog-article,
    section.blog-page {
        padding: 90px 18px 40px;
        font-size: 1rem;
    }

    .blog-article h1,
    .blog-page h1 {
        font-size: 1.8rem;
    }

    .blog-article h2,
    .blog-page h2 {
        font-size: 1.4rem;
        margin-top: 40px;
    }

    .blog-article h3,
    .blog-page h3 {
        font-size: 1.15rem;
    }

    .callout {
        grid-template-columns: 1fr;
        padding: 16px 18px;
    }

    .callout-icon {
        margin-bottom: 6px;
    }

    .blog-cta {
        padding: 28px 20px;
    }

    .steps > li {
        padding-left: 56px;
    }
}

/* ═══ PRINT (pour les utilisateurs qui veulent imprimer les guides) ═══ */
@media print {
    nav.nav, footer.footer, .blog-cta, .cookie-banner, .blog-toc {
        display: none !important;
    }
    article.blog-article, section.blog-page {
        max-width: 100%;
        padding: 0;
        color: #000;
    }
    .blog-article h1, .blog-page h1,
    .blog-article h2, .blog-page h2,
    .blog-article h3, .blog-page h3 {
        color: #000;
    }
    .blog-article pre, .blog-page pre,
    .callout {
        border: 1px solid #333;
        background: #f5f5f5;
        color: #000;
    }
}
