/* -------------------------------------------------------------------------
 * Imetric Distributors: frontend styles
 * ---------------------------------------------------------------------- */

.idist-wrap {
	--idist-accent: #0a6cff;
	--idist-border: #e6e8ec;
	--idist-text: #1d2127;
	--idist-muted: #5b6471;
	--idist-card-bg: #fff;
	--idist-radius: 14px;

	margin: 0 auto;
	/* Generous bottom padding so the footer never crowds the last row. */
	padding: 8px 0 80px;
	max-width: 1140px;
	color: var( --idist-text );
	-webkit-font-smoothing: antialiased;
}

/* ---- Country selector ---- */

.idist-controls {
	margin-bottom: 40px;
}

.idist-select-label {
	display: block;
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var( --idist-muted );
	margin-bottom: 8px;
}

.idist-select {
	min-width: 320px;
	max-width: 100%;
	padding: 13px 44px 13px 16px;
	font-size: 16px;
	line-height: 1.2;
	color: var( --idist-text );
	border: 1px solid var( --idist-border );
	border-radius: 10px;
	background-color: #fff;
	/* Custom chevron so the control looks consistent across browsers. */
	background-image: url( "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%235b6471' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E" );
	background-repeat: no-repeat;
	background-position: right 16px center;
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
	cursor: pointer;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.idist-select:hover {
	border-color: #c9ced6;
}

.idist-select:focus {
	outline: none;
	border-color: var( --idist-accent );
	box-shadow: 0 0 0 3px rgba( 10, 108, 255, 0.15 );
}

/* Native <select> is hidden once the JS combobox enhances it. */
.idist-select--enhanced {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	border: 0;
	overflow: hidden;
	clip: rect( 0 0 0 0 );
	clip-path: inset( 50% );
	white-space: nowrap;
}

/* ---- Searchable combobox ---- */

.idist-combo {
	position: relative;
	min-width: 320px;
	max-width: 420px;
}

.idist-combo-input {
	width: 100%;
	padding: 13px 42px 13px 16px;
	font-size: 16px;
	line-height: 1.2;
	color: var( --idist-text );
	border: 1px solid var( --idist-border );
	border-radius: 10px;
	background-color: #fff;
	/* Search glyph on the right. */
	background-image: url( "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235b6471' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E" );
	background-repeat: no-repeat;
	background-position: right 14px center;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.idist-combo-input:hover {
	border-color: #c9ced6;
}

.idist-combo-input:focus {
	outline: none;
	border-color: var( --idist-accent );
	box-shadow: 0 0 0 3px rgba( 10, 108, 255, 0.15 );
}

/* Clear button, shown only once a country is chosen. */
.idist-combo-clear {
	position: absolute;
	top: 50%;
	right: 8px;
	transform: translateY( -50% );
	/* Swapped to flex by .has-value; display:none also keeps it out of the
	   tab order while there is nothing to clear. */
	display: none;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	padding: 0;
	color: var( --idist-muted );
	background: none;
	border: 0;
	border-radius: 50%;
	cursor: pointer;
	transition: color 0.15s ease, background-color 0.15s ease;
}

.idist-combo.has-value .idist-combo-clear {
	display: flex;
}

.idist-combo-clear:hover {
	color: var( --idist-text );
	background: #eef0f3;
}

.idist-combo-clear:focus-visible {
	outline: 2px solid var( --idist-accent );
	outline-offset: 1px;
}

.idist-combo-clear svg {
	width: 13px;
	height: 13px;
}

/* The clear button takes over the corner the search glyph occupies. */
.idist-combo.has-value .idist-combo-input {
	background-image: none;
}

.idist-combo-list {
	position: absolute;
	z-index: 20;
	left: 0;
	right: 0;
	top: calc( 100% + 6px );
	max-height: 280px;
	margin: 0;
	padding: 6px;
	list-style: none;
	overflow-y: auto;
	background: #fff;
	border: 1px solid var( --idist-border );
	border-radius: 10px;
	box-shadow: 0 12px 32px rgba( 16, 24, 40, 0.14 );
}

.idist-combo-list[hidden] {
	display: none;
}

.idist-combo-option {
	padding: 10px 12px;
	font-size: 15px;
	line-height: 1.3;
	color: var( --idist-text );
	border-radius: 7px;
	cursor: pointer;
}

.idist-combo-option:hover,
.idist-combo-option.is-active {
	background: #eef4ff;
	color: #084ec2;
}

.idist-combo-option[aria-selected="true"] {
	font-weight: 600;
}

.idist-combo-empty {
	padding: 12px;
	font-size: 14px;
	color: var( --idist-muted );
	text-align: center;
}

/* ---- Empty / prompt message ---- */

.idist-message {
	color: var( --idist-muted );
	font-size: 16px;
	margin: 8px 0 0;
	padding: 28px;
	text-align: center;
	border: 1px dashed var( --idist-border );
	border-radius: var( --idist-radius );
	background: #fafbfc;
}

/* ---- Cards grid ---- */

.idist-grid {
	display: grid;
	grid-template-columns: repeat( auto-fill, minmax( 260px, 1fr ) );
	gap: 28px;
}

.idist-card {
	position: relative;
	display: flex;
	flex-direction: column;
	/* Allow the card to shrink within its grid track so long content wraps. */
	min-width: 0;
	padding: 28px 24px;
	background: var( --idist-card-bg );
	border: 1px solid var( --idist-border );
	border-radius: var( --idist-radius );
	box-shadow: 0 1px 2px rgba( 16, 24, 40, 0.04 );
	transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.idist-card:hover {
	transform: translateY( -3px );
	border-color: #d6dbe2;
	box-shadow: 0 12px 28px rgba( 16, 24, 40, 0.10 );
}

.idist-card-logo {
	display: flex;
	align-items: center;
	justify-content: center;
	/* Fixed height so every logo occupies an identical, centered area. */
	height: 110px;
	margin-bottom: 18px;
	padding-bottom: 18px;
	border-bottom: 1px solid var( --idist-border );
}

.idist-card-logo img {
	/* Scale to fit the box without distortion; stays centered via the flex parent. */
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
}

.idist-card-name {
	margin: 0 0 14px;
	font-size: 19px;
	font-weight: 700;
	line-height: 1.3;
	color: var( --idist-text );
	/* Wrap long, unbroken names (e.g. "Straumann/neodent") inside the card. */
	min-width: 0;
	overflow-wrap: anywhere;
	word-break: break-word;
}

/* ---- "Visit Site" link ---- */

.idist-card-visit {
	/* Negative top margin tucks it under the name's own 14px bottom margin. */
	margin: -6px 0 14px;
	font-size: 13.5px;
	line-height: 1.4;
}

.idist-card-visit a {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	font-weight: 600;
	color: var( --idist-accent );
	text-decoration: none;
	transition: color 0.15s ease;
}

.idist-card-visit a:hover {
	color: #084ec2;
	text-decoration: underline;
}

.idist-card-visit a:focus-visible {
	outline: 2px solid var( --idist-accent );
	outline-offset: 3px;
	border-radius: 3px;
}

/* Outbound arrow: signals the link opens in a new tab. */
.idist-visit-icon {
	flex: 0 0 auto;
	width: 11px;
	height: 11px;
	transition: transform 0.15s ease;
}

.idist-card-visit a:hover .idist-visit-icon {
	transform: translate( 1.5px, -1.5px );
}

@media ( prefers-reduced-motion: reduce ) {
	.idist-visit-icon {
		transition: none;
	}

	.idist-card-visit a:hover .idist-visit-icon {
		transform: none;
	}
}

/* ---- Card meta (address, phone) ---- */

.idist-card-meta {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin-top: auto;
}

.idist-card-meta p {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	margin: 0;
	font-size: 14.5px;
	line-height: 1.5;
	color: var( --idist-muted );
}

/* Inline label icons rendered with pseudo-elements (no asset deps). */
.idist-card-meta p::before {
	flex: 0 0 auto;
	width: 16px;
	margin-top: 1px;
	text-align: center;
	opacity: 0.7;
}

.idist-card-address::before {
	content: "\1F4CD"; /* 📍 */
}

.idist-card-phone::before {
	content: "\1F4DE"; /* 📞 */
}

.idist-card-meta a {
	color: var( --idist-accent );
	text-decoration: none;
	word-break: break-word;
	transition: color 0.15s ease;
}

.idist-card-meta a:hover {
	color: #084ec2;
	text-decoration: underline;
}

/* ---- Section headings ---- */

.idist-intro {
	margin: 0 0 28px;
}

.idist-intro-title {
	margin: 0 0 8px;
	font-size: 34px;
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: -0.015em;
	color: var( --idist-text );
	text-wrap: balance;
}

.idist-intro-text {
	margin: 0;
	/*
	 * Wide enough that the standard subheading sits on one line at desktop
	 * widths. Still a ch cap rather than a px one, so it scales with the font
	 * size and the line wraps naturally as the viewport narrows.
	 */
	max-width: 100ch;
	font-size: 17px;
	line-height: 1.55;
	color: var( --idist-muted );
}

/* Separates the promoted row from everything beneath it. */
.idist-more {
	margin: 56px 0 28px;
	padding-top: 44px;
	border-top: 1px solid var( --idist-border );
}

.idist-more-title {
	margin: 0 0 8px;
	font-size: 26px;
	font-weight: 700;
	line-height: 1.25;
	letter-spacing: -0.01em;
	color: var( --idist-text );
	text-wrap: balance;
}

.idist-more-text {
	margin: 0;
	max-width: 100ch;
	font-size: 16px;
	line-height: 1.55;
	color: var( --idist-muted );
}

/* ---- Promoted (featured) tier ---- */

/*
 * auto-fit collapses the empty tracks, so two promoted distributors fill the
 * row as two equal halves while a third would wrap rather than squeezing all
 * three into one line.
 */
.idist-grid--featured {
	grid-template-columns: repeat( auto-fit, minmax( min( 100%, 420px ), 1fr ) );
}

.idist-card--featured {
	align-items: center;
	text-align: center;
	padding: 22px 36px;
}

/*
 * The box is fixed so every promoted logo occupies the same area and the
 * divider lines up across the row. Kept just above the tallest logo we
 * actually serve at `medium` (300x169), rather than the 170px it was, which
 * left most of the box empty for a wide, short mark like Straumann's 300x65.
 */
.idist-card--featured .idist-card-logo {
	width: 100%;
	height: 140px;
	margin-bottom: 20px;
	padding-bottom: 12px;
}

.idist-card--featured .idist-card-name {
	margin: 0 0 10px;
	font-size: 28px;
}

.idist-card--featured .idist-card-visit {
	margin: 0;
	font-size: 15px;
}

/* The meta block is auto-pushed to the bottom; centre it with the rest. */
.idist-card--featured .idist-card-meta {
	align-items: center;
	width: 100%;
}

/* ---- Compact tier (everything below the promoted row) ---- */

.idist-grid--compact {
	grid-template-columns: repeat( auto-fill, minmax( 190px, 1fr ) );
	gap: 20px;
}

.idist-card--compact {
	padding: 20px 18px;
}

.idist-card--compact .idist-card-logo {
	height: 76px;
	margin-bottom: 14px;
	padding-bottom: 14px;
}

.idist-card--compact .idist-card-name {
	margin: 0 0 10px;
	font-size: 17px;
}

.idist-card--compact .idist-card-visit {
	margin: -4px 0 10px;
	font-size: 13px;
}

/* ---- Small screens ---- */

@media ( max-width: 600px ) {
	.idist-wrap {
		padding-bottom: 56px;
	}

	.idist-select,
	.idist-combo {
		min-width: 0;
		width: 100%;
		max-width: 100%;
	}

	.idist-grid {
		grid-template-columns: 1fr;
		gap: 20px;
	}

	.idist-intro-title {
		font-size: 26px;
	}

	.idist-intro-text {
		font-size: 16px;
	}

	.idist-more {
		margin: 40px 0 24px;
		padding-top: 32px;
	}

	.idist-more-title {
		font-size: 21px;
	}

	.idist-card--featured {
		padding: 18px 22px;
	}

	.idist-card--featured .idist-card-logo {
		height: 112px;
		margin-bottom: 16px;
		padding-bottom: 10px;
	}

	.idist-card--featured .idist-card-name {
		font-size: 23px;
	}

	/* Two across rather than one, so the compact tier stays compact. */
	.idist-grid--compact {
		grid-template-columns: repeat( 2, 1fr );
		gap: 14px;
	}
}
