/* Styles de base pour l'article */
.article-body {
    max-width: 920px;
    margin: 0 auto;
    padding: clamp(1.1rem, 4vw, 2.4rem);
    line-height: 1.8;
    border-radius: 12px;
}

.article-body .matatabi-intro {
    margin: 0 0 2rem;
    padding: 1.2rem 1.4rem;
    border-left: 5px solid #f3ad48;
    border-radius: 0 16px 16px 0;
    background: linear-gradient(90deg, rgba(243, 173, 72, .12), rgba(255, 255, 255, 0));
}

.article-body .matatabi-intro p {
    margin: 0;
    color: #263d50;
    font-size: clamp(1.08rem, 2vw, 1.28rem);
    line-height: 1.7;
}

.article-body .matatabi-after-test {
    margin-top: 2.2rem;
}

.article-content-wrapper {
    max-width: 800px;
    margin: 2rem auto;
    padding: 0 2rem;
}

/* Titres */
.article-body h2 {
    font-size: 1.8rem;
    color: #1a202c;
    margin: 0.5rem 0 1.2rem;
    padding-bottom: 0.8rem;
    border-bottom: 2px solid #5b7fae;
    font-weight: 600;
}

.article-body > h2:first-child {
    margin-top: 0;
}

.article-body h3 {
    font-size: 1.5rem;
    color: #2d3748;
    margin: 1.8rem 0 1rem;
    font-weight: 600;
}

/* Paragraphes */
.article-body p {
    font-size: 1.1rem;
    line-height: 1.85;
    color: #374151;
    margin-bottom: 1.2rem;
}

/* Premier paragraphe sans marge supérieure */
.article-body > p:first-child {
    margin-top: 0;
}

/* Listes */
.article-body ul {
    padding-left: 1.5rem;
    margin: 1.2rem 0;
}

.article-body ul li {
    margin-bottom: 0.6rem;
    color: #374151;
}

.article-body ul li::marker {
    color: #5b7fae;
}

/* Liens */
.article-body a {
    color: #5b7fae;
    text-decoration: none;
    border-bottom: 1px solid rgba(68, 172, 238, 0.3);
}

.article-body a:hover {
    border-bottom-color: #5b7fae;
}

/* Citations */
.article-body blockquote {
    margin: 1.5rem 0;
    padding: 1.5rem 2rem;
    border-left: 4px solid #5b7fae;
    background-color: #fafafa;
    font-style: italic;
    color: #4a5568;
    border-radius: 0 8px 8px 0;
}

.article-body blockquote p {
    margin-bottom: 0;
}

/* Images */
.article-body img {
    max-width: 100%;
    height: auto;
    margin: 1.5rem auto;
    display: block;
}

/* Produit du jour encart */

