/**
 * Components — cards, badges, sections, grids, hero, sidebar, newsletter.
 * Version 2.0 — Premium food magazine design.
 */

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

.hk-section--sm { padding-block: var(--hk-space-6); }
.hk-section--lg { padding-block: var(--hk-space-9); }

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

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

.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-6);
}

.hk-section__title {
	margin: 0;
	position: relative;
	padding-bottom: var(--hk-space-3);
}

/* Decorative underline accent */
.hk-section__title::after {
	content: '';
	position: absolute;
	bottom: 0;
	left: 0;
	width: 40px;
	height: 3px;
	background: var(--hk-color-accent);
	border-radius: 3px;
}

.hk-section__link {
	font-size: var(--hk-text-sm);
	font-weight: 600;
	text-decoration: none;
	color: var(--hk-color-accent-dark);
	display: inline-flex;
	align-items: center;
	gap: var(--hk-space-1);
	padding: var(--hk-space-2) var(--hk-space-3);
	border: 1.5px solid var(--hk-color-border);
	border-radius: var(--hk-radius-pill);
	white-space: nowrap;
	transition: all var(--hk-duration) var(--hk-ease);
}

.hk-section__link:hover {
	border-color: var(--hk-color-accent);
	background: var(--hk-color-accent-light);
}

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

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

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

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

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

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

.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-xs);
	border: 1px solid var(--hk-color-border);
}

.hk-badge--overlay {
	padding: 3px var(--hk-space-3);
	border-radius: var(--hk-radius-pill);
	background: rgba(255,255,255,0.92);
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
	box-shadow: var(--hk-shadow-xs);
}

/* =====================================================================
 * 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-light);
	box-shadow: var(--hk-shadow-xs);
	transition: box-shadow var(--hk-duration) var(--hk-ease), transform var(--hk-duration) var(--hk-ease), border-color var(--hk-duration) var(--hk-ease);
}

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

@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);
	overflow: hidden;
}

.hk-card__thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.4s var(--hk-ease);
}

.hk-card:hover .hk-card__thumb img { transform: scale(1.04); }

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

.hk-card__count {
	position: absolute;
	bottom: var(--hk-space-2);
	right: var(--hk-space-2);
	background: rgba(20,14,8,0.75);
	color: #fff;
	font-size: var(--hk-text-xs);
	font-weight: 700;
	padding: 3px var(--hk-space-2);
	border-radius: var(--hk-radius-pill);
}

/* Category badge overlaid on image */
.hk-card__overlay-badge {
	position: absolute;
	top: var(--hk-space-3);
	left: var(--hk-space-3);
}

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

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

.hk-card__title a {
	text-decoration: none;
	color: var(--hk-color-text);
	transition: color var(--hk-duration) var(--hk-ease);
}

.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);
	line-height: var(--hk-line-normal);
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	margin: 0;
}

.hk-card__meta {
	margin-top: auto;
	padding-top: var(--hk-space-3);
	border-top: 1px solid var(--hk-color-border-light);
	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);
	font-weight: 500;
}

.hk-card__byline { margin-left: auto; }

/* List variant */
@media (min-width: 640px) {
	.hk-card--list { flex-direction: row; }
	.hk-card--list .hk-card__thumb { width: 40%; flex-shrink: 0; aspect-ratio: 4/3; }
	.hk-card--list .hk-card__body  { width: 60%; }
}

/* =====================================================================
 * Hero Card (Featured Recipe)
 * =================================================================== */
.hk-hero-card {
	display: grid;
	grid-template-columns: 1fr;
	border-radius: var(--hk-radius-xl);
	overflow: hidden;
	background: var(--hk-color-surface);
	border: 1px solid var(--hk-color-border-light);
	box-shadow: var(--hk-shadow-lg);
}

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

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

@media (min-width: 900px) {
	.hk-hero-card__thumb { aspect-ratio: auto; min-height: 480px; }
}

.hk-hero-card__thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.5s var(--hk-ease);
}

.hk-hero-card:hover .hk-hero-card__thumb img { transform: scale(1.03); }

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

