/* ============================================
   Family Chronicle — Public Styles
   RTL Hebrew layout, clean serif, accessible
   ============================================ */

/* ============ CHAPTER PAGE ROOT ============ */

.fc-chapter-page {
    direction: rtl;
    display: flex;
    align-items: flex-start;
    gap: 0;
    max-width: 100%;
    margin: 0;
    padding: 40px 32px 80px;
    font-size: 19px;
    line-height: 1.9;
    color: #18181b;
    background: #fafaf9;
    min-height: 100vh;
}

/* Shortcode embed: inside a page, inherit theme background, no standalone min-height */
.fc-chapter-page.fc-embed {
    background: transparent;
    min-height: 0;
    padding: 0 0 60px;
    border-top: 1px solid #e4e4e7;
    margin-top: 32px;
}

/* ============ RIGHT SIDEBAR: TOC ============ */

.fc-chapter-page .fc-toc-sidebar {
    width: 270px;
    flex-shrink: 0;
    position: sticky;
    top: 80px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    margin-left: 32px;
    display: flex;
    flex-direction: column;
    gap: 0;
    scrollbar-width: thin;
    scrollbar-color: #c4b5fd #f5f3ff;
}

.fc-chapter-page .fc-toc-sidebar::-webkit-scrollbar { width: 4px; }
.fc-chapter-page .fc-toc-sidebar::-webkit-scrollbar-track { background: #f5f3ff; }
.fc-chapter-page .fc-toc-sidebar::-webkit-scrollbar-thumb { background: #c4b5fd; border-radius: 4px; }

/* Mobile toggle button */
.fc-chapter-page .fc-toc-sidebar .fc-toc-toggle-btn {
    display: none;
    width: 100%;
    background: #7c3aed;
    color: #fff;
    border: none;
    padding: 13px 18px;
    font-size: 16px;
    cursor: pointer;
    border-radius: 12px;
    margin-bottom: 12px;
    transition: background 0.2s;
    font-family: inherit;
    font-weight: 600;
    align-items: center;
    gap: 8px;
}
.fc-chapter-page .fc-toc-sidebar .fc-toc-toggle-btn:hover { background: #6d28d9; }

/* Sidebar sections */
.fc-sidebar-section {
    background: #fff;
    border: 1px solid #e4e4e7;
    border-radius: 18px;
    overflow: hidden;
    margin-bottom: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05), 0 4px 16px rgba(0,0,0,0.05);
}

/* TOC Section */
.fc-sidebar-toc-section nav.fc-sidebar-toc { padding: 0; }

.fc-sidebar-toc-section nav.fc-sidebar-toc .fc-toc-heading {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 2.8px;
    text-transform: uppercase;
    color: #71717a;
    margin: 0;
    padding: 14px 16px 11px;
    border-bottom: 1px solid #f4f4f5;
    background: #fafafa;
}

.fc-sidebar-toc-section .fc-toc-ul {
    list-style: none;
    margin: 0;
    padding: 4px 0;
}

.fc-sidebar-toc-section .fc-toc-ul .fc-toc-li {
    border-bottom: 1px solid #fafafa;
}
.fc-sidebar-toc-section .fc-toc-ul .fc-toc-li:last-child { border-bottom: none; }

.fc-sidebar-toc-section .fc-toc-ul .fc-toc-li a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    font-size: 13px;
    color: #52525b;
    text-decoration: none;
    line-height: 1.4;
    transition: all 0.15s ease;
}

.fc-sidebar-toc-section .fc-toc-ul .fc-toc-li a:hover {
    color: #18181b;
    background: #fafafa;
}

.fc-sidebar-toc-section .fc-toc-ul .fc-toc-li.fc-toc-active > a {
    color: #7c3aed;
    font-weight: 700;
    background: #f5f3ff;
    border-right: 3px solid #7c3aed;
    padding-right: 11px;
}

.fc-sidebar-toc-section .fc-toc-ul .fc-toc-li a .fc-toc-n {
    font-weight: 700;
    color: #a1a1aa;
    flex-shrink: 0;
    font-size: 10.5px;
    min-width: 22px;
    text-align: center;
    background: #f4f4f5;
    border-radius: 4px;
    padding: 1px 4px;
}

/* ============ LEFT SIDEBAR: READER GUIDE ============ */

.fc-guide-sidebar {
    width: 252px;
    flex-shrink: 0;
    position: sticky;
    top: 80px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    margin-right: 32px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scrollbar-width: none;
}
.fc-guide-sidebar::-webkit-scrollbar { display: none; }

/* Guide Cards */
.fc-guide-card {
    background: #fff;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 4px 20px rgba(0,0,0,0.06);
    border: 1px solid #e4e4e7;
}

.fc-guide-card-label {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 2.8px;
    text-transform: uppercase;
    color: #71717a;
    padding: 13px 20px 10px;
    border-bottom: 1px solid #f4f4f5;
    background: #fafafa;
}

/* Identity Card */
.fc-guide-identity {
    background: linear-gradient(145deg, #1e1b4b 0%, #312e81 50%, #4338ca 100%);
    border: none;
    padding: 24px 22px 22px;
    position: relative;
    overflow: hidden;
}

.fc-guide-identity::before {
    content: '';
    position: absolute;
    top: -40px;
    left: -40px;
    width: 180px;
    height: 180px;
    background: radial-gradient(circle, rgba(167,139,250,0.2) 0%, transparent 70%);
    pointer-events: none;
}

.fc-guide-identity-num {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: rgba(167,139,250,0.9);
    margin-bottom: 10px;
}

.fc-guide-identity-title {
    font-size: 15px;
    font-weight: 800;
    color: #fff;
    line-height: 1.5;
    margin-bottom: 16px;
}

.fc-guide-identity-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.fc-guide-meta-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11.5px;
    font-weight: 600;
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.9);
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 20px;
    padding: 4px 12px;
}

/* Progress Card */
.fc-guide-progress-card { padding: 18px 20px 20px; }

.fc-guide-progress-wrap { margin-top: 6px; }

.fc-guide-progress-track {
    height: 6px;
    background: #f4f4f5;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 10px;
}

