/* NYM — portfolio online
   Palette e font presi da 01_work_2026.indd */
:root {
  --lav: #7f80b8;      /* swatch r127 g128 b184 */
  --peach: #e3b4a1;    /* swatch r227 g180 b161 */
  --ink: #2e2572;      /* swatch R46 G37 B114 */
  --paper: #ffffff;    /* Carta */
  --lav-soft: #eeeef7;
  --peach-soft: #f9ede7;
  --gutter: clamp(16px, 4vw, 56px);
  --maxw: 1320px;
  --radius: 22px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Poppins", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- lettering ritagliato (vedi main.js) */
.cut { display: inline-flex; flex-wrap: wrap; gap: 0 .28em; line-height: 1; margin: 0; font-weight: 800; }
.cut svg { height: 1em; width: auto; overflow: visible; fill: currentColor; }
.cut:not(.is-ready) { font-size: 0; }
.cut:not(.is-ready)::before { content: attr(aria-label); font-size: 2rem; }

/* doodles */
.doodle { position: absolute; pointer-events: none; color: var(--peach); }
.doodle svg, .icon svg { width: 100%; height: auto; display: block; }

/* ---------- header */
.site-header { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: rgba(255,255,255,.92); backdrop-filter: blur(8px); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 76px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--lav); }
.brand .logo { width: 52px; display: block; }
.brand .name { font-weight: 600; font-size: 14px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink); }
.nav { display: flex; gap: 22px; align-items: center; }
.nav a { white-space: nowrap; text-decoration: none; font-weight: 500; font-size: 15px; position: relative; padding: 4px 0; }
.nav a::after { content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 3px; border-radius: 3px; background: var(--peach); transform: scaleX(0); transform-origin: left; transition: transform .25s; }
.nav a:hover::after, .nav a[aria-current="page"]::after { transform: scaleX(1); }
.nav-toggle { display: none; background: none; border: 0; padding: 8px; color: var(--ink); cursor: pointer; }
.nav-toggle svg { width: 28px; height: 28px; }

@media (max-width: 1080px) {
  .nav-toggle { display: block; }
  .nav { position: fixed; inset: 76px 0 auto 0; flex-direction: column; align-items: flex-start; gap: 6px; padding: 18px var(--gutter) 28px; background: var(--paper); border-bottom: 3px solid var(--peach); transform: translateY(-120%); transition: transform .3s; }
  .nav.open { transform: none; }
  .nav a { font-size: 20px; }
  .brand .name { display: none; }
}

/* ---------- hero = copertina */
.hero { position: relative; padding: clamp(40px, 7vw, 90px) 0 clamp(60px, 8vw, 110px); }
.hero-block { position: relative; background: var(--lav); color: #fff; border-radius: 4px; padding: 0 clamp(16px, 3vw, 40px) clamp(24px, 4vw, 48px); margin-top: clamp(40px, 7vw, 90px); }
.hero-title { font-size: clamp(52px, 13vw, 200px); color: #fff; display: block; margin: 0; position: relative; top: -.45em; margin-bottom: -.3em; }
.hero-title .cut { display: flex; }
.hero-title .line2 { margin-top: .06em; }
.hero-meta { position: absolute; top: clamp(14px, 2vw, 26px); right: clamp(16px, 3vw, 40px); text-align: right; line-height: 1.25; font-size: clamp(12px, 1.5vw, 19px); text-transform: uppercase; }
.hero-meta strong { font-weight: 700; display: block; }
.hero-intro { display: flex; flex-direction: column; gap: 18px; align-items: center; text-align: center; margin-top: 34px; }
.hero-intro .logo-big { width: clamp(80px, 9vw, 120px); color: var(--lav); }
.hero-intro p { max-width: 540px; margin: 0; font-size: clamp(16px, 1.6vw, 19px); }
.hero .d1 { width: clamp(70px, 10vw, 150px); left: -1.5%; top: -2%; }
.hero .d2 { width: clamp(130px, 24vw, 380px); right: -3%; bottom: -16%; }
.hero .d3 { width: clamp(44px, 6vw, 90px); right: 30%; top: 4%; color: var(--peach); }
@media (max-width: 640px) {
  .hero-meta { position: static; text-align: left; padding-top: 14px; margin-bottom: 10px; }
  .hero-title { top: 0; margin-bottom: 0; }
  .hero .d3 { display: none; }
}

/* ---------- section head */
.sec { padding: clamp(50px, 8vw, 110px) 0; position: relative; }
.sec-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: clamp(26px, 4vw, 48px); flex-wrap: wrap; }
.sec-head .cut { font-size: clamp(44px, 8vw, 110px); color: var(--lav); }
.sec-head p { margin: 0; max-width: 420px; }
.kicker { display: inline-block; font-size: 13px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--lav); margin-bottom: 14px; }

