/*
Theme Name: Brancaleone
Description: Tema di "A cena con Brancaleone". Impianto editoriale da giornale: carta calda, inchiostro, rosso Amarone; filetti al posto di box e ombre. Notizie a sinistra, colonna con player Spreaker e comunicati a destra.
Version: 3.7.0
Requires at least: 6.5
Requires PHP: 8.1
Text Domain: brancaleone
License: GPL-2.0-or-later
*/

/* =====================================================================
   Fonts (self-hosted, SIL Open Font License; see scripts/fetch-assets.py)
   ================================================================== */
@font-face {
	font-family: "Fraunces";
	src: url("assets/fonts/fraunces-latin-wght-normal.woff2") format("woff2");
	font-weight: 100 900;
	font-style: normal;
	font-display: swap;
}
@font-face {
	font-family: "Almendra";
	src: url("assets/fonts/almendra-latin-700-normal.woff2") format("woff2");
	font-weight: 700;
	font-style: normal;
	font-display: swap;
}
@font-face {
	font-family: "Nunito Sans";
	src: url("assets/fonts/nunito-sans-latin-wght-normal.woff2") format("woff2");
	font-weight: 200 1000;
	font-style: normal;
	font-display: swap;
}
@font-face {
	font-family: "Nunito Sans";
	src: url("assets/fonts/nunito-sans-latin-wght-italic.woff2") format("woff2");
	font-weight: 200 1000;
	font-style: italic;
	font-display: swap;
}

/* =====================================================================
   Tokens — palette "Amarone": rosso scuro caldo, carta crema, oro
   ================================================================== */
