/* ==========================================================================
   COMPONENTS — the card system, buttons, badges, placeholder treatment.

   Three card types, three different aspect ratios, on purpose. See
   docs/design-reference.md before unifying them.
   ========================================================================== */

/* --- Shared card behaviour ------------------------------------------------
   Hover is asymmetric: quick to arrive, slow to leave. */

.kbia-tile,
.kbia-card {
	transition: transform var(--kbia-dur-slow) var(--kbia-ease-smooth);
	border-radius: var(--kbia-radius-lg);
	box-shadow: var(--kbia-shadow);
}

.kbia-tile:hover,
.kbia-card:hover {
	transform: scale(1.02);
	transition-duration: var(--kbia-dur);
}

.kbia-tile img,
.kbia-card img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: var(--kbia-radius-lg);
}

/* --- 1. Category tile — 16:11, title overlaid, accent rule beneath --------
   The signature component. The 8px rule under the title is the detail that
   makes the set read as a system; do not drop it. */

.kbia-tile {
	position: relative;
	display: block;
	overflow: hidden;
	aspect-ratio: var(--kbia-ratio-tile);
	/* A solid ground so a missing image degrades to a coloured tile rather
	   than a hole -- which matters here: 290 of 347 listings have no photo. */
	background: var(--kbia-blue-800);
	text-decoration: none;
}

.kbia-tile__scrim {
	position: absolute;
	inset: 0;
	background: var(--kbia-scrim);
	pointer-events: none;
}

.kbia-tile__body {
	position: absolute;
	inset-inline: 0;
	bottom: 0;
	z-index: 1;
	padding: 0 1.5rem 1.25rem;
}

.kbia-tile__title {
	margin: 0;
	padding-bottom: 0.25rem;
	border-bottom: var(--kbia-rule) solid var(--kbia-accent);
	color: #fff;
	font-size: var(--kbia-fs-h3);
	font-weight: 600;
}

.kbia-tile__count {
	display: block;
	margin-top: 0.5rem;
	color: rgb(255 255 255 / 78%);
	font-family: var(--kbia-font-mono);
	font-size: var(--kbia-fs-eyebrow);
	letter-spacing: var(--kbia-ls-eyebrow);
	text-transform: uppercase;
}

/* --- 2. Business card — 6:7 portrait, text below ------------------------- */

.kbia-card {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	text-decoration: none;
}

.kbia-card__media {
	position: relative;
	overflow: hidden;
	aspect-ratio: 1 / 1;
	border-radius: var(--kbia-radius-lg);
	background: var(--kbia-blue-800);
}

@media (min-width: 768px) {
	.kbia-card__media { aspect-ratio: var(--kbia-ratio-card); }
}

.kbia-card--event .kbia-card__media { aspect-ratio: var(--kbia-ratio-event); }
.kbia-card--person .kbia-card__media { aspect-ratio: var(--kbia-ratio-face); }

.kbia-card__eyebrow {
	color: var(--kbia-muted);
	font-family: var(--kbia-font-mono);
	font-size: var(--kbia-fs-eyebrow);
	font-weight: 500;
	letter-spacing: var(--kbia-ls-eyebrow);
	text-transform: uppercase;
}

.kbia-card__title {
	margin: 0;
	font-size: var(--kbia-fs-h3);
	font-weight: 700;
	transition: color var(--kbia-dur) var(--kbia-ease-out);
}

.kbia-card:hover .kbia-card__title { color: var(--kbia-accent); }

.kbia-card__summary {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	margin: 0;
	color: var(--kbia-body);
	line-height: var(--kbia-lh-loose);
}

/* Event date, in the mono/numeral face. */
.kbia-card__date {
	color: var(--kbia-muted);
	font-family: var(--kbia-font-mono);
	font-size: 1.0625rem;
	text-transform: uppercase;
}

/* "Date to be announced" in place of a real range. It holds the same line so
   the card keeps its baseline, but it is not a date and should not read with
   the same weight as one. */
