/**
 * Home Page — Word Search Section (Explorer par mot-clé)
 *
 * Grid of letters with hidden keywords that highlight on hover.
 * Hidden on screens smaller than 768px.
 *
 * Dependencies: home-base.css, child theme design tokens
 *
 * @package BlockskyChild
 */

/* ============================================
   HIDE ON SMALL SCREENS
   ============================================ */

.home-wordsearch {
	display: none;
}

@media (min-width: 768px) {
	.home-wordsearch {
		display: block;
	}
}

/* ============================================
   SECTION BACKGROUND
   ============================================ */

.home-wordsearch {
	--section-bg: var(--color-bg-primary);
}

/* ============================================
   HEADER
   ============================================ */

.home-wordsearch__header {
	text-align: center;
	margin-bottom: var(--spacing-xl);
}

.home-wordsearch__kicker {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--color-accent);
	margin-bottom: 1rem;
}

.home-wordsearch__kicker-dot {
	display: inline-block;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--color-accent);
}

.home-wordsearch__title {
	font-size: clamp(1.8rem, 4vw, 2.8rem);
	font-weight: 800;
	line-height: 1.1;
	letter-spacing: -0.02em;
	color: var(--color-text-primary);
	margin: 0 0 1rem;
}

.home-wordsearch__desc {
	font-size: var(--font-size-base);
	color: var(--color-text-secondary);
	line-height: 1.6;
	max-width: 560px;
	margin: 0 auto;
}

/* ============================================
   GRID
   ============================================ */

.home-wordsearch__grid-wrap {
	display: flex;
	justify-content: center;
}

.home-wordsearch__grid {
	display: grid;
	/* grid-template-columns & grid-template-rows set inline */
	width: 100%;
	max-width: 740px;
	user-select: none;
}

/* ============================================
   LETTER CELLS
   ============================================ */

.home-wordsearch__cell {
	/* grid-row & grid-column set inline */
	z-index: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	font-family: ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Consolas, 'Courier New', monospace;
	font-size: clamp(0.85rem, 1.6vw, 1.15rem);
	font-weight: 700;
	color: var(--color-text-muted);
	aspect-ratio: 1;
	cursor: default;
	transition: color 0.2s ease;
}

/* Word cells get a pointer cursor */
.home-wordsearch__cell[data-word] {
	cursor: pointer;
}

/* Highlighted word cells change color */
.home-wordsearch__cell--active {
	color: var(--color-accent);
}

/* ============================================
   PILL OVERLAYS
   ============================================ */

.home-wordsearch__pill {
	/* grid-row & grid-column set inline */
	z-index: 0;
	border: 2px solid var(--color-accent);
	border-radius: 999px;
	opacity: 0;
	pointer-events: none;
	margin: 4px -4px;
	transition: opacity 0.3s ease;
}

.home-wordsearch__pill--active {
	opacity: 1;
	background: rgba(96, 165, 250, 0.06);
}

[data-theme="light"] .home-wordsearch__pill--active {
	background: rgba(59, 130, 246, 0.06);
}

/* ============================================
   SCROLL REVEAL
   ============================================ */

.home-wordsearch .home-reveal {
	opacity: 0;
	transform: translateY(2rem);
	filter: blur(4px);
}

.home-wordsearch .home-reveal.home-reveal--visible {
	animation: wsReveal 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.home-wordsearch__header.home-reveal--visible   { animation-delay: 0s; }
.home-wordsearch__grid-wrap.home-reveal--visible { animation-delay: 0.15s; }

@keyframes wsReveal {
	from {
		opacity: 0;
		transform: translateY(2rem);
		filter: blur(4px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
		filter: blur(0);
	}
}

/* Staggered cell entrance (row-based wave) */
.home-wordsearch__grid-wrap.home-reveal--visible .home-wordsearch__cell {
	animation: wsCellReveal 0.35s ease forwards;
	animation-delay: calc(0.3s + var(--r, 0) * 0.04s);
	opacity: 0;
}

@keyframes wsCellReveal {
	from {
		opacity: 0;
		transform: scale(0.7);
	}
	to {
		opacity: 1;
		transform: scale(1);
	}
}

/* ============================================
   REDUCED MOTION
   ============================================ */

@media (prefers-reduced-motion: reduce) {
	.home-wordsearch .home-reveal {
		opacity: 1;
		transform: none;
		filter: none;
	}

	.home-wordsearch .home-reveal.home-reveal--visible {
		animation: none;
	}

	.home-wordsearch__grid-wrap.home-reveal--visible .home-wordsearch__cell {
		animation: none;
		opacity: 1;
	}

	.home-wordsearch__pill {
		transition: none;
	}

	.home-wordsearch__cell {
		transition: none;
	}
}
