/* Durable accessibility, responsive-content and overlay fixes. */

/* Kadence puts parent links inside a wrapper, not directly under .menu-item. */
@media (max-width: 1024px) {
	#mobile-drawer .mobile-navigation .drawer-nav-drop-wrap > a,
	#mobile-drawer .mobile-navigation .drawer-nav-drop-wrap > a:visited {
		display: flex;
		min-height: 50px;
		margin-bottom: 7px;
		padding: 11px 15px;
		align-items: center;
		border: 1px solid #e1e9f1;
		border-radius: 12px;
		background: #f7fafd;
		color: #18344f !important;
		font-weight: 700;
		line-height: 1.65;
	}

	#mobile-drawer .mobile-navigation .drawer-nav-drop-wrap > a:hover,
	#mobile-drawer .mobile-navigation .drawer-nav-drop-wrap > a:focus-visible {
		border-color: #075da8;
		background: #eaf4fc;
		color: #075da8 !important;
	}

	#mobile-drawer .drawer-nav-drop-wrap > .drawer-sub-toggle {
		min-width: 44px;
		min-height: 50px;
		color: #075da8 !important;
	}

	#mobile-drawer .drawer-nav-drop-wrap > .drawer-sub-toggle svg {
		fill: currentColor !important;
		stroke: currentColor !important;
	}

	#mobile-drawer .menu-toggle-close {
		min-width: 44px;
		min-height: 44px;
		padding: 8px;
	}
}

/* Long outlines stay useful instead of becoming a multi-screen wall. */
.methaly-toc-header {
	min-height: 44px;
	padding-block: 7px;
}

#methaly-toc-container .methaly-toc-list {
	max-height: min(65vh, 520px);
	max-height: min(65dvh, 520px);
	overflow-y: auto;
	overscroll-behavior: contain;
	scrollbar-color: #075da8 #e3edf6;
	scrollbar-width: thin;
}

.methaly-toc-list li {
	margin: 0;
}

.methaly-toc-list a {
	display: flex;
	min-height: 44px;
	padding: 7px 4px;
	align-items: center;
	line-height: 1.55;
}

.methaly-toc-list .methaly-level-3 {
	padding-inline-start: 1rem;
	font-size: 0.94em;
}

/* Media and legacy WordPress captions must never exceed the article column. */
.single-post .entry-content img,
.single-post .entry-content svg,
.single-post .entry-content video,
.single-post .entry-content iframe,
.single-post .entry-content figure,
.single-post .entry-content .wp-caption,
.single-post .entry-content [id^="attachment_"] {
	max-width: 100% !important;
}

.single-post .entry-content img,
.single-post .entry-content video {
	height: auto !important;
}

.single-post .entry-content .wp-caption,
.single-post .entry-content [id^="attachment_"] {
	width: auto !important;
	margin-inline: auto !important;
}

.single-post .entry-content .wp-caption img,
.single-post .entry-content [id^="attachment_"] img {
	display: block;
	margin-inline: auto;
}

.single-post .entry-content iframe {
	width: 100%;
	border: 0;
}

/* Tables remain inside the content column and communicate horizontal scroll. */
.single-post .entry-content .kayan-table-scroll {
	max-width: 100%;
	-webkit-overflow-scrolling: touch;
}

/* Rating is read-only on this site: expose one meaningful accessible object. */
#kayan-article-rating[role="img"] .kksr-stars {
	pointer-events: none;
}

/* Floating actions stay compact and never sit above navigation/dialogs. */
.cta-float-wrap {
	z-index: 8000 !important;
	transition: opacity 0.2s ease, visibility 0.2s ease;
}

body.showing-popup-drawer-from-right .cta-float-wrap,
body.popup-drawer-show .cta-float-wrap,
body.sp-modal-open .cta-float-wrap {
	pointer-events: none !important;
	visibility: hidden !important;
	opacity: 0 !important;
}

@media (max-width: 480px) {
	.cta-float-wrap {
		left: 10px !important;
		bottom: max(10px, env(safe-area-inset-bottom)) !important;
		flex-direction: row !important;
		gap: 10px !important;
	}

	.cta-fb__icon,
	.cta-ring {
		width: 50px !important;
		height: 50px !important;
	}

	.cta-fb__body {
		position: absolute !important;
		width: 1px !important;
		height: 1px !important;
		min-width: 0 !important;
		margin: -1px !important;
		padding: 0 !important;
		overflow: hidden !important;
		clip: rect(0 0 0 0) !important;
		clip-path: inset(50%) !important;
		white-space: nowrap !important;
	}

	.cta-fb,
	.cta-fb-outer {
		width: 50px !important;
		height: 50px !important;
	}
}

/* The partner dialog works on short landscape phones as well as portrait. */
.sp-modal {
	overflow-y: auto;
	overscroll-behavior: contain;
}

.sp-modal__card {
	max-height: calc(100vh - 26px);
	max-height: calc(100dvh - 26px);
	overflow-y: auto;
	overscroll-behavior: contain;
}

.sp-modal__close {
	width: 44px;
	height: 44px;
}

@media (max-height: 650px) {
	.sp-modal {
		padding: 10px;
		align-items: flex-start;
	}

	.sp-modal__card {
		padding: 24px 18px 18px;
	}

	.sp-modal__head {
		margin-bottom: 14px;
	}

	.sp-modal__logo {
		width: 52px;
		height: 52px;
		margin-bottom: 7px;
	}

	.sp-modal__logo img {
		width: 42px;
		height: 42px;
	}

	.sp-option {
		min-height: 56px;
		padding-block: 7px;
	}

	.sp-modal__options {
		gap: 6px;
		margin-bottom: 10px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.cta-ring,
	.cta-fb-outer--call {
		animation: none !important;
	}

	.cta-fb,
	.sp-modal__card,
	.sp-modal__backdrop {
		transition: none !important;
	}
}