.kbia-card__date--tba {
	font-style: italic;
	text-transform: none;
	letter-spacing: 0;
}

/* --- 3. Link idiom — an underline that wipes 0 -> 100% ------------------- */

.kbia-link {
	display: inline-flex;
	flex-direction: column;
	align-items: flex-start;
	color: var(--kbia-accent);
	font-weight: 700;
	text-decoration: none;
}

.kbia-link::after {
	content: "";
	display: block;
	width: 0;
	height: var(--kbia-underline);
	background: currentcolor;
	transition: width var(--kbia-dur) var(--kbia-ease-out);
}

.kbia-link:hover::after,
.kbia-card:hover .kbia-link::after,
.kbia-link:focus-visible::after { width: 100%; }

/* Arrow variant: the gap widens, sliding the arrow away from the label. */
.kbia-link--arrow {
	flex-direction: row;
	align-items: center;
	gap: 0.75rem;
	transition: gap var(--kbia-dur) var(--kbia-ease-out);
}

.kbia-link--arrow::after { display: none; }
.kbia-link--arrow:hover,
.kbia-card:hover .kbia-link--arrow { gap: 1rem; }

/* --- Buttons — softened, unshadowed -------------------------------------- */

.kbia-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	padding: 0.75rem 1.5rem;
	border: 0;
	border-radius: var(--kbia-radius);
	background: var(--kbia-accent);
	color: var(--kbia-on-accent);
	font-family: var(--kbia-font-body);
	font-size: var(--kbia-fs-body);
	font-weight: 600;
	text-decoration: none;
	white-space: nowrap;
	cursor: pointer;
	transition: background var(--kbia-dur) var(--kbia-ease-out);
}

.kbia-btn:hover { background: var(--kbia-accent-hover); color: var(--kbia-on-accent); }

.kbia-btn--secondary {
	background: var(--kbia-surface);
	box-shadow: inset 0 0 0 1px var(--kbia-accent);
	color: var(--kbia-heading);
}

.kbia-btn--secondary:hover { background: var(--kbia-blue-50); color: var(--kbia-heading); }

.kbia-btn--soft {
	background: var(--kbia-blue-50);
	color: var(--kbia-blue-700);
}

.kbia-btn--soft:hover { background: var(--kbia-blue-100); color: var(--kbia-blue-700); }

.kbia-btn--lg { padding: 1rem 2rem; font-size: 1.25rem; }

/* --- Badges -------------------------------------------------------------- */

.kbia-badge {
	display: inline-block;
	padding: 0.15rem 0.5rem;
	border-radius: var(--kbia-radius-sm);
	background: var(--kbia-accent);
	color: #fff;
	font-family: var(--kbia-font-mono);
	font-size: 0.75rem;
	font-weight: 400;
	letter-spacing: 0.2em;
	text-transform: uppercase;
}

/* The warm accent earns its keep here: it is what tells a community event apart
   from a BIA event at a glance. Used here and on footer column headings, and
   nowhere else. */
.kbia-badge--community {
	background: var(--kbia-warm);
	color: var(--kbia-blue-900);
}

/* --- Placeholder treatment ----------------------------------------------
   KBIA_Placeholders substitutes a bucket SVG whose filename always contains
   "kbia-placeholder", which lets us style it without overriding any of the
   parent theme's card templates. Muted, so it sits behind the design rather
   than competing with it.

   The honesty rule: a visitor must never read one of these as a photograph of
   that business. Hence the label.

   SCOPE, TODAY. The muted treatment below is a bare attribute selector and so
   applies everywhere immediately, including on cards the My Listing parent
   theme renders itself. The "Photo coming soon" label needs one of our own
   wrapper classes, so it appears only on cards built from the Elementor loop
   templates -- which is Phase 4. Until then listings show a muted placeholder
   without the label. Do not chase this by guessing at the parent theme's own
   card class names: they change between My Listing releases, and a stale
   selector is worse than no label. */

img[src*="kbia-placeholder"] {
	opacity: 0.92;
	filter: saturate(0.75);
}

