/* Split view: index aside = 50% width, hero = 50% (below fixed header) */

#directory-slide-overlay {
	position: fixed;
	left: 0;
	right: 0;
	top: 75px;
	bottom: 0;
	z-index: 1;
	background: #fff;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.35s ease, visibility 0.35s ease;
	pointer-events: none;
}

body.is-directory-slide #directory-slide-overlay {
	opacity: 1;
	visibility: visible;
}

body.is-directory-slide #pattern {
	opacity: 0;
	pointer-events: none;
}

.directory-slide {
	display: flex;
	width: 100%;
	height: 100%;
	min-height: 0;
}

/* Index: exactly half the section */
aside.directory-index {
	flex: 0 0 50%;
	width: 50%;
	max-width: none;
	min-width: 0;
	background-color: #eae8e4;
	background-image: url("../images/wheat1.jpg");
	background-size: cover;
	background-position: center center;
	background-repeat: no-repeat;
	color: #000;
	border-right: 1px solid #000;
	display: flex;
	flex-direction: column;
	padding: 22px 18px 16px 20px;
	box-sizing: border-box;
	overflow: hidden;
	pointer-events: auto;
}

.directory-index-header {
	text-align: center;
	margin-bottom: 14px;
	padding-bottom: 10px;
	border-bottom: 1px solid #000;
	min-height: 88px;
}

.directory-index-meta {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	font-family: Georgia, "Times New Roman", Times, serif;
	font-size: 9px;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	margin-bottom: 8px;
}

.directory-index-title-wrap {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
}

/* Wrapper for typewriter title (see css/td-typewriter.css) */
.directory-index-kicker {
	display: inline-block;
	margin: 0;
	padding: 0;
}

.directory-index-title {
	font-family: Georgia, "Times New Roman", Times, serif;
	font-size: clamp(20px, 2.8vw, 32px);
	line-height: 0.95;
	letter-spacing: -0.04em;
	font-weight: 700;
	text-transform: uppercase;
	margin: 0;
	padding: 0 8px;
	color: #8b1538;
}

.directory-index-nav {
	flex-shrink: 0;
	padding: 0 6px;
	border-bottom: 1px solid #000;
	position: relative;
}

.directory-index-filter-bar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 10px 12px;
	padding: 8px 0 10px;
}

