:root { --header-h: 94px; }
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--theme-bg); color: var(--theme-text); font-family: Inter, sans-serif; min-height: 100vh; transition: background .35s ease, color .35s ease; }
html.viewer-open, body.viewer-open { overflow: hidden; scrollbar-gutter: auto; }
.project-header { position: fixed; inset: 0 0 auto 0; z-index: 50; height: var(--header-h); padding: 28px 38px; display: flex; justify-content: space-between; align-items: center; background: color-mix(in srgb, var(--theme-bg) 88%, transparent); backdrop-filter: blur(12px); }
.project-logo { font: italic 700 22px/1 'Playfair Display', serif; color: var(--theme-text); text-decoration: none; }
.project-nav { display: flex; gap: 15px; align-items: center; }
.project-nav a { color: var(--theme-muted); text-decoration: none; font-size: 12px; text-transform: uppercase; letter-spacing: 2px; }
.theme-toggle { border: 0; background: none; color: var(--theme-text); font-size: 19px; cursor: pointer; padding: 4px; }
.project-main { padding: calc(var(--header-h) + 64px) 3vw 90px; }
.project-intro { text-align: center; max-width: 980px; margin: 0 auto 90px; }
.project-intro h1 { margin: 0; font: italic 400 clamp(3.2rem, 7vw, 7rem)/.95 'Playfair Display', serif; letter-spacing: -.045em; }
.project-caption { margin: 25px auto 0; max-width: 760px; color: var(--theme-muted); font-size: clamp(.82rem, 1.25vw, 1rem); line-height: 1.55; letter-spacing: .055em; }
.project-caption:empty { display: none; }
.project-gallery { width: min(1560px, 100%); min-height: 80vh; margin: 0 auto; display: grid; grid-template-columns: repeat(12, 1fr); grid-auto-flow: dense; gap: clamp(30px, 6vw, 100px) clamp(24px, 4vw, 72px); align-items: center; }
.gallery-item { position: relative; appearance: none; border: 0; padding: 0; background: none; cursor: pointer; width: 100%; justify-self: center; transition: transform .55s cubic-bezier(.16,1,.3,1), opacity .4s; }
.gallery-item:hover { transform: translateY(-5px); }
.gallery-item img { display: block; width: 100%; height: auto; max-height: 72vh; object-fit: contain; }
.gallery-item { grid-column: var(--grid-start, 1) / span var(--grid-span, 4); width: var(--random-width, 100%); margin-top: var(--random-shift, 0); }
.gallery-index { position: absolute; top: 2px; right: -25px; color: var(--theme-muted); font-size: 10px; }
.gallery-empty { grid-column: 1/-1; text-align: center; color: var(--theme-muted); padding: 15vh 0; }
.project-description { max-width: 760px; font: 400 clamp(1rem,1.5vw,1.18rem)/1.75 Inter,sans-serif; }
.project-description:empty { display: none; }
.gallery-description-item { grid-column: var(--grid-start, 1) / span var(--grid-span, 5); width: var(--random-width, 100%); margin: var(--random-shift, 0) 0 0; justify-self: center; color: var(--theme-text); }


