/*
 * Design System - AELITA
 * components/dealer-card.css - the .a-dealer-card (autosalon / location) card.
 *
 * Used on the contacts directory (city pages under /kontakty/*).
 * Source of truth: docs/aelita-design/DESIGN.md
 *
 * Consumes tokens.css only: no hex values, no !important, no `transition: all`.
 * Only transform / colour properties are animated. Hover effects are gated
 * behind (hover: hover) and (pointer: fine). Sharp corners (--radius: 0),
 * a single red accent and flat surfaces (no decorative shadows).
 *
 * Compact by design: one divider, inline contact labels and a single fixed
 * logo box. The body is clickable through the title link's stretched ::after;
 * the phone links and the action row sit above it and stay individually
 * clickable and keyboard reachable.
 */

.a-dealer-card {
	position: relative;
	display: flex;
	flex-direction: column;
	width: 100%;
	padding: var(--space-4);
	border: var(--border-w) solid var(--border);
	background-color: var(--bg);
	transition:
		border-color var(--dur-press) var(--ease-out),
		transform var(--dur-press) var(--ease-out);
}

/* -------------------------------------------------------------------- */
/* Head: logo + title + address                                         */
/* -------------------------------------------------------------------- */
.a-dealer-card__top {
	display: flex;
	align-items: center;
	gap: var(--space-3);
}

/* One fixed box for every source logo, whatever its native aspect ratio.
 * Both dimensions are fixed, so the space is reserved and there is no CLS. */
.a-dealer-card__logo {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: flex-start;
	width: 72px;
	height: 46px;
}

.a-dealer-card__logo img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
	object-position: left center;
}

.a-dealer-card__monogram {
	font-family: var(--font-display-strong);
	font-size: 26px;
	line-height: 1;
	color: var(--c-ink-300);
}

.a-dealer-card__headings {
	flex: 1 1 auto;
	min-width: 0;
}

.a-dealer-card__title {
	margin: 0;
	font-family: var(--font-display);
	font-size: var(--fs-h4);
	font-weight: var(--fw-semibold);
	line-height: 1.25;
	text-transform: none;
}

.a-dealer-card__link {
	color: var(--text-primary);
	text-decoration: none;
}

/* Stretched hit-area for the whole card. */
.a-dealer-card__link::after {
	content: "";
	position: absolute;
	inset: 0;
}

.a-dealer-card__address {
	margin: var(--space-2) 0 0;
	font-size: var(--fs-small);
	line-height: 1.4;
	color: var(--text-secondary);
	overflow-wrap: anywhere;
}

/* -------------------------------------------------------------------- */
/* Body: hours + contacts                                               */
/* -------------------------------------------------------------------- */
.a-dealer-card__body {
	display: grid;
	gap: var(--space-3);
	margin-top: var(--space-4);
}

.a-dealer-card__hours {
	display: flex;
	align-items: flex-start;
	gap: var(--space-2);
	margin: 0;
	font-size: var(--fs-small);
	line-height: 1.45;
	color: var(--text-secondary);
}

.a-dealer-card__icon {
	flex: 0 0 auto;
	width: 16px;
	height: 16px;
	margin-top: 2px;
	color: var(--c-ink-300);
}

.a-dealer-card__contacts {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-1) var(--space-6);
}

.a-dealer-card__contact {
	display: flex;
	align-items: baseline;
	gap: var(--space-2);
	margin: 0;
	min-width: 0;
}

.a-dealer-card__label {
	flex: 0 0 auto;
	font-size: var(--fs-caption);
	font-weight: var(--fw-semibold);
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--text-secondary);
}

.a-dealer-card__values {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-1) var(--space-3);
	min-width: 0;
}

.a-dealer-card__phone {
	position: relative;
	z-index: 1;
	font-size: var(--fs-body);
	font-weight: var(--fw-bold);
	color: var(--text-primary);
	text-decoration: none;
	white-space: nowrap;
}

/* -------------------------------------------------------------------- */
/* Actions                                                              */
/* -------------------------------------------------------------------- */
/* margin-top: auto keeps the action row at the bottom so rows of cards
 * with different content stay aligned. */
.a-dealer-card__actions {
	position: relative;
	z-index: 1;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-2) var(--space-4);
	margin-top: auto;
	padding-top: var(--space-3);
	border-top: var(--border-w) solid var(--border);
}

.a-dealer-card__action,
.a-dealer-card__more {
	display: inline-flex;
	align-items: center;
	gap: var(--space-2);
	font-size: var(--fs-small);
	font-weight: var(--fw-semibold);
	text-decoration: none;
}

/* Route is a quiet, secondary action: no border, no fill. */
.a-dealer-card__route {
	color: var(--text-secondary);
	min-height: 44px;
}

.a-dealer-card__more {
	color: var(--text-primary);
	min-height: 44px;
}

.a-dealer-card__action svg,
.a-dealer-card__more svg {
	width: 16px;
	height: 16px;
	transition: transform var(--dur-press) var(--ease-out);
}

/* -------------------------------------------------------------------- */
/* Desktop                                                              */
/* -------------------------------------------------------------------- */
@media (min-width: 768px) {
	.a-dealer-card {
		padding: var(--space-5);
	}

	.a-dealer-card__top {
		gap: var(--space-4);
	}

	.a-dealer-card__logo {
		width: 104px;
		height: 64px;
	}
}

/* -------------------------------------------------------------------- */
/* States                                                               */
/* -------------------------------------------------------------------- */
@media (hover: hover) and (pointer: fine) {
	.a-dealer-card:hover {
		border-color: var(--c-ink-300);
		transform: translateY(-2px);
	}

	.a-dealer-card:hover .a-dealer-card__link {
		text-decoration: underline;
		text-underline-offset: 3px;
	}

	.a-dealer-card__phone:hover,
	.a-dealer-card__more:hover {
		color: var(--c-red-600);
	}

	.a-dealer-card__route:hover {
		color: var(--text-primary);
	}

	.a-dealer-card__route:hover svg {
		transform: translateX(-2px);
	}

	.a-dealer-card__more:hover svg {
		transform: translateX(3px);
	}
}

.a-dealer-card:focus-within {
	border-color: var(--c-ink-300);
}

.a-dealer-card__link:focus-visible,
.a-dealer-card__phone:focus-visible,
.a-dealer-card__action:focus-visible,
.a-dealer-card__more:focus-visible {
	outline: 2px solid var(--focus-ring);
	outline-offset: 2px;
}

/* -------------------------------------------------------------------- */
/* Reduced motion                                                       */
/* -------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
	.a-dealer-card,
	.a-dealer-card__action svg,
	.a-dealer-card__more svg {
		transition-duration: 0.01ms;
	}

	.a-dealer-card:hover {
		transform: none;
	}
}
