/* Studio Portfolio – usa i colori del tema Leksa (--mainColor, --mainBackground…) così segue anche la modalità scura */
:root {
	--spf-fg: var(--mainColor, #070707);
	--spf-muted: var(--secondaryColor, #858585);
	--spf-bg: var(--mainBackground, #f0f0f0);
	--spf-line: var(--secondaryBackground, #dcdcdc);
	--spf-accent: var(--mainColor, #070707);
	--spf-gutter: clamp(16px, 4vw, 64px);
	--spf-gap: clamp(10px, 1.4vw, 20px);
	--spf-space: clamp(64px, 9vw, 144px);
	--spf-column: 720px;
	--spf-radius: 4px;
	--spf-ease: cubic-bezier(.22, .8, .2, 1);
}

.spf-main { color: var(--spf-fg); overflow: visible !important; overflow-x: clip !important; } /* clip invece di hidden: non rompe lo sticky della scena */
.spf-main *, .spf-main *::before, .spf-main *::after { box-sizing: border-box; }
.spf-wrap { padding-left: var(--spf-gutter); padding-right: var(--spf-gutter); }
.spf-column { width: min(var(--spf-column), 100% - 2 * var(--spf-gutter)); margin-left: auto; margin-right: auto; }
.spf-main img, .spf-main video { display: block; max-width: 100%; height: auto; }
.spf-main video { width: 100%; }

.spf-eyebrow { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--spf-muted); margin: 0 0 1.2em; }
.spf-link-arrow { color: inherit; text-decoration: none; border-bottom: 1px solid currentColor; padding-bottom: 1px; transition: opacity .2s; }
.spf-link-arrow:hover { opacity: .6; }

/* ---------- Progetto: sfondo pagina ---------- */
.spf-project.has-page-bg { background: var(--spf-page-bg); color: var(--spf-fg); }

/* ---------- Apertura: copertina a tutto schermo con titolo ---------- */
.spf-cover-hero { position: relative; min-height: 88vh; min-height: 88svh; display: flex; align-items: center; justify-content: center; overflow: hidden; color: #fff; background: #111; }
.spf-cover-hero-media { position: absolute; inset: 0; }
.spf-cover-hero-media img, .spf-cover-hero-media video { width: 100%; height: 100% !important; object-fit: cover; }
.spf-cover-hero::after { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse at center, rgba(0,0,0,.38) 0%, rgba(0,0,0,.12) 55%, rgba(0,0,0,.25) 100%); pointer-events: none; }
.spf-cover-hero-text { position: relative; z-index: 2; text-align: center; padding: clamp(40px, 6vh, 80px) var(--spf-gutter); max-width: 1400px; }
.spf-cover-hero-text .spf-eyebrow { color: rgba(255,255,255,.8); }
.spf-cover-hero .spf-title { margin: 0 auto; color: #fff; animation: spf-rise 1.4s var(--spf-ease) both .15s; }
@keyframes spf-rise { from { opacity: 0; transform: translateY(50px); } }

/* ---------- Apertura: titolo + copertina sotto ---------- */
.spf-hero { padding-top: clamp(130px, 20vh, 240px); padding-bottom: clamp(40px, 6vw, 88px); }
.spf-title { font-size: clamp(2.8rem, 8vw, 8.5rem) !important; line-height: .95 !important; letter-spacing: -.045em; margin: 0; max-width: 16ch; font-weight: normal; }
.spf-cover { margin: 0; }
.spf-cover img, .spf-cover video { width: 100%; max-height: 100vh; object-fit: cover; }

/* ---------- Testo introduttivo (colonna stretta) ---------- */
.spf-lead { padding-top: var(--spf-space); margin-bottom: var(--spf-space); }
.spf-intro { font-size: clamp(1.5rem, 2.6vw, 2.3rem); line-height: 1.25; letter-spacing: -.02em; margin: 0 0 clamp(32px, 4vw, 56px); }
.spf-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 20px var(--spf-gap); margin: 0 0 clamp(32px, 4vw, 56px); padding: 18px 0; border-top: 1px solid var(--spf-line); border-bottom: 1px solid var(--spf-line); }
.spf-facts dt, .spf-credits dt { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--spf-muted); margin: 0 0 6px; }
.spf-facts dd, .spf-credits dd { margin: 0; font-size: 1.05rem; line-height: 1.4; }
.spf-about-text { font-size: clamp(1.1rem, 1.35vw, 1.3rem); line-height: 1.6; }
.spf-about-text p { font-size: inherit; margin: 0 0 1em; }
.spf-about-text > *:last-child { margin-bottom: 0; }

/* ---------- Blocchi ---------- */
.spf-block { margin: 0 0 var(--spf-space); padding: 0 var(--spf-gutter); }
.spf-block.is-bleed { padding-left: 0; padding-right: 0; }
.spf-block.has-bg { background: var(--spf-block-bg); color: var(--spf-block-fg); padding-top: var(--spf-space); padding-bottom: var(--spf-space); margin-bottom: 0; }
.spf-block.has-bg + .spf-block:not(.has-bg) { margin-top: var(--spf-space); }
.spf-block.has-bg .spf-block-text, .spf-block.has-bg figcaption, .spf-block.has-bg .spf-fonts-use { color: inherit; opacity: .75; }
.spf-block-intro { width: min(var(--spf-column), 100% - 2 * var(--spf-gutter)); margin: 0 auto clamp(32px, 4.5vw, 64px); }
.spf-block:not(.is-bleed) .spf-block-intro { width: min(var(--spf-column), 100%); }
.spf-block-title { font-size: clamp(2rem, 4vw, 3.6rem) !important; line-height: 1.05 !important; letter-spacing: -.035em; margin: 0 0 .5em !important; font-weight: normal; }
.spf-block-text { font-size: clamp(1.05rem, 1.3vw, 1.25rem); line-height: 1.6; }
.spf-block-text p { font-size: inherit; margin: 0 0 1em; }
.spf-block-text > *:last-child { margin-bottom: 0; }
.spf-block--text-only .spf-block-intro { margin-bottom: 0; }

.spf-fig { margin: 0; }
.spf-fig img, .spf-fig video { width: 100%; border-radius: var(--spf-radius); }
.spf-fig figcaption { font-size: 13px; color: var(--spf-muted); margin: 12px auto 0; width: min(var(--spf-column), 100%); }

.spf-gallery { display: grid; gap: var(--spf-gap); }
.spf-gallery--bleed { gap: 0; }
.spf-gallery--bleed .spf-fig img, .spf-gallery--bleed .spf-fig video { border-radius: 0; }
.spf-gallery--bleed figcaption { padding: 0 var(--spf-gutter); margin-bottom: 24px; }
.spf-gallery--grid-2, .spf-gallery--brand-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.spf-gallery--grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.spf-gallery--brand-feature { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.spf-gallery--brand-feature .is-feature { grid-column: 1 / -1; }
.spf-gallery--grid-2 img, .spf-gallery--grid-3 img { aspect-ratio: 4 / 3; object-fit: cover; }
.spf-gallery--masonry { display: block; columns: 3; column-gap: var(--spf-gap); }
.spf-gallery--masonry .spf-fig { break-inside: avoid; margin-bottom: var(--spf-gap); }

/* Brand: palette + caratteri */
.spf-brand-specs { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 4fr); gap: var(--spf-gap); margin-bottom: var(--spf-gap); }
.spf-palette { display: flex; min-height: clamp(160px, 22vw, 320px); border-radius: var(--spf-radius); overflow: hidden; }
.spf-swatch { flex: 1; display: flex; align-items: flex-end; padding: 14px; font-size: 12px; letter-spacing: .08em; transition: flex .5s var(--spf-ease); }
.spf-palette:hover .spf-swatch:hover { flex: 1.8; }
.spf-fonts { list-style: none; margin: 0; padding: 0; display: grid; align-content: start; border-top: 1px solid var(--spf-line); }
.spf-fonts li { padding: 18px 0; border-bottom: 1px solid var(--spf-line); }
.spf-fonts-name { display: block; font-size: clamp(1.6rem, 2.6vw, 2.6rem); line-height: 1.1; letter-spacing: -.02em; }
.spf-fonts-use { display: block; font-size: 13px; color: var(--spf-muted); margin-top: 6px; }

/* ---------- Scena animata ---------- */
.spf-scene { position: relative; }
.spf-scene-stage { position: relative; height: 100vh; height: 100svh; overflow: hidden; }
.spf-scene--assemble .spf-scene.is-live { height: 260vh; }
.spf-scene--assemble .spf-scene.is-live .spf-scene-stage { position: sticky; top: 0; }
.spf-scene--assemble .spf-scene.is-live.is-manual-pin .spf-scene-stage { position: relative; will-change: transform; }
.spf-scene--float .spf-scene-stage { height: 120vh; overflow: visible; }
.spf-scene--float .spf-scene { overflow: hidden; }
.spf-scene--row .spf-scene-stage { height: 92vh; height: 92svh; max-height: 1000px; }
.spf-scene--row .spf-obj img { filter: drop-shadow(0 30px 40px rgba(0,0,0,.22)); }
.spf-fx-clip { overflow: hidden; }
.spf-fx-clip img, .spf-fx-clip video { will-change: transform; }
.spf-palette .spf-swatch { will-change: transform; }
.spf-obj { position: absolute; transform-origin: 50% 50%; will-change: transform, opacity; margin: 0; translate: -50% -50%; }
.spf-obj img { width: 100%; height: auto; user-select: none; -webkit-user-drag: none; filter: drop-shadow(0 18px 30px rgba(0,0,0,.12)); }
@media (max-width: 768px) {
	.spf-scene-stage { height: 80vh; }
	.spf-scene--assemble .spf-scene.is-live { height: 200vh; }
}

/* ---------- Social wall ---------- */
.spf-wall { columns: 3; column-gap: var(--spf-gap); }
.spf-wall--wall-4 { columns: 4; }
.spf-post {
	all: unset; box-sizing: border-box; cursor: zoom-in; position: relative; display: block; width: 100%;
	break-inside: avoid; margin: 0 0 var(--spf-gap); border-radius: var(--spf-radius); overflow: hidden;
	background: var(--spf-line); transform: translateZ(0);
}
.spf-post:focus-visible { outline: 2px solid var(--spf-fg); outline-offset: 3px; }
.spf-post img, .spf-post video { width: 100%; height: auto; border-radius: 0; transition: transform .8s var(--spf-ease); }
.spf-post:hover img, .spf-post:hover video { transform: scale(1.03); }
.spf-post.is-video::after {
	content: ""; position: absolute; top: 12px; right: 12px; width: 22px; height: 22px; border-radius: 50%;
	background: rgba(0, 0, 0, .45) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M9 7v10l8-5z'/%3E%3C/svg%3E") center / 16px no-repeat;
}
.spf-post-caption {
	position: absolute; inset: auto 0 0 0; padding: 40px 16px 14px; font-size: 13px; line-height: 1.4; color: #fff;
	background: linear-gradient(transparent, rgba(0, 0, 0, .7)); opacity: 0; transform: translateY(8px);
	transition: opacity .35s, transform .35s var(--spf-ease);
}
.spf-post:hover .spf-post-caption, .spf-post:focus-visible .spf-post-caption { opacity: 1; transform: none; }
.spf-wall--feed { columns: auto; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
.spf-wall--feed .spf-post { margin: 0; border-radius: 0; aspect-ratio: 4 / 5; }
.spf-wall--feed .spf-post img, .spf-wall--feed .spf-post video { height: 100%; object-fit: cover; aspect-ratio: auto !important; }

/* ---------- Sito web ---------- */
.spf-browser { border-radius: 10px; overflow: hidden; background: #1b1b1b; box-shadow: 0 40px 80px -30px rgba(0, 0, 0, .35); }
.spf-browser-bar { display: flex; align-items: center; gap: 7px; padding: 12px 16px; background: #2a2a2a; }
.spf-browser-bar i { width: 11px; height: 11px; border-radius: 50%; background: #555; }
.spf-browser-bar span { flex: 1; text-align: center; font-size: 12px; color: #aaa; margin-right: 50px; }
.spf-browser img, .spf-browser video { width: 100%; border-radius: 0; }
.spf-web-plain video, .spf-web-plain img, .spf-video-full video { border-radius: var(--spf-radius); }
.spf-web-link { margin: 24px auto 0; width: min(var(--spf-column), 100%); }

/* ---------- Crediti ---------- */
.spf-credits { margin-block: var(--spf-space); padding-block: clamp(36px, 4.5vw, 64px); border-top: 1px solid var(--spf-line); border-bottom: 1px solid var(--spf-line); }
.spf-credits dl > div:last-child, .spf-credits dd { margin-bottom: 0; }
.spf-credits-title { font-size: clamp(1.6rem, 2.6vw, 2.4rem) !important; line-height: 1.1 !important; letter-spacing: -.02em; margin: 0 0 32px !important; font-weight: normal; }
.spf-credits dl { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px var(--spf-gap); }

/* ---------- Griglia del portfolio (tessere) ---------- */
.spf-portfolio { padding-bottom: var(--spf-space); container-type: inline-size; }
.spf-filters { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 0 auto clamp(24px, 3vw, 44px); max-width: 1100px; }
.spf-filters button {
	all: unset; cursor: pointer; font-size: 14px; padding: 7px 14px; border-radius: 6px;
	background: var(--spf-line); color: var(--spf-fg); transition: background .25s, color .25s;
}
.spf-filters button sup { font-size: 10px; opacity: .55; margin-left: 2px; }
.spf-filters button:hover { background: color-mix(in srgb, var(--spf-line) 60%, var(--spf-fg) 15%); }
.spf-filters button.is-active { background: var(--spf-fg); color: var(--spf-bg); }
.spf-filters button:focus-visible { outline: 2px solid var(--spf-fg); outline-offset: 2px; }

.spf-tiles {
	--spf-cols: 4;
	--spf-tile-gap: 8px;
	display: grid;
	grid-template-columns: repeat(var(--spf-cols), minmax(0, 1fr));
	grid-auto-rows: calc((100cqw - (var(--spf-cols) - 1) * var(--spf-tile-gap)) / var(--spf-cols) * 1.3);
	grid-auto-flow: dense;
	gap: var(--spf-tile-gap);
	transition: opacity .22s;
}
.is-filtering .spf-tiles { opacity: 0; }
.spf-tile { position: relative; overflow: hidden; border-radius: var(--spf-radius); background: var(--spf-tile-bg, var(--spf-line)); }
.spf-tile.is-hidden { display: none; }
.spf-tile--larga { grid-column: span 2; }
.spf-tile--alta { grid-row: span 2; }
.spf-tile--grande { grid-column: span 2; grid-row: span 2; }
.spf-tile-link { position: absolute; inset: 0; display: block; color: inherit; text-decoration: none; }
.spf-tile-media { position: absolute; inset: 0; width: 100% !important; height: 100% !important; object-fit: cover; transition: transform 1.1s var(--spf-ease); background: transparent !important; }
.spf-tile-link:hover .spf-tile-media { transform: scale(1.035); }
.spf-tile-info { position: absolute; left: 0; right: 0; bottom: 0; padding: 48px 16px 14px; display: flex; flex-direction: column; gap: 4px; }
.spf-tile-title { font-size: clamp(15px, 1.15vw, 19px); line-height: 1.25; max-width: 24ch; }
.spf-tile--larga .spf-tile-title, .spf-tile--grande .spf-tile-title { font-size: clamp(17px, 1.6vw, 26px); max-width: 30ch; }
.spf-tile-meta { font-size: 12px; opacity: .7; transform: translateY(6px); opacity: 0; transition: opacity .3s, transform .4s var(--spf-ease); }
.spf-tile-link:hover .spf-tile-meta, .spf-tile-link:focus-visible .spf-tile-meta { opacity: .75; transform: none; }
.spf-tile--text-chiaro .spf-tile-info { color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.45)); }
.spf-tile--text-scuro .spf-tile-info { color: #111; }
.spf-tile-link:focus-visible { outline: 2px solid var(--spf-fg); outline-offset: -4px; }

/* ---------- Progetto successivo ---------- */
.spf-next { border-top: 1px solid var(--spf-line); }
.spf-next a { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: var(--spf-gap); color: inherit; text-decoration: none; padding: clamp(48px, 8vw, 120px) var(--spf-gutter); }
.spf-next .spf-eyebrow { grid-column: 1 / -1; margin: 0; }
.spf-next-title { font-size: clamp(2.4rem, 7vw, 7rem); line-height: .95; letter-spacing: -.045em; transition: transform .6s var(--spf-ease); }
.spf-next a:hover .spf-next-title { transform: translateX(14px); }
.spf-next-img { width: clamp(120px, 20vw, 320px); aspect-ratio: 4 / 3; overflow: hidden; border-radius: var(--spf-radius); }
.spf-next-img img { width: 100%; height: 100% !important; object-fit: cover; }

/* ---------- Lightbox ---------- */
.spf-lightbox { position: fixed; inset: 0; z-index: 99999; display: none; align-items: center; justify-content: center; }
.spf-lightbox.is-open { display: flex; animation: spf-fade .3s ease; }
.spf-lb-backdrop { position: absolute; inset: 0; background: rgba(10, 10, 10, .92); }
.spf-lb-inner { position: relative; display: flex; gap: 32px; align-items: center; max-width: min(1200px, 92vw); max-height: 88vh; }
.spf-lb-media img, .spf-lb-media video { max-height: 86vh; max-width: min(900px, 92vw); width: auto; height: auto; border-radius: var(--spf-radius); display: block; }
.spf-lb-caption { color: #eee; font-size: 15px; line-height: 1.6; max-width: 320px; max-height: 80vh; overflow: auto; white-space: pre-line; }
.spf-lb-btn { all: unset; position: absolute; cursor: pointer; color: #fff; font-size: 26px; width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; border-radius: 50%; transition: background .2s; }
.spf-lb-btn:hover, .spf-lb-btn:focus-visible { background: rgba(255, 255, 255, .12); }
.spf-lb-btn[hidden] { display: none; }
.spf-lb-close { top: 16px; right: 16px; font-size: 32px; }
.spf-lb-prev { left: 16px; top: 50%; transform: translateY(-50%); }
.spf-lb-next { right: 16px; top: 50%; transform: translateY(-50%); }
html.spf-lb-open, html.spf-lb-open body { overflow: hidden; }
@keyframes spf-fade { from { opacity: 0; } }

/* ---------- Animazione d'ingresso ---------- */
.spf-js [data-spf-reveal] { opacity: 0; transform: translateY(40px); transition: opacity 1s var(--spf-ease), transform 1.2s var(--spf-ease); }
.spf-js [data-spf-reveal].is-in { opacity: 1; transform: none; }
.spf-js .spf-scene--assemble[data-spf-reveal] { transform: none; }
@media (prefers-reduced-motion: reduce) {
	.spf-js [data-spf-reveal] { opacity: 1; transform: none; transition: none; }
	.spf-cover-hero .spf-title { animation: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
	.spf-tiles { --spf-cols: 2 !important; }
	.spf-wall--wall-4 { columns: 3; }
}
@media (max-width: 768px) {
	.spf-brand-specs, .spf-credits dl { grid-template-columns: 1fr; }
	.spf-wall, .spf-wall--wall-4 { columns: 2; }
	.spf-gallery--grid-3, .spf-gallery--masonry { columns: 2; }
	.spf-gallery--grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.spf-lb-inner { flex-direction: column; gap: 16px; }
	.spf-lb-caption { max-width: 92vw; max-height: 20vh; }
	.spf-lb-media img, .spf-lb-media video { max-height: 64vh; }
	.spf-post-caption { display: none; }
	.spf-next a { grid-template-columns: 1fr; }
	.spf-next-img { display: none; }
	.spf-tile-meta { opacity: .75; transform: none; }
}
@media (max-width: 560px) {
	.spf-tiles { --spf-cols: 1 !important; grid-auto-rows: calc(100cqw * 1.05); }
	.spf-tile--larga, .spf-tile--grande { grid-column: span 1; }
	.spf-tile--alta, .spf-tile--grande { grid-row: span 1; }
	.spf-gallery--grid-2, .spf-gallery--brand-grid-2, .spf-gallery--brand-feature, .spf-gallery--grid-3 { grid-template-columns: 1fr; }
	.spf-gallery--masonry { columns: 1; }
}