.kbia-card__media:has(img[src*="kbia-placeholder"])::after,
.kbia-tile:has(img[src*="kbia-placeholder"]) .kbia-tile__body::after {
	content: "Photo coming soon";
	position: absolute;
	right: 0.75rem;
	bottom: 0.75rem;
	padding: 0.2rem 0.5rem;
	border-radius: var(--kbia-radius-sm);
	background: rgb(10 39 64 / 72%);
	color: rgb(255 255 255 / 90%);
	font-family: var(--kbia-font-mono);
	font-size: 0.6875rem;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	pointer-events: none;
}

/* --- Empty and loading states ------------------------------------------
   Small things the reference gets right and most directories skip. */

.kbia-empty {
	grid-column: 1 / -1;
	padding: var(--kbia-band-y) 0;
	text-align: center;
}

.kbia-empty__title {
	margin: 0 0 0.5rem;
	font-size: var(--kbia-fs-h3);
}

.kbia-empty__hint { margin: 0; color: var(--kbia-muted); }

.kbia-skeleton__block {
	border-radius: var(--kbia-radius-lg);
	background: color-mix(in srgb, var(--kbia-muted) 20%, transparent);
	animation: kbia-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.kbia-skeleton__block--media { aspect-ratio: var(--kbia-ratio-card); }
.kbia-skeleton__block--line { height: 1em; margin-top: 0.5rem; border-radius: var(--kbia-radius-sm); }

@keyframes kbia-pulse {
	0%, 100% { opacity: 1; }
	50% { opacity: 0.45; }
}

/* --- Additions for the sitemap build -------------------------------------
   Modifiers the §2/§3 templates reference. Kept here with the rest of the
   card system rather than in the page stylesheets, so the three card types
   stay one decision. */

/* The primary button. --secondary and --soft already exist above. */
.kbia-btn--primary {
	background: var(--kbia-accent);
	border-color: var(--kbia-accent);
	color: var(--kbia-on-accent);
}

.kbia-btn--primary:hover,
.kbia-btn--primary:focus-visible {
	background: var(--kbia-accent-hover);
	border-color: var(--kbia-accent-hover);
}

/* Tile ground: a solid colour behind the image, so a missing photograph
   degrades to a coloured tile rather than a hole. With 283 listings still on
   placeholders this is load-bearing, not decorative. */
.kbia-tile__ground {
	position: absolute;
	inset: 0;
	background: var(--kbia-blue-800);
	overflow: hidden;
}

.kbia-tile__img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* Card media, and the square variant the event card uses. */
.kbia-card__media {
	position: relative;
	display: block;
	aspect-ratio: var(--kbia-ratio-card);
	overflow: hidden;
	border-radius: var(--kbia-radius-lg);
	background: var(--kbia-blue-800);
}

.kbia-card__media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.kbia-card__media--square { aspect-ratio: var(--kbia-ratio-event); }
.kbia-card--person .kbia-card__media { aspect-ratio: var(--kbia-ratio-face); }

/* Badges sit on the image, top-left, clear of the card's hover scale. Inset by
   the media's own radius rather than flush: against a rounded corner a badge at
   0,0 reads as clipped, because it is -- the media clips to its curve. */
.kbia-badge--bia,
.kbia-badge--community,
.kbia-badge--latest,
.kbia-badge--past {
	position: absolute;
	top: var(--kbia-radius-sm);
	left: var(--kbia-radius-sm);
	z-index: 2;
}

.kbia-badge--bia {
	background: var(--kbia-blue-800);
	color: #fff;
}

.kbia-badge--past {
	position: static;
	display: inline-block;
	margin-bottom: 1rem;
	background: rgb(255 255 255 / 15%);
	color: #fff;
}

/* Community card: section name and date share the eyebrow line. */
.kbia-card__section::after {
	content: " ·";
	opacity: 0.5;
}

.kbia-card__business {
	margin: 0.35rem 0 0.75rem;
	font-size: var(--kbia-fs-eyebrow);
}
