/* ==========================================================================
   Find Font — Frontend Widget Styles
   Light theme only. All rules scoped under .ff-widget.
   ========================================================================== */

/* ── Design tokens ─────────────────────────────────────────────────────── */
.ff-widget {
	--ff-bg:        #ffffff;
	--ff-surface:   #f9f9fb;
	--ff-surface2:  #f3f3f7;
	--ff-border:    #e4e4ec;
	--ff-border-hi: #c7c7dc;
	--ff-accent:    #2563eb;
	--ff-accent2:   #3b82f6;
	--ff-accent-bg: #eff6ff;
	--ff-text:      #111118;
	--ff-muted:     #6b7280;
	--ff-success:   #059669;
	--ff-warning:   #d97706;
	--ff-danger:    #dc2626;

	/* Category badge colors */
	--ff-serif-bg:    #eff6ff;   --ff-serif-text:    #1d4ed8;
	--ff-sans-bg:     #f0fdf4;   --ff-sans-text:     #15803d;
	--ff-script-bg:   #fdf4ff;   --ff-script-text:   #7e22ce;
	--ff-mono-bg:     #fffbeb;   --ff-mono-text:     #92400e;
	--ff-display-bg:  #fff1f2;   --ff-display-text:  #be123c;
	--ff-bold-bg:     #f5f3ff;   --ff-bold-text:     #5b21b6;
	--ff-light-bg:    #f9f9fb;   --ff-light-text:    #6b7280;

	/* Typography */
	--ff-font-display: 'Playfair Display', Georgia, serif;
	--ff-font-body:    'Plus Jakarta Sans', system-ui, sans-serif;
	--ff-font-mono:    'IBM Plex Mono', 'Courier New', monospace;

	/* Layout */
	--ff-radius:    10px;
	--ff-radius-sm: 6px;
	--ff-gap:       18px;
	--ff-shadow:    0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
	--ff-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.04);
}

/* ── Keyframes ──────────────────────────────────────────────────────────── */
@keyframes ff-float {
	0%, 100% { transform: translateY(0); }
	50%       { transform: translateY(-5px); }
}

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

@keyframes ff-slide-in {
	from { opacity: 0; transform: translateY(8px); }
	to   { opacity: 1; transform: translateY(0); }
}

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

/* ── Widget wrapper ─────────────────────────────────────────────────────── */
.ff-widget {
	background: #ffffff;
	border-radius: 18px;
	padding: 24px;
	max-width: 920px;
	margin: 0 auto;
	font-family: var(--ff-font-body);
	color: var(--ff-text);
	box-sizing: border-box;
	position: relative;
	box-shadow: 0 10px 35px rgba(15, 23, 42, 0.06);
}

.ff-widget *,
.ff-widget *::before,
.ff-widget *::after {
	box-sizing: border-box;
}

.ff-status[hidden],
.ff-results[hidden] {
	display: none !important;
}

/* ── Upload zone ────────────────────────────────────────────────────────── */
.ff-widget .ff-upload-zone {
	border: 1px dashed #d1d5db;
	border-radius: 14px;
	background: var(--ff-surface);
	padding: 40px 24px;
	text-align: center;
	cursor: pointer;
	transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
	position: relative;
}

.ff-widget .ff-upload-zone:hover,
.ff-widget .ff-upload-zone.ff-dragover {
	border-color: var(--ff-accent);
	background: var(--ff-accent-bg);
	box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.08);
}

.ff-widget .ff-file-input {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	opacity: 0;
	cursor: pointer;
}

.ff-widget .ff-upload-icon {
	font-size: 2.6rem;
	animation: ff-float 3s ease-in-out infinite;
	margin-bottom: 4px;
}

.ff-widget .ff-upload-text {
	font-family: var(--ff-font-display);
	font-style: italic;
	font-size: 1.05rem;
	color: var(--ff-text);
	margin: 10px 0 6px;
}

.ff-widget .ff-upload-hint {
	font-family: var(--ff-font-mono);
	font-size: 0.75rem;
	color: var(--ff-muted);
	margin: 0 0 16px;
}

/* ── Sample buttons ─────────────────────────────────────────────────────── */
.ff-widget .ff-samples {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	flex-wrap: wrap;
	position: relative;
	z-index: 1;
}

.ff-widget .ff-samples-label {
	font-size: 0.75rem;
	color: var(--ff-muted);
	margin-right: 6px;
}

.ff-widget .ff-sample-btn {
	background: white;
	border: 1px solid var(--ff-border);
	border-radius: 99px;
	padding: 5px 14px;
	font-size: 0.78rem;
	font-family: var(--ff-font-body);
	color: var(--ff-muted);
	cursor: pointer;
	transition: border-color 0.18s, color 0.18s, background 0.18s;
	position: relative;
	z-index: 2;
}