.fc-guide-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4338ca, #7c3aed, #a78bfa);
    border-radius: 3px;
    transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.fc-guide-progress-stats {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.fc-guide-progress-pct {
    font-size: 28px;
    font-weight: 900;
    color: #1e1b4b;
    line-height: 1;
    letter-spacing: -1px;
}

.fc-guide-progress-frac {
    font-size: 12px;
    color: #a1a1aa;
    font-weight: 500;
}

/* Tips Card */
.fc-guide-tips-list {
    list-style: none;
    margin: 0;
    padding: 6px 0 4px;
}

.fc-guide-tip-item {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 11px 20px;
    border-bottom: 1px solid #f4f4f5;
    transition: background 0.15s;
}
.fc-guide-tip-item:last-child { border-bottom: none; }
.fc-guide-tip-item:hover { background: #fafafa; }

.fc-guide-tip-icon {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 800;
}

.fc-tip-parallel { background: #ede9fe; color: #7c3aed; }
.fc-tip-hebrew   { background: #ddd6fe; color: #6d28d9; }
.fc-tip-ladino   { background: #1e1b4b; color: #c4b5fd; }
.fc-tip-fn       { background: #f4f4f5; color: #52525b; font-size: 10px; }

.fc-guide-tip-body {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.fc-guide-tip-body strong {
    font-size: 13px;
    font-weight: 700;
    color: #18181b;
    line-height: 1.2;
}

.fc-guide-tip-body span {
    font-size: 11.5px;
    color: #71717a;
    line-height: 1.4;
}

/* ============ CHAPTER MAIN ============ */

.fc-chapter-page .fc-chapter-main {
    flex: 1;
    min-width: 0;
}

/* ---- Chapter Header ---- */

.fc-chapter-page .fc-chapter-main .fc-chapter-header {
    margin-bottom: 36px;
    padding-bottom: 30px;
    border-bottom: 1px solid #e4e4e7;
}

.fc-chapter-eyebrow {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.fc-chapter-number-badge {
    display: inline-flex;
    align-items: center;
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 5px 14px;
    border-radius: 20px;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    box-shadow: 0 2px 10px rgba(124,58,237,0.25);
}

.fc-meta-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    padding: 5px 13px;
    border-radius: 20px;
    font-weight: 600;
    letter-spacing: 0.3px;
    border: 1px solid #e4e4e7;
    color: #52525b;
    background: #fff;
}

.fc-chapter-page .fc-chapter-main .fc-chapter-header .fc-chapter-title {
    font-size: 36px;
    font-weight: 800;
    color: #09090b;
    margin: 0;
    line-height: 1.2;
    letter-spacing: -0.5px;
}

/* ---- View Toggle Bar ---- */

/* Top bar wraps view-toggle (RTL right) + page-nav (RTL left) on one row */
.fc-chapter-page .fc-chapter-main .fc-chapter-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}

.fc-chapter-page .fc-chapter-main .fc-view-toggle-bar {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    background: #fff;
    border: 1px solid #e4e4e7;
    border-radius: 14px;
    padding: 5px;
    width: fit-content;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.fc-chapter-page .fc-chapter-main .fc-view-toggle-bar .fc-view-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 9px 20px;
    font-size: 13.5px;
    border: none;
    background: transparent;
    color: #71717a;
    border-radius: 10px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    transition: all 0.18s ease;
}

.fc-btn-icon { font-size: 15px; }

.fc-chapter-page .fc-chapter-main .fc-view-toggle-bar .fc-view-btn:hover {
    background: #f4f4f5;
    color: #18181b;
}

.fc-chapter-page .fc-chapter-main .fc-view-toggle-bar .fc-view-btn.fc-view-btn-active {
    background: #1e1b4b;
    color: #fff;
    box-shadow: 0 2px 8px rgba(30, 27, 75, 0.25);
}

/* ---- Text Columns ---- */

.fc-chapter-page .fc-chapter-main .fc-content-wrap {
    display: flex;
    gap: 0;
    border: 1px solid #e4e4e7;
    border-radius: 20px;
    overflow: hidden;
    margin-bottom: 40px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05), 0 8px 32px rgba(0,0,0,0.06);
    background: #fff;
}

.fc-chapter-page .fc-chapter-main .fc-content-wrap.fc-view-hebrew .fc-col-ladino,
.fc-chapter-page .fc-chapter-main .fc-content-wrap.fc-view-ladino .fc-col-hebrew {
    display: none;
}

.fc-chapter-page .fc-chapter-main .fc-content-wrap.fc-view-hebrew .fc-col-hebrew,
.fc-chapter-page .fc-chapter-main .fc-content-wrap.fc-view-ladino .fc-col-ladino {
    width: 100%;
    border: none;
}

.fc-chapter-page .fc-chapter-main .fc-content-wrap .fc-col {
    flex: 1;
    min-width: 0;
}

.fc-chapter-page .fc-chapter-main .fc-content-wrap .fc-col-hebrew {
    border-left: 1px solid #e4e4e7;
    direction: rtl;
    background: #fff;
}

.fc-chapter-page .fc-chapter-main .fc-content-wrap .fc-col-ladino {
    direction: ltr;
    background: #f8f7ff;
}

/* Column Headers */
.fc-col-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 15px 20px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 2.5px;
    text-transform: uppercase;
}

.fc-col-header-hebrew {
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    color: #fff;
}

.fc-col-header-ladino {
    background: linear-gradient(135deg, #1e1b4b, #312e81);
    color: rgba(255,255,255,0.85);
}

.fc-col-header-icon { font-size: 14px; }

/* Text Content */
.fc-text-content {
    padding: 36px 34px;
    font-size: 19px;
    line-height: 2;
}

.fc-text-hebrew {
    direction: rtl;
    color: #18181b;
}

.fc-text-ladino {
    direction: ltr;
    color: #2e1065;
    background: #f8f7ff;
    font-style: italic;
}

.fc-text-content p { margin: 0 0 1.4em; }

/* Glossary links */
.fc-text-content .fc-glossary-link {
    color: #7c3aed;
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 3px;
    transition: color 0.15s;
}
.fc-text-content .fc-glossary-link:hover {
    color: #6d28d9;
    text-decoration-style: solid;
}

/* Place links */
.fc-text-content .fc-place-link {
    color: #0f766e;
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 3px;
    transition: color 0.15s;
}
.fc-text-content .fc-place-link:hover {
    color: #115e59;
    text-decoration-style: solid;
}


/* Glossary Popup */
.fc-glossary-popup {
    z-index: 99999;
    width: 340px;
    max-width: calc(100vw - 20px);
    direction: rtl;
}
.fc-glossary-popup-inner {
    background: #fff;
    border: 1.5px solid #c4b5fd;
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(124, 58, 237, 0.18);
    padding: 16px 18px 14px;
    position: relative;
}
.fc-glossary-popup-close {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 26px;
    height: 26px;
    background: #ffffff !important;
    background-color: #ffffff !important;
    border: none;
    border-radius: 50%;
    font-size: 13px;
    cursor: pointer;
    color: #71717a !important;
    line-height: 1;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}
.fc-glossary-popup-close:hover {
    background: #fee2e2 !important;
    background-color: #fee2e2 !important;
    color: #dc2626 !important;
}
.fc-glossary-popup-close:focus-visible {
    outline: 2px solid #7c3aed;
    outline-offset: 2px;
}
.fc-glossary-popup-title {
    font-size: 17px;
    font-weight: 700;
    color: #4a1d91;
    margin: 0 0 8px;
    padding-left: 24px;
    line-height: 1.4;
}
.fc-glossary-popup-body {
    font-size: 14px;
    color: #374151;
    line-height: 1.7;
    max-height: 180px;
    overflow-y: auto;
}
.fc-glossary-popup-body p {
    margin: 0 0 0.6em;
}
.fc-glossary-popup-link {
    display: block;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid #ede9fe;
    font-size: 12px;
    color: #7c3aed;
    text-decoration: none;
}
.fc-glossary-popup-link:hover {
    text-decoration: underline;
}

/* Footnote Markers */
.fc-text-content .fc-fn-marker {
    color: #7c3aed;
    font-weight: 700;
    cursor: pointer;
    font-size: 0.72em;
    vertical-align: super;
    border-bottom: 1px dotted #a78bfa;
    transition: color 0.15s;
    padding: 0 1px;
}
.fc-text-content .fc-fn-marker:hover {
    color: #6d28d9;
    border-color: #6d28d9;
}

/* ---- Footnotes Section ---- */

.fc-chapter-page .fc-chapter-main .fc-footnotes-section {
    margin-bottom: 40px;
    background: #fff;
    border: 1px solid #e4e4e7;
    border-radius: 16px;
    padding: 24px 28px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.fc-footnotes-section .fc-fn-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: #71717a;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f4f4f5;
}

.fc-footnotes-section .fc-fn-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.fc-footnotes-section .fc-fn-item {
    display: flex;
    gap: 12px;
    font-size: 15.5px;
    line-height: 1.75;
    padding: 10px 8px;
    border-radius: 8px;
    transition: background 0.15s;
}
.fc-footnotes-section .fc-fn-item:hover { background: #fafafa; }

.fc-footnotes-section .fc-fn-item.fc-fn-highlighted {
    background: #fef3c7;
    box-shadow: 0 0 0 3px #fcd34d;
    animation: footnote-highlight-pulse 0.6s ease-out;
}

@keyframes footnote-highlight-pulse {
    0% { background: #fef08a; box-shadow: 0 0 0 8px rgba(252, 211, 77, 0.3); }
    100% { background: #fef3c7; box-shadow: 0 0 0 3px #fcd34d; }
}

.fc-footnotes-section .fc-fn-label {
    font-weight: 700;
    color: #7c3aed;
    flex-shrink: 0;
    min-width: 30px;
    font-size: 13px;
}

.fc-footnotes-section .fc-fn-text { color: #3f3f46; }

/* "Back to reading" button appended to a footnote item on click */
.fc-fn-back-link {
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
    margin-right: 10px !important;
    padding: 2px 10px !important;
    background: #ede9fe !important;
    border: 1px solid #c4b5fd !important;
    border-radius: 20px !important;
    font-size: 12px !important;
    color: #6d28d9 !important;
    cursor: pointer !important;
    white-space: nowrap !important;
    transition: background 0.15s, color 0.15s !important;
    vertical-align: middle !important;
}
.fc-fn-back-link:hover {
    background: #ddd6fe;
    color: #4c1d95;
}
button.fc-fn-back-link {
    color: white;
    border-color: var(--e-global-color-accent);
}

/* ---- Guide sidebar: hidden (removed from template, kept for compat) ---- */
.fc-guide-sidebar { display: none !important; }

/* ---- Page navigation bar ---- */
.fc-page-nav-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 10px;
    background: #f5f3ff;
    border: 1px solid rgba(124,58,237,0.18);
    border-radius: 14px;
    direction: rtl;
}
.fc-page-btn {
    background: #7c3aed;
    color: #fff;
    border: none;
    border-radius: 9px;
    padding: 7px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.18s;
    font-family: inherit;
    white-space: nowrap;
}
.fc-page-btn:hover:not(:disabled) { background: #6d28d9; }
.fc-page-btn:disabled { background: #e5e7eb; cursor: not-allowed; color: #9ca3af; }
.fc-page-indicator {
    font-size: 12px;
    color: #374151;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    text-align: center;
    line-height: 1.3;
    min-width: 90px;
}
.fc-page-progress-pct {
    font-size: 12px;
    font-weight: 700;
    color: #7c3aed;
}

/* ---- Chapter Navigation ---- */

.fc-chapter-page .fc-chapter-main .fc-chapter-nav {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    column-gap: 24px;
    row-gap: 16px;
    padding-top: 36px;
    margin-top: 28px;
    border-top: 1px solid #e4e4e7;
}

/* Each side hosts at most one prev/next button (or stays empty as a spacer) */
.fc-nav-side { display: flex; min-width: 0; }
.fc-nav-side-prev { justify-content: flex-start; }   /* RTL: right edge */
.fc-nav-side-next { justify-content: flex-end; }     /* RTL: left edge */

.fc-nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    line-height: 1.3;
    background: #fff;
    color: #18181b;
    border: 1px solid #e4e4e7;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    transition: background-color 0.18s ease, border-color 0.18s ease,
                box-shadow 0.18s ease, transform 0.18s ease, color 0.18s ease;
    max-width: 100%;
    min-width: 0;
}

.fc-nav-btn:hover,
.fc-nav-btn:focus-visible {
    background: #faf7ff;                          /* soft purple tint, keeps text readable */
    border-color: #c4b5fd;
    color: #18181b;
    box-shadow: 0 4px 14px rgba(124, 58, 237, 0.12);
    transform: translateY(-1px);
    text-decoration: none;
    outline: none;
}
.fc-nav-btn:focus-visible {
    outline: 2px solid #7c3aed;
    outline-offset: 2px;
}

.fc-nav-arrow {
    font-size: 18px;
    color: #7c3aed;
    flex-shrink: 0;
    transition: transform 0.18s ease;
}
.fc-nav-prev:hover .fc-nav-arrow { transform: translateX(4px); }
.fc-nav-next:hover .fc-nav-arrow { transform: translateX(-4px); }

.fc-nav-label {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.fc-nav-side-next .fc-nav-label { align-items: flex-end; text-align: end; }

.fc-nav-hint {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    color: #94a3b8;
}

.fc-nav-title {
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 260px;
}

/* ─── Center actions cluster ─── */
.fc-nav-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: nowrap;
}

.fc-nav-action-group {
    display: inline-flex;
    align-items: stretch;
    background: #fff;
    border: 1px solid #e4e4e7;
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    overflow: hidden;
}

.fc-nav-action {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease;
    border: none;
}
.fc-nav-action + .fc-nav-action { border-right: 1px solid #e4e4e7; }   /* RTL divider */

.fc-nav-action-icon { font-size: 15px; line-height: 1; }

.fc-nav-action:hover,
.fc-nav-action:focus-visible {
    background: #f5f3ff;
    color: #7c3aed;
    text-decoration: none;
    outline: none;
}
.fc-nav-action:focus-visible {
    outline: 2px solid #7c3aed;
    outline-offset: -2px;
}

.fc-nav-action.fc-nav-tree:hover,
.fc-nav-action.fc-nav-tree:focus-visible {
    background: #f0fdf4;
    color: #166534;
}

.fc-nav-progress {
    font-size: 12px;
    font-weight: 700;
    color: #7c3aed;
    white-space: nowrap;
    padding-inline-start: 4px;
}

/* ============ FOOTNOTE POPUP ============ */

.fc-fn-popup {
    position: absolute;
    z-index: 9999;
    width: 320px;
    max-width: 90vw;
    background: #fff;
    border: 1px solid #d4d4d8;
    border-radius: 14px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15), 0 2px 8px rgba(0,0,0,0.08);
    padding: 0;
    direction: rtl;
}

.fc-fn-popup .fc-fn-popup-inner {
    padding: 22px 24px;
    font-size: 16px;
    line-height: 1.8;
    color: #3f3f46;
    position: relative;
}

.fc-fn-popup .fc-fn-popup-inner .fc-fn-popup-close {
    position: absolute;
    top: 10px;
    left: 12px;
    width: 26px;
    height: 26px;
    background: #f4f4f5;
    border: none;
    border-radius: 50%;
    font-size: 13px;
    color: #71717a;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
    font-weight: 700;
}
.fc-fn-popup .fc-fn-popup-inner .fc-fn-popup-close:hover {
    background: #fee2e2;
    color: #dc2626;
}
.fc-fn-popup .fc-fn-popup-inner .fc-fn-popup-close:focus-visible {
    outline: 2px solid #7c3aed;
    outline-offset: 2px;
}

/* ============ MOBILE ============ */

@media (max-width: 1280px) {
    .fc-guide-sidebar {
        width: 220px;
        margin-right: 20px;
    }
    .fc-chapter-page .fc-toc-sidebar {
        width: 240px;
        margin-left: 20px;
    }
}

@media (max-width: 1024px) {
    .fc-guide-sidebar {
        display: none;
    }
    .fc-chapter-page .fc-toc-sidebar {
        width: 230px;
        margin-left: 16px;
    }
}

@media (max-width: 768px) {
    .fc-chapter-page {
        flex-direction: column;
        padding: 20px 14px 40px;
    }

    .fc-chapter-page .fc-toc-sidebar {
        width: 100%;
        position: static;
        max-height: none;
        margin-left: 0;
        margin-bottom: 20px;
    }

    .fc-chapter-page .fc-toc-sidebar .fc-toc-toggle-btn {
        display: flex;
    }

    .fc-toc-sidebar-inner {
        display: none;
    }

    .fc-toc-sidebar-inner.fc-toc-open {
        display: block;
    }

    .fc-chapter-page .fc-chapter-main .fc-chapter-title {
        font-size: 26px;
    }

    .fc-chapter-page .fc-chapter-main .fc-chapter-topbar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    .fc-chapter-page .fc-chapter-main .fc-view-toggle-bar {
        width: 100%;
    }
    .fc-page-nav-bar {
        width: 100%;
        justify-content: space-between;
    }

    .fc-chapter-page .fc-chapter-main .fc-content-wrap {
        flex-direction: column;
    }

    .fc-chapter-page .fc-chapter-main .fc-content-wrap .fc-col-hebrew {
        border-left: none;
        border-bottom: 2px solid #e2e8f0;
    }

    /* Stack the chapter-nav on narrow screens: prev / actions / next */
    .fc-chapter-page .fc-chapter-main .fc-chapter-nav {
        grid-template-columns: 1fr;
        column-gap: 0;
        row-gap: 12px;
    }
    .fc-nav-side-prev,
    .fc-nav-side-next { justify-content: stretch; }
    .fc-nav-side-prev .fc-nav-btn,
    .fc-nav-side-next .fc-nav-btn { width: 100%; }
    .fc-nav-actions {
        order: 3;                                 /* actions go to the bottom of the stack */
        justify-content: center;
        flex-wrap: wrap;
    }
    .fc-nav-title {
        max-width: 200px;
        font-size: 13px;
    }

    .fc-chapter-page .fc-toc-sidebar,
    .fc-chapter-page .fc-chapter-main .fc-chapter-nav .fc-nav-btn {
        font-size: 14px;
    }
}

/* ============ PERSON LINKS ============ */

/* In TOC generation cells */
.fc-person-link {
    color: #7c3aed;
    text-decoration: none;
    font-weight: 700;
    border-bottom: 1.5px solid #ddd6fe;
    padding-bottom: 1px;
    transition: color 0.15s, border-color 0.15s;
    cursor: pointer;
}
.fc-person-link:hover {
    color: #6d28d9;
    border-bottom-color: #7c3aed;
}

/* In chapter text */
.fc-person-link-text {
    color: #7c3aed;
    text-decoration: none;
    font-weight: 600;
    border-bottom: 1px dotted #a78bfa;
    text-underline-offset: 2px;
    transition: color 0.15s;
}
.fc-person-link-text:hover {
    color: #6d28d9;
    border-bottom-style: solid;
}

/* Highlighted node in family tree */
.fc-tree-node.fc-tree-node-highlighted {
    border: 2.5px solid #7c3aed !important;
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.18), 0 4px 20px rgba(124, 58, 237, 0.25) !important;
    background: #faf5ff !important;
    z-index: 10;
}

.fc-tree-node.fc-tree-node-highlighted .fc-tree-node-name {
    color: #6d28d9 !important;
    font-weight: 800 !important;
}

/* ---- Cross-family marriage badge (single numbered circle between couple cards) ---- */
.fc-cross-marriage-badge {
    position: absolute;
    width: 22px;
    height: 22px;
    background: linear-gradient(135deg, #7c3aed, #4c1d95);
    color: #fff;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    box-shadow: 0 2px 8px rgba(124,58,237,0.55);
    z-index: 12;   /* above cards (z-index:10) */
    line-height: 1;
    cursor: pointer;
    pointer-events: auto;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    /* top/left set via inline styles from JS */
}
.fc-cross-marriage-badge:hover {
    transform: translateX(-50%) scale(1.25);
    box-shadow: 0 3px 12px rgba(124,58,237,0.7);
}

/* ============ TOC PAGE ============ */

.fc-toc-page {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 0 70px;
}

/* ---- Intro Description ---- */
.fc-toc-intro {
    max-width: 860px;
    margin: 0 auto;
    padding: 36px 32px 28px;
    border-bottom: 1px solid #ede9fe;
}

.fc-toc-intro p {
    font-size: 15px;
    line-height: 1.85;
    color: #374151;
    margin: 0 0 14px;
}

.fc-toc-intro p:last-child {
    margin-bottom: 0;
}

.fc-toc-intro-note {
    font-size: 13.5px !important;
    color: #6b7280 !important;
    border-right: 3px solid #c4b5fd;
    padding-right: 14px;
    background: #faf5ff;
    padding: 10px 14px;
    border-radius: 0 8px 8px 0;
}

/* ---- Live Search ---- */
.fc-toc-search-wrap {
    max-width: 680px;
    margin: 28px auto 24px;
    padding: 0 24px;
}

.fc-toc-search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.fc-toc-search-icon {
    position: absolute;
    left: 16px;
    font-size: 16px;
    color: #9ca3af;
    pointer-events: none;
    z-index: 1;
}

.fc-toc-search-input {
    width: 100%;
    padding: 13px 18px 13px 48px;
    font-size: 15px;
    border: 1.5px solid #ddd6fe;
    border-radius: 12px;
    background: #fff;
    color: #1e1b4b;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
    box-shadow: 0 2px 8px rgba(124,58,237,0.06);
}

.fc-toc-search-input:focus {
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124,58,237,0.12);
}

.fc-toc-search-input::placeholder {
    color: #9ca3af;
}

.fc-toc-search-count {
    margin-top: 8px;
    font-size: 12.5px;
    color: #7c3aed;
    font-weight: 600;
    text-align: center;
    min-height: 18px;
}

/* ---- No-results message ---- */
.fc-toc-no-results {
    text-align: center;
    padding: 40px 20px;
    font-size: 15px;
    color: #6b7280;
}

/* ---- Table container ---- */
.fc-toc-table-wrap {
    background: #fff;
    border-radius: 0;
    border-top: 2px solid #c4b5fd;
    overflow-x: auto;
    box-shadow: 0 4px 30px rgba(124,58,237,0.06);
    margin: 0 0 0;
}

.fc-toc-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
    line-height: 1.5;
}

/* ---- Header ---- */
.fc-toc-table thead tr {
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
    color: #fff;
}

.fc-toc-table thead th {
    padding: 13px 12px;
    text-align: right;
    font-size: 12.5px;
    font-weight: 700;
    white-space: nowrap;
    border-left: 1px solid rgba(255,255,255,0.16);
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.fc-toc-table thead th:last-child {
    border-left: none;
}

.fc-toc-table thead .fc-th-gen {
    text-align: center;
    min-width: 80px;
    font-size: 12px;
}

.fc-toc-table thead .fc-th-gen-first {
    border-left: 2px solid rgba(255,255,255,0.4);
}

.fc-toc-table thead .fc-th-num {
    position: sticky;
    right: 0;
    background: #6d28d9;
    z-index: 2;
    border-left: 1px solid rgba(255,255,255,0.16);
    text-align: center;
    min-width: 60px;
}

.fc-toc-table thead .fc-th-page {
    white-space: nowrap;
    text-align: center;
}

.fc-toc-table thead .fc-th-year {
    white-space: nowrap;
    border-left: 2px solid rgba(255,255,255,0.4);
}

/* ---- Body rows ---- */
.fc-toc-table tbody .fc-toc-row {
    border-top: 1px solid #ede9fe;
    transition: background 0.15s ease;
}

.fc-toc-table tbody .fc-toc-row:nth-child(even) {
    background: #faf8ff;
}

.fc-toc-table tbody .fc-toc-row:hover {
    background: #ede9fe;
}

/* ---- Chapter number badge ---- */
.fc-td-num {
    padding: 10px 8px;
    position: sticky;
    right: 0;
    background: inherit;
    z-index: 1;
    text-align: center;
}

.fc-toc-row:hover .fc-td-num {
    background: #ede9fe;
}

.fc-toc-row:nth-child(even) .fc-td-num {
    background: #faf8ff;
}

.fc-toc-row:nth-child(even):hover .fc-td-num {
    background: #ede9fe;
}

.fc-chapter-badge {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 14px;
    color: #475569;
    transition: all 0.2s ease;
    margin: 0 auto;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

.fc-toc-row:hover .fc-chapter-badge {
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    color: #fff;
    transform: scale(1.1);
    box-shadow: 0 3px 10px rgba(124,58,237,0.3);
}

.fc-td-num a {
    text-decoration: none;
    display: block;
}

/* ---- Chapter name ---- */
.fc-td-name {
    padding: 10px 14px;
}

.fc-td-name a {
    text-decoration: none;
    color: #1e293b;
    font-weight: 600;
    font-size: 14px;
    transition: color 0.18s;
    display: block;
    line-height: 1.5;
}

.fc-toc-row:hover .fc-td-name a {
    color: #6d28d9;
}

/* ---- Page number ---- */
.fc-td-page {
    padding: 10px 10px;
    white-space: nowrap;
    text-align: center;
}

.fc-page-num {
    color: #64748b;
    font-size: 13px;
    font-weight: 400;
}

.fc-page-link {
    color: #a78bfa;
    text-decoration: none;
    margin-right: 6px;
    font-size: 14px;
    line-height: 1;
    transition: transform 0.15s ease, filter 0.15s ease;
    display: inline-block;
    vertical-align: middle;
}

.fc-page-link:hover {
    transform: scale(1.15);
    filter: drop-shadow(0 0 2px rgba(67, 56, 202, 0.35));
    text-decoration: none;
}

/* ---- Year and location ---- */
.fc-td-year {
    padding: 10px 12px;
    white-space: nowrap;
    border-left: 2px solid #ddd6fe;
}

.fc-year-text {
    color: #475569;
    font-size: 13px;
    font-weight: 500;
}

.fc-loc-text {
    color: #7c3aed;
    font-size: 12px;
    font-weight: 500;
    margin-top: 2px;
    opacity: 0.85;
}

/* ---- Generation columns ---- */
.fc-td-gen {
    padding: 10px 8px;
    text-align: center;
    border-right: 1px solid #ede9fe;
    vertical-align: middle;
}

.fc-td-gen-first {
    border-right: 2px solid #c4b5fd;
}

.fc-gen-name {
    font-size: 12.5px;
    color: #334155;
    white-space: pre-line;
    font-weight: 500;
    line-height: 1.4;
}

/* ---- Dynasty vertical label ---- */
.fc-td-dynasty {
    padding: 10px 5px;
    text-align: center;
    border-right: 1px solid #ede9fe;
    vertical-align: middle;
    writing-mode: vertical-lr;
    text-orientation: mixed;
}

.fc-dynasty-label {
    font-size: 12.5px;
    font-weight: 800;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    height: 100%;
    letter-spacing: 1px;
}

/* ---- Mobile responsive ---- */
@media (max-width: 768px) {
    .fc-toc-intro {
        padding: 24px 20px 20px;
    }

    .fc-toc-intro p {
        font-size: 14px;
    }

    .fc-toc-search-wrap {
        padding: 0 16px;
        margin: 20px auto 16px;
    }

    .fc-toc-table {
        font-size: 12px;
    }

    .fc-chapter-badge {
        width: 32px;
        height: 32px;
        font-size: 12px;
        border-radius: 8px;
    }

    .fc-toc-table thead th {
        padding: 10px 7px;
        font-size: 11px;
    }

    .fc-td-name a {
        font-size: 13px;
    }

    .fc-td-name,
    .fc-td-num,
    .fc-td-page,
    .fc-td-year,
    .fc-td-gen {
        padding: 8px 6px;
    }
}

/* ============ GLOSSARY PAGE ============ */

.fc-glossary-page {
    max-width: 820px;
    margin: 0 auto;
    padding: 28px 20px;
}

.fc-glossary-page .fc-glossary-title {
    font-size: 30px;
    font-weight: 700;
    color: var(--e-global-color-primary);
    margin-bottom: 24px;
    border-bottom: 3px solid var(--e-global-color-accent);
    padding-bottom: 14px;
}

.fc-glossary-page .fc-glossary-search-wrap {
    margin-bottom: 24px;
}

.fc-glossary-page .fc-glossary-search-wrap .fc-glossary-search {
    width: 100%;
    padding: 13px 18px;
    font-size: 16px;
    border: 1.5px solid rgba(143, 75, 241, 0.2);
    border-radius: 10px;
    direction: rtl;
    background: var(--e-global-color-backgroundAccent);
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
    font-family: inherit;
}

.fc-glossary-page .fc-glossary-search-wrap .fc-glossary-search:focus {
    border-color: var(--e-global-color-accent);
    outline: none;
    box-shadow: 0 0 0 3px rgba(143, 75, 241, 0.1);
    background: var(--e-global-color-background);
}

.fc-glossary-page .fc-glossary-item {
    margin-bottom: 28px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    padding-bottom: 22px;
}

.fc-glossary-page .fc-glossary-item .fc-glossary-term {
    font-size: 22px;
    font-weight: 700;
    color: var(--e-global-color-secondary);
    margin-bottom: 8px;
}

.fc-glossary-page .fc-glossary-item .fc-glossary-def {
    font-size: 16px;
    line-height: 1.85;
    color: var(--e-global-color-text);
}

/* ============ FAMILY TREE ============ */

.fc-family-tree-wrap {
    max-width: 100%;
    margin: 0 auto;
    padding: 28px 20px;
}

.fc-family-tree-wrap .fc-tree-title {
    font-size: 30px;
    font-weight: 700;
    color: var(--e-global-color-primary);
    margin-bottom: 20px;
}

.fc-family-tree-wrap #fc-tree-container {
    position: relative;
    height: 75vh;
    min-height: 500px;
    max-height: 900px;
    background: var(--e-global-color-backgroundAccent);
    border: 1px solid rgba(143, 75, 241, 0.1);
    border-radius: 12px;
    padding: 0;
    overflow: hidden;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.03);
    direction: ltr;
    cursor: grab;
}

/* ---- Zoom control bar ---- */

.fc-family-tree-wrap #fc-tree-container .fc-zoom-bar {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 200;
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(143, 75, 241, 0.2);
    border-radius: 10px;
    padding: 6px 10px;
    box-shadow: 0 2px 14px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(6px);
    direction: ltr;
}

.fc-family-tree-wrap #fc-tree-container .fc-zoom-bar .fc-zoom-btn {
    width: 30px;
    height: 30px;
    border: 1px solid rgba(143, 75, 241, 0.25);
    background: var(--e-global-color-background);
    color: var(--e-global-color-accent);
    border-radius: 7px;
    font-size: 17px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    font-family: inherit;
    padding: 0;
}

.fc-family-tree-wrap #fc-tree-container .fc-zoom-bar .fc-zoom-btn:hover {
    background: var(--e-global-color-accent);
    color: #fff;
    border-color: var(--e-global-color-secondary);
}

.fc-family-tree-wrap #fc-tree-container .fc-zoom-bar .fc-zoom-level {
    font-size: 12px;
    font-weight: 700;
    color: var(--e-global-color-accent);
    min-width: 38px;
    text-align: center;
    letter-spacing: 0.5px;
}

/* ---- Canvas (absolutely positioned, transformed by JS) ---- */

.fc-family-tree-wrap #fc-tree-container .fc-tree-canvas {
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: 0 0;
    will-change: transform;
}

/* ---- SVG connector lines ---- */

.fc-family-tree-wrap #fc-tree-container .fc-tree-canvas .fc-tree-svg line,
.fc-family-tree-wrap #fc-tree-container .fc-tree-canvas .fc-tree-svg path {
    stroke: #0284c7;          /* deep sky-blue (תכלת עמוק) */
    stroke-width: 2.75;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
    opacity: 0.92;
}

/* ---- Person cards (absolutely positioned by JS) ---- */

.fc-family-tree-wrap #fc-tree-container .fc-tree-canvas .fc-tree-node {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    background: var(--e-global-color-background);
    border: 1.5px solid rgba(143, 75, 241, 0.28);
    border-radius: 10px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 12px;
    line-height: 1.35;
    transition: all 0.2s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.07);
    min-height: 50px;
    box-sizing: border-box;
    overflow: visible;
    direction: rtl;
    text-align: right;
}

