/*
 * Spacca - Stili di base (shell condiviso)
 * -----------------------------------------------------------------------------
 * 1) Variabili (alias brevi che puntano ai token di theme.json)
 * 2) Reset
 * 3) Tipografia
 * 4) Layout di base dello shell (header / main / footer)
 *
 * I VALORI dei token NON si scrivono qui: vivono in theme.json.
 * Qui creiamo solo nomi corti e comodi da usare nel resto dei CSS.
 */

/* ============================================================
   1) VARIABILI
   ============================================================ */
:root {
	/* Colori (alias dei preset generati da theme.json) */
	--text: var(--wp--preset--color--text);
	--text-muted: var(--wp--preset--color--text-muted);
	--text-hover: var(--wp--preset--color--text-hover);
	--white: var(--wp--preset--color--white);
	--bg: var(--wp--preset--color--bg);
	--bg-alt: var(--wp--preset--color--bg-alt);

	/* Velo scuro condiviso (background hero home + issue): testo al 60%.
	   Qui sta il valore di ripiego; color-mix() lo sostituisce nel blocco
	   @supports sotto, dove e' disponibile. */
	--overlay: rgba(46, 46, 46, 0.6);

	/* Font */
	--font-inter: var(--wp--preset--font-family--inter);
	--font-newsreader: var(--wp--preset--font-family--newsreader);

	/* Dimensioni testo */
	--size-small: var(--wp--preset--font-size--small);
	--size-body: var(--wp--preset--font-size--body);
	--size-season: var(--wp--preset--font-size--season);
	--size-issue: var(--wp--preset--font-size--issue);
	--size-display: var(--wp--preset--font-size--display);

	/* Spaziature */
	--space-xs: var(--wp--preset--spacing--xs);
	--space-s: var(--wp--preset--spacing--s);
	--space-m: var(--wp--preset--spacing--m);
	--space-l: var(--wp--preset--spacing--l);
	--space-xl: var(--wp--preset--spacing--xl);

	/* Larghezza massima del contenuto */
	--content-width: 1200px;
	--wide-width: 1400px;
}

/* color-mix() esiste da Safari 16.2, Chrome 111 e Firefox 113 in poi. Sui
   browser precedenti resta l'rgba dichiarato sopra: senza questo blocco il velo
   sparirebbe del tutto, lasciando testo bianco su foto chiare.
   Serve @supports e non basta scrivere due dichiarazioni in fila: dentro una
   variabile CSS un valore non supportato non fa ricadere sulla riga precedente,
   rende invalida la proprieta' che la usa dopo il calcolo. */
@supports (color: color-mix(in srgb, red 50%, transparent)) {
	:root {
		--overlay: color-mix(in srgb, var(--text) 60%, transparent);
	}
}

/* ============================================================
   2) RESET
   ============================================================ */
*,
*::before,
*::after {
	box-sizing: border-box;
}

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

@media (prefers-reduced-motion: no-preference) {
	html {
		scroll-behavior: smooth;
	}
}

body {
	margin: 0;
	min-height: 100vh;
	background-color: var(--bg);
	color: var(--text);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

/* Evidenziazione testo: sfondo nero (--text), testo grigio chiaro. */
::selection {
	background-color: var(--text);
	color: var(--text-hover);
}

/* Le immagini non sforano mai il contenitore e mantengono le proporzioni. */
img,
picture,
svg,
video {
	display: block;
	max-width: 100%;
	height: auto;
}

/* Niente sottolineatura di default: la decidiamo noi dove serve. */
a {
	color: inherit;
	text-decoration: none;
}

a:hover {
	color: var(--text-muted);
	text-decoration: none;
}

/* I titoli partono senza margini imposti dal browser. */
h1, h2, h3, h4, h5, h6,
p, figure, ul, ol {
	margin: 0;
}

ul, ol {
	padding: 0;
	list-style: none;
}

/* Accessibilita': focus sempre visibile da tastiera. */
:focus-visible {
	outline: 2px solid var(--text);
	outline-offset: 2px;
}

/* Nasconde alla vista ma resta leggibile da screen reader e SEO (es. h1). */
.spacca-visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ============================================================
   3) TIPOGRAFIA
   ============================================================ */
