/*
 * JewishNews visual redesign — homepage v4.
 * The source SP Page Builder content remains intact and is hidden only after
 * jn-redesign.js has successfully created the new presentation layer.
 */

:root {
    --jn-blue: #168df0;
    --jn-blue-dark: #0570ca;
    --jn-ink: #101217;
    --jn-muted: #717985;
    --jn-line: #e5e8ec;
    --jn-surface: #ffffff;
    --jn-page: #f5f6f8;
    --jn-radius: 12px;
    --jn-shadow: 0 12px 36px rgba(12, 25, 44, 0.07);
}

html {
    scroll-behavior: smooth;
}

body.site {
    background: var(--jn-page) !important;
    color: var(--jn-ink);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body.site a {
    transition: color .18s ease, border-color .18s ease, background-color .18s ease, transform .18s ease, box-shadow .18s ease;
}

/* Header: only appearance, Joomla menu behavior is untouched. */
html body.site #sp-header.dark-bg,
html body.site #sp-header.header-sticky {
    height: 62px !important;
    min-height: 62px !important;
    max-height: 62px !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #090a0c !important;
    box-shadow: 0 1px 0 rgba(255,255,255,.08) !important;
}

html body.site #sp-header > .container,
html body.site #sp-header .container-inner,
html body.site #sp-header .container-inner > .row,
html body.site #sp-header .container-inner > .row > [class*="col-"],
html body.site #sp-header .sp-column {
    height: 62px !important;
    min-height: 62px !important;
    max-height: 62px !important;
}

html body.site #sp-header > .container {
    width: min(1440px, calc(100% - 40px)) !important;
    max-width: 1440px !important;
    padding: 0 !important;
}

html body.site #sp-header .container-inner > .row {
    margin: 0 !important;
    align-items: center !important;
}

html body.site #sp-header #sp-logo > .sp-column,
html body.site #sp-header #sp-menu > .sp-column,
html body.site #sp-header #sp-logo-left > .sp-column,
html body.site #sp-header #sp-logo-right > .sp-column {
    align-items: center !important;
}

html body.site #sp-header .logo-image {
    height: 46px !important;
    width: auto !important;
    max-width: 210px !important;
    object-fit: contain;
}

#sp-header .sp-megamenu-parent {
    display: flex !important;
    align-items: stretch;
    gap: 28px;
}

#sp-header .sp-megamenu-parent > li > a,
#sp-header .sp-megamenu-parent > li > span {
    position: relative;
    display: flex !important;
    align-items: center;
    height: 62px !important;
    padding: 0 !important;
    color: rgba(255,255,255,.78) !important;
    font-size: 13px !important;
    line-height: 1 !important;
    font-weight: 700 !important;
    letter-spacing: .035em;
    text-transform: uppercase;
}

#sp-header .sp-megamenu-parent > li > a:hover,
#sp-header .sp-megamenu-parent > li.active > a,
#sp-header .sp-megamenu-parent > li.current-item > a {
    color: #fff !important;
}

#sp-header .sp-megamenu-parent > li.active > a::after,
#sp-header .sp-megamenu-parent > li.current-item > a::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    background: var(--jn-blue);
    border-radius: 3px 3px 0 0;
}



/* Mobile header / offcanvas bar */
#sp-mobile-logo {
    min-height: 54px !important;
    background: #090a0c !important;
    box-shadow: 0 1px 0 rgba(255,255,255,.08) !important;
}

#sp-mobile-logo .container,
#sp-mobile-logo .container-inner,
#sp-mobile-logo .row {
    min-height: 54px !important;
    height: 54px !important;
    align-items: center !important;
}

#sp-mobile-logo .logo-image,
#sp-mobile-logo img,
#sp-mobile-logo .custom img {
    max-height: 34px !important;
    width: auto !important;
}

#offcanvas-toggler,
.offcanvas-toggler {
    line-height: 54px !important;
}


/* Gazette has a built-in 120px sticky-header offset. Keep it aligned with the compact header. */
html body.site #sp-header.header-sticky ~ section#sp-main-body {
    padding-top: 62px !important;
}

html body.site.jn-home-redesign-ready #sp-main-body {
    margin-top: 0 !important;
}

@media (max-width: 767px) {
    html body.site #sp-header.header-sticky ~ section#sp-main-body {
        padding-top: 54px !important;
    }
}

/*
 * The homepage receives jn-home-pending directly from PHP, before the first
 * browser paint. The old SP Page Builder content keeps its dimensions but is
 * invisible until the new layout is ready. This removes the 1–2 second flash.
 */
html body.site.jn-home-pending #sp-page-builder > .page-content.builder-container {
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Do not animate the switch: the finished layout appears in one paint. */
html body.site.jn-home-pending .jn-home-redesign {
    visibility: visible !important;
    opacity: 1 !important;
}