/* ---------- gallery (masonry a colonne) */
.grid { columns: 3 280px; column-gap: 22px; }
.grid figure { break-inside: avoid; margin: 0 0 22px; position: relative; }
.tile { display: block; width: 100%; padding: 0; border: 0; background: var(--lav-soft); cursor: zoom-in; border-radius: 6px; overflow: hidden; }
.tile img { width: 100%; height: auto; transition: transform .5s ease; }
.tile:hover img, .tile:focus-visible img { transform: scale(1.035); }
.tile:focus-visible { outline: 3px solid var(--peach); outline-offset: 3px; }
.grid figcaption { font-size: 13px; padding: 8px 2px 0; line-height: 1.4; }
.grid figcaption b { font-weight: 600; display: block; font-size: 14px; }

/* ---------- category cards */
.cats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
@media (max-width: 900px) { .cats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .cats { grid-template-columns: 1fr; } }
.cat { position: relative; display: block; text-decoration: none; border-radius: var(--radius); overflow: hidden; background: var(--lav-soft); aspect-ratio: 4 / 5; }
.cat img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s ease; }
.cat:hover img { transform: scale(1.05); }
.cat .label { position: absolute; left: 14px; right: 14px; bottom: 14px; background: #fff; border-radius: 14px; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cat .label b { font-weight: 700; font-size: 17px; }
.cat .label small { display: block; font-size: 12px; color: var(--lav); font-weight: 500; }
.cat .label .icon { width: 46px; color: var(--peach); flex: none; }

/* ---------- project blocks (pagine categoria) */
.project { padding: clamp(28px, 5vw, 64px) 0; border-top: 2px dashed var(--peach); }
.project:first-of-type { border-top: 0; padding-top: 0; }
.project-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 12px 40px; margin-bottom: 26px; }
.project-head h2 { margin: 0; font-size: clamp(22px, 2.6vw, 32px); line-height: 1.15; font-weight: 700; }
.project-head p { margin: 0; }
.project-head .meta { font-size: 13px; color: var(--lav); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; margin-top: 6px; }
@media (max-width: 760px) { .project-head { grid-template-columns: 1fr; } }

.page-hero { padding: clamp(40px, 7vw, 90px) 0 clamp(20px, 4vw, 40px); position: relative; }
.page-hero .cut { font-size: clamp(54px, 11vw, 150px); color: var(--lav); }
.page-hero p { max-width: 560px; font-size: 18px; margin: 18px 0 0; }
.page-hero .doodle { width: clamp(70px, 9vw, 130px); right: var(--gutter); top: 30%; }

.pager { display: flex; justify-content: space-between; gap: 16px; padding: 40px 0 10px; }
.pager a { text-decoration: none; font-weight: 600; display: inline-flex; align-items: center; gap: 10px; }
.pager .icon { width: 56px; color: var(--peach); }
.pager .prev .icon { transform: scaleX(-1); }

