/*
 * "הכתבה הבאה" — the next articles at the end of the article (includes/next-article.php,
 * doc/next-article.md). No frame and no section title: the next article reads as the page going
 * on. Sponsored cards are the cards of "אולי יעניין אותך" (their styles come from
 * _maybe-interesting.css of ttfc-css-compiler); here only their row and label. Loaded only on the
 * articles that get the next articles.
 */

.next-article {
    max-width: var(--post-content-width, 750px);
    margin: 0 auto;
    padding: 0 20px;
}

.entry-content.wp-block-post-content > .next-article:last-child {
    margin-bottom: 40px;
}

.next-article .next-article__item {
    position: relative;
    margin: 0;
    padding: 36px 0 8px;
    border-top: 1px solid #e3e3e3;
}

.next-article .next-article__label {
    margin: 0 0 10px;
    font-size: 13px;
    font-weight: 600;
    color: #8a8a8a;
}

.next-article .next-article__super {
    margin: 0 0 6px;
    font-size: 16px;
    font-weight: 700;
    color: var(--primary-color-jhhd, #DE0100);
}

.next-article .next-article__title {
    margin: 0 0 10px;
    font-size: 30px;
    line-height: 1.25;
    font-weight: 800;
}

.next-article .next-article__title a,
.next-article .next-article__title a:visited {
    color: var(--secondary-color-jhhd, #1B365D);
    text-decoration: none;
    border: 0;
    box-shadow: none;
}

.next-article .next-article__title a:hover {
    text-decoration: underline;
}

.next-article .next-article__subtitle {
    margin: 0 0 10px;
    font-size: 19px;
    line-height: 1.45;
    color: #333;
}

.next-article .next-article__date {
    margin: 0 0 16px;
    font-size: 13px;
    color: #8a8a8a;
}

.next-article .next-article__figure {
    margin: 0 0 18px;
}

.next-article .next-article__img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 4px;
}

.next-article .next-article__body {
    position: relative;
}

.next-article .next-article__item.is-collapsed .next-article__body {
    max-height: 9.5em;
    overflow: hidden;
}

.next-article .next-article__item.is-collapsed .next-article__body::after {
    content: "";
    position: absolute;
    inset: auto 0 0 0;
    height: 5em;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0), var(--ttfc-page-bg, #fff));
    pointer-events: none;
}

.next-article .next-article__body:focus {
    outline: none;
}

.next-article .next-article__more {
    display: block;
    margin: 14px auto 0;
    padding: 12px 40px;
    font: inherit;
    font-size: 17px;
    font-weight: 700;
    color: #fff;
    background: var(--primary-color-jhhd, #DE0100);
    border: 0;
    border-radius: 4px;
    cursor: pointer;
}

.next-article .next-article__more[hidden] {
    display: none;
}

.next-article .next-article__more:hover {
    opacity: 0.9;
}

.next-article .next-article__more:focus-visible {
    outline: 3px solid var(--secondary-color-jhhd, #1B365D);
    outline-offset: 2px;
}

/* Sponsored: an item of the chain in the format of a beginning, with a clear label. */
.next-article .next-article__label--sponsored {
    display: inline-block;
    padding: 4px 10px;
    color: #fff;
    background: #4a4a4a;
    border-radius: 3px;
    font-size: 13px;
    font-weight: 700;
}

.next-article .next-article__item--sponsored .next-article__figure {
    display: block;
}

.next-article a.next-article__more--sponsored,
.next-article a.next-article__more--sponsored:visited {
    text-align: center;
    text-decoration: none;
    color: #fff;
    background: #4a4a4a;
}

.next-article__sentinel {
    height: 1px;
}

.next-article__status {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
}

/* Only when the reader actually waits for the next beginning (is-waiting, after 600 ms): a small
   spinning ring, not three dots — three dots read as "more" to click (Israel, 26/11/2026). */
.next-article.is-waiting .next-article__sentinel {
    box-sizing: border-box;
    height: 28px;
    width: 28px;
    margin: 20px auto 0;
    border: 3px solid #e3e3e3;
    border-top-color: var(--primary-color-jhhd, #DE0100);
    border-radius: 50%;
    animation: next-article-spin 0.8s linear infinite;
}

@keyframes next-article-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .next-article.is-waiting .next-article__sentinel {
        animation-duration: 2.4s;
    }
}

@media (max-width: 768px) {
    .next-article {
        padding: 0;
    }

    /* With side banners the article sits in .ttfc-post-content-wrapper (20px padding) and the
       section may come after that wrapper (position "end"), so it needs the same gutter itself. */
    .ttfc-post-content-with-sidebar-banner + .next-article {
        padding: 0 20px;
    }

    .next-article .next-article__title {
        font-size: 24px;
    }

    .next-article .next-article__subtitle {
        font-size: 17px;
    }

    .next-article .next-article__more {
        width: 100%;
    }
}

/* The heading is a plain block: no box, border or sticky position from the theme's styles for
   "…head" classes (it stuck to the top of the screen over the opened text). */
.next-article .next-article__head {
    position: static !important;
    z-index: auto !important;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    box-shadow: none;
}

.next-article .next-article__head p,
.next-article .next-article__label {
    line-height: 1.4;
}

/* Comments folded behind a button where the chain replaces "אולי יעניין אותך"
   (ttfc_next_article_comments_fold): is-folded for everyone, or arm C of the experiment. */
.ttfc-comments-fold__button {
    display: none;
}

.ttfc-comments-fold.is-folded:not(.is-open) > .ttfc-comments-fold__button,
html.ttfc-end-C .ttfc-comments-fold:not(.is-open) > .ttfc-comments-fold__button {
    display: block;
    width: 100%;
    max-width: var(--post-content-width, 750px);
    margin: 24px auto;
    padding: 12px 20px;
    font: inherit;
    font-size: 17px;
    font-weight: 700;
    color: var(--secondary-color-jhhd, #1B365D);
    background: #fff;
    border: 1px solid #c9ced6;
    border-radius: 4px;
    cursor: pointer;
}

.ttfc-comments-fold.is-folded:not(.is-open) > .ttfc-comments-fold__button:hover,
html.ttfc-end-C .ttfc-comments-fold:not(.is-open) > .ttfc-comments-fold__button:hover {
    background: #f4f6f9;
}

.ttfc-comments-fold.is-folded:not(.is-open) > .ttfc-comments-fold__body,
html.ttfc-end-C .ttfc-comments-fold:not(.is-open) > .ttfc-comments-fold__body {
    display: none;
}

@media (max-width: 768px) {
    .ttfc-comments-fold.is-folded:not(.is-open) > .ttfc-comments-fold__button,
    html.ttfc-end-C .ttfc-comments-fold:not(.is-open) > .ttfc-comments-fold__button {
        width: calc(100% - 40px);
    }
}

/* The banner manager's banners in a next article's text: hidden until it is opened with a pageview
   of its own (next-article.js adds has-banners after ttfc_banner_tracking.scan()). */
.next-article .next-article__item:not(.has-banners) .ttfc-banner-block {
    display: none !important;
}

/* Format "gallery" (hmb): the main image, a strip of the first pictures, "לכל התמונות". The gallery
   itself stays out of view (and unloaded) until the item is opened; then the strip goes away. */
.next-article .next-article__item--gallery.is-collapsed .next-article__body {
    display: none;
}

.next-article .next-article__item--gallery .next-article__figure {
    margin-bottom: 6px;
}

.next-article .next-article__strip {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 6px;
    margin: 0 0 4px;
}

.next-article .next-article__thumb {
    display: block;
    aspect-ratio: 1 / 1;
    margin: 0;
    padding: 0;
    overflow: hidden;
    border: 0;
    border-radius: 4px;
    background: #eee;
    cursor: pointer;
}

.next-article .next-article__thumb-img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.next-article .next-article__item--gallery.is-open .next-article__strip,
.next-article .next-article__item--gallery.is-open .next-article__figure.is-in-gallery {
    display: none;
}

@media (max-width: 768px) {
    .next-article .next-article__strip {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 4px;
    }

    .next-article .next-article__strip .next-article__thumb:nth-child(n+5) {
        display: none;
    }
}