/* ---- Gender colour tints ---- */

.fc-family-tree-wrap #fc-tree-container .fc-tree-canvas .fc-tree-node--male {
    background: #ffffff;
    border: 2.5px solid #2563eb;     /* solid blue border, white interior */
}

.fc-family-tree-wrap #fc-tree-container .fc-tree-canvas .fc-tree-node--female {
    background: #ffffff;
    border: 2.5px solid #db2777;     /* solid pink/red border, white interior */
}

.fc-family-tree-wrap #fc-tree-container .fc-tree-canvas .fc-tree-node--male:hover,
.fc-family-tree-wrap #fc-tree-container .fc-tree-canvas .fc-tree-node--female:hover {
    background: var(--e-global-color-accent);
    border-color: var(--e-global-color-secondary);
}

.fc-family-tree-wrap #fc-tree-container .fc-tree-canvas .fc-tree-node:hover {
    background: var(--e-global-color-accent);
    color: var(--e-global-color-background);
    border-color: var(--e-global-color-secondary);
    box-shadow: 0 6px 22px rgba(143, 75, 241, 0.3);
    transform: translateY(-2px);
    z-index: 10;
}

.fc-family-tree-wrap #fc-tree-container .fc-tree-canvas .fc-tree-node .fc-tree-node-name {
    font-weight: 800;
    font-size: 13.5px;
    line-height: 1.25;
    color: #0f172a;          /* near-black for high contrast on white card */
    display: block;
}