body.back-area-active,
body.back-area-active .project-main { cursor: pointer; }
.project-back-follower { position:fixed; top:0; left:0; z-index:90; pointer-events:none; background:#110e2c; color:#faf8f5; padding:8px 16px; border-radius:30px; font-size:11px; font-weight:500; text-transform:uppercase; letter-spacing:1px; white-space:nowrap; box-shadow:0 10px 25px rgba(17,14,44,.15); opacity:0; transform:translate3d(var(--mx,0),var(--my,0),0) scale(.8); transform-origin:center; transition:opacity .3s ease,transform .3s cubic-bezier(.16,1,.3,1); }
.project-back-follower.visible { opacity:1; transform:translate3d(var(--mx,0),var(--my,0),0) scale(1); }
[data-theme="dark"] .project-back-follower { background:#faf8f5; color:#110e2c; }

.gallery-cursor { position: fixed; z-index: 170; left: 0; top: 0; width: 82px; height: 82px; border-radius: 50%; color: #fff; display: grid; place-items: center; pointer-events: none; opacity: 0; overflow: hidden; transform: translate3d(calc(var(--x,0px) - 41px),calc(var(--y,0px) - 41px),0) scale(.58); transition: opacity .2s, transform .28s cubic-bezier(.16,1,.3,1); }
.gallery-cursor::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background-image: var(--lens-image, none);
  background-repeat: no-repeat;
  background-size: var(--lens-size, auto);
  background-position: var(--lens-position, center);
  filter: hue-rotate(145deg) saturate(2.35) contrast(1.18) brightness(.96);
  transform: scale(1.015);
}
.gallery-cursor.visible { opacity: 1; transform: translate3d(calc(var(--x,0px) - 41px),calc(var(--y,0px) - 41px),0) scale(1); }
.gallery-cursor span { position:relative; z-index:1; font-size: 27px; line-height:1; font-weight: 200; color:#fff; text-shadow:0 1px 5px rgba(0,0,0,.65); mix-blend-mode:normal; }

.gallery-zoom-follower {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 175;
  pointer-events: none;
  padding: 8px 15px;
  border-radius: 999px;
  background: #110e2c;
  color: #faf8f5;
  font-size: 10px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 1.15px;
  text-transform: uppercase;
  white-space: nowrap;
  opacity: 0;
  transform: translate3d(calc(var(--zx, 0px) + 24px), calc(var(--zy, 0px) + 22px), 0) scale(.82);
  transition: opacity .2s ease, transform .28s cubic-bezier(.16,1,.3,1);
  box-shadow: 0 10px 25px rgba(17,14,44,.15);
}
.gallery-zoom-follower.visible {
  opacity: 1;
  transform: translate3d(calc(var(--zx, 0px) + 24px), calc(var(--zy, 0px) + 22px), 0) scale(1);
}
[data-theme="dark"] .gallery-zoom-follower { background:#faf8f5; color:#110e2c; }
.gallery-viewer { position: fixed; inset: 0; z-index: 200; background: #050505; color: white; display: grid; grid-template-columns: 78px minmax(0,1fr) minmax(260px,21vw); opacity: 0; visibility: hidden; transition: opacity .35s ease, visibility .35s; }
.gallery-viewer.open { opacity: 1; visibility: visible; }

.viewer-return-follower {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 280;
  pointer-events: none;
  padding: 8px 16px;
  border-radius: 999px;
  background: #faf8f5;
  color: #110e2c;
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 1px;
  text-transform: uppercase;
  white-space: nowrap;
  box-shadow: 0 10px 25px rgba(0,0,0,.2);
  opacity: 0;
  transform: translate3d(var(--vrx,0),var(--vry,0),0) scale(.8);
  transform-origin: center;
  transition: opacity .25s ease, transform .3s cubic-bezier(.16,1,.3,1);
}
.viewer-return-follower.visible {
  opacity: 1;
  transform: translate3d(var(--vrx,0),var(--vry,0),0) scale(1);
}
.gallery-viewer.return-area-active,
.gallery-viewer.return-area-active * { cursor: pointer !important; }

.viewer-thumbs { overflow-y: auto; padding: 10px 8px; display: flex; flex-direction: column; gap: 10px; border-right: 0; background: #fff; scrollbar-width: none; }
.viewer-thumbs::-webkit-scrollbar { display:none; }
.viewer-thumb { border: 0; padding: 0; opacity: .34; cursor: pointer; background: transparent; transition: opacity .2s; }
.viewer-thumb.active, .viewer-thumb:hover { opacity: 1; }
.viewer-thumb img { display:block; width:100%; aspect-ratio: 3/4; object-fit:cover; }
.viewer-stage { min-width:0; min-height:0; display:flex; align-items:center; justify-content:center; background:#fff; overflow:hidden; padding-inline:clamp(24px,4vw,76px); }
.viewer-stage img { display:block; max-width:100%; width:auto; height:100vh; object-fit:contain; }
.viewer-info { padding: 38px 30px 34px; display:flex; flex-direction:column; justify-content:flex-end; min-width:0; }
.viewer-counter { position:absolute; top:18px; font-size:10px; color:#b8b8b8; }
.viewer-info h2 {
  margin:0;
  color:#fff !important;
  font-family:var(--theme-font-display,'Playfair Display',serif) !important;
  font-size:clamp(2rem,3vw,3.4rem);
  font-weight:400;
  line-height:.98;
  overflow-wrap:normal;
  word-break:normal;
  hyphens:none;
  white-space:normal;
}
.viewer-info h2.title-medium { font-size:clamp(1.72rem,2.45vw,2.8rem); }
.viewer-info h2.title-long { font-size:clamp(1.42rem,2vw,2.25rem); line-height:1.02; }
.viewer-info h2.title-xlong { font-size:clamp(1.16rem,1.55vw,1.78rem); line-height:1.06; }

.viewer-info p { margin:18px 0 0; color:#d3d3d3; font-size:12px; line-height:1.55; white-space:pre-line; }
@media (max-width: 800px) {
  :root { --header-h: 72px; }
  .project-header { padding: 20px; }
  .project-logo { font-size:18px; }
  .project-main { padding: calc(var(--header-h) + 42px) 18px 65px; }
  .project-intro { margin-bottom:55px; }
  .project-gallery { display:flex; flex-direction:column; gap:48px; min-height:0; }
  .gallery-item { width:min(var(--mobile-width,100%),620px); align-self:var(--mobile-align,center); cursor:pointer; margin:0!important; }
  .gallery-description-item { width:var(--mobile-width,100%); align-self:var(--mobile-align,center); margin:0!important; }
  .gallery-index { right:0; top:-18px; }
  
.project-back-follower { position:fixed; top:0; left:0; z-index:90; pointer-events:none; background:#110e2c; color:#faf8f5; padding:8px 16px; border-radius:30px; font-size:11px; font-weight:500; text-transform:uppercase; letter-spacing:1px; white-space:nowrap; box-shadow:0 10px 25px rgba(17,14,44,.15); opacity:0; transform:translate3d(var(--mx,0),var(--my,0),0) scale(.8); transform-origin:center; transition:opacity .3s ease,transform .3s cubic-bezier(.16,1,.3,1); }
.project-back-follower.visible { opacity:1; transform:translate3d(var(--mx,0),var(--my,0),0) scale(1); }
[data-theme="dark"] .project-back-follower { background:#faf8f5; color:#110e2c; }

.gallery-cursor, .gallery-zoom-follower, .viewer-return-follower { display:none; }
  .project-description { margin-top:0; }
  .gallery-viewer { grid-template-columns:1fr; grid-template-rows:minmax(0,1fr) auto auto; }
  .viewer-stage { grid-row:1; background:#050505; padding-inline:14px; }
  .viewer-stage img { width:100%; height:calc(100dvh - 190px); max-height:none; object-fit:contain; }
  .viewer-thumbs { grid-row:2; flex-direction:row; overflow-x:auto; overflow-y:hidden; border-right:0; border-top:0; background:#fff; padding:7px; }
  .viewer-thumb { flex:0 0 48px; }
  .viewer-thumb img { height:62px; aspect-ratio:auto; }
  .viewer-info { grid-row:3; padding:13px 18px 18px; display:block; max-height:112px; overflow:auto; }
  .viewer-counter { position:static; margin-bottom:6px; }
  .viewer-info h2 { font-size:1.55rem; }
  .viewer-info p { margin-top:7px; font-size:11px; }
}

/* Sticky project identity */
.project-intro {
  position: sticky;
  top: calc(var(--header-h) + 18px);
  z-index: 22;
  width: fit-content;
  min-width: min(92vw, 420px);
  padding: 10px 18px 14px;
  border-radius: 2px;
  background: color-mix(in srgb, var(--theme-bg) 84%, transparent);
  backdrop-filter: blur(10px);
  transition: transform .45s cubic-bezier(.16,1,.3,1), padding .45s ease, background .35s ease;
}
.project-intro.is-scrolled {
  transform: translateY(-8px) scale(.88);
  transform-origin: top center;
  padding-top: 7px;
  padding-bottom: 9px;
}
.project-intro.is-scrolled h1 { letter-spacing: -.035em; }
.project-intro.is-scrolled .project-caption { margin-top: 14px; }

/* Stronger depth/parallax on gallery images */
.gallery-item {
  --parallax-x: 0px;
  --parallax-y: 0px;
  --parallax-rotate-x: 0deg;
  --parallax-rotate-y: 0deg;
  --scroll-parallax: 0px;
  --depth-z: 0px;
  transform: perspective(1100px) translate3d(var(--parallax-x), calc(var(--parallax-y) + var(--scroll-parallax)), var(--depth-z))
             rotateX(var(--parallax-rotate-x)) rotateY(var(--parallax-rotate-y));
  transform-style: preserve-3d;
  will-change: transform;
}
.gallery-item:hover {
  transform: perspective(1100px) translate3d(var(--parallax-x), calc(var(--parallax-y) + var(--scroll-parallax) - 24px), calc(var(--depth-z) + 48px))
             rotateX(var(--parallax-rotate-x)) rotateY(var(--parallax-rotate-y)) scale(1.025);
  z-index: 12;
}
.gallery-item img {
  transition: filter .45s ease, box-shadow .45s ease;
}
.gallery-item:hover img {
  box-shadow: 0 28px 52px rgba(0,0,0,.16);
}

/* Variable exhibition-like composition */
.gallery-item {
  z-index: var(--layer, 1);
  margin-left: var(--overlap-x, 0px);
  margin-bottom: var(--overlap-y, 0px);
}
.gallery-description-item {
  --text-scroll-parallax: 0px;
  transform: translate3d(0, var(--text-scroll-parallax), 0);
  z-index: var(--layer, 2);
  padding: clamp(10px,1.5vw,22px);
  background: color-mix(in srgb, var(--theme-bg) 76%, transparent);
  backdrop-filter: blur(5px);
}

.project-footer {
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 40px;
  color: var(--theme-muted);
  background: transparent;
  font-family: Inter, sans-serif;
  font-size: 12px;
  line-height: normal;
  letter-spacing: 1px;
  text-transform: uppercase;
  text-align: left;
}
body.viewer-open .project-footer { visibility: hidden; }

@media (max-width: 800px) {
  .project-intro {
    position: sticky;
    top: calc(var(--header-h) + 8px);
    min-width: 0;
    width: 100%;
    padding: 8px 10px 10px;
  }
  .project-intro.is-scrolled {
    transform: translateY(-4px) scale(.94);
  }
  .gallery-item,
  .gallery-item:hover {
    transform: none;
  }
  .gallery-item:hover img { box-shadow: none; }
  .project-footer { padding: 40px 20px; font-size: 12px; }
}


/* =========================================================
   FILIPPO CENTENARI — PORTFOLIO 1.0
   Viewer refinements and accessibility/performance safeguards
   ========================================================= */

/* Lightbox opens/closes as a single calm transition. */
.gallery-viewer {
  transform: translateY(10px) scale(.995);
  transition: opacity .34s ease, visibility .34s, transform .48s cubic-bezier(.16,1,.3,1);
}
.gallery-viewer.open { transform: translateY(0) scale(1); }

/* Thumbnails are centred in the viewport when they fit. JS switches to
   top alignment only when the column actually needs its own scrollbar. */
.viewer-thumbs {
  justify-content: center;
  padding-block: 18px;
  overscroll-behavior: contain;
}
.viewer-thumbs.is-overflowing { justify-content: flex-start; }
.viewer-thumb {
  flex: 0 0 auto;
  transform: scale(.94);
  transform-origin: center;
  transition: opacity .28s ease, transform .38s cubic-bezier(.16,1,.3,1);
}
.viewer-thumb.active {
  opacity: 1;
  transform: scale(1.07);
}
.viewer-thumb:hover { transform: scale(1.025); }
.viewer-thumb.active:hover { transform: scale(1.07); }

/* Progressive image change: old image softens, new image settles in. */
.viewer-stage img {
  opacity: 1;
  filter: blur(0);
  transform: scale(1);
  transition: opacity .26s ease, filter .42s ease, transform .48s cubic-bezier(.16,1,.3,1);
}
.viewer-stage img.is-loading {
  opacity: .35;
  filter: blur(10px);
  transform: scale(.992);
}

.viewer-progress {
  width: min(150px, 100%);
  height: 1px;
  margin: 10px 0 0;
  background: rgba(255,255,255,.2);
  overflow: hidden;
}
.viewer-progress-bar {
  display: block;
  width: 0;
  height: 100%;
  background: currentColor;
  transition: width .48s cubic-bezier(.16,1,.3,1);
}

/* Keep heavy motion away from users/devices that request less animation. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .gallery-viewer, .viewer-stage img, .viewer-thumb, .gallery-item,
  .project-intro, .project-back-follower, .gallery-cursor, .gallery-zoom-follower { transition-duration: .01ms !important; }
  .gallery-item, .gallery-item:hover, .gallery-description-item { transform: none !important; }
}

@media (max-width: 800px) {
  .viewer-thumbs,
  .viewer-thumbs.is-overflowing { justify-content: flex-start; padding-block: 7px; }
  .viewer-thumb.active { transform: scale(1.04); }
  .viewer-progress { width: 90px; margin-top: 6px; }
}


/* =========================================================
   PORTFOLIO 2.1 — visual continuity and micro-refinements
   ========================================================= */
:root { --ease-out-expo: cubic-bezier(.16,1,.3,1); --signature-stroke: .8px; }
html { -webkit-font-smoothing: antialiased; text-rendering: geometricPrecision; }
body::after {
  content:''; position:fixed; inset:0; z-index:500; pointer-events:none; opacity:.02;
  background-image:url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.6'/%3E%3C/svg%3E");
  mix-blend-mode:soft-light;
}
.project-header { background: color-mix(in srgb, var(--theme-bg) 86%, transparent); transition: background .35s ease; }
.gallery-item { transition: transform .68s var(--ease-out-expo), opacity .4s; }
.gallery-item img { transition: filter .5s ease, box-shadow .6s var(--ease-out-expo); }

/* Four-line signature anchored to the main reference image. */
.project-entry-signature,
.viewer-signature {
  position:fixed; inset:0; width:100vw; height:100vh; pointer-events:none; overflow:visible;
}
.project-entry-signature { z-index:0; opacity:0; transition:opacity 160ms linear; }
.project-entry-signature.is-visible { opacity:1; }
.project-entry-signature.is-hidden,
.project-entry-signature.is-outside { opacity:0; }
.project-entry-signature path,
.project-entry-signature rect,
.viewer-signature path,
.viewer-signature rect {
  fill:none; stroke:var(--theme-accent); stroke-width:var(--signature-stroke); vector-effect:non-scaling-stroke;
  stroke-linecap:square; stroke-linejoin:miter; path-length:1; stroke-dasharray:1; stroke-dashoffset:1;
}
.project-entry-signature path,
.project-entry-signature rect { stroke-dashoffset:0; }
.project-entry-frame { shape-rendering:geometricPrecision; }

/* The same four-line vocabulary becomes the viewer frame. */
.viewer-signature { z-index:3; opacity:0; transition:opacity .12s linear; }
.gallery-viewer.open .viewer-signature { opacity:0; }
.viewer-signature path,
.viewer-signature rect { transition:stroke-dashoffset 250ms var(--ease-out-expo); }
.gallery-viewer.open .viewer-signature path,
.gallery-viewer.open .viewer-signature rect { stroke-dashoffset:0; }
.viewer-stage img { position:relative; z-index:2; }
.viewer-stage { position:relative; }

/* A calmer, more consistent typographic rhythm. */
.project-intro h1 { text-wrap:balance; }
.project-caption, .project-description, .viewer-info p { text-wrap:pretty; }
.viewer-info h2 { letter-spacing:-.025em; }

@media (prefers-reduced-motion: reduce) {
  body::after, .project-entry-signature, .viewer-signature { display:none!important; }
}

/* v2.2.2 — signature above navigation, while project content stays foreground */
.project-header { z-index: 12; }
.project-entry-signature { z-index: 20; }
.project-intro { z-index: 40; }
.project-gallery { position: relative; z-index: 30; }
.project-footer { position: relative; z-index: 30; }


/* v2.2.3 — compact project navigation */
:root { --header-h: 52px; }
.project-header {
  height: var(--header-h);
  min-height: var(--header-h);
  padding: 14px 18px;
  align-items: flex-start;
  background: transparent;
}
.project-logo { font-size: 17px; line-height: 1; }
.project-nav { gap: 12px; align-items: flex-start; }
.project-nav a { font-size: 11px; line-height: 1; letter-spacing: 1.7px; }
.project-header .theme-toggle { font-size: 16px; line-height: 1; padding: 0 0 0 8px; }
.project-main { padding-top: calc(var(--header-h) + 54px); }
@media (max-width: 800px) {
  :root { --header-h: 46px; }
  .project-header { padding: 12px 14px; }
  .project-logo { font-size: 16px; }
  .project-nav a { font-size: 10px; }
  .project-main { padding-top: calc(var(--header-h) + 38px); }
}


/* v3.0.2 — dimensioni opera e immagine di riferimento principale */
.project-dimensions {
  margin: 9px auto 0;
  max-width: 760px;
  color: var(--theme-muted);
  font-size: clamp(.74rem, 1vw, .88rem);
  line-height: 1.45;
  letter-spacing: .075em;
}
.project-dimensions:empty { display: none; }
.project-intro.is-scrolled .project-dimensions { margin-top: 7px; }
.gallery-item--reference img { max-height: 84vh; }
@media (min-width: 821px) {
  .gallery-item--reference {
    grid-column: var(--grid-start, 2) / span var(--grid-span, 10);
    width: min(var(--random-width, 100%), 1320px);
    margin-left: 0;
    margin-bottom: 0;
  }
}
@media (max-width: 820px) {
  .gallery-item--reference { width: min(100%, 720px); align-self: center; }
  .gallery-item--reference img { max-height: 78vh; }
}

/* v3.0.6 — contorno unificato con le linee dell'immagine principale */
.gallery-item--reference img { border:0; border-radius:0; }


/* v3.0.8 — inclinazione ampia ripristinata; cornice vincolata agli angoli reali */
.gallery-item--reference {
  transform: perspective(1100px) translate3d(var(--parallax-x), calc(var(--parallax-y) + var(--scroll-parallax)), var(--depth-z))
             rotateX(var(--parallax-rotate-x)) rotateY(var(--parallax-rotate-y));
  transform-style: preserve-3d;
}
.gallery-item--reference:hover {
  transform: perspective(1100px) translate3d(var(--parallax-x), calc(var(--parallax-y) + var(--scroll-parallax) - 24px), calc(var(--depth-z) + 48px))
             rotateX(var(--parallax-rotate-x)) rotateY(var(--parallax-rotate-y)) scale(1.025);
}
.reference-corner-marker {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
  z-index: -1;
}
.reference-corner-marker--tl { left: 0; top: 0; transform: translate(-50%,-50%); }
.reference-corner-marker--tr { right: 0; top: 0; transform: translate(50%,-50%); }
.reference-corner-marker--br { right: 0; bottom: 0; transform: translate(50%,50%); }
.reference-corner-marker--bl { left: 0; bottom: 0; transform: translate(-50%,50%); }
.gallery-item--reference img {
  border-radius: 0 !important;
  clip-path: none !important;
}
.gallery-cursor {
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--theme-accent) 72%, white), 0 10px 28px rgba(0,0,0,.16);
}
.gallery-cursor::before {
  transform: none;
  image-rendering: auto;
}

/* v3.0.12 — cornice e collegamenti condividono gli stessi quattro marcatori. */
.gallery-item--reference img { outline: 0 !important; }
.project-entry-signature path[data-frame-edge] {
  stroke-dasharray: none;
  stroke-dashoffset: 0;
}

/* Elimina qualsiasi piano grafico residuo sotto l'immagine principale. */
.gallery-item--reference::before,
.gallery-item--reference::after { content: none !important; display: none !important; }
.gallery-item--reference { line-height: 0; }
.gallery-item--reference img { vertical-align: top; }

/* v3.0.13 — il box della reference coincide con i pixel reali dell'immagine. */
.gallery-item--reference {
  width: fit-content !important;
  max-width: min(100%, 1320px);
  justify-self: center;
}
.gallery-item--reference img {
  display: block;
  width: auto !important;
  height: auto !important;
  max-width: 100%;
  max-height: 84vh;
  object-fit: initial !important;
}
@media (max-width: 820px) {
  .gallery-item--reference {
    width: fit-content !important;
    max-width: min(100%, 720px);
  }
  .gallery-item--reference img {
    max-width: 100%;
    max-height: 78vh;
  }
}

/* v3.0.16 — reference responsive senza overflow: un solo box, stesso rapporto reale. */
.gallery-item--reference {
  width: min(100%, 1320px, calc(84vh * var(--reference-ratio, 1.7777778))) !important;
  max-width: 100% !important;
  justify-self: center;
  overflow: visible;
}
.gallery-item--reference img {
  display: block;
  width: 100% !important;
  height: auto !important;
  max-width: none !important;
  max-height: none !important;
  object-fit: initial !important;
}
@media (max-width: 820px) {
  .gallery-item--reference {
    width: min(100%, 720px, calc(78vh * var(--reference-ratio, 1.7777778))) !important;
  }
}
html, body { overflow-x: clip; }

/* v3.0.16 — bordo calcolato sul quadrilatero reale dell'immagine. */
.project-entry-signature path[data-frame-edge] {
  stroke-width: 1px;
  shape-rendering: geometricPrecision;
}

/* v3.0.18 — refactor definitivo del componente reference.
   Il bottone resta neutro nel layout; immagine, bordo e marker formano un solo oggetto. */
.gallery-item--reference {
  width: 100% !important;
  max-width: 100% !important;
  justify-self: stretch;
  overflow: visible;
  transform: none !important;
  line-height: normal;
}
.gallery-item--reference:hover { transform: none !important; }
.gallery-item--reference .reference-object {
  position: relative;
  display: block;
  width: min(100%, 1320px, calc(84vh * var(--reference-ratio, 1.7777778)));
  margin-inline: auto;
  line-height: 0;
  box-sizing: border-box;
  border: 1px solid var(--theme-accent);
  background: transparent;
  transform: perspective(1100px)
    translate3d(var(--parallax-x), calc(var(--parallax-y) + var(--scroll-parallax)), var(--depth-z))
    rotateX(var(--parallax-rotate-x)) rotateY(var(--parallax-rotate-y));
  transform-style: preserve-3d;
  transform-origin: center center;
  will-change: transform;
  transition: transform .68s var(--ease-out-expo), box-shadow .45s ease;
}
.gallery-item--reference:hover .reference-object {
  transform: perspective(1100px)
    translate3d(var(--parallax-x), calc(var(--parallax-y) + var(--scroll-parallax) - 24px), calc(var(--depth-z) + 48px))
    rotateX(var(--parallax-rotate-x)) rotateY(var(--parallax-rotate-y)) scale(1.025);
  box-shadow: 0 28px 52px rgba(0,0,0,.16);
}
.gallery-item--reference .reference-object > img {
  display: block;
  width: 100% !important;
  height: auto !important;
  max-width: none !important;
  max-height: none !important;
  object-fit: fill !important;
  border: 0 !important;
  outline: 0 !important;
  box-shadow: none !important;
  vertical-align: top;
}
.gallery-item--reference .reference-corner-marker {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
  transform: none;
}
.gallery-item--reference .reference-corner-marker--tl { left: -1px; top: -1px; }
.gallery-item--reference .reference-corner-marker--tr { right: -1px; top: -1px; }
.gallery-item--reference .reference-corner-marker--br { right: -1px; bottom: -1px; }
.gallery-item--reference .reference-corner-marker--bl { left: -1px; bottom: -1px; }
.project-entry-signature path[data-frame-edge] { display: none !important; }
.gallery-item--reference::before,
.gallery-item--reference::after,
.gallery-item--reference .reference-object::before,
.gallery-item--reference .reference-object::after { content: none !important; display: none !important; }
@media (max-width: 820px) {
  .gallery-item--reference .reference-object {
    width: min(100%, 720px, calc(78vh * var(--reference-ratio, 1.7777778)));
  }
}

/* v3.0.20 — navigazione verticale della pagina progetto */
.project-scroll-cue {
  position: fixed;
  left: 50%;
  bottom: clamp(18px, 3vh, 34px);
  z-index: 85;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 8px 12px;
  border: 0;
  background: transparent;
  color: var(--theme-accent);
  font: 500 9px/1 Inter, sans-serif;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translate3d(-50%, 10px, 0);
  transition: opacity .28s ease, visibility .28s, transform .42s cubic-bezier(.16,1,.3,1), color .35s ease;
}
.project-scroll-cue.is-visible {
  opacity: .9;
  visibility: visible;
  transform: translate3d(-50%, 0, 0);
}
.project-scroll-cue i {
  display: block;
  font-style: normal;
  font-size: 18px;
  line-height: 1;
  animation: project-scroll-hint 1.45s cubic-bezier(.45,0,.55,1) infinite;
}
.project-scroll-cue:hover { opacity: 1; }
@keyframes project-scroll-hint {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(6px); }
}

.back-to-top-wrap {
  position: relative;
  z-index: 40;
  width: 100%;
  display: flex;
  justify-content: center;
  padding: clamp(50px, 8vh, 100px) 20px 10px;
}
.back-to-top {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 0;
  padding: 10px 14px;
  background: transparent;
  color: var(--theme-accent);
  font: 500 10px/1 Inter, sans-serif;
  letter-spacing: 1.7px;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform .35s cubic-bezier(.16,1,.3,1), opacity .25s ease, color .35s ease;
}
.back-to-top i {
  font-style: normal;
  font-size: 16px;
  line-height: 1;
  transition: transform .35s cubic-bezier(.16,1,.3,1);
}
.back-to-top:hover { transform: translateY(-2px); }
.back-to-top:hover i { transform: translateY(-4px); }
body.viewer-open .project-scroll-cue,
body.viewer-open .back-to-top-wrap { visibility: hidden; }

@media (max-width: 800px) {
  .project-scroll-cue { bottom: 14px; font-size: 8px; }
  .project-scroll-cue i { font-size: 16px; }
  .back-to-top-wrap { padding-top: 52px; }
  .back-to-top { font-size: 9px; padding: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .project-scroll-cue i { animation: none; }
  .project-scroll-cue, .back-to-top, .back-to-top i { transition-duration: .01ms !important; }
}

.project-nav .adesso-live-link{display:inline-flex;align-items:center;gap:7px;white-space:nowrap}
.project-nav .adesso-live-link i{width:7px;height:7px;border-radius:50%;background:#e32626;display:block;animation:adesso-live-pulse 2.2s ease-in-out infinite}
@keyframes adesso-live-pulse{0%,100%{opacity:.45;transform:scale(.78)}50%{opacity:1;transform:scale(1)}}


/* RC4.11 — keep project-page mobile header aligned with the shared header. */
@media (max-width: 800px) {
  :root { --header-h: 52px; }
  .project-header { padding: 14px 15px !important; align-items: center !important; }
  .project-logo { font-size: 17.5px !important; }
  .project-nav { align-items: center !important; gap: 9px !important; }
  .project-nav a { font-size: 10.5px !important; line-height: 1 !important; }
  .project-header .theme-toggle { font-size: 18px !important; width:18px !important; height:18px !important; margin:-1px 0 0 !important; }
  .project-main { padding-top: calc(var(--header-h) + 38px); }
}


/* RC4.25: horizontal swipe on the large lightbox image (mobile). */
@media (pointer: coarse) {
  #viewer-image {
    touch-action: pan-y;
    -webkit-user-drag: none;
    user-select: none;
  }
}

/* RC4.34 — voce live accanto al nome anche nelle pagine opera. */
.project-header .brand-live-group{
  display:inline-flex;
  align-items:center;
  gap:16px;
  white-space:nowrap;
}
.project-header .brand-live-group .adesso-live-link{
  display:inline-flex;
  align-items:center;
  gap:6px;
  margin:0;
  padding:0;
  color:var(--theme-muted)!important;
  text-decoration:none!important;
  font-family:var(--theme-font-body,Inter,sans-serif)!important;
  font-size:11px!important;
  line-height:1!important;
  font-weight:500;
  letter-spacing:1.55px!important;
  text-transform:uppercase;
  white-space:nowrap;
}
.project-header .brand-live-group .adesso-live-link:hover{
  color:var(--theme-text)!important;
}
@media(max-width:800px){
  .project-header .brand-live-group{gap:9px;max-width:calc(100vw - 116px)}
  .project-header .brand-live-group .adesso-live-link{
    font-size:9.5px!important;
    letter-spacing:.85px!important;
    gap:5px;
  }
  .project-header .brand-live-group .adesso-live-link i{
    width:5px;
    height:5px;
    min-width:5px;
  }
}
@media(max-width:390px){
  .project-header .brand-live-group{gap:7px}
  .project-header .brand-live-group .adesso-live-link{
    font-size:8.7px!important;
    letter-spacing:.55px!important;
  }
}



/* RC4.36 — stessa baseline nelle pagine opera. */
.project-header .brand-live-group{
  align-items:baseline!important;
  gap:15px;
}
.project-header .brand-live-group .project-logo{
  transform:none!important;
}
.project-header .brand-live-group .adesso-live-link{
  align-self:baseline;
  transform:none;
}
.project-header .brand-live-group .adesso-live-link i{
  position:relative;
  top:-1px;
}
@media(max-width:800px){
  .project-header .brand-live-group{align-items:baseline!important;gap:9px}
  .project-header .brand-live-group .project-logo{transform:none!important}
  .project-header .brand-live-group .adesso-live-link i{top:-1px}
}

/* RC4.43 — ulteriore allineamento del menu destro nelle pagine opera. */
.project-header > .project-nav{transform:translateY(5px)!important;}
@media(max-width:800px){
  .project-header > .project-nav{transform:translateY(5px)!important;}
}



/* RC4.50 — fix isolato voce live nelle pagine opera. */
.project-header .brand-live-group .adesso-live-link{
  position:relative;
  top:-1px;
  display:inline-flex!important;
  align-items:center!important;
  align-self:baseline!important;
  gap:6px!important;
}
.project-header .brand-live-group .adesso-live-link .adesso-dot{
  position:relative!important;
  top:0!important;
  display:block!important;
  width:6px!important;
  height:6px!important;
  min-width:6px!important;
  margin:0!important;
  border-radius:50%!important;
  background:#e32727!important;
  box-shadow:0 0 0 0 rgba(227,39,39,.42);
  animation:adesso-breathe 1.8s ease-in-out infinite!important;
}
@media(max-width:800px){
  .project-header .brand-live-group .adesso-live-link{gap:5px!important}
  .project-header .brand-live-group .adesso-live-link .adesso-dot{
    width:5px!important;
    height:5px!important;
    min-width:5px!important;
  }
}


/* RC4.52 — firma nelle pagine opera. */
.project-logo{display:inline-flex!important;align-items:center!important;line-height:0!important}
.project-logo .site-signature{display:block;width:152px;height:auto;pointer-events:none}
html[data-theme="dark"] .project-logo .site-signature{filter:invert(1)}
@media(max-width:800px){.project-logo .site-signature{width:112px}}
@media(max-width:390px){.project-logo .site-signature{width:98px}}


/* =========================================================
   Navigazione continua tra opere — precedente / successiva
   ========================================================= */
.project-sequence-nav{
  width:min(1500px,94vw);
  margin:clamp(70px,10vw,150px) auto 22px;
  padding-top:28px;
  border-top:1px solid var(--theme-border,rgba(127,127,127,.18));
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:clamp(36px,8vw,140px);
  position:relative;
  z-index:31;
}
.project-sequence-side{min-width:0;}
.project-sequence-next{text-align:right;}
.project-sequence-side.is-empty{visibility:hidden;}
.project-sequence-link{
  display:inline-flex;
  flex-direction:column;
  gap:10px;
  max-width:min(540px,42vw);
  color:var(--theme-text);
  text-decoration:none;
  cursor:pointer;
}
.project-sequence-next .project-sequence-link{align-items:flex-end;}
.project-sequence-kicker{
  color:var(--theme-muted);
  font:500 9px/1 Inter,sans-serif;
  letter-spacing:.16em;
  text-transform:uppercase;
}
.project-sequence-link strong{
  font:italic 400 clamp(1.65rem,3vw,3.8rem)/1.02 var(--theme-font-display,'Playfair Display',serif);
  letter-spacing:-.025em;
  transition:transform .45s cubic-bezier(.16,1,.3,1),color .25s ease;
}
.project-sequence-prev .project-sequence-link:hover strong{transform:translateX(-8px);}
.project-sequence-next .project-sequence-link:hover strong{transform:translateX(8px);}
.project-sequence-preview{
  position:fixed;
  left:0;
  top:0;
  z-index:190;
  width:min(340px,30vw);
  pointer-events:none;
  opacity:0;
  transform:translate3d(var(--seq-x,0px),var(--seq-y,0px),0) scale(.965);
  transition:opacity .2s ease,transform .28s cubic-bezier(.16,1,.3,1);
}
.project-sequence-preview.visible{opacity:1;transform:translate3d(var(--seq-x,0px),var(--seq-y,0px),0) scale(1);}
.project-sequence-preview img{
  display:block;
  width:100%;
  max-height:42vh;
  object-fit:contain;
  background:var(--theme-bg);
  border:1px solid var(--theme-border,rgba(127,127,127,.18));
}
.project-sequence-preview span{
  display:block;
  margin-top:8px;
  max-width:100%;
  color:var(--theme-muted);
  font:400 10px/1.45 Inter,sans-serif;
  letter-spacing:.045em;
}
body.is-sequence-leaving .project-main,
body.is-sequence-leaving .project-header,
body.is-sequence-leaving .project-sequence-nav,
body.is-sequence-leaving .back-to-top-wrap,
body.is-sequence-leaving .project-footer{
  opacity:0;
  transform:translateY(-5px);
  transition:opacity .17s ease,transform .17s ease;
}
@media(max-width:800px),(pointer:coarse){
  .project-sequence-nav{
    width:calc(100% - 36px);
    margin:78px auto 10px;
    gap:20px;
    padding-top:22px;
  }
  .project-sequence-link{max-width:44vw;gap:7px;}
  .project-sequence-link strong{font-size:clamp(1.15rem,5.2vw,1.7rem);line-height:1.06;}
  .project-sequence-kicker{font-size:8px;letter-spacing:.12em;}
  .project-sequence-preview{display:none!important;}
  .project-sequence-prev .project-sequence-link:hover strong,
  .project-sequence-next .project-sequence-link:hover strong{transform:none;}
}


/* RIFINITURA — più spazio sotto la navigazione tra opere */
.project-sequence-nav{
  margin-bottom:140px!important;
}
@media(max-width:800px),(pointer:coarse){
  .project-sequence-nav{
    margin-bottom:110px!important;
  }
}


/* GALLERY VIEWER — alza i testi nella fascia nera destra
   per lasciare libera l'area occupata da marquee + menu tema/lingua */
@media (min-width: 801px) {
  .gallery-viewer .viewer-info {
    padding-bottom: 150px !important;
  }
}


/* GALLERY VIEWER — mobile: testi più in alto, fuori da marquee + tools */
@media (max-width: 800px) {
  .gallery-viewer .viewer-info{
    padding:13px 18px 112px !important;
    max-height:190px !important;
    box-sizing:border-box !important;
  }
}


/* GALLERY VIEWER — mobile: niente scrollbar interna e più respiro dalle thumbnails */
@media (max-width: 800px) {
  .gallery-viewer .viewer-info{
    padding:24px 18px 112px !important;
    max-height:none !important;
    overflow:visible !important;
  }

  .gallery-viewer .viewer-thumbs{
    margin-bottom:8px !important;
  }
}
