/* WP Stories — public bar, viewer, and upload dialog. */

.wpst {
	--wpst-bg: #f6f4f2;
	--wpst-ink: #252e3a;
	--wpst-label: #2c2426;
	--wpst-link: #c51632;
	--wpst-ring: linear-gradient(200deg, #ff9a3c 0%, #ff4b6e 30%, #e23cae 62%, #7b3ff0 100%);
	--wpst-ring-add: linear-gradient(180deg, #ffb25a 0%, #ff6d3a 46%, #ff3f6e 100%);
	--wpst-size: 78px;
	color: var(--wpst-ink);
	font-family: inherit;
	line-height: 1.4;
	-webkit-font-smoothing: antialiased;
}

.wpst *,
.wpst-viewer *,
.wpst-modal * {
	box-sizing: border-box;
}

.wpst[dir="rtl"],
.wpst-viewer[dir="rtl"],
.wpst-modal[dir="rtl"] {
	font-family: Tahoma, "Noto Naskh Arabic", "Noto Sans Arabic", sans-serif;
}

.wpst-bar {
	background: var(--wpst-bg);
	border-radius: 20px;
	padding: 16px 18px 14px;
}

.wpst-bar__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	margin: 0 0 12px;
}

.wpst .wpst-bar__title {
	margin: 0;
	padding: 0;
	color: var(--wpst-ink);
	font-family: inherit;
	font-size: 22px;
	font-weight: 800;
	letter-spacing: -0.02em;
	line-height: 1.2;
}

.wpst button.wpst-bar__all {
	cursor: pointer;
	box-shadow: none;
	font-size: 20px;
	font-weight: 700;
	display: inline-flex;
	align-items: center;
	gap: 5px;
	transition: all 300ms ease 0s;
	-webkit-transition: all 300ms ease 0s;
	-moz-transition: all 300ms ease 0s;
	color: #d90f12;
	text-decoration: none;
	background-color: transparent;
	border: 0;
	line-height: 1.5;
	font-family: "Adobe Arabic";
}
.wpst button.wpst-bar__all:hover svg {
	transform: translateX(-4px);
}
.wpst button.wpst-bar__all svg {
	transition: transform 0.3s ease;
}
.wpst-chevron {
	display: block;
}

.wpst[dir="rtl"] .wpst-chevron {
	transform: scaleX(-1);
}

.wpst-bar__scroller {
	display: flex;
	align-items: flex-start;
	gap: 18px;
	overflow-x: auto;
	padding: 2px 2px 4px;
	scroll-behavior: smooth;
	scrollbar-width: none;
}

.wpst-bar__scroller::-webkit-scrollbar {
	display: none;
}

.wpst-slot {
	position: relative;
	flex: 0 0 auto;
	width: var(--wpst-size);
}

.wpst button.wpst-item {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	width: var(--wpst-size);
	margin: 0;
	padding: 0;
	border: 0;
	background: transparent;
	color: inherit;
	text-align: center;
	cursor: pointer;
	box-shadow: none;
	appearance: none;
	font-family: "Adobe Arabic";
}

.wpst-ring {
	display: block;
	width: var(--wpst-size);
	height: var(--wpst-size);
	padding: 3px;
	border-radius: 50%;
	background: var(--wpst-ring);
	transition: transform 0.18s ease;
}

.wpst-item:hover .wpst-ring,
.wpst-item:focus-visible .wpst-ring {
	transform: scale(1.04);
}

.wpst-item:focus-visible {
	outline: none;
}

.wpst-item:focus-visible .wpst-ring {
	outline: 2px solid #7b3ff0;
	outline-offset: 3px;
}

.wpst-item.is-seen .wpst-ring {
	background: #c4bdb8;
}

.wpst-item.is-pending .wpst-ring {
	background: linear-gradient(160deg, #f0b45a 0%, #e08a32 55%, #e7dfd8 55%, #e7dfd8 100%);
}

.wpst-item--add .wpst-ring {
	background: var(--wpst-ring-add);
}

.wpst-ring__gap {
	display: block;
	width: 100%;
	height: 100%;
	padding: 3px;
	border-radius: 50%;
	background: var(--wpst-bg);
}

.wpst-ring__photo,
.wpst-plus {
	display: block;
	width: 100%;
	height: 100%;
	border-radius: 50%;
	object-fit: cover;
	background: #fff;
}

.wpst-plus {
	display: grid;
	place-items: center;
	color: #1c1c1c;
}

.wpst-label {
	display: -webkit-box;
	max-width: 100%;
	overflow: hidden;
	color: var(--wpst-label);
	font-size: 18px;
	font-weight: 600;
	line-height: 1.25;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
}

.wpst button.wpst-badge {
	position: absolute;
	top: calc(var(--wpst-size) - 22px);
	inset-inline-end: -2px;
	z-index: 2;
	display: grid;
	place-items: center;
	width: 26px;
	height: 26px;
	margin: 0;
	padding: 0;
	border: 2px solid var(--wpst-bg);
	border-radius: 50%;
	background: #fff;
	color: #1c1c1c;
	cursor: pointer;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.14);
}

.wpst button.wpst-badge:hover,
.wpst button.wpst-badge:focus-visible {
	background: #fff7f2;
}

.wpst-empty {
	margin: 2px 2px 0;
	color: #6d645f;
	font-size: 14px;
}

.wpst [hidden],
.wpst-viewer [hidden],
.wpst-modal [hidden],
.wpst-viewer[hidden],
.wpst-modal[hidden] {
	display: none !important;
}

.wpst-viewer.is-rtl .wpst-viewer__nav svg {
	transform: scaleX(-1);
}

/* Viewer */

html.wpst-lock,
html.wpst-lock body {
	overflow: hidden;
}

.wpst-viewer {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
	background: rgba(12, 10, 10, 0.9);
	animation: wpst-fade 0.2s ease;
}

.wpst-viewer__stage {
	display: flex;
	align-items: center;
	gap: 16px;
	max-width: 100%;
}

.wpst-viewer__card {
	position: relative;
	width: min(400px, 92vw, calc((100vh - 48px) * 9 / 16));
	height: min(calc(100vh - 48px), calc(min(400px, 92vw) * 16 / 9));
	overflow: hidden;
	border-radius: 16px;
	background: #111;
	box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
	user-select: none;
	touch-action: none;
}

.wpst-viewer button.wpst-viewer__nav {
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.16);
	color: #fff;
	cursor: pointer;
	box-shadow: none;
}