.fc-family-tree-wrap #fc-tree-container .fc-tree-canvas .fc-tree-node .fc-tree-node-years {
    font-size: 11px;
    color: #475569;          /* darker than #aaa — readable */
    font-weight: 600;
    display: block;
}

.fc-family-tree-wrap #fc-tree-container .fc-tree-canvas .fc-tree-node:hover .fc-tree-node-years {
    color: rgba(255, 255, 255, 0.75);
}

.fc-family-tree-wrap #fc-tree-container .fc-tree-canvas .fc-tree-node .fc-tree-node-loc {
    font-size: 10px;
    color: var(--e-global-color-accent);
    display: block;
}

.fc-family-tree-wrap #fc-tree-container .fc-tree-canvas .fc-tree-node:hover .fc-tree-node-loc {
    color: rgba(255, 255, 255, 0.85);
}

/* ---- Ring icon between couples ---- */

.fc-family-tree-wrap #fc-tree-container .fc-tree-canvas .fc-tree-ring-icon {
    position: absolute;
    width: 36px;
    text-align: center;
    font-size: 16px;
    line-height: 1;
    pointer-events: none;
    user-select: none;
    z-index: 12;   /* above cards (z-index:10) */
}

/* ---- Fallback: old nested-list styles (shown before JS renders) ---- */

