/**
 * Berke professional site tools.
 *
 * Search, quick actions, active states, accessibility,
 * footer principles and back-to-top.
 */

/* Consistent keyboard focus across custom header/footer tools. */
.berke-site-header :focus-visible,
.berke-site-footer :focus-visible,
.berke-search-dialog :focus-visible,
.berke-back-to-top:focus-visible {
	outline: 3px solid #4bb8dd !important;
	outline-offset: 3px !important;
}

/* Keep skip-link visible above the sticky header and admin bar. */
.berke-skip-link.screen-reader-text:focus {
	position: fixed;
	z-index: 100300;
	top: calc(var(--berke-admin-bar-offset, 0px) + 0.75rem);
	inset-inline-start: 0.75rem;
}

/* Desktop header tools. */
.berke-header-actions {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 0.42rem;
}

.berke-header-tool,
.berke-header-tool:hover,
.berke-header-tool:focus,
.berke-header-tool:focus-visible,
.berke-header-tool:active {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.9rem;
	height: 2.9rem;
	min-width: 2.9rem;
	min-height: 2.9rem;
	padding: 0 !important;
	color: #223d65 !important;
	text-decoration: none !important;
	background: #f1f8fb !important;
	background-image: none !important;
	border: 1px solid rgba(34, 61, 101, 0.12) !important;
	border-radius: 0.86rem !important;
	box-shadow: none !important;
	appearance: none;
	cursor: pointer;
	transition:
		color 160ms ease,
		background 160ms ease,
		border-color 160ms ease,
		transform 160ms ease !important;
}

.berke-header-tool:hover,
.berke-header-tool:focus-visible {
	color: #ffffff !important;
	background: #223d65 !important;
	border-color: #223d65 !important;
	transform: translateY(-1px);
}

.berke-header-tool svg {
	width: 1.14rem;
	height: 1.14rem;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.75;
	stroke-linecap: round;
	stroke-linejoin: round;
}

/* Strong but quiet current-page language in the services menu. */
@media (min-width: 64rem) {
	.berke-mega-menu.current-menu-parent > .berke-mega-menu__trigger::after {
		transform: scaleX(1);
	}

	.berke-mega-menu__list .current-menu-item > a {
		color: #173f55 !important;
		background: #eef8fb !important;
		border-color: rgba(75, 184, 221, 0.34) !important;
		border-inline-start: 3px solid #4bb8dd !important;
		box-shadow: none !important;
		transform: none !important;
	}

	.berke-mega-menu__column.is-current-column {
		border-color: rgba(75, 184, 221, 0.28) !important;
	}
}

/* Mobile drawer quick actions. */
.berke-mobile-quick-actions {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 0.55rem;
	margin-block-end: 0.62rem;
}

.berke-mobile-tool,
.berke-mobile-tool:hover,
.berke-mobile-tool:focus,
.berke-mobile-tool:focus-visible,
.berke-mobile-tool:active {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.48rem;
	min-height: 3rem;
	padding: 0.65rem 0.72rem !important;
	color: #223d65 !important;
	font-size: 0.78rem;
	font-weight: 700;
	text-decoration: none !important;
	background: #eef6f9 !important;
	background-image: none !important;
	border: 1px solid rgba(34, 61, 101, 0.11) !important;
	border-radius: 0.82rem !important;
	box-shadow: none !important;
	appearance: none;
	cursor: pointer;
}

.berke-mobile-tool:hover,
.berke-mobile-tool:focus-visible {
	color: #173f55 !important;
	background: #e4f2f7 !important;
	border-color: rgba(75, 184, 221, 0.36) !important;
}

.berke-mobile-tool__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	width: 1.85rem;
	height: 1.85rem;
	color: #187ca1;
	background: #ffffff;
	border-radius: 0.55rem;
}

.berke-mobile-tool svg {
	width: 0.95rem;
	height: 0.95rem;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.75;
	stroke-linecap: round;
	stroke-linejoin: round;
}

/* Search dialog. */
body.berke-search-open {
	overflow: hidden;
}

.berke-search-dialog[hidden] {
	display: none !important;
}

.berke-search-dialog {
	position: fixed;
	z-index: 100250;
	inset: 0;
	display: grid;
	align-items: start;
	justify-items: center;
	padding:
		calc(var(--berke-admin-bar-offset, 0px) + clamp(4.8rem, 11vh, 7.5rem))
		1rem
		1rem;
	overflow-y: auto;
	overscroll-behavior: contain;
}

.berke-search-dialog__backdrop {
	position: fixed;
	inset: 0;
	background: rgba(15, 36, 57, 0.78);
	backdrop-filter: blur(7px);
	-webkit-backdrop-filter: blur(7px);
	opacity: 0;
	transition: opacity 180ms ease;
}

