/* Okavango Business Directory — front-end styles */

/*
 * --okbd-accent / --okbd-dark / --okbd-on-dark / --okbd-card-bg are the
 * four colours exposed in Appearance > Customize > Business Directory
 * Colours. PHP prints the saved values as an inline style on this same
 * element (see OKBD_Customizer::inline_style()), which overrides the
 * fallback defaults below — those defaults only apply if that inline
 * style is ever missing (e.g. this file loaded standalone for testing).
 */
.okbd-directory {
	--okbd-accent: #C9922B;
	--okbd-dark: #111111;
	--okbd-on-dark: #ffffff;
	--okbd-card-bg: #f2f2f2;
	--okbd-ink: #1a1a1a;
	--okbd-grey-border: #d9d9d9;
	--okbd-grey-text: #6b6b6b;
	box-sizing: border-box;
}

.okbd-directory *,
.okbd-directory *::before,
.okbd-directory *::after {
	box-sizing: inherit;
}

.okbd-pill {
	font-family: inherit;
	font-size: 13px;
	font-weight: 600;
	line-height: 1;
	cursor: pointer;
	background: #fff;
	color: var(--okbd-ink);
	border: 1px solid var(--okbd-grey-border);
	border-radius: 4px;
	padding: 10px 12px;
	transition: background .2s ease, color .2s ease, border-color .2s ease, transform .1s ease;
}

.okbd-pill:hover {
	border-color: var(--okbd-dark);
}

.okbd-pill:active {
	transform: scale(.96);
}

.okbd-pill:focus-visible {
	outline: 2px solid var(--okbd-accent);
	outline-offset: 2px;
}

.okbd-pill.is-active {
	background: var(--okbd-dark);
	color: var(--okbd-on-dark);
	border-color: var(--okbd-dark);
}

/* ---------- Counter + category pills ---------- */
.okbd-toolbar {
	margin: 0 0 24px;
}

.okbd-counter {
	font-size: 14px;
	color: var(--okbd-grey-text);
	margin: 0 0 12px;
}

.okbd-categories {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
}

.okbd-pill--cat {
	background: var(--okbd-card-bg);
	border-color: var(--okbd-grey-border);
	border-radius: 999px;
	padding: 9px 16px;
}

.okbd-pill--overflow {
	display: none;
}

.okbd-categories--expanded .okbd-pill--overflow {
	display: inline-block;
	animation: okbd-pill-in .25s ease both;
}

.okbd-pill--viewall {
	background: transparent;
	border-style: dashed;
	color: var(--okbd-ink);
	border-radius: 999px;
	font-weight: 700;
	letter-spacing: .02em;
}

/* ---------- Grid ---------- */
.okbd-grid-wrap {
	position: relative;
	min-height: 120px;
}

.okbd-grid-wrap.is-loading {
	pointer-events: none;
}

.okbd-grid-wrap.is-loading .okbd-grid {
	opacity: .35;
	filter: saturate(.7);
	transition: opacity .2s ease, filter .2s ease;
}

/* Small spinner shown centred over the grid while an AJAX filter request
   is in flight. Colours track the same Customizer-driven variables as
   everything else. */
.okbd-grid-wrap.is-loading::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 34px;
	height: 34px;
	margin: -17px 0 0 -17px;
	border: 3px solid var(--okbd-card-bg);
	border-top-color: var(--okbd-accent);
	border-radius: 50%;
	animation: okbd-spin .7s linear infinite;
}

.okbd-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 24px;
	margin: 0;
	padding: 0;
	align-items: stretch;
}

@media (max-width: 1024px) {
	.okbd-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 600px) {
	.okbd-grid {
		grid-template-columns: 1fr;
	}
}

.okbd-empty {
	grid-column: 1 / -1;
	color: var(--okbd-grey-text);
	padding: 48px 0;
	text-align: center;
	font-size: 15px;
}

