/* ============== App mode tab bar ==============
 *
 * Only drawn in the Subsplash app (see assets/app-nav.js). Styled after the
 * app's own tab bar: white, a hairline on top, gray line icons with small
 * labels, the current one in black. Each tab opens a sheet of links that
 * slides up above the bar.
 *
 * The app's web view runs under the iPhone's home indicator but usually
 * reports no safe area, so the bar keeps a floor of space below its labels.
 *
 * Layers: above the page and its docked bars (the Daily Reading player is
 * 100), below pop-ups (the Joshua Initiative modal is 1000, Elementor's
 * are higher), so a pop-up covers the tab bar like any other page. */

.fan {
	--fan-ink: #111;
	--fan-soft: #8a8f93;
	--fan-line: #e3e5e6;
	--fan-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
	font-family: var(--fan-font);
	-webkit-tap-highlight-color: transparent;
}
.fan *,
.fan *::before,
.fan *::after { box-sizing: border-box; }

html.foundry-app-nav body { padding-bottom: var(--foundry-app-nav-h, 64px); }

.fan__bar {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 999;
	display: flex;
	padding: 0.45rem max(0.5rem, env(safe-area-inset-right, 0px)) max(env(safe-area-inset-bottom, 0px), 1.75rem) max(0.5rem, env(safe-area-inset-left, 0px));
	background: #fff;
	box-shadow: 0 -1px 0 var(--fan-line);
}

.fan .fan__tab {
	flex: 1 1 0;
	min-width: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.3rem;
	margin: 0;
	padding: 0.3rem 0.25rem;
	border: 0;
	border-radius: 0;
	background: none;
	box-shadow: none;
	color: var(--fan-soft);
	font: 500 0.72rem/1.1 var(--fan-font);
	letter-spacing: 0.01em;
	text-transform: none;
	cursor: pointer;
}
.fan .fan__tab:hover,
.fan .fan__tab:focus,
.fan .fan__tab:active {
	border: 0;
	outline: none;
	background: none;
	box-shadow: none;
	color: var(--fan-soft);
}
.fan .fan__tab.is-current,
.fan .fan__tab[aria-expanded="true"] { color: var(--fan-ink); }
.fan .fan__tab.is-current:focus,
.fan .fan__tab[aria-expanded="true"]:focus { color: var(--fan-ink); }
.fan .fan__tab:focus-visible {
	outline: 2px solid #80b0b4;
	outline-offset: -2px;
	border-radius: 8px;
}
.fan__icon { display: block; flex: none; width: 26px; height: 26px; }
.fan__label {
	max-width: 100%;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.fan__backdrop {
	position: fixed;
	inset: 0;
	z-index: 997;
	background: rgba(0, 0, 0, 0.35);
	animation: fan-fade 0.18s ease-out;
}
.fan__backdrop[hidden],
.fan__sheet[hidden] { display: none; }

.fan__sheet {
	position: fixed;
	left: 0;
	right: 0;
	bottom: var(--foundry-app-nav-h, 64px);
	z-index: 998;
	max-height: calc(100vh - var(--foundry-app-nav-h, 64px) - 4rem);
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 1.1rem max(1.25rem, env(safe-area-inset-right, 0px)) 0.5rem max(1.25rem, env(safe-area-inset-left, 0px));
	background: #fff;
	border-radius: 16px 16px 0 0;
	box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.12);
	animation: fan-up 0.2s ease-out;
}
.fan .fan__sheet-title {
	margin: 0 0 0.35rem;
	color: var(--fan-ink);
	font: 700 1.35rem/1.2 var(--fan-font);
}
.fan .fan__links {
	list-style: none;
	margin: 0;
	padding: 0;
}
.fan .fan__links li { margin: 0; padding: 0; }
.fan .fan__links li + li { border-top: 1px solid var(--fan-line); }
.fan .fan__link {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding: 0.95rem 0;
	color: var(--fan-ink);
	font: 600 1.05rem/1.3 var(--fan-font);
	text-decoration: none;
}
.fan .fan__link:hover,
.fan .fan__link:focus { color: var(--fan-ink); text-decoration: none; }
.fan .fan__link--sub {
	padding-left: 1rem;
	color: #4a5154;
	font-weight: 500;
	font-size: 0.98rem;
}
.fan .fan__link.is-current { color: #576669; }
.fan .fan__link.is-current span::after {
	content: "";
	display: inline-block;
	width: 6px;
	height: 6px;
	margin-left: 0.5rem;
	vertical-align: middle;
	border-radius: 50%;
	background: #80b0b4;
}
.fan__chevron { flex: none; color: #b5babd; }

@keyframes fan-up {
	from { transform: translateY(16px); opacity: 0; }
	to { transform: none; opacity: 1; }
}
@keyframes fan-fade {
	from { opacity: 0; }
	to { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
	.fan__sheet,
	.fan__backdrop { animation: none; }
}
