/* =====================================================================
 * Fichier : assets/css/pages/ratgeber-artikel.css
 * Projet  : Brennholz Shop24
 * Rôle    : Styles propres à un article du Ratgeber
 *           (ratgeber-artikel.php) : en-tête, typographie de lecture,
 *           tableaux défilants, sommaire collant (ordinateur) ou
 *           repliable (mobile), barre de progression, boutons de
 *           partage, produits recommandés, articles liés, page 404.
 * ===================================================================== */

/* ---------------------------------------------------------------------
 * 1. En-tête
 * ------------------------------------------------------------------- */
.ra-hero::before { z-index: 0; }
.ra-hero-embers { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.ra-hero-inner { position: relative; z-index: 2; }
.ra-hero-head { max-width: 900px; margin-top: 1.2rem; }
.ra-topic { transition: background .25s, transform .25s var(--hfk-ease); }
.ra-topic:hover { color: #fff; background: var(--hfk-flame); transform: translateY(-2px); }
.ra-hero-head h1 { font-size: clamp(1.9rem, 4.2vw, 3.2rem); animation: hfk-fade-up .7s var(--hfk-ease) both; }
.ra-hero .ra-lead { max-width: 780px; font-size: clamp(1.02rem, 1.6vw, 1.2rem); line-height: 1.65; animation: hfk-fade-up .7s .1s var(--hfk-ease) both; }
.ra-meta { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1.2rem 0 0; padding: 0; list-style: none; animation: hfk-fade-up .7s .2s var(--hfk-ease) both; }
.ra-meta li { display: inline-flex; align-items: center; gap: .45rem; padding: .4rem .8rem; background: rgba(255, 255, 255, .08); color: #fff; font-size: .88rem; font-weight: 500; }
.ra-meta i { color: var(--hfk-amber); }

/* ---------------------------------------------------------------------
 * 2. Mise en page et contenu
 * ------------------------------------------------------------------- */
.ra-body { --ra-sticky-top: calc(var(--hfk-header-h, 76px) + 1rem); padding-top: clamp(2rem, 5vw, 3.5rem); }
.ra-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: clamp(1.5rem, 4vw, 4rem); align-items: start; }
.ra-article { min-width: 0; max-width: 800px; }
.ra-cover { margin: 0 0 2rem; }
.ra-cover img { width: 100%; height: auto; display: block; }
.ra-content { font-size: 1.06rem; line-height: 1.8; color: var(--hfk-text); }
.ra-content > p:first-child { font-size: 1.15rem; color: var(--hfk-charcoal); }
.ra-content > p:first-child::first-letter { float: left; margin: .35rem .6rem 0 0; font-family: var(--hfk-font-head); font-weight: 800; font-size: 3.6rem; line-height: .8; color: var(--hfk-flame); }
.ra-content h2 { position: relative; padding-left: 1rem; scroll-margin-top: calc(var(--ra-sticky-top) + 1rem); }
.ra-content h2::before { content: ''; position: absolute; left: 0; top: .2em; bottom: .2em; width: 4px; background: var(--hfk-grad-fire); }
.ra-content h3 { scroll-margin-top: calc(var(--ra-sticky-top) + 1rem); }
.ra-content h2.is-target { animation: ra-flash 1.4s var(--hfk-ease); }
@keyframes ra-flash { 0%, 40% { background: var(--hfk-flame-light); } 100% { background: transparent; } }
.ra-content a { text-decoration: underline; text-underline-offset: 3px; }
.ra-table-wrap { margin: 1.4rem 0; overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--hfk-border); }
.ra-content .ra-table-wrap table { margin: 0; min-width: 520px; font-size: .94rem; line-height: 1.5; }
.ra-content .ra-table-wrap th { background: var(--hfk-charcoal); color: #fff; font-family: var(--hfk-font-head); font-weight: 600; text-align: left; border-color: var(--hfk-charcoal-3); }
.ra-content .ra-table-wrap tbody tr:nth-child(even) { background: var(--hfk-cream); }
.ra-content .ra-table-wrap tbody tr { transition: background .2s; }
.ra-content .ra-table-wrap tbody tr:hover { background: var(--hfk-flame-light); }

/* Fin d'article */
.ra-end { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 2px solid var(--hfk-charcoal); }
.ra-end-note { padding: .9rem 1rem; background: var(--hfk-cream); border-left: 4px solid var(--hfk-sky); font-size: .9rem; color: var(--hfk-text); }
.ra-end-note i { color: var(--hfk-sky); margin-right: .3rem; }
.ra-end-share { display: flex; flex-wrap: wrap; align-items: center; gap: .7rem 1rem; margin: 1.4rem 0; }
.ra-end-share > strong { font-family: var(--hfk-font-head); color: var(--hfk-charcoal); }
.ra-back { margin-top: .4rem; }
.ra-back i { transition: transform .3s var(--hfk-ease); }
.ra-back:hover i { transform: translateX(-4px); }

/* ---------------------------------------------------------------------
 * 3. Sommaire et progression
 * ------------------------------------------------------------------- */
.ra-side { position: sticky; top: var(--ra-sticky-top); display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; max-height: calc(100vh - var(--ra-sticky-top) - 1rem); overflow-y: auto; scrollbar-width: thin; }
.ra-toc { background: #fff; border: 1px solid var(--hfk-border); border-top: 4px solid var(--hfk-flame); box-shadow: var(--hfk-shadow-sm); }
.ra-toc[hidden] { display: none; }
.ra-toc-toggle { width: 100%; display: flex; align-items: center; gap: .6rem; padding: .9rem 1.1rem .6rem; border: 0; background: none; text-align: left; cursor: default; }
.ra-toc-title { font-family: var(--hfk-font-head); font-weight: 700; font-size: 1.05rem; color: var(--hfk-charcoal); white-space: nowrap; }
.ra-toc-title i { color: var(--hfk-flame); margin-right: .25rem; }
.ra-toc-current { display: none; }
.ra-toc-chevron { display: none; }
.ra-progress { height: 4px; margin: 0 1.1rem; background: var(--hfk-ash); overflow: hidden; }
.ra-progress span { display: block; width: 100%; height: 100%; background: var(--hfk-grad-fire-h); transform: scaleX(0); transform-origin: left; transition: transform .15s linear; }
.ra-progress-text { margin: .4rem 1.1rem .6rem; font-size: .78rem; color: var(--hfk-muted); }
.ra-progress-text span { font-weight: 700; color: var(--hfk-charcoal); font-variant-numeric: tabular-nums; }
.ra-toc-list { margin: 0; padding: 0 0 .6rem; list-style: none; counter-reset: ra-toc; }
.ra-toc-list li { counter-increment: ra-toc; }
.ra-toc-list a { position: relative; display: flex; gap: .6rem; padding: .45rem 1.1rem .45rem 1.1rem; border-left: 3px solid transparent; color: var(--hfk-text); font-size: .9rem; line-height: 1.4; transition: background .2s, color .2s, border-color .2s, padding-left .25s var(--hfk-ease); }
.ra-toc-list a::before { content: counter(ra-toc, decimal-leading-zero); flex: 0 0 auto; font-family: var(--hfk-font-head); font-weight: 700; font-size: .78rem; color: var(--hfk-muted); padding-top: .1rem; transition: color .2s; }
.ra-toc-list a:hover { background: var(--hfk-cream); color: var(--hfk-flame-dark); padding-left: 1.35rem; }
.ra-toc-list a.is-active { border-left-color: var(--hfk-flame); background: var(--hfk-flame-light); color: var(--hfk-charcoal); font-weight: 600; }
.ra-toc-list a.is-active::before, .ra-toc-list a.is-done::before { color: var(--hfk-flame); }

/* Partage */
.ra-side-share { padding: 1rem 1.1rem; background: var(--hfk-cream); }
.ra-side-share > strong { display: block; margin-bottom: .6rem; font-family: var(--hfk-font-head); font-size: .95rem; color: var(--hfk-charcoal); }
.ra-share { display: flex; flex-wrap: wrap; gap: .4rem; }
.ra-share-btn { display: inline-flex; align-items: center; gap: .45rem; height: 40px; padding: 0 .8rem; border: 1px solid var(--hfk-border); background: #fff; color: var(--hfk-charcoal); font-size: .85rem; font-weight: 600; transition: background .25s, color .25s, border-color .25s, transform .25s var(--hfk-ease); }
.ra-share-btn[hidden] { display: none; }
.ra-share-btn i { width: 16px; text-align: center; }
.ra-share-btn:hover { transform: translateY(-2px); color: #fff; }
.ra-share-btn.is-copy:hover, .ra-share-btn.is-native:hover { background: var(--hfk-charcoal); border-color: var(--hfk-charcoal); }
.ra-share-btn.is-wa:hover { background: #1E9E57; border-color: #1E9E57; }
.ra-share-btn.is-mail:hover { background: var(--hfk-sky); border-color: var(--hfk-sky); }
.ra-share-btn.is-done { background: var(--hfk-forest); border-color: var(--hfk-forest); color: #fff; }
.ra-share-side .ra-share-btn { flex: 1 1 calc(50% - .4rem); justify-content: center; }
.ra-side-calc { display: flex; align-items: center; gap: .9rem; padding: 1rem 1.1rem; background: var(--hfk-grad-fire); color: #fff; transition: transform .3s var(--hfk-ease), box-shadow .3s; }
.ra-side-calc > i { width: 46px; height: 46px; flex: 0 0 46px; display: grid; place-items: center; background: rgba(255, 255, 255, .2); font-size: 1.2rem; transition: transform .4s var(--hfk-ease-bounce); }
.ra-side-calc span { font-size: .84rem; line-height: 1.4; }
.ra-side-calc strong { display: block; font-family: var(--hfk-font-head); font-size: 1.05rem; }
.ra-side-calc:hover { color: #fff; transform: translateY(-3px); box-shadow: var(--hfk-shadow-fire); }
.ra-side-calc:hover > i { transform: rotate(-10deg) scale(1.1); }

/* ---------------------------------------------------------------------
 * 4. Articles liés
 * ------------------------------------------------------------------- */
.ra-related-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.3rem; }
.ra-rel { display: flex; flex-direction: column; background: #fff; border: 1px solid var(--hfk-border); transition: transform .4s var(--hfk-ease), box-shadow .4s var(--hfk-ease); }
.ra-rel:hover { transform: translateY(-6px); box-shadow: var(--hfk-shadow-lg); }
.ra-rel-media { display: block; aspect-ratio: 16 / 9; overflow: hidden; background: var(--hfk-placeholder); }
.ra-rel-media img, .ra-rel-media .img-ph { width: 100%; height: 100%; object-fit: cover; transition: transform .7s var(--hfk-ease); }
.ra-rel:hover .ra-rel-media img, .ra-rel:hover .ra-rel-media .img-ph { transform: scale(1.06); }
.ra-rel-body { flex: 1; padding: 1rem 1.2rem 1.2rem; }
.ra-rel-meta { font-size: .76rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--hfk-flame-dark); }
.ra-rel-body h3 { margin: .4rem 0; font-size: 1.12rem; line-height: 1.3; }
.ra-rel-body h3 a { color: var(--hfk-charcoal); }
.ra-rel-body h3 a:hover { color: var(--hfk-flame-dark); }
.ra-rel-body p { margin: 0; font-size: .9rem; color: var(--hfk-muted); }
.ra-related-more { margin: 2rem 0 0; text-align: center; }

/* 404 */
.ra-missing .empty-state p { max-width: 640px; margin-left: auto; margin-right: auto; color: var(--hfk-muted); }
.ra-missing-form { display: flex; gap: .5rem; max-width: 520px; margin: 1.4rem auto; }
.ra-missing-form .form-control { flex: 1; min-width: 0; }
.ra-missing-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: .4rem; max-width: 620px; margin: 0 auto 1.4rem; padding: 0; list-style: none; text-align: left; }
.ra-missing-list a { display: flex; align-items: center; gap: .6rem; padding: .7rem .9rem; border: 1px solid var(--hfk-border); color: var(--hfk-charcoal); font-weight: 600; transition: border-color .25s, background .25s, padding-left .25s var(--hfk-ease); }
.ra-missing-list a i { color: var(--hfk-flame); }
.ra-missing-list a:hover { border-color: var(--hfk-flame); background: var(--hfk-cream); padding-left: 1.2rem; }

/* ---------------------------------------------------------------------
 * 5. Adaptation aux écrans : sommaire repliable collant sur mobile
 * ------------------------------------------------------------------- */
@media (max-width: 991.98px) {
    .ra-layout { grid-template-columns: minmax(0, 1fr); }
    .ra-article { max-width: none; }
    .ra-side { display: contents; }
    .ra-toc { order: -1; position: sticky; top: var(--ra-sticky-top); z-index: 20; box-shadow: var(--hfk-shadow); margin-bottom: 1.4rem; }
    .ra-side-share, .ra-side-calc { display: none; }
    .ra-toc-toggle { padding: .7rem 1rem .55rem; cursor: pointer; }
    .ra-toc-current { display: block; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .86rem; color: var(--hfk-muted); }
    .ra-toc-chevron { display: inline-block; flex: 0 0 auto; color: var(--hfk-flame); transition: transform .35s var(--hfk-ease); }
    .ra-toc.is-open .ra-toc-chevron { transform: rotate(180deg); }
    .ra-progress { margin: 0; }
    .ra-progress-text { display: none; }
    .ra-toc-list { display: none; max-height: 55vh; overflow-y: auto; padding-top: .4rem; }
    .ra-toc.is-open .ra-toc-list { display: block; animation: hfk-fade-up .3s var(--hfk-ease) both; }
    .ra-toc.is-open .ra-progress-text { display: block; margin-top: .5rem; }
    .ra-related-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 575.98px) {
    .ra-meta li { font-size: .8rem; padding: .35rem .6rem; }
    .ra-content { font-size: 1rem; }
    .ra-content > p:first-child { font-size: 1.06rem; }
    .ra-content > p:first-child::first-letter { font-size: 3rem; }
    .ra-related-grid { grid-template-columns: minmax(0, 1fr); }
    .ra-end-share .ra-share { width: 100%; }
    .ra-end-share .ra-share-btn { flex: 1 1 calc(50% - .4rem); justify-content: center; }
    .ra-missing-form { flex-direction: column; }
}