/*
Theme Name: Nordest Ingegneria
Theme URI: https://nordestingegneria.com
Author: Giacomo Novello
Description: Tema su misura per Nordest Ingegneria: header e footer custom, contenuti costruiti solo con blocchi Gutenberg e pattern per tutte le pagine del sito.
Version: 1.4.5
Requires at least: 7.0
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: nordestingegneria_theme
Tags: blog, one-column, two-columns, right-sidebar, custom-logo, custom-menu, featured-images, threaded-comments, translation-ready, block-styles, wide-blocks
*/

/* ---------------------------------------------------------
   1. Variabili
--------------------------------------------------------- */
:root {
	--ss-color-primary: var(--wp--preset--color--primary);
	--ss-color-primary-dark: var(--wp--preset--color--accent);
	--ss-color-text: var(--wp--preset--color--navy);
	--ss-color-muted: var(--wp--preset--color--muted);
	--ss-color-border: #dde3ea;
	--ss-color-bg: var(--wp--preset--color--white);
	--ss-color-bg-alt: var(--wp--preset--color--light);
	--ss-font-body: var(--wp--preset--font-family--montserrat);
	--ss-font-heading: var(--ss-font-body);
	--ss-radius: 30px;
	--ss-content-width: 1140px;
	--ss-shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .06);
}

/* ---------------------------------------------------------
   2. Reset di base
--------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

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

/* Font, colori e dimensioni di testo e titoli arrivano da theme.json. */
body { margin: 0; }

img, svg, video, iframe { max-width: 100%; height: auto; }
figure { margin: 0 0 1.5rem; }

a { text-decoration: none; }
a:hover, a:focus { text-decoration: underline; }

h1, h2, h3, h4, h5, h6 { margin: 0 0 .6em; }

p, ul, ol, dl, pre, table, blockquote { margin: 0 0 1.5rem; }

/* Dentro i contenuti a blocchi la spaziatura la gestisce il blockGap di theme.json. */
.is-block-page .entry-content :where(h1, h2, h3, h4, h5, h6, p, ul, ol, figure, blockquote) { margin-block-end: 0; }

blockquote {
	padding: .25rem 0 .25rem 1.25rem;
	border-left: 4px solid var(--ss-color-primary);
	color: var(--ss-color-muted);
	font-style: italic;
}

code, kbd, pre, samp { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; }
pre {
	padding: 1rem;
	background: var(--ss-color-bg-alt);
	border: 1px solid var(--ss-color-border);
	border-radius: var(--ss-radius);
	overflow-x: auto;
}
code { background: var(--ss-color-bg-alt); padding: .15em .4em; border-radius: 4px; }
pre code { background: none; padding: 0; }

table { width: 100%; border-collapse: collapse; }
th, td { padding: .6rem .75rem; border: 1px solid var(--ss-color-border); text-align: left; }
th { background: var(--ss-color-bg-alt); }

hr { border: 0; border-top: 1px solid var(--ss-color-border); margin: 2.5rem 0; }

/* ---------------------------------------------------------
   3. Accessibilita
--------------------------------------------------------- */
.screen-reader-text {
	position: absolute !important;
	width: 1px; height: 1px;
	padding: 0; margin: -1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}
.skip-link:focus {
	position: absolute !important;
	top: 8px; left: 8px;
	z-index: 100000;
	width: auto; height: auto;
	padding: .75rem 1rem;
	clip-path: none;
	background: #fff;
	border-radius: var(--ss-radius);
	box-shadow: var(--ss-shadow);
}
:focus-visible { outline: 2px solid var(--ss-color-primary); outline-offset: 2px; }

/* ---------------------------------------------------------
   4. Layout
--------------------------------------------------------- */
.ss-container {
	width: 100%;
	max-width: var(--ss-content-width);
	margin: 0 auto;
	padding: 0 1.25rem;
}

