/* Dot And Draft Core — floating WhatsApp chat button + popup
   --------------------------------------------------------------------------
   Design D1 "The Dot": the logo's orange dot (--ddc-wa-color, Studio →
   Settings → Button colour) with two rings pulsing out of it. Open
   (.is-open, set by whatsapp.js), the dot grows into a dark card and the page
   behind is dimmed and blurred. Uses the theme's colour tokens and font when
   they're there, with fallbacks.
   1. Base
   2. Backdrop
   3. Button
   4. Card
   5. Small screens, reduced motion
   ========================================================================== */


/* 1. Base
   ========================================================================== */

.ddc-wa {
	--ddc-wa-color: #ff7a3b;
	--ddc-wa-ink: var(--color-ink, #1b1a19);
	--ddc-wa-paper: var(--color-paper, #e5e5e5);
	--ddc-wa-size: 62px;
	--ddc-wa-gap: 28px;
	font-family: var(--font-sans, "Inter", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif);
	line-height: 1.4;
}

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

.ddc-wa p {
	margin: 0;
}

.ddc-wa svg {
	display: block;
	width: 1em;
	height: 1em;
}

.ddc-wa .screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	border: 0;
	white-space: nowrap;
}

/* Holds the card and the button, in the bottom-right corner. */
.ddc-wa__dock {
	position: fixed;
	right: var(--ddc-wa-gap);
	bottom: var(--ddc-wa-gap);
	z-index: 99999;
	animation: ddc-wa-pop 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) 0.8s backwards;
}

@keyframes ddc-wa-pop {
	from { opacity: 0; transform: scale(0); }
}


/* 2. Backdrop — dims and blurs the page while the card is open
   ========================================================================== */

.ddc-wa__backdrop {
	position: fixed;
	inset: 0;
	z-index: 99998;
	background-color: rgba(17, 17, 16, 0.45);
	-webkit-backdrop-filter: blur(3px);
	backdrop-filter: blur(3px);
	cursor: pointer;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.4s, visibility 0s 0.4s;
}

.ddc-wa.is-open .ddc-wa__backdrop {
	opacity: 1;
	visibility: visible;
	transition: opacity 0.4s;
}


/* 3. Button
   ========================================================================== */

.ddc-wa__launcher {
	position: relative;
	z-index: 2;
	display: grid;
	place-items: center;
	width: var(--ddc-wa-size);
	height: var(--ddc-wa-size);
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background-color: var(--ddc-wa-color);
	color: #fff;
	font-size: 28px;
	cursor: pointer;
	box-shadow: 0 12px 30px color-mix(in srgb, var(--ddc-wa-color) 45%, transparent);
	transition: background-color 0.4s, color 0.4s, box-shadow 0.4s, transform 0.3s;
}

.ddc-wa__launcher:hover {
	transform: scale(1.06);
}

.ddc-wa__launcher:focus-visible {
	outline: 2px solid var(--ddc-wa-ink);
	outline-offset: 3px;
}

/* Two rings pulsing out of the dot. */
.ddc-wa__launcher::before,
.ddc-wa__launcher::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	border: 2px solid var(--ddc-wa-color);
	border-radius: 50%;
	opacity: 0;
	animation: ddc-wa-ring 2.6s cubic-bezier(0.2, 0.6, 0.3, 1) infinite;
}

.ddc-wa__launcher::after {
	animation-delay: 1.3s;
}

@keyframes ddc-wa-ring {
	from { opacity: 0.7; transform: scale(1); }
	to { opacity: 0; transform: scale(1.9); }
}

.ddc-wa__icon-open,
.ddc-wa__icon-close {
	grid-area: 1 / 1;
	transition: transform 0.5s cubic-bezier(0.7, 0, 0.2, 1), opacity 0.3s;
}

.ddc-wa__icon-close {
	font-size: 22px;
	opacity: 0;
	transform: rotate(-90deg) scale(0.4);
}

.ddc-wa.is-open .ddc-wa__icon-open {
	opacity: 0;
	transform: rotate(90deg) scale(0.4);
}

.ddc-wa.is-open .ddc-wa__icon-close {
	opacity: 1;
	transform: none;
}

.ddc-wa.is-open .ddc-wa__launcher {
	background-color: var(--ddc-wa-paper);
	color: var(--ddc-wa-ink);
	box-shadow: none;
}

.ddc-wa.is-open .ddc-wa__launcher::before,
.ddc-wa.is-open .ddc-wa__launcher::after {
	animation: none;
}


/* 4. Card — clipped to a circle on the dot, opened out to full size; its
   contents fade up one after another (--i = order)
   ========================================================================== */

