/* Site layout and legacy content, implemented without a CSS framework. */
:root { color-scheme: light; --navy: #142e59; --gold: #edc987; --ink: #192c48; --page-width: 1600px; }
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; }
[hidden] { display: none !important; }
img, video, canvas, svg { max-width: 100%; height: auto; }
iframe, object, embed { max-width: 100%; }
button, input, select, textarea { font: inherit; }
button, summary, a, input, select { touch-action: manipulation; }
a, button, summary { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a:focus-visible, button:focus-visible, summary:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid #c68c28; outline-offset: 3px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link { position: fixed; z-index: 3000; top: .5rem; left: .5rem; padding: .8rem; background: white; color: var(--navy); transform: translateY(-200%); }
.skip-link:focus { transform: none; }
.site-page { background: #e9edf2; color: var(--ink); font: 1rem/1.7 Sylfaen, Georgia, 'Times New Roman', serif; }
.site-page :where(div, span, a, p, td, th, tr) { font-family: inherit; font-size: inherit; }
.site-header { background: var(--navy); color: white; border-bottom: 3px solid var(--gold); }
.site-header-inner { max-width: var(--page-width); margin: auto; padding: 1rem clamp(1rem, 2vw, 2.5rem) 0; display: grid; grid-template-columns: minmax(0,1fr) auto; gap: .75rem 1.5rem; align-items: center; }
.site-brand { display: flex; gap: 1rem; align-items: center; min-width: 0; grid-column: 1; grid-row: 1; color: var(--gold); text-decoration: none; }
.site-brand:hover { text-decoration: none; }
.brand-emblem { flex: 0 0 92px; height: 92px; background: url('/img/top1.png') left top / auto 92px no-repeat; }
.brand-text { display: grid; min-width: 0; overflow-wrap: anywhere; }
.brand-title { font-size: clamp(1.25rem, 2vw, 2rem) !important; line-height: 1.3; }
.brand-tagline { font-size: .85rem !important; color: #d3dfed; margin-top: .35rem; }
.site-languages { justify-self: end; align-self: center; grid-column: 2; grid-row: 1; }
.language-menu { position: relative; }
.language-menu > summary { display: flex; align-items: center; gap: .5rem; min-width: 44px; min-height: 44px; padding: .5rem .65rem; color: #e3e9f3; border: 1px solid #526b8e; border-radius: .35rem; cursor: pointer; list-style: none; white-space: nowrap; }
.language-menu > summary::-webkit-details-marker { display: none; }
.language-menu > summary:hover, .language-menu[open] > summary { background: #29456c; border-color: var(--gold); }
.site-languages .language-icon { display: block; flex-shrink: 0; font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; font-size: 1.5rem; line-height: 1; }
.language-menu .language-name { font-size: .9rem; }
.language-chevron { width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); margin-inline-start: .15rem; flex-shrink: 0; }
.language-menu[open] .language-chevron { transform: rotate(225deg); }
.language-options { position: absolute; top: calc(100% + .4rem); inset-inline-end: 0; z-index: 2000; min-width: 11rem; max-width: calc(100vw - 1rem); padding: .3rem; background: var(--navy); border: 1px solid #526b8e; border-radius: .4rem; box-shadow: 0 .4rem 1rem #0004; }
.language-options a { display: flex; align-items: center; gap: .65rem; min-height: 44px; padding: .6rem .75rem; color: #e3e9f3; border-radius: .25rem; text-decoration: none; white-space: nowrap; }
.language-options a:hover, .language-options [aria-current] { color: var(--gold); background: #31547e; }
.language-options [aria-current]::after { content: '✓'; margin-inline-start: auto; }
.site-primary { grid-column: 1/-1; grid-row: 2; display: flex; flex-wrap: wrap; gap: .25rem; }
.site-primary a { color: #e3e9f3; padding: .65rem 1rem; min-height: 44px; border-radius: .3rem .3rem 0 0; }
.site-primary a:hover, .site-primary [aria-current] { color: var(--gold); background: #243e68; text-decoration: none; }
.site-layout { max-width: var(--page-width); margin: auto; display: grid; grid-template-columns: clamp(240px, 20vw, 300px) minmax(0,1fr); align-items: start; min-height: 70vh; }
.site-sidebar { min-width: 0; background: var(--navy); color: white; align-self: stretch; }
.section-menu > summary { display: none; }
.section-menu > summary::-webkit-details-marker { display: none; }
.section-menu-icon { display: block; flex-shrink: 0; width: 22px; height: 18px; border-block: 2px solid currentColor; background: linear-gradient(currentColor, currentColor) center / 100% 2px no-repeat; }
.section-menu-title { min-width: 0; font-weight: bold; font-size: clamp(.8rem, 3.8vw, 1rem); }
.section-menu-body { padding: 1rem; }
.site-sections { min-width: 0; }
.section-list, .section-submenu { list-style: none; margin: 0; padding: 0; }
.section-item { min-width: 0; }
.section-item + .section-item { margin-block-start: .2rem; }
.section-submenu { margin: .25rem 0 .6rem .6rem; padding-inline-start: .65rem; border-inline-start: 1px solid #526b8e; }
.site-sections a, .section-action { display: block; padding: .55rem .75rem; border: 0; border-radius: .3rem; color: #d7e3f2; text-align: start; text-decoration: none; background: transparent; line-height: 1.5; min-height: 44px; overflow-wrap: anywhere; }
.site-sections .section-link { display: flex; align-items: start; gap: .4rem; }
.section-label { min-width: 0; }
.section-parent > .section-link { font-weight: bold; color: #f0f4fa; }
.section-branch-marker { flex-shrink: 0; margin-inline-start: auto; color: #a9bdd8; }
.section-submenu .section-label, .section-submenu .section-action { font-size: .92rem; }
.section-action { width: 100%; }
.is-ancestor > .section-link { color: var(--gold); }
.site-sections a:hover, .section-action:hover { color: var(--gold); background: #29456c; }
.site-sections a[aria-current="page"] { color: var(--gold); background: #31547e; border-inline-start: 3px solid var(--gold); padding-inline-start: calc(.75rem - 3px); font-weight: bold; }
.section-heading { padding: 1rem .7rem .6rem; margin-bottom: .4rem; border-bottom: 1px solid #405a7d; font-weight: bold; color: var(--gold); }
.site-content { min-width: 0; width: 100%; background: #fff; padding: clamp(1rem, 2.2vw, 2.75rem); font-size: clamp(1rem, .85rem + .25vw, 1.15rem); overflow-wrap: anywhere; }
.site-content :where(h1,h2,h3,h4,h5,h6) { line-height: 1.35; }
.content-toolbar { display: flex; gap: 1rem; align-items: center; justify-content: space-between; padding-bottom: .9rem; margin-bottom: 1.3rem; border-bottom: 1px solid #e1e6ed; }
.content-toolbar > .mnFull { min-width: 0; }
.content-actions, .collection-controls { display: flex; align-items: center; gap: .4rem; flex-shrink: 0; }
.collection-controls button { min-width: 44px; min-height: 44px; padding: .4rem; border: 1px solid #d3dce7; border-radius: .3rem; background: white; color: var(--navy); font-size: 1.25rem; }
.collection-controls button:disabled { opacity: .4; cursor: default; }
.collection-controls button[data-state="mixed"] { background: #fff3d8; border-color: #c68c28; }
.mnFull { color: #52627b; font-size: .85rem !important; }
.reading-toggle { padding: .4rem .6rem; border: 1px solid #d3dce7; border-radius: .3rem; white-space: nowrap; color: var(--navy); min-width: 44px; text-align: center; }
.content-flow { min-width: 0; max-width: 100%; }
.content-flow > :where(#book,#book2,.dname,.dsound,.nterBk) { max-width: 100ch; margin-inline: auto; }
.content-flow p { margin-block: 0 1em; }
.content-flow :where(iframe) { display: block; width: 100%; min-height: min(28rem,75vh); height: clamp(28rem,70vh,58rem); border: 0; margin-block: 1rem; background: #f3f5f8; }
.content-flow :where(video) { display: block; width: 100%; aspect-ratio: 16/9; background: #10203d; }
.content-flow audio { width: min(100%, 36rem); }
.content-flow :where(table) { max-width: 100%; border-collapse: collapse; }
.content-flow :where(td,th) { overflow-wrap: anywhere; }
.content-flow :where(hr) { max-width: 100%; }
.content-flow :where(input,select,textarea) { max-width: 100%; min-height: 44px; }
.content-flow :where(.bibA,.bibA_,.patA,.patA_) { display: inline-block; padding: .35rem .2rem; }
.nterT { padding: 1rem 2.25rem 1rem 1rem; border-radius: .25rem; background: #f0f3f7; }
.nterA { color: #193b70; }
.nterBk { margin-bottom: .65rem; }
.closeImg { width: 28px; height: 28px; padding: 6px; background: #e4eaf3; border-radius: 50%; }
.site-footer { background: var(--navy); color: #d7c299; text-align: center; padding: 1rem; font-size: .85rem; }
#barPre { position: fixed; inset: 50% auto auto 50%; z-index: 2000; margin: 0; transform: translate(-50%,-50%); width: auto; height: auto; padding: .75rem; border-radius: .5rem; background: white; box-shadow: 0 3px 20px #0003; display: block; }
.request-status { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); z-index: 2100; width: min(90%,40rem); background: #fff3d6; border: 1px solid #d9ab4a; border-radius: .4rem; padding: 1rem; color: #542c00; }
.sidebar-hidden { grid-template-columns: minmax(0,1fr); }
.sidebar-hidden .site-sidebar { display: none; }
.reading-mode .site-content { font-size: clamp(1.1rem,1rem + .4vw,1.45rem); }
.sidebar-calendar { padding: 1rem 1rem 0; }
.site-calendar { margin-bottom: 0; }
.site-calendar table { width: 100%; table-layout: fixed; }
.site-calendar td { padding: 0; text-align: center; }
.site-calendar button { display: block; width: 100%; min-height: 36px; padding: .15rem; border: 0; background: transparent; color: #e0e9f5; font-size: .82rem; border-radius: .25rem; }
.site-calendar button:hover, .site-calendar [aria-current] { background: #45618a; color: var(--gold); }
.calendar-controls { display: grid; grid-template-columns: 2.2rem 2.2rem minmax(0,1fr) 2.2rem 2.2rem; align-items: center; color: var(--gold); text-align: center; font-size: .85rem; }
.calendar-weekday { font-size: .75rem !important; color: #acbfd9; }
/* Wide authored content scrolls inside its own region, never the entire page. */
.table-scroll { width: 100%; max-width: 100%; min-width: 0; overflow-x: auto; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; }
.table-scroll > table { width: 100%; }
.content-flow .media-layout { width: 100%; background: #142e59; color: white; }
.media-layout > tbody > tr > td { padding: .75rem; }
.photo-albums { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,240px),1fr)); gap: 1rem; }
.photo-album { display: grid; align-content: start; gap: .6rem; text-align: start; color: var(--ink); background: #f4f6f9; padding: .75rem; border: 1px solid #d9e1eb; border-radius: .4rem; }
.photo-album img { width: 100%; aspect-ratio: 2/1; object-fit: cover; }
.photo-album:hover { background: #e9eef5; }
.photo-gallery { display: grid; grid-template-columns: repeat(auto-fill,minmax(min(100%,160px),1fr)); gap: .75rem; margin-block: 1.5rem; }
.photo-gallery a { display: block; }
.photo-gallery img { display: block; width: 100%; height: 170px; object-fit: cover; }
.gallery-dialog { width: min(96vw,1500px); max-width: 96vw; max-height: 96dvh; padding: .75rem; border: 0; border-radius: .5rem; background: #101e34; color: white; }
.gallery-dialog::backdrop { background: #000c; }
.gallery-dialog figure { margin: 0; display: grid; justify-items: center; gap: .5rem; }
.gallery-dialog img { display: block; max-width: 100%; max-height: 76dvh; object-fit: contain; }
.gallery-controls { display: flex; justify-content: space-between; gap: .5rem; margin-bottom: .5rem; }
.gallery-controls button { min-width: 44px; min-height: 44px; border: 1px solid #66758e; color: white; background: #243e62; border-radius: .3rem; }
.media-collection { border: 1px solid #d6dfeb; border-radius: .4rem; margin-bottom: 1rem; }
.media-collection > summary { padding: .9rem 1rem; background: #f0f3f8; cursor: pointer; color: var(--navy); }
.media-collection-body { padding: .75rem; }
/* Standalone archive documents retain their diagrams and image-map coordinates. */
body.legacy-page { max-width: 100%; margin: 0; padding: .75rem; font-family: Sylfaen, Georgia, serif; line-height: 1.6; overflow-wrap: anywhere; }
.legacy-page table { max-width: 100%; }
.legacy-page iframe { width: 100%; min-height: 20rem; border: 0; }
.legacy-page .diagram-viewport { width: 100%; overflow: auto; overscroll-behavior: contain; touch-action: pan-x pan-y pinch-zoom; }
.diagram-stage { position: relative; }
.diagram-canvas { transform-origin: top left; overflow: visible; }
.diagram-canvas :where(img,table,iframe,object,embed) { max-width: none; }
.diagram-canvas img { height: revert-layer; }
.diagram-toolbar { display: flex; gap: .5rem; margin-bottom: .5rem; }
.diagram-toolbar button { min-height: 44px; padding: .4rem .8rem; border: 1px solid #aebdd0; border-radius: .3rem; background: #edf1f7; color: #142e59; }
body.legacy-frame-page { margin: 0; padding: 0; }
.legacy-frames { display: grid; gap: .5rem; min-width: 0; align-items: stretch; }
.legacy-frame-columns { grid-template-columns: var(--frame-tracks); }
.legacy-frame-rows { grid-template-rows: var(--frame-tracks); }
.legacy-frame-page > .legacy-frames { min-height: 100dvh; }
.legacy-frame { width: 100%; min-width: 0; min-height: 24rem; border: 0; }
.legacy-frame-header { min-height: 3rem; height: 7rem; }
.legacy-frame-spacer { min-height: 0; }
@media(max-width: 800px) { .legacy-frame-spacer { display: none; } }
@media (max-width: 1366px) {
    .language-menu > summary .language-name { display: none; }
}
@media (min-width: 2000px) { :root { --page-width: 1880px; } .site-layout { grid-template-columns: 320px minmax(0,1fr); } .site-layout.sidebar-hidden { grid-template-columns: minmax(0,1fr); } }
@media (max-width: 1100px) { .site-layout { grid-template-columns: 235px minmax(0,1fr); } .site-layout.sidebar-hidden { grid-template-columns: minmax(0,1fr); } }
@media (max-width: 800px) {
    .site-header-inner { padding: .75rem .75rem 0; gap: .5rem; }
    .brand-emblem { flex-basis: 64px; height: 64px; background-size: auto 64px; }
    .site-brand { gap: .6rem; }
    .brand-title { font-size: clamp(1.1rem,4vw,1.5rem) !important; }
    .brand-tagline { font-size: .75rem !important; }
    .site-primary { gap: 0; }
    .site-primary a { padding: .55rem .65rem; font-size: .9rem; }
    .site-layout, .site-layout.sidebar-hidden { display: block; }
    .site-sidebar, .sidebar-hidden .site-sidebar { display: block; }
    .section-menu > summary { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .8rem 1rem; min-height: 48px; cursor: pointer; color: var(--gold); list-style: none; }
    .section-menu-heading { display: none; }
    .section-menu-body { padding: .5rem 1rem 1rem; }
    .site-calendar { max-width: 26rem; margin-inline: auto; }
    .site-calendar button { min-height: 44px; }
    .site-content { padding: 1rem; font-size: 1rem; }
    .content-flow iframe { min-height: 24rem; height: 65vh; }
    .content-flow .media-layout > tbody > tr { display: flex; flex-direction: column; }
    .content-flow .media-layout > tbody > tr > td { display: block; width: 100%; }
    .legacy-frame-columns { grid-template-columns: minmax(0,1fr) !important; }
    .legacy-frame-rows { grid-template-rows: auto !important; }
    .legacy-frame { min-height: 24rem; }
    .legacy-frame-header { min-height: 3rem; height: 7rem; }
    .content-flow :where(.picL,.picR,.picPL,.picMR) { float: none; max-width: 100%; margin-inline: 0; padding-inline: 0; }
    .content-flow :where(.cit,.cit2,.cit3) { margin-inline: .75rem; }
}
@media (max-width: 480px) {
    .site-header-inner { padding-inline: .5rem; column-gap: .4rem; }
    .site-brand { gap: .4rem; }
    .brand-emblem { flex-basis: clamp(48px, 12vw, 64px); height: clamp(48px, 12vw, 64px); background-size: auto clamp(48px, 12vw, 64px); }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

@media(max-width: 480px) { .site-primary { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); } .site-primary a { text-align: center; padding-inline: .35rem; } }
body.legacy-page:not(.has-diagrams) :where(font,td,p,div) { font-size: inherit; }
.legacy-page:not(.has-diagrams) > .table-scroll { width: 100%; }
.legacy-page:not(.has-diagrams) :where(video,audio) { width: min(100%,45rem); }
.legacy-page:not(.has-diagrams) #lnk { width: 100% !important; max-width: 100%; }
.diagram-canvas > table { width: 100%; }
.diagram-toolbar button[aria-pressed="true"] { background: #213f6b; color: white; }
@media(max-width: 800px) { .legacy-page:not(.has-diagrams) .table-scroll > table > tbody > tr > td:has(iframe, video, audio, #lnk) { display: block; width: 100%; } }

.legacy-page form { width: 100%; min-width: 0; }
.legacy-page form table { width: 100%; table-layout: fixed; }
.legacy-page form iframe { max-width: 100%; }
@media(max-width: 800px) { .legacy-page form table > tbody > tr { display: flex; flex-wrap: wrap; gap: .5rem; } .legacy-page form table > tbody > tr > td { display: block; max-width: 100%; width: auto; } }
.diagram-canvas img { display: block; }
.diagram-viewport:focus-visible { outline: 3px solid #c68c28; outline-offset: 2px; }

body.legacy-page { width: 100%; max-width: var(--page-width); margin-inline: auto; }
body.legacy-page:not(.has-diagrams):not(.legacy-frame-page) { max-width: 1200px; }
.legacy-page iframe.legacy-frame { min-height: 24rem; }
.legacy-page iframe.legacy-frame-header { min-height: 3rem; }
.legacy-page iframe.legacy-frame-spacer { min-height: 0; }

/* Authored interactive documents handle their own artwork and inset frames. */
.content-flow iframe.interactive-host-frame { display: block; width: 100%; min-height: 0; height: 560px; margin: 0 auto; border: 0; }
.interactive-open-link { display: inline-block; min-height: 44px; padding: .4rem 0; font-size: .9rem !important; }

/* The standalone Bible manages its own layout and navigation inside this frame. */
.content-flow iframe.bible-reader-frame { display: block; width: 100%; height: calc(100vh - 18rem); height: calc(100dvh - 18rem); min-height: 32rem; margin: 0; border: 0; background: #fffdf8; }

/* Selected media belongs to its own list entry, before the next title. */
.media-articles { list-style: none; margin: 0; padding: 0; overflow-anchor: none; }
.media-item { min-width: 0; border-bottom: 1px solid #dce3ed; scroll-margin-top: 1rem; }
.media-item-link { display: block; min-height: 44px; padding: .65rem .75rem; color: #193b70; }
.media-item-link:hover { background: #f2f5f9; }
.media-item-link[aria-expanded="true"] { background: #eaf0f7; font-weight: bold; }
.media-item-heading { padding: 1rem .75rem .5rem; font-weight: bold; color: #52627b; }
.media-item-content { min-width: 0; max-width: 100%; padding: .75rem; }
.media-item-content > .media-body > :first-child { margin-top: 0; }
.alphabet-nav { display: flex; flex-wrap: wrap; gap: .25rem; margin-bottom: 1rem; }
.alphabet-nav a { display: inline-flex; justify-content: center; align-items: center; min-width: 44px; min-height: 44px; padding: .4rem; border: 1px solid #dce3ed; border-radius: .25rem; }
.alphabet-nav a[aria-current="page"] { color: white; background: var(--navy); border-color: var(--navy); font-weight: bold; }
.bible-chapter-heading { text-align: center; font-weight: bold; }
.bible-selected-passage { background: #fff3b0; }
.article-readings .media-body { max-width: 100ch; margin-inline: auto; }

/* Timeline titles stay fixed; the content frame owns vertical scrolling. */
body.legacy-frame-page.timeline-shell { width: 100%; max-width: none; height: 100vh; height: 100dvh; overflow: hidden; }
.timeline-shell > .legacy-frames { height: 100%; min-height: 0; gap: 0; grid-template-rows: auto minmax(0,1fr) !important; }
.timeline-shell > .legacy-frames > .legacy-frame { display: block; min-height: 0 !important; }
.timeline-shell > .legacy-frames > iframe[data-timeline-content] { height: 100% !important; }
body.legacy-page.timeline-heading { padding: 0; margin: 0; max-width: none !important; overflow: hidden; }
.timeline-heading p { margin: 0; }
.timeline-heading img { display: block; }
body.legacy-page.timeline-content { max-width: none; }
.timeline-content .diagram-viewport { overscroll-behavior-y: auto; }
.timeline-content .diagram-stage { overflow: hidden; overflow: clip; }