.ff-widget .ff-sample-btn:hover {
	border-color: var(--ff-accent);
	color: var(--ff-accent);
	background: var(--ff-accent-bg);
}

/* ── Status bar ─────────────────────────────────────────────────────────── */
.ff-widget .ff-status {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 16px;
	background: var(--ff-surface);
	border: 1px solid var(--ff-border);
	border-radius: 8px;
	margin-top: var(--ff-gap);
	animation: ff-fade-in 0.2s ease;
}

.ff-widget .ff-spinner {
	width: 16px;
	height: 16px;
	border: 2px solid var(--ff-border);
	border-top-color: var(--ff-accent);
	border-radius: 50%;
	animation: ff-spin 0.7s linear infinite;
	flex-shrink: 0;
}

.ff-widget .ff-status-text {
	font-family: var(--ff-font-mono);
	font-size: 0.82rem;
	color: var(--ff-muted);
}

/* ── Results ────────────────────────────────────────────────────────────── */
.ff-widget .ff-results {
	animation: ff-fade-in 0.3s ease;
}

.ff-widget .ff-results-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: var(--ff-gap);
	margin-top: var(--ff-gap);
}

.ff-widget .ff-col-left,
.ff-widget .ff-col-right {
	display: flex;
	flex-direction: column;
	gap: var(--ff-gap);
}

/* ── Cards ──────────────────────────────────────────────────────────────── */
.ff-widget .ff-card {
	background: var(--ff-bg);
	border: 1px solid var(--ff-border);
	border-radius: var(--ff-radius);
	padding: 20px;
	
}

.ff-widget .ff-card-title {
	font-size: 0.7rem;
	text-transform: uppercase;
	letter-spacing: 1.8px;
	color: var(--ff-muted);
	font-family: var(--ff-font-body);
	font-weight: 600;
	margin: 0 0 16px;
	padding: 0;
}

/* ── Preview canvas ─────────────────────────────────────────────────────── */
.ff-widget .ff-preview-canvas {
	width: 100%;
	border-radius: 7px;
	border: 1px solid var(--ff-border);
	display: block;
	background: var(--ff-surface2);
}

/* ── Metric rows ────────────────────────────────────────────────────────── */
.ff-widget .ff-metric-row {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 9px 0;
	border-bottom: 1px solid var(--ff-border);
}

.ff-widget .ff-metric-row:last-child {
	border-bottom: none;
}

.ff-widget .ff-metric-label {
	font-size: 0.83rem;
	color: var(--ff-muted);
	font-family: var(--ff-font-body);
}

.ff-widget .ff-metric-badge {
	padding: 3px 10px;
	border-radius: 99px;
	font-size: 0.78rem;
	font-weight: 600;
}

.ff-widget .ff-tag-serif   { background: var(--ff-serif-bg);   color: var(--ff-serif-text); }
.ff-widget .ff-tag-sans    { background: var(--ff-sans-bg);    color: var(--ff-sans-text); }
.ff-widget .ff-tag-script  { background: var(--ff-script-bg);  color: var(--ff-script-text); }
.ff-widget .ff-tag-mono    { background: var(--ff-mono-bg);    color: var(--ff-mono-text); }
.ff-widget .ff-tag-display { background: var(--ff-display-bg); color: var(--ff-display-text); }
.ff-widget .ff-tag-bold    { background: var(--ff-bold-bg);    color: var(--ff-bold-text); }
.ff-widget .ff-tag-neutral { background: var(--ff-light-bg);   color: var(--ff-light-text); }

/* ── Gauge bars ─────────────────────────────────────────────────────────── */
.ff-widget .ff-gauge-wrap {
	margin-bottom: 12px;
}

.ff-widget .ff-gauge-label-row {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	margin-bottom: 5px;
}

.ff-widget .ff-gauge-name {
	font-size: 0.8rem;
	color: var(--ff-text);
}

.ff-widget .ff-gauge-note {
	font-size: 0.72rem;
	color: var(--ff-muted);
	font-family: var(--ff-font-mono);
}

.ff-widget .ff-gauge-track {
	height: 6px;
	background: var(--ff-surface2);
	border-radius: 99px;
	overflow: hidden;
}

