/**
 * Layout — container, grid/flex primitives, header/footer/nav structure.
 *
 * Component-level visuals (cards, buttons, forms) live in components.css
 * (Phase 4). This file only owns page-level structure so it can be
 * enqueued on every template without pulling in card/component styles a
 * given page might not use.
 */

/* ---------------------------------------------------------------------
 * Container + generic layout utilities
 * ------------------------------------------------------------------- */
.hk-container {
	width: 100%;
	max-width: var(--hk-container-max);
	margin-inline: auto;
	padding-inline: var(--hk-container-pad);
}

.hk-container--narrow {
	max-width: 860px;
}

.hk-visually-hidden {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* Primary content / sidebar layout — ~70/30 via grid, never a hard px
   split (brief §6): the sidebar column has a flexible min/max so it
   never breaks at in-between viewport widths. */
.hk-content-layout {
	display: grid;
	grid-template-columns: 1fr;
	gap: var(--hk-space-7);
	padding-block: var(--hk-space-7);
}

@media (min-width: 1024px) {
	.hk-content-layout {
		grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
		align-items: start;
	}

	.hk-content-layout--no-sidebar {
		grid-template-columns: minmax(0, 1fr);
	}
}

/* Grid items default to a content-based min-width, which can force
   horizontal overflow on narrow viewports when a child contains a wide
   image or unbroken text (brief §7: "no horizontal overflow"). */
.hk-content,
.hk-content-layout > .widget-area {
	min-width: 0;
}

/* ---------------------------------------------------------------------
 * Site header
 * ------------------------------------------------------------------- */
.site-header {
	background: var(--hk-color-surface);
	border-bottom: var(--hk-border-width) solid var(--hk-color-border);
}

.site-header__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--hk-space-4);
	min-height: var(--hk-header-height);
	padding-block: var(--hk-space-2);
}

.site-branding {
	display: flex;
	align-items: center;
	gap: var(--hk-space-2);
	min-width: 0;
}

.site-branding a {
	display: inline-flex;
	align-items: center;
	gap: var(--hk-space-2);
	text-decoration: none;
}

.site-branding__logo img {
	max-height: 44px;
	width: auto;
}

.site-branding__title {
	font-family: var(--hk-font-display);
	font-weight: 700;
	font-size: var(--hk-text-xl);
	color: var(--hk-color-text);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.site-branding__tagline {
	display: none;
}

.site-header__actions {
	display: flex;
	align-items: center;
	gap: var(--hk-space-2);
}

.site-header__icon-link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	border-radius: var(--hk-radius-md);
	color: var(--hk-color-text);
	text-decoration: none;
}

.site-header__icon-link:hover {
	background: var(--hk-color-surface-alt);
}

.site-header__subscribe {
	display: none;
}

/* Desktop primary nav */
.primary-nav {
	display: none;
}

@media (min-width: 1024px) {
	.primary-nav {
		display: block;
	}

	.site-header__subscribe {
		display: inline-flex;
	}

	.primary-nav__menu {
		display: flex;
		align-items: center;
		gap: var(--hk-space-5);
		list-style: none;
		margin: 0;
		padding: 0;
	}

	.primary-nav__menu > li {
		position: relative;
	}

	.primary-nav__menu a {
		display: inline-block;
		padding-block: var(--hk-space-2);
		text-decoration: none;
		font-size: var(--hk-text-sm);
		font-weight: 600;
		letter-spacing: 0.01em;
	}

	.primary-nav__menu a:hover,
	.primary-nav__menu a:focus-visible {
		color: var(--hk-color-accent-dark);
	}

	/* Sub-menus (e.g. Recipes → Breakfast, Dinner, ...) */
	.primary-nav__menu ul {
		display: none;
		position: absolute;
		top: 100%;
		left: 0;
		z-index: 20;
		min-width: 220px;
		margin: 0;
		padding: var(--hk-space-2);
		list-style: none;
		background: var(--hk-color-surface);
		border: 1px solid var(--hk-color-border);
		border-radius: var(--hk-radius-md);
		box-shadow: var(--hk-shadow-md);
	}

	.primary-nav__menu li:hover > ul,
	.primary-nav__menu li:focus-within > ul {
		display: block;
	}

	.primary-nav__menu ul a {
		display: block;
		padding: var(--hk-space-2) var(--hk-space-3);
		border-radius: var(--hk-radius-sm);
		font-weight: 500;
	}

	.primary-nav__menu ul a:hover,
	.primary-nav__menu ul a:focus-visible {
		background: var(--hk-color-surface-alt);
	}
}

/* Mobile nav toggle button */
.mobile-nav-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	border: 0;
	background: transparent;
	border-radius: var(--hk-radius-md);
	color: var(--hk-color-text);
}

