/*
Theme Name: Manuel Silvestri — Tecnico Creativo
Theme URI: https://manuelsilvestri.it
Author: Manuel Silvestri
Author URI: https://manuelsilvestri.it
Description: Tema portfolio monopagina per Manuel Silvestri — tecnico creativo specializzato in installazioni immersive, videomapping, strutture LED e sistemi interattivi. Tema full-screen con scroll-snap verticale, hero video, sezioni a pieno schermo, modali di progetto e pannello contatti integrato.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.5
Requires PHP: 7.4
License: Proprietary — All Rights Reserved
License URI: https://manuelsilvestri.it/license
Text Domain: manu
Tags: portfolio, one-page, dark, creative, interactive
*/

/* =========================================================================
   1. VARIABILI & RESET
   ========================================================================= */
:root {
  /* Palette */
  --bg: #050508;
  --bg2: #0a0a12;
  --bg3: #10101c;
  --cyan: #00fff9;
  --cyan-dark: #006b68;
  --magenta: #ff00c1;
  --magenta-dark: #7a005d;
  --yellow: #ffe44d;
  --white: #e8e8ec;
  --white-soft: #c0c0cc;
  --gray: #808090;
  --gray-dim: #1a1a28;

  /* Tipografia */
  --font: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: 'Source Code Pro', 'SF Mono', Consolas, monospace;
  --serif: 'Liberation Serif', 'Times New Roman', serif;
  --cursive: 'Tangerine', cursive;

  /* Animazioni */
  --jumbo-speed: 90s;
  --ease-out-expo: cubic-bezier(.16, 1, .3, 1);
  --ease-out-quart: cubic-bezier(.25, 1, .5, 1);

  /* Layout */
  --nav-h: 56px;
  --container-max: 1200px;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

/* =========================================================================
   2. SCROLL SNAP & BASE
   ========================================================================= */
html {
  scroll-snap-type: y mandatory;
  overflow-y: scroll;
  overscroll-behavior-y: contain;
  background: var(--bg);
  scrollbar-width: none;
  -ms-overflow-style: none;
  scroll-behavior: smooth;
}
html::-webkit-scrollbar { display: none; }

body {
  font-family: var(--font);
  color: var(--white);
  overflow-x: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
body::-webkit-scrollbar { display: none; }
::selection { background: var(--magenta); color: var(--bg); }

/* Skip link per accessibilità */
.skip-link {
  position: absolute; top: -100px; left: 0;
  background: var(--cyan); color: var(--bg);
  padding: .6rem 1rem; font-family: var(--mono); font-size: .75rem;
  z-index: 10000; text-decoration: none;
}
.skip-link:focus { top: 0; }

/* Screen reader utility (WP standard) */
.screen-reader-text {
  border: 0; clip: rect(1px, 1px, 1px, 1px);
  clip-path: inset(50%);
  height: 1px; width: 1px;
  margin: -1px; overflow: hidden; padding: 0;
  position: absolute !important; word-wrap: normal !important;
}
.screen-reader-text:focus {
  background: var(--bg2); clip: auto !important; clip-path: none;
  color: var(--white); display: block;
  font-size: .85rem; font-weight: 600;
  height: auto; left: 5px; line-height: normal;
  padding: 15px 23px 14px; text-decoration: none;
  top: 5px; width: auto; z-index: 100000;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  html { scroll-snap-type: none; }
}

/* =========================================================================
   3. CURSOR CUSTOM (solo desktop)
   ========================================================================= */
@media (hover: hover) and (min-width: 769px) {
  body { cursor: none; }
}
.cursor-dot, .cursor-ring {
  position: fixed; pointer-events: none;
  transform: translate(-50%, -50%);
  will-change: transform;
}
.cursor-dot {
  width: 8px; height: 8px;
  background: var(--white); border-radius: 50%;
  transition: width .15s, height .15s, background .2s;
  z-index: 10001;
}
.cursor-ring {
  width: 40px; height: 40px;
  border: 1.5px solid rgba(255, 255, 255, .35); border-radius: 50%;
  transition: width .25s var(--ease-out-expo), height .25s var(--ease-out-expo), border-color .2s, background .2s;
  z-index: 10000;
}
.cursor-dot.hover { width: 4px; height: 4px; background: var(--cyan); }
.cursor-ring.hover { width: 60px; height: 60px; border-color: var(--cyan); background: rgba(0, 255, 249, .06); }
@media (max-width: 768px), (hover: none) {
  .cursor-dot, .cursor-ring { display: none; }
}

/* =========================================================================
   4. SFONDO (jumbo-bg) + grana
   ========================================================================= */
@keyframes jumbo {
  from { background-position: 50% 50%, 50% 50%; }
  to   { background-position: 350% 50%, 350% 50%; }
}
.jumbo-bg {
  --s: repeating-linear-gradient(100deg, #000 0%, #000 7%, transparent 10%, transparent 12%, #000 16%);
  --r: repeating-linear-gradient(100deg, var(--cyan-dark) 10%, var(--magenta-dark) 15%, var(--cyan-dark) 20%, #3d2b00 25%, var(--magenta-dark) 30%);
  position: fixed; inset: 0; z-index: 0;
  background-image: var(--s), var(--r);
  background-size: 300%, 200%;
  filter: blur(14px) opacity(40%) saturate(180%);
  mask-image: radial-gradient(ellipse at 100% 0%, black 40%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse at 100% 0%, black 40%, transparent 70%);
  pointer-events: none;
}
.jumbo-bg::after {
  content: ""; position: absolute; inset: 0;
  background-image: var(--s), var(--r);
  background-size: 200%, 100%;
  animation: jumbo var(--jumbo-speed) linear infinite;
  background-attachment: fixed;
  mix-blend-mode: difference;
}
body::after {
  content: ''; position: fixed; inset: 0; z-index: 9998;
  pointer-events: none; opacity: .03;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.z1 { position: relative; z-index: 1; }

/* =========================================================================
   5. PAGINE — full-screen con scroll-snap
   ========================================================================= */
.page {
  scroll-snap-align: start;
  scroll-snap-stop: always;
  min-height: 100dvh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: calc(var(--nav-h) + 1rem) 2rem 2rem;
  position: relative;
  overflow: hidden;
}
.page[data-page="hero"] { padding: 0; }

/* =========================================================================
   6. NAV — sempre fissa in alto
   ========================================================================= */
nav.site-nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  padding: .6rem 2rem;
  display: flex; justify-content: space-between; align-items: center;
  background: rgba(5, 5, 8, .8);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, .05);
  height: var(--nav-h);
}
.nav-logo {
  display: block;
  transition: opacity .3s, transform .3s;
  opacity: .9;
}
.nav-logo img {
  height: 32px; width: auto; display: block;
}
.nav-logo:hover { opacity: 1; transform: translateY(-1px); }
.nav-logo:focus-visible { outline: 2px solid var(--cyan); outline-offset: 4px; }

.nav-links {
  display: flex; gap: 2rem; list-style: none;
}
.nav-links a {
  font-family: var(--mono); font-size: .68rem; font-weight: 400;
  letter-spacing: .05em; text-transform: uppercase;
  color: var(--gray); text-decoration: none;
  transition: color .3s;
  position: relative;
}
.nav-links a::after {
  content: ''; position: absolute; left: 0; bottom: -4px;
  width: 0; height: 1px; background: var(--cyan);
  transition: width .3s var(--ease-out-expo);
}
.nav-links a:hover { color: var(--white); }
.nav-links a:hover::after { width: 100%; }

/* =========================================================================
   7. HERO — video bg + nome + typewriter
   ========================================================================= */
.hero { padding: 0; }

.hero-video-wrap {
  position: absolute; inset: 0; z-index: 0;
  overflow: hidden;
  background: var(--bg); /* fallback */
}
.hero-video {
  position: absolute; top: 50%; left: 50%;
  min-width: 100%; min-height: 100%;
  width: auto; height: auto;
  transform: translate(-50%, -50%);
  object-fit: cover;
  opacity: 0; /* fade-in on canplay */
  transition: opacity 1.2s ease;
}
.hero-video.is-playing { opacity: 1; }
.hero-video-overlay {
  position: absolute; inset: 0; z-index: 1;
  background:
    radial-gradient(ellipse at center, rgba(5, 5, 8, .45) 0%, rgba(5, 5, 8, .75) 100%),
    linear-gradient(to bottom, rgba(5, 5, 8, .55) 0%, rgba(5, 5, 8, .4) 50%, rgba(5, 5, 8, .8) 100%);
}

.hero-inner {
  text-align: center; z-index: 2; position: relative;
  display: flex; flex-direction: column; align-items: center;
  padding: 2rem;
}

/* Nome — glitch indipendente */
.glitch-wrap { position: relative; display: inline-block; line-height: 1; }
.glitch-first {
  font-family: var(--serif); font-weight: 700;
  font-size: clamp(2.5rem, 8vw, 5rem);
  letter-spacing: .02em; color: var(--white);
  display: inline-block; position: relative;
  cursor: pointer;
}
.glitch-last {
  font-family: var(--cursive); font-weight: 400;
  font-size: clamp(3.5rem, 11vw, 7.5rem);
  color: var(--white); display: block; margin-top: -.2em;
  position: relative; cursor: pointer;
}

.glitch-first::before, .glitch-first::after,
.glitch-last::before, .glitch-last::after {
  content: attr(data-text);
  position: absolute; top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}
.glitch-first::before { left: .3%; text-shadow: -2px 0 var(--magenta); animation: gx 4s infinite linear alternate-reverse, gop 5s infinite steps(2), gshape1 6s infinite linear; }
.glitch-first::after { left: -.3%; text-shadow: 2px 0 var(--cyan); animation: gx 3.5s infinite linear alternate, gop 4.5s infinite steps(3), gshape2 5.5s infinite linear reverse; }
.glitch-last::before { left: .2%; text-shadow: -2px 0 var(--magenta); animation: gx 5.5s infinite linear alternate, gop 6s infinite steps(3), gshape1b 7s infinite linear; }
.glitch-last::after { left: -.2%; text-shadow: 2px 0 var(--cyan); animation: gx 4.8s infinite linear alternate-reverse, gop 5.2s infinite steps(2), gshape2b 6.5s infinite linear reverse; }

@keyframes gx {
  0%, 7%, 12%, 20%, 25%, 35%, 43%, 52%, 60%, 71%, 78%, 85%, 93%, 100% { transform: translateX(0); }
  3% { transform: translateX(2px); } 9% { transform: translateX(-3px); } 15% { transform: translateX(5px); }
  30% { transform: translateX(-6px); } 47% { transform: translateX(7px); } 55% { transform: translateX(-8px); }
  75% { transform: translateX(-5px); } 90% { transform: translateX(-4px); }
}
@keyframes gop {
  0%, 5%, 8%, 12%, 15%, 27%, 34%, 42%, 51%, 63%, 71%, 80%, 88%, 95%, 100% { opacity: .8; }
  3%, 7%, 10%, 18%, 23%, 30%, 38%, 46%, 55%, 60%, 68%, 75%, 83%, 91%, 98% { opacity: .3; }
}
@keyframes gshape1 {
  0% { clip-path: polygon(0 12%, 100% 2%, 100% 55%, 0 45%); }
  15% { clip-path: polygon(0 65%, 100% 35%, 100% 35%, 0 65%); }
  30% { clip-path: polygon(0 80%, 100% 80%, 100% 80%, 0 80%); }
  45% { clip-path: polygon(0 50%, 100% 50%, 100% 55%, 0 55%); }
  60% { clip-path: polygon(0 90%, 100% 90%, 100% 95%, 0 95%); }
  75% { clip-path: polygon(0 33%, 100% 43%, 100% 68%, 0 58%); }
  90% { clip-path: polygon(0 78%, 100% 88%, 100% 98%, 0 88%); }
}
@keyframes gshape2 {
  0% { clip-path: polygon(0 25%, 100% 15%, 100% 85%, 0 75%); transform: skew(.5deg); }
  20% { clip-path: polygon(0 45%, 100% 35%, 100% 65%, 0 55%); transform: skew(-1.2deg); }
  40% { clip-path: polygon(0 85%, 100% 75%, 100% 95%, 0 85%); transform: skew(.8deg); }
  60% { clip-path: polygon(0 5%, 100% 15%, 100% 25%, 0 15%); transform: skew(-.4deg); }
  80% { clip-path: polygon(0 65%, 100% 55%, 100% 75%, 0 65%); transform: skew(1.7deg); }
  100% { clip-path: polygon(0 35%, 100% 45%, 100% 55%, 0 45%); transform: skew(-.9deg); }
}
@keyframes gshape1b {
  0% { clip-path: polygon(0 70%, 100% 60%, 100% 85%, 0 95%); }
  17% { clip-path: polygon(0 10%, 100% 20%, 100% 30%, 0 20%); }
  34% { clip-path: polygon(0 45%, 100% 55%, 100% 60%, 0 50%); }
  51% { clip-path: polygon(0 80%, 100% 70%, 100% 90%, 0 100%); }
  68% { clip-path: polygon(0 30%, 100% 40%, 100% 45%, 0 35%); }
  85% { clip-path: polygon(0 60%, 100% 50%, 100% 75%, 0 85%); }
  100% { clip-path: polygon(0 15%, 100% 5%, 100% 25%, 0 35%); }
}
@keyframes gshape2b {
  0% { clip-path: polygon(0 55%, 100% 45%, 100% 70%, 0 80%); transform: skew(-.7deg); }
  25% { clip-path: polygon(0 20%, 100% 30%, 100% 40%, 0 30%); transform: skew(1deg); }
  50% { clip-path: polygon(0 75%, 100% 85%, 100% 95%, 0 85%); transform: skew(-.5deg); }
  75% { clip-path: polygon(0 5%, 100% 15%, 100% 20%, 0 10%); transform: skew(1.5deg); }
  100% { clip-path: polygon(0 40%, 100% 50%, 100% 60%, 0 50%); transform: skew(-.3deg); }
}

.hero-role {
  font-family: var(--mono); font-size: clamp(.65rem, 1.2vw, .82rem);
  font-weight: 400; color: var(--white-soft);
  letter-spacing: .15em; text-transform: uppercase;
  margin: 1.5rem 0 1.2rem;
  opacity: 0; animation: fadeIn .8s .3s forwards;
}
.hero-role .sep { color: var(--cyan); margin: 0 .6em; }

/* Typewriter — "Mi occupo di [parola]" — FIX: la parte statica resta ferma */
.tw-wrap {
  display: inline-flex;
  align-items: baseline;
  gap: .4em;
  min-height: 2em;
  opacity: 0; animation: fadeIn .8s .6s forwards;
  /* la riserva di spazio per la parte dinamica rende il layout stabile */
}
.tw-static {
  font-weight: 400; font-size: clamp(.95rem, 1.8vw, 1.3rem);
  color: var(--white-soft);
  white-space: nowrap;
  flex-shrink: 0;
}
.tw-dynamic {
  display: inline-flex;
  align-items: baseline;
  /* min-width copre la parola più lunga ("Videomapping.") così
     il contenitore non cambia larghezza e "Mi occupo di" resta fermo */
  min-width: 14ch;
  justify-content: flex-start;
  text-align: left;
}
.tw-text {
  font-weight: 600;
  font-size: clamp(.95rem, 1.8vw, 1.3rem);
  color: var(--cyan);
  white-space: nowrap;
}
.tw-cursor {
  font-family: var(--mono);
  font-size: clamp(.95rem, 1.8vw, 1.3rem);
  color: var(--cyan);
  animation: blink .6s infinite;
  margin-left: 2px;
  display: inline-block;
}
@keyframes blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }

.hero-cta {
  margin-top: 2rem; opacity: 0; animation: fadeIn .8s 1s forwards;
  display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap;
}
.btn {
  font-family: var(--mono); font-size: .72rem; font-weight: 400;
  letter-spacing: .04em; text-transform: uppercase;
  padding: .7rem 1.8rem; border-radius: 4px;
  text-decoration: none;
  transition: all .3s var(--ease-out-expo);
  display: inline-block; cursor: pointer;
  border: 1px solid transparent;
}
.btn-primary { background: var(--white); color: var(--bg); border-color: var(--white); }
.btn-primary:hover { background: var(--cyan); border-color: var(--cyan); transform: translateY(-2px); }
.btn-ghost { background: transparent; color: var(--white); border-color: rgba(255, 255, 255, .25); }
.btn-ghost:hover { border-color: var(--white); transform: translateY(-2px); background: rgba(255, 255, 255, .04); }
.btn:focus-visible { outline: 2px solid var(--cyan); outline-offset: 4px; }

.scroll-arrow {
  position: absolute; bottom: 2rem; left: 50%;
  transform: translateX(-50%);
  opacity: 0; animation: fadeIn 1s 1.8s forwards;
  z-index: 2;
}
.scroll-arrow::before, .scroll-arrow::after {
  content: ''; display: block; width: 10px; height: 10px;
  transform: rotate(45deg);
  border-bottom: 2px solid var(--gray); border-right: 2px solid var(--gray);
}
.scroll-arrow::before { animation: ab1 2.6s cubic-bezier(.77, 0, .175, 1) infinite; }
.scroll-arrow::after { animation: ab2 2.6s cubic-bezier(.77, 0, .175, 1) infinite; }
@keyframes ab1 { 50%, 100% { transform: rotate(45deg) translate(70%, 70%); } }
@keyframes ab2 {
  50% { transform: rotate(45deg) translate(110%, 110%); opacity: 0; }
  51% { transform: rotate(45deg) translate(-130%, -130%); }
  100% { transform: rotate(45deg) translate(-70%, -70%); opacity: 1; }
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

#glitch-msg {
  position: fixed; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--mono); font-size: .85rem; color: var(--magenta);
  opacity: 0; z-index: 999; pointer-events: none;
  transition: opacity .3s;
  text-shadow: 0 0 20px var(--magenta);
}
#glitch-msg.show { opacity: 1; }

/* =========================================================================
   8. SECTION COMMON
   ========================================================================= */
.s-head {
  font-weight: 700;
  font-size: clamp(1.6rem, 3.5vw, 2.5rem);
  letter-spacing: -.02em; line-height: 1.1;
}
.s-sub {
  font-family: var(--mono); font-size: .72rem;
  letter-spacing: .06em; color: var(--white-soft);
  margin-top: .8rem; line-height: 1.65;
  max-width: 640px;
  font-weight: 300;
}
.reveal {
  opacity: 0; transform: translateY(30px);
  transition: opacity .7s var(--ease-out-expo), transform .7s var(--ease-out-expo);
}
.reveal.visible { opacity: 1; transform: translateY(0); }

/* =========================================================================
   9. SEGNALI — diamante 4 card (canvas particles RIMOSSO)
   ========================================================================= */
.signal-wrap {
  position: relative; width: 100%; max-width: 820px;
  display: flex; flex-direction: column; align-items: center;
  flex: 1; justify-content: center;
  gap: 1.5rem;
}
.signal-diamond {
  position: relative; width: 100%;
  display: grid;
  grid-template-areas:
    ". top ."
    "left . right"
    ". bottom .";
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
  justify-items: center;
  align-items: center;
  margin-top: 1rem;
}
.svc {
  background: rgba(18, 18, 30, .55);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 12px;
  padding: 1.1rem 1.1rem 1rem;
  position: relative; overflow: hidden;
  transition: border-color .4s, transform .3s, box-shadow .4s;
  width: 100%; max-width: 240px;
  z-index: 1;
}
.svc:hover {
  border-color: rgba(0, 255, 249, .2);
  transform: translateY(-3px);
  box-shadow: 0 12px 40px rgba(0, 255, 249, .06);
}
.svc-gradient {
  position: absolute; inset: 0;
  background: radial-gradient(circle at var(--mx, 50%) var(--my, 50%), rgba(0, 255, 249, .1) 0%, transparent 0%);
  transition: background .5s ease;
  pointer-events: none; border-radius: 12px;
}
.svc:hover .svc-gradient {
  background: radial-gradient(circle at var(--mx, 50%) var(--my, 50%), rgba(0, 255, 249, .1) 60%, transparent 100%);
}
.svc-header {
  display: flex; align-items: center; gap: .5rem;
  margin-bottom: .45rem; position: relative; z-index: 1;
}
.svc-icon {
  font-size: 1.15rem; transition: transform .3s;
  display: inline-block;
}
.svc:hover .svc-icon { transform: scale(1.1) rotate(-5deg); }
.svc-label { font-weight: 600; font-size: .9rem; position: relative; z-index: 1; }
.svc-desc {
  font-weight: 300; font-size: .74rem;
  color: var(--white-soft); line-height: 1.55;
  position: relative; z-index: 1;
}
.svc[data-signal="sistemi"]   { grid-area: top; }
.svc[data-signal="luci"]      { grid-area: left; }
.svc[data-signal="visual"]    { grid-area: right; }
.svc[data-signal="strutture"] { grid-area: bottom; }

/* =========================================================================
   10. OUTPUT / PORTFOLIO — card a dimensione fissa, hover text-reveal
   ========================================================================= */
.port-section {
  width: 100%; max-width: var(--container-max);
  display: flex; flex-direction: column;
  justify-content: center;
  height: 100%;
  gap: 1.2rem;
}
.port-carousel {
  display: flex; gap: 1.2rem;
  overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory;
  padding: 1.5rem 0 2.5rem;
  mask: linear-gradient(90deg, white 0%, white 85%, transparent 100%);
  -webkit-mask: linear-gradient(90deg, white 0%, white 85%, transparent 100%);
  scrollbar-width: none; -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
}
.port-carousel.scrolled {
  mask: linear-gradient(90deg, transparent 0%, white 5%, white 85%, transparent 100%);
  -webkit-mask: linear-gradient(90deg, transparent 0%, white 5%, white 85%, transparent 100%);
}
.port-carousel::-webkit-scrollbar { display: none; }

/* CARD — dimensione fissa responsive, NO transform su hover */
.port-card {
  scroll-snap-align: start;
  width: clamp(260px, 30vw, 340px);
  height: clamp(340px, 44vh, 420px);
  flex-shrink: 0;
  background: var(--bg2);
  border: 1px solid var(--gray-dim);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  transition: border-color .3s, box-shadow .3s;
}
.port-card:hover {
  border-color: rgba(255, 0, 193, .25);
  box-shadow: 0 12px 40px rgba(255, 0, 193, .08);
}
.port-card:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 4px;
}

