/* DM Business Cards: public card page. Mobile-first, no external resources. */

*,
*::before,
*::after { box-sizing: border-box; }

:root {
	/* Destinations Magiques brand defaults (blue + gold); the page overrides the
	   brand colors with the values from Settings. Never purple. */
	--dmbc-primary: #345791;
	--dmbc-accent: #dda052;
	--dmbc-on-primary: #ffffff;
	--dmbc-on-accent: #2b2415;
	--dmbc-primary-text: #345791;
	--dmbc-accent-text: #212529; /* gold is never text on white */
	--dmbc-night: #1b2f52;
	--dmbc-ink: #212529;
	--dmbc-muted: #4a5361;
	--dmbc-line: #dfe5ee;
	--dmbc-surface: #ffffff;
	--dmbc-soft: #f5f8fc;
	--dmbc-mist: #f2f5fa;
	--dmbc-tint: #e7eef8;
	--dmbc-avatar: #cfddf0;
	--dmbc-radius: 14px;
	--dmbc-btn-radius: 8px;
	/* Bottom action bar: button + vertical padding (safe-area inset added where used). */
	--dmbc-savebar-h: 76px;
	/* The theme's Prompt font is not loaded here (no external fonts): system UI stack. */
	--dmbc-font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body.dmbc {
	margin: 0;
	min-height: 100vh;
	min-height: 100dvh;
	background: var(--dmbc-surface);
	color: var(--dmbc-ink);
	font: 16px/1.45 var(--dmbc-font);
	-webkit-font-smoothing: antialiased;
}

.dmbc a { color: inherit; text-decoration: none; }
.dmbc img { display: block; max-width: 100%; }
.dmbc button { font: inherit; color: inherit; }

.dmbc-sr {
	position: absolute !important;
	width: 1px; height: 1px;
	padding: 0; margin: -1px;
	overflow: hidden; clip: rect(0 0 0 0);
	white-space: nowrap; border: 0;
}

.dmbc-icon { width: 20px; height: 20px; flex: none; }

/* Visible focus for every interactive element. */
.dmbc a:focus-visible,
.dmbc button:focus-visible,
.dmbc-share:focus-visible {
	outline: 3px solid var(--dmbc-primary-text);
	outline-offset: 2px;
	border-radius: var(--dmbc-btn-radius);
}

/* ---------- Card shell ---------- */

.dmbc-card {
	position: relative;
	width: 100%;
	max-width: 420px;
	margin: 0 auto;
	min-height: 100vh;
	min-height: 100dvh;
	background: var(--dmbc-surface);
	display: flex;
	flex-direction: column;
}

/* ---------- Banner ---------- */

.dmbc-banner {
	position: relative;
	/* The only designed height: scales with the screen, never clips the 40px logo or the 44px switch. */
	height: clamp(96px, min(30vw, 28vh), 140px);
	flex: none;
	/* Fallback when no banner image: brand blue to night, white text. */
	background: linear-gradient(135deg, var(--dmbc-primary) 0%, var(--dmbc-night) 100%);
	color: #fff;
	padding: calc(10px + env(safe-area-inset-top, 0px)) 12px 0 16px;
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 12px;
}

.dmbc-banner::after {
	/* Soft wash keeps logo and toggle readable on any banner image. */
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(180deg, rgba(0, 0, 0, .28) 0%, rgba(0, 0, 0, 0) 60%);
	pointer-events: none;
}

.dmbc-banner:not(.dmbc-banner--image)::after {
	/* Subtle gold glow accent, as on the site's hero bands. */
	background: radial-gradient(90% 120% at 100% 0%, rgba(221, 160, 82, .22) 0%, rgba(221, 160, 82, 0) 60%);
}

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

.dmbc-brand {
	position: relative;
	z-index: 1;
	min-width: 0;
	display: flex;
	align-items: center;
	min-height: 44px;
}

.dmbc-brand__logo {
	max-height: 40px;
	max-width: 170px;
	width: auto;
	height: auto;
	object-fit: contain;
}

/* Language switch: one button showing only the other language. Always top right, with or
   without a logo before it. */
.dmbc .dmbc-lang {
	position: relative;
	z-index: 1;
	flex: none;
	margin-left: auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 44px;
	height: 44px;
	padding: 0 12px;
	border-radius: 999px;
	border: 1px solid rgba(255, 255, 255, .55);
	background: rgba(0, 0, 0, .45);
	color: #fff;
	font-size: 14px;
	font-weight: 700;
	letter-spacing: .08em;
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
	transition: background-color .12s ease;
}

.dmbc .dmbc-lang:hover { background: rgba(0, 0, 0, .6); }
.dmbc .dmbc-lang:focus-visible { outline-color: #fff; border-radius: 999px; }

/* Photo / initials overlapping the banner */
.dmbc-avatar {
	position: absolute;
	z-index: 2;
	left: 20px;
	bottom: -40px;
	width: 80px;
	height: 80px;
	border-radius: var(--dmbc-radius);
	border: 3px solid var(--dmbc-surface);
	background: var(--dmbc-soft);
	box-shadow: 0 8px 22px rgba(27, 47, 82, .18);
	overflow: hidden;
}

.dmbc-photo { width: 100%; height: 100%; object-fit: cover; }

.dmbc-avatar--initials {
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--dmbc-avatar);
	color: var(--dmbc-primary-text);
}

.dmbc-initials { font-size: 28px; font-weight: 600; letter-spacing: .02em; }

/* ---------- Body ---------- */

.dmbc-body {
	flex: 1;
	display: flex;
	flex-direction: column;
	/* Grows with its content; the bottom padding keeps the last row clear of the save bar. */
	padding: 52px 20px 24px;
}

.dmbc-name {
	margin: 0;
	font-size: 26px;
	line-height: 1.15;
	font-weight: 600;
	letter-spacing: -.01em;
	overflow-wrap: anywhere;
}

.dmbc-title {
	margin: 4px 0 0;
	color: var(--dmbc-muted);
	font-size: 15px;
	overflow-wrap: anywhere;
}

.dmbc-agency {
	margin: 2px 0 0;
	color: var(--dmbc-primary-text);
	font-size: 13px;
	font-weight: 600;
	letter-spacing: .02em;
}

/* Quick actions */
.dmbc-actions {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
	gap: 8px;
	margin: 18px 0 0;
}

.dmbc-action {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 4px;
	min-height: 64px;
	padding: 8px 4px;
	border-radius: var(--dmbc-btn-radius);
	background: var(--dmbc-primary);
	color: var(--dmbc-on-primary, #fff) !important;
	font-size: 13px;
	font-weight: 600;
	text-align: center;
	transition: transform .12s ease, filter .12s ease;
}

.dmbc-action:hover { filter: brightness(1.06); }
.dmbc-action:active { transform: scale(.97); }

/* Share panel: hidden until opened (JS) or targeted (#dmbc-share without JS). */
.dmbc-share {
	display: none;
	margin: 10px 0 0;
	padding: 6px;
	border: 1px solid var(--dmbc-line);
	border-radius: var(--dmbc-radius);
	background: var(--dmbc-soft);
	/* When opened it is scrolled into view above the sticky save bar, never behind it. */
	scroll-margin-top: 12px;
	scroll-margin-bottom: calc(var(--dmbc-savebar-h) + 12px + env(safe-area-inset-bottom, 0px));
}
.dmbc-share:target,
.dmbc-share.is-open { display: block; }

.dmbc-share__list { list-style: none; margin: 0; padding: 0; }

.dmbc .dmbc-share__link {
	display: flex;
	align-items: center;
	gap: 12px;
	width: 100%;
	min-height: 48px;
	padding: 0 12px;
	border: 0;
	border-radius: var(--dmbc-btn-radius);
	background: transparent;
	font-size: 15px;
	font-weight: 550;
	text-align: left;
	cursor: pointer;
}

.dmbc-share__link .dmbc-icon { color: var(--dmbc-primary-text); }
.dmbc-share__link:hover { background: var(--dmbc-tint); }
.dmbc-share__link[hidden] { display: none; }
.dmbc-share__status { margin: 0; padding: 0 12px; font-size: 13px; color: var(--dmbc-muted); }
.dmbc-share__status:empty { display: none; }
.dmbc-share__status:not(:empty) { padding-bottom: 8px; }

/* Messenger app link: phones and tablets only (no Facebook app ID on desktop). */
.dmbc-share__messenger { display: none; }
@media (hover: none) and (pointer: coarse) {
	.dmbc-share__messenger { display: list-item; list-style: none; }
}

/* Contact rows */
.dmbc-rows { list-style: none; margin: 18px 0 0; padding: 0; }
.dmbc-rows li + li { border-top: 1px solid var(--dmbc-line); }

.dmbc-row {
	display: flex;
	align-items: center;
	gap: 14px;
	min-height: 60px;
	padding: 8px 0;
}

.dmbc-row__icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	flex: none;
	border-radius: var(--dmbc-btn-radius);
	background: var(--dmbc-tint);
	color: var(--dmbc-primary-text);
}

.dmbc-row__text { display: flex; flex-direction: column; min-width: 0; }

.dmbc-row__label {
	font-size: 12px;
	font-weight: 600;
	color: var(--dmbc-muted);
	letter-spacing: .02em;
}

.dmbc-row__value {
	font-size: 16px;
	font-weight: 550;
	overflow-wrap: anywhere;
}

.dmbc-row:hover .dmbc-row__value { text-decoration: underline; text-underline-offset: 3px; }

/* About */
.dmbc-about { margin: 18px 0 0; padding: 16px; border-radius: var(--dmbc-radius); background: var(--dmbc-soft); }

.dmbc-heading {
	margin: 0 0 6px;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: .1em;
	text-transform: uppercase;
	color: var(--dmbc-muted);
}

.dmbc-note { margin: 0; font-size: 15px; line-height: 1.55; white-space: pre-line; overflow-wrap: anywhere; }

/* Social icons */
.dmbc-social {
	list-style: none;
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 12px;
	margin: 20px 0 0;
	padding: 0;
}

.dmbc-social__link {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	border-radius: 50%;
	border: 1px solid var(--dmbc-line);
	color: var(--dmbc-primary-text) !important;
	transition: background-color .12s ease, color .12s ease;
}

.dmbc-social__link .dmbc-icon { width: 22px; height: 22px; }
.dmbc-social__link:hover { background: var(--dmbc-primary); color: var(--dmbc-on-primary, #fff) !important; border-color: var(--dmbc-primary); }

/* Save to Contacts: a bottom bar, last in the card's flex column. Sticky keeps it at the
   viewport bottom while the card scrolls; being in normal flow, it never covers content. */
.dmbc-savebar {
	position: sticky;
	bottom: 0;
	z-index: 3;
	flex: none;
	padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
	background: var(--dmbc-surface);
	border-top: 1px solid var(--dmbc-line);
	box-shadow: 0 -6px 18px rgba(27, 47, 82, .08);
}

.dmbc-save {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	min-height: 52px;
	padding: 0 20px;
	/* Primary CTA: brand gold with dark text and a soft gold shadow. */
	border-radius: var(--dmbc-btn-radius);
	background: var(--dmbc-accent);
	color: var(--dmbc-on-accent) !important;
	font-size: 16px;
	font-weight: 700;
	box-shadow: 0 6px 16px rgba(221, 160, 82, .35);
	transition: transform .12s ease;
}

.dmbc-save:hover { filter: brightness(1.04); }
.dmbc-save:active { transform: scale(.98); }
.dmbc-save--light { margin-top: 24px; border: 1px solid var(--dmbc-primary); background: var(--dmbc-surface); color: var(--dmbc-primary-text) !important; box-shadow: none; }

/* Unavailable page */
.dmbc-body--unavailable { padding-top: 40px; align-items: center; text-align: center; }
.dmbc-body--unavailable .dmbc-name { font-size: 22px; }
.dmbc-unavailable__icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 64px;
	height: 64px;
	margin-bottom: 16px;
	border-radius: var(--dmbc-radius);
	background: var(--dmbc-tint);
	color: var(--dmbc-primary-text);
}
.dmbc-unavailable__icon .dmbc-icon { width: 30px; height: 30px; }
.dmbc-hint { margin: 8px 0 0; color: var(--dmbc-muted); max-width: 30ch; }

/* ---------- Larger screens: a centered card ---------- */
@media (min-width: 480px) {
	body.dmbc {
		background:
			radial-gradient(80% 60% at 50% 0%, rgba(52, 87, 145, .12) 0%, rgba(52, 87, 145, 0) 70%),
			var(--dmbc-mist);
		/* Less top/bottom space on short (landscape) screens. */
		padding: clamp(0px, 5vh, 40px) 16px;
	}
	.dmbc-card {
		min-height: 0;
		border: 1px solid var(--dmbc-line);
		border-radius: var(--dmbc-radius);
		overflow: clip;
		box-shadow: 0 18px 50px rgba(27, 47, 82, .18);
	}
	.dmbc-banner { border-radius: var(--dmbc-radius) var(--dmbc-radius) 0 0; }
}

@media (prefers-reduced-motion: reduce) {
	.dmbc *, .dmbc *::before, .dmbc *::after { transition: none !important; scroll-behavior: auto !important; }
	.dmbc-action:active, .dmbc-save:active { transform: none; }
}