/* The original page is hidden only after the new page has been built. */
.jn-home-redesign-ready #sp-page-builder > .page-content.builder-container {
    display: none !important;
}

.jn-home-redesign {
    width: 100%;
    padding: 14px 0 54px;
}

.jn-home-container {
    width: min(1440px, calc(100% - 48px));
    margin: 0 auto;
}

.jn-lead-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.75fr) minmax(250px, .72fr) minmax(300px, .76fr);
    gap: 24px;
    align-items: stretch;
}

.jn-hero {
    position: relative;
    min-height: 520px;
    overflow: hidden;
    border-radius: var(--jn-radius);
    background: #111820;
    box-shadow: var(--jn-shadow);
}

.jn-hero__media,
.jn-hero__image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.jn-hero__image {
    object-fit: cover;
    object-position: center;
    transition: transform .55s ease;
}

.jn-hero:hover .jn-hero__image {
    transform: scale(1.025);
}

.jn-hero__shade {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(5,8,12,.03) 20%, rgba(5,8,12,.22) 54%, rgba(5,8,12,.92) 100%);
}

.jn-hero__content {
    position: absolute;
    z-index: 2;
    left: 30px;
    right: 30px;
    bottom: 28px;
    max-width: 720px;
    color: #fff;
}

.jn-hero__category,
.jn-kicker {
    color: var(--jn-blue);
    font-size: 12px;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: .035em;
    text-transform: uppercase;
}

.jn-hero__category {
    display: inline-flex;
    padding: 7px 10px;
    margin-bottom: 13px;
    color: #fff;
    background: var(--jn-blue);
    border-radius: 4px;
}

.jn-hero h1 {
    margin: 0;
    font-size: clamp(28px, 2.25vw, 42px);
    line-height: 1.08;
    font-weight: 800;
    letter-spacing: -.025em;
}

.jn-hero h1 a {
    color: #fff !important;
}

.jn-hero h1 a:hover {
    color: #fff !important;
}

.jn-hero time {
    display: block;
    margin-top: 18px;
    color: rgba(255,255,255,.76);
    font-size: 13px;
}

.jn-side-stories {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.jn-side-story {
    display: grid;
    grid-template-columns: 104px minmax(0, 1fr);
    gap: 14px;
    min-height: 0;
    padding: 0 0 14px;
    border-bottom: 1px solid var(--jn-line);
}

.jn-side-story:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.jn-side-story__media {
    display: block;
    height: 96px;
    overflow: hidden;
    border-radius: 8px;
    background: #eaf2fa;
}

.jn-side-story__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.jn-side-story__number {
    display: flex;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
    color: var(--jn-blue);
    font-size: 28px;
    font-weight: 800;
    background: linear-gradient(145deg, #edf6ff, #f7fbff);
}

.jn-side-story__body {
    min-width: 0;
}

.jn-side-story h3 {
    margin: 5px 0 8px;
    font-size: 16px;
    line-height: 1.3;
    font-weight: 700;
}

.jn-side-story h3 a,
.jn-latest-card h3 a,
.jn-category-card h3 a {
    color: var(--jn-ink) !important;
}

.jn-side-story h3 a:hover,
.jn-latest-card h3 a:hover,
.jn-category-card h3 a:hover {
    color: var(--jn-blue-dark) !important;
}

.jn-side-story time,
.jn-latest-card time,
.jn-category-card time {
    color: var(--jn-muted);
    font-size: 12px;
}

.jn-home-sidebar {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.jn-donation-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 250px;
    padding: 22px 24px;
    color: var(--jn-ink) !important;
    text-align: center;
    background: var(--jn-surface);
    border: 1px solid var(--jn-line);
    border-radius: var(--jn-radius);
    box-shadow: 0 8px 24px rgba(12,25,44,.035);
}

.jn-donation-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--jn-shadow);
}

.jn-donation-card img {
    display: block;
    width: auto;
    max-width: 240px;
    height: 116px;
    object-fit: contain;
    margin: 0 auto 8px;
}

.jn-donation-card p {
    margin: 2px 0 18px;
    color: var(--jn-muted);
    font-size: 14px;
    line-height: 1.45;
}

.jn-donation-card > span {
    display: inline-flex;
    min-width: 170px;
    min-height: 46px;
    align-items: center;
    justify-content: center;
    margin-top: auto;
    color: #fff;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: .02em;
    text-transform: uppercase;
    background: #d9222a;
    border-radius: 5px;
}

.jn-cemetery-card {
    position: relative;
    display: block;
    min-height: 250px;
    overflow: hidden;
    color: #fff !important;
    background: #161a1d;
    border-radius: var(--jn-radius);
    box-shadow: var(--jn-shadow);
}