/* Thumbnail che occupa tutta la card */
.port-thumb {
  position: absolute; inset: 0;
  overflow: hidden;
}
.port-thumb-bg {
  position: absolute; inset: -20px;
  background-size: cover; background-position: center;
  transition: transform .25s linear, filter .4s ease;
  will-change: transform;
}
.port-thumb-ov {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(5, 5, 8, .7) 0%, rgba(5, 5, 8, .15) 55%, transparent 100%);
  transition: background .4s ease;
}
.port-card:hover .port-thumb-bg { filter: brightness(.55) saturate(1.15); }

/* Title sempre visibile nella parte bassa della card */
.port-title-strip {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 1rem 1.2rem;
  z-index: 2;
  pointer-events: none;
  transition: opacity .35s ease;
}
.port-title {
  font-weight: 700; font-size: 1.05rem;
  line-height: 1.2; color: var(--white);
  text-shadow: 0 2px 14px rgba(0, 0, 0, .6);
}
.port-type {
  font-family: var(--mono); font-size: .55rem;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--white-soft);
  margin-top: .35rem;
  text-shadow: 0 2px 8px rgba(0, 0, 0, .6);
}

/* Overlay descrittivo che sale dal basso SOLO al hover */
.port-body {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 1.1rem 1.2rem 1.2rem;
  background: linear-gradient(to top, rgba(5, 5, 8, .95) 0%, rgba(5, 5, 8, .88) 55%, rgba(5, 5, 8, .5) 100%);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  transform: translateY(100%);
  transition: transform .45s var(--ease-out-expo);
  z-index: 3;
  max-height: 100%;
  overflow: hidden;
  display: flex; flex-direction: column; gap: .55rem;
}
.port-card:hover .port-body,
.port-card:focus-visible .port-body { transform: translateY(0); }
.port-card:hover .port-title-strip { opacity: 0; } /* il titolo viene preso nel body */

