/**
 * OCD Anxiety Centers — Locations Directory styles.
 * All selectors are namespaced under .ocda-dir to coexist with the Location
 * Finder plugin (which uses the .lf- prefix) on the same page.
 */

.ocda-dir {
	--ocda-primary: #557085;
	--ocda-primary-hover: #45606f;
	--ocda-accent: #D4B896;
	--ocda-soft: #ACC1C9;
	--ocda-bg: #ffffff;
	--ocda-bg-soft: #f6f8f9;
	--ocda-border: #e5e7eb;
	--ocda-text: #2a2a2a;
	--ocda-text-muted: #5a5a5a;
	--ocda-radius: 10px;
	--ocda-radius-sm: 6px;
	--ocda-radius-pill: 999px;
	--ocda-focus-ring: 0 0 0 3px rgba(85,112,133,0.35);
	--ocda-scroll-offset: 110px;
	max-width: 1100px;
	margin: 0 auto;
	padding: 1.5rem;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	color: var(--ocda-text);
}

.ocda-dir-intro { max-width: 760px; margin: 0 auto 2rem; text-align: center; }
.ocda-dir-intro p { font-size: 1.05rem; color: var(--ocda-text-muted); line-height: 1.6; margin: 0; }

.ocda-dir-nav {
	position: relative;
	z-index: 50;
	background: rgba(255,255,255,0.96);
	padding: 1rem 0;
	margin: 0 -1.5rem 2.5rem;
	border-bottom: 1px solid var(--ocda-border);
}
.ocda-dir-nav-desktop {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	justify-content: center;
	padding: 0 1.5rem;
	max-width: 1100px;
	margin: 0 auto;
	/* When the chip count meets or exceeds the admin-configured threshold,
	 * PHP swaps in the dropdown layout (.ocda-dir-nav-dropdown-mode). */
}

/* Dropdown mode: PHP forced the dropdown layout because state count exceeded
 * the admin-configured threshold. Hide the chip block at every viewport width
 * and reveal the dropdown wrapper that's normally only shown on mobile. */
.ocda-dir-nav-dropdown-mode .ocda-dir-nav-desktop { display: none; }
.ocda-dir-nav-dropdown-mode .ocda-dir-nav-mobile {
	display: block;
	padding: 0 1.5rem;
	max-width: 600px;
	margin: 0 auto;
}
.ocda-dir-nav-mobile { display: none; padding: 0 1.5rem; max-width: 600px; margin: 0 auto; }
.ocda-dir-select-wrap { position: relative; width: 100%; }
.ocda-dir-select-label {
	display: block;
	font-size: 0.8rem;
	font-weight: 600;
	color: var(--ocda-primary);
	text-transform: uppercase;
	letter-spacing: 0.05em;
	margin-bottom: 0.4rem;
}
.ocda-dir-select {
	width: 100%;
	min-height: 52px;
	padding: 0.75rem 2.75rem 0.75rem 1.1rem;
	background: var(--ocda-bg);
	color: var(--ocda-text);
	border: 2px solid var(--ocda-primary);
	border-radius: var(--ocda-radius);
	font-size: 1rem;
	font-weight: 600;
	font-family: inherit;
	cursor: pointer;
	appearance: none;
	-webkit-appearance: none;
	-moz-appearance: none;
}
.ocda-dir-select:focus-visible { outline: none; box-shadow: var(--ocda-focus-ring); }
.ocda-dir-select-arrow { position: absolute; right: 1rem; bottom: 18px; pointer-events: none; color: var(--ocda-primary); }

