/* THE WINDOW OVER THE APPS (nav/sheet.js): a window that rises from the bottom, on a phone and a
   computer alike; the way back always at its top, and the way to the app at its foot.
   (Over the Bible reader and its pop-ups, under the word ring and its card, which can open on its text.) */
.nv { position: fixed; inset: 0; z-index: 2147483155; display: flex; align-items: flex-end; justify-content: center; background: rgba(20, 16, 12, 0.32); opacity: 0; transition: opacity 0.22s ease; }
.nv.open { opacity: 1; }
.nv[hidden] { display: none; }
.nv-box { position: relative; display: flex; flex-direction: column; width: min(760px, 100%); height: min(78vh, 820px); height: min(78dvh, 820px); border-radius: 22px 22px 0 0; background: var(--bg); border: 1px solid var(--rule); border-bottom: none; box-shadow: 0 -18px 50px -20px rgba(20, 16, 12, 0.55); transform: translateY(24px); transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1); overflow: hidden; }
.nv.open .nv-box { transform: none; }
@media (max-width: 560px) { .nv-box { height: 86vh; height: 86dvh; border-left: none; border-right: none; } }

/* (once it's been sized with the grab bar: what's above it can be tapped again) */
.nv.is-sized { background: rgba(20, 16, 12, 0.08); pointer-events: none; }
.nv.is-sized .nv-box { pointer-events: auto; }

/* the grab bar */
.nv-grip { flex: none; display: grid; place-items: center; height: 18px; cursor: ns-resize; touch-action: none; }
.nv-grip span { width: 44px; height: 5px; border-radius: 3px; background: var(--rule); transition: background 0.15s, width 0.15s; }
.nv-grip:hover span, .nv-grip:focus-visible span, .nv-grip.is-drag span { width: 56px; background: var(--muted); }
.nv-grip:focus { outline: none; }

/* the top: the way back, the page's name, and back and forward */
.nv-head { flex: none; display: flex; align-items: center; gap: 10px; padding: 0 12px 10px; border-bottom: 1px solid var(--rule); }
.nv-close { flex: none; display: inline-flex; align-items: center; gap: 6px; max-width: 46%; height: 36px; padding: 0 14px 0 10px; border: 1px solid color-mix(in srgb, var(--coral) 45%, var(--rule)); border-radius: 999px; background: color-mix(in srgb, var(--coral) 9%, var(--bg-raised)); color: var(--ink); font: 700 13px var(--sans); cursor: pointer; -webkit-tap-highlight-color: transparent; }
.nv-close > span:first-child { font-size: 20px; line-height: 1; margin-top: -2px; color: var(--coral); }
.nv-close-l { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (hover: hover) { .nv-close:hover { border-color: var(--coral); } }
.nv-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 800 11px var(--sans); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); text-align: right; }
/* back to the page before, and forward again: each named for its page, only when there's one that way */
.nv-tabs { flex: none; display: flex; justify-content: space-between; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--rule); background: var(--bg-raised); }
.nv-tabs[hidden] { display: none; }
.nv-tab { display: inline-flex; align-items: center; gap: 4px; min-width: 0; max-width: 60%; height: 32px; padding: 0 12px 0 8px; border: 1px solid var(--rule); border-radius: 999px; background: var(--bg); color: var(--ink); font: 700 12.5px var(--sans); cursor: pointer; -webkit-tap-highlight-color: transparent; }
.nv-tab.is-fwd { margin-left: auto; padding: 0 8px 0 12px; }
.nv-tab[hidden] { display: none; }
.nv-tab span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nv-tab svg { flex: none; width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; color: var(--coral); }
@media (hover: hover) { .nv-tab:hover { border-color: var(--coral); } }
.nv-close:focus-visible, .nv-tab:focus-visible, .nv-app:focus-visible { outline: 2px solid var(--coral); outline-offset: 2px; }

/* the page */
.nv-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 22px 28px 32px; }
@media (max-width: 560px) { .nv-body { padding: 18px 20px 28px; } }
@media (max-width: 560px) { .nv-close { max-width: 66%; } .nv-t { font-size: 10px; letter-spacing: 0.1em; } } /* (on a phone: the way back first, the page's name after) */
/* (a page's own buttons, in the header beside its name: a passage's Study) */
.nv-tools { flex: none; display: flex; align-items: center; gap: 6px; }
.nv-tools:empty { display: none; }
.nv-head:has(.nv-tools:not(:empty)) .nv-close { max-width: 48%; }
.nv-loading { margin: 24px 0; font: 600 14px var(--sans); color: var(--muted); text-align: center; }

