/**
 * Components — cards, badges, sections, grids, hero, sidebar blocks,
 * newsletter, empty states, forms. Loaded on every front-end template
 * (inc/enqueue.php) since nearly every template uses at least one of
 * these (cards, buttons). Recipe-specific components (ingredients,
 * instructions, nutrition, etc.) live in recipe.css (Phase 6).
 */

/* ---------------------------------------------------------------------
 * Section scaffolding
 * ------------------------------------------------------------------- */
.hk-section {
	padding-block: var(--hk-space-7);
}

.hk-section--alt {
	background: var(--hk-color-surface-alt);
}

.hk-section__header {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: var(--hk-space-3);
	margin-bottom: var(--hk-space-5);
}

.hk-section__title {
	margin: 0;
}

.hk-section__link {
	font-size: var(--hk-text-sm);
	font-weight: 600;
	text-decoration: none;
	white-space: nowrap;
}

.hk-section__link:hover {
	color: var(--hk-color-accent-dark);
}

/* ---------------------------------------------------------------------
 * Grid
 * ------------------------------------------------------------------- */
.hk-grid {
	display: grid;
	gap: var(--hk-space-6);
	grid-template-columns: 1fr;
}

@media (min-width: 640px) {
	.hk-grid--2up,
	.hk-grid--3up,
	.hk-grid--4up {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (min-width: 1024px) {
	.hk-grid--3up {
		grid-template-columns: repeat(3, 1fr);
	}

	.hk-grid--4up {
		grid-template-columns: repeat(4, 1fr);
	}
}

/* ---------------------------------------------------------------------
 * Badge (category label)
 * ------------------------------------------------------------------- */
.hk-badge {
	display: inline-block;
	font-size: var(--hk-text-xs);
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--hk-color-accent-dark);
	text-decoration: none;
	margin-bottom: var(--hk-space-2);
}

.hk-badge--accent {
	padding: var(--hk-space-1) var(--hk-space-3);
	border-radius: var(--hk-radius-pill);
	background: var(--hk-color-surface);
	box-shadow: var(--hk-shadow-sm);
}

/* ---------------------------------------------------------------------
 * Recipe card
 * ------------------------------------------------------------------- */
.hk-card {
	display: flex;
	flex-direction: column;
	background: var(--hk-color-surface);
	border-radius: var(--hk-radius-lg);
	overflow: hidden;
	border: 1px solid var(--hk-color-border);
	transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.hk-card:hover {
	box-shadow: var(--hk-shadow-md);
	transform: translateY(-2px);
}

@media (prefers-reduced-motion: reduce) {
	.hk-card:hover {
		transform: none;
	}
}

.hk-card__thumb {
	position: relative;
	display: block;
	aspect-ratio: 4 / 3;
	background: var(--hk-color-surface-alt);
}

.hk-card__thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.hk-card__thumb-placeholder {
	display: block;
	width: 100%;
	height: 100%;
	background: linear-gradient(135deg, var(--hk-color-surface-alt), var(--hk-color-border));
}

.hk-card__count {
	position: absolute;
	bottom: var(--hk-space-2);
	right: var(--hk-space-2);
	background: rgba(20, 14, 8, 0.72);
	color: var(--hk-color-accent-contrast);
	font-size: var(--hk-text-xs);
	font-weight: 600;
	padding: var(--hk-space-1) var(--hk-space-2);
	border-radius: var(--hk-radius-pill);
}

.hk-card__body {
	padding: var(--hk-space-4);
	display: flex;
	flex-direction: column;
	flex: 1;
}

.hk-card__title {
	font-size: var(--hk-text-lg);
	margin-bottom: var(--hk-space-2);
}

.hk-card__title a {
	text-decoration: none;
}

.hk-card__title a:hover {
	color: var(--hk-color-accent-dark);
}

.hk-card__excerpt {
	font-size: var(--hk-text-sm);
	color: var(--hk-color-text-muted);
	margin-bottom: var(--hk-space-3);
}

.hk-card__meta {
	margin-top: auto;
	display: flex;
	flex-wrap: wrap;
	gap: var(--hk-space-3);
	font-size: var(--hk-text-xs);
	color: var(--hk-color-text-muted);
}

.hk-card__time {
	display: inline-flex;
	align-items: center;
	gap: var(--hk-space-1);
}

.hk-card__link {
	margin-top: auto;
	font-size: var(--hk-text-sm);
	font-weight: 600;
	text-decoration: none;
}

.hk-card__link:hover {
	color: var(--hk-color-accent-dark);
}

/* List variant — used later (Phase 7 archives) for denser rows. */
@media (min-width: 640px) {
	.hk-card--list {
		flex-direction: row;
	}

	.hk-card--list .hk-card__thumb {
		width: 40%;
		aspect-ratio: 4 / 3;
	}

	.hk-card--list .hk-card__body {
		width: 60%;
	}
}

/* ---------------------------------------------------------------------
 * Hero card
 * ------------------------------------------------------------------- */
.hk-hero-card {
	display: grid;
	grid-template-columns: 1fr;
	gap: var(--hk-space-5);
	border-radius: var(--hk-radius-lg);
	overflow: hidden;
	background: var(--hk-color-surface);
	border: 1px solid var(--hk-color-border);
}

@media (min-width: 1024px) {
	.hk-hero-card {
		grid-template-columns: 1.3fr 1fr;
		align-items: stretch;
	}
}

.hk-hero-card__thumb {
	display: block;
	aspect-ratio: 16 / 10;
	background: var(--hk-color-surface-alt);
}

.hk-hero-card__thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.hk-hero-card__thumb-placeholder {
	display: block;
	width: 100%;
	height: 100%;
	background: linear-gradient(135deg, var(--hk-color-surface-alt), var(--hk-color-border));
}

.hk-hero-card__body {
	padding: var(--hk-space-5);
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: var(--hk-space-3);
	/* Same CSS Grid/Flex overflow guard as .hk-content in layout.css — a
	   long, unbroken recipe title could otherwise force this column
	   wider than its 1.3fr/1fr share at the 1024px breakpoint. */
	min-width: 0;
}

@media (min-width: 1024px) {
	.hk-hero-card__body {
		padding: var(--hk-space-7);
	}
}

.hk-hero-card__title {
	font-size: var(--hk-text-3xl);
	margin: 0;
}

.hk-hero-card__title a {
	text-decoration: none;
}

.hk-hero-card__desc {
	color: var(--hk-color-text-muted);
	font-size: var(--hk-text-lg);
}

.hk-hero-card--welcome {
	grid-template-columns: 1fr;
}

.hk-hero-card--welcome .hk-hero-card__body {
	padding: var(--hk-space-7) var(--hk-space-5);
	text-align: center;
	align-items: center;
}

/* ---------------------------------------------------------------------
 * Sidebar blocks + popular list
 * ------------------------------------------------------------------- */
.hk-sidebar-block {
	background: var(--hk-color-surface);
	border: 1px solid var(--hk-color-border);
	border-radius: var(--hk-radius-lg);
	padding: var(--hk-space-5);
	margin-bottom: var(--hk-space-6);
}

.hk-sidebar-block__title {
	font-size: var(--hk-text-xl);
	margin-bottom: var(--hk-space-4);
}

.hk-popular-list {
	display: flex;
	flex-direction: column;
	gap: var(--hk-space-4);
}

.hk-popular-item {
	display: grid;
	grid-template-columns: auto 72px 1fr;
	align-items: center;
	gap: var(--hk-space-3);
}

.hk-popular-item__body {
	/* Same CSS Grid overflow guard as .hk-content in layout.css — the 1fr
	   track otherwise sizes to its content's intrinsic width, which a
	   long, unbroken recipe title can force wider than the track. */
	min-width: 0;
}

.hk-popular-item__rank {
	font-family: var(--hk-font-display);
	font-size: var(--hk-text-xl);
	font-weight: 700;
	color: var(--hk-color-border);
	line-height: 1;
	min-width: 1.2ch;
}

.hk-popular-item__thumb {
	display: block;
	width: 72px;
	aspect-ratio: 1 / 1;
	border-radius: var(--hk-radius-md);
	overflow: hidden;
	background: var(--hk-color-surface-alt);
}

.hk-popular-item__thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.hk-popular-item__title {
	font-size: var(--hk-text-sm);
	margin: 0 0 var(--hk-space-1);
	line-height: var(--hk-line-snug);
}

.hk-popular-item__title a {
	text-decoration: none;
}

.hk-popular-item__meta {
	font-size: var(--hk-text-xs);
	color: var(--hk-color-text-muted);
}

/* ---------------------------------------------------------------------
 * Category card
 * ------------------------------------------------------------------- */
.hk-category-card {
	display: flex;
	flex-direction: column;
	gap: var(--hk-space-1);
	padding: var(--hk-space-5);
	border-radius: var(--hk-radius-lg);
	background: var(--hk-color-surface);
	border: 1px solid var(--hk-color-border);
	text-decoration: none;
}

.hk-category-card:hover {
	border-color: var(--hk-color-accent);
}

.hk-category-card__title {
	margin: 0;
	font-size: var(--hk-text-lg);
}

.hk-category-card__count {
	font-size: var(--hk-text-xs);
	color: var(--hk-color-text-muted);
}

/* ---------------------------------------------------------------------
 * Newsletter
 * ------------------------------------------------------------------- */
.hk-newsletter {
	background: var(--hk-color-surface-alt);
	border-top: 1px solid var(--hk-color-border);
	border-bottom: 1px solid var(--hk-color-border);
}

.hk-newsletter__inner {
	text-align: center;
}

.hk-newsletter__title {
	margin-bottom: var(--hk-space-2);
}

.hk-newsletter__desc {
	color: var(--hk-color-text-muted);
	margin-bottom: var(--hk-space-5);
}

.hk-newsletter__form {
	display: flex;
	flex-wrap: wrap;
	gap: var(--hk-space-2);
	justify-content: center;
}

.hk-newsletter__form input[type="email"] {
	flex: 1 1 280px;
	min-height: 44px;
	padding: var(--hk-space-2) var(--hk-space-4);
	border: 1px solid var(--hk-color-border);
	border-radius: var(--hk-radius-pill);
	background: var(--hk-color-surface);
	color: var(--hk-color-text);
}

.hk-newsletter__admin-note {
	margin-top: var(--hk-space-3);
	font-size: var(--hk-text-xs);
	color: var(--hk-color-text-muted);
}

/* ---------------------------------------------------------------------
 * Ad slots (Phase 10)
 *
 * Every slot reserves its min-height up front so an ad network's script
 * injecting content later never shifts surrounding layout (CLS, brief
 * §6). Heights approximate common IAB units per placement rather than
 * one generic box. A slot with no code configured renders no markup at
 * all (advertisement_slot(), inc/ads.php) — these rules only ever apply
 * once a slot is either live or showing the admin-only dev placeholder.
 * ------------------------------------------------------------------- */
.hk-ad-slot {
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	margin-block: var(--hk-space-6);
}

.hk-ad-slot--header {
	min-height: 50px;
	margin-block: var(--hk-space-3);
}

@media (min-width: 768px) {
	.hk-ad-slot--header {
		min-height: 90px;
	}
}

.hk-ad-slot--sidebar,
.hk-ad-slot--content_1,
.hk-ad-slot--content_2,
.hk-ad-slot--content_3,
.hk-ad-slot--between_sections,
.hk-ad-slot--before_related {
	min-height: 250px;
}

.hk-ad-slot--placeholder {
	border: 1px dashed var(--hk-color-border);
	border-radius: var(--hk-radius-md);
	background: var(--hk-color-surface-alt);
}

.hk-ad-slot__placeholder-label {
	font-size: var(--hk-text-xs);
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--hk-color-text-muted);
	padding: var(--hk-space-3);
	text-align: center;
}

/* ---------------------------------------------------------------------
 * Empty state
 * ------------------------------------------------------------------- */
.hk-empty-state {
	text-align: center;
	padding: var(--hk-space-7) var(--hk-space-4);
	border: 1px dashed var(--hk-color-border);
	border-radius: var(--hk-radius-lg);
}

.hk-empty-state__title {
	margin-bottom: var(--hk-space-2);
}

.hk-empty-state__message {
	color: var(--hk-color-text-muted);
	margin-bottom: var(--hk-space-4);
}