:root {
	--accent: #561010;                                         /* rosso Amarone */
	--accent-dark: color-mix(in srgb, var(--accent) 75%, #1c0703);
	--accent-darker: color-mix(in srgb, var(--accent) 52%, #140502);

	--ink: #261510;                                            /* titoli */
	--text: #40302a;
	--muted: #746052;
	--rule: #e6d5bd;                                           /* filetti, bordi */
	--paper: #f4e9d8;                                          /* fondo crema */
	--surface: #fffaf1;                                        /* card */
	--gold: #c8963e;                                           /* dettagli */
	--radius: 6px;
	--shadow: 0 1px 2px rgba(75, 35, 12, .05), 0 10px 24px -16px rgba(75, 35, 12, .22);
	--shadow-hover: 0 2px 4px rgba(75, 35, 12, .06), 0 16px 30px -16px rgba(75, 35, 12, .3);

	--font-title: "Almendra", Georgia, "Times New Roman", serif;   /* masthead only */
	--font-head: "Fraunces", Georgia, "Times New Roman", serif;
	--font-body: "Nunito Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	--container: 1240px;
	--gutter: 1.5rem;
}

/* =====================================================================
   Base
   ================================================================== */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
	margin: 0;
	background: var(--paper);
	color: var(--text);
	font-family: var(--font-body);
	font-size: 17.5px;
	line-height: 1.65;
	-webkit-font-smoothing: antialiased;
	/* Footer always at the bottom, even on short pages */
	display: flex;
	flex-direction: column;
	min-height: 100vh;
}
body > * { flex-shrink: 0; }
body > .layout { flex-grow: 1; }
body.admin-bar { min-height: calc(100vh - var(--wp-admin--admin-bar--height, 32px)); }

h1, h2, h3, h4, h5, h6 {
	color: var(--ink);
	font-family: var(--font-head);
	font-weight: 600;
	line-height: 1.18;
	margin: 0 0 .5em;
}

a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--accent-dark); }
img { max-width: 100%; height: auto; display: block; }
p { margin: 0 0 1.2em; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.screen-reader-text {
	position: absolute !important;
	width: 1px; height: 1px;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	white-space: nowrap;
}
.skip-link:focus {
	position: fixed !important;
	top: .5rem; left: .5rem;
	width: auto; height: auto;
	clip: auto; clip-path: none;
	z-index: 100;
	padding: .75rem 1rem;
	background: #fff;
	color: var(--ink);
}

.container {
	width: 100%;
	max-width: var(--container);
	margin: 0 auto;
	padding: 0 var(--gutter);
}

/* Section titles: serif, with a short wine-red bar underneath */
.section-label,
.sidebar .widget-title {
	margin: 0 0 1.25rem;
	color: var(--ink);
	font-family: var(--font-head);
	font-size: 1.35rem;
	font-weight: 600;
	line-height: 1.25;
}
.section-label::after,
.sidebar .widget-title::after {
	content: "";
	display: block;
	width: 36px;
	height: 3px;
	margin-top: .5rem;
	background: var(--accent);
}
.sidebar .widget-title { font-size: 1.2rem; }

/* =====================================================================
   Header (masthead)
   ================================================================== */
.site-header {
	background: var(--accent);
	border-bottom: 3px solid var(--gold);
	color: #fff;
	position: relative;
	z-index: 10;
}
.site-header__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1.5rem;
	min-height: 92px;
}
.site-brand { display: flex; align-items: center; gap: .9rem; color: #fff; text-decoration: none; }
.site-brand__icon { flex: none; width: 64px; height: 64px; }
.site-brand__text { min-width: 0; }
.site-brand:hover { color: #fff; }
.site-title {
	margin: 0;
	color: #fff;
	font-family: var(--font-title);
	font-size: 2.3rem;
	font-weight: 700;
	line-height: 1.05;
}
.site-tagline {
	display: block;
	margin-top: .3rem;
	color: rgba(255, 255, 255, .78);
	font-size: .85rem;
	letter-spacing: .02em;
}
.custom-logo { max-height: 60px; width: auto; }

.primary-nav .menu {
	display: flex;
	gap: .25rem 2rem;
	margin: 0;
	padding: 0;
	list-style: none;
}
.primary-nav a {
	display: block;
	padding: .4rem 0;
	color: #fff;
	font-size: .82rem;
	font-weight: 800;
	letter-spacing: .12em;
	text-transform: uppercase;
	text-decoration: none;
	border-bottom: 2px solid transparent;
}
.primary-nav a:hover,
.primary-nav .current-menu-item > a { border-bottom-color: #fff; }

.menu-toggle { display: none; }

@media (max-width: 1024px) {
	.menu-toggle {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		width: 44px; height: 44px;
		padding: 0;
		background: transparent;
		border: 0;
		color: #fff;
		cursor: pointer;
	}
	.menu-toggle__bars,
	.menu-toggle__bars::before,
	.menu-toggle__bars::after {
		content: "";
		display: block;
		width: 22px; height: 2px;
		background: currentColor;
		position: relative;
		transition: transform .2s;
	}
	.menu-toggle__bars::before { position: absolute; top: -7px; }
	.menu-toggle__bars::after  { position: absolute; top: 7px; }
	.menu-toggle[aria-expanded="true"] .menu-toggle__bars { background: transparent; }
	.menu-toggle[aria-expanded="true"] .menu-toggle__bars::before { transform: translateY(7px) rotate(45deg); }
	.menu-toggle[aria-expanded="true"] .menu-toggle__bars::after  { transform: translateY(-7px) rotate(-45deg); }

	.primary-nav {
		display: none;
		position: absolute;
		top: 100%; left: 0; right: 0;
		background: var(--accent-dark);
		padding: 0 var(--gutter) .75rem;
	}
	.primary-nav.is-open { display: block; }
	.primary-nav .menu { flex-direction: column; gap: 0; }
	.primary-nav a { padding: .9rem 0; border-bottom: 1px solid rgba(255, 255, 255, .15); }
	.primary-nav .current-menu-item > a { border-bottom-color: rgba(255, 255, 255, .15); text-decoration: underline; }
	.site-brand { gap: .65rem; }
	.site-brand__icon { width: 48px; height: 48px; }
	.site-title { font-size: 1.6rem; }
	.site-tagline { font-size: .78rem; }
}

/* =====================================================================
   Layout: content left, side column right
   ================================================================== */
.layout {
	padding-top: 2.75rem;
	padding-bottom: 4.5rem;
}
@media (min-width: 1025px) {
	.layout {
		display: grid;
		grid-template-columns: minmax(0, 5fr) minmax(0, 2fr);
		column-gap: 4.5rem;
		align-items: start;
	}
	.content { grid-column: 1; grid-row: 1; min-width: 0; }
	.sidebar { grid-column: 2; grid-row: 1; align-self: stretch; min-width: 0; }
	.sidebar__inner { position: sticky; top: var(--sticky-top, 20px); }
}
@media (max-width: 1024px) {
	.sidebar { margin-top: 3.5rem; }
}

/* =====================================================================
   News list
   ================================================================== */
.story {
	position: relative;
	margin: 0 0 1.25rem;
	background: var(--surface);
	border: 1px solid var(--rule);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	overflow: hidden;
	transition: box-shadow .2s;
}
.story:hover { box-shadow: var(--shadow-hover); }
.story__body { padding: 1.15rem 1.6rem 1.3rem; }
.story--media { display: grid; }
@media (min-width: 700px) {
	.story--media { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); }
	/* The photo fills the card but never sets its height (text does):
	   absolutely positioned, so tall/square photos can't stretch the card. */
	.story--media .story__thumb { position: relative; }
	.story--media .story__thumb img { position: absolute; inset: 0; height: 100%; aspect-ratio: auto; }
}
@media (max-width: 600px) {
	.story__body { padding: 1rem 1.15rem 1.15rem; }
}
.story__thumb { display: block; overflow: hidden; }
.story__thumb img {
	width: 100%;
	aspect-ratio: 16 / 9;
	object-fit: cover;
	transition: transform .4s;
}
.story:hover .story__thumb img { transform: scale(1.03); }

/* Press releases only */
.press-chip {
	display: flex;
	align-items: center;
	gap: .4rem;
	width: fit-content;
	margin-bottom: .7rem;
	padding: .22rem .75rem .22rem .6rem;
	border-radius: 999px;
	background: var(--accent);
	color: #fff;
	font-size: .78rem;
	font-weight: 700;
	line-height: 1.4;
}
.press-chip__icon { flex: none; }

/* The whole card is clickable: the title link stretches over it */
.story__title a::after,
.related__title a::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
	border-radius: var(--radius);
}
.story__title a:focus-visible,
.related__title a:focus-visible { outline: 0; }
.story__title a:focus-visible::after,
.related__title a:focus-visible::after { outline: 2px solid var(--accent); outline-offset: -2px; }

/* Chip + date on one row: the chip adds no height to the card */
.story__top {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: .25rem .7rem;
	min-height: 1.75rem;
	margin-bottom: .35rem;
}
.story__top .press-chip { margin-bottom: 0; }
.story__top .entry-meta { margin: 0; }

.story__title { font-size: 1.4rem; margin: 0 0 .4rem; }
.story__title a { color: var(--ink); text-decoration: none; }
.story:hover .story__title a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 2px; }

