/**
 * SA — Font Pairing Previewer widget, used only on
 * /tools/font-pairing-previewer/ (see the `data-sa-tool` markup rendered
 * by sa_font_pairing_shortcode() in inc/tools.php). Self-contained;
 * reuses the --tool-* tokens from tools.css, which is a declared
 * dependency so it always loads first.
 */

.sa-fp-previewer {
	background: #fff;
	border: 1px solid var(--tool-border);
	border-radius: 1rem;
	padding: 1.75rem;
	box-shadow: 0 14px 32px -20px rgba(23, 35, 61, 0.3);
	margin: 2rem 0;
}
@media (min-width: 768px) {
	.sa-fp-previewer {
		padding: 2.25rem;
	}
}

/* ==========================================================================
   Two-column layout on desktop: controls on the left, live preview on the
   right (sticky, so it stays visible while typing) — falls back to
   stacked (controls, then preview) below 992px. The CSS snippet always
   sits full-width underneath both columns.
   ========================================================================== */

.sa-fp-layout {
	display: block;
}
@media (min-width: 992px) {
	.sa-fp-layout {
		display: grid;
		grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
		align-items: start;
		gap: 2rem;
	}
}

.sa-fp-main {
	container-type: inline-size;
	min-width: 0;
}

.sa-fp-controls {
	display: grid;
	grid-template-columns: 1fr;
	gap: 1.25rem;
	margin-bottom: 1.25rem;
}
@container (min-width: 380px) {
	.sa-fp-controls {
		grid-template-columns: 1fr 1fr;
	}
}

.sa-fp-field {
	margin-bottom: 1.25rem;
}
.sa-fp-controls .sa-fp-field {
	margin-bottom: 0;
}
.sa-fp-field label {
	display: block;
	font-weight: 700;
	font-size: 0.85rem;
	color: var(--tool-ink);
	margin-bottom: 0.5rem;
}

.sa-fp-previewer select,
.sa-fp-previewer input[type="text"],
.sa-fp-previewer textarea {
	width: 100%;
	border: 1px solid var(--tool-border);
	border-radius: 0.6rem;
	padding: 0.65rem 0.85rem;
	font-family: inherit;
	font-size: 0.95rem;
	color: var(--tool-ink);
	background: #fff;
	resize: vertical;
}
.sa-fp-previewer select:focus,
.sa-fp-previewer input[type="text"]:focus,
.sa-fp-previewer textarea:focus {
	outline: none;
	border-color: var(--tool-yellow);
	box-shadow: 0 0 0 3px var(--tool-yellow-glow);
}

/* ==========================================================================
   Preview
   ========================================================================== */

.sa-fp-preview {
	position: relative;
	background: var(--tool-bg-alt);
	border-radius: 0.85rem;
	padding: 2rem 1.75rem;
	margin: 1.75rem 0 0;
	min-height: 8rem;
	display: flex;
	flex-direction: column;
	justify-content: center;
}
@media (min-width: 768px) {
	.sa-fp-preview {
		padding: 2.75rem 2.5rem;
	}
}
@media (min-width: 992px) {
	.sa-fp-preview {
		margin-top: 0;
		height: 100%;
		min-height: 20rem;
		position: sticky;
		top: 1.5rem;
	}
}

.sa-fp-preview__loading {
	position: absolute;
	top: 1rem;
	right: 1.25rem;
	font-size: 0.75rem;
	font-weight: 600;
	color: var(--tool-muted);
}

.sa-fp-preview__heading {
	margin: 0 0 0.85rem;
	font-size: 1.9rem;
	line-height: 1.25;
	color: var(--tool-ink);
	overflow-wrap: break-word;
}
@media (min-width: 768px) {
	.sa-fp-preview__heading {
		font-size: 2.5rem;
	}
}

.sa-fp-preview__body {
	margin: 0;
	font-size: 1.05rem;
	line-height: 1.7;
	color: var(--tool-ink);
	max-width: 42rem;
	overflow-wrap: break-word;
}

/* ==========================================================================
   CSS snippet
   ========================================================================== */

.sa-fp-css {
	margin-top: 1.75rem;
	padding-top: 1.75rem;
	border-top: 1px solid var(--tool-border);
}

.sa-fp-css__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	margin-bottom: 0.6rem;
}
.sa-fp-css__label {
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: var(--tool-muted);
}
.sa-fp-copy-btn {
	flex-shrink: 0;
	border: none;
	border-radius: 0.5rem;
	padding: 0.5rem 1rem;
	font-family: inherit;
	font-weight: 700;
	font-size: 0.82rem;
	white-space: nowrap;
	background: var(--tool-yellow);
	color: #14110a;
	cursor: pointer;
	transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.sa-fp-copy-btn:hover {
	box-shadow: 0 0 16px 2px var(--tool-yellow-glow);
	transform: translateY(-1px);
}

.sa-fp-css__code {
	background: var(--tool-ink);
	color: #e8ecf3;
	border-radius: 0.75rem;
	padding: 1rem 1.15rem;
	overflow: auto;
	margin: 0;
}
.sa-fp-css__code code {
	font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
	font-size: 0.8rem;
	line-height: 1.55;
	white-space: pre;
}

.sa-fp-copy-status {
	display: block;
	margin-top: 0.5rem;
	font-size: 0.82rem;
	color: #2e7d32;
	min-height: 1.2em;
}