body {
	font-family: var(--font-newsreader);
	font-weight: 400;
	font-size: var(--size-body);
	line-height: 1.4;
}

h1, h2, h3, h4, h5, h6 {
	font-family: var(--font-inter);
	font-weight: 600;
	line-height: 1.0;
}

/* Crediti, didascalie e testo secondario. */
figcaption,
.spacca-credit {
	color: var(--text-muted);
	font-size: var(--size-small);
}

/* ============================================================
   4) LAYOUT DI BASE DELLO SHELL
   ============================================================ */

/* Contenitore centrato riutilizzabile. */
.spacca-container {
	width: 100%;
	max-width: var(--content-width);
	margin-inline: auto;
	padding-inline: var(--space-s);
}

/* Struttura a colonna: header in alto, footer in basso, main che si espande. */
.site-header,
.site-footer {
	width: 100%;
}

.site-main {
	display: block;
}

/* --- Header --- */
.site-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-s);
	padding-block: var(--space-s);
	padding-inline: var(--space-s);
	max-width: var(--wide-width);
	margin-inline: auto;
}

.site-header__logo {
	display: inline-flex;
	align-items: center;
}

/* Logo: mobile-first 44px -> tablet 52px -> desktop 64px. */
.site-header__logo svg,
.site-header__logo img {
	height: 44px;
	width: auto;
}

@media (min-width: 768px) {
	.site-header__logo svg,
	.site-header__logo img {
		height: 52px;
	}
}

@media (min-width: 1024px) {
	.site-header__logo svg,
	.site-header__logo img {
		height: 64px;
	}
}

.site-header__contact {
	font-family: var(--font-inter);
	font-weight: 500;
	font-size: 13px;
}

/* Header in overlay trasparente sopra una hero (home + pagine issue).
   E' 'absolute', non 'fixed': resta sopra la hero ma scorre via col contenuto. */
.spacca-overlay-header .site-header {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	z-index: 20;
	max-width: none;
	margin: 0;
	padding: 16px;
	background: transparent;
	color: var(--white);
}

.spacca-overlay-header .site-header a {
	color: var(--white);
}

.spacca-overlay-header .site-header a:hover {
	color: var(--text-hover);
}

/* --- Footer --- */
.site-footer {
	margin-top: var(--space-xl);
	padding-block: var(--space-l);
	background-color: var(--bg-alt);
}

.site-footer__inner {
	max-width: var(--content-width);
	margin-inline: auto;
	padding-inline: var(--space-s);
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-s);
	font-family: var(--font-inter);
	font-size: 12px;
	color: var(--text-muted);
}

.site-footer a {
	color: var(--text);
}

.site-footer__legal {
	display: flex;
	align-items: center;
	gap: var(--space-s);
}

.site-footer__social {
	display: flex;
	align-items: center;
	gap: var(--space-s);
}

.site-footer__social-link {
	display: inline-flex;
}

/* --- Back-home link (shared: issue pages + 404) --- */
/* Bold Newsreader link with an underline that grows on hover. Colour follows
   the page: dark by default, overridden to white on dark pages (page.css). */
.spacca-back-home {
	display: block;
	width: fit-content;
	margin: 1rem auto;
	font-family: var(--font-newsreader);
	font-weight: 700;
	font-size: 18px;
	color: var(--text);
	background-image: linear-gradient(currentColor, currentColor);
	background-repeat: no-repeat;
	background-position: 0 100%;
	background-size: 0 1px;
	transition: background-size 0.3s ease;
}

.spacca-back-home:hover {
	color: var(--text);
	background-size: 100% 1px;
}