.fc-family-tree-wrap #fc-tree-container .fc-tree-ul {
    list-style: none;
    padding: 0;
    margin: 0;
    direction: rtl;
}

.fc-family-tree-wrap #fc-tree-container .fc-tree-ul ul {
    list-style: none;
    padding-right: 28px;
    border-right: 2px solid rgba(143, 75, 241, 0.2);
    margin-right: 14px;
    margin-top: 4px;
}

.fc-family-tree-wrap #fc-tree-container .fc-tree-node-wrap {
    padding: 4px 0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.fc-family-tree-wrap #fc-tree-container .fc-tree-node-wrap .fc-tree-node {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--e-global-color-background);
    border: 1.5px solid rgba(143, 75, 241, 0.28);
    border-radius: 10px;
    padding: 7px 13px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
}

.fc-family-tree-wrap #fc-tree-container .fc-tree-node-wrap .fc-tree-node:hover {
    background: var(--e-global-color-accent);
    color: var(--e-global-color-background);
    border-color: var(--e-global-color-secondary);
    box-shadow: 0 4px 18px rgba(143, 75, 241, 0.28);
    transform: translateY(-1px);
}

/* ---- Person Sidebar ---- */

.fc-person-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 350px;
    height: 100vh;
    background: var(--e-global-color-background);
    border-right: 2px solid rgba(143, 75, 241, 0.18);
    box-shadow: 4px 0 36px rgba(74, 29, 145, 0.12);
    z-index: 9998;
    overflow-y: auto;
    padding: 28px;
    direction: rtl;
}