.hk-hero-card__body {
	padding: var(--hk-space-6) var(--hk-space-6);
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: var(--hk-space-4);
	min-width: 0;
}

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

.hk-hero-card__eyebrow {
	font-size: var(--hk-text-xs);
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.1em;
	color: var(--hk-color-accent);
	display: flex;
	align-items: center;
	gap: var(--hk-space-2);
}

.hk-hero-card__eyebrow::before {
	content: '';
	display: block;
	width: 28px;
	height: 2px;
	background: var(--hk-color-accent);
	border-radius: 2px;
	flex-shrink: 0;
}

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

.hk-hero-card__title a {
	text-decoration: none;
	color: var(--hk-color-text);
	transition: color var(--hk-duration) var(--hk-ease);
}

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

.hk-hero-card__desc {
	color: var(--hk-color-text-muted);
	font-size: var(--hk-text-lg);
	line-height: var(--hk-line-normal);
	margin: 0;
}

.hk-hero-card__meta {
	display: flex;
	flex-wrap: wrap;
	gap: var(--hk-space-4);
	font-size: var(--hk-text-sm);
	color: var(--hk-color-text-muted);
}

.hk-hero-card__meta-item {
	display: flex;
	align-items: center;
	gap: var(--hk-space-2);
	font-weight: 500;
}

.hk-hero-card__cta { margin-top: var(--hk-space-2); align-self: flex-start; }

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

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

/* =====================================================================
 * Sidebar Blocks
 * =================================================================== */
.hk-sidebar-block {
	background: var(--hk-color-surface);
	border: 1px solid var(--hk-color-border-light);
	border-radius: var(--hk-radius-lg);
	padding: var(--hk-space-5);
	margin-bottom: var(--hk-space-5);
	overflow: hidden;
}

.hk-sidebar-block__title {
	font-size: var(--hk-text-base);
	margin: 0 0 var(--hk-space-4);
	padding-bottom: var(--hk-space-3);
	border-bottom: 2px solid var(--hk-color-accent);
	font-family: var(--hk-font-display);
	text-transform: uppercase;
	letter-spacing: 0.04em;
	font-size: var(--hk-text-sm);
	color: var(--hk-color-text);
}

/* Popular list */
.hk-popular-list { display: flex; flex-direction: column; gap: 0; }

.hk-popular-item {
	display: grid;
	grid-template-columns: 24px 64px 1fr;
	align-items: center;
	gap: var(--hk-space-3);
	padding-block: var(--hk-space-3);
	border-bottom: 1px solid var(--hk-color-border-light);
}

.hk-popular-item:last-child { border-bottom: none; }

.hk-popular-item__body { 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;
	text-align: center;
}

.hk-popular-item:first-child .hk-popular-item__rank { color: var(--hk-color-gold); }
.hk-popular-item:nth-child(2) .hk-popular-item__rank { color: var(--hk-color-text-light); }
.hk-popular-item:nth-child(3) .hk-popular-item__rank { color: #b87333; }

.hk-popular-item__thumb {
	display: block;
	width: 64px;
	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);
	font-weight: 600;
}

.hk-popular-item__title a {
	text-decoration: none;
	color: var(--hk-color-text);
	transition: color var(--hk-duration) var(--hk-ease);
}

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

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

/* =====================================================================
 * Category Card (visual card with image)
 * =================================================================== */
.hk-category-card {
	position: relative;
	display: block;
	border-radius: var(--hk-radius-lg);
	overflow: hidden;
	aspect-ratio: 4/3;
	background: var(--hk-color-surface-alt);
	text-decoration: none;
}

.hk-category-card__image {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.4s var(--hk-ease);
}

.hk-category-card:hover .hk-category-card__image { transform: scale(1.06); }

.hk-category-card__overlay {
	position: absolute;
	inset: 0;
	background: linear-gradient(to top, rgba(20,14,8,0.75) 0%, rgba(20,14,8,0.1) 60%, transparent 100%);
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	padding: var(--hk-space-4);
}

.hk-category-card__title {
	margin: 0 0 var(--hk-space-1);
	font-size: var(--hk-text-lg);
	color: #fff;
	font-family: var(--hk-font-display);
}