.directory-index-filter-trigger {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-family: "BebasNeueRegular", Impact, "Arial Narrow", sans-serif;
	font-size: clamp(12px, 2vw, 16px);
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: #000;
	background: transparent;
	border: 1px solid #000;
	padding: 8px 14px 10px;
	cursor: pointer;
	line-height: 1;
	transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.directory-index-filter-trigger:hover,
.directory-index-filter-trigger:focus {
	color: #8b1538;
	border-color: #8b1538;
	outline: none;
}

.directory-index-filter-icon {
	display: flex;
	color: currentColor;
}

.directory-index-filter-status {
	display: flex;
	align-items: center;
	gap: 6px;
	min-width: 0;
	flex: 1;
	justify-content: flex-end;
}

.directory-index-filter-status-text {
	font-family: Georgia, "Times New Roman", Times, serif;
	font-size: 11px;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: #444;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.directory-index-filter-clear {
	font-family: Georgia, "Times New Roman", Times, serif;
	font-size: 18px;
	line-height: 1;
	width: 28px;
	height: 28px;
	padding: 0;
	border: 1px solid #000;
	background: #fff;
	color: #000;
	cursor: pointer;
	flex-shrink: 0;
	transition: color 0.2s ease, border-color 0.2s ease;
}

.directory-index-filter-clear:hover,
.directory-index-filter-clear:focus {
	color: #8b1538;
	border-color: #8b1538;
	outline: none;
}

/* Full-height panel over the index column only (fixed below site header) */
.directory-index-filter-panel {
	position: fixed;
	left: 0;
	top: 75px;
	width: 50%;
	bottom: 0;
	/* Above #footer (11900), below #header (12000) */
	z-index: 11980;
	display: flex;
	align-items: stretch;
	justify-content: center;
	pointer-events: none;
	visibility: hidden;
	opacity: 0;
	transition: opacity 0.3s ease, visibility 0.3s ease;
}

.directory-index-filter-panel.is-open {
	pointer-events: auto;
	visibility: visible;
	opacity: 1;
}

.directory-index-filter-backdrop {
	position: absolute;
	inset: 0;
	background-color: #eae8e4;
	background-image: url("../images/wheat1.jpg");
	background-size: cover;
	background-position: center center;
	background-repeat: no-repeat;
	cursor: pointer;
}

.directory-index-filter-dialog {
	position: relative;
	z-index: 1;
	width: 100%;
	max-width: 360px;
	margin: auto 0;
	padding: 20px 18px 28px;
	box-sizing: border-box;
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
}

.directory-index-filter-close {
	position: absolute;
	top: 8px;
	right: 10px;
	width: 36px;
	height: 36px;
	font-size: 22px;
	line-height: 1;
	padding: 0;
	border: none;
	background: transparent;
	color: #000;
	cursor: pointer;
	transition: color 0.2s ease;
}

.directory-index-filter-close:hover,
.directory-index-filter-close:focus {
	color: #8b1538;
	outline: none;
}

.directory-index-filter-dialog-title {
	font-family: Georgia, "Times New Roman", Times, serif;
	font-size: clamp(16px, 2.2vw, 20px);
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	margin: 0 32px 8px 0;
	padding: 0;
	color: #000;
}

.directory-index-filter-dialog-sub {
	font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
	font-size: 12px;
	line-height: 1.35;
	color: #555;
	margin: 0 0 18px;
	max-width: 280px;
}

.directory-index-rolodex {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	width: 100%;
	margin-bottom: 22px;
}

.directory-index-rolodex-arrow {
	flex-shrink: 0;
	width: 40px;
	height: 40px;
	font-size: 18px;
	line-height: 1;
	padding: 0;
	border: 1px solid #000;
	background: #fff;
	color: #000;
	cursor: pointer;
	border-radius: 2px;
	transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.directory-index-rolodex-arrow:hover,
.directory-index-rolodex-arrow:focus {
	color: #8b1538;
	border-color: #8b1538;
	outline: none;
}

.directory-index-rolodex-stage {
	flex: 1;
	min-width: 0;
	max-width: 260px;
	perspective: 1100px;
	perspective-origin: 50% 50%;
}

.directory-index-rolodex-card {
	position: relative;
	min-height: 120px;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px 14px;
	box-sizing: border-box;
	border: 2px solid #000;
	background: #fff;
	box-shadow: 4px 6px 0 rgba(0, 0, 0, 0.08);
	transform-origin: 50% 50%;
	transform: rotateX(0deg);
	opacity: 1;
	transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
	transform-style: preserve-3d;
	backface-visibility: hidden;
}

.directory-index-rolodex-card.is-rolodex-out-next {
	transform: rotateX(-88deg);
	opacity: 0.25;
}

.directory-index-rolodex-card.is-rolodex-out-prev {
	transform: rotateX(88deg);
	opacity: 0.25;
}

.directory-index-rolodex-card.is-rolodex-in-next {
	transition: none;
	transform: rotateX(88deg);
	opacity: 0.25;
}

.directory-index-rolodex-card.is-rolodex-in-prev {
	transition: none;
	transform: rotateX(-88deg);
	opacity: 0.25;
}

/* Match index tabs: Bebas + white strike through text */
.directory-index-rolodex-label {
	position: relative;
	font-family: "BebasNeueRegular", Impact, "Arial Narrow", sans-serif;
	font-size: clamp(15px, 2.8vw, 22px);
	letter-spacing: 0.08em;
	text-transform: uppercase;
	font-weight: normal;
	color: #000;
	line-height: 1.1;
	z-index: 0;
}

.directory-index-rolodex-label::after {
	content: "";
	position: absolute;
	left: 0.04em;
	right: 0.04em;
	top: 50%;
	height: 0.08em;
	margin-top: -0.04em;
	background: #fff;
	pointer-events: none;
	z-index: 1;
}

.directory-index-filter-actions {
	display: flex;
	flex-direction: column;
	gap: 10px;
	width: 100%;
	max-width: 260px;
}

.directory-index-filter-apply,
.directory-index-filter-all {
	font-family: "BebasNeueRegular", Impact, "Arial Narrow", sans-serif;
	font-size: clamp(12px, 2vw, 15px);
	letter-spacing: 0.08em;
	text-transform: uppercase;
	padding: 12px 16px;
	cursor: pointer;
	border: 2px solid #000;
	background: #fff;
	color: #000;
	transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.directory-index-filter-apply {
	background: #000;
	color: #fff;
	border-color: #000;
}

.directory-index-filter-apply:hover,
.directory-index-filter-apply:focus {
	background: #8b1538;
	border-color: #8b1538;
	color: #fff;
	outline: none;
}

.directory-index-filter-all:hover,
.directory-index-filter-all:focus {
	color: #8b1538;
	border-color: #8b1538;
	outline: none;
}

.directory-index-rows {
	flex: 1;
	overflow-y: auto;
	overflow-x: hidden;
	margin: 0;
	padding: 0;
	list-style: none;
	-webkit-overflow-scrolling: touch;
}

.directory-index-rows li {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 12px;
	border-bottom: 1px solid #000;
	padding: 10px 0 9px 0;
	font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
	font-size: 12px;
	line-height: 1.25;
}

.directory-index-rows .dir-name {
	font-weight: 600;
	text-align: left;
	flex: 1;
	min-width: 0;
	color: #000;
}

.directory-index-rows a.dir-name {
	text-decoration: none;
	display: block;
}

.directory-index-rows a.dir-name:hover {
	text-decoration: underline;
	color: #8b1538;
}

.directory-index-rows .dir-num {
	font-weight: 800;
	font-size: 18px;
	line-height: 1;
	letter-spacing: -0.03em;
	flex: 0 0 auto;
	color: #000;
}

.directory-index-rows li.directory-index-empty {
	display: none;
	justify-content: center;
	align-items: center;
	text-align: center;
	font-family: Georgia, "Times New Roman", Times, serif;
	font-size: 11px;
	color: #666;
	padding: 20px 12px;
	border-bottom: none;
}

.directory-index-rows li.directory-index-empty.is-visible {
	display: flex;
}

.directory-index-footer {
	text-align: center;
	font-family: Georgia, "Times New Roman", Times, serif;
	font-size: 22px;
	font-weight: 700;
	padding-top: 10px;
	margin-top: auto;
	border-top: 1px solid #000;
	color: #000;
}

/* Hero: other half */
.directory-hero {
	flex: 0 0 50%;
	width: 50%;
	min-width: 0;
	position: relative;
	background: #c5ccd4;
	pointer-events: none;
}

.directory-hero-img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center 20%;
	display: block;
}

.directory-hero-caption {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 28px;
	margin: 0;
	text-align: center;
	font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
	font-size: clamp(28px, 4.5vw, 56px);
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: #fff;
	text-shadow: 0 2px 24px rgba(0, 0, 0, 0.45);
	line-height: 1.05;
	pointer-events: none;
}

/* Phase 4 — index + hero: calmer split on phones, safe areas, readable tabs, tappable rows */
@media (max-width: 900px) {
	.directory-slide {
		flex-direction: column;
		min-height: 0;
	}

	aside.directory-index {
		flex: 0 0 auto;
		width: 100%;
		max-width: 100%;
		/* Share viewport with fixed header/footer + hero; cap so list scrolls inside aside */
		max-height: min(58vh, calc(100vh - 75px - 124px - 180px));
		border-right: none;
		border-bottom: 1px solid #000;
		padding-top: max(12px, env(safe-area-inset-top, 0px));
		padding-right: max(12px, env(safe-area-inset-right, 0px));
		padding-bottom: 10px;
		padding-left: max(12px, env(safe-area-inset-left, 0px));
	}

	.directory-index-header {
		min-height: 0;
		margin-bottom: 10px;
		padding-bottom: 8px;
	}

	.directory-index-filter-panel {
		width: 100%;
	}

	.directory-index-filter-bar {
		padding: 10px 0 12px;
		gap: 8px 10px;
	}

	.directory-index-filter-trigger {
		min-height: 44px;
		padding: 10px 14px 10px;
		touch-action: manipulation;
	}

	.directory-index-rolodex-arrow {
		width: 44px;
		height: 44px;
		touch-action: manipulation;
	}

	.directory-index-filter-apply,
	.directory-index-filter-all {
		min-height: 44px;
		touch-action: manipulation;
	}

	.directory-index-rows li {
		align-items: center;
		min-height: 44px;
		padding-top: 12px;
		padding-bottom: 12px;
		box-sizing: border-box;
	}

	.directory-index-footer {
		padding-top: 8px;
		margin-top: 6px;
	}

	.directory-hero {
		flex: 1 1 auto;
		width: 100%;
		min-width: 0;
		min-height: clamp(160px, 28vh, 240px);
	}

	.directory-hero-caption {
		bottom: max(16px, calc(10px + env(safe-area-inset-bottom, 0px)));
		left: max(0px, env(safe-area-inset-left, 0px));
		right: max(0px, env(safe-area-inset-right, 0px));
		padding: 0 12px;
		box-sizing: border-box;
		font-size: clamp(22px, 5.5vw, 48px);
	}
}

/* Short viewports (e.g. landscape phone): give index a bit less vertical share */
@media (max-width: 900px) and (max-height: 620px) {
	aside.directory-index {
		max-height: min(46vh, calc(100vh - 75px - 124px - 140px));
	}

	.directory-hero {
		min-height: 140px;
	}
}

@supports (height: 100dvh) {
	@media (max-width: 900px) {
		aside.directory-index {
			max-height: min(58vh, calc(100dvh - 75px - 124px - 180px));
		}
	}

	@media (max-width: 900px) and (max-height: 620px) {
		aside.directory-index {
			max-height: min(46vh, calc(100dvh - 75px - 124px - 140px));
		}
	}
}

@media (prefers-reduced-motion: reduce) {
	#directory-slide-overlay {
		transition-duration: 0.12s;
	}

	.directory-index-filter-panel {
		transition-duration: 0.12s;
	}

	.directory-index-rolodex-card {
		transition-duration: 0.12s;
	}
}