.mobile-nav-toggle:hover {
	background: var(--hk-color-surface-alt);
}

@media (min-width: 1024px) {
	.mobile-nav-toggle {
		display: none;
	}
}

/* Mobile nav drawer */
.mobile-nav {
	position: fixed;
	inset: 0;
	z-index: 1000;
	visibility: hidden;
}

.mobile-nav[data-open="true"] {
	visibility: visible;
}

.mobile-nav__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(20, 14, 8, 0.5);
	opacity: 0;
	transition: opacity 0.18s ease;
}

.mobile-nav[data-open="true"] .mobile-nav__backdrop {
	opacity: 1;
}

.mobile-nav__panel {
	position: absolute;
	top: 0;
	right: 0;
	height: 100%;
	width: min(86vw, 360px);
	background: var(--hk-color-surface);
	box-shadow: var(--hk-shadow-md);
	padding: var(--hk-space-4);
	overflow-y: auto;
	transform: translateX(100%);
	transition: transform 0.2s ease;
	display: flex;
	flex-direction: column;
	gap: var(--hk-space-4);
}

.mobile-nav[data-open="true"] .mobile-nav__panel {
	transform: translateX(0);
}

.mobile-nav__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.mobile-nav__close {
	width: 44px;
	height: 44px;
	border: 0;
	background: var(--hk-color-surface-alt);
	border-radius: var(--hk-radius-md);
}

.mobile-nav__menu {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
}

.mobile-nav__menu a {
	display: block;
	padding: var(--hk-space-3) var(--hk-space-1);
	text-decoration: none;
	font-size: var(--hk-text-lg);
	font-weight: 600;
	border-bottom: 1px solid var(--hk-color-border);
	min-height: 44px;
}

.mobile-nav__menu ul {
	list-style: none;
	margin: 0 0 0 var(--hk-space-3);
	padding: 0;
}

.mobile-nav__menu ul a {
	font-size: var(--hk-text-base);
	font-weight: 500;
}

body.has-mobile-nav-open {
	overflow: hidden;
}

/* ---------------------------------------------------------------------
 * Site footer
 * ------------------------------------------------------------------- */
.site-footer {
	background: var(--hk-color-surface-alt);
	border-top: 1px solid var(--hk-color-border);
	margin-top: var(--hk-space-8);
}

.site-footer__grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: var(--hk-space-6);
	padding-block: var(--hk-space-7);
}

@media (min-width: 640px) {
	.site-footer__grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (min-width: 1024px) {
	.site-footer__grid {
		grid-template-columns: repeat(4, 1fr);
	}
}

.site-footer__heading {
	font-size: var(--hk-text-sm);
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--hk-color-text-muted);
	margin-bottom: var(--hk-space-3);
}

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

.site-footer__list a {
	text-decoration: none;
	font-size: var(--hk-text-sm);
}

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

.site-footer__social {
	display: flex;
	gap: var(--hk-space-2);
}

.site-footer__social a {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	border-radius: var(--hk-radius-pill);
	background: var(--hk-color-surface);
	border: 1px solid var(--hk-color-border);
}

.site-footer__social a:hover {
	border-color: var(--hk-color-accent);
	color: var(--hk-color-accent-dark);
}

.site-footer__bottom {
	border-top: 1px solid var(--hk-color-border);
	padding-block: var(--hk-space-4);
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: var(--hk-space-3);
	font-size: var(--hk-text-xs);
	color: var(--hk-color-text-muted);
}

.site-footer__bottom-links {
	list-style: none;
	display: flex;
	flex-wrap: wrap;
	gap: var(--hk-space-4);
	margin: 0;
	padding: 0;
}

.site-footer__bottom-links a {
	text-decoration: none;
	color: inherit;
}

/* ---------------------------------------------------------------------
 * Generic buttons (extended with variants in components.css, Phase 4)
 * ------------------------------------------------------------------- */
.hk-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--hk-space-2);
	min-height: 44px;
	padding: var(--hk-space-2) var(--hk-space-5);
	border-radius: var(--hk-radius-pill);
	border: 1px solid transparent;
	font-weight: 600;
	font-size: var(--hk-text-sm);
	text-decoration: none;
	cursor: pointer;
}

.hk-btn--primary {
	background: var(--hk-color-accent);
	color: var(--hk-color-accent-contrast);
}

.hk-btn--primary:hover {
	background: var(--hk-color-accent-dark);
}

.hk-btn--outline {
	background: transparent;
	border-color: var(--hk-color-border);
	color: var(--hk-color-text);
}