.product-sidebar {
    float: right;
    width: 300px;
    margin-left: 2rem;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: linear-gradient(to bottom right, #5c7fae, #152236);
    border-radius: 12px;
    color: white;
    position: relative;
    transition: transform 0.6s ease-in-out;
    overflow: hidden;
}

.product-sidebar::before {
    content: "";
    position: absolute;
    top: -1px;
    left: -10px;
    right: -1px;
    bottom: -1px;
    background-image: linear-gradient(to right, transparent, #5b7fae 3%, transparent 97%, transparent);
    background-size: 100% 20%;
    background-repeat: repeat-y;
        animation: line-flow 30s linear infinite;
     animation-delay: 5s;
     z-index: 1;
    border-radius: inherit;
    mix-blend-mode: lighten;
    pointer-events: none;
     opacity: 0;

}
@keyframes line-flow {
    0%, 70%, 100%{
        background-position: 0% 0%;
        opacity: 0;
    }
     15%{
         background-position: 0% 100%;
         opacity: 0.5;
    }
    33.33%, 50%{
          background-position: 0% 100%;
         opacity: 0.1;

      }

}


.product-sidebar p {
    color: #888;
}

.product-sidebar h3 {
    color: white !important;
    margin-top: 0 !important;
    font-size: 1.3rem !important;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

.product-sidebar img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.product-sidebar .price {
    font-size: 1.4rem;
    color: var(--primary-color);
    font-weight: bold;
    margin: 0.5rem 0;
}

.product-sidebar .btn-buy {
    display: block;
    width: 100%;
    padding: 0.8rem;
    background: var(--primary-color);
    color: white;
    text-align: center;
    border-radius: 6px;
    text-decoration: none;
    transition: background 0.3s ease;
}

.product-sidebar .btn-buy:hover {
    background: var(--secondary-color);
}

/* Dans la page du livre, la fiche Amazon clôt l'article sur toute sa largeur.
   Les encarts flottants historiques conservent leur comportement d'origine. */
.article-body--book .product-sidebar {
    float: none;
    display: grid;
    grid-template-columns: minmax(150px, 210px) auto minmax(0, 1fr);
    align-items: center;
    column-gap: 2rem;
    width: 100%;
    margin: 2.5rem 0 0;
    padding: 1.5rem;
}

.article-body--book .product-sidebar img {
    grid-row: 1 / span 3;
    margin: 0;
    max-height: 260px;
    object-fit: contain;
}

.article-body--book .product-sidebar h4 {
    grid-column: 2 / -1;
    margin: 0 0 .6rem;
    color: white;
    font-size: 1.35rem;
}

.article-body--book .product-sidebar p {
    grid-column: 2 / -1;
    margin: 0 0 1rem;
    color: rgba(255, 255, 255, .82);
}

.article-body--book .product-sidebar .price {
    grid-column: 2;
    grid-row: 3;
    margin: 0;
    white-space: nowrap;
}

.article-body--book .product-sidebar .btn-buy {
    grid-column: 3;
    grid-row: 3;
    justify-self: start;
    width: auto;
    min-width: 210px;
}

@media (max-width: 600px) {
    .article-body--book .product-sidebar {
        display: block;
    }

    .article-body--book .product-sidebar img {
        width: min(100%, 230px);
        margin: 0 auto 1rem;
    }

    .article-body--book .product-sidebar .btn-buy {
        width: 100%;
    }
}

/* Produits en bas de l'article */
.bottom-products {
    margin-top: 3rem;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: clamp(1rem, 2vw, 2rem);
}

.bottom-product-card {
    min-width: 0;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.bottom-product-card:hover {
    transform: translateY(-5px);
}

.bottom-product-card img {
    width: 100%;
    height: 200px;
    object-fit: contain;
}

.bottom-product-card .product-info {
    padding: 1.5rem;
}

.bottom-product-card h4 {
    margin: 0 0 0.5rem 0;
    color: #1a202c;
    font-size: 1.2rem;
}

.bottom-product-card .price {
    color: var(--primary-color);
    font-size: 1.2rem;
    font-weight: bold;
    margin: 0.5rem 0;
}

.bottom-product-card .btn-buy {
    display: inline-block;
    padding: 0.6rem 1.2rem;
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 4px;
    transition: background 0.3s ease;
}

.bottom-product-card .btn-buy:hover {
    background: var(--secondary-color);
}

/* Les trois repères éditoriaux des articles interactifs restent sur une seule
   rangée en affichage large, puis se replient proprement avec la largeur utile. */
.article-body .benefits-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: clamp(1rem, 2vw, 2rem);
}

@media (max-width: 900px) {
    .article-body .benefits-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    .article-body .benefits-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

.article-book-bridge {
    display: grid;
    grid-template-columns: 82px 1fr auto;
    align-items: center;
    gap: 1.1rem;
    margin: 2.5rem 0 1rem;
    padding: 1rem;
    color: var(--matatabi-primary);
    background: #fff;
    border: 1px solid rgba(116, 164, 86, .2);
    border-radius: 18px;
    box-shadow: var(--card-shadow);
    text-decoration: none;
}

.book-a-plus-visual {
    margin: 2.25rem 0;
}

.book-a-plus-visual img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 18px;
    box-shadow: var(--card-shadow);
}

.book-a-plus-visual a {
    display: block;
    border-radius: 18px;
}

.book-a-plus-visual a:focus-visible {
    outline: 3px solid var(--matatabi-primary);
    outline-offset: 4px;
}

.book-a-plus-visual figcaption {
    display: block;
    width: 100%;
    margin-top: .65rem;
    color: #6a6a6a;
    font-size: .88rem;
    line-height: 1.45;
    text-align: center;
}

.article-book-bridge img {
    width: 82px;
    height: 82px;
    border-radius: 13px;
    object-fit: cover;
}

.article-book-bridge span,
.article-book-bridge small {
    display: block;
}

.article-book-bridge small {
    margin-top: .35rem;
    color: #626262;
    line-height: 1.45;
}

.article-book-bridge i {
    color: var(--matatabi-secondary);
}

@media (max-width: 600px) {
    .article-book-bridge {
        grid-template-columns: 66px 1fr;
        gap: .85rem;
    }

    .article-book-bridge img {
        width: 66px;
        height: 66px;
    }

    .article-book-bridge i {
        display: none;
    }
}

/* Media Queries */
@media (max-width: 768px) {
    .article-body {
        padding: 1.5rem;
    }

    .article-body h2 {
        font-size: 1.6rem;
    }

    .article-body h3 {
        font-size: 1.4rem;
    }

    .article-body p {
        font-size: 1rem;
    }

    .product-sidebar {
        float: none;
        width: 100%;
        margin-left: 0;
    }

    
    .bottom-products {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 520px) {
    .bottom-products {
        grid-template-columns: minmax(0, 1fr);
    }
}
