/*
Theme Name: Kestrel
Description: Tema editoriale classico con sidebar destra, griglia di card, navigazione a tendina e pannello di ricerca.
Author: Moto in Chiaro
Version: 1.2
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
*/

/* ---------- Custom properties ---------- */
:root {
	--bg: #eef2f6;
	--fg: #1b1f24;
	--muted: #6b7480;
	--border: #d3dce4;
	--radius: 4px;
	--shadow: 0 4px 12px rgba(0,0,0,0.08);
	--accent: #1f5aa8;
	--accent-dark: #17457f;
	--surface: #ffffff;
	--sidebar-w: 280px;
	--card-gap: 20px;
	--serif: 'Lora', Georgia, serif;
	--sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
	--media-ratio: 16 / 9;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
	margin: 0;
	background-color: var(--bg);
	background-image:
		linear-gradient(rgba(31, 90, 168, 0.045) 1px, transparent 1px),
		linear-gradient(90deg, rgba(31, 90, 168, 0.045) 1px, transparent 1px);
	background-size: 28px 28px;
	color: var(--fg);
	font-family: var(--sans);
	font-size: 18px;
	line-height: 1.75;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover, a:focus { color: var(--accent-dark); text-decoration: underline; }

h1, h2, h3, h4, h5, h6 {
	font-family: var(--serif);
	font-weight: 700;
	line-height: 1.25;
	color: var(--fg);
	margin: 0 0 0.6em;
}
h1 { font-size: 2rem; }
h2 { font-size: 1.55rem; }
h3 { font-size: 1.25rem; }

p { margin: 0 0 1.2em; }
ul, ol { margin: 0 0 1.2em; padding-left: 1.4em; }
blockquote {
	margin: 0 0 1.2em;
	padding: 0.2em 0 0.2em 1.2em;
	border-left: 3px solid var(--accent);
	color: var(--muted);
	font-family: var(--serif);
	font-style: italic;
}
table { width: 100%; border-collapse: collapse; margin: 0 0 1.2em; font-size: 0.95rem; }
th, td { border: 1px solid var(--border); padding: 10px 12px; text-align: left; overflow-wrap: normal; }
th { background: #f6f9fc; font-family: var(--serif); }
code, pre { font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace; font-size: 0.9em; }
pre { background: #f6f9fc; border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; overflow-x: auto; }
hr { border: 0; border-top: 1px solid var(--border); margin: 2em 0; }

/* ---------- Layout skeleton ---------- */
.hxnjn-wrap { width: 100%; max-width: 1160px; margin: 0 auto; padding: 0 24px; }
.hxnjn-main { display: flex; gap: 48px; padding: 40px 0 64px; align-items: flex-start; }
.hxnjn-content { flex: 1 1 auto; min-width: 0; }
.hxnjn-sidebar { flex: 0 0 var(--sidebar-w); width: var(--sidebar-w); }

@media (max-width: 920px) {
	.hxnjn-main { flex-direction: column; }
	.hxnjn-sidebar { flex: 1 1 auto; width: 100%; }
}

/* ---------- Header ---------- */
.hxnjn-header {
	background: var(--surface);
	border-bottom: 1px solid var(--border);
}
.hxnjn-header-bar { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 72px; }
.hxnjn-header-right { display: flex; align-items: center; gap: 12px; }
.hxnjn-logo { font-family: var(--serif); font-size: 1.4rem; font-weight: 700; }
.hxnjn-logo a { color: var(--fg); }
.hxnjn-logo a:hover { color: var(--accent); text-decoration: none; }

.hxnjn-nav { display: flex; align-items: center; gap: 16px; }
.hxnjn-menu { display: flex; align-items: center; gap: 4px; list-style: none; margin: 0; padding: 0; }
.hxnjn-menu li { position: relative; margin: 0; }
.hxnjn-menu a {
	display: block;
	padding: 10px 12px;
	color: var(--fg);
	font-size: 0.92rem;
	font-weight: 500;
	border-radius: var(--radius);
}
.hxnjn-menu a:focus { color: var(--accent); background: #f0f5fb; text-decoration: none; }
@media (hover: hover) {
	.hxnjn-menu a:hover { color: var(--accent); background: #f0f5fb; text-decoration: none; }
}
.hxnjn-menu .current-menu-item > a, .hxnjn-menu .current-menu-ancestor > a { color: var(--accent); }

/* Dropdowns */
.hxnjn-menu .sub-menu {
	position: absolute;
	top: 100%;
	left: 0;
	z-index: 60;
	min-width: 240px;
	list-style: none;
	margin: 0;
	padding: 8px;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
}
.hxnjn-menu li:hover > .sub-menu,
.hxnjn-menu li:focus-within > .sub-menu { opacity: 1; visibility: visible; pointer-events: auto; }
.hxnjn-menu .sub-menu a { padding: 8px 10px; white-space: nowrap; }

.hxnjn-menu-toggle {
	display: none;
	background: none;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 0 14px;
	height: 40px;
	align-items: center;
	font: inherit;
	font-size: 0.95rem;
	line-height: 1;
	color: var(--fg);
	cursor: pointer;
}
.hxnjn-submenu-toggle { display: none; }

@media (max-width: 920px) {
	.hxnjn-header-bar { flex-wrap: wrap; padding: 12px 0; row-gap: 12px; column-gap: 10px; justify-content: flex-start; }
	.hxnjn-header-right { display: contents; }
	.hxnjn-search-toggle { margin-left: auto; }
	.hxnjn-menu-toggle { display: inline-flex; }
	.hxnjn-nav { order: 3; width: 100%; display: block; }
	.hxnjn-menu { display: none; width: 100%; flex-direction: column; align-items: stretch; gap: 2px; }
	.hxnjn-menu.hxnjn-open { display: flex; }
	.hxnjn-menu .sub-menu {
		position: static;
		opacity: 1;
		visibility: visible;
		pointer-events: auto;
		box-shadow: none;
		border: 0;
		border-top: 1px solid var(--border);
		border-radius: 0;
		margin: 0;
		padding: 4px 0 4px 16px;
		display: none;
	}
	.hxnjn-menu li.hxnjn-sub-open > .sub-menu { display: block; }
	.hxnjn-menu li { display: flex; flex-wrap: wrap; align-items: center; }
	.hxnjn-menu li > a { flex: 1 1 auto; min-width: 0; order: 1; }
	.hxnjn-menu li > .sub-menu { flex: 0 0 100%; order: 3; }
	.hxnjn-submenu-toggle {
		order: 2;
		display: inline-flex;
		align-items: center;
		justify-content: center;
		flex: 0 0 44px;
		height: 44px;
		padding: 0;
		background: none;
		border: 0;
		border-left: 1px solid var(--border);
		font: inherit;
		font-size: 1.15rem;
		line-height: 1;
		color: var(--muted);
		cursor: pointer;
	}
}

/* Search entry: icon button + expandable panel */
.hxnjn-search-toggle {
	background: none;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	width: 40px;
	height: 40px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	color: var(--fg);
}
.hxnjn-search-toggle:hover { color: var(--accent); border-color: var(--accent); }
.hxnjn-search-toggle svg { width: 18px; height: 18px; }
.hxnjn-header .hxnjn-wrap { position: relative; }
.hxnjn-search-panel {
	display: none;
	position: absolute;
	top: 100%;
	right: 24px;
	z-index: 70;
	width: min(420px, calc(100% - 48px));
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	padding: 16px;
}
.hxnjn-search-panel.hxnjn-open { display: block; }
.hxnjn-search-panel .search-form { max-width: none; }

/* ---------- Search form ---------- */
.search-form { display: flex; gap: 8px; width: 100%; max-width: 520px; }
.search-field {
	flex: 1 1 auto;
	min-width: 0;
	padding: 10px 14px;
	font: inherit;
	font-size: 0.95rem;
	color: var(--fg);
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
}
.search-field:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.search-submit {
	padding: 10px 18px;
	font: inherit;
	font-size: 0.95rem;
	font-weight: 500;
	color: #fff;
	background: var(--accent);
	border: 1px solid var(--accent);
	border-radius: var(--radius);
	cursor: pointer;
}
.search-submit:hover, .search-submit:focus { background: var(--accent-dark); border-color: var(--accent-dark); }

/* ---------- Hero (home, text-only, centered) ---------- */
.hxnjn-hero {
	background: var(--surface);
	border-bottom: 1px solid var(--border);
	padding: 72px 0 64px;
	text-align: center;
}
.hxnjn-hero-title { font-size: 2.6rem; margin-bottom: 0.3em; }
.hxnjn-hero-desc { max-width: 720px; margin: 0 auto; color: var(--muted); font-size: 1.05rem; }
.hxnjn-hero-rule {
	width: 64px;
	height: 3px;
	background: var(--accent);
	margin: 26px auto 0;
	border-radius: 2px;
}

/* ---------- Breadcrumb ---------- */
.breadcrumb {
	font-size: 0.85rem;
	color: var(--muted);
	margin-bottom: 24px;
	padding-bottom: 12px;
	border-bottom: 1px solid var(--border);
}
.breadcrumb .trail { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.breadcrumb .crumb { color: var(--muted); }
.breadcrumb a.crumb:hover { color: var(--accent); }
.breadcrumb .crumb-sep { color: var(--border); }

/* ---------- Section headings ---------- */
.hxnjn-section-head { margin-bottom: 28px; padding-bottom: 14px; border-bottom: 2px solid var(--fg); }
.hxnjn-section-title { margin: 0; font-size: 1.6rem; }
.hxnjn-section-sub { margin: 6px 0 0; color: var(--muted); font-size: 0.95rem; }

/* ---------- Card grid ---------- */
.hxnjn-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: var(--card-gap);
}
@media (max-width: 640px) {
	.hxnjn-grid { grid-template-columns: 1fr; }
}
.hxnjn-card {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	overflow: hidden;
	display: flex;
	flex-direction: column;
}
.hxnjn-card-media { display: block; aspect-ratio: var(--media-ratio); overflow: hidden; background: #e4eaf1; }
.hxnjn-card-media img { width: 100%; height: 100%; object-fit: cover; }
.hxnjn-card-body { padding: 20px; display: flex; flex-direction: column; flex: 1 1 auto; }
.hxnjn-card-cats { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 8px; }
.hxnjn-card-cats a { color: var(--accent); font-weight: 600; }
.hxnjn-card-title { font-size: 1.15rem; margin: 0 0 8px; }
.hxnjn-card-title a { color: var(--fg); }
.hxnjn-card-title a:hover { color: var(--accent); text-decoration: none; }
.hxnjn-card-excerpt { font-size: 0.92rem; color: var(--muted); margin: 0 0 14px; }
.hxnjn-card-meta { margin-top: auto; font-size: 0.82rem; color: var(--muted); border-top: 1px solid var(--border); padding-top: 12px; }

/* ---------- Pagination ---------- */
.hxnjn-pagination { margin-top: 40px; display: flex; justify-content: center; }
.hxnjn-pagination .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 40px;
	height: 40px;
	padding: 0 12px;
	margin: 0 3px;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: var(--surface);
	color: var(--fg);
	font-size: 0.92rem;
}
.hxnjn-pagination .page-numbers.current { background: var(--accent); border-color: var(--accent); color: #fff; }
.hxnjn-pagination a.page-numbers:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

/* ---------- Single article ---------- */
.hxnjn-article { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 36px; }
@media (max-width: 640px) { .hxnjn-article { padding: 22px; } }
.hxnjn-article-title { font-size: 2.1rem; margin-bottom: 0.4em; }
.hxnjn-meta-row {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 18px;
	font-size: 0.85rem;
	color: var(--muted);
	padding-bottom: 18px;
	margin-bottom: 24px;
	border-bottom: 1px solid var(--border);
}
.hxnjn-meta-row a { color: var(--muted); }
.hxnjn-meta-row a:hover { color: var(--accent); }
.hxnjn-featured { margin: 0 0 28px; border-radius: var(--radius); overflow: hidden; aspect-ratio: var(--media-ratio); }
.hxnjn-featured img { width: 100%; height: 100%; object-fit: cover; }
.hxnjn-entry h2, .hxnjn-entry h3, .hxnjn-entry h4 { margin-top: 1.6em; }
.hxnjn-entry a { text-decoration: underline; }
.hxnjn-entry a:hover { text-decoration: none; }

.hxnjn-tags { margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--border); display: flex; flex-wrap: wrap; gap: 8px; }
.hxnjn-tags a {
	display: inline-block;
	padding: 4px 12px;
	font-size: 0.8rem;
	color: var(--fg);
	background: #f0f5fb;
	border: 1px solid var(--border);
	border-radius: 999px;
}
.hxnjn-tags a:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }

.hxnjn-note {
	margin-top: 28px;
	padding: 16px 20px;
	background: #f0f5fb;
	border: 1px solid var(--border);
	border-left: 3px solid var(--accent);
	border-radius: var(--radius);
	font-size: 0.92rem;
	color: var(--muted);
}
.hxnjn-note p:last-child { margin-bottom: 0; }

.hxnjn-bio {
	margin-top: 28px;
	padding: 22px;
	background: #f6f9fc;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	display: flex;
	gap: 18px;
	align-items: flex-start;
}
.hxnjn-bio-avatar { flex: 0 0 auto; max-width: 64px; }
.hxnjn-bio-avatar img { border-radius: var(--radius); display: block; width: 100%; height: auto; }
.hxnjn-bio-name { font-family: var(--serif); font-weight: 700; margin: 0 0 6px; font-size: 1.02rem; }
.hxnjn-bio-name a { color: var(--fg); }
.hxnjn-bio-text { margin: 0; font-size: 0.92rem; color: var(--muted); }

/* Related posts */
.hxnjn-related { margin-top: 40px; }
.hxnjn-related-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: var(--card-gap);
	margin-top: 20px;
}
@media (max-width: 1100px) { .hxnjn-related-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .hxnjn-related-grid { grid-template-columns: 1fr; } }
.hxnjn-rel-card {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	overflow: hidden;
}
.hxnjn-rel-card .hxnjn-card-body { padding: 14px 16px; }
.hxnjn-rel-card .hxnjn-card-title { font-size: 0.98rem; margin: 0; }

/* ---------- Sidebar ---------- */
.hxnjn-widget {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	padding: 22px;
	margin-bottom: 24px;
}
.hxnjn-widget-title {
	font-size: 1.05rem;
	margin: 0 0 14px;
	padding-bottom: 10px;
	border-bottom: 2px solid var(--accent);
}
.hxnjn-widget ul { list-style: none; margin: 0; padding: 0; }
.hxnjn-widget ul li { margin: 0; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 0.92rem; }
.hxnjn-widget ul li:last-child { border-bottom: 0; }
.hxnjn-widget ul li a { color: var(--fg); }
.hxnjn-widget ul li a:hover { color: var(--accent); }
.hxnjn-widget .hxnjn-recent-date { display: block; font-size: 0.78rem; color: var(--muted); }

/* Search form inside the narrow sidebar stacks vertically */
.hxnjn-widget .search-form { flex-direction: column; max-width: none; }
.hxnjn-widget .search-field { width: 100%; }
.hxnjn-widget .search-submit { width: 100%; }

/* ---------- Comments ---------- */
.hxnjn-comments { margin-top: 40px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 32px; }
.hxnjn-comments .comment-list { list-style: none; margin: 0 0 24px; padding: 0; }
.hxnjn-comments .comment-list .children { list-style: none; margin-left: 24px; padding-left: 18px; border-left: 2px solid var(--border); }
.hxnjn-comments .comment-body { padding: 18px 0; border-bottom: 1px solid var(--border); font-size: 0.95rem; }
.hxnjn-comments .comment-author { font-family: var(--serif); font-weight: 700; }
.hxnjn-comments .comment-metadata { font-size: 0.8rem; color: var(--muted); }
.hxnjn-comments .reply a { font-size: 0.82rem; font-weight: 600; }
.hxnjn-comments textarea, .hxnjn-comments input[type="text"], .hxnjn-comments input[type="email"], .hxnjn-comments input[type="url"] {
	width: 100%;
	padding: 10px 12px;
	font: inherit;
	font-size: 0.92rem;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: var(--surface);
	color: var(--fg);
}
.hxnjn-comments .submit {
	padding: 10px 22px;
	font: inherit;
	font-weight: 500;
	color: #fff;
	background: var(--accent);
	border: 1px solid var(--accent);
	border-radius: var(--radius);
	cursor: pointer;
}
.hxnjn-comments .submit:hover { background: var(--accent-dark); }

/* ---------- Footer ---------- */
.hxnjn-footer {
	background: #14181d;
	color: #aab4c0;
	margin-top: 0;
}
.hxnjn-footer-main {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	gap: 32px;
	padding: 56px 0 40px;
}
.hxnjn-footer-brand { flex: 1 1 220px; min-width: 200px; }
.hxnjn-footer-sitename {
	font-family: var(--serif);
	font-size: 1.25rem;
	font-weight: 700;
	color: #e8edf3;
}
.hxnjn-footer-sitename:hover { color: #fff; text-decoration: none; }
.hxnjn-footer-group { flex: 1 1 160px; min-width: 150px; }
@media (max-width: 820px) {
	.hxnjn-footer-main { flex-direction: column; gap: 28px; }
	.hxnjn-footer-brand, .hxnjn-footer-group { flex: 1 1 auto; width: 100%; }
}
.hxnjn-footer-group-title {
	font-family: var(--serif);
	font-size: 1rem;
	font-weight: 700;
	color: #e8edf3;
	margin: 0 0 14px;
	padding-bottom: 10px;
	border-bottom: 1px solid #2b333d;
}
.hxnjn-footer-group ul { list-style: none; margin: 0; padding: 0; }
.hxnjn-footer-group ul li { margin: 0 0 8px; font-size: 0.9rem; }
.hxnjn-footer-group a { color: #aab4c0; }
.hxnjn-footer-group a:hover { color: #fff; }
.hxnjn-footer-bottom {
	border-top: 1px solid #2b333d;
	padding: 18px 0 22px;
	font-size: 0.82rem;
	color: #7d8894;
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: 6px 24px;
}

/* ---------- 404 ---------- */
.hxnjn-empty {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	padding: 56px 36px;
	text-align: center;
}
.hxnjn-empty .search-form { margin: 24px auto 0; }

/* ---------- Long words and small screens ---------- */
p, li, h1, h2, h3, h4, h5, h6, blockquote, .hxnjn-entry { overflow-wrap: break-word; }

@media (max-width: 640px) {
	body { font-size: 17px; }
	h1 { font-size: 1.6rem; }
	.hxnjn-hero { padding: 48px 0 44px; }
	.hxnjn-hero-title { font-size: 1.85rem; }
	.hxnjn-article-title { font-size: 1.5rem; }
	.hxnjn-section-title { font-size: 1.35rem; }
}

/* ---------- Tables scroll inside their own wrapper ---------- */
.hxnjn-table-scroll { overflow-x: auto; margin: 0 0 1.2em; }
.hxnjn-table-scroll table { width: auto; min-width: 100%; margin: 0; }

/* ---------- Accessibility ---------- */
.screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}