.hk-category-card__count {
	font-size: var(--hk-text-xs);
	color: rgba(255,255,255,0.75);
	font-weight: 500;
}

/* Fallback when no image */
.hk-category-card--no-image {
	background: var(--hk-color-surface);
	border: 1px solid var(--hk-color-border-light);
	aspect-ratio: auto;
	padding: var(--hk-space-5);
}

.hk-category-card--no-image .hk-category-card__overlay {
	position: static;
	background: none;
	padding: 0;
}

.hk-category-card--no-image .hk-category-card__title { color: var(--hk-color-text); }
.hk-category-card--no-image .hk-category-card__count { color: var(--hk-color-text-muted); }
.hk-category-card--no-image:hover { border-color: var(--hk-color-accent); }

/* =====================================================================
 * Newsletter Section
 * =================================================================== */
.hk-newsletter {
	background: linear-gradient(135deg, #2c1f14 0%, #3d2b1a 50%, #2c1f14 100%);
	color: var(--hk-color-surface);
	padding-block: var(--hk-space-9);
	text-align: center;
	position: relative;
	overflow: hidden;
}

.hk-newsletter::before {
	content: '';
	position: absolute;
	inset: 0;
	background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
	pointer-events: none;
}

.hk-newsletter__inner {
	position: relative;
	z-index: 1;
	max-width: 600px;
	margin-inline: auto;
}

.hk-newsletter__eyebrow {
	font-size: var(--hk-text-xs);
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.12em;
	color: var(--hk-color-accent-light);
	margin-bottom: var(--hk-space-3);
}

.hk-newsletter__title {
	margin: 0 0 var(--hk-space-3);
	font-size: var(--hk-text-3xl);
	color: var(--hk-color-surface);
}

.hk-newsletter__desc {
	color: rgba(255,255,255,0.7);
	margin-bottom: var(--hk-space-6);
	font-size: var(--hk-text-lg);
}

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

.hk-newsletter__form input[type="email"] {
	flex: 1 1 280px;
	min-height: 50px;
	padding: var(--hk-space-3) var(--hk-space-5);
	border: 2px solid rgba(255,255,255,0.2);
	border-radius: var(--hk-radius-pill);
	background: rgba(255,255,255,0.1);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	color: #fff;
	font-size: var(--hk-text-base);
	transition: border-color var(--hk-duration) var(--hk-ease), background var(--hk-duration) var(--hk-ease);
}

.hk-newsletter__form input[type="email"]::placeholder { color: rgba(255,255,255,0.5); }

.hk-newsletter__form input[type="email"]:focus {
	border-color: var(--hk-color-accent);
	background: rgba(255,255,255,0.15);
	outline: none;
}

.hk-newsletter__form .hk-btn--primary {
	min-height: 50px;
	padding-inline: var(--hk-space-6);
}

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

/* =====================================================================
 * Ad Slots
 * =================================================================== */
.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-8) 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); }

/* =====================================================================
 * Widget area (sidebar)
 * =================================================================== */
.widget-area .widget {
	background: var(--hk-color-surface);
	border: 1px solid var(--hk-color-border-light);
	border-radius: var(--hk-radius-lg);
	padding: var(--hk-space-5);
	margin-bottom: var(--hk-space-5);
}

.widget-area .widget-title {
	font-size: var(--hk-text-sm);
	text-transform: uppercase;
	letter-spacing: 0.08em;
	margin: 0 0 var(--hk-space-4);
	padding-bottom: var(--hk-space-3);
	border-bottom: 2px solid var(--hk-color-accent);
	font-family: var(--hk-font-display);
}

.widget-area ul {
	list-style: none;
	margin: 0; padding: 0;
	display: flex;
	flex-direction: column;
	gap: var(--hk-space-2);
}

.widget-area ul li a {
	font-size: var(--hk-text-sm);
	text-decoration: none;
	color: var(--hk-color-text-muted);
	display: flex;
	align-items: center;
	gap: var(--hk-space-2);
	transition: color var(--hk-duration) var(--hk-ease);
}

.widget-area ul li a:hover { color: var(--hk-color-accent-dark); }
