/**
 * Social Card Generator — semua style di-scope .scg-*.
 * Tidak ada styling global (button/img/canvas/body/h1) kecuali
 * body.scg-modal-open saat modal terbuka.
 */

/* ---------------------------------------------------------- Tombol */
.scg-button {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 10px 18px;
	border-radius: 999px;
	border: 1px solid transparent;
	cursor: pointer;
	line-height: 1.4;
	text-decoration: none;
}

.scg-button__icon {
	flex: none;
}

.scg-button--auto {
	font-family: inherit;
	font-size: inherit;
	background: transparent;
	border-color: currentColor;
	color: inherit;
}

.scg-button--auto:hover {
	opacity: 0.8;
}

.scg-button--minimal {
	background: #fff;
	border-color: #d7dce1;
	color: #1d2327;
	font-size: 14px;
}

.scg-button--minimal:hover {
	border-color: #1d2327;
}

.scg-button--branded {
	background: var(--scg-primary, #1d4ed8);
	border-color: var(--scg-primary, #1d4ed8);
	color: #fff;
	font-size: 14px;
	font-weight: 600;
}

.scg-button--branded:hover {
	filter: brightness(0.92);
}

.scg-button--icon-only {
	padding: 10px;
}

.scg-auto-slot,
.scg-shortcode-slot {
	margin: 24px 0;
	overflow: visible;
}

/* Penjaga visibilitas mobile (scoped, tanpa !important):
   - Spesifisitas ganda .scg-button.scg-button mengalahkan aturan umum
     theme seperti `button { ... }` tanpa merusak theme.
   - Slot auto/fallback selalu visible; bila theme menyembunyikan
     target desktop (display:none pada mobile / overflow-x clip),
     JS memindahkan tombol ke .scg-auto-slot--fallback di bawah. */
.scg-auto-slot .scg-button.scg-button,
.scg-shortcode-slot .scg-button.scg-button,
.scg-auto-slot--fallback .scg-button.scg-button {
	display: inline-flex;
	visibility: visible;
	opacity: 1;
	max-width: 100%;
}

.scg-auto-slot--fallback {
	margin: 24px 0;
	overflow: visible;
}

@media (max-width: 640px) {
	.scg-auto-slot,
	.scg-shortcode-slot,
	.scg-auto-slot--fallback {
		width: 100%;
	}

	.scg-auto-slot .scg-button.scg-button,
	.scg-auto-slot--fallback .scg-button.scg-button {
		flex-wrap: wrap;
	}
}

/* ----------------------------------------------------------- Modal */
.scg-modal[hidden] {
	display: none !important;
}

.scg-modal {
	position: fixed;
	inset: 0;
	z-index: 99990;
	display: flex;
	align-items: center;
	justify-content: center;
}

.scg-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(5, 5, 7, 0.9);
}

.scg-modal__dialog {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
	width: min(92vw, 460px);
	max-height: 92dvh;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 20px 18px 18px;
	background: #fff;
	color: #1d2327;
	border-radius: 12px;
}

.scg-modal__close {
	position: absolute;
	top: 10px;
	right: 10px;
	width: 40px;
	height: 40px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: 0;
	border-radius: 50%;
	background: #f0f0f1;
	color: inherit;
	cursor: pointer;
}

.scg-modal__close:hover {
	background: #dcdcde;
}

.scg-modal__title {
	margin: 0;
	padding-right: 44px;
	font-size: 20px;
	align-self: flex-start;
}

.scg-modal__status {
	margin: 0;
	font-size: 14px;
	color: #646970;
	align-self: flex-start;
}

.scg-modal__status:empty {
	display: none;
}

.scg-preview[hidden] {
	display: none;
}

.scg-preview img {
	display: block;
	width: 100%;
	height: auto;
	border-radius: 8px;
	border: 1px solid #dcdcde;
}

.scg-modal__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	justify-content: center;
}

.scg-btn {
	padding: 10px 18px;
	border-radius: 999px;
	border: 1px solid #1d2327;
	background: #fff;
	color: #1d2327;
	cursor: pointer;
	font-size: 14px;
}

.scg-btn--primary {
	background: var(--scg-primary, #1d4ed8);
	border-color: var(--scg-primary, #1d4ed8);
	color: #fff;
	font-weight: 600;
}

.scg-btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

body.scg-modal-open {
	overflow: hidden;
}

@media (max-width: 600px) {
	.scg-modal {
		align-items: stretch;
	}

	.scg-modal__dialog {
		width: 100%;
		max-height: 100dvh;
		height: 100dvh;
		border-radius: 0;
		justify-content: flex-start;
		padding-top: 60px;
	}

	.scg-preview img {
		max-height: 62dvh;
		width: auto;
		max-width: 100%;
		margin-inline: auto;
		object-fit: contain;
	}
}