.berke-search-dialog__panel {
	position: relative;
	z-index: 1;
	width: min(44rem, 100%);
	padding: clamp(1.35rem, 3.2vw, 2.3rem);
	color: #173f55;
	background:
		radial-gradient(
			circle at 10% 10%,
			rgba(75, 184, 221, 0.14),
			transparent 34%
		),
		#ffffff;
	border: 1px solid rgba(34, 61, 101, 0.12);
	border-radius: 1.35rem;
	box-shadow: 0 2rem 5rem rgba(9, 29, 47, 0.28);
	opacity: 0;
	transform: translateY(-0.75rem) scale(0.985);
	transition:
		opacity 180ms ease,
		transform 180ms ease;
}

.berke-search-dialog.is-open .berke-search-dialog__backdrop {
	opacity: 1;
}

.berke-search-dialog.is-open .berke-search-dialog__panel {
	opacity: 1;
	transform: translateY(0) scale(1);
}

.berke-search-dialog__close,
.berke-search-dialog__close:hover,
.berke-search-dialog__close:focus,
.berke-search-dialog__close:focus-visible,
.berke-search-dialog__close:active {
	position: absolute;
	top: 0.9rem;
	inset-inline-end: 0.9rem;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.65rem;
	height: 2.65rem;
	padding: 0 !important;
	color: #223d65 !important;
	background: #eef5f8 !important;
	background-image: none !important;
	border: 1px solid rgba(34, 61, 101, 0.1) !important;
	border-radius: 0.8rem !important;
	box-shadow: none !important;
	appearance: none;
	cursor: pointer;
}

.berke-search-dialog__close span {
	position: absolute;
	width: 1.05rem;
	height: 2px;
	background: currentColor;
	border-radius: 99px;
}

.berke-search-dialog__close span:first-child {
	transform: rotate(45deg);
}

.berke-search-dialog__close span:last-child {
	transform: rotate(-45deg);
}

.berke-search-dialog__eyebrow {
	display: inline-flex;
	align-items: center;
	min-height: 1.8rem;
	padding-inline: 0.68rem;
	margin-block-end: 0.72rem;
	color: #223d65;
	font-size: 0.7rem;
	font-weight: 700;
	background: rgba(75, 184, 221, 0.14);
	border: 1px solid rgba(75, 184, 221, 0.25);
	border-radius: 999px;
}

.berke-search-dialog h2 {
	max-width: calc(100% - 3.2rem);
	margin: 0;
	color: #173f55;
	font-size: clamp(1.3rem, 2.8vw, 1.9rem);
	font-weight: 800;
	line-height: 1.55;
	letter-spacing: -0.025em;
}

.berke-search-form {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	gap: 0.65rem;
	margin-block-start: 1.35rem;
}