.hk-btn--outline:hover {
	border-color: var(--hk-color-accent);
	color: var(--hk-color-accent-dark);
}

/* ---------------------------------------------------------------------
 * Generic content + forms (used by index.php, single.php, page.php,
 * 404.php until their richer component styles land in later phases)
 * ------------------------------------------------------------------- */
.entry-content {
	font-size: var(--hk-text-base);
	line-height: var(--hk-line-normal);
}

.entry-content > * + * {
	margin-top: var(--hk-space-4);
}

.entry-thumbnail {
	margin-block: var(--hk-space-5);
	border-radius: var(--hk-radius-lg);
	overflow: hidden;
}

.hk-post-list {
	display: grid;
	gap: var(--hk-space-6);
}

.hk-post-list__item {
	display: grid;
	gap: var(--hk-space-4);
}

@media (min-width: 640px) {
	.hk-post-list__item {
		grid-template-columns: 240px 1fr;
		align-items: start;
	}
}

.hk-post-list__thumb img {
	border-radius: var(--hk-radius-md);
}

.hk-post-list__body {
	/* Same CSS Grid overflow guard as .hk-content — the 1fr text track
	   otherwise sizes to its content's intrinsic width. */
	min-width: 0;
}

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

.hk-post-list__title a {
	text-decoration: none;
}

.hk-post-list__meta {
	font-size: var(--hk-text-sm);
	color: var(--hk-color-text-muted);
	margin-bottom: var(--hk-space-2);
}

.hk-post-list__excerpt {
	color: var(--hk-color-text-muted);
	font-size: var(--hk-text-sm);
}

.hk-search-form {
	display: flex;
	flex-wrap: wrap;
	gap: var(--hk-space-2);
	justify-content: center;
	margin-block: var(--hk-space-5);
}

.hk-search-form input[type="search"] {
	flex: 1 1 260px;
	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-pagination {
	margin-top: var(--hk-space-6);
	display: flex;
	gap: var(--hk-space-3);
	justify-content: center;
}

.hk-pagination .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 44px;
	min-height: 44px;
	padding: 0 var(--hk-space-2);
	border-radius: var(--hk-radius-md);
	text-decoration: none;
	border: 1px solid var(--hk-color-border);
}

.hk-pagination .page-numbers.current {
	background: var(--hk-color-accent);
	border-color: var(--hk-color-accent);
	color: var(--hk-color-accent-contrast);
}

.comments-area {
	padding-block: var(--hk-space-6);
}

.comment-list {
	list-style: none;
	margin: 0 0 var(--hk-space-5);
	padding: 0;
}

/* ---------------------------------------------------------------------
 * Archive / search headers and results (Phase 7)
 * ------------------------------------------------------------------- */
.hk-archive-header {
	padding-block: var(--hk-space-6) var(--hk-space-5);
}

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

.hk-archive-header__desc {
	color: var(--hk-color-text-muted);
	max-width: 70ch;
}

.hk-archive-header__desc > * + * {
	margin-top: var(--hk-space-3);
}

.hk-search-form--page {
	justify-content: flex-start;
	margin-bottom: var(--hk-space-6);
}

.hk-search-results {
	display: flex;
	flex-direction: column;
	gap: var(--hk-space-5);
}

.hk-search-result {
	display: grid;
	grid-template-columns: 1fr;
	gap: var(--hk-space-3);
	padding-bottom: var(--hk-space-5);
	border-bottom: 1px solid var(--hk-color-border);
}

@media (min-width: 560px) {
	.hk-search-result {
		grid-template-columns: 160px 1fr;
		align-items: start;
	}
}

.hk-search-result__thumb {
	display: block;
	aspect-ratio: 4 / 3;
	border-radius: var(--hk-radius-md);
	overflow: hidden;
	background: var(--hk-color-surface-alt);
}

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

.hk-search-result__body {
	/* Same CSS Grid overflow guard as .hk-content — the 1fr text track
	   otherwise sizes to its content's intrinsic width. */
	min-width: 0;
}

.hk-search-result__eyebrow {
	font-size: var(--hk-text-xs);
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--hk-color-text-muted);
	margin-bottom: var(--hk-space-1);
}

.hk-search-result__eyebrow a {
	color: var(--hk-color-accent-dark);
	text-decoration: none;
}

.hk-search-result__title {
	margin-bottom: var(--hk-space-1);
}

.hk-search-result__title a {
	text-decoration: none;
}

.hk-search-result__meta {
	font-size: var(--hk-text-xs);
	color: var(--hk-color-text-muted);
	margin-bottom: var(--hk-space-2);
}

.hk-search-result__excerpt {
	color: var(--hk-color-text-muted);
	font-size: var(--hk-text-sm);
}