.port-body .port-title { font-size: 1.05rem; }
.port-body .port-type {
  font-family: var(--mono); font-size: .55rem;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--magenta);
}
.port-desc {
  font-weight: 300; font-size: .78rem;
  color: var(--white-soft); line-height: 1.55;
}
.port-tags {
  display: flex; flex-wrap: wrap; gap: .3rem;
  margin-top: .2rem;
}
.ptag {
  font-family: var(--mono); font-size: .52rem;
  letter-spacing: .05em; text-transform: uppercase;
  padding: .18rem .45rem; border-radius: 3px;
  background: rgba(0, 255, 249, .08); color: var(--cyan);
  border: 1px solid rgba(0, 255, 249, .12);
}
.wip {
  font-family: var(--mono); font-size: .48rem; font-weight: 500;
  letter-spacing: .1em; text-transform: uppercase;
  background: var(--magenta); color: var(--bg);
  padding: .1rem .4rem; border-radius: 2px;
  margin-left: .3rem; vertical-align: middle;
}
.port-hint {
  font-family: var(--mono); font-size: .55rem;
  color: var(--magenta);
  margin-top: auto;
  padding-top: .3rem;
}

/* =========================================================================
   11. PROJECT MODALS
   ========================================================================= */
body.modal-open { overflow: hidden !important; }
body.modal-open .z1 { pointer-events: none; }