.berke-search-form__field {
	width: 100%;
	min-width: 0;
	min-height: 3.55rem;
	padding: 0.78rem 1rem;
	color: #173f55;
	background: #f7fafc;
	border: 1px solid rgba(34, 61, 101, 0.15);
	border-radius: 0.92rem;
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.berke-search-form__field::placeholder {
	color: #78909f;
	opacity: 1;
}

.berke-search-form__field:focus {
	background: #ffffff;
	border-color: #4bb8dd;
	box-shadow: 0 0 0 0.23rem rgba(75, 184, 221, 0.12);
}

.berke-search-form__submit,
.berke-search-form__submit:hover,
.berke-search-form__submit:focus,
.berke-search-form__submit:focus-visible,
.berke-search-form__submit:active {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.48rem;
	min-height: 3.55rem;
	padding: 0.72rem 1.08rem !important;
	color: #ffffff !important;
	font-weight: 800;
	background: #223d65 !important;
	background-image: none !important;
	border: 1px solid #223d65 !important;
	border-radius: 0.92rem !important;
	box-shadow: 0 0.7rem 1.4rem rgba(34, 61, 101, 0.18) !important;
	appearance: none;
	cursor: pointer;
}

.berke-search-form__submit:hover,
.berke-search-form__submit:focus-visible {
	background: #182d4c !important;
}

.berke-search-form__submit > span:first-child {
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.berke-search-form__submit svg {
	width: 1rem;
	height: 1rem;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.8;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.berke-search-dialog__hint {
	margin: 0.78rem 0 0;
	color: #6b8392;
	font-size: 0.74rem;
	line-height: 1.75;
}

/* Footer trust principles. */
.berke-footer-principles {
	color: #ffffff;
	background: #102b43;
	border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.berke-footer-principles__grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
}

.berke-footer-principle {
	display: grid;
	grid-template-columns: 2.7rem minmax(0, 1fr);
	align-items: center;
	gap: 0.75rem;
	min-height: 6rem;
	padding: 1rem clamp(1rem, 2.4vw, 1.7rem);
	border-inline-start: 1px solid rgba(255, 255, 255, 0.08);
}

.berke-footer-principle:first-child {
	border-inline-start: 0;
}

.berke-footer-principle__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.7rem;
	height: 2.7rem;
	color: #4bb8dd;
	background: rgba(75, 184, 221, 0.09);
	border: 1px solid rgba(75, 184, 221, 0.13);
	border-radius: 0.78rem;
}

.berke-footer-principle svg {
	width: 1.18rem;
	height: 1.18rem;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.7;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.berke-footer-principle > div {
	display: grid;
	gap: 0.15rem;
}

.berke-footer-principle strong {
	color: #ffffff;
	font-size: 0.82rem;
	font-weight: 800;
	line-height: 1.6;
}

.berke-footer-principle > div > span {
	color: rgba(255, 255, 255, 0.58);
	font-size: 0.68rem;
	line-height: 1.65;
}

/* Back to top. */
.berke-back-to-top,
.berke-back-to-top:hover,
.berke-back-to-top:focus,
.berke-back-to-top:focus-visible,
.berke-back-to-top:active {
	position: fixed;
	z-index: 9990;
	inset-inline-start: max(1rem, env(safe-area-inset-left));
	inset-block-end: max(1rem, env(safe-area-inset-bottom));
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.95rem;
	height: 2.95rem;
	padding: 0 !important;
	color: #ffffff !important;
	background: #223d65 !important;
	background-image: none !important;
	border: 1px solid rgba(255, 255, 255, 0.15) !important;
	border-radius: 0.9rem !important;
	box-shadow: 0 0.85rem 1.8rem rgba(15, 36, 57, 0.24) !important;
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transform: translateY(0.7rem);
	appearance: none;
	cursor: pointer;
	transition:
		opacity 180ms ease,
		visibility 180ms ease,
		transform 180ms ease,
		background 160ms ease !important;
}

.berke-back-to-top.is-visible {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
	transform: translateY(0);
}

.berke-back-to-top:hover,
.berke-back-to-top:focus-visible {
	background: #4bb8dd !important;
}

.berke-back-to-top svg {
	width: 1.12rem;
	height: 1.12rem;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.8;
	stroke-linecap: round;
	stroke-linejoin: round;
}

body.berke-mobile-menu-open .berke-back-to-top,
body.berke-search-open .berke-back-to-top {
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
}

body.berke-font-iranyekan .berke-search-dialog,
body.berke-font-iranyekan .berke-search-dialog *:not(svg):not(path),
body.berke-font-iranyekan .berke-footer-principles,
body.berke-font-iranyekan .berke-footer-principles *:not(svg):not(path),
body.berke-font-iranyekan .berke-header-actions,
body.berke-font-iranyekan .berke-mobile-quick-actions {
	font-family: "IRANYekanX", Tahoma, Arial, sans-serif !important;
}

/* Header tools are desktop-only; mobile/tablet tools live inside the drawer. */
@media (max-width: 63.999rem) {
	.berke-header-actions {
		display: none !important;
	}

	.berke-footer-principles__grid {
		grid-template-columns: 1fr;
		padding-block: 0.35rem;
	}

	.berke-footer-principle {
		min-height: 4.8rem;
		border-inline-start: 0;
		border-bottom: 1px solid rgba(255, 255, 255, 0.07);
	}

	.berke-footer-principle:last-child {
		border-bottom: 0;
	}
}

@media (min-width: 48rem) and (max-width: 63.999rem) {
	.berke-footer-principles__grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
		padding-block: 0;
	}

	.berke-footer-principle {
		grid-template-columns: 2.45rem minmax(0, 1fr);
		min-height: 6.2rem;
		padding-inline: 0.8rem;
		border-inline-start: 1px solid rgba(255, 255, 255, 0.07);
		border-bottom: 0;
	}

	.berke-footer-principle:first-child {
		border-inline-start: 0;
	}

	.berke-footer-principle__icon {
		width: 2.45rem;
		height: 2.45rem;
	}

	.berke-footer-principle > div > span {
		display: none;
	}
}

@media (max-width: 47.999rem) {
	.berke-search-dialog {
		padding:
			calc(var(--berke-admin-bar-offset, 0px) + 4.4rem)
			0.7rem
			0.7rem;
	}

	.berke-search-dialog__panel {
		padding: 1.25rem;
		border-radius: 1.1rem;
	}

	.berke-search-dialog h2 {
		font-size: 1.22rem;
	}

	.berke-search-form {
		grid-template-columns: 1fr;
	}

	.berke-search-form__field,
	.berke-search-form__submit {
		min-height: 3.35rem;
	}

	.berke-back-to-top,
	.berke-back-to-top:hover,
	.berke-back-to-top:focus,
	.berke-back-to-top:focus-visible,
	.berke-back-to-top:active {
		width: 2.65rem;
		height: 2.65rem;
		border-radius: 0.78rem !important;
	}
}

@media (max-width: 23.5rem) {
	.berke-mobile-quick-actions {
		grid-template-columns: 1fr;
	}

	.berke-search-dialog__hint {
		display: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.berke-header-tool,
	.berke-search-dialog__backdrop,
	.berke-search-dialog__panel,
	.berke-back-to-top {
		transition: none !important;
	}
}