.jn-cemetery-card > img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .5s ease;
}

.jn-cemetery-card:hover > img {
    transform: scale(1.035);
}

.jn-cemetery-card__shade {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(7,9,10,.94) 0%, rgba(7,9,10,.68) 58%, rgba(7,9,10,.20) 100%);
}

.jn-cemetery-card__content {
    position: absolute;
    z-index: 2;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-end;
    padding: 24px;
}

.jn-cemetery-card strong {
    max-width: 230px;
    font-size: 25px;
    line-height: 1.05;
    font-weight: 800;
}

.jn-cemetery-card small {
    max-width: 260px;
    margin-top: 10px;
    color: rgba(255,255,255,.78);
    font-size: 13px;
    line-height: 1.4;
}

.jn-cemetery-card b {
    display: inline-flex;
    margin-top: 18px;
    padding: 9px 12px;
    color: #fff;
    font-size: 12px;
    line-height: 1;
    text-transform: uppercase;
    border: 1px solid rgba(255,255,255,.62);
    border-radius: 4px;
}

.jn-latest-section {
    margin-top: 30px;
}

.jn-section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 16px;
}

.jn-section-heading h2 {
    position: relative;
    margin: 0;
    padding-bottom: 10px;
    color: var(--jn-ink);
    font-size: 20px;
    line-height: 1.1;
    font-weight: 800;
    letter-spacing: .02em;
    text-transform: uppercase;
}

.jn-section-heading h2::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 34px;
    height: 3px;
    background: var(--jn-blue);
    border-radius: 3px;
}

.jn-section-heading > a {
    color: var(--jn-blue) !important;
    font-size: 13px;
    font-weight: 700;
}

.jn-latest-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.jn-latest-card {
    display: grid;
    grid-template-columns: 118px minmax(0, 1fr);
    gap: 14px;
    min-height: 130px;
    padding: 12px;
    background: var(--jn-surface);
    border: 1px solid var(--jn-line);
    border-radius: 9px;
}

.jn-latest-card:hover {
    transform: translateY(-2px);
    border-color: #cbd8e5;
    box-shadow: 0 10px 24px rgba(12,25,44,.055);
}

.jn-latest-card__media {
    display: block;
    height: 112px;
    overflow: hidden;
    border-radius: 7px;
    background: #edf5fc;
}

.jn-latest-card__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.jn-latest-card__number {
    display: flex;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
    color: var(--jn-blue);
    font-size: 31px;
    font-weight: 800;
    background: linear-gradient(145deg, #edf6ff, #f9fcff);
}

.jn-latest-card h3 {
    margin: 5px 0 8px;
    font-size: 15px;
    line-height: 1.34;
    font-weight: 700;
}

.jn-category-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin-top: 28px;
}

.jn-category-card {
    padding: 18px;
    background: var(--jn-surface);
    border: 1px solid var(--jn-line);
    border-radius: var(--jn-radius);
}

.jn-category-card .jn-section-heading {
    margin-bottom: 14px;
}

.jn-category-card .jn-section-heading h2 {
    font-size: 18px;
}

.jn-category-card__content {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
    gap: 16px;
}

.jn-category-lead__media {
    display: block;
    height: 210px;
    overflow: hidden;
    border-radius: 8px;
    background: #edf2f6;
}

.jn-category-lead__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.jn-category-lead h3 {
    margin: 11px 0 7px;
    font-size: 16px;
    line-height: 1.32;
    font-weight: 750;
}

.jn-category-list article {
    padding: 0 0 12px;
    margin: 0 0 12px;
    border-bottom: 1px solid var(--jn-line);
}

.jn-category-list article:last-child {
    padding-bottom: 0;
    margin-bottom: 0;
    border-bottom: 0;
}

.jn-category-list h3 {
    margin: 0 0 6px;
    font-size: 14px;
    line-height: 1.32;
    font-weight: 700;
}

.jn-image-placeholder {
    display: block;
    width: 100%;
    height: 100%;
    background: linear-gradient(145deg, #eaf3fb, #f8fbfd);
}

/* The old social block is not copied into the new homepage. */
.jn-home-redesign #sppb-addon-1537359022060,
.jn-home-redesign #sppb-addon-1537344109952 {
    display: none !important;
}



/* Images for title-only Joomla news lists are filled from the article's own og:image. */
.jn-side-story__media,
.jn-latest-card__media {
    position: relative;
}

.jn-side-story__image,
.jn-latest-card__image {
    display: block;
    opacity: 0;
    animation: jn-image-in .28s ease forwards;
}

@keyframes jn-image-in {
    to { opacity: 1; }
}

.jn-side-story.has-image .jn-side-story__image,
.jn-latest-card.has-image .jn-latest-card__image,
.jn-side-story__media > img,
.jn-latest-card__media > img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}