.ff-widget .ff-gauge-fill {
	height: 100%;
	background: linear-gradient(90deg, var(--ff-accent), var(--ff-accent2));
	border-radius: 99px;
	width: 0;
	transition: width 0.75s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── Font match cards ───────────────────────────────────────────────────── */
.ff-widget .ff-match {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 13px 15px;
	border: 1px solid var(--ff-border);
	border-radius: 9px;
	margin-bottom: 8px;
	background: var(--ff-bg);
	transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
	animation: ff-slide-in 0.35s ease both;
	animation-delay: calc(var(--i, 0) * 0.08s);
	cursor: default;
	flex-wrap: wrap;
}

.ff-widget .ff-match:last-child {
	margin-bottom: 0;
}

.ff-widget .ff-match:hover {
	border-color: var(--ff-border-hi);
	
	transform: translateX(2px);
}

.ff-widget .ff-match:first-child {
	border-color: var(--ff-accent);
	background: var(--ff-accent-bg);
	border-left: 3px solid var(--ff-accent);
	padding-left: 12px;
}

.ff-widget .ff-match-rank {
	width: 28px;
	height: 28px;
	border-radius: 50%;
	background: var(--ff-accent);
	color: #fff;
	font-size: 0.7rem;
	font-weight: 800;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}

.ff-widget .ff-match:first-child .ff-match-rank {
	background: linear-gradient(135deg, #1d4ed8, #3b82f6);
}

.ff-widget .ff-match-info {
	flex: 1;
	min-width: 0;
}

.ff-widget .ff-match-name {
	font-family: var(--ff-font-display);
	font-size: 1rem;
	font-weight: 600;
	color: var(--ff-text);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.ff-widget .ff-match-meta {
	font-family: var(--ff-font-mono);
	font-size: 0.72rem;
	color: var(--ff-muted);
	margin-top: 2px;
}

.ff-widget .ff-match-score {
	font-weight: 700;
	font-size: 0.85rem;
	color: var(--ff-accent);
	font-family: var(--ff-font-body);
	text-align: right;
	flex-shrink: 0;
}

.ff-widget .ff-match-bar {
	width: 100%;
	height: 3px;
	background: var(--ff-border);
	border-radius: 99px;
	overflow: hidden;
	margin-top: 4px;
	flex-basis: 100%;
}

.ff-widget .ff-match-bar-fill {
	height: 100%;
	background: var(--ff-accent);
	border-radius: 99px;
	width: 0;
	transition: width 0.75s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── Reset bar ──────────────────────────────────────────────────────────── */
.ff-widget .ff-reset-bar {
	margin-top: var(--ff-gap);
}

.ff-widget .ff-reset-btn {
	width: 100%;
	padding: 11px;
	border: 1px solid var(--ff-border);
	border-radius: 8px;
	background: white;
	color: var(--ff-muted);
	font-family: var(--ff-font-body);
	font-size: 0.88rem;
	cursor: pointer;
	transition: border-color 0.18s, color 0.18s, background 0.18s;
}

.ff-widget .ff-reset-btn:hover {
	border-color: var(--ff-accent);
	color: var(--ff-accent);
	background: var(--ff-accent-bg);
}

/* ── Attribution ────────────────────────────────────────────────────────── */
.ff-widget .ff-attribution {
	text-align: center;
	font-size: 0.72rem;
	color: var(--ff-muted);
	margin-top: 16px;
	font-family: var(--ff-font-body);
}

.ff-widget .ff-attribution a {
	color: var(--ff-accent);
	text-decoration: none;
}

.ff-widget .ff-attribution a:hover {
	text-decoration: underline;
}

/* ── Accessibility — focus rings ────────────────────────────────────────── */
.ff-widget button:focus-visible,
.ff-widget [tabindex="0"]:focus-visible {
	outline: 2px solid var(--ff-accent);
	outline-offset: 2px;
	border-radius: var(--ff-radius-sm);
}

/* ── Working canvas (hidden) ────────────────────────────────────────────── */
.ff-work-canvas {
	display: none;
	position: absolute;
	left: -9999px;
}

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
	.ff-widget {
		padding: 18px;
	}

	.ff-widget .ff-results-grid {
		grid-template-columns: 1fr;
	}

	.ff-widget .ff-upload-zone {
		padding: 28px 16px;
	}

	.ff-widget .ff-title {
		font-size: 1.3rem;
	}
}

@media (max-width: 400px) {
	.ff-widget {
		padding: 14px;
	}

	.ff-widget .ff-card {
		padding: 14px;
	}

	.ff-widget .ff-gauge-note {
		display: none;
	}

	.ff-widget .ff-title {
		font-size: 1.15rem;
	}

	.ff-widget .ff-subtitle {
		font-size: 0.75rem;
	}

	.ff-widget .ff-match-meta {
		font-size: 0.66rem;
	}
}
