/**
 * Scroll-to-top and floating contact buttons.
 */

.hafez-float {
	position: fixed;
	z-index: var(--hafez-float-z, 99990);
	inset: auto;
	margin: 0;
	padding: 0;
	line-height: 1;
}

.hafez-float--br {
	right: var(--hafez-float-x, 24px);
	bottom: var(--hafez-float-y, 24px);
}

.hafez-float--bl {
	left: var(--hafez-float-x, 24px);
	bottom: var(--hafez-float-y, 24px);
}

.hafez-float--bc {
	left: 50%;
	bottom: var(--hafez-float-y, 24px);
	transform: translateX(-50%);
}

.hafez-float--tr {
	right: var(--hafez-float-x, 24px);
	top: var(--hafez-float-y, 24px);
}

.hafez-float--tl {
	left: var(--hafez-float-x, 24px);
	top: var(--hafez-float-y, 24px);
}

.hafez-float--tc {
	left: 50%;
	top: var(--hafez-float-y, 24px);
	transform: translateX(-50%);
}

@media (max-width: 781px) {
	.hafez-float--desktop {
		display: none !important;
	}
}

@media (min-width: 782px) {
	.hafez-float--mobile {
		display: none !important;
	}
}

.hafez-scroll-top {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: var(--hafez-scroll-size, 44px);
	min-height: var(--hafez-scroll-size, 44px);
	padding: 0;
	border: 0;
	border-radius: 999px;
	background: var(--hafez-scroll-bg, #111827);
	color: var(--hafez-scroll-icon, #fff);
	font: inherit;
	font-size: 13px;
	cursor: pointer;
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition:
		opacity 0.4s cubic-bezier(0.22, 1, 0.36, 1),
		transform 0.45s cubic-bezier(0.22, 1, 0.36, 1),
		visibility 0s linear 0.4s,
		background-color 0.2s ease;
}

.hafez-scroll-top--rounded {
	border-radius: 14px;
}

.hafez-scroll-top--square {
	border-radius: 4px;
}

.hafez-scroll-top--shadow {
	box-shadow: 0 10px 24px rgba(15, 23, 42, 0.22);
}

.hafez-scroll-top--slide:not(.is-visible) {
	transform: translateY(12px);
}

.hafez-float--bc.hafez-scroll-top--slide:not(.is-visible),
.hafez-float--tc.hafez-scroll-top--slide:not(.is-visible) {
	transform: translateX(-50%) translateY(12px);
}

.hafez-scroll-top--none {
	transition: none;
}

.hafez-scroll-top.is-visible {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
	transition-delay: 0s;
}

.hafez-float--bc.hafez-scroll-top.is-visible,
.hafez-float--tc.hafez-scroll-top.is-visible {
	transform: translateX(-50%);
}

.hafez-scroll-top:hover,
.hafez-scroll-top:focus-visible {
	background: var(--hafez-scroll-bg-hover, #1f2937);
}

.hafez-scroll-top:focus-visible {
	outline: 2px solid var(--hafez-scroll-icon, #fff);
	outline-offset: 3px;
}

.hafez-scroll-top__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 18px;
	height: 18px;
}

.hafez-scroll-top__icon svg,
.hafez-scroll-top__img {
	width: 18px;
	height: 18px;
	object-fit: contain;
}

.hafez-scroll-top__label {
	white-space: nowrap;
}

.hafez-scroll-top:has(.hafez-scroll-top__label) {
	width: auto;
	padding: 0 14px;
}

.hafez-contact {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
}

.hafez-contact__panel {
	position: absolute;
	display: flex;
	align-items: stretch;
	width: max-content;
	min-width: var(--hafez-contact-size, 44px);
	gap: 10px;
	visibility: hidden;
	pointer-events: none;
	transition: visibility 0s linear 0.55s;
}

.hafez-contact--up .hafez-contact__panel {
	bottom: calc(100% + 12px);
	flex-direction: column-reverse;
}

.hafez-contact--down .hafez-contact__panel {
	top: calc(100% + 12px);
	flex-direction: column;
}

.hafez-float--br .hafez-contact__panel,
.hafez-float--tr .hafez-contact__panel,
.hafez-contact--from-right .hafez-contact__panel {
	right: 0;
	left: auto;
}

.hafez-float--bl .hafez-contact__panel,
.hafez-float--tl .hafez-contact__panel,
.hafez-contact--from-left .hafez-contact__panel {
	left: 0;
	right: auto;
}

.hafez-float--bc .hafez-contact__panel,
.hafez-float--tc .hafez-contact__panel {
	left: 50%;
	right: auto;
	transform: translateX(-50%);
}

.hafez-contact.is-open .hafez-contact__panel {
	visibility: visible;
	pointer-events: auto;
	transition-delay: 0s;
}

.hafez-contact__item {
	display: flex;
	align-items: center;
	gap: 8px;
	width: 100%;
	box-sizing: border-box;
	color: inherit;
	text-decoration: none;
	opacity: 0;
	transform: translateY(16px) scale(0.86);
	transition:
		opacity 0.42s cubic-bezier(0.22, 1, 0.36, 1),
		transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
	transition-delay: calc((var(--n, 1) - var(--i, 0)) * 32ms);
}

.hafez-contact__item.is-preview {
	cursor: default;
}

/* Pin bubbles to the launcher edge so titles of different lengths stay aligned. */
.hafez-float--br .hafez-contact__item,
.hafez-float--tr .hafez-contact__item,
.hafez-contact--from-right .hafez-contact__item {
	flex-direction: row;
	justify-content: flex-end;
}

.hafez-float--bl .hafez-contact__item,
.hafez-float--tl .hafez-contact__item,
.hafez-contact--from-left .hafez-contact__item {
	flex-direction: row-reverse;
	justify-content: flex-end;
}

.hafez-float--bc .hafez-contact__item,
.hafez-float--tc .hafez-contact__item {
	display: grid;
	grid-template-columns: minmax(0, 1fr) var(--hafez-contact-size, 44px) minmax(0, 1fr);
	justify-content: initial;
	gap: 8px;
}

.hafez-float--bc .hafez-contact__title,
.hafez-float--tc .hafez-contact__title {
	grid-column: 1;
	justify-self: end;
}

.hafez-float--bc .hafez-contact__bubble,
.hafez-float--tc .hafez-contact__bubble {
	grid-column: 2;
}

.hafez-contact.is-open .hafez-contact__item {
	opacity: 1;
	transform: none;
	transition-delay: calc(var(--i, 0) * 55ms);
}

.hafez-contact__title {
	padding: 7px 12px;
	border-radius: 999px;
	background: var(--hafez-contact-title-bg, #fff);
	color: var(--hafez-contact-title-ink, #111827);
	font-size: 13px;
	line-height: 1.3;
	white-space: nowrap;
	box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
}

.hafez-contact--labels-hover .hafez-contact__title {
	opacity: 1;
}

@media (hover: hover) and (pointer: fine) {
	.hafez-contact--labels-hover .hafez-contact__title {
		opacity: 0;
		transform: translateX(8px);
		transition: opacity 0.25s ease, transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
	}

	.hafez-float--bl.hafez-contact--labels-hover .hafez-contact__title,
	.hafez-float--tl.hafez-contact--labels-hover .hafez-contact__title {
		transform: translateX(-8px);
	}

	.hafez-contact--labels-hover .hafez-contact__item:hover .hafez-contact__title,
	.hafez-contact--labels-hover .hafez-contact__item:focus-visible .hafez-contact__title {
		opacity: 1;
		transform: none;
	}
}

.hafez-contact__bubble,
.hafez-contact__launcher {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: var(--hafez-contact-size, 44px);
	height: var(--hafez-contact-size, 44px);
	border: 0;
	border-radius: 999px;
	box-shadow: 0 10px 24px rgba(15, 23, 42, 0.2);
}

.hafez-contact__bubble {
	flex: 0 0 var(--hafez-contact-size, 44px);
	background: var(--hafez-contact-bubble-bg, #111827);
	color: var(--hafez-contact-bubble-ink, #fff);
}

.hafez-contact__launcher {
	position: relative;
	background: var(--hafez-contact-bg, #111827);
	color: var(--hafez-contact-icon, #fff);
	cursor: pointer;
	transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), background-color 0.2s ease;
}

.hafez-contact__launcher:hover,
.hafez-contact__launcher:focus-visible {
	background: var(--hafez-contact-bg-hover, #1f2937);
	transform: translateY(-2px);
}

.hafez-contact__item:hover .hafez-contact__bubble,
.hafez-contact__item:focus-visible .hafez-contact__bubble {
	transform: translateY(-2px);
}

.hafez-contact__launcher:focus-visible,
.hafez-contact__item:focus-visible .hafez-contact__bubble {
	outline: 2px solid currentColor;
	outline-offset: 3px;
}

.hafez-contact__glyph {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: opacity 0.35s ease, transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.hafez-contact__glyph--close {
	opacity: 0;
	transform: rotate(-80deg) scale(0.55);
}

.hafez-contact.is-open .hafez-contact__glyph--open {
	opacity: 0;
	transform: rotate(80deg) scale(0.55);
}

.hafez-contact.is-open .hafez-contact__glyph--close {
	opacity: 1;
	transform: none;
}

.hafez-contact__img,
.hafez-contact__glyph svg {
	width: 20px;
	height: 20px;
	object-fit: contain;
}

.hafez-contact__letter {
	font-size: 14px;
	font-weight: 700;
	line-height: 1;
}

@media (prefers-reduced-motion: reduce) {
	.hafez-scroll-top,
	.hafez-contact__item,
	.hafez-contact__glyph,
	.hafez-contact__title,
	.hafez-contact__launcher,
	.hafez-contact__panel {
		transition: none !important;
	}
}