.ddc-wa__popup {
	position: absolute;
	right: 0;
	bottom: 0;
	z-index: 1;
	display: flex;
	flex-direction: column;
	gap: 14px;
	width: min(340px, calc(100vw - 2 * var(--ddc-wa-gap)));
	padding: 26px 26px calc(var(--ddc-wa-size) + 32px);
	border-radius: 26px;
	background-color: var(--ddc-wa-ink);
	color: var(--ddc-wa-paper);
	box-shadow: rgba(0, 0, 0, 0.25) 0 20px 50px;
	clip-path: circle(0 at calc(100% - var(--ddc-wa-size) / 2) calc(100% - var(--ddc-wa-size) / 2));
	visibility: hidden;
	transition: clip-path 0.7s cubic-bezier(0.7, 0, 0.2, 1), visibility 0s 0.7s;
}

.ddc-wa.is-open .ddc-wa__popup {
	clip-path: circle(160% at calc(100% - var(--ddc-wa-size) / 2) calc(100% - var(--ddc-wa-size) / 2));
	visibility: visible;
	transition: clip-path 0.7s cubic-bezier(0.7, 0, 0.2, 1);
}

.ddc-wa__popup > * {
	opacity: 0;
	transform: translateY(10px);
	transition: opacity 0.3s, transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.ddc-wa.is-open .ddc-wa__popup > * {
	opacity: 1;
	transform: none;
	transition-delay: calc(0.25s + var(--i, 0) * 70ms);
}

.ddc-wa__brand {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 11px;
	font-weight: 500;
	letter-spacing: 0.4px;
	text-transform: uppercase;
	color: color-mix(in srgb, var(--ddc-wa-paper) 60%, transparent);
}

.ddc-wa__brand-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background-color: var(--ddc-wa-color);
}

.ddc-wa .ddc-wa__title {
	font-size: 30px;
	font-weight: 500;
	letter-spacing: -1px;
	line-height: 1.05;
}

.ddc-wa__title span {
	color: var(--ddc-wa-color);
}

.ddc-wa__intro {
	font-size: 14px;
	font-weight: 300;
	line-height: 1.4;
	color: color-mix(in srgb, var(--ddc-wa-paper) 70%, transparent);
}

.ddc-wa__intro strong {
	font-weight: 500;
	color: var(--ddc-wa-paper);
}

.ddc-wa__member {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-top: 4px;
	padding: 10px;
	border: 1px solid var(--color-line-light, rgba(255, 255, 255, 0.1));
	border-radius: 18px;
	background-color: rgba(255, 255, 255, 0.05);
	color: inherit;
	text-decoration: none;
	transition: background-color 0.3s;
}

.ddc-wa__member:hover,
.ddc-wa__member:focus-visible {
	background-color: rgba(255, 255, 255, 0.11);
	color: inherit;
}

.ddc-wa__avatar {
	position: relative;
	flex-shrink: 0;
	width: 44px;
	height: 44px;
}

.ddc-wa__avatar img {
	display: block;
	width: 100%;
	height: 100%;
	border-radius: 50%;
	object-fit: cover;
}

/* No photo: the WhatsApp icon on a round tile. */
.ddc-wa__avatar-icon {
	display: grid;
	place-items: center;
	width: 100%;
	height: 100%;
	border-radius: 50%;
	background-color: rgba(255, 255, 255, 0.08);
	color: var(--ddc-wa-color);
	font-size: 22px;
}

.ddc-wa__online {
	position: absolute;
	right: 0;
	bottom: 1px;
	width: 11px;
	height: 11px;
	border-radius: 50%;
	background-color: var(--color-green, #5ae55a);
	box-shadow: 0 0 0 2px var(--ddc-wa-ink);
}

.ddc-wa__member-text {
	display: flex;
	flex-direction: column;
	min-width: 0;
	line-height: 1.3;
}

.ddc-wa__member-name {
	font-size: 16px;
	font-weight: 500;
}

.ddc-wa__member-role {
	font-size: 12px;
	opacity: 0.55;
}

.ddc-wa__member-go {
	display: grid;
	flex-shrink: 0;
	place-items: center;
	width: 36px;
	height: 36px;
	margin-left: auto;
	border-radius: 50%;
	background-color: var(--ddc-wa-color);
	color: #fff;
	font-size: 16px;
	transition: transform 0.3s;
}

.ddc-wa__member:hover .ddc-wa__member-go {
	transform: translateX(3px);
}

.ddc-wa__notice {
	font-size: 12px;
	color: color-mix(in srgb, var(--ddc-wa-paper) 45%, transparent);
}


/* 5. Small screens, reduced motion
   ========================================================================== */

@media (max-width: 600px) {
	.ddc-wa {
		--ddc-wa-size: 56px;
		--ddc-wa-gap: 18px;
	}

	.ddc-wa__launcher {
		font-size: 26px;
	}

	.ddc-wa .ddc-wa__title {
		font-size: 26px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.ddc-wa *,
	.ddc-wa *::before,
	.ddc-wa *::after,
	.ddc-wa__dock {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
	}
}
