/* ניווט טקסטים — אותה משפחה ויזואלית כמו .back-link ב־exhibition-page.css */
.article-nav-wrap {
    position: relative;
    z-index: 10;
    max-width: 980px;
    width: 100%;
    margin-inline: auto;
    margin-top: max(4.5rem, calc(env(safe-area-inset-top, 0px) + 3.25rem));
    margin-bottom: 20px;
    padding: max(4px, env(safe-area-inset-top, 0px)) 0 0;
    background: transparent;
    border: none;
    box-shadow: none;
    /* שורת Back — ימין פיזי (כמו שאר האתר) */
    direction: ltr;
    text-align: right;
    unicode-bidi: isolate;
}
.article-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 14px 22px;
    align-items: center;
    justify-content: flex-end;
}
.article-nav .article-back,
a.article-back {
    display: inline-block;
    margin: 0;
    padding: 0;
    font-size: 12px;
    font-weight: 400;
    color: #bbb;
    text-decoration: none;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    transition: color 0.25s ease;
}
.article-back[lang="en"],
.article-back[dir="ltr"] {
    direction: ltr;
}
.article-nav .article-back:hover,
a.article-back:hover {
    color: #fff;
    background: transparent;
    border: none;
}
a.article-back:any-link,
a.article-back:visited {
    color: #bbb;
}
/* ← Back הראשי — בולט יותר */
.article-nav .article-back:first-child:any-link,
.article-nav .article-back:first-child:visited {
    color: #f0f0f0;
    font-weight: 600;
}

/* קפיצה לטקסט באנגלית (דפי texts עם .en-section) */
a.article-lang-en:any-link,
a.article-lang-en:visited {
    color: #9eb8e0 !important;
    font-weight: 600;
}
a.article-lang-en:hover {
    color: #cfe0ff !important;
}

/* קפיצה לטקסט באנגלית — גם .en-section וגם עמודות שיר (.col-en) */
#article-en {
    scroll-margin-top: max(5rem, calc(env(safe-area-inset-top, 0px) + 3rem));
}

/* TOP — חזרה לראש הדף (דפי texts עם אנגלית; תערוכות — exhibition-page.css); שמאל למטה */
button.article-scroll-top {
    display: none;
    position: fixed;
    bottom: max(18px, calc(env(safe-area-inset-bottom, 0px) + 10px));
    left: max(18px, env(safe-area-inset-left, 0px));
    right: auto;
    z-index: 49990;
    min-width: 52px;
    min-height: 44px;
    padding: 10px 14px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    cursor: pointer;
    -webkit-tap-highlight-color: rgba(255, 255, 255, 0.1);
    transition: background 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}