/* the foot: to the app. Kept quiet (a line of small text, no fill): what the window is for is the page in it; this is only the way out to the page's own app, for those who want it */
.nv-foot { flex: none; display: flex; justify-content: center; padding: 3px 16px; padding-bottom: max(4px, env(safe-area-inset-bottom)); border-top: 1px solid color-mix(in srgb, var(--rule) 55%, transparent); background: var(--bg); }
.nv-foot[hidden] { display: none; }
.nv-app { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 12px; border: none; border-radius: 999px; background: none; color: var(--muted); font: 600 13px var(--sans); cursor: pointer; -webkit-tap-highlight-color: transparent; }
.nv-app > span { color: var(--coral); }
@media (hover: hover) { .nv-app:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 5%, transparent); } }

@media (prefers-reduced-motion: reduce) { .nv, .nv-box { transition: none; } }
/* (a passage in the window: its own "Open in the reader" is the window's foot instead) */
.nv .br-inline-foot { display: none; }
/* (the reader's verse pop-up, opened from a passage in the window: over it) */
html.nv-open .br-pop { z-index: 2147483166; z-index: max(2147483166, calc(var(--nv-z, 2147483155) + 11)); }
/* (the reader's floating controls wait while the window's open) */
html.nv-open .as-ctl, html.nv-open .as-hint { visibility: hidden; }

/* ---- A picture, larger (nav/zoom.js): over everything; pinch, scroll, or double-tap to zoom, drag to move */
.zm { position: fixed; inset: 0; z-index: 2147483300; background: rgba(14, 12, 9, 0.94); opacity: 0; transition: opacity 0.18s ease; font-family: var(--sans, system-ui); }
.zm.is-open { opacity: 1; }
.zm[hidden] { display: none; }
html.zm-open, html.zm-open body { overflow: hidden; }
.zm-stage { position: absolute; inset: 0; overflow: hidden; touch-action: none; cursor: zoom-in; -webkit-user-select: none; user-select: none; }
.zm.is-zoomed .zm-stage { cursor: grab; }
.zm.is-zoomed .zm-stage:active { cursor: grabbing; }
.zm-img { position: absolute; left: 0; top: 0; max-width: none; transform-origin: 0 0; border-radius: 4px; box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5); -webkit-user-drag: none; will-change: transform; }
.zm-x.x-close { position: absolute; top: max(12px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right)); z-index: 2; background: rgba(255, 253, 247, 0.94) !important; border-color: transparent !important; color: #2E2B27 !important; }
.zm-foot { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 28px 16px max(14px, env(safe-area-inset-bottom)); background: linear-gradient(to top, rgba(14, 12, 9, 0.85), rgba(14, 12, 9, 0)); pointer-events: none; transition: opacity 0.2s ease; }
.zm-foot > * { pointer-events: auto; }
.zm-cap { max-width: 720px; margin: 0; color: #EFE9DC; font-size: 13px; line-height: 1.45; text-align: center; }
.zm-cap a { color: #E0B96B; }
.zm-cap[hidden] { display: none; }
.zm.is-zoomed .zm-cap { display: none; } /* (zoomed in: only the picture, and the buttons) */
.zm-tools { display: flex; gap: 2px; padding: 3px; border-radius: 999px; background: rgba(255, 253, 247, 0.16); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.zm-tools button { min-width: 44px; height: 38px; padding: 0 12px; border: none; border-radius: 999px; background: none; color: #fff; font: 700 19px/1 var(--sans, system-ui); cursor: pointer; -webkit-tap-highlight-color: transparent; }
.zm-tools button[data-zm="0"] { font-size: 13.5px; }
.zm-tools button:disabled { opacity: 0.35; cursor: default; }
@media (hover: hover) { .zm-tools button:not(:disabled):hover { background: rgba(255, 255, 255, 0.14); } }
@media (prefers-reduced-motion: reduce) { .zm, .zm-img { transition: none !important; } }