.project-modal {
  position: fixed; inset: 0; z-index: 500;
  background: var(--bg);
  overflow-y: auto;
  padding: 5rem 2rem 4rem;
  opacity: 0; pointer-events: none;
  transition: opacity .4s ease;
}
.project-modal.open { opacity: 1; pointer-events: auto; }

.modal-gradient-bg {
  position: fixed; inset: 0; z-index: 0;
  pointer-events: none; overflow: hidden;
}
.modal-gradient-bg .blob {
  position: absolute; border-radius: 50%;
  filter: blur(80px); opacity: .3;
  animation: blob-drift 12s ease-in-out infinite alternate;
}
.modal-gradient-bg .blob:nth-child(1) {
  width: 45vw; height: 45vw;
  background: radial-gradient(circle, var(--magenta-dark), transparent 70%);
  top: -10%; left: -10%; animation-duration: 14s;
}
.modal-gradient-bg .blob:nth-child(2) {
  width: 40vw; height: 40vw;
  background: radial-gradient(circle, var(--cyan-dark), transparent 70%);
  bottom: -10%; right: -10%;
  animation-duration: 10s; animation-delay: -4s;
}
.modal-gradient-bg .blob:nth-child(3) {
  width: 30vw; height: 30vw;
  background: radial-gradient(circle, #3d2b00, transparent 70%);
  top: 40%; left: 50%;
  transform: translate(-50%, -50%);
  animation-duration: 16s; animation-delay: -8s;
}
@keyframes blob-drift {
  0% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(8vw, -6vh) scale(1.1); }
  66% { transform: translate(-5vw, 8vh) scale(.9); }
  100% { transform: translate(3vw, -3vh) scale(1.05); }
}

