/* ================================================================
   RAFA BLOG — Styles articles premium
   Version 1.0 — Compatible thème rafa-premium-fix
   Palette : Sage #A8CFA5 | Btn #8DBA8A | Hover #6F9D73
             Cream #FAF8F4 | Beige #EADFCF | Rose #F4C7C3
             Text #4A4A4A
   ================================================================ */

/* ── 1. BARRE DE PROGRESSION DE LECTURE ── */
#rafa-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, #A8CFA5, #8DBA8A, #6F9D73);
    z-index: 9999;
    transition: width .1s linear;
    border-radius: 0 2px 2px 0;
}

/* ── 2. LAYOUT ARTICLE ── */
body.single-post {
    background: #FAF8F4;
}

.rafa-article-wrap {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 48px;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
    align-items: flex-start;
}

/* Contenu principal */
.rafa-article-content {
    max-width: 720px;
    width: 100%;
}

/* ── 3. HERO ARTICLE ── */
.rafa-article-hero {
    background: linear-gradient(135deg, #FAF8F4 0%, #EADFCF 100%);
    padding: 56px 0 48px;
    margin-bottom: 0;
}

.rafa-article-hero-inner {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Catégorie */
.rafa-article-cat {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: #8DBA8A;
    background: rgba(141,186,138,.12);
    border: 1px solid rgba(141,186,138,.3);
    border-radius: 20px;
    padding: 5px 14px;
    margin-bottom: 18px;
    text-decoration: none !important;
}

/* Titre H1 de l'article */
.rafa-article-hero h1,
.single-post h1.entry-title,
.single-post .entry-title {
    font-size: clamp(28px, 4vw, 42px) !important;
    font-weight: 300 !important;
    color: #4A4A4A !important;
    line-height: 1.3 !important;
    letter-spacing: -.4px !important;
    margin-bottom: 20px !important;
}

.rafa-article-hero h1 strong,
.single-post h1.entry-title strong {
    font-weight: 600 !important;
    color: #6F9D73 !important;
}

/* ── 4. MÉTA INFOS ARTICLE ── */
.rafa-article-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    padding: 16px 0;
    border-top: 1px solid rgba(168,207,165,.25);
    border-bottom: 1px solid rgba(168,207,165,.25);
    margin-bottom: 32px;
}

.rafa-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 400;
    color: #aaa;
    letter-spacing: .3px;
}

.rafa-meta-item svg {
    width: 14px;
    height: 14px;
    color: #A8CFA5;
    flex-shrink: 0;
}

.rafa-meta-item strong {
    color: #4A4A4A;
    font-weight: 500;
}

/* Image mise en avant */
.rafa-article-thumbnail {
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 40px;
    box-shadow: 0 8px 32px rgba(74,74,74,.10);
}

.rafa-article-thumbnail img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform .5s ease;
    filter: saturate(.9);
}

.rafa-article-thumbnail:hover img {
    transform: scale(1.02);
}

