/*
Theme Name: OFS Sabbioncello
Theme URI: https://ofssabbioncello.it
Author: Blu Taco
Author URI: https://blutaco.it
Description: Tema leggero per la Fraternità OFS di Sabbioncello. Riprende il layout del sito costruito con Total + WPBakery senza dipendenze esterne.
Version: 1.0.0
Requires at least: 6.6
Requires PHP: 8.2
License: GPL-2.0-or-later
Text Domain: ofs
*/

/* Sfondo "ricepaper" da Subtle Patterns (CC BY-SA 3.0). */

:root {
	--ofs-red: #740000;
	--ofs-red-hover: #723c3c;
	--ofs-red-dark: #722121;
	--ofs-blue: #20478c;
	--ofs-text: #666;
	--ofs-muted: #777;
	--ofs-border: #eee;
	--ofs-light: #f7f7f7;
	--ofs-gold: #f9b53d;
	--ofs-gold-hover: #f99e00;
	--ofs-sans: Lato, system-ui, -apple-system, "Segoe UI", sans-serif;
	--ofs-serif: "Playfair Display", Georgia, serif;
	--ofs-container: min(980px, 100% - 40px);
	--ofs-header-h: 100px;
}

/* ---- Base ------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
	margin: 0;
	min-height: 100vh;
	display: flex;
	flex-direction: column;
	font: 400 15px/1.65 var(--ofs-sans);
	color: var(--ofs-text);
	background: #fff url(assets/img/ricepaper.png) repeat;
}
.site-main { flex: 1 0 auto; }
img { max-width: 100%; height: auto; }
a { color: var(--ofs-red); text-decoration: none; }
a:hover, a:focus { color: var(--ofs-red-hover); }
:focus-visible { outline: 2px solid var(--ofs-blue); outline-offset: 2px; }
p { margin: 0 0 20px; }
ul, ol { margin: 0 0 20px; padding-left: 1.5em; }
blockquote { margin: 0 0 20px; padding-left: 20px; border-left: 3px solid var(--ofs-border); font-style: italic; }
hr { border: 0; border-top: 1px solid var(--ofs-border); margin: 30px 0; }
table { width: 100%; border-collapse: collapse; margin: 0 0 20px; }
th, td { border: 1px solid var(--ofs-border); padding: 6px 10px; text-align: left; }

h1, h2, h3, h4, h5, h6 {
	font-family: var(--ofs-serif);
	font-weight: 600;
	color: var(--ofs-blue);
	line-height: 1.5;
	margin: 30px 0 20px;
}
h1, h2 { font-size: 30px; }
h3 { font-size: 17px; }
h4, h5, h6 { font-size: 15px; }
.entry-content > :first-child,
.ofs-section > :first-child { margin-top: 0; }

.container { width: var(--ofs-container); margin-inline: auto; }
.section { padding: 40px 0 50px; }

.screen-reader-text {
	position: absolute !important;
	width: 1px; height: 1px;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	white-space: nowrap;
}
.skip-link { position: absolute; left: -9999px; top: 0; z-index: 1000; padding: 10px 15px; background: #fff; }
.skip-link:focus { left: 10px; top: 10px; }

/* Pulsanti (anche i link "button" scritti a mano nei contenuti) */
.button,
.wp-block-button__link,
.wp-block-latest-posts__read-more,
input[type="submit"],
button[type="submit"] {
	display: inline-block;
	padding: 7px 15px;
	border: 0;
	border-radius: 3px;
	background: var(--ofs-red);
	color: #fff;
	font: 400 13.85px/1.65 var(--ofs-sans);
	cursor: pointer;
	transition: background-color .15s;
}
.button:hover, .button:focus,
.wp-block-button__link:hover,
.wp-block-latest-posts__read-more:hover,
input[type="submit"]:hover,
button[type="submit"]:hover { background: var(--ofs-red-hover); color: #fff; }
.button--readmore,
.wp-block-latest-posts__read-more { font-weight: 700; text-transform: uppercase; letter-spacing: 1px; }

/* ---- Testata ---------------------------------------------------------- */
.site-top {
	position: sticky;
	top: var(--wp-admin--admin-bar--height, 0px);
	z-index: 100;
}
.topbar {
	background: var(--ofs-red);
	color: #fff;
	font-size: 13.85px;
	line-height: 1.65;
	text-align: center;
	padding: 10px 0;
	border-bottom: 1px solid var(--ofs-border);
}
.topbar strong { font-weight: 700; }
.topbar a { color: #fff; }

.site-header { background: #fff; }
.site-header__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	min-height: var(--ofs-header-h);
	padding: 10px 0;
}
.site-logo img, .site-logo .custom-logo { display: block; width: auto; height: 80px; }
.site-logo a { display: block; font-family: var(--ofs-serif); font-weight: 600; }

.site-nav__list {
	display: flex;
	flex-wrap: wrap;
	gap: 0 22px;
	margin: 0;
	padding: 0;
	list-style: none;
}
.site-nav__list a {
	display: block;
	padding: 0 4px;
	line-height: 50px;
	font: 600 15px/50px var(--ofs-serif);
	color: var(--ofs-red);
}
.site-nav__list a:hover { color: var(--ofs-red-hover); }
.site-nav__list .current-menu-item > a,
.site-nav__list .current-menu-ancestor > a,
.site-nav__list .current_page_parent > a { color: var(--ofs-blue); }
.single-post .site-nav__list .current_page_parent > a { color: var(--ofs-blue); }

.nav-toggle {
	display: none;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	background: none;
	color: var(--ofs-text);
	cursor: pointer;
}
.nav-toggle__bars,
.nav-toggle__bars::before,
.nav-toggle__bars::after {
	display: block;
	width: 22px;
	height: 2px;
	margin: 0 auto;
	background: currentColor;
	content: "";
	transition: transform .2s;
}
.nav-toggle__bars::before { transform: translateY(-7px); }
.nav-toggle__bars::after { transform: translateY(5px); }
.nav-open .nav-toggle__bars { background: transparent; }
.nav-open .nav-toggle__bars::before { transform: translateY(0) rotate(45deg); }
.nav-open .nav-toggle__bars::after { transform: translateY(-2px) rotate(-45deg); }

/* ---- Testata pagina (titolo + breadcrumb) ----------------------------- */
.page-header {
	background: var(--ofs-light);
	border-top: 1px solid var(--ofs-border);
	border-bottom: 1px solid var(--ofs-border);
	padding: 10px 0 20px;
	text-align: center;
}
.page-header__title { margin: 0; font-size: 32px; line-height: 1.4; }
.breadcrumbs { padding-top: 5px; font-size: 13.5px; color: #bcbcbc; }
.breadcrumbs a { color: var(--ofs-muted); }
.breadcrumbs a:hover { color: var(--ofs-red-hover); }

/* ---- Pagine a blocchi (ex WPBakery) ------------------------------------ */
.entry-content--blocks > :not(.alignfull),
.ofs-section.is-layout-constrained > :not(.alignfull) {
	max-width: var(--ofs-container) !important;
	margin-inline: auto !important;
}
.entry-content--blocks > * { margin-block: 0; }
.entry-content--blocks > :not(.alignfull):not(.ofs-section) { margin-block: 40px; }

.ofs-hero { margin: 0; }
body .wp-block-image.ofs-hero img {
	display: block;
	width: 100%;
	height: clamp(220px, 35vw, 500px);
	object-fit: cover;
	object-position: center;
}
body .ofs-hero-map { padding: 0; }
body .ofs-hero-map.is-layout-constrained > * { max-width: none !important; margin: 0 !important; }
body .ofs-hero-map .ofs-map iframe { height: clamp(300px, 35vw, 450px); }

.ofs-section { padding: 50px 0; }
.ofs-section--white { background: #fff; }
.ofs-section--gray { background: #dedede; }
.ofs-section + .ofs-section:not(.ofs-section--white):not(.ofs-section--gray) { padding-top: 30px; }

.wp-block-columns { gap: 30px; margin-bottom: 0; }
.wp-block-image { margin: 0 0 20px; }
.wp-block-image img { display: block; }

body .ofs-map iframe { display: block; width: 100%; height: 400px; border: 0; }

.ofs-gallery.wp-block-gallery { gap: 15px; }

/* Etichette scritte nei contenuti (es. "indirizzo") */
.subtitle { text-transform: uppercase; color: var(--ofs-blue); }
span.subtitle { display: inline-block; font-size: 13px; font-weight: 700; }
.site-footer .subtitle { display: block; font-size: 15px; }

/* "Le ultime notizie" / "Documenti" in home */
body ul.wp-block-latest-posts.ofs-cards.is-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 20px;
	align-items: start;
	margin: 0;
	padding: 0;
}
body .wp-block-latest-posts.ofs-cards li {
	display: flex;
	flex-direction: column;
	width: auto !important;
	margin: 0 !important;
	padding: 15px;
	background: var(--ofs-light);
	border: 1px solid var(--ofs-border);
}
body .wp-block-latest-posts.ofs-cards .wp-block-latest-posts__featured-image { margin: -15px -15px 15px; }
body .wp-block-latest-posts.ofs-cards .wp-block-latest-posts__featured-image img { display: block; width: 100%; height: auto; }
body .wp-block-latest-posts.ofs-cards .wp-block-latest-posts__post-title {
	font: 600 16px/1.65 var(--ofs-serif);
	color: var(--ofs-blue);
}
body .wp-block-latest-posts.ofs-cards .wp-block-latest-posts__post-title:hover { color: var(--ofs-red-hover); }
body .wp-block-latest-posts.ofs-cards .wp-block-latest-posts__post-date { margin: 5px 0; font-size: 13.85px; color: var(--ofs-muted); }
body .wp-block-latest-posts.ofs-cards .wp-block-latest-posts__post-excerpt { margin: 5px 0 0; }
body .wp-block-latest-posts.ofs-cards .wp-block-latest-posts__read-more { align-self: flex-start; margin-top: 15px; }

/* ---- Griglia articoli (Notizie, categorie, ricerca) ------------------- */
.card-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 20px;
	align-items: start;
}
.card {
	background: #fff;
	border: 1px solid var(--ofs-border);
}
.card__media { display: block; overflow: hidden; }
.card__media img { display: block; width: 100%; height: auto; transition: transform .4s; }
.card__media:hover img { transform: scale(1.05); }
.card__body { padding: 20px; }
.card__title { margin: 0 0 10px; font-size: 18.5px; line-height: 1.5; }
.card__title a { color: var(--ofs-blue); }
.card__title a:hover { color: var(--ofs-red-hover); }
.card__excerpt { margin: 10px 0 20px; }
.card__excerpt p { margin: 0; }

.entry-meta { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 13.85px; color: var(--ofs-muted); }
.entry-meta__item { display: inline-flex; align-items: center; gap: 6px; }
.entry-meta a { color: var(--ofs-muted); }
.entry-meta a:hover { color: var(--ofs-red-hover); }
.entry-meta svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.5; }

.pagination { margin-top: 40px; text-align: center; }
.pagination .nav-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.pagination .page-numbers {
	display: inline-block;
	min-width: 36px;
	padding: 6px 10px;
	border: 1px solid var(--ofs-border);
	background: #fff;
}
.pagination .page-numbers.current { background: var(--ofs-red); border-color: var(--ofs-red); color: #fff; }

/* ---- Articolo singolo ------------------------------------------------- */
.single__media { margin: 0 0 20px; text-align: center; }
.single__media img { display: inline-block; }
.single .entry-meta { margin-bottom: 20px; }
.single .entry-content { margin-bottom: 40px; }
.entry-content::after { content: ""; display: table; clear: both; }
.entry-content .alignleft { float: left; margin: 0 20px 20px 0; }
.entry-content .alignright { float: right; margin: 0 0 20px 20px; }
.entry-content .aligncenter { display: block; margin-inline: auto; }
.wp-caption { max-width: 100%; }
.wp-caption-text { font-size: 13px; color: var(--ofs-muted); }
.entry-content iframe { max-width: 100%; }

.share { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 40px; padding: 0; list-style: none; }
.share a {
	display: inline-block;
	padding: 5px 11px;
	border: 1px solid #e8e8e8;
	background: #fff;
	font-size: 13.85px;
	color: #999;
}
.share a:hover { color: var(--ofs-red); border-color: currentColor; }

.related__title { margin: 0 0 20px; padding-top: 20px; border-top: 1px solid var(--ofs-border); font-size: 17px; }
.related__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.related__item { padding: 20px; background: #fff; }
.related__item h3 { margin: 0 0 10px; font-size: 15px; }
.related__item h3 a { color: var(--ofs-blue); }
.related__item p { margin: 0; font-size: 14px; }

.post-nav { background: #fff; padding: 23px 0; }
.post-nav__inner { display: flex; justify-content: space-between; gap: 20px; font-size: 16px; }
.post-nav a { color: #888; }
.post-nav a:hover { color: var(--ofs-red); }
.post-nav__next { margin-left: auto; text-align: right; }

/* ---- Ricerca ---------------------------------------------------------- */
.search-form { display: flex; gap: 8px; max-width: 420px; }
.search-form label { flex: 1; }
.search-field { width: 100%; padding: 7px 10px; border: 1px solid #ddd; font: inherit; }

/* ---- Footer ----------------------------------------------------------- */
.site-footer { background: var(--ofs-red); color: #fff; }
.site-footer a { color: #fff; }
.site-footer a:hover { color: var(--ofs-gold); }
.site-footer__widgets {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 30px;
	padding: 45px 0 0;
}
.footer-widget { padding-bottom: 45px; }
.footer-widget p { margin: 0 0 20px; }
.footer-widget ul { margin: 0; padding: 0; list-style: none; }
.footer-widget .subtitle,
.footer-widget__title {
	margin: 0 0 10px;
	font: 700 15px/1.65 var(--ofs-sans);
	color: #fff;
	text-transform: uppercase;
}
.site-footer__bottom {
	background: var(--ofs-red-dark);
	padding: 20px 0;
	font-size: 13.85px;
	text-align: center;
}
.site-footer__bottom a { color: var(--ofs-gold); font-weight: 700; text-transform: uppercase; }
.site-footer__bottom a:hover { color: var(--ofs-gold-hover); }

/* ---- Mobile ----------------------------------------------------------- */
@media (max-width: 959px) {
	:root { --ofs-header-h: 70px; }
	.site-logo img, .site-logo .custom-logo { height: 54px; }
	.nav-toggle { display: block; }
	.site-nav {
		display: none;
		position: absolute;
		top: 100%;
		left: 0;
		right: 0;
		background: #fff;
		border-top: 1px solid var(--ofs-border);
		box-shadow: 0 8px 16px rgba(0, 0, 0, .08);
		max-height: calc(100vh - 150px);
		overflow-y: auto;
	}
	.site-header { position: relative; }
	.nav-open .site-nav { display: block; }
	.site-nav__list { display: block; width: var(--ofs-container); margin: 0 auto; padding: 8px 0; }
	.site-nav__list li + li { border-top: 1px solid var(--ofs-border); }
	.site-nav__list a { line-height: 46px; }

	.card-grid,
	.related__grid,
	body ul.wp-block-latest-posts.ofs-cards.is-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.site-footer__widgets { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 767px) {
	h1, h2 { font-size: 26px; }
	.page-header__title { font-size: 26px; }
	.ofs-section { padding: 40px 0; }
	.ofs-hide-mobile { display: none; }
	.card-grid,
	.related__grid,
	body ul.wp-block-latest-posts.ofs-cards.is-grid,
	.site-footer__widgets { grid-template-columns: 1fr; }
	body ul.wp-block-latest-posts.ofs-cards.is-grid { align-items: stretch; }
	.post-nav__inner { flex-direction: column; }
	.post-nav__next { text-align: left; margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { transition: none !important; }
}
