/*
 * WID Announcement Popup
 * CSS mandiri (tanpa library). Semua selector memakai prefix .wid-ap.
 * Ubah warna/radius lewat variabel CSS di bawah ini.
 */

.wid-ap {
	--wid-ap-accent: #0f172a;
	--wid-ap-accent-hover: #1e293b;
	--wid-ap-accent-text: #ffffff;
	--wid-ap-surface: #ffffff;
	--wid-ap-title: #0f172a;
	--wid-ap-text: #475569;
	--wid-ap-overlay: rgba(15, 23, 42, 0.6);
	--wid-ap-radius: 16px;
	--wid-ap-focus: #2563eb;

	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	padding: 16px;
	padding:
		max(16px, env(safe-area-inset-top))
		max(16px, env(safe-area-inset-right))
		max(16px, env(safe-area-inset-bottom))
		max(16px, env(safe-area-inset-left));
	opacity: 0;
	transition: opacity 0.22s ease;
	font-family: inherit;
	font-size: 16px;
	line-height: 1.5;
	text-align: left;
	-webkit-text-size-adjust: 100%;
}

.wid-ap[hidden] {
	display: none !important;
}

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

.wid-ap.is-open {
	opacity: 1;
}

/* Backdrop */
.wid-ap .wid-ap__backdrop {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	background: var(--wid-ap-overlay);
}

/* Kotak dialog */
.wid-ap .wid-ap__dialog {
	position: relative;
	display: flex;
	width: 100%;
	max-width: 760px;
	max-height: calc(100vh - 32px);
	max-height: calc(100dvh - 32px);
	background: var(--wid-ap-surface);
	border-radius: var(--wid-ap-radius);
	box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
	transform: translateY(12px) scale(0.98);
	transition: transform 0.22s ease;
	outline: none;
}

.wid-ap.is-open .wid-ap__dialog {
	transform: none;
}

.wid-ap .wid-ap__dialog--no-image {
	max-width: 520px;
}

/* Area isi (ini yang bisa di-scroll jika layar pendek) */
.wid-ap .wid-ap__inner {
	display: flex;
	flex: 1 1 auto;
	min-width: 0;
	min-height: 0;
	overflow-y: auto;
	overscroll-behavior: contain;
	border-radius: inherit;
}

/* Gambar: proporsional, tidak terdistorsi */
.wid-ap .wid-ap__media {
	position: relative;
	flex: 0 0 42%;
	min-height: 300px;
	background: #e2e8f0;
}

.wid-ap .wid-ap__img {
	position: absolute;
	top: 0;
	left: 0;
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	margin: 0;
	border-radius: 0;
	object-fit: cover;
	object-position: center;
}

/* Teks */
.wid-ap .wid-ap__body {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	justify-content: center;
	min-width: 0;
	padding: 40px 36px;
}

.wid-ap .wid-ap__dialog--no-image .wid-ap__title {
	padding-right: 36px;
}

.wid-ap .wid-ap__title {
	margin: 0 0 12px;
	padding: 0;
	color: var(--wid-ap-title);
	font-family: inherit;
	font-size: clamp(1.25rem, 1rem + 1.2vw, 1.75rem);
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: normal;
	text-transform: none;
	overflow-wrap: anywhere;
}

.wid-ap .wid-ap__text {
	color: var(--wid-ap-text);
	font-size: 1rem;
	line-height: 1.6;
	overflow-wrap: anywhere;
}

.wid-ap .wid-ap__text p {
	margin: 0 0 0.75em;
	color: inherit;
	font-size: inherit;
	line-height: inherit;
}

.wid-ap .wid-ap__text p:last-child {
	margin-bottom: 0;
}

.wid-ap .wid-ap__text a {
	color: var(--wid-ap-title);
	text-decoration: underline;
}

/* Tombol CTA */
.wid-ap .wid-ap__cta {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	align-self: flex-start;
	min-height: 44px;
	margin: 24px 0 0;
	padding: 12px 24px;
	border: 0;
	border-radius: 10px;
	background: var(--wid-ap-accent);
	color: var(--wid-ap-accent-text);
	font-family: inherit;
	font-size: 1rem;
	font-weight: 600;
	line-height: 1.25;
	text-align: center;
	text-decoration: none;
	transition: background-color 0.15s ease;
}

.wid-ap .wid-ap__cta:hover,
.wid-ap .wid-ap__cta:focus {
	background: var(--wid-ap-accent-hover);
	color: var(--wid-ap-accent-text);
	text-decoration: none;
}

/* Tombol Close: area sentuh 44x44 px */
.wid-ap .wid-ap__close {
	position: absolute;
	top: 10px;
	right: 10px;
	z-index: 2;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.92);
	color: #0f172a;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
	line-height: 1;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
	transition: background-color 0.15s ease, transform 0.15s ease;
}

.wid-ap .wid-ap__close:hover {
	background: #ffffff;
	transform: scale(1.06);
}

.wid-ap .wid-ap__close:focus-visible,
.wid-ap .wid-ap__cta:focus-visible,
.wid-ap .wid-ap__text a:focus-visible {
	outline: 2px solid var(--wid-ap-focus);
	outline-offset: 2px;
}

/* Mobile */
@media (max-width: 640px) {
	.wid-ap .wid-ap__inner {
		flex-direction: column;
	}

	.wid-ap .wid-ap__media {
		flex: 0 0 auto;
		min-height: 0;
		aspect-ratio: 16 / 9;
	}

	.wid-ap .wid-ap__body {
		flex: 1 0 auto;
		justify-content: flex-start;
		padding: 20px 20px 24px;
	}

	.wid-ap .wid-ap__cta {
		align-self: stretch;
		width: 100%;
	}

	.wid-ap .wid-ap__dialog--no-image .wid-ap__body {
		padding-top: 28px;
	}
}

/* Hormati preferensi pengurangan gerakan */
@media (prefers-reduced-motion: reduce) {
	.wid-ap,
	.wid-ap .wid-ap__dialog,
	.wid-ap .wid-ap__close,
	.wid-ap .wid-ap__cta {
		transition: none;
	}

	.wid-ap .wid-ap__dialog {
		transform: none;
	}

	.wid-ap .wid-ap__close:hover {
		transform: none;
	}
}