/* ---------- Card ---------- */
/* Display-only: no link to a single business page — this is a basic
   directory. The card is still a flex column stretched to the grid row's
   full height (align-items: stretch is the grid default) — .okbd-card__inner
   and .okbd-card__body flex to fill that height too, so shorter cards don't
   leave a gap of the article's own background showing beneath them. */
.okbd-card {
	list-style: none;
	display: flex;
	flex-direction: column;
	height: 100%;
	border-radius: 10px;
	overflow: hidden;
	box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
	background: var(--okbd-card-bg);
	animation: okbd-card-in .45s cubic-bezier(.22, .8, .32, 1) both;
	animation-delay: calc(var(--okbd-i, 0) * 45ms);
	transition: box-shadow .2s ease, transform .2s ease;
}

.okbd-card:hover {
	box-shadow: 0 10px 24px rgba(0, 0, 0, .12);
	transform: translateY(-3px);
}

.okbd-card__inner {
	display: flex;
	flex-direction: column;
	flex: 1;
	color: inherit;
}

.okbd-card__header {
	background: var(--okbd-dark);
	background-image: linear-gradient(160deg, rgba(255, 255, 255, .08), rgba(0, 0, 0, .1));
	height: 140px;
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
}

.okbd-card__header img {
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
}

.okbd-card__initial {
	width: 56px;
	height: 56px;
	border-radius: 50%;
	background: var(--okbd-accent);
	color: var(--okbd-dark);
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 700;
	font-size: 22px;
	box-shadow: 0 3px 8px rgba(0, 0, 0, .18);
}

.okbd-card__body {
	background: var(--okbd-card-bg);
	padding: 16px 18px 20px;
	flex: 1;
	display: flex;
	flex-direction: column;
}

.okbd-card__title {
	font-size: 17px;
	font-weight: 700;
	margin: 0 0 6px;
	color: var(--okbd-ink);
	line-height: 1.3;
}

.okbd-card__meta {
	font-size: 13px;
	color: var(--okbd-grey-text);
	margin: 0;
}

.okbd-card__phone {
	color: inherit;
	text-decoration: none;
	transition: color .15s ease;
}

.okbd-card__phone:hover,
.okbd-card__phone:focus-visible {
	color: var(--okbd-accent);
	text-decoration: underline;
}

.okbd-card__website {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding-top: 10px;
	/* Pinned to the bottom of the flex column so it lines up across a row
	   of cards even when titles/meta run to different lengths. */
	margin-top: auto;
	font-size: 13px;
	font-weight: 600;
	color: var(--okbd-accent);
	text-decoration: none;
	transition: opacity .15s ease;
}

.okbd-card__website:hover,
.okbd-card__website:focus-visible {
	opacity: .75;
	text-decoration: underline;
}

.okbd-card__website span[aria-hidden] {
	transition: transform .15s ease;
	display: inline-block;
}

.okbd-card__website:hover span[aria-hidden] {
	transform: translate(2px, -2px);
}

/* Fallback in case the active theme doesn't already define this standard
   WordPress utility class — keeps "(opens in a new tab)" audible to screen
   readers without showing it visually. */
.okbd-directory .screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ---------- Animations ---------- */
@keyframes okbd-card-in {
	from {
		opacity: 0;
		transform: translateY(12px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@keyframes okbd-pill-in {
	from {
		opacity: 0;
		transform: translateY(-4px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@keyframes okbd-spin {
	to {
		transform: rotate(360deg);
	}
}

/* Respect the visitor's OS-level motion preference: keep every colour/
   layout change instant rather than animated, and drop the one looping
   animation (the loading spinner) entirely. */
@media (prefers-reduced-motion: reduce) {
	.okbd-card,
	.okbd-pill--overflow,
	.okbd-grid-wrap.is-loading::after {
		animation: none !important;
	}

	.okbd-card,
	.okbd-pill,
	.okbd-card__phone,
	.okbd-card__website,
	.okbd-card__website span[aria-hidden],
	.okbd-grid-wrap.is-loading .okbd-grid {
		transition: none !important;
	}
}