.modal-close {
  position: fixed; top: 1.2rem; right: 1.5rem; z-index: 501;
  background: rgba(12, 12, 20, .7);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, .1);
  color: var(--white);
  font-family: var(--mono); font-size: .7rem;
  padding: .5rem 1rem; border-radius: 5px;
  cursor: pointer;
  transition: border-color .3s, color .3s;
}
.modal-close:hover { border-color: var(--cyan); color: var(--cyan); }
.modal-inner {
  max-width: 820px; margin: 0 auto;
  position: relative; z-index: 1;
}
.modal-inner .modal-eyebrow {
  font-family: var(--mono); font-size: .62rem;
  letter-spacing: .15em; text-transform: uppercase;
  color: var(--magenta); margin-bottom: .8rem;
}
.modal-inner h2 {
  font-weight: 700; font-size: clamp(1.6rem, 3.2vw, 2.4rem);
  margin-bottom: .6rem; line-height: 1.1;
}
.modal-meta {
  font-family: var(--mono); font-size: .72rem;
  color: var(--gray); margin-bottom: 1.2rem;
  font-style: italic;
}
.modal-tags {
  display: flex; flex-wrap: wrap; gap: .4rem;
  margin-bottom: 2rem;
}
.modal-inner p {
  font-weight: 300; font-size: 1rem; line-height: 1.8;
  color: var(--white-soft);
  margin-bottom: 1.3rem;
}
.modal-role {
  border-top: 1px solid var(--gray-dim);
  padding-top: 1rem;
  margin-top: 1.5rem;
  font-family: var(--mono); font-size: .78rem;
  color: var(--white-soft); line-height: 1.7;
}
.modal-role strong {
  color: var(--cyan);
  letter-spacing: .1em; text-transform: uppercase;
  font-size: .62rem; font-weight: 600;
  display: block;
  margin-bottom: .4rem;
}
.media-ph {
  width: 100%; aspect-ratio: 16 / 9;
  background: rgba(18, 18, 30, .6);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: .75rem;
  color: var(--gray);
  margin-bottom: 1.3rem;
  border: 1px solid var(--gray-dim);
  overflow: hidden;
}
.media-ph img, .media-ph video {
  width: 100%; height: 100%; object-fit: cover;
}