/* ---------- about */
.about { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: clamp(26px, 5vw, 70px); align-items: center; }
.about-art { position: relative; }
.about-art img { width: 100%; max-width: 460px; }
.about-art .doodle { width: 22%; left: 0; top: -4%; }
.about-text { background: var(--peach); border-radius: 0 0 0 var(--radius); padding: clamp(24px, 4vw, 48px); }
.about-text p { margin: 0 0 1em; }
.about-text p:last-child { margin: 0; }
.about-text .cut { font-size: clamp(40px, 6vw, 80px); color: var(--ink); margin-bottom: 18px; }
.skills { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 26px; }
.skills span { display: inline-grid; place-items: center; min-width: 48px; height: 48px; padding: 0 10px; border-radius: 10px; background: var(--lav); color: #fff; font-weight: 700; font-size: 17px; }
.skills span.alt { background: var(--peach); color: #fff; }
@media (max-width: 760px) { .about { grid-template-columns: 1fr; } }

/* ---------- footer / contatti */
.contact { background: var(--lav); color: #fff; position: relative; overflow: hidden; padding: clamp(60px, 9vw, 120px) 0; margin-top: clamp(40px, 6vw, 80px); }
.contact .cut { font-size: clamp(46px, 9vw, 130px); color: #fff; }
.contact p { font-size: clamp(17px, 1.8vw, 21px); max-width: 520px; }
.contact .btn { display: inline-flex; align-items: center; gap: 12px; background: #fff; color: var(--ink); text-decoration: none; font-weight: 700; padding: 14px 24px; border-radius: 999px; margin-top: 10px; }
.contact .btn:hover { background: var(--peach); }
.contact .btn .icon { width: 44px; color: var(--ink); }
.contact .links { display: flex; gap: 22px; margin-top: 26px; flex-wrap: wrap; }
.contact .links a { font-weight: 500; }
.contact .doodle { color: var(--peach); }
.contact .d1 { width: clamp(110px, 18vw, 260px); right: 6%; top: 10%; }
.contact .d2 { width: clamp(160px, 30vw, 430px); right: -4%; bottom: -6%; }
.foot { padding-top: 22px; padding-bottom: 22px; font-size: 13px; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

/* ---------- lightbox */
.lightbox { border: 0; padding: 0; background: transparent; max-width: 100vw; max-height: 100vh; width: 100vw; height: 100vh; }
.lightbox::backdrop { background: rgba(46, 37, 114, .92); }
.lb-inner { width: 100%; height: 100%; display: grid; grid-template-rows: minmax(0, 1fr) auto; align-items: center; padding: 56px 16px 20px; }
.lb-inner img { max-width: 100%; max-height: calc(100vh - 130px); margin: auto; object-fit: contain; border-radius: 4px; }
.lb-cap { color: #fff; text-align: center; padding-top: 12px; font-size: 14px; }
.lb-cap b { font-weight: 600; }
.lb-btn { position: absolute; background: #fff; color: var(--ink); border: 0; width: 48px; height: 48px; border-radius: 50%; font-size: 22px; cursor: pointer; display: grid; place-items: center; }
.lb-btn:hover { background: var(--peach); }
.lb-close { top: 12px; right: 12px; }
.lb-prev { left: 12px; top: 50%; }
.lb-next { right: 12px; top: 50%; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }

/* ---------- selettore lingua IT / EN */
.lang { display: inline-flex; align-items: center; gap: 2px; margin-left: 6px; padding: 3px; border: 2px solid var(--lav); border-radius: 999px; font-size: 13px; font-weight: 600; }
.lang > * { padding: 2px 9px; border-radius: 999px; line-height: 1.4; }
.lang .on { background: var(--lav); color: #fff; }
.nav .lang a { padding: 2px 9px; }
.nav .lang a::after { display: none; }
.nav .lang a:hover { background: var(--peach-soft); }
@media (max-width: 1080px) { .lang { margin: 12px 0 0; font-size: 15px; } }

/* =====================================================================
   ANIMAZIONI  (attive solo con .js-anim, cioè JS acceso e "riduci movimento" spento)
   ===================================================================== */

/* lettering: le lettere ritagliate saltano dentro una alla volta, poi ballano al passaggio del mouse */
.cut .ch { transform-box: fill-box; transform-origin: 50% 90%; }
.js-anim .cut:not(.in) .ch { opacity: 0; }
.js-anim .cut.in .ch { animation: pop .65s cubic-bezier(.34, 1.7, .5, 1) both; animation-delay: calc(var(--d, 0ms) + var(--i) * 55ms); }
.js-anim .cut.in.done .ch { animation: none; }
.js-anim .cut.in.done .ch.wig { animation: wig .6s ease; }
@keyframes pop { from { opacity: 0; transform: translateY(45%) scale(.3) rotate(-28deg); } 55% { opacity: 1; } to { opacity: 1; transform: none; } }
@keyframes wig { 0%, 100% { transform: none; } 25% { transform: translateY(-8%) rotate(-11deg) scale(1.08); } 60% { transform: rotate(7deg); } 80% { transform: rotate(-3deg); } }

/* scarabocchi: si "disegnano" entrando, poi il tratto trema (line boil) e fluttua */
.doodle { translate: 0 var(--py, 0px); }
.js-anim .doodle:not(.drawn) svg { clip-path: inset(0 100% 0 0); transition: clip-path 1.2s cubic-bezier(.65, 0, .25, 1); }
.js-anim .doodle.in:not(.drawn) svg { clip-path: inset(-10% -10% -10% -10%); }
.js-anim :is(.doodle, .logo-big, .cat .icon, .pager .icon) svg { animation: boil .45s steps(1) infinite; }
.js-anim .doodle svg { animation: boil .45s steps(1) infinite, float 5.5s ease-in-out infinite alternate; }
.js-anim .hero .d3 svg, .js-anim .contact .d1 svg { animation: boil .45s steps(1) infinite, spin 22s linear infinite; }
@keyframes boil { 0% { filter: url(#boil0); } 33% { filter: url(#boil1); } 66% { filter: url(#boil2); } }
@keyframes float { to { transform: translateY(-10px) rotate(3deg); } }
@keyframes spin { to { rotate: 360deg; } }

/* copertina */
.js-anim .hero-block { animation: rise .9s cubic-bezier(.2, .9, .3, 1.15) both; }
.js-anim .hero-meta { animation: fade .6s .6s both; }
.js-anim .hero-intro { animation: rise .8s .8s both; }
.js-anim .page-hero :is(.kicker, p) { animation: rise .7s .25s both; }
@keyframes rise { from { opacity: 0; transform: translateY(40px) rotate(-1.5deg); } }
@keyframes fade { from { opacity: 0; } }

/* lavori, sezioni, chi sono: entrano come pezzi di carta che atterrano */
.js-anim :is(.grid figure, .cat, .about-art, .about-text, .project-head) { transition: opacity .7s ease, transform .9s cubic-bezier(.2, .9, .3, 1.2); }
.js-anim :is(.grid figure, .cat, .about-art, .about-text, .project-head):not(.in) { opacity: 0; transform: translateY(46px) rotate(var(--r, 1.5deg)); }
.js-anim .cat.done { transition: transform .35s cubic-bezier(.3, 1.6, .5, 1); }
.js-anim .cat.done:hover { transform: translateY(-6px) rotate(-1deg); }
.cat:hover .label .icon svg { animation: wig .7s ease; }

/* immagine "adesivo": al passaggio si solleva con l'ombra pesca */
.tile { transition: transform .35s cubic-bezier(.3, 1.6, .5, 1), box-shadow .35s ease; }
.tile:hover, .tile:focus-visible { transform: translateY(-4px) rotate(-1deg); box-shadow: 8px 8px 0 var(--peach); }
.grid figure:nth-child(even) .tile:hover, .grid figure:nth-child(even) .tile:focus-visible { transform: translateY(-4px) rotate(1deg); }

/* bollino che segue il mouse sopra le immagini */
.peek { position: fixed; left: 0; top: 0; z-index: 40; width: 88px; height: 88px; margin: -44px 0 0 -44px; border-radius: 50%; background: var(--peach); color: var(--ink); display: grid; place-items: center; font-weight: 700; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; pointer-events: none; scale: 0; transition: scale .3s cubic-bezier(.3, 1.6, .5, 1); }
.peek.on { scale: 1; }
.peek::before { content: ""; position: absolute; inset: -7px; border: 2px dashed var(--lav); border-radius: 50%; animation: spin 9s linear infinite; }
.has-peek .tile { cursor: none; }

/* piccoli dettagli */
.brand:hover .logo { animation: wig .6s ease; }
.logo-big:hover { animation: wig .7s ease; }
.contact .btn .icon, .pager .icon { transition: translate .3s cubic-bezier(.3, 1.6, .5, 1); }
.contact .btn:hover .icon, .pager .next:hover .icon { translate: 8px 0; }
.pager .prev:hover .icon { translate: -8px 0; }
.lb-inner img.pop { animation: lbpop .45s cubic-bezier(.3, 1.5, .5, 1); }
@keyframes lbpop { from { opacity: 0; transform: scale(.92) rotate(-1.5deg); } }

/* nastro che scorre sotto la copertina */
.marquee { overflow: hidden; padding: 18px 0 26px; margin-top: clamp(-50px, -4vw, -20px); }
.marquee-band { background: var(--peach); rotate: -2deg; width: 106%; margin-left: -3%; padding: 12px 0; }
.marquee-track { display: flex; width: max-content; animation: marq 38s linear infinite; }
.marquee:hover .marquee-track { animation-play-state: paused; }
.marquee-row { display: flex; align-items: center; gap: .55em; padding-right: .55em; font-weight: 800; font-size: clamp(22px, 3.2vw, 44px); line-height: 1.1; text-transform: uppercase; color: var(--ink); white-space: nowrap; }
.marquee-row a { text-decoration: none; }
.marquee-row a:hover { color: #fff; }
.m-ico { width: 1.05em; color: #fff; display: inline-block; flex: none; }
.m-ico svg { width: 100%; height: auto; display: block; animation: spin 12s linear infinite; }
@keyframes marq { to { transform: translateX(-50%); } }

/* passaggio morbido tra le pagine (browser che lo supportano) */
@view-transition { navigation: auto; }
.site-header { view-transition-name: site-header; }
::view-transition-old(root) { animation: vt-out .22s ease both; }
::view-transition-new(root) { animation: vt-in .45s cubic-bezier(.2, .9, .3, 1) both; }
@keyframes vt-out { to { opacity: 0; transform: translateY(-12px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(18px); } }
@media (prefers-reduced-motion: reduce) { @view-transition { navigation: none; } }