.fc-person-sidebar .fc-sidebar-close {
    display: block;
    margin-bottom: 18px;
    background: none;
    border: 1px solid rgba(0, 0, 0, 0.13);
    border-radius: 6px;
    padding: 7px 16px;
    cursor: pointer;
    font-size: 14px;
    color: #999;
    transition: all 0.15s;
    font-family: inherit;
}

.fc-person-sidebar .fc-sidebar-close:hover {
    color: #e74c3c;
    border-color: #e74c3c;
}

.fc-person-sidebar .fc-person-bio h3 {
    font-size: 22px;
    color: var(--e-global-color-primary);
    margin-bottom: 8px;
}

.fc-person-sidebar .fc-person-bio .fc-person-years {
    font-size: 16px;
    color: #888;
}

.fc-person-sidebar .fc-person-bio .fc-person-location {
    font-size: 14px;
    color: var(--e-global-color-accent);
}

.fc-person-sidebar .fc-person-bio .fc-person-desc {
    font-size: 15px;
    line-height: 1.75;
    margin-top: 12px;
    color: var(--e-global-color-text);
}

.fc-person-sidebar .fc-person-bio h4 {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #bbb;
    margin: 20px 0 8px;
}

.fc-person-sidebar .fc-person-bio ul {
    padding-right: 20px;
}

.fc-person-sidebar .fc-person-bio ul li {
    margin-bottom: 6px;
}

.fc-person-sidebar .fc-person-bio ul li a {
    color: var(--e-global-color-accent);
    text-decoration: none;
}

.fc-person-sidebar .fc-person-bio ul li a:hover {
    color: var(--e-global-color-secondary);
    text-decoration: underline;
}

/* ============ WIDGET TOC ============ */

.fc-widget-toc {
    direction: rtl;
}