/* =========================================================================
   12. CHI SONO — foto + testo + award + clienti
   ========================================================================= */
.about-wrap { max-width: 820px; width: 100%; }
.about-layout {
  display: flex; gap: 2.5rem;
  align-items: flex-start;
  margin-top: 1.5rem;
}
.about-text { flex: 1; }
.about-text p {
  font-weight: 300;
  font-size: clamp(.88rem, 1.3vw, 1rem);
  line-height: 1.75; color: var(--white-soft);
  margin-bottom: .85rem;
}
.hl { color: var(--cyan); }

.about-pic {
  flex-shrink: 0;
  width: 140px; height: 140px;
  border-radius: 50%; overflow: hidden;
  border: 2px solid var(--gray-dim);
  box-shadow: 0 0 40px rgba(0, 255, 249, .06);
}
.about-pic img {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
}

/* Award & clienti */
.about-meta {
  margin-top: 1.2rem;
  display: flex; flex-direction: column; gap: .5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--gray-dim);
}
.about-award {
  font-family: var(--mono); font-size: .7rem;
  color: var(--white-soft);
  letter-spacing: .04em;
}
.about-award .badge {
  display: inline-block;
  font-size: .55rem;
  letter-spacing: .15em; text-transform: uppercase;
  background: rgba(255, 228, 77, .1);
  color: var(--yellow);
  border: 1px solid rgba(255, 228, 77, .25);
  padding: .15rem .5rem; border-radius: 2px;
  margin-right: .6rem;
  vertical-align: middle;
}
.about-clients {
  font-family: var(--mono); font-size: .62rem;
  color: var(--gray);
  letter-spacing: .08em;
  line-height: 1.7;
}
.about-clients .label {
  color: var(--white-soft);
  text-transform: uppercase;
  letter-spacing: .15em;
  display: block;
  margin-bottom: .3rem;
  font-size: .58rem;
}

/* Skills scroller */
.scroller-sec { margin-top: 1.2rem; width: 100%; }
.scroller {
  overflow: hidden;
  mask: linear-gradient(90deg, transparent, white 10%, white 90%, transparent);
  -webkit-mask: linear-gradient(90deg, transparent, white 10%, white 90%, transparent);
}
.scroller-in {
  display: flex; gap: .7rem; width: max-content;
  animation: stag 50s var(--dir, forwards) linear infinite;
}
.scroller:nth-child(2) .scroller-in { animation-duration: 42s; --dir: reverse; }
@keyframes stag { to { transform: translateX(calc(-50% - .35rem)); } }
.stag {
  font-family: var(--mono); font-size: .65rem;
  font-weight: 400; color: var(--white);
  background: rgba(128, 128, 128, .08);
  padding: .35rem .65rem; border-radius: 5px;
  white-space: nowrap;
  transition: color .3s, background .3s;
}
.stag:hover { color: var(--cyan); background: rgba(0, 255, 249, .06); }
.stag .h { color: var(--gray); margin-right: .12rem; }

