/* Fotonico — sito portfolio. Nero, testo bianco 12/16, titoli nel carattere a puntini "Fdot". */

@font-face {
  font-family: "Fdot";
  src: url("/assets/fonts/fdot-5x7.woff2") format("woff2");
  font-display: block;
}

:root {
  --bg: #000;
  --fg: #fff;
  --dim: rgba(255, 255, 255, 0.5);
  --pad: 16px;
  --sans: "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --dotf: "Fdot", ui-monospace, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); color: var(--fg); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  font-family: var(--sans);
  font-size: 12px;
  line-height: 16px;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
img, video { display: block; max-width: 100%; }
h1, p, ul, ol { margin: 0; padding: 0; }
ul, ol { list-style: none; }
::selection { background: #fff; color: #000; }
.dim { color: var(--dim); }

/* ---------- scritta a puntini che si accende sotto al mouse ---------- */
.dot {
  position: relative;
  display: inline-grid;
  font-family: var(--dotf);
  font-weight: 400;
  text-transform: uppercase;
  white-space: nowrap;
  --x: 50%;
  --y: 50%;
  --on: 0;
}
.dot > * { grid-area: 1 / 1; }
.dot__b { color: rgba(255, 255, 255, 0.5); }
.dot__s, .dot__p {
  color: transparent;
  -webkit-background-clip: text;
  background-clip: text;
  pointer-events: none;
  user-select: none;
}
.dot__s {
  background-image: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0) 30%, rgba(255,255,255,0.18) 42%, rgba(255,255,255,0.92) 50%, rgba(255,255,255,0.3) 58%, rgba(255,255,255,0) 72%, rgba(255,255,255,0) 100%);
  background-size: 250% 100%;
  background-repeat: no-repeat;
  background-position: 115% 0;
  opacity: 0.9;
  animation: sweep 8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}