.fc-widget-toc .fc-widget-toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.fc-widget-toc .fc-widget-toc-list li {
    padding: 6px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.fc-widget-toc .fc-widget-toc-list li.fc-active a {
    color: var(--e-global-color-accent);
    font-weight: 700;
}

.fc-widget-toc .fc-widget-toc-list a {
    color: var(--e-global-color-text);
    text-decoration: none;
    font-size: 15px;
    transition: color 0.15s;
}

.fc-widget-toc .fc-widget-toc-list a:hover {
    color: var(--e-global-color-accent);
}

.fc-widget-toc .fc-widget-toc-list .fc-w-num {
    font-weight: 700;
    color: var(--e-global-color-accent);
    opacity: 0.55;
}

/* ============ MOBILE ============ */

@media (max-width: 768px) {
    .fc-chapter-page {
        flex-direction: column;
        padding: 14px 12px;
    }

    .fc-chapter-page .fc-toc-sidebar {
        width: 100%;
        position: relative;
        top: 0;
        max-height: none;
        overflow: visible;
        border-left: none;
        border-bottom: 2px solid rgba(143, 75, 241, 0.2);
        padding-left: 0;
        margin-left: 0;
        margin-bottom: 20px;
    }

    .fc-chapter-page .fc-toc-sidebar .fc-toc-toggle-btn {
        display: block;
    }

    .fc-chapter-page .fc-toc-sidebar .fc-toc-sidebar-inner {
        display: none;
    }

    .fc-chapter-page .fc-toc-sidebar .fc-toc-sidebar-inner.fc-toc-open {
        display: block;
    }

    .fc-chapter-page .fc-chapter-main .fc-content-wrap {
        flex-direction: column;
    }

    .fc-chapter-page .fc-chapter-main .fc-content-wrap .fc-col-hebrew {
        border-left: none;
        border-bottom: 1px solid rgba(0, 0, 0, 0.07);
    }

    .fc-chapter-page .fc-chapter-main .fc-chapter-header .fc-chapter-title {
        font-size: 26px;
    }

    .fc-chapter-page .fc-chapter-main .fc-chapter-nav .fc-nav-btn {
        max-width: 100%;
        font-size: 14px;
    }

    .fc-fn-popup {
        max-width: calc(100vw - 32px);
        left: 16px !important;
    }

    .fc-person-sidebar {
        width: 100%;
    }
}

/* ============ INDEXES PAGE (People & Places) ============ */

.fc-index-page {
    max-width: 1160px;
    margin: 0 auto;
    padding: 48px 24px 80px;
    direction: rtl;
}

/* ---- Hero header ---- */
.fc-index-hero {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 2px solid #ede9fe;
    flex-wrap: wrap;
}

.fc-index-hero-left {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.fc-index-title {
    font-size: 34px;
    font-weight: 900;
    color: #1e1b4b;
    margin: 0;
    letter-spacing: -0.5px;
    line-height: 1.15;
}

.fc-index-subtitle {
    font-size: 14px;
    color: #71717a;
    font-weight: 400;
}

.fc-index-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    padding: 7px 18px;
    border-radius: 20px;
    box-shadow: 0 3px 12px rgba(124,58,237,0.3);
    white-space: nowrap;
}

/* ---- Search bar ---- */
.fc-index-search-wrap {
    position: relative;
    max-width: 520px;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
}

.fc-index-search-icon {
    position: absolute;
    right: 16px;
    font-size: 15px;
    pointer-events: none;
    z-index: 1;
}

.fc-index-search {
    width: 100%;
    padding: 13px 48px 13px 18px;
    font-size: 15px;
    border: 2px solid #ddd6fe;
    border-radius: 14px;
    background: #fff;
    color: #1e1b4b;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 12px rgba(124,58,237,0.07);
    font-family: inherit;
    direction: rtl;
}

.fc-index-search:focus {
    border-color: #7c3aed;
    box-shadow: 0 0 0 4px rgba(124,58,237,0.12);
}

.fc-index-search::placeholder { color: #a78bfa; }

.fc-index-count {
    font-size: 12.5px;
    color: #7c3aed;
    font-weight: 600;
    margin-bottom: 28px;
    min-height: 18px;
}

.fc-index-no-results {
    text-align: center;
    padding: 60px 20px;
    font-size: 16px;
    color: #6b7280;
}

/* ---- Letter groups ---- */
.fc-index-letter-group {
    margin-bottom: 36px;
}

.fc-index-letter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    color: #fff;
    font-size: 16px;
    font-weight: 900;
    border-radius: 10px;
    margin-bottom: 14px;
    box-shadow: 0 3px 10px rgba(124,58,237,0.25);
    line-height: 1;
}

/* ---- Person cards grid ---- */
.fc-index-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}

.fc-index-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1.5px solid rgba(124,58,237,0.15);
    background: #fff;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
    box-shadow: 0 1px 6px rgba(0,0,0,0.05);
    position: relative;
    overflow: hidden;
}

.fc-index-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, #7c3aed, #a78bfa);
    opacity: 0;
    transition: opacity 0.2s;
}

.fc-index-card:hover {
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
    border-color: #6d28d9;
    box-shadow: 0 6px 20px rgba(124,58,237,0.3);
    transform: translateY(-3px);
    color: #fff;
}

.fc-index-card:hover::before { opacity: 0; }