/* =========================================================================
   13. CONTACT BUTTON + PANEL
   ========================================================================= */
.contact-trigger {
  position: fixed; bottom: 2rem; right: 2rem; z-index: 300;
  background: var(--magenta); color: var(--white);
  font-family: var(--mono); font-size: .7rem; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase;
  padding: .75rem 1.4rem; border-radius: 8px;
  border: none; cursor: pointer;
  box-shadow: 0 4px 24px rgba(255, 0, 193, .2);
  transition: background .3s, transform .3s, box-shadow .3s;
}
.contact-trigger:hover {
  background: #ff33d1; transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(255, 0, 193, .3);
}
.contact-trigger.hidden { transform: translateY(80px); opacity: 0; pointer-events: none; }

.contact-panel {
  position: fixed; bottom: 0; right: 0; z-index: 400;
  width: 420px; max-width: 100vw; height: 100dvh;
  background: var(--bg2);
  border-left: 1px solid var(--gray-dim);
  transform: translateX(100%);
  transition: transform .5s var(--ease-out-expo);
  display: flex; flex-direction: column;
}
.contact-panel.open { transform: translateX(0); }
.cp-header {
  padding: 1.5rem;
  display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px solid var(--gray-dim);
  flex-shrink: 0;
}
.cp-header h3 { font-weight: 600; font-size: 1.1rem; }
.cp-close {
  background: none;
  border: 1px solid var(--gray-dim);
  color: var(--white);
  font-family: var(--mono); font-size: .65rem;
  padding: .35rem .7rem; border-radius: 4px;
  cursor: pointer;
  transition: border-color .3s;
}
.cp-close:hover { border-color: var(--cyan); }
.cp-body {
  padding: 1.5rem;
  flex: 1; overflow-y: auto;
  display: flex; flex-direction: column;
}
.cp-tabs {
  display: flex; gap: 0;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--gray-dim);
  flex-shrink: 0;
}
.cp-tab {
  flex: 1; padding: .6rem .4rem;
  text-align: center;
  font-family: var(--mono); font-size: .62rem;
  letter-spacing: .04em; text-transform: uppercase;
  color: var(--gray);
  background: none; border: none;
  cursor: pointer;
  transition: color .3s;
  border-bottom: 2px solid transparent;
}
.cp-tab.active { color: var(--white); border-bottom-color: var(--cyan); }
.cp-tab:hover { color: var(--white); }

.cp-shared-fields {
  display: flex; flex-direction: column; gap: .8rem;
  margin-bottom: 1rem;
  flex-shrink: 0;
}
.cp-input {
  background: var(--bg3);
  border: 1px solid var(--gray-dim);
  border-radius: 6px;
  padding: .65rem .85rem;
  color: var(--white);
  font-family: var(--font); font-size: .85rem;
  outline: none;
  transition: border-color .3s;
  width: 100%;
}
.cp-input:focus { border-color: var(--cyan); }
.cp-input::placeholder { color: var(--gray); }
textarea.cp-input { resize: vertical; min-height: 90px; }

.cp-tab-content {
  position: relative; flex: 1; overflow: hidden;
}
.cp-view {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; gap: .8rem;
  opacity: 0; transform: translateX(20px);
  transition: opacity .3s ease, transform .3s ease;
  pointer-events: none;
  overflow-y: auto;
}
.cp-view.active {
  opacity: 1; transform: translateX(0);
  pointer-events: auto;
  position: relative;
}
.cp-send {
  background: var(--white); color: var(--bg);
  border: none;
  font-family: var(--mono); font-size: .7rem; font-weight: 500;
  letter-spacing: .05em; text-transform: uppercase;
  padding: .65rem; border-radius: 6px;
  cursor: pointer;
  transition: background .3s, transform .2s;
  width: 100%;
  margin-top: auto;
}
.cp-send:hover { background: var(--cyan); transform: translateY(-1px); }

/* Calendario */
.cal-nav {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: .8rem;
}
.cal-month { font-weight: 600; font-size: .9rem; text-align: center; }
.cal-arrow {
  background: none;
  border: 1px solid var(--gray-dim);
  color: var(--gray);
  font-size: .7rem;
  padding: .25rem .5rem; border-radius: 4px;
  cursor: pointer;
  font-family: var(--mono);
  transition: border-color .2s, color .2s;
}
.cal-arrow:hover { border-color: var(--cyan); color: var(--white); }
.cal-arrow:disabled { opacity: .2; cursor: default; }
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px; text-align: center;
}
.cal-day-label {
  font-family: var(--mono); font-size: .48rem;
  color: var(--gray);
  padding: .25rem 0;
  text-transform: uppercase; letter-spacing: .04em;
}
.cal-day {
  padding: .4rem .1rem; border-radius: 4px;
  font-size: .72rem; cursor: pointer;
  transition: background .2s, color .2s;
}
.cal-day:hover { background: rgba(0, 255, 249, .08); }
.cal-day.empty { pointer-events: none; }
.cal-day.available {
  color: var(--white); background: var(--bg3);
  border: 1px solid var(--gray-dim);
}
.cal-day.available:hover { border-color: var(--cyan); background: rgba(0, 255, 249, .1); }
.cal-day.unavailable { color: var(--gray); opacity: .4; pointer-events: none; }
.cal-day.selected { background: var(--cyan); color: var(--bg); border-color: var(--cyan); font-weight: 600; }