.entry-meta {
	margin: 0 0 .9rem;
	color: var(--muted);
	font-size: .85rem;
}
.entry-meta__sep { color: var(--rule); }

/* Excerpt capped at 3 lines, so every card stays slim */
.story__excerpt p {
	display: -webkit-box;
	margin: 0;
	font-size: .98rem;
	line-height: 1.55;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 3;
	line-clamp: 3;
	overflow: hidden;
}

.empty-state { padding: 2rem 0; color: var(--muted); }

/* Archive title ("Comunicati stampa") */
.archive-header { margin-bottom: 2rem; }
.archive-header::after { content: ""; display: block; width: 48px; height: 3px; margin-top: .9rem; background: var(--accent); }
.archive-header__title { margin: 0; font-size: clamp(2rem, 3.4vw, 2.75rem); }
.archive-header__desc { margin-top: .4rem; color: var(--muted); }
.archive-header__desc p { margin: 0; }

/* Pagination */
.pagination .nav-links { display: flex; flex-wrap: wrap; gap: .4rem; }
.pagination .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 2.6rem;
	height: 2.6rem;
	padding: 0 .7rem;
	border: 1px solid var(--rule);
	border-radius: 4px;
	background: var(--surface);
	color: var(--ink);
	font-weight: 700;
	text-decoration: none;
}
.pagination a.page-numbers:hover { border-color: var(--accent); color: var(--accent); }
.pagination .page-numbers.current { background: var(--accent); border-color: var(--accent); color: #fff; }
.pagination .page-numbers.dots { border: 0; }

/* =====================================================================
   Single post / page
   ================================================================== */
.entry__title { font-size: clamp(2rem, 3.6vw, 2.8rem); margin: 0 0 .6rem; letter-spacing: -.01em; }
.entry .entry-meta { margin-bottom: 1.5rem; }
.entry__thumb { margin: 0 0 2rem; }
.entry__thumb img { width: 100%; max-height: 540px; object-fit: cover; }
.entry__thumb figcaption { margin-top: .5rem; color: var(--muted); font-size: .75rem; }
@media (max-width: 600px) { .entry__thumb { margin-bottom: 1.5rem; } }
.entry__content { overflow-wrap: break-word; font-size: 1.07rem; line-height: 1.75; max-width: 44rem; }
.entry__content > :last-child { margin-bottom: 0; }
.entry__content h2 { font-size: 1.6rem; margin-top: 1.6em; }
.entry__content h3 { font-size: 1.3rem; margin-top: 1.6em; }
.entry__content blockquote {
	margin: 1.75em 0;
	padding: 0 0 0 1.25em;
	border-left: 3px solid var(--accent);
	color: var(--ink);
	font-family: var(--font-head);
	font-size: 1.25em;
	line-height: 1.45;
}
.entry__content figure { margin: 1.75em 0; }
.entry__content figcaption { color: var(--muted); font-size: .8rem; margin-top: .5em; }

/* Previous / next */
.post-navigation { margin-top: 3rem; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.post-navigation .nav-links { display: grid; grid-template-columns: 1fr 1fr; }
.post-navigation .nav-previous,
.post-navigation .nav-next { padding: 1.25rem 0; }
.post-navigation .nav-next { text-align: right; grid-column: 2; padding-left: 1.5rem; }
.post-navigation .nav-previous { padding-right: 1.5rem; }
.post-navigation .nav-previous + .nav-next { border-left: 1px solid var(--rule); }
.post-navigation a { display: block; text-decoration: none; }
.post-navigation a:hover .post-nav__title { color: var(--accent); }
.post-nav__label {
	display: block;
	margin-bottom: .25rem;
	color: var(--muted);
	font-size: .72rem;
	font-weight: 800;
	letter-spacing: .14em;
	text-transform: uppercase;
}
.post-nav__title { display: block; color: var(--ink); font-family: var(--font-head); font-size: 1.15rem; line-height: 1.3; }
@media (max-width: 600px) {
	.post-navigation .nav-links { grid-template-columns: 1fr; }
	.post-navigation .nav-next { grid-column: 1; text-align: left; padding-left: 0; }
	.post-navigation .nav-previous + .nav-next { border-left: 0; border-top: 1px solid var(--rule); }
}

/* Related posts */
.related { margin-top: 3.5rem; }
.related__grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
	gap: 2rem 1.75rem;
}
.related__item {
	position: relative;
	background: var(--surface);
	border: 1px solid var(--rule);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	overflow: hidden;
	padding-bottom: 1.1rem;
	transition: box-shadow .2s;
}
.related__item:hover { box-shadow: var(--shadow-hover); }
.related__item > :not(.related__thumb) { margin-left: 1.1rem; margin-right: 1.1rem; }
.related__thumb + *,
.related__item > :first-child:not(.related__thumb) { margin-top: 1rem; }
.related__thumb { display: block; }
.related__thumb img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; }
.related__title { font-size: 1.1rem; line-height: 1.3; margin: 0 0 .35rem; }
.related__title a { color: var(--ink); text-decoration: none; }
.related__item:hover .related__title a { color: var(--accent); text-decoration: underline; }
.related__item .entry-meta { margin-top: 0; margin-bottom: 0; font-size: .8rem; }
.related__item .entry-meta__author,
.related__item .entry-meta__sep { display: none; }