.wpst-viewer button.wpst-viewer__nav:hover,
.wpst-viewer button.wpst-viewer__nav:focus-visible {
	background: rgba(255, 255, 255, 0.3);
}

.wpst-viewer button.wpst-viewer__nav:disabled {
	opacity: 0.35;
	cursor: default;
}

.wpst-viewer__progress {
	position: absolute;
	top: 0;
	right: 0;
	left: 0;
	z-index: 5;
	display: flex;
	gap: 4px;
	padding: 10px 10px 0;
	direction: ltr;
	pointer-events: none;
}

.wpst-progress__bar {
	flex: 1 1 0;
	height: 3px;
	overflow: hidden;
	border-radius: 99px;
	background: rgba(255, 255, 255, 0.35);
}

.wpst-progress__fill {
	display: block;
	width: 100%;
	height: 100%;
	background: #fff;
	transform: scaleX(0);
	transform-origin: left center;
}

.wpst-viewer__top {
	position: absolute;
	top: 0;
	right: 0;
	left: 0;
	z-index: 4;
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 22px 12px 36px;
	background: linear-gradient(rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0));
	color: #fff;
	pointer-events: none;
}

.wpst-viewer__avatar {
	flex: 0 0 auto;
	width: 34px;
	height: 34px;
	padding: 2px;
	border-radius: 50%;
	background: var(--wpst-ring);
}

.wpst-viewer__avatar img {
	display: block;
	width: 100%;
	height: 100%;
	border-radius: 50%;
	object-fit: cover;
	background: #222;
}