.cal-slots h4 {
  font-family: var(--mono); font-size: .58rem;
  color: var(--gray);
  text-transform: uppercase; letter-spacing: .06em;
  margin: .6rem 0 .4rem;
}
.slot-grid { display: flex; flex-wrap: wrap; gap: .3rem; }
.slot {
  font-family: var(--mono); font-size: .62rem;
  padding: .3rem .55rem; border-radius: 4px;
  background: var(--bg3);
  border: 1px solid var(--gray-dim);
  color: var(--white);
  cursor: pointer;
  transition: all .2s;
}
.slot:hover { border-color: var(--cyan); background: rgba(0, 255, 249, .06); }
.slot.selected { background: var(--cyan); color: var(--bg); border-color: var(--cyan); }

.cal-confirm {
  margin-top: .6rem; width: 100%;
  padding: .65rem;
  background: var(--white); color: var(--bg);
  border: none; border-radius: 6px;
  font-family: var(--mono); font-size: .7rem; font-weight: 500;
  letter-spacing: .05em; text-transform: uppercase;
  cursor: pointer;
  transition: background .3s;
}
.cal-confirm:hover { background: var(--cyan); }

/* Direct contact fallback */
.cp-direct {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--gray-dim);
}
.cp-direct p {
  font-family: var(--mono); font-size: .6rem;
  color: var(--gray);
  letter-spacing: .05em;
  line-height: 1.8;
}
.cp-direct a {
  color: var(--white-soft);
  text-decoration: none;
  border-bottom: 1px dashed var(--gray-dim);
  transition: color .2s, border-color .2s;
}
.cp-direct a:hover { color: var(--cyan); border-bottom-color: var(--cyan); }

/* =========================================================================
   14. FOOTER
   ========================================================================= */
.site-footer {
  position: absolute; bottom: 0; left: 0; right: 0;
  border-top: 1px solid var(--gray-dim);
  padding: .7rem 2rem;
  text-align: center;
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: .5rem;
}
.site-footer p {
  font-family: var(--mono); font-size: .52rem;
  color: var(--gray);
  letter-spacing: .06em;
}
.site-footer .social {
  display: flex; gap: 1rem;
}
.site-footer .social a {
  font-family: var(--mono); font-size: .52rem;
  color: var(--gray);
  text-decoration: none;
  letter-spacing: .08em; text-transform: uppercase;
  transition: color .2s;
}
.site-footer .social a:hover { color: var(--cyan); }

/* =========================================================================
   15. RESPONSIVE
   ========================================================================= */
@media (max-width: 768px) {
  nav.site-nav { padding: .5rem 1rem; }
  .nav-links { gap: .9rem; }
  .nav-links a { font-size: .56rem; }
  .nav-logo img { height: 26px; }

  .page { padding: calc(var(--nav-h) + .8rem) 1rem 1rem; }

  .signal-diamond {
    display: flex; flex-direction: column;
    align-items: center; gap: .7rem;
    grid-template-areas: none;
  }
  .svc { max-width: 100%; width: 100%; }

  .port-card {
    width: clamp(260px, 75vw, 300px);
    height: 380px;
  }

  .about-layout { flex-direction: column; align-items: center; text-align: center; }
  .about-pic { width: 100px; height: 100px; }
  .about-text p { font-size: .92rem; }
  .about-meta { text-align: center; align-items: center; }

  .contact-panel { width: 100%; }
  .contact-trigger { bottom: 1.5rem; right: 1rem; font-size: .62rem; padding: .6rem 1.1rem; }

  .site-footer { padding: .6rem 1rem; }
  .site-footer p, .site-footer .social a { font-size: .48rem; }
}

/* Touch devices (no hover capability): body portfolio sempre parzialmente visibile */
@media (hover: none) {
  .port-body { transform: translateY(calc(100% - 96px)); }
  .port-card:hover .port-body,
  .port-card:focus-visible .port-body,
  .port-card:active .port-body { transform: translateY(0); }
  .port-title-strip { opacity: 0; }
}

@media (max-width: 480px) {
  .glitch-first { font-size: clamp(2rem, 10vw, 3.2rem); }
  .glitch-last { font-size: clamp(3rem, 14vw, 5rem); }
  .hero-cta { flex-direction: column; align-items: center; }
  .hero-cta .btn { width: 100%; max-width: 280px; text-align: center; }

  .tw-dynamic { min-width: 12ch; }
}

/* =========================================================================
   16. WP-SPECIFIC ADMIN BAR COMPENSATION
   ========================================================================= */
.admin-bar .site-nav { top: 32px; }
@media screen and (max-width: 782px) {
  .admin-bar .site-nav { top: 46px; }
}
.admin-bar .page {
  min-height: calc(100dvh - 32px);
  height: calc(100dvh - 32px);
}
@media screen and (max-width: 782px) {
  .admin-bar .page {
    min-height: calc(100dvh - 46px);
    height: calc(100dvh - 46px);
  }
}
