/**
 * RelevantFlow frontend styles (SLAI-12 design system).
 *
 * Follows the theme by default: text, font and link colours are inherited,
 * and borders and card tints use translucent grey that works on light and
 * dark themes. The --atlas-ai-rf-* custom properties are the public styling
 * API (set from the Appearance settings; safe to override in custom CSS).
 */

.atlas-ai-rf-container {
	margin: 2em 0;
	padding: 1.5em 0;
	border-top: 1px solid var(--atlas-ai-rf-border, rgba(127, 127, 127, 0.3));
	background: var(--atlas-ai-rf-bg, transparent);
	color: var(--atlas-ai-rf-text, inherit);
}

.atlas-ai-rf-title {
	font-size: 1.25em;
	font-weight: 600;
	line-height: 1.3;
	margin: 0 0 1em;
	color: var(--atlas-ai-rf-heading, inherit);
}

/* Cards template */
.atlas-ai-rf-cards {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
	gap: 1em;
}

/* List template */
.atlas-ai-rf-list {
	display: flex;
	flex-direction: column;
	gap: 0.75em;
}

.atlas-ai-rf-list .atlas-ai-rf-item {
	display: flex;
	flex-direction: row;
	align-items: center;
	gap: 1em;
}

.atlas-ai-rf-list .atlas-ai-rf-thumb {
	width: 96px;
	height: 72px;
	flex-shrink: 0;
}

/* Grid template */
.atlas-ai-rf-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
	gap: 0.75em;
}

/* Shared item styles */
.atlas-ai-rf-item {
	display: block;
	text-decoration: none;
	color: var(--atlas-ai-rf-text, inherit);
	border-radius: var(--atlas-ai-rf-border-radius, 12px);
	overflow: hidden;
	background: var(--atlas-ai-rf-card-bg, rgba(127, 127, 127, 0.06));
	border: 1px solid var(--atlas-ai-rf-border, rgba(127, 127, 127, 0.3));
	transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.atlas-ai-rf-item:hover {
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
	transform: translateY(-2px);
	text-decoration: none;
	border-color: var(--atlas-ai-rf-accent, currentColor);
}

.atlas-ai-rf-item:hover .atlas-ai-rf-item-title {
	color: var(--atlas-ai-rf-accent, inherit);
	text-decoration: underline;
	text-underline-offset: 0.15em;
}

.atlas-ai-rf-item:focus-visible {
	outline: 2px solid var(--atlas-ai-rf-accent, currentColor);
	outline-offset: 2px;
}

.atlas-ai-rf-thumb {
	width: 100%;
	height: auto;
	aspect-ratio: 16 / 9;
	object-fit: cover;
	display: block;
}

.atlas-ai-rf-content {
	padding: 0.75em;
}

.atlas-ai-rf-item-title {
	font-size: 0.95em;
	font-weight: 600;
	margin: 0 0 0.25em;
	color: var(--atlas-ai-rf-heading, inherit);
	line-height: 1.35;
}

.atlas-ai-rf-excerpt {
	font-size: 0.85em;
	color: var(--atlas-ai-rf-excerpt-color, inherit);
	opacity: 0.85;
	margin: 0;
	line-height: 1.5;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.atlas-ai-rf-fallback {
	opacity: 0.7;
	font-style: italic;
	font-size: 0.875em;
}

/* Responsive */
@media (max-width: 640px) {

	.atlas-ai-rf-cards,
	.atlas-ai-rf-grid {
		grid-template-columns: 1fr;
	}

	.atlas-ai-rf-list .atlas-ai-rf-thumb {
		width: 80px;
		height: 60px;
	}
}

@media (prefers-reduced-motion: reduce) {

	.atlas-ai-rf-item,
	.atlas-ai-rf-item:hover {
		transition: none;
		transform: none;
	}
}

/* Reserve space while the list loads (was an inline style). */
.atlas-ai-rf-container:empty {
	min-height: 200px;
}