.site-content { padding: 2.5rem 0 3rem; }

.ss-layout {
	display: grid;
	gap: 2.5rem;
	grid-template-columns: 1fr;
}
@media (min-width: 900px) {
	.ss-layout.has-sidebar { grid-template-columns: minmax(0, 1fr) 320px; }
}

/* Pagine costruite a blocchi: niente contenitore fisso, le sezioni
   usano la larghezza di theme.json e "Larghezza piena" arriva ai bordi. */
.is-block-page .site-content { padding: 0; }
.is-block-page .entry-header { padding-top: var(--wp--preset--spacing--50); }
.is-block-page .entry-content > .alignfull { margin-block: 0; }
.is-block-page .entry-content > :last-child:not(.alignfull) { margin-block-end: var(--wp--preset--spacing--50); }

/* ---------------------------------------------------------
   6. Articoli
--------------------------------------------------------- */
.page-header { margin-bottom: 2rem; }
.page-title { margin-bottom: .35rem; }
.archive-description { color: var(--ss-color-muted); }

.entry {
	padding-bottom: 2rem;
	margin-bottom: 2rem;
	border-bottom: 1px solid var(--ss-color-border);
}
.entry:last-of-type { border-bottom: 0; }

.entry-title { margin-bottom: .5rem; }
.entry-title a { color: var(--ss-color-text); text-decoration: none; }
.entry-title a:hover { color: var(--ss-color-primary); }

.entry-meta {
	font-size: .85rem;
	color: var(--ss-color-muted);
	margin-bottom: 1rem;
	display: flex;
	flex-wrap: wrap;
	gap: .35rem 1rem;
}
.entry-meta a { color: var(--ss-color-muted); }
.entry-meta a:hover { color: var(--ss-color-primary); }

.entry-thumbnail { margin-bottom: 1.25rem; }
.entry-thumbnail img { width: 100%; border-radius: var(--ss-radius); display: block; }

.entry-content > *:last-child { margin-bottom: 0; }
.entry-footer { margin-top: 1.5rem; font-size: .9rem; color: var(--ss-color-muted); }

.more-link {
	display: inline-block;
	margin-top: .5rem;
	font-weight: 600;
}

/* Blocchi larghi negli articoli (nelle pagine a blocchi li gestisce theme.json). */
body:not(.is-block-page) .entry-content .alignwide,
body:not(.is-block-page) .entry-content .alignfull {
	margin-left: calc(50% - 50vw);
	margin-right: calc(50% - 50vw);
	max-width: 100vw;
}
@media (min-width: 900px) {
	.ss-layout.has-sidebar .entry-content .alignwide,
	.ss-layout.has-sidebar .entry-content .alignfull { margin-left: 0; margin-right: 0; max-width: 100%; }
}
.alignleft { float: left; margin: 0 1.5rem 1rem 0; }
.alignright { float: right; margin: 0 0 1rem 1.5rem; }
.aligncenter { margin-left: auto; margin-right: auto; display: block; }
.wp-caption-text, .wp-element-caption { font-size: .85rem; color: var(--ss-color-muted); text-align: center; }

.sticky .entry-title::after {
	content: "\2605";
	color: var(--ss-color-primary);
	margin-left: .4rem;
}

/* ---------------------------------------------------------
   7. Form e pulsanti
--------------------------------------------------------- */
input[type="text"], input[type="email"], input[type="url"], input[type="password"],
input[type="search"], input[type="tel"], input[type="number"], input[type="date"], textarea, select {
	width: 100%;
	padding: .65rem .8rem;
	font: inherit;
	color: var(--ss-color-text);
	background: #fff;
	border: 1px solid var(--ss-color-border);
	border-radius: var(--ss-radius);
}
textarea { min-height: 140px; resize: vertical; }