/* ── 5. TABLE DES MATIÈRES ── */
.rafa-toc {
    position: sticky;
    top: 100px;
    background: #fff;
    border: 1px solid #EADFCF;
    border-radius: 14px;
    padding: 22px;
    max-height: calc(100vh - 130px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #A8CFA5 transparent;
}

.rafa-toc::-webkit-scrollbar { width: 4px; }
.rafa-toc::-webkit-scrollbar-thumb { background: #A8CFA5; border-radius: 4px; }

.rafa-toc-title {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #aaa;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 7px;
}

.rafa-toc-title svg {
    width: 14px;
    height: 14px;
    color: #8DBA8A;
}

.rafa-toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.rafa-toc-list li a {
    display: block;
    font-size: 12px;
    font-weight: 400;
    color: #888;
    text-decoration: none !important;
    padding: 6px 10px;
    border-left: 2px solid transparent;
    border-radius: 0 6px 6px 0;
    transition: all .2s;
    line-height: 1.4;
}

.rafa-toc-list li.toc-h3 a {
    padding-left: 20px;
    font-size: 11px;
}

.rafa-toc-list li.toc-h4 a {
    padding-left: 32px;
    font-size: 11px;
    color: #bbb;
}

.rafa-toc-list li a:hover {
    color: #8DBA8A;
    border-left-color: rgba(141,186,138,.4);
    background: rgba(141,186,138,.06);
}

.rafa-toc-list li.active > a {
    color: #6F9D73;
    border-left-color: #8DBA8A;
    background: rgba(141,186,138,.08);
    font-weight: 500;
}

/* ── 6. TYPOGRAPHIE ARTICLE ── */
.entry-content,
.rafa-article-body {
    font-size: 16px !important;
    font-weight: 300 !important;
    color: #4A4A4A !important;
    line-height: 1.85 !important;
    letter-spacing: .1px;
}

/* H2 */
.entry-content h2 {
    font-size: clamp(20px, 2.5vw, 26px) !important;
    font-weight: 600 !important;
    color: #4A4A4A !important;
    margin-top: 52px !important;
    margin-bottom: 18px !important;
    padding-bottom: 10px !important;
    border-bottom: 2px solid #EADFCF !important;
    letter-spacing: -.2px !important;
    line-height: 1.3 !important;
}

/* H3 */
.entry-content h3 {
    font-size: clamp(17px, 2vw, 21px) !important;
    font-weight: 600 !important;
    color: #4A4A4A !important;
    margin-top: 36px !important;
    margin-bottom: 14px !important;
    letter-spacing: -.1px !important;
    line-height: 1.35 !important;
}

.entry-content h3::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 18px;
    background: #8DBA8A;
    border-radius: 4px;
    margin-right: 10px;
    vertical-align: middle;
    margin-top: -2px;
}

/* H4 */
.entry-content h4 {
    font-size: 16px !important;
    font-weight: 600 !important;
    color: #6F9D73 !important;
    margin-top: 28px !important;
    margin-bottom: 10px !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
    font-size: 13px !important;
}

/* Paragraphes */
.entry-content p {
    margin-bottom: 22px !important;
    max-width: 68ch;
}

/* ── 7. LIENS ── */
.entry-content a {
    color: #6F9D73 !important;
    text-decoration: underline !important;
    text-decoration-color: rgba(111,157,115,.35) !important;
    text-underline-offset: 3px !important;
    text-decoration-thickness: 1.5px !important;
    transition: color .2s, text-decoration-color .2s !important;
    font-weight: 400 !important;
}

.entry-content a:hover {
    color: #4a7a50 !important;
    text-decoration-color: #6F9D73 !important;
}

/* Lien externe avec icône */
.entry-content a[target="_blank"]::after {
    content: '↗';
    font-size: .7em;
    margin-left: 3px;
    opacity: .6;
    display: inline-block;
    vertical-align: super;
}

/* ── 8. LISTES ── */
.entry-content ul {
    list-style: none !important;
    padding: 0 !important;
    margin: 22px 0 !important;
}

.entry-content ul li {
    position: relative;
    padding: 6px 0 6px 26px !important;
    font-size: 15px;
    line-height: 1.7;
    color: #4A4A4A;
}

.entry-content ul li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 14px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #A8CFA5;
    border: 2px solid #8DBA8A;
}

/* Listes imbriquées */
.entry-content ul ul li::before {
    width: 6px;
    height: 6px;
    background: transparent;
    border-color: #A8CFA5;
}

/* Listes numérotées */
.entry-content ol {
    padding-left: 0 !important;
    margin: 22px 0 !important;
    counter-reset: rafa-counter;
    list-style: none !important;
}

.entry-content ol li {
    position: relative;
    padding: 6px 0 6px 38px !important;
    font-size: 15px;
    line-height: 1.7;
    color: #4A4A4A;
    counter-increment: rafa-counter;
}