/* =====================================================================
   Side column
   ================================================================== */
.sidebar .widget {
	background: var(--surface);
	border: 1px solid var(--rule);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	padding: 1.4rem 1.5rem 1.5rem;
}
.sidebar .widget + .widget { margin-top: 1.75rem; }
/* The Spreaker player sits directly on the page: no panel around it */
.sidebar .widget_brancaleone_spreaker {
	background: none;
	border: 0;
	box-shadow: none;
	padding: 0;
}
.sidebar .widget + .widget_brancaleone_spreaker { margin-top: 2.25rem; }

/* "Comunicati stampa recenti" (core Latest Posts block) */
.brancaleone-press .wp-block-latest-posts { margin: 0; padding: 0; list-style: none; }
.brancaleone-press .wp-block-latest-posts li {
	margin: 0;
	padding: .8rem 0;
	border-bottom: 1px solid var(--rule);
}
.brancaleone-press .wp-block-latest-posts li:first-child { padding-top: 0; }
.brancaleone-press .wp-block-latest-posts__post-title {
	display: block;
	color: var(--ink);
	font-family: var(--font-head);
	font-size: 1.05rem;
	font-weight: 600;
	line-height: 1.3;
	text-decoration: none;
}
.brancaleone-press .wp-block-latest-posts__post-title:hover { color: var(--accent); text-decoration: underline; }
.brancaleone-press .wp-block-latest-posts__post-date {
	display: block;
	margin-top: .25rem;
	color: var(--muted);
	font-size: .8rem;
}
.brancaleone-press__all { margin: .9rem 0 0; font-size: .9rem; font-weight: 700; }
.brancaleone-press__all a { text-decoration: none; }
.brancaleone-press__all a:hover { text-decoration: underline; }