button, input[type="submit"], .wp-block-button__link, .ss-button {
	display: inline-block;
	padding: .7rem 1.25rem;
	font: inherit;
	font-weight: 600;
	color: #fff;
	background: var(--ss-color-primary);
	border: 0;
	border-radius: var(--ss-radius);
	cursor: pointer;
	text-decoration: none;
	transition: background .15s ease;
}
button:hover, input[type="submit"]:hover, .ss-button:hover {
	background: var(--ss-color-primary-dark);
	color: #fff;
	text-decoration: none;
}

.search-form { display: flex; gap: .5rem; }
.search-form label { flex: 1; margin: 0; }

/* ---------------------------------------------------------
   8. Sidebar e widget
--------------------------------------------------------- */
.widget-area .widget,
.footer-widgets .widget { margin-bottom: 2rem; }
.widget-title {
	font-size: 1.05rem;
	text-transform: uppercase;
	letter-spacing: .04em;
	margin-bottom: .9rem;
}
.widget ul { list-style: none; padding: 0; margin: 0; }
.widget ul li { padding: .4rem 0; border-bottom: 1px solid var(--ss-color-border); }
.widget ul li:last-child { border-bottom: 0; }

/* ---------------------------------------------------------
   9. Paginazione
--------------------------------------------------------- */
.ss-pagination { margin-top: 2rem; }
.ss-pagination .nav-links { display: flex; flex-wrap: wrap; gap: .4rem; }
.ss-pagination .page-numbers {
	display: inline-block;
	padding: .45rem .85rem;
	border: 1px solid var(--ss-color-border);
	border-radius: var(--ss-radius);
	color: var(--ss-color-text);
	text-decoration: none;
}
.ss-pagination .page-numbers.current,
.ss-pagination .page-numbers:hover {
	background: var(--ss-color-primary);
	border-color: var(--ss-color-primary);
	color: #fff;
	text-decoration: none;
}
.post-navigation { margin-top: 2.5rem; }
.post-navigation .nav-links { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; }

/* ---------------------------------------------------------
   10. Commenti
--------------------------------------------------------- */
.comments-area { margin-top: 3rem; padding-top: 2rem; border-top: 1px solid var(--ss-color-border); }
.comment-list { list-style: none; margin: 0 0 2rem; padding: 0; }
.comment-list ol.children { list-style: none; padding-left: 1.5rem; }
.comment-body {
	padding: 1.25rem;
	margin-bottom: 1rem;
	background: var(--ss-color-bg-alt);
	border-radius: var(--ss-radius);
}
.comment-author img { border-radius: 50%; vertical-align: middle; margin-right: .5rem; }
.comment-metadata { font-size: .82rem; color: var(--ss-color-muted); margin-bottom: .6rem; }
.comment-respond { margin-top: 2rem; }
.comment-form p { margin-bottom: 1rem; }
.comment-form label { display: block; font-weight: 600; margin-bottom: .3rem; font-size: .9rem; }

/* ---------------------------------------------------------
   12. Utility
--------------------------------------------------------- */
.no-results { padding: 2rem 0; }
.ss-error-404 { text-align: center; padding: 3rem 0; }
.ss-error-404 .error-code { font-size: clamp(4rem, 12vw, 8rem); line-height: 1; color: var(--ss-color-primary); font-weight: 800; }

/* Header Nordest: resta in cima mentre si scorre ma occupa il suo spazio,
   così non copre l'inizio della pagina, e scende sotto la barra admin. */
body .site-header {
	position: sticky;
	top: var(--wp-admin--admin-bar--height, 0px);
}

/* Se la pagina finisce con una sezione a tutta larghezza, il footer le sta attaccato. */
.is-block-page .site-main > article:has(> .entry-content > .alignfull:last-child) {
	margin-bottom: 0;
	padding-bottom: 0;
}

/* Sotto i 600px la barra admin di WordPress scorre con la pagina: l'header si attacca in cima. */
@media (max-width: 600px) {
	body .site-header { top: 0; }
}