.entry-content ol li::before {
    content: counter(rafa-counter);
    position: absolute;
    left: 0;
    top: 7px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #8DBA8A;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── 9. BLOCKQUOTES / CITATIONS ── */
.entry-content blockquote {
    position: relative;
    margin: 36px 0 !important;
    padding: 28px 28px 28px 52px !important;
    background: linear-gradient(135deg, #FAF8F4, #EADFCF) !important;
    border: none !important;
    border-left: 4px solid #8DBA8A !important;
    border-radius: 0 14px 14px 0 !important;
    font-style: italic !important;
    font-size: 17px !important;
    font-weight: 300 !important;
    color: #4A4A4A !important;
    line-height: 1.8 !important;
}

.entry-content blockquote::before {
    content: '\201C';
    position: absolute;
    left: 14px;
    top: 14px;
    font-size: 52px;
    color: #A8CFA5;
    font-style: normal;
    line-height: 1;
    font-family: Georgia, serif;
    opacity: .7;
}

.entry-content blockquote p {
    margin: 0 !important;
    max-width: 100% !important;
}

.entry-content blockquote cite {
    display: block;
    margin-top: 12px;
    font-size: 12px;
    font-style: normal;
    font-weight: 500;
    color: #8DBA8A;
    letter-spacing: .5px;
}

/* ── 10. BLOCS INFORMATIFS ── */
/* Base commune */
.rafa-note,
.rafa-tip,
.rafa-warning,
.rafa-info,
.rafa-success {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 18px 20px;
    border-radius: 12px;
    margin: 28px 0 !important;
    font-size: 14px;
    line-height: 1.7;
    border-width: 1px;
    border-style: solid;
}

.rafa-note-icon,
.rafa-tip-icon,
.rafa-warning-icon,
.rafa-info-icon,
.rafa-success-icon {
    font-size: 20px;
    flex-shrink: 0;
    margin-top: 1px;
    line-height: 1;
}

.rafa-note-body,
.rafa-tip-body,
.rafa-warning-body,
.rafa-info-body,
.rafa-success-body {
    flex: 1;
}

.rafa-note-body strong,
.rafa-tip-body strong,
.rafa-warning-body strong,
.rafa-info-body strong,
.rafa-success-body strong {
    display: block;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 5px;
}

/* 💡 Conseil */
.rafa-tip {
    background: #FFFBEB;
    border-color: #F59E0B;
    color: #78450a;
}
.rafa-tip-body strong { color: #B45309; }

/* ⚠️ Attention */
.rafa-warning {
    background: #FEF2F2;
    border-color: #FCA5A5;
    color: #7f1d1d;
}
.rafa-warning-body strong { color: #DC2626; }

/* ℹ️ Information */
.rafa-info {
    background: #EFF6FF;
    border-color: #93C5FD;
    color: #1e3a5f;
}
.rafa-info-body strong { color: #2563EB; }

/* ✅ Succès / Bon à savoir */
.rafa-success {
    background: #F0FDF4;
    border-color: #A8CFA5;
    color: #14532d;
}
.rafa-success-body strong { color: #6F9D73; }

/* 📝 Note neutre */
.rafa-note {
    background: #FAF8F4;
    border-color: #EADFCF;
    color: #4A4A4A;
}
.rafa-note-body strong { color: #8DBA8A; }

/* ── 11. TABLEAUX ── */
.entry-content table {
    width: 100% !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
    border-radius: 12px !important;
    overflow: hidden !important;
    box-shadow: 0 2px 16px rgba(74,74,74,.08) !important;
    margin: 32px 0 !important;
    font-size: 14px !important;
}

.entry-content table th {
    background: #8DBA8A !important;
    color: #fff !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    letter-spacing: 1px !important;
    text-transform: uppercase !important;
    padding: 13px 18px !important;
    text-align: left !important;
}

.entry-content table td {
    padding: 12px 18px !important;
    border-bottom: 1px solid #EADFCF !important;
    color: #4A4A4A !important;
    vertical-align: top !important;
}

.entry-content table tr:nth-child(even) td {
    background: #FAF8F4 !important;
}

.entry-content table tr:last-child td {
    border-bottom: none !important;
}

.entry-content table tr:hover td {
    background: rgba(141,186,138,.06) !important;
}

/* Wrapper responsive */
.rafa-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 32px 0;
    border-radius: 12px;
}

/* ── 12. IMAGES ── */
.entry-content img {
    border-radius: 12px !important;
    box-shadow: 0 4px 20px rgba(74,74,74,.10) !important;
    max-width: 100% !important;
    height: auto !important;
    display: block !important;
    margin: 28px auto !important;
    transition: transform .3s ease, box-shadow .3s ease !important;
    filter: saturate(.92) !important;
}

.entry-content img:hover {
    transform: scale(1.01) !important;
    box-shadow: 0 8px 32px rgba(74,74,74,.16) !important;
}

/* Légendes */
.entry-content figure {
    margin: 32px 0 !important;
    text-align: center !important;
}

.entry-content figcaption,
.entry-content .wp-caption-text {
    font-size: 12px !important;
    font-weight: 400 !important;
    color: #aaa !important;
    font-style: italic !important;
    margin-top: 10px !important;
    letter-spacing: .3px !important;
}

/* ── 13. CODE ── */
.entry-content code {
    font-family: 'SF Mono', 'Fira Code', 'Courier New', monospace !important;
    font-size: 13px !important;
    background: rgba(168,207,165,.15) !important;
    color: #3d6b3f !important;
    padding: 2px 7px !important;
    border-radius: 5px !important;
    border: 1px solid rgba(168,207,165,.3) !important;
}

.entry-content pre {
    position: relative !important;
    background: #1e1e2e !important;
    color: #cdd6f4 !important;
    border-radius: 12px !important;
    padding: 48px 22px 22px !important;
    margin: 28px 0 !important;
    overflow-x: auto !important;
    box-shadow: 0 4px 20px rgba(0,0,0,.2) !important;
    font-size: 13px !important;
    line-height: 1.7 !important;
}

.entry-content pre code {
    background: transparent !important;
    color: inherit !important;
    padding: 0 !important;
    border: none !important;
    font-size: inherit !important;
}

/* Bouton copier */
.rafa-copy-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(255,255,255,.1);
    color: rgba(255,255,255,.7);
    border: 1px solid rgba(255,255,255,.15);
    border-radius: 6px;
    padding: 4px 12px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all .2s;
    letter-spacing: .5px;
}

.rafa-copy-btn:hover {
    background: rgba(141,186,138,.3);
    color: #fff;
    border-color: #8DBA8A;
}

.rafa-copy-btn.copied {
    background: #8DBA8A;
    color: #fff;
    border-color: #8DBA8A;
}

/* Indicateur langage */
.entry-content pre::before {
    content: attr(data-lang);
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 36px;
    background: rgba(255,255,255,.05);
    border-bottom: 1px solid rgba(255,255,255,.08);
    display: flex;
    align-items: center;
    padding: 0 16px;
    font-size: 11px;
    color: rgba(255,255,255,.4);
    letter-spacing: 1px;
    text-transform: uppercase;
    border-radius: 12px 12px 0 0;
}

/* ── 14. BOUTONS DANS ARTICLES ── */
.entry-content .rafa-btn,
.entry-content a.button,
.entry-content .wp-block-button__link {
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    background: #8DBA8A !important;
    color: #fff !important;
    border: none !important;
    border-radius: 32px !important;
    padding: 12px 28px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    letter-spacing: .8px !important;
    text-transform: uppercase !important;
    text-decoration: none !important;
    transition: all .25s ease !important;
    box-shadow: 0 2px 12px rgba(141,186,138,.3) !important;
    cursor: pointer !important;
}

.entry-content .rafa-btn:hover,
.entry-content a.button:hover,
.entry-content .wp-block-button__link:hover {
    background: #6F9D73 !important;
    box-shadow: 0 6px 20px rgba(141,186,138,.4) !important;
    transform: translateY(-2px) !important;
    color: #fff !important;
    text-decoration: none !important;
}

/* ── 15. SÉPARATEURS ── */
.entry-content hr {
    border: none !important;
    height: 1px !important;
    background: linear-gradient(90deg, transparent, #EADFCF, transparent) !important;
    margin: 48px 0 !important;
}

/* ── 16. PARTAGE & NAVIGATION ── */
.rafa-article-footer {
    margin-top: 64px;
    padding-top: 32px;
    border-top: 1px solid #EADFCF;
}

.rafa-share {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
    flex-wrap: wrap;
}

.rafa-share-label {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #aaa;
}

.rafa-share-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 16px;
    border-radius: 20px;
    border: 1.5px solid #EADFCF;
    font-size: 12px;
    font-weight: 500;
    color: #4A4A4A;
    text-decoration: none !important;
    background: #fff;
    transition: all .2s;
}

.rafa-share-btn:hover {
    border-color: #8DBA8A;
    color: #6F9D73 !important;
    box-shadow: 0 2px 8px rgba(141,186,138,.15);
}

/* Articles liés */
.rafa-related {
    margin-top: 48px;
    padding: 32px;
    background: #fff;
    border-radius: 16px;
    border: 1px solid #EADFCF;
}

.rafa-related h3 {
    font-size: 16px !important;
    font-weight: 600 !important;
    color: #4A4A4A !important;
    margin-bottom: 20px !important;
    margin-top: 0 !important;
    border: none !important;
    padding: 0 !important;
}

.rafa-related h3::before { display: none !important; }

.rafa-related-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.rafa-related-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px;
    border: 1px solid #EADFCF;
    border-radius: 12px;
    text-decoration: none !important;
    background: #FAF8F4;
    transition: all .2s;
}

.rafa-related-card:hover {
    border-color: #A8CFA5;
    box-shadow: 0 4px 14px rgba(141,186,138,.12);
    transform: translateY(-2px);
}

.rafa-related-card-cat {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: #8DBA8A;
}

.rafa-related-card-title {
    font-size: 13px;
    font-weight: 500;
    color: #4A4A4A;
    line-height: 1.5;
}

/* ── 17. RESPONSIVE ── */
@media (max-width: 1024px) {
    .rafa-article-wrap {
        grid-template-columns: 1fr;
    }
    .rafa-toc {
        position: static;
        max-height: none;
        order: -1;
    }
}

@media (max-width: 768px) {
    .rafa-article-meta { gap: 12px; }
    .rafa-meta-item { font-size: 11px; }
    .rafa-related-grid { grid-template-columns: 1fr; }
    .entry-content h2 { margin-top: 36px !important; }
    .entry-content pre { padding: 44px 16px 16px !important; }
    .rafa-article-wrap { padding: 0 16px; }
}

@media (max-width: 480px) {
    .entry-content blockquote {
        padding: 20px 18px 20px 40px !important;
    }
    .entry-content table { font-size: 12px !important; }
    .entry-content table th,
    .entry-content table td { padding: 10px 12px !important; }
}

/* ── 18. ACCESSIBILITÉ ── */
.entry-content a:focus-visible,
.rafa-toc-list li a:focus-visible {
    outline: 2px solid #8DBA8A;
    outline-offset: 3px;
    border-radius: 3px;
}

.rafa-copy-btn:focus-visible {
    outline: 2px solid #8DBA8A;
}

/* Focus visible global */
*:focus-visible {
    outline: 2px solid #8DBA8A;
    outline-offset: 2px;
}

/* ── 19. TAG NOUVEAU / MIS À JOUR ── */
.rafa-article-updated {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 500;
    color: #8DBA8A;
    background: rgba(141,186,138,.1);
    border: 1px solid rgba(141,186,138,.25);
    border-radius: 20px;
    padding: 3px 10px;
    margin-left: 8px;
}

/* ── 20. SCROLLBAR GLOBAL ── */
.rafa-toc::-webkit-scrollbar { width: 4px; }
.rafa-toc::-webkit-scrollbar-track { background: transparent; }
.rafa-toc::-webkit-scrollbar-thumb { background: #A8CFA5; border-radius: 4px; }
