/* ═══════════════════════════════════════════════════════════════
   ARTICLE PAGE
   ═══════════════════════════════════════════════════════════════ */

/* Reset overflow pour les pages article (style.css le bloque) */
html.article-page {
    height: auto;
    overflow-y: auto;
}

body.article-page {
    height: auto;
    overflow-y: auto;
    /* Force 16px base : empêche le zoom automatique iOS sur les inputs
       et garantit que 1rem = 16px partout */
    font-size: 16px;
}

html.article-page body {
    overflow-y: auto !important;
}

body.article-page {
    display: block;
    max-width: 100%;
    background: #0a0a0a;
    /* #d4d4d4 sur #0a0a0a = 10.7:1 — WCAG AAA, confortable en lecture longue */
    color: #d4d4d4;
    overflow-wrap: break-word;
    word-break: break-word;
    -webkit-text-size-adjust: 100%; /* Empêche iOS d'agrandir le texte en paysage */
}

/* ─── NAV ───────────────────────────────────────────────────── */

.article-nav {
    display: flex;
    align-items: center;
    padding: 20px 40px;
    border-bottom: 1px solid #1e1e1e;
    position: sticky;
    top: 0;
    background: rgba(10, 10, 10, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    z-index: 100;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.nav-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-decoration: none;
    color: #555;
    transition: color 0.2s ease;
}

.nav-back svg {
    width: 14px;
    height: 14px;
}

.nav-back:hover { color: #f0f0f0; }

.nav-separator {
    width: 1px;
    height: 14px;
    background: #2a2a2a;
}

.nav-blog {
    font-size: 0.75rem;
    font-weight: 400;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #888;
}

/* ─── ARTICLE CONTAINER ─────────────────────────────────────── */

article {
    /* 680px = ~65-70 caractères par ligne → longueur de ligne optimale pour la lecture */
    max-width: 740px;
    margin: 0 auto;
    /* Moins de padding top sur desktop, géré différemment sur mobile */
    padding: 56px 40px 96px;
}

/* ─── HEADER ────────────────────────────────────────────────── */

.article-header {
    margin-bottom: 56px;
}

.article-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px 16px;
    margin-bottom: 24px;
}

.article-category {
    /* 12px — standard pour les labels/badges */
    font-size: 0.75rem;
    font-weight: 400;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #e0e0e0;
    background: #1e1e1e;
    border: 1px solid #2e2e2e;
    padding: 4px 10px;
    border-radius: 4px;
    flex-shrink: 0;
    line-height: 1.4;
}

.article-meta-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* 13px — standard pour les métadonnées secondaires (Medium, Substack utilisent 13-14px) */
.article-date,
.article-read-time {
    font-size: 0.8125rem;
    font-weight: 300;
    color: #555;
    letter-spacing: 0.02em;
    line-height: 1.4;
}

.article-meta-sep {
    color: #333;
    font-size: 0.8125rem;
    line-height: 1;
    user-select: none;
}

.article-title {
    /* clamp : min 28px (mobile), fluide, max 40px (desktop)
       28px est la taille standard d'un H1 d'article sur mobile (NYT, Medium, Substack) */
    font-size: clamp(1.75rem, 5vw, 2.5rem);
    font-weight: 300;
    line-height: 1.15;
    letter-spacing: -0.02em;
    /* Blanc pur pour le titre — contraste maximum, ancre visuelle */
    color: #f5f5f5;
    margin-bottom: 20px;
}

.article-lead {
    /* 18px — taille standard pour le chapeau d'un article (Substack, NYT) */
    font-size: 1.125rem;
    font-weight: 300;
    line-height: 1.7;
    /* #999 sur #0a0a0a = 6.0:1 — WCAG AA ✓ */
    color: #999;
}

/* ─── COVER IMAGE ───────────────────────────────────────────── */

.article-cover {
    margin: 0 0 56px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #1e1e1e;
}

.article-cover img {
    width: 100%;
    height: auto;
    display: block;
}

.article-cover figcaption {
    padding: 10px 16px;
    /* 13px standard pour les légendes */
    font-size: 0.8125rem;
    color: #555;
    font-weight: 300;
    text-align: center;
    border-top: 1px solid #1e1e1e;
    line-height: 1.5;
}

/* ─── BODY ──────────────────────────────────────────────────── */

.article-body {
    /* 17px — légèrement au-dessus de 16px base, plus confortable en lecture longue
       (Medium utilise 21px, Substack 18px, on reste dans le style du site) */
    font-size: 1.0625rem;
    font-weight: 300;
    /* 1.75 = ~30px line-height à 17px — standard éditorial */
    line-height: 1.75;
    color: #c8c8c8;
}

.article-body h2 {
    /* 24px — ratio 1.41x par rapport au corps, hiérarchie claire */
    font-size: 1.5rem;
    /* weight 500 pour la hiérarchie — 300 était trop proche du corps */
    font-weight: 500;
    letter-spacing: -0.015em;
    color: #f0f0f0;
    /* Espace vertical généreux : le blanc "respire" le contenu */
    margin: 56px 0 16px;
    line-height: 1.25;
}

/* Pas de margin-top sur le premier h2 directement après le header */
.article-body > h2:first-child {
    margin-top: 0;
}

.article-body h3 {
    /* 20px — entre le corps (17px) et le h2 (24px) */
    font-size: 1.25rem;
    font-weight: 500;
    color: #e8e8e8;
    margin: 40px 0 12px;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

.article-body p {
    margin-bottom: 24px;
}

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

.article-body li {
    margin-bottom: 8px;
    /* Même line-height que le corps */
    line-height: 1.75;
    padding-left: 4px;
}

.article-body ul li::marker { color: #3a3a3a; }
.article-body ol li::marker {
    color: #666;
    font-weight: 400;
}

.article-body a {
    color: #f0f0f0;
    text-decoration: underline;
    text-decoration-color: #3a3a3a;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
    transition: text-decoration-color 0.15s, color 0.15s;
}

.article-body a:hover {
    color: #fff;
    text-decoration-color: #888;
}

.article-body strong {
    color: #f0f0f0;
    font-weight: 500;
}

.article-body em { color: #aaa; }

.article-body blockquote {
    margin: 40px 0;
    padding: 20px 24px;
    border-left: 2px solid #2e2e2e;
    background: #111;
    border-radius: 0 6px 6px 0;
    /* 18px italic — format éditorial standard pour les citations */
    font-size: 1.125rem;
    font-style: italic;
    line-height: 1.65;
    color: #aaa;
}

.article-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 32px 0;
    font-size: 0.95rem;
}

.article-body table th,
.article-body table td {
    padding: 10px 16px;
    border: 1px solid #2a2a2a;
    text-align: left;
}

.article-body table th {
    color: #fff;
    font-weight: 500;
    background: #111;
}

.article-body table td {
    color: #aaa;
}

.article-body pre {
    background: #111;
    border: 1px solid #1e1e1e;
    border-radius: 8px;
    padding: 20px 24px;
    overflow-x: auto;
    margin: 32px 0;
    /* -webkit-overflow-scrolling: touch pour scroll fluide sur iOS */
    -webkit-overflow-scrolling: touch;
}

.article-body code {
    font-family: 'SF Mono', 'Fira Code', ui-monospace, 'Cascadia Code', monospace;
    /* 14px pour le code — standard universel */
    font-size: 0.875rem;
    color: #c8c8c8;
    line-height: 1.6;
}

.article-body p code,
.article-body li code {
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8125rem;
    color: #e0e0e0;
    font-style: normal;
}

/* Images dans le corps */
.article-body img {
    max-width: 100%;
    max-height: 740px;
    width: auto;
    height: auto;
    border-radius: 6px;
    display: block;
    margin: 32px auto;
    object-fit: contain;
}

/* ─── ARTICLE FOOTER ────────────────────────────────────────── */

.article-footer {
    margin-top: 56px;
    padding-top: 32px;
    border-top: 1px solid #1a1a1a;
}

.article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    font-size: 0.75rem;
    font-weight: 300;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #555;
    border: 1px solid #222;
    padding: 5px 10px;
    border-radius: 4px;
    transition: border-color 0.2s, color 0.2s;
    cursor: default;
    line-height: 1.4;
}

.tag:hover {
    border-color: #3a3a3a;
    color: #888;
}

/* ─── CTA BLOCK ─────────────────────────────────────────────── */

.cta-block {
    background: linear-gradient(135deg, #0d0d0d 0%, #151515 100%);
    border-top: 1px solid #1a1a1a;
    padding: 80px 40px;
}

.cta-inner {
    max-width: 520px;
    margin: 0 auto;
    text-align: center;
}

.cta-eyebrow {
    font-size: 0.75rem;
    font-weight: 300;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #484848;
    margin-bottom: 14px;
}

.cta-title {
    font-size: clamp(1.5rem, 4vw, 2.125rem);
    font-weight: 300;
    letter-spacing: -0.02em;
    line-height: 1.15;
    color: #f0f0f0;
    margin-bottom: 14px;
}

.cta-body {
    font-size: 0.95rem;
    font-weight: 300;
    line-height: 1.65;
    color: #666;
    margin: 0 auto 32px;
}

.cta-button {
    display: inline-block;
    padding: 12px 36px;
    background: #f0f0f0;
    color: #0a0a0a;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    border-radius: 6px;
    transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
    min-height: 44px;
    line-height: 20px;
    box-shadow: 0 2px 8px rgba(240, 240, 240, 0.1);
}

.cta-button:hover {
    background: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(240, 240, 240, 0.15);
}

/* ─── FOOTER ────────────────────────────────────────────────── */

.site-footer {
    background: #0a0a0a;
    border-top: 1px solid #1a1a1a;
    padding: 48px 40px;
    margin-top: 80px;
}

.footer-inner {
    max-width: 740px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 32px;
}

.footer-copy {
    font-size: 0.75rem;
    font-weight: 300;
    color: #484848;
    letter-spacing: 0.02em;
    margin: 0;
}

.footer-nav {
    display: flex;
    gap: 24px;
}

.footer-link {
    font-size: 0.75rem;
    font-weight: 300;
    letter-spacing: 0.04em;
    text-decoration: none;
    color: #555;
    transition: color 0.2s ease;
}

.footer-link:hover {
    color: #f0f0f0;
}

/* ─── MOBILE ────────────────────────────────────────────────── */
/* Breakpoint à 640px plutôt que 768px : la colonne de texte
   est naturellement à pleine largeur avant 680px + padding */

@media (max-width: 640px) {
    .article-nav {
        padding: 0 20px;
        height: 52px;
    }

    article {
        /* 24px = marge standard iOS (HIG recommande 16-20px minimum) */
        padding: 32px 20px 72px;
    }

    .article-header {
        margin-bottom: 40px;
    }

    .article-meta {
        /* Sur mobile, catégorie et meta-right s'empilent si besoin via flex-wrap */
        gap: 6px 12px;
    }

    .article-title {
        /* clamp garantit déjà le bon résultat, mais on force le line-height */
        line-height: 1.2;
        margin-bottom: 16px;
    }

    .article-lead {
        /* 17px sur mobile — on descend légèrement pour le chapeau */
        font-size: 1.0625rem;
    }

    .article-body {
        /* 16px sur mobile — standard universel, zéro zoom iOS */
        font-size: 1rem;
        line-height: 1.75;
    }

    .article-body h2 {
        font-size: 1.25rem;
        margin: 40px 0 12px;
    }

    .article-body h3 {
        font-size: 1.125rem;
        margin: 32px 0 10px;
    }

    .article-body img {
        max-height: 80vw;
    }

    .article-body table {
        font-size: 0.8rem;
    }

    .article-body table th,
    .article-body table td {
        padding: 8px 10px;
    }

    .article-body blockquote {
        font-size: 1rem;
        padding: 16px 18px;
        margin: 32px 0;
    }

    .article-body pre {
        /* Déborde légèrement pour utiliser toute la largeur */
        margin-left: -20px;
        margin-right: -20px;
        border-radius: 0;
        padding: 16px 20px;
    }

    .article-footer {
        margin-top: 40px;
    }

    .cta-block {
        padding: 56px 20px;
    }

    .cta-button {
        width: 100%;
        text-align: center;
    }

    .site-footer {
        padding: 32px 20px;
        margin-top: 56px;
    }

    .footer-inner {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }

    .footer-nav {
        justify-content: center;
    }
}
