/* ==========================================================================
   Simone Portfolio – stili delle animazioni.
   Tutto ciò che nasconde contenuti vale solo sotto html.sp-motion,
   classe aggiunta solo se JavaScript gira e "riduci movimento" è spento.
   ========================================================================== */

/* Lenis (scroll morbido) */
html.lenis, html.lenis body { height: auto; }
.lenis:not(.lenis-autoToggle).lenis-stopped { overflow: clip; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }

.sp-sr {
	position: absolute !important;
	width: 1px; height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Prima di partire: hero invisibile finché JS non è pronto (max 4 s, poi
   la classe sp-ready arriva comunque dallo script nell'head).
   -------------------------------------------------------------------------- */
/* Se il preloader o le onde coprono già lo schermo, la hero si disegna subito sotto di loro:
   così Google la conta come caricata (LCP) mentre l’\animazione d’ntrata è ancora in corso. */
html.sp-motion:not(.sp-ready):not(.sp-preload):not(.sp-wave-in) .sp-hero,
html.sp-motion:not(.sp-ready) .sp-header { visibility: hidden; }

/* (Gli sfondi delle sezioni sono fissi: vedi style.css) */

/* --------------------------------------------------------------------------
   Preloader
   -------------------------------------------------------------------------- */
.sp-preloader { display: none; }
html.sp-preload .sp-preloader {
	position: fixed;
	inset: 0;
	z-index: 1000;
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	padding: clamp(1.5rem, 4vw, 3rem);
	background: var(--wp--preset--color--contrast);
	color: var(--wp--preset--color--base);
	animation: sp-failsafe 0.4s 5s forwards;
}
.sp-preloader__inner { display: contents; }
.sp-preloader__name {
	align-self: center;
	font-family: var(--wp--preset--font-family--clash-display);
	font-style: italic;
	font-size: clamp(3rem, 12vw, 10rem);
	line-height: 0.9;
	overflow: hidden;
	display: inline-flex;
}
.sp-preloader__name span { display: inline-block; }
.sp-preloader__count {
	font-family: var(--wp--preset--font-family--jetbrains-mono);
	font-size: clamp(1.2rem, 3vw, 2rem);
	color: var(--wp--preset--color--accent-2);
	font-variant-numeric: tabular-nums;
}
.sp-preloader__count::after { content: "%"; }

/* Tendina tra una pagina e l'altra */
.sp-curtain {
	position: fixed;
	inset: 0;
	z-index: 999;
	background: var(--wp--preset--color--accent-1);
	transform: translateY(100%);
	pointer-events: none;
}
html.sp-entering .sp-curtain { transform: translateY(0); animation: sp-failsafe 0.4s 4s forwards; }

@keyframes sp-failsafe { to { opacity: 0; visibility: hidden; } }

/* --------------------------------------------------------------------------
   Barra di avanzamento
   -------------------------------------------------------------------------- */
.sp-progress {
	position: fixed;
	top: 0; left: 0; right: 0;
	height: 3px;
	z-index: 200;
	transform-origin: 0 50%;
	transform: scaleX(0);
	background: linear-gradient(90deg, var(--wp--preset--color--accent-2), var(--wp--preset--color--accent-1));
	pointer-events: none;
}
.admin-bar .sp-progress { top: var(--wp-admin--admin-bar--height, 32px); }

/* --------------------------------------------------------------------------
   Cursore
   -------------------------------------------------------------------------- */
.sp-cursor, .sp-cursor-ring {
	position: fixed;
	top: 0; left: 0;
	z-index: 1001;
	pointer-events: none;
	border-radius: 50%;
	opacity: 0;
	transition: opacity .3s ease;
}
.sp-cursor { width: 8px; height: 8px; margin: -4px 0 0 -4px; background: var(--wp--preset--color--accent-1); }
.sp-cursor-ring {
	width: 38px; height: 38px; margin: -19px 0 0 -19px;
	border: 1.5px solid var(--wp--preset--color--accent-1);
	transition: opacity .3s ease, width .3s ease, height .3s ease, margin .3s ease, background-color .3s ease;
}
.sp-cursor-ring.is-hover {
	width: 70px; height: 70px; margin: -35px 0 0 -35px;
	background: color-mix(in srgb, var(--wp--preset--color--accent-2) 25%, transparent);
	border-color: var(--wp--preset--color--accent-2);
}
html.sp-cursor-visible .sp-cursor,
html.sp-cursor-visible .sp-cursor-ring { opacity: 1; }

.sp-cursor-toggle {
	position: fixed;
	left: 1rem; bottom: 1rem;
	z-index: 150;
	font: 600 0.72rem/1 var(--wp--preset--font-family--jetbrains-mono);
	letter-spacing: 0.05em;
	text-transform: uppercase;
	padding: 0.55rem 0.8rem;
	border-radius: 999px;
	border: 1px solid var(--sp-border);
	background: var(--wp--preset--color--base);
	color: var(--wp--preset--color--contrast);
	cursor: pointer;
	opacity: 0.75;
	transition: opacity .2s ease;
}
.sp-cursor-toggle:hover { opacity: 1; }

/* --------------------------------------------------------------------------
   Hero: macchia che segue il mouse
   -------------------------------------------------------------------------- */
.sp-hero__blob {
	position: absolute;
	top: 0; left: 0;
	width: 34vw; height: 34vw;
	max-width: 520px; max-height: 520px;
	margin: calc(min(34vw, 520px) / -2) 0 0 calc(min(34vw, 520px) / -2);
	border-radius: 50%;
	background: radial-gradient(circle, var(--wp--preset--color--accent-2) 0%, transparent 65%);
	opacity: 0.55;
	filter: blur(30px);
	z-index: -1;
	pointer-events: none;
	mix-blend-mode: multiply;
}

/* Titoli divisi in lettere: niente "buchi" tra le lettere */
.sp-hero__title .char,
.sp-hero__title > div { display: inline-block; }

/* --------------------------------------------------------------------------
   Nastri che scorrono
   -------------------------------------------------------------------------- */
.sp-marquee {
	overflow: hidden;
	margin-block: 0 !important;
	padding-block: 1.2rem;
	border-block: 1px solid var(--sp-border);
	max-width: none !important;
}
.sp-marquee__row {
	margin: 0;
	font-family: var(--wp--preset--font-family--clash-display);
	font-size: clamp(2rem, 5vw, 4rem);
	font-weight: 600;
	line-height: 1.25;
	white-space: nowrap;
}
.sp-marquee__row + .sp-marquee__row { margin-top: 0.3rem; }
.sp-marquee__track { display: inline-flex; align-items: center; will-change: transform; }
.sp-marquee__item { padding-inline: 0.5em; }
.sp-marquee__sep { color: var(--wp--preset--color--accent-1); font-size: 0.6em; }
.sp-marquee__row--reverse { font-style: italic; font-weight: 400; color: var(--wp--preset--color--accent-1); }
.sp-marquee__row--reverse .sp-marquee__sep { color: var(--wp--preset--color--accent-2); }
/* Senza JS: il testo va a capo normalmente */
html:not(.sp-motion) .sp-marquee__row { white-space: normal; font-size: clamp(1.4rem, 3vw, 2rem); }

/* --------------------------------------------------------------------------
   Timeline
   -------------------------------------------------------------------------- */

html.sp-motion .sp-timeline__item::before { transform: scale(0); transition: transform .5s cubic-bezier(.34, 1.56, .64, 1); }
html.sp-motion .sp-timeline__item.is-on::before { transform: scale(1); }

/* --------------------------------------------------------------------------
   "Obiettivo sbloccato"
   -------------------------------------------------------------------------- */
.sp-toasts {
	position: fixed;
	right: 1rem; bottom: 5.5rem;
	z-index: 300;
	display: grid;
	gap: 0.6rem;
	pointer-events: none;
}
.sp-toast {
	display: flex;
	align-items: center;
	gap: 0.9rem;
	padding: 0.8rem 1.2rem 0.8rem 0.8rem;
	border-radius: 14px;
	background: #1b100b;
	color: var(--wp--preset--color--base);
	border: 1px solid color-mix(in srgb, var(--wp--preset--color--accent-2) 45%, transparent);
	box-shadow: 0 12px 30px -10px rgba(0, 0, 0, .5), 0 0 24px -6px color-mix(in srgb, var(--wp--preset--color--accent-2) 60%, transparent);
	font-family: var(--wp--preset--font-family--jetbrains-mono);
}
.sp-toast__icon {
	display: grid;
	place-items: center;
	width: 2.4rem; height: 2.4rem;
	border-radius: 10px;
	background: linear-gradient(135deg, var(--wp--preset--color--accent-2), var(--wp--preset--color--accent-1));
	color: #1b100b;
	font-size: 1.2rem;
}
.sp-toast small { display: block; font-size: 0.68rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--wp--preset--color--accent-2); }
.sp-toast strong { font-size: 0.9rem; }

/* --------------------------------------------------------------------------
   Movimento ridotto: tutto fermo
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
	.sp-press-start, .sp-card--empty::before { animation: none !important; }
}

/* --------------------------------------------------------------------------
   Orologio della giornata (sole/luna su un arco)
   -------------------------------------------------------------------------- */
.sp-clock {
	position: fixed;
	right: 1rem;
	bottom: 1rem;
	z-index: 150;
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding: 0.55rem 1rem 0.55rem 0.7rem;
	border-radius: 999px;
	border: 1px solid var(--sp-border);
	background: color-mix(in srgb, var(--wp--preset--color--base) 88%, transparent);
	color: var(--wp--preset--color--contrast);
	box-shadow: 0 10px 30px -18px rgba(42, 26, 18, .4);
	font-family: var(--wp--preset--font-family--jetbrains-mono);
	transition: background-color .6s ease, color .6s ease, border-color .6s ease;
	pointer-events: none;
}
.sp-clock.is-night {
	background: color-mix(in srgb, #1b100b 90%, transparent);
	color: var(--wp--preset--color--base);
	border-color: color-mix(in srgb, var(--wp--preset--color--accent-2) 35%, transparent);
}
.sp-clock__arc {
	position: relative;
	width: 44px; height: 24px;
	overflow: hidden;
}
.sp-clock__arc::before {
	content: "";
	position: absolute;
	left: 3px; top: 3px;
	width: 38px; height: 38px;
	box-sizing: border-box;
	border-radius: 50%;
	border: 1.5px dashed currentColor;
	opacity: .35;
}
.sp-clock__arc::after {
	content: "";
	position: absolute;
	left: 0; right: 0; bottom: 0;
	height: 1.5px;
	background: currentColor;
	opacity: .35;
}
.sp-clock__orb {
	position: absolute;
	left: 0; top: 0;
	width: 10px; height: 10px;
	margin: -5px 0 0 -5px;
	border-radius: 50%;
	background: var(--wp--preset--color--accent-2);
	box-shadow: 0 0 10px var(--wp--preset--color--accent-2);
}
.sp-clock.is-night .sp-clock__orb { background: transparent; box-shadow: 3px 2px 0 0 #FBE7C6; }
.sp-clock__txt { display: grid; line-height: 1.15; }
.sp-clock__time { font-size: 0.95rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.sp-clock__label { font-size: 0.65rem; letter-spacing: 0.08em; text-transform: uppercase; opacity: .7; }
@media (max-width: 600px) {
	.sp-clock { padding: 0.45rem 0.8rem 0.45rem 0.55rem; gap: 0.5rem; }
	.sp-clock__label { display: none; }
}
/* Preloader "una giornata in morphing": sole → caffè → gamepad → luna → cerchio che si apre */
.sp-preloader__stage {
	position: absolute;
	left: 50%;
	top: 46%;
	translate: -50% -50%;
	display: grid;
	justify-items: center;
	gap: 1.2rem;
	pointer-events: none;
}
.sp-preloader__morph { width: clamp(140px, 26vmin, 260px); height: auto; overflow: visible; }
.sp-preloader__shape { fill: #F29E4C; }
.sp-preloader__cap {
	font-family: var(--wp--preset--font-family--jetbrains-mono);
	font-size: 0.8rem;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: color-mix(in srgb, var(--wp--preset--color--base) 70%, transparent);
	min-height: 1.2em;
}
.sp-preloader__name { font-style: normal !important; }
.sp-preloader__name { align-self: flex-end !important; }

/* Onde di colore (shape overlays) tra caricamenti e pagine */
svg.sp-waves {
	display: none;
	position: fixed;
	inset: 0;
	z-index: 1002;
	width: 100%;
	height: 100%;
	pointer-events: none;
}
html.sp-wave-in svg.sp-waves, svg.sp-waves.is-on { display: block; }
html.sp-wave-in svg.sp-waves { animation: sp-failsafe 0.4s 4s forwards; }
/* la vecchia tendina non serve più: ora ci sono le onde */
.sp-curtain { display: none !important; }