.fc-person-card--male   {
    background: #f0f8ff;
    border-color: rgba(59,130,246,0.25);
}
.fc-person-card--male::before   { background: linear-gradient(90deg, #3b82f6, #93c5fd); opacity: 1; }

.fc-person-card--female {
    background: #fff0f8;
    border-color: rgba(236,72,153,0.25);
}
.fc-person-card--female::before { background: linear-gradient(90deg, #ec4899, #f9a8d4); opacity: 1; }

.fc-person-card--male:hover,
.fc-person-card--female:hover {
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
    border-color: #6d28d9;
    color: #fff;
}

.fc-index-card-name {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.3;
    color: #18181b;
}

.fc-index-card-years {
    font-size: 11px;
    color: #71717a;
    font-weight: 500;
    line-height: 1.3;
}

.fc-index-card-loc {
    font-size: 11px;
    color: #7c3aed;
    font-weight: 500;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fc-index-card:hover .fc-index-card-name { color: #fff; }

.fc-index-card:hover .fc-index-card-years,
.fc-index-card:hover .fc-index-card-loc {
    color: rgba(255,255,255,0.78);
}

@media (max-width: 768px) {
    .fc-index-page { padding: 28px 16px 60px; }

    .fc-index-title { font-size: 26px; }

    .fc-index-cards {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 8px;
    }

    .fc-index-card { padding: 11px 13px; }

    .fc-index-card-name { font-size: 13px; }

    .fc-index-hero { flex-direction: column; align-items: flex-start; }
}

/* ============ BACK TO TOP BUTTON ============ */

#fc-back-to-top {
    position: fixed;
    bottom: 32px;
    left: 32px;
    z-index: 9990;
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(124,58,237,0.4);
    opacity: 0;
    visibility: hidden;
    transform: translateY(14px) scale(0.9);
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease, box-shadow 0.25s ease;
    font-family: inherit;
    line-height: 1;
}

#fc-back-to-top.fc-btt-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

#fc-back-to-top:hover {
    background: linear-gradient(135deg, #6d28d9, #5b21b6);
    box-shadow: 0 6px 28px rgba(124,58,237,0.55);
    transform: translateY(-3px) scale(1.06) !important;
}

#fc-back-to-top:active {
    transform: scale(0.95) !important;
}

@media (max-width: 768px) {
    #fc-back-to-top {
        bottom: 20px;
        left: 20px;
        width: 42px;
        height: 42px;
        font-size: 17px;
    }
}

/* ============ PRINT ============ */

/* ============ FAMILY TREE — NAME SEARCH ============ */

.fc-tree-search-wrap {
    max-width: 480px;
    margin: 28px auto 0;
    padding: 0 16px;
    position: relative;
    direction: rtl;
}

.fc-tree-search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 2px solid #c4b5fd;
    border-radius: 12px;
    padding: 8px 14px;
    box-shadow: 0 2px 12px rgba(124,58,237,0.08);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.fc-tree-search-box:focus-within {
    border-color: #7c3aed;
    box-shadow: 0 4px 20px rgba(124,58,237,0.15);
}

.fc-tree-search-icon {
    font-size: 17px;
    flex-shrink: 0;
    color: #7c3aed;
    line-height: 1;
}

.fc-tree-search-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 15px;
    color: #1e293b;
    font-family: inherit;
    direction: rtl;
    min-width: 0;
}

.fc-tree-search-input::placeholder {
    color: #a78bfa;
    font-size: 14px;
}

.fc-tree-search-clear {
    background: none;
    border: none;
    cursor: pointer;
    color: #9ca3af;
    font-size: 16px;
    line-height: 1;
    padding: 2px 4px;
    border-radius: 4px;
    transition: color 0.15s;
    flex-shrink: 0;
}

.fc-tree-search-clear:hover {
    color: #7c3aed;
}

.fc-tree-search-results {
    position: absolute;
    top: calc(100% + 6px);
    right: 16px;
    left: 16px;
    background: #fff;
    border: 1.5px solid #ede9fe;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(124,58,237,0.12);
    max-height: 280px;
    overflow-y: auto;
    z-index: 999;
    display: none;
    scrollbar-width: thin;
    scrollbar-color: #c4b5fd #f5f3ff;
}

.fc-tree-search-results::-webkit-scrollbar { width: 4px; }
.fc-tree-search-results::-webkit-scrollbar-track { background: #f5f3ff; }
.fc-tree-search-results::-webkit-scrollbar-thumb { background: #c4b5fd; border-radius: 4px; }

.fc-search-result {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f3f0ff;
    transition: background 0.12s;
}

.fc-search-result:last-child {
    border-bottom: none;
}

.fc-search-result:hover,
.fc-search-result.fc-search-active {
    background: #f5f3ff;
}

.fc-search-result-name {
    font-size: 14.5px;
    font-weight: 600;
    color: #1e293b;
}

.fc-search-result-name mark {
    background: #ede9fe;
    color: #6d28d9;
    border-radius: 3px;
    padding: 0 1px;
}

.fc-search-result-meta {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.fc-search-result-years,
.fc-search-result-loc {
    font-size: 12px;
    color: #94a3b8;
    white-space: nowrap;
}

.fc-search-empty {
    text-align: center;
    padding: 18px;
    color: #a78bfa;
    font-size: 14px;
}

/* ============================================================
   PEOPLE INDEX — glossary-style rows with thumbnail
   ============================================================ */

.fc-person-row,
.fc-person-row *,
.fc-person-row:hover,
.fc-person-row:visited {
    text-decoration: none !important;
}

.fc-person-row {
    display: flex;
    align-items: center;
    gap: 18px;
    color: inherit;
    transition: background 0.15s, border-color 0.15s;
    cursor: pointer;
}

.fc-person-row:hover {
    background: #f5f3ff !important;
    border-color: #c4b5fd !important;
}

.fc-person-row-thumb {
    flex-shrink: 0;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e9e5ff;
}

.fc-person-row-thumb--empty {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    background: #f5f3ff;
    color: #c4b5fd;
    border: 2px solid #e9e5ff;
}

.fc-person-row-body {
    flex: 1;
    min-width: 0;
}

.fc-person-row .fc-glossary-term {
    margin-bottom: 2px;
}

.fc-person-row-tagline {
    display: block;
    font-size: 12px;
    color: #7c3aed;
    font-style: italic;
    margin-bottom: 4px;
    line-height: 1.4;
}

.fc-person-row-arrow {
    flex-shrink: 0;
    font-size: 16px;
    color: #c4b5fd;
    transition: color 0.15s, transform 0.15s;
}

.fc-person-row:hover .fc-person-row-arrow {
    color: #7c3aed;
    transform: translateX(-3px);
}

/* ============================================================
   SINGLE NOTABLE PERSON PAGE
   ============================================================ */

.fc-notable-page {
    direction: rtl;
    max-width: 820px;
    margin: 0 auto;
    padding-inline: 4vw;
    padding-block: 8vh;
    font-size: 17px;
    line-height: 1.85;
    color: #18181b;
}

.fc-notable-back {
    margin-bottom: 22px;
}

.fc-notable-back a {
    font-size: 13px;
    color: #7c3aed;
    text-decoration: none !important;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    opacity: 0.8;
    transition: opacity 0.15s;
}
.fc-notable-back a:hover { opacity: 1; }

.fc-notable-article {
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 2px 20px rgba(0,0,0,0.07);
    overflow: hidden;
    border: 1.5px solid #ede9fe;
}

/* Header: flex row, RTL → text on physical right, photo on physical left */
.fc-notable-header {
    display: flex;
    flex-direction: row;     /* RTL: first=right, second=left */
    align-items: center;
    gap: 28px;
    padding: 32px 36px;
    border-bottom: 1.5px solid #f1f0ff;
    background: linear-gradient(135deg, #faf5ff 0%, #f0ebff 100%);
}

/* Photo — second in HTML → physical left in RTL */
.fc-notable-photo-wrap {
    flex-shrink: 0;
    width: 110px;
    height: 110px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid #c4b5fd;
    box-shadow: 0 3px 12px rgba(124,58,237,0.18);
    background: #ede9fe;
}

.fc-notable-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.fc-notable-photo-placeholder {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 44px;
    background: #f5f3ff;
    border: 3px solid #e9e5ff;
    flex-shrink: 0;
    color: #c4b5fd;
}

.fc-notable-header-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.fc-notable-name {
    font-size: 26px;
    font-weight: 800;
    color: #1e1b4b;
    margin: 0;
    line-height: 1.2;
}

.fc-notable-tagline {
    font-size: 14px;
    color: #7c3aed;
    margin: 0;
    font-style: italic;
    line-height: 1.5;
    opacity: 0.9;
}

.fc-notable-tree-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
    padding: 8px 16px;
    background: #7c3aed;
    color: #fff !important;
    border-radius: 9px;
    text-decoration: none !important;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.02em;
    transition: background 0.18s, transform 0.15s;
    align-self: flex-start;
    width: fit-content;
}
.fc-notable-tree-btn:hover {
    background: #5b21b6;
    transform: translateY(-1px);
}

.fc-notable-bio {
    padding: 32px 36px;
    font-size: 17px;
    line-height: 1.9;
    color: #27272a;
}
.fc-notable-bio p { margin-bottom: 1.1em; }
.fc-notable-bio p:last-child { margin-bottom: 0; }

/* Empty bio: show a placeholder message */
.fc-notable-bio:empty {
    display: none;
}

@media (max-width: 640px) {
    .fc-notable-header {
        flex-direction: column-reverse;  /* stack: photo on top, text below */
        align-items: center;
        text-align: center;
        padding: 24px 20px;
        gap: 16px;
    }
    .fc-notable-header-text { align-items: center; }
    .fc-notable-tree-btn { align-self: center; }
    .fc-notable-name { font-size: 22px; }
    .fc-notable-bio { padding: 24px 20px; }
}

@media print {
    .fc-chapter-page .fc-toc-sidebar,
    .fc-chapter-page .fc-chapter-main .fc-view-toggle-bar,
    .fc-chapter-page .fc-chapter-main .fc-chapter-nav,
    .fc-fn-popup {
        display: none !important;
    }

    .fc-chapter-page .fc-chapter-main .fc-content-wrap {
        border: none;
        box-shadow: none;
    }

    .fc-chapter-page .fc-chapter-main .fc-content-wrap .fc-col .fc-col-header {
        background: #333 !important;
        -webkit-print-color-adjust: exact;
    }

    .fc-chapter-page {
        font-size: 14px;
    }
}

/* ---- TOC: year row with optional tree icon flush-left ---- */
.fc-year-row {
    display: flex;
    align-items: center;
    justify-content: space-between;   /* RTL: text on the right, icon flush-left */
    gap: 8px;
    width: 100%;
}

.fc-toc-tree-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 16px;
    line-height: 1;
    flex-shrink: 0;
    transition: transform 0.15s ease, filter 0.15s ease;
}
.fc-toc-tree-icon:hover {
    transform: scale(1.2);
    filter: drop-shadow(0 0 2px rgba(22,101,52,0.45));
    text-decoration: none;
}

/* ---- Chapter eyebrow: Family Tree button ---- */
.fc-meta-tag.fc-meta-tree {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #166534;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
}
.fc-meta-tag.fc-meta-tree:hover {
    background: #166534;
    color: #fff;
    border-color: #166534;
}