button.article-scroll-top.is-visible {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
button.article-scroll-top:hover,
button.article-scroll-top:focus-visible {
    background: rgba(0, 0, 0, 0.78);
    border-color: rgba(255, 255, 255, 0.65);
    outline: none;
}
@media (max-width: 700px) {
    button.article-scroll-top {
        bottom: max(12px, calc(env(safe-area-inset-bottom, 0px) + 8px));
        left: max(12px, env(safe-area-inset-left, 0px));
        min-width: 48px;
        min-height: 44px;
        font-size: 10px;
    }
}

/* --- דפי PDF — רקע שחור אחיד (כמו שאר האתר) --- */
html.pdf-viewer-root,
html:has(body.page-pdf-viewer) {
    background: #0a0a0a;
    color-scheme: dark;
}
body.page-pdf-viewer {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    min-height: 100dvh;
    background: #0a0a0a;
    color: #eaeaea;
    font-family: 'Segoe UI', sans-serif;
    padding-top: max(4.5rem, calc(env(safe-area-inset-top, 0px) + 3.5rem));
}
body.page-pdf-viewer .brand {
    position: static !important;
}
body.page-pdf-viewer .site-brand-stack {
    z-index: 10055;
}
body.page-pdf-viewer a.pdf-history-back {
    position: fixed;
    top: max(14px, env(safe-area-inset-top, 0px));
    right: max(14px, env(safe-area-inset-right, 0px));
    left: auto;
    z-index: 10060;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0 22px;
    box-sizing: border-box;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    text-decoration: none;
    color: #fff !important;
    background: rgba(0, 0, 0, 0.78);
    border: 2px solid rgba(255, 255, 255, 0.55);
    border-radius: 999px;
    direction: ltr;
    white-space: nowrap;
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.55);
    cursor: pointer;
}
body.page-pdf-viewer a.pdf-history-back:hover {
    background: rgba(36, 36, 36, 0.95);
    border-color: rgba(255, 255, 255, 0.85);
}
body.page-pdf-viewer a.pdf-en-jump {
    position: fixed;
    top: max(14px, env(safe-area-inset-top, 0px));
    right: max(128px, calc(env(safe-area-inset-right, 0px) + 114px));
    left: auto;
    z-index: 10060;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0 16px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-decoration: none;
    color: #cfe0ff !important;
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(158, 184, 224, 0.55);
    border-radius: 999px;
    direction: ltr;
    cursor: pointer;
}
body.page-pdf-viewer a.pdf-en-jump.is-active {
    color: #fff !important;
    border-color: rgba(200, 220, 255, 0.9);
    background: rgba(40, 55, 80, 0.75);
}
body.page-pdf-viewer .pdf-viewer-chrome {
    flex: 0 0 auto;
    padding: 0 12px 8px;
}
body.page-pdf-viewer .pdf-viewer-title {
    max-width: 980px;
    margin: 0 auto;
    font-size: 14px;
    font-weight: 500;
    color: #aaa;
    line-height: 1.35;
}
body.page-pdf-viewer .pdf-frame-wrap {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 0 8px 16px;
    box-sizing: border-box;
    background: #0a0a0a;
}
body.page-pdf-viewer #pdfViewerHost,
body.page-pdf-viewer .pdf-viewer-panel {
    flex: 1 1 auto;
    min-height: calc(100dvh - 6.5rem);
    display: flex;
    flex-direction: column;
    background: #0a0a0a;
}
body.page-pdf-viewer .pdf-iframe {
    flex: 1 1 auto;
    width: 100%;
    min-height: calc(100dvh - 6.5rem);
    border: 1px solid #333;
    border-radius: 6px;
    background: #1a1a1a;
}
body.page-pdf-viewer .pdf-js-pages {
    width: 100%;
    max-width: 980px;
    margin: 0 auto;
    padding: 8px 0 32px;
    background: #0a0a0a;
}
body.page-pdf-viewer .pdf-js-page {
    display: none;
}
/* טקסט מחולץ מ-PDF — כמו דפי texts (passion2 וכו') */
body.page-pdf-viewer.page-pdf-as-text {
    background: #0f0f0f;
    padding-top: max(4.5rem, calc(env(safe-area-inset-top, 0px) + 3.5rem));
    padding-bottom: max(88px, calc(env(safe-area-inset-bottom, 0px) + 72px));
}
body.page-pdf-viewer.page-pdf-as-text .pdf-viewer-chrome {
    display: none;
}
body.page-pdf-viewer.page-pdf-as-text #pdfViewerHost,
body.page-pdf-viewer.page-pdf-as-text .pdf-viewer-panel {
    min-height: 0;
    background: transparent;
}
body.page-pdf-viewer.page-pdf-as-text .pdf-frame-wrap {
    background: transparent;
    padding: 0 16px 24px;
}
body.page-pdf-viewer .pdf-text-article.wrap {
    max-width: 46rem;
    width: 100%;
    margin-inline: auto;
    padding: 0 4px 32px;
    line-height: 1.95;
    font-size: 16px;
    color: #eaeaea;
    background: transparent;
}
body.page-pdf-viewer .pdf-text-h1 {
    margin: 0 0 18px;
    font-size: 26px;
    font-weight: 300;
    letter-spacing: 0.5px;
    color: #f0f0f0;
    line-height: 1.35;
}
body.page-pdf-viewer .pdf-text-page {
    margin: 0 0 28px;
    padding: 0;
    border: none;
    background: transparent;
}
body.page-pdf-viewer .pdf-text-page p {
    margin: 0 0 18px;
}
body.page-pdf-viewer .pdf-text-page--en {
    margin-top: 28px;
    padding-top: 22px;
    border-top: 1px solid #333;
}
body.page-pdf-viewer #article-en,
body.page-pdf-viewer .pdf-text-page#article-en {
    scroll-margin-top: max(5.5rem, calc(env(safe-area-inset-top, 0px) + 4rem));
}
body.page-pdf-viewer .pdf-text-page--en + .pdf-text-page--en {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}
body.page-pdf-viewer .pdf-text-muted {
    color: #888;
    font-style: italic;
}
body.page-pdf-viewer .pdf-text-source {
    margin-top: 28px;
    padding-top: 16px;
    border-top: 1px solid #2a2a2a;
    font-size: 13px;
    text-align: center;
}
body.page-pdf-viewer .pdf-text-source a {
    color: #9eb8e0;
    text-decoration: none;
}
body.page-pdf-viewer .pdf-text-source a:hover {
    color: #cfe0ff;
}
body.page-pdf-viewer .pdf-loading,
body.page-pdf-viewer .pdf-error {
    text-align: center;
    padding: 2.5rem 1rem;
    color: #bbb;
    font-size: 15px;
    background: #0a0a0a;
}
body.page-pdf-viewer .pdf-error a {
    color: #cfe0ff;
}
body.page-pdf-viewer .pdf-open-fallback {
    display: none;
    margin: 10px auto 0;
    max-width: 28rem;
    font-size: 14px;
    color: #ccc;
    text-align: center;
    line-height: 1.45;
}
body.page-pdf-viewer.pdf-needs-fallback .pdf-open-fallback {
    display: block;
}
body.page-pdf-viewer .pdf-open-fallback a {
    display: inline-block;
    margin-top: 6px;
    padding: 10px 18px;
    color: #fff !important;
    background: rgba(0, 0, 0, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 999px;
    text-decoration: none;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-size: 12px;
}
@media (max-width: 1100px) {
    body.page-pdf-viewer {
        padding-top: max(6.5rem, calc(env(safe-area-inset-top, 0px) + 5.25rem));
    }
    body.page-pdf-viewer a.pdf-history-back {
        top: max(54px, calc(env(safe-area-inset-top, 0px) + 46px));
        right: max(12px, env(safe-area-inset-right, 0px));
    }
    body.page-pdf-viewer a.pdf-en-jump {
        top: max(54px, calc(env(safe-area-inset-top, 0px) + 46px));
        right: max(118px, calc(env(safe-area-inset-right, 0px) + 104px));
    }
    body.page-pdf-viewer .pdf-viewer-title {
        display: none;
    }
    body.page-pdf-viewer #pdfViewerHost,
    body.page-pdf-viewer .pdf-iframe {
        min-height: calc(100dvh - 7.25rem);
    }
}
@media (min-width: 1101px) {
    body.page-pdf-viewer a.site-home {
        display: flex !important;
    }
}


.site-brand-stack {
    position: fixed;
    top: max(14px, env(safe-area-inset-top, 0px));
    left: max(18px, env(safe-area-inset-left, 0px));
    right: auto;
    z-index: 10050;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    pointer-events: auto;
    max-width: min(92vw, 280px);
    text-align: left;
}

html[dir="rtl"] .site-brand-stack {
    left: max(36px, calc(20px + env(safe-area-inset-left, 0px)));
}

@media (max-width: 1100px) {
    html[dir="rtl"] .site-brand-stack:has(> a.mobile-top-menu-btn),
    .site-brand-stack:has(> a.mobile-top-menu-btn) {
        direction: ltr;
        unicode-bidi: isolate;
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        left: max(12px, env(safe-area-inset-left, 0px));
        right: max(14px, env(safe-area-inset-right, 0px));
        width: auto;
        max-width: none;
        box-sizing: border-box;
    }
    html[dir="rtl"] .site-brand-stack:has(> a.mobile-top-menu-btn) {
        left: max(12px, env(safe-area-inset-left, 0px));
        right: max(14px, env(safe-area-inset-right, 0px));
    }
    .site-brand-stack:has(> a.mobile-top-menu-btn) > .brand,
    .site-brand-stack:has(> a.mobile-top-menu-btn) > a.site-brand-home {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: calc(100% - 112px);
    }
    .site-brand-stack:has(> a.mobile-top-menu-btn) > a.mobile-top-menu-btn {
        flex: 0 0 auto;
        white-space: nowrap;
        overflow: visible;
        min-width: 4.75rem;
        padding: 0 16px;
    }
}

.site-brand-stack .brand {
    position: static !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    pointer-events: none;
    font-size: clamp(17px, 4.2vw, 22px);
    font-weight: 700;
    letter-spacing: 0.12em;
    color: #fff;
    text-transform: uppercase;
}

/* קישור «← Exhibitions» אם exhibition-gallery.js נטען בעתיד */
a.ex-back-exhibitions:any-link,
a.ex-back-exhibitions:visited {
    color: rgba(235, 235, 235, 0.72);
}
a.ex-back-exhibitions {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin: 0;
    padding: 0;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(235, 235, 235, 0.72);
    text-decoration: none;
    pointer-events: auto;
    transition: color 0.2s ease, opacity 0.2s ease;
}
a.ex-back-exhibitions:hover,
a.ex-back-exhibitions:focus-visible {
    color: #fff;
    outline: none;
}
.ex-back-exhibitions-arrow {
    font-size: 11px;
    line-height: 1;
    opacity: 0.75;
    transition: opacity 0.2s ease, transform 0.2s ease;
}
a.ex-back-exhibitions:hover .ex-back-exhibitions-arrow,
a.ex-back-exhibitions:focus-visible .ex-back-exhibitions-arrow {
    opacity: 1;
    transform: translateX(-2px);
}
.ex-back-exhibitions-label {
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s ease;
}
a.ex-back-exhibitions:hover .ex-back-exhibitions-label,
a.ex-back-exhibitions:focus-visible .ex-back-exhibitions-label {
    border-bottom-color: rgba(255, 255, 255, 0.35);
}

/* ——— נייד: מטרות נגיעה, safe area, מרווח מכפתור INDEX ——— */
@media (max-width: 700px) {
    .article-nav {
        gap: 8px 14px;
    }
    .article-nav .article-back,
    a.article-back {
        min-height: 44px;
        padding: 10px 6px;
        display: inline-flex;
        align-items: center;
        font-size: 13px;
        -webkit-tap-highlight-color: rgba(255, 255, 255, 0.08);
    }
    .site-brand-stack .brand {
        font-size: clamp(15px, 4.8vw, 20px);
    }
    body:has(.article-nav-wrap) {
        padding-bottom: max(96px, calc(72px + env(safe-area-inset-bottom, 0px)));
    }
    body:has(.article-nav-wrap) a.site-home {
        bottom: max(12px, calc(8px + env(safe-area-inset-bottom, 0px)));
        right: max(12px, calc(8px + env(safe-area-inset-right, 0px)));
    }
}

/* שורת JS «Back to…» — מיקום/עיצוב ב־site-index-button.css */
@media (max-width: 1100px) {
    body.mobile-smart-back-on .article-nav-wrap {
        display: none !important;
    }
}