@keyframes sweep {
  0% { background-position: 115% 0; }
  32%, 100% { background-position: -15% 0; }
}
.dot__p {
  background-image: radial-gradient(3.6em at var(--x) var(--y), #fff 0%, rgba(255,255,255,0.92) 18%, rgba(255,255,255,0.28) 45%, rgba(255,255,255,0) 100%);
  opacity: var(--on);
  transition: opacity 0.35s ease;
}
.dot__g { mix-blend-mode: screen; filter: blur(0.08em) brightness(1.5) drop-shadow(0 0 0.22em rgba(255, 255, 255, 0.75)); }
.dot--solid .dot__b { color: #fff; }

/* ---------- caricamento ---------- */
.loader {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  background: var(--bg);
  transition: opacity 0.7s ease 0.1s, visibility 0s linear 0.8s;
}
.loader .dot { font-size: 60px; line-height: 1.1; }
.loader .dot__s { animation-duration: 2.4s; }
.loader.is-done { opacity: 0; visibility: hidden; pointer-events: none; }

/* ---------- barra in alto ---------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 8px var(--pad);
  transition: opacity 0.4s ease;
}
.nav__l, .nav__r { width: 50%; }
.nav__r { display: flex; justify-content: space-between; }
.brand b { font-weight: 700; }
.brand span { opacity: 0.6; }
.nav a[data-nav] { position: relative; transition: opacity 0.2s; }
.nav a[data-nav]::before {
  content: ""; position: absolute; left: -11px; top: 5px;
  border-left: 6px solid #fff; border-top: 3px solid transparent; border-bottom: 3px solid transparent;
  opacity: 0; transform: translateX(-4px); transition: opacity 0.25s, transform 0.25s;
}
.nav a[data-nav].is-on::before { opacity: 1; transform: none; }
.nav__r:hover a[data-nav]:not(:hover) { opacity: 0.5; }
body.is-project .nav { opacity: 0; pointer-events: none; }

#view { transition: opacity 0.22s ease; }
#view.is-out { opacity: 0; }

/* ---------- cursore: mirino e etichetta ---------- */
.cur { position: fixed; left: 0; top: 0; z-index: 200; pointer-events: none; mix-blend-mode: difference; display: none; will-change: transform; }
@media (hover: hover) and (pointer: fine) { .cur { display: block; } }
.cur i {
  position: absolute; left: -6px; top: -6px; width: 12px; height: 12px; opacity: 0;
  transition: opacity 0.2s;
  background:
    linear-gradient(#fff, #fff) 0 0 / 4px 1px, linear-gradient(#fff, #fff) 0 0 / 1px 4px,
    linear-gradient(#fff, #fff) 100% 0 / 4px 1px, linear-gradient(#fff, #fff) 100% 0 / 1px 4px,
    linear-gradient(#fff, #fff) 0 100% / 4px 1px, linear-gradient(#fff, #fff) 0 100% / 1px 4px,
    linear-gradient(#fff, #fff) 100% 100% / 4px 1px, linear-gradient(#fff, #fff) 100% 100% / 1px 4px;
  background-repeat: no-repeat;
}
.cur span {
  position: absolute; left: -30px; top: -42px; height: 24px; padding: 0 7px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  font-family: var(--dotf); font-size: 20px; line-height: 23px; white-space: nowrap; text-transform: lowercase;
  opacity: 0; transition: opacity 0.2s;
}
.cur.is-on i { opacity: 0.9; }
.cur.has-label span { opacity: 1; }

/* ---------- home: striscia di fotogrammi ---------- */
.home { position: relative; height: 100vh; height: 100svh; overflow: hidden; touch-action: none; overscroll-behavior: none; }
.strip { position: absolute; inset: 0; perspective: 1500px; perspective-origin: 50% 50%; }
.fr {
  position: absolute; left: 0; top: 0;
  display: block; background: #0a0a0a;
  transform-origin: 50% 50%;
  will-change: transform, opacity;
  backface-visibility: hidden;
  cursor: pointer;
}
.fr img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 0.6s ease; pointer-events: none; }
.fr img.is-in { opacity: 1; }
.fr video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 0.3s ease; pointer-events: none; background: #000; }
.fr video.is-in { opacity: 1; }

.home__bar { position: absolute; left: 0; right: 0; bottom: 0; z-index: 5; display: flex; align-items: flex-end; justify-content: space-between; padding: var(--pad); pointer-events: none; }
.meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; transition: opacity 0.25s; }
.meta.is-out { opacity: 0; }
.meta p { display: flex; gap: 4px; white-space: nowrap; }
.meta span:first-child { color: var(--dim); }

.ticks { position: relative; flex: none; display: flex; align-items: flex-end; height: 32px; pointer-events: auto; }
.tick { position: relative; width: 11px; height: 32px; }
.tick::after { content: ""; position: absolute; left: 5px; bottom: 0; width: 1px; height: 22px; background: rgba(255, 255, 255, 0.5); transition: height 0.3s ease, background 0.3s; }
.tick.is-on::after { height: 32px; background: #fff; }
.tick:hover::after { background: #fff; }
.tickpop { position: absolute; right: 0; bottom: 40px; width: 132px; opacity: 0; transform: translateY(6px); transition: opacity 0.2s, transform 0.2s; pointer-events: none; }
.tickpop.is-on { opacity: 1; transform: none; }
.tickpop b { display: block; font-weight: 400; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tickpop div { border: 1px solid rgba(255, 255, 255, 0.5); padding: 6px; display: flex; flex-direction: column; gap: 6px; align-items: center; max-height: 46vh; overflow: hidden; }
.tickpop img { width: 100%; height: auto; max-height: 120px; object-fit: contain; }
@media (hover: none) { .tickpop { display: none; } }

/* ---------- lettore (pagina progetto e reel) ---------- */
.hero { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; background: #000; }
.hero video, .hero > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.hero__shade { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.2); pointer-events: none; transition: opacity 0.5s; }
.hero.is-idle .hero__shade { opacity: 0; }
.hero__hit { position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; cursor: pointer; }
.hero__ui { position: absolute; inset: 0; z-index: 3; pointer-events: none; transition: opacity 0.5s ease; }
.hero.is-idle .hero__ui, .hero.is-away .hero__ui { opacity: 0; }
.hero.is-away .hero__ui * { pointer-events: none; }
.hero__back { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; pointer-events: auto; }
.hero__back::before, .hero__back::after { content: ""; border-bottom: 6px solid #fff; border-left: 3px solid transparent; border-right: 3px solid transparent; }
.hero__mid { position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-45px); display: flex; flex-direction: column; align-items: center; }
.hero__mid h1 { font-size: 40px; line-height: 48px; font-weight: 400; max-width: calc(100vw - 180px); text-align: center; }
.hero__mid h1 .dot { white-space: normal; }
.hero__line { position: relative; width: 100%; height: 1px; border-top: 1px dotted #fff; }
.hero__line a { position: absolute; bottom: 0; height: 32px; display: flex; align-items: center; gap: 8px; padding: 0 var(--pad); pointer-events: auto; }
.hero__line a:first-child { left: 0; }
.hero__line a:last-child { right: 0; }
.tri { display: inline-block; border-top: 3px solid transparent; border-bottom: 3px solid transparent; }
.tri--l { border-right: 6px solid #fff; }
.tri--r { border-left: 6px solid #fff; }
.hero__ctl { margin-top: 8px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 28px; width: 320px; pointer-events: auto; }
.hero__ctl > :first-child { justify-self: end; }
.hero__ctl > :last-child { justify-self: start; }
.snd.is-off { text-decoration: line-through; }
.tc { font-family: var(--dotf); font-size: 20px; line-height: 28px; min-width: 96px; text-align: center; }
.hero__ctl--one { display: flex; justify-content: center; }
.hero__clips { margin-top: 12px; display: flex; gap: 14px; pointer-events: auto; }
.clipb { position: relative; padding: 2px 0; opacity: 0.5; transition: opacity 0.2s; }
.clipb.is-on, .clipb:hover { opacity: 1; }
.clipb.is-on::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; border-bottom: 1px dotted #fff; }
.hero iframe { position: absolute; left: 0; top: 40px; z-index: 2; width: 100%; height: calc(100% - 40px); border: 0; background: #000; }
.hero.is-yt .hero__mid, .hero.is-yt .hero__shade, .hero.is-yt .hero__hit, .hero.is-yt > img { display: none; }
/* a tutto schermo: solo il video */
.hero.is-fs .hero__ui, .hero.is-fs .hero__shade { display: none; }
.hero.is-fs video, .reel .hero.is-fs video { inset: 0; width: 100%; height: 100%; }
.hero.is-fs.is-idle .hero__hit { cursor: none; }
.fsb { position: relative; padding: 0 4px; }
.fsb::before, .fsb::after { content: ""; position: absolute; inset: -3px -4px; pointer-events: none;
  background:
    linear-gradient(#fff, #fff) 0 0 / 5px 1px, linear-gradient(#fff, #fff) 0 0 / 1px 5px,
    linear-gradient(#fff, #fff) 100% 0 / 5px 1px, linear-gradient(#fff, #fff) 100% 0 / 1px 5px;
  background-repeat: no-repeat; }
.fsb::after { transform: scaleY(-1); }

.film { position: absolute; left: var(--pad); right: var(--pad); bottom: var(--pad); height: 44px; border: 1px dotted rgba(255, 255, 255, 0.7); display: grid; grid-template-columns: repeat(12, 1fr); pointer-events: auto; cursor: pointer; touch-action: none; overflow: hidden; }
.film i { display: block; background-repeat: no-repeat; background-size: 1200% auto; background-position-y: 50%; opacity: 0.85; }
.film__head { position: absolute; top: 0; bottom: 0; left: 0; width: 1px; background: #fff; mix-blend-mode: difference; pointer-events: none; will-change: transform; }

/* reel: il lettore dentro la pagina, barra visibile */
.reel .hero { position: relative; }
.reel .hero video { inset: 32px 0 76px; height: calc(100% - 108px); }
.reel .hero__back { display: none; }

/* ---------- pagina progetto: scheda e fotogrammi ---------- */
.pj__body {
  position: relative; z-index: 4; min-height: 100vh; padding: var(--pad);
  background: rgba(0, 0, 0, 0.62);
  -webkit-backdrop-filter: blur(48px); backdrop-filter: blur(48px);
}
.pj__grid { display: grid; grid-template-columns: 400px minmax(0, 1fr); gap: 32px; align-items: start; }
.pj__info { position: sticky; top: 32px; max-width: 400px; }
.pj__info h1 { font-size: 40px; line-height: 44px; margin-bottom: 16px; font-weight: 400; }
.pj__info h1 .dot { white-space: normal; }
.pj__facts { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.pj__facts span { display: block; }
.pj__facts span:first-child { color: var(--dim); }
.pj__desc { text-align: justify; margin-bottom: 16px; }
.pj__info.is-long { position: static; }
.pj__credits { display: grid; grid-template-columns: 136px minmax(0, 1fr); gap: 2px 16px; margin-bottom: 16px; }
.pj__credits dt { color: var(--dim); }
.pj__credits a, .pj__facts a { border-bottom: 1px dotted rgba(255, 255, 255, 0.5); transition: border-color 0.2s; }
.pj__credits a:hover, .pj__facts a:hover { border-color: #fff; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { background: #fff; color: #000; border-radius: 2px; padding: 0 4px; text-transform: lowercase; }
.pj__stills { display: flex; flex-direction: column; gap: 16px; padding-top: 236px; }
.pj__stills img { width: 100%; height: auto; background: #0a0a0a; }
.pj__stills.is-vert { display: grid; grid-template-columns: 1fr 1fr; }
.pj__foot { position: relative; z-index: 4; display: flex; align-items: flex-end; justify-content: space-between; padding: 112px var(--pad) var(--pad); background: rgba(0, 0, 0, 0.62); -webkit-backdrop-filter: blur(48px); backdrop-filter: blur(48px); }
.pj__nb { display: flex; flex-direction: column; gap: 8px; width: 137px; }
.pj__nb span:first-child { display: flex; align-items: center; gap: 8px; white-space: nowrap; align-self: stretch; }
.pj__nb span:first-child::after { content: ""; flex: 1; border-top: 1px solid #fff; }
.pj__nb img { width: 137px; height: 69px; object-fit: contain; border: 1px solid rgba(255, 255, 255, 0.5); padding: 6px; transition: border-color 0.2s; }
.pj__nb:hover img { border-color: #fff; }
.pj__nb span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.pj__nb--prev span:first-child { flex-direction: row-reverse; }
.pj__nb--next { align-items: flex-end; text-align: right; }

/* ---------- info ---------- */
.info { padding: 44px var(--pad) var(--pad); }
.info__grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: 528px auto; gap: 16px; }
.info__title h1, .idx h1 { font-size: 40px; line-height: 40px; font-weight: 400; }
.info__right { grid-column: 2; grid-row: 1 / span 2; display: flex; gap: 16px; align-items: flex-start; }
.info__img { flex: 0 0 35.4%; position: sticky; top: 44px; }
.info__img img { width: 100%; height: auto; background: #0a0a0a; }
.info__img figcaption { margin-top: 8px; color: var(--dim); }
.info__txt { flex: 1; min-height: 528px; display: flex; flex-direction: column; justify-content: space-between; gap: 40px; }
.bio { display: flex; flex-direction: column; gap: 24px; text-align: justify; }
.contacts { display: flex; justify-content: space-between; gap: 16px; }
.contacts a, .contacts button { position: relative; }
.contacts a::after, .contacts button::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; border-bottom: 1px dotted #fff; opacity: 0; transition: opacity 0.2s; }
.contacts a:hover::after, .contacts button:hover::after { opacity: 1; }
.boxes { grid-column: 1; grid-row: 2; margin-top: 32px; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; align-self: start; }
.box { border: 1px dotted #fff; padding: 8px 8px 16px; min-height: 204px; }
.box > span { display: block; margin-bottom: 2px; color: var(--dim); }
.box--label > span { color: #fff; }
.box li { display: flex; }
.box li::before { content: ""; flex: 0 0 auto; align-self: flex-start; margin: 5px 6px 0 1px; border-left: 6px solid rgba(255, 255, 255, 0.5); border-top: 3px solid transparent; border-bottom: 3px solid transparent; }

/* ---------- index ---------- */
.idx { padding: 44px var(--pad) 64px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.idx__l { min-width: 0; }
.idx__filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 28px 0 20px; }
.pill { border: 1px dotted #fff; border-radius: 2px; padding: 0 4px; text-transform: lowercase; transition: background 0.2s, color 0.2s; }
.pill.is-on, .pill:hover { background: #fff; color: #000; border-style: solid; }
.idx__list { border-top: 1px dotted rgba(255, 255, 255, 0.6); }
.idx__list a { display: grid; grid-template-columns: 32px minmax(0, 1.25fr) minmax(0, 1fr) 96px 36px; gap: 12px; padding: 8px 0; border-bottom: 1px dotted rgba(255, 255, 255, 0.6); transition: opacity 0.2s; }
.idx__list a span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.idx__list a span:nth-child(1), .idx__list a span:nth-child(4) { color: var(--dim); }
.idx__list a span:nth-child(5) { text-align: right; }
.idx__list:hover a:not(:hover) { opacity: 0.45; }
.idx__list li.is-hid { display: none; }
.idx__r { position: sticky; top: 44px; height: calc(100vh - 60px); display: flex; flex-direction: column; }
.idx__prev { position: relative; flex: 1; min-height: 0; }
.idx__prev img { position: absolute; left: 0; top: 0; max-width: 100%; max-height: 100%; width: auto; height: auto; opacity: 0; transition: opacity 0.35s ease; }
.idx__prev img.is-on { opacity: 1; }

/* ---------- comparsa dei blocchi ---------- */
.rise { opacity: 0; transform: translateY(8px); animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) forwards; animation-delay: calc(var(--i, 0) * 45ms + 80ms); }
@keyframes rise { to { opacity: 1; transform: none; } }

/* ---------- telefono ---------- */
@media (max-width: 760px) {
  .nav__l { width: auto; }
  .nav__r { width: auto; flex: 1; margin-left: 40px; max-width: 240px; }
  .loader .dot { font-size: 40px; }
  /* home: dati del lavoro a tutta larghezza (i testi lunghi vanno a capo), tacche sotto */
  .home__bar { flex-direction: column; align-items: stretch; gap: 10px; }
  .meta p { white-space: normal; }
  .meta span:first-child { flex: none; }
  .ticks { align-self: flex-end; }
  .hero__mid h1 { font-size: 30px; line-height: 38px; max-width: calc(100vw - 32px); }
  .hero__line a { height: 28px; bottom: auto; top: 44px; }
  .hero__ctl { width: 280px; gap: 16px; }
  .pj__grid { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .pj__info { position: static; }
  .pj__stills { padding-top: 0; gap: 8px; }
  .pj__foot { padding-top: 64px; }
  .info { padding-top: 40px; }
  .info__grid { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto; }
  .info__right { grid-column: 1; grid-row: auto; flex-direction: column; }
  .info__img { position: static; flex: none; width: 62%; }
  .info__txt { min-height: 0; }
  .boxes { grid-row: auto; margin-top: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .box { min-height: 0; }
  .box--label { grid-column: 1 / -1; padding-bottom: 8px; }
  .idx { grid-template-columns: minmax(0, 1fr); }
  .idx__r { display: none; }
  .idx__list a { grid-template-columns: 24px minmax(0, 1.2fr) minmax(0, 1fr) 32px; }
  .idx__list a span:nth-child(4) { display: none; }
  .reel .hero video { inset: 40px 0 76px; }
}

@media (prefers-reduced-motion: reduce) {
  .dot__s { animation: none; opacity: 0; }
  .rise { animation: none; opacity: 1; transform: none; }
}