.wpst-viewer__who {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.wpst-viewer__name {
	overflow: hidden;
	font-size: 14px;
	font-weight: 700;
	line-height: 1.2;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.wpst-viewer__time {
	font-size: 12px;
	line-height: 1.2;
	opacity: 0.85;
}

.wpst-viewer__status {
	display: inline-block;
	width: fit-content;
	margin-top: 4px;
	padding: 2px 8px;
	border-radius: 99px;
	background: rgba(255, 255, 255, 0.2);
	font-size: 11px;
	font-weight: 600;
}

.wpst-viewer__actions {
	display: flex;
	gap: 4px;
	margin-inline-start: auto;
	pointer-events: auto;
}

.wpst-viewer button.wpst-viewer__icon {
	display: grid;
	place-items: center;
	width: 34px;
	height: 34px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: #fff;
	cursor: pointer;
	box-shadow: none;
}

.wpst-viewer button.wpst-viewer__icon:hover,
.wpst-viewer button.wpst-viewer__icon:focus-visible {
	background: rgba(255, 255, 255, 0.16);
}

.wpst-viewer__pause .icon-play {
	display: none;
}

.wpst-viewer.is-paused .wpst-viewer__pause .icon-pause {
	display: none;
}

.wpst-viewer.is-paused .wpst-viewer__pause .icon-play {
	display: block;
}

.wpst-viewer__media {
	position: absolute;
	inset: 0;
	background: #111;
}

.wpst-viewer__img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	animation: wpst-pop 0.28s ease;
	-webkit-user-drag: none;
}

.wpst-viewer__media.is-loading .wpst-viewer__img {
	opacity: 0;
}

.wpst-viewer__media.is-loading::after {
	content: "";
	position: absolute;
	inset: 0;
	width: 34px;
	height: 34px;
	margin: auto;
	border: 3px solid rgba(255, 255, 255, 0.28);
	border-top-color: #fff;
	border-radius: 50%;
	animation: wpst-spin 0.7s linear infinite;
}

.wpst-viewer__caption {
	position: absolute;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 3;
	margin: 0;
	padding: 56px 16px 22px;
	background: linear-gradient(transparent, rgba(0, 0, 0, 0.72));
	color: #fff;
	font-size: 15px;
	line-height: 1.45;
	pointer-events: none;
}

.wpst-viewer__confirm {
	position: absolute;
	right: 12px;
	bottom: 12px;
	left: 12px;
	z-index: 6;
	padding: 14px;
	border-radius: 14px;
	background: rgba(20, 16, 16, 0.92);
	color: #fff;
}

.wpst-viewer__confirm-text {
	margin: 0 0 12px;
	font-size: 14px;
}

.wpst-viewer__confirm-actions {
	display: flex;
	justify-content: flex-end;
	gap: 8px;
}

/* Upload dialog */

.wpst-modal {
	position: fixed;
	inset: 0;
	z-index: 100001;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	background: rgba(12, 10, 10, 0.72);
	animation: wpst-fade 0.2s ease;
}

.wpst-modal__dialog {
	position: relative;
	width: min(520px, 100%);
	max-height: min(88vh, 760px);
	overflow: auto;
	padding: 28px 24px 22px;
	border-radius: 20px;
	background: #f6f4f2;
	color: var(--wpst-ink, #252e3a);
	box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

.wpst-modal__dialog h2 {
	margin: 0 36px 8px 0;
	color: #252e3a;
	font-family: inherit;
	font-size: 22px;
	font-weight: 800;
	line-height: 1.2;
}

.wpst-modal[dir="rtl"] .wpst-modal__dialog h2 {
	margin: 0 0 8px 36px;
}

.wpst-modal__lead,
.wpst-drop__hint,
.wpst-modal__error,
.wpst-modal__success {
	margin: 0 0 14px;
	font-size: 14px;
	line-height: 1.45;
}

.wpst-modal__lead,
.wpst-drop__hint {
	color: #5e564f;
}

.wpst-modal button.wpst-modal__close {
	position: absolute;
	top: 14px;
	inset-inline-end: 14px;
	display: grid;
	place-items: center;
	width: 34px;
	height: 34px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: #252e3a;
	cursor: pointer;
	box-shadow: none;
}

.wpst-modal button.wpst-modal__close:hover,
.wpst-modal button.wpst-modal__close:focus-visible {
	background: rgba(0, 0, 0, 0.06);
}

.wpst-drop {
	padding: 28px 16px;
	border: 1.5px dashed #e0d5cc;
	border-radius: 16px;
	background: #fff;
	text-align: center;
}

.wpst-drop.is-over {
	border-color: #e23cae;
	background: #fff7fb;
}

.wpst-drop__title {
	margin: 0;
	font-size: 15px;
	font-weight: 600;
}

.wpst-modal button.wpst-link {
	margin: 0;
	padding: 0;
	border: 0;
	background: transparent;
	color: #c51632;
	font: inherit;
	font-weight: 700;
	cursor: pointer;
	box-shadow: none;
}

.wpst-previews {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
	gap: 12px;
	margin-top: 14px;
}

.wpst-preview {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 8px;
	border-radius: 14px;
	background: #fff;
}

.wpst-preview img {
	width: 100%;
	height: 160px;
	border-radius: 10px;
	object-fit: cover;
	background: #eee;
}

.wpst-preview input[type="text"] {
	width: 100%;
	margin: 0;
	padding: 8px 10px;
	border: 1px solid #e6ddd6;
	border-radius: 8px;
	background: #fff;
	color: #252e3a;
	font: inherit;
	font-size: 13px;
}

.wpst-modal button.wpst-preview__remove {
	align-self: flex-start;
	margin: 0;
	padding: 0;
	border: 0;
	background: transparent;
	color: #8a4038;
	font: inherit;
	font-size: 12px;
	font-weight: 600;
	cursor: pointer;
	box-shadow: none;
}

.wpst-modal__error {
	color: #a32032;
}

.wpst-modal__success {
	color: #1d7a45;
}

.wpst-modal__actions {
	display: flex;
	justify-content: flex-end;
	margin-top: 8px;
}

.wpst-modal button.wpst-btn,
.wpst-viewer button.wpst-btn {
	margin: 0;
	padding: 11px 18px;
	border: 0;
	border-radius: 999px;
	background: linear-gradient(135deg, #ff8a3d, #e23cae 70%, #7b3ff0);
	color: #fff;
	font-family: inherit;
	font-size: 14px;
	font-weight: 700;
	line-height: 1;
	cursor: pointer;
	box-shadow: none;
}

.wpst-modal button.wpst-btn:disabled {
	opacity: 0.45;
	cursor: default;
}

.wpst-viewer button.wpst-btn--ghost,
.wpst-modal button.wpst-btn--ghost {
	background: transparent;
	color: #fff;
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4);
}

.wpst-viewer button.wpst-btn--danger {
	background: #d21f35;
}

@media (max-width: 700px) {
	.wpst-bar {
		padding: 14px 12px 12px;
		border-radius: 16px;
	}

	.wpst .wpst-bar__title {
		font-size: 18px;
	}

	.wpst {
		--wpst-size: 68px;
	}

	.wpst-viewer {
		padding: 0;
	}

	.wpst-viewer__nav {
		display: none;
	}

	.wpst-viewer__stage {
		width: 100%;
		height: 100%;
		gap: 0;
	}

	.wpst-viewer__card {
		width: 100%;
		height: 100%;
		border-radius: 0;
	}
}

@media (prefers-reduced-motion: reduce) {
	.wpst-viewer,
	.wpst-modal,
	.wpst-viewer__img,
	.wpst-ring,
	.wpst-viewer__media.is-loading::after {
		animation: none;
		transition: none;
	}
}

@keyframes wpst-fade {
	from { opacity: 0; }
	to { opacity: 1; }
}

@keyframes wpst-pop {
	from { opacity: 0.35; transform: scale(1.015); }
	to { opacity: 1; transform: none; }
}

@keyframes wpst-spin {
	to { transform: rotate(360deg); }
}