@media (max-width: 1280px) {
    .jn-lead-layout {
        grid-template-columns: minmax(0, 1.65fr) minmax(235px, .72fr) minmax(280px, .78fr);
        gap: 18px;
    }

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

    .jn-category-card__content {
        grid-template-columns: 1fr;
    }

    .jn-category-lead__media {
        height: 220px;
    }
}

@media (max-width: 1050px) {
    #sp-header > .container,
    .jn-home-container {
        width: min(100% - 32px, 980px) !important;
    }

    .jn-lead-layout {
        grid-template-columns: minmax(0, 1fr) minmax(280px, .48fr);
    }

    .jn-hero {
        min-height: 500px;
    }

    .jn-side-stories {
        grid-column: 1;
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 14px;
    }

    .jn-side-story {
        grid-template-columns: 78px minmax(0, 1fr);
        border: 1px solid var(--jn-line);
        border-radius: 9px;
        padding: 10px;
        background: var(--jn-surface);
    }

    .jn-side-story__media {
        height: 78px;
    }

    .jn-home-sidebar {
        grid-column: 2;
        grid-row: 1 / span 2;
    }

    .jn-category-grid {
        grid-template-columns: 1fr;
    }

    .jn-category-card__content {
        grid-template-columns: minmax(240px, .85fr) minmax(0, 1.15fr);
    }
}

@media (max-width: 767px) {
    html body.site #sp-header.dark-bg,
    html body.site #sp-header.header-sticky,
    html body.site #sp-header > .container,
    html body.site #sp-header .container-inner,
    html body.site #sp-header .container-inner > .row,
    html body.site #sp-header .container-inner > .row > [class*="col-"],
    html body.site #sp-header .sp-column {
        height: 56px !important;
        min-height: 56px !important;
        max-height: 56px !important;
    }

    #sp-header > .container,
    .jn-home-container {
        width: calc(100% - 24px) !important;
    }

    html body.site #sp-header .logo-image,
    html body.site #sp-header .logo-image-phone,
    html body.site #sp-header #mod-custom157 img {
        height: 36px !important;
        width: auto !important;
        max-height: 36px !important;
    }

    html body.site #sp-header .sp-megamenu-parent > li > a,
    html body.site #sp-header .sp-megamenu-parent > li > span {
        height: 56px !important;
    }

    .jn-home-redesign {
        padding-top: 8px;
    }

    .jn-lead-layout {
        display: block;
    }

    .jn-hero {
        min-height: 410px;
    }

    .jn-hero__content {
        left: 19px;
        right: 19px;
        bottom: 20px;
    }

    .jn-hero h1 {
        font-size: 27px;
    }

    .jn-side-stories {
        display: grid;
        grid-template-columns: 1fr;
        margin-top: 14px;
    }

    .jn-side-story {
        grid-template-columns: 94px minmax(0, 1fr);
    }

    .jn-home-sidebar {
        margin-top: 18px;
    }

    .jn-donation-card,
    .jn-cemetery-card {
        min-height: 230px;
    }

    .jn-latest-grid {
        grid-template-columns: 1fr;
    }

    .jn-latest-card {
        grid-template-columns: 104px minmax(0, 1fr);
        min-height: 116px;
    }

    .jn-latest-card__media {
        height: 96px;
    }


    .jn-category-card__content {
        grid-template-columns: 1fr;
    }

    .jn-category-lead__media {
        height: 230px;
    }
}

@media (max-width: 420px) {
    .jn-hero {
        min-height: 390px;
    }

    .jn-hero h1 {
        font-size: 23px;
    }

    .jn-latest-card {
        grid-template-columns: 110px minmax(0, 1fr);
    }

    .jn-latest-card__media {
        height: 92px;
    }

    .jn-section-heading {
        align-items: flex-end;
    }

    .jn-section-heading h2 {
        font-size: 18px;
    }
}


@media (max-width: 767px) {
    html body.site #sp-header,
    html body.site #sp-header.dark-bg,
    html body.site #sp-header.header-sticky,
    html body.site #sp-header > .container,
    html body.site #sp-header .container-inner,
    html body.site #sp-header .container-inner > .row,
    html body.site #sp-header .container-inner > .row > [class*="col-"],
    html body.site #sp-header .sp-column {
        height: 54px !important;
        min-height: 54px !important;
        max-height: 54px !important;
    }

    html body.site #sp-header #mod-custom157,
    html body.site #sp-header #mod-custom157 a {
        display: flex !important;
        height: 54px !important;
        align-items: center !important;
    }

    html body.site #sp-header #mod-custom157 img,
    html body.site #sp-header .logo-image-phone {
        height: 32px !important;
        max-height: 32px !important;
        width: auto !important;
    }
}