.ocda-dir-chip {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	min-height: 44px;
	padding: 0.5rem 1.1rem;
	background: #f3f4f6;
	color: var(--ocda-primary);
	border: 2px solid transparent;
	border-radius: var(--ocda-radius-pill);
	font-size: 0.95rem;
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
	transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.ocda-dir-chip:hover { background: var(--ocda-soft); color: #ffffff; }
.ocda-dir-chip:focus-visible { outline: none; border-color: var(--ocda-primary); box-shadow: var(--ocda-focus-ring); }
.ocda-dir-chip-count {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 22px;
	height: 22px;
	padding: 0 0.4rem;
	background: rgba(85,112,133,0.15);
	color: var(--ocda-primary);
	border-radius: var(--ocda-radius-pill);
	font-size: 0.75rem;
	font-weight: 700;
}
.ocda-dir-chip:hover .ocda-dir-chip-count { background: rgba(255,255,255,0.25); color: #ffffff; }
.ocda-dir-chip-virtual { background: rgba(212,184,150,0.18); color: #8a6d3b; }
.ocda-dir-chip-virtual:hover { background: var(--ocda-accent); color: #2a2a2a; }
.ocda-dir-chip-virtual .ocda-dir-chip-count { background: rgba(138,109,59,0.18); color: #8a6d3b; }
.ocda-dir-chip-virtual:hover .ocda-dir-chip-count { background: rgba(42,42,42,0.15); color: #2a2a2a; }

.ocda-dir-section { padding: 2rem 0 1rem; scroll-margin-top: var(--ocda-scroll-offset); }
.ocda-dir-section + .ocda-dir-section { border-top: 1px solid #f0f0f0; }
.ocda-dir-section-header { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
/* When a virtual IOP badge is shown, stack the heading and badge row vertically.
 * The heading gets its own line; the badge sits on a second line with the
 * gradient accent extending out to the right edge. */
.ocda-dir-section-header-with-badge {
	flex-direction: column;
	align-items: stretch;
	gap: 0.6rem;
}
.ocda-dir-section-header-with-badge .ocda-dir-state-name { line-height: 1.1; }
.ocda-dir-badge-row {
	display: flex;
	align-items: center;
	gap: 1rem;
	flex-wrap: wrap;
}
.ocda-dir-state-name {
	font-size: 2rem;
	font-weight: 700;
	color: var(--ocda-primary);
	margin: 0;
	letter-spacing: -0.02em;
}
.ocda-dir-state-name:focus { outline: none; }
.ocda-dir-state-name:focus-visible { outline: none; }

/* When a state has a hub URL configured, its name becomes a link. The link is
 * visually identical to non-linked state names so the directory looks uniform.
 * Only the cursor and focus outline reveal that it's interactive. */
.ocda-dir-state-hub-link,
.ocda-dir-state-hub-link:link,
.ocda-dir-state-hub-link:visited,
.ocda-dir-state-hub-link:hover,
.ocda-dir-state-hub-link:active {
	color: inherit;
	text-decoration: none;
	background: none;
	border: none;
}
.ocda-dir-state-hub-link:focus-visible {
	outline: 2px solid var(--ocda-primary);
	outline-offset: 4px;
	border-radius: 2px;
}

.ocda-dir-virtual-badge {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	padding: 0.3rem 0.7rem;
	background: rgba(212,184,150,0.18);
	color: #8a6d3b;
	border: 1px solid rgba(212,184,150,0.6);
	border-radius: var(--ocda-radius-pill);
	font-size: 0.78rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	text-decoration: none;
	transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
	min-height: 28px;
}
.ocda-dir-virtual-badge:hover { background: var(--ocda-accent); color: #2a2a2a; border-color: var(--ocda-accent); }
.ocda-dir-virtual-badge:focus-visible { outline: 2px solid var(--ocda-primary); outline-offset: 2px; }
.ocda-dir-virtual-badge svg { width: 12px; height: 12px; }

.ocda-dir-state-accent {
	flex: 1;
	min-width: 40px;
	height: 3px;
	background: linear-gradient(to right, var(--ocda-accent) 0%, transparent 100%);
	border-radius: 2px;
}

.ocda-dir-virtual-section {
	padding: 2.5rem 0 1rem;
	scroll-margin-top: var(--ocda-scroll-offset);
	border-top: 2px solid var(--ocda-accent);
	margin-top: 2rem;
}
.ocda-dir-virtual-section-intro {
	font-size: 1rem;
	color: var(--ocda-text-muted);
	margin: 0 0 1.5rem;
	line-height: 1.6;
}
.ocda-dir-virtual-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap: 0.75rem;
	list-style: none;
	padding: 0;
	margin: 0;
}
.ocda-dir-virtual-card {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	background: var(--ocda-bg);
	border: 1px solid var(--ocda-border);
	border-left: 4px solid var(--ocda-accent);
	border-radius: var(--ocda-radius-sm);
	padding: 1rem 1.15rem;
	transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
	min-height: 44px;
}
.ocda-dir-virtual-card:hover {
	transform: translateY(-1px);
	box-shadow: 0 4px 12px rgba(85,112,133,0.1);
	border-color: var(--ocda-soft);
	border-left-color: var(--ocda-accent);
}
.ocda-dir-virtual-card-link {
	position: absolute;
	inset: 0;
	z-index: 1;
	border-radius: var(--ocda-radius-sm);
}
.ocda-dir-virtual-card-link:focus-visible { outline: 3px solid var(--ocda-primary); outline-offset: -3px; }
.ocda-dir-virtual-state { font-size: 1rem; font-weight: 700; color: var(--ocda-text); position: relative; z-index: 2; pointer-events: none; }
.ocda-dir-virtual-arrow { position: relative; z-index: 2; pointer-events: none; color: var(--ocda-primary); flex-shrink: 0; }
.ocda-dir-virtual-arrow svg { width: 18px; height: 18px; display: block; }

.ocda-dir-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
	gap: 1rem;
	list-style: none;
	padding: 0;
	margin: 0;
}
.ocda-dir-card {
	position: relative;
	display: flex;
	flex-direction: column;
	background: var(--ocda-bg);
	border: 1px solid var(--ocda-border);
	border-radius: var(--ocda-radius);
	padding: 1.5rem 1.5rem 1.5rem 1.75rem;
	transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
	overflow: hidden;
}
.ocda-dir-card::before {
	content: "";
	position: absolute;
	left: 0;
	top: 0;
	bottom: 0;
	width: 4px;
	background: var(--ocda-primary);
	transition: width 0.2s ease;
	z-index: 1;
}
.ocda-dir-card:hover {
	transform: translateY(-2px);
	box-shadow: 0 8px 24px rgba(85,112,133,0.12);
	border-color: var(--ocda-soft);
}
.ocda-dir-card:hover::before { width: 6px; }

.ocda-dir-sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0,0,0,0);
	white-space: nowrap;
	border: 0;
}

.ocda-dir-card-link {
	position: absolute;
	inset: 0;
	z-index: 1;
	border-radius: var(--ocda-radius);
}
.ocda-dir-card-link:focus-visible { outline: 3px solid var(--ocda-primary); outline-offset: -3px; }

.ocda-dir-card-city { margin: 0 0 0.5rem; font-size: 1.25rem; font-weight: 700; letter-spacing: -0.01em; color: var(--ocda-text); position: relative; z-index: 2; pointer-events: none; }
.ocda-dir-card-address { margin: 0 0 1.15rem; font-size: 0.92rem; color: var(--ocda-text-muted); line-height: 1.5; position: relative; z-index: 2; pointer-events: none; }
.ocda-dir-card-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 0.5rem; margin-top: auto; padding-top: 0.25rem; position: relative; z-index: 3; }

.ocda-dir-btn {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	min-height: 44px;
	padding: 0.5rem 0.9rem;
	text-decoration: none;
	font-weight: 600;
	font-size: 0.92rem;
	border-radius: var(--ocda-radius-sm);
	border: 1px solid var(--ocda-border);
	transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
	position: relative;
}
.ocda-dir-btn svg { width: 14px; height: 14px; flex-shrink: 0; }
.ocda-dir-btn-phone { background: var(--ocda-bg-soft); color: var(--ocda-primary); }
.ocda-dir-btn-phone:hover { background: var(--ocda-primary); color: #ffffff; border-color: var(--ocda-primary); }
.ocda-dir-btn-details { background: var(--ocda-primary); color: #ffffff; border-color: var(--ocda-primary); }
.ocda-dir-btn-details:hover { background: var(--ocda-primary-hover); border-color: var(--ocda-primary-hover); }
.ocda-dir-btn:focus-visible { outline: 2px solid var(--ocda-primary); outline-offset: 2px; }

/* Back-to-top button — fixed to viewport corner, shown after scrolling past nav.
 * Uses transform/opacity transitions so it can fade in without layout thrash.
 *
 * Vertical offset bumped to clear Safari iOS bottom URL bar. env(safe-area-inset-bottom)
 * adds whatever iOS reserves for the home indicator area; we add ~2rem on top of that.
 * On desktops env() resolves to 0 so the base 2rem applies. */
.ocda-dir-back-to-top {
	position: fixed;
	bottom: calc(2rem + env(safe-area-inset-bottom, 0px));
	/* Z-index set to the CSS max integer (2^31 - 1). Divi's footer and various
	 * theme/plugin chrome can use values above 999999, so we go all-in here.
	 * The button is also moved to <body> in JS to escape transformed ancestor
	 * containing blocks that would otherwise trap position: fixed. */
	z-index: 2147483647;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	padding: 0;
	background: var(--ocda-primary);
	color: #ffffff;
	border: none;
	border-radius: 50%;
	box-shadow: 0 4px 12px rgba(0,0,0,0.18);
	cursor: pointer;
	opacity: 0;
	transform: translateY(8px);
	transition: opacity 0.2s ease, transform 0.2s ease, background 0.15s ease;
}
.ocda-dir-back-to-top-right { right: 1.5rem; }
.ocda-dir-back-to-top-left  { left: 1.5rem; }
.ocda-dir-back-to-top:hover { background: var(--ocda-primary-hover); }
.ocda-dir-back-to-top:focus-visible { outline: 3px solid var(--ocda-accent); outline-offset: 2px; }
.ocda-dir-back-to-top svg { width: 22px; height: 22px; display: block; }
.ocda-dir-back-to-top[hidden] { display: none !important; }
.ocda-dir-back-to-top-visible { opacity: 1; transform: translateY(0); }

/* Tablet: jump-to-section uses tablet-specific scroll offset. */
@media (min-width: 769px) and (max-width: 1024px) {
	.ocda-dir-section,
	.ocda-dir-virtual-section { scroll-margin-top: var(--ocda-scroll-offset-tablet); }
}

@media (max-width: 768px) {
	.ocda-dir { padding: 1rem; }
	.ocda-dir-nav { margin: 0 -1rem 1.5rem; padding: 0.75rem 0; }
	.ocda-dir-nav-desktop { display: none; }
	.ocda-dir-nav-mobile { display: block; padding: 0 1rem; }
	.ocda-dir-state-name { font-size: 1.6rem; }
	.ocda-dir-grid { grid-template-columns: 1fr; }
	.ocda-dir-card { padding: 1.15rem 1.15rem 1.15rem 1.4rem; }
	.ocda-dir-section,
	.ocda-dir-virtual-section { scroll-margin-top: var(--ocda-scroll-offset-mobile); }
	.ocda-dir-back-to-top { bottom: calc(1.75rem + env(safe-area-inset-bottom, 0px)); width: 44px; height: 44px; }
	.ocda-dir-back-to-top-right { right: 1rem; }
	.ocda-dir-back-to-top-left  { left: 1rem; }
	.ocda-dir-back-to-top svg { width: 20px; height: 20px; }
}

@media (prefers-reduced-motion: reduce) {
	.ocda-dir-card,
	.ocda-dir-card::before,
	.ocda-dir-btn,
	.ocda-dir-chip,
	.ocda-dir-back-to-top { transition: none; }
	.ocda-dir-card:hover { transform: none; }
	.ocda-dir-back-to-top { transform: none; }
}