/* Spreaker player */
.spreaker-player { scroll-margin-top: 1.5rem; }
.spreaker-player iframe { display: block; width: 100%; border: 0; border-radius: 0 !important; }
.spreaker-player--empty { font-size: .9rem; color: var(--muted); }

/* =====================================================================
   Footer
   ================================================================== */
.site-footer { color: rgba(255, 244, 228, .82); font-size: .95rem; }
.site-footer a { color: #fff; text-decoration: underline; text-decoration-color: rgba(255, 255, 255, .35); }
.site-footer a:hover { text-decoration-color: #fff; }

.site-footer__main { background: var(--accent-dark); border-top: 3px solid var(--gold); padding: 3.25rem 0 3rem; }
.site-footer__grid {
	display: grid;
	grid-template-columns: 2fr 1fr;
	gap: 2.5rem 4rem;
}
@media (max-width: 767px) { .site-footer__grid { grid-template-columns: 1fr; } }
.site-footer .widget-title {
	margin: 0 0 .8rem;
	color: #fff;
	font-family: var(--font-head);
	font-size: 1.2rem;
	font-weight: 600;
}
.site-footer .widget p { margin: 0 0 .6rem; line-height: 1.6; }
.site-footer .widget > :last-child,
.site-footer .wp-block-group__inner-container > :last-child { margin-bottom: 0; }

.site-footer__bottom { background: var(--accent-darker); font-size: .82rem; color: rgba(255, 244, 228, .65); }
.site-footer__bottom-inner {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: .5rem 2rem;
	padding-top: 1.1rem;
	padding-bottom: 1.1rem;
}
.site-footer__copy { margin: 0; }
.footer-nav .menu { display: flex; flex-wrap: wrap; gap: .25rem 1.5rem; margin: 0; padding: 0; list-style: none; }
.footer-nav a { color: rgba(255, 244, 228, .8); text-decoration: none; }
.footer-nav a:hover { color: #fff; text-decoration: underline; }

/* =====================================================================
   Core block alignment helpers
   ================================================================== */
.alignleft { float: left; margin: .25em 1.5em 1em 0; }
.alignright { float: right; margin: .25em 0 1em 1.5em; }
.aligncenter { margin-left: auto; margin-right: auto; }
.wp-caption-text, .wp-element-caption { color: var(--muted); font-size: .8rem; }
