@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;700&display=swap');

@font-face {
  font-family: 'customfont';
  src: url('./customfont.woff') format('woff');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'custommono';
  src: url('./custommono.woff') format('woff');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

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

:root {
  --black: #000;
  --white: #fff;
  --grey: #ebebeb;
  --font: 'customfont', 'DM Sans', 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'custommono', 'Courier New', monospace;
  --fs: 20px;
  --nav-h: 44px;
}

html {
  scroll-behavior: smooth;
}

/* LENIS SCROLL */
html.lenis, html.lenis body {
  height: auto;
}

.lenis.lenis-smooth {
  scroll-behavior: auto !important;
}

.lenis.lenis-smooth [data-lenis-prevent] {
  overscroll-behavior: contain;
}

.lenis.lenis-stopped {
  overflow: hidden;
}

.lenis.lenis-smooth iframe {
  pointer-events: none;
}

body {
  background: var(--black);
  color: var(--white);
  font-family: var(--font);
  font-size: var(--fs);
  font-weight: 700;
  line-height: normal;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ══════════════════════════════════════════
 FIXED UI
══════════════════════════════════════════ */
#fixed-ui {
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
  mix-blend-mode: difference;
}

#fixed-ui nav {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-h);
  display: flex;
  align-items: flex-end;
  padding: 10px;
  pointer-events: auto;
}

.nav-inner {
  width: 100%;
  display: flex;
  align-items: flex-end;
}

.n-brand {
  padding-right: 20px;
  cursor: pointer;
}

.n-mid {
  padding-right: 20px;
  cursor: pointer;
  position: static;
  transform: none;
  left: auto;
}

.n-right {
  padding-right: 20px;
  cursor: pointer;
  margin-left: 0;
}

.n-brand:hover,
.n-mid:hover,
.n-right:hover {
  opacity: .5;
}

#back-btn {
  position: absolute;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: auto;
  background: none;
  border: none;
  font-family: var(--font);
  font-size: var(--fs);
  font-weight: 700;
  color: var(--white);
  cursor: pointer;
  white-space: nowrap;
}

#back-btn:hover {
  opacity: .5;
}

#back-btn.hidden {
  display: none;
}

/* ══════════════════════════════════════════
 PAGES
══════════════════════════════════════════ */
.page {
  display: none;
}

.page.active {
  display: block;
}

.proj {
  display: none;
}

.proj.active {
  display: block;
}

.page.active,
.proj.active {
  animation: fi .3s ease;
}

@keyframes fi {
  from {
    opacity: 0
  }

  to {
    opacity: 1
  }
}

/* ══════════════════════════════════════════
 SHARED SCROLL PRIMITIVES
══════════════════════════════════════════ */

.sticky-slot {
  position: sticky;
  top: 0;
  width: 100%;
  height: 100vh;
  overflow: hidden;
  z-index: 1;
}

.sticky-slot video,
.sticky-slot img.fill {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ══════════════════════════════════════════
 SHARED TEXT LAYOUT (3+2+2 grid)
══════════════════════════════════════════ */
.text-layout {
  display: grid;
  grid-template-columns: 3fr 2fr 2fr;
  padding: 10px;
  align-items: start;
  align-content: start;
}

.tl-col {
  padding: 10px;
  display: flex;
  flex-direction: column;
}

.tl-mono {
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 11px;
  text-transform: uppercase;
  color: var(--white);
  font-weight: 400;
  display: block;
  margin-bottom: 20px;
  padding: 0;
}

.tl-body {
  font-size: var(--fs);
  font-weight: 700;
  line-height: 22px;
  color: var(--white);
  padding: 10px;
}

.tl-body a {
  color: var(--white);
  text-decoration: underline;
}

.tl-link {
  display: block;
  font-size: var(--fs);
  font-weight: 700;
  line-height: 22px;
  color: var(--white);
  text-decoration: none;
  padding: 0 10px;
}

.tl-link:hover {
  opacity: 0.5;
}

/* sticky-text (project pages) */
.sticky-text {
  position: sticky;
  top: 0;
  width: 100%;
  height: 100vh;
  z-index: 1;
  display: grid;
  grid-template-columns: 3fr 2fr 2fr;
  align-items: start;
  align-content: start;
  padding: calc(var(--nav-h) + 10px) 0 0;
  background: transparent;
  mix-blend-mode: difference;
  pointer-events: none;
}

/* Pull text over the video in projects */
.sticky-slot + .sticky-text {
  margin-top: -100vh;
}

/* Push subsequent content down to compensate for the overlay */
.sticky-text + .over {
  margin-top: 100vh;
}

.st-label {
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 11px;
  text-transform: uppercase;
  color: var(--white);
  font-weight: 400;
  display: block;
  margin-bottom: 20px;
  padding: 0;
}

.st-about { padding: 10px; }
.st-tags  { padding: 10px; }
.st-links { padding: 10px; pointer-events: auto; grid-column: 3; }

.sticky-text p,
.sticky-text .st-about p,
.sticky-text .st-tags p {
  font-size: var(--fs);
  font-weight: 700;
  line-height: 22px;
  color: var(--white);
}

.st-links a {
  color: var(--white);
  text-decoration: none;
  font-size: var(--fs);
  line-height: 22px;
  font-weight: 700;
  display: block;
}

.st-links a:hover { opacity: 0.5; }

.over {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.row {
  position: relative;
  width: 100%;
  aspect-ratio: 1920/1200;
  overflow: hidden;
  cursor: pointer;
}

.row video,
.row img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.pad-img {
  object-fit: contain !important;
  padding: 10%;
}

/* Overlay Website Link */
.video-link-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  mix-blend-mode: difference;
  color: var(--white);
  z-index: 10;
}

.row-vh {
  position: relative;
  width: 100%;
  height: 100vh;
  overflow: hidden;
  display: flex;
  gap: 10px;
  cursor: pointer;
}

.row-vh .col {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.row-vh .col video,
.row-vh .col img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.row-vertical {
  position: relative;
  width: 100%;
  height: 100vh;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
}

.row-vertical video,
.row-vertical img {
  height: 100%;
  aspect-ratio: 9/16;
  object-fit: cover;
  display: block;
}

.row-yt {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  background: #000;
}

.row-yt-vertical {
  position: relative;
  width: 100%;
  aspect-ratio: 9/16;
  background: #000;
  max-width: 500px; /* Limit width for vertical video on desktop */
  margin: 0 auto;
}

.row-yt iframe,
.row-yt-vertical iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

.scroll-block {
  position: relative;
}

/* ══════════════════════════════════════════
 HOMEPAGE specifics
══════════════════════════════════════════ */
#page-home {
  background: transparent;
}

#home-first-scroll-block {
  margin-top: -100vh;
  position: relative;
  z-index: 2;
  pointer-events: none;
}

#home-sticky-slot {
  background: transparent;
  pointer-events: none;
}

#home-first-over {
  margin-top: 100vh;
  pointer-events: auto;
}

#hero-vid-wrap {
  position: absolute;
  bottom: 0px;
  left: 40px;
  width: calc(100% - 80px);
  height: 30vh;
  overflow: hidden;
  will-change: width, height, bottom, left, border-radius;
}

#hero-vid-wrap video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

#page-home .over {
  background: transparent;
}

#page-home .over-grey {
  background: transparent;
}

#page-home .over-grey .row {
  background: transparent;
}

/* ══════════════════════════════════════════
 WORKS
══════════════════════════════════════════ */
#page-works {
  background: var(--black);
  min-height: 100vh;
  position: relative;
}

#works-hover-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

#works-hover-bg video,
#works-hover-bg img {
  position: absolute;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.4s ease;
}

#works-hover-bg .active {
  opacity: 1;
}

.works-inner {
  min-height: 100vh;
  position: relative;
  z-index: 1;
  mix-blend-mode: difference;
  padding-top: var(--nav-h);
}

/* tag filter bar */
.works-filter {
  display: flex;
  align-items: flex-end;
  padding: 10px;
  flex-wrap: wrap;
}

.filter-btn {
  padding-right: 20px;
  cursor: pointer;
  background: none;
  border: none;
  color: var(--white);
  font-family: var(--font);
  font-size: var(--fs);
  font-weight: 700;
  line-height: 22px;
  opacity: 0.4;
  transition: opacity .2s;
  padding-left: 0;
}

.filter-btn.active {
  opacity: 1;
  text-decoration: underline;
}

.filter-btn:hover { opacity: 1; }

.works-list {
  width: 100%;
  display: flex;
  flex-direction: column;
}

/* header row */
.works-header {
  display: grid;
  grid-template-columns: 3fr 2fr 2fr;
  padding: 0 0 0 0;
}

.works-header .wh-cell {
  padding: 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 11px;
  text-transform: uppercase;
  font-weight: 400;
}

.works-header + .work-item {
  border-top: none;
}

.work-item {
  display: grid;
  grid-template-columns: 3fr 2fr 2fr;
  width: 100%;
  cursor: pointer;
  transition: opacity .2s;
  border-top: 1px solid rgba(255,255,255,0.15);
}

.work-item:hover { opacity: .4; }
.work-item.hidden { display: none; }



.w-cell {
  padding: 10px;
  font-size: var(--fs);
  line-height: 22px;
  font-weight: 700;
  color: var(--white);
}

/* ══════════════════════════════════════════
 ABOUT
══════════════════════════════════════════ */
#page-about {
  background: var(--black);
  min-height: 100vh;
}

.about-inner {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 3fr 2fr 2fr;
  align-items: start;
  align-content: start;
  padding: calc(var(--nav-h) + 10px) 0 80px;
}

.about-bio {
  padding: 10px;
}

.about-bio p {
  font-size: var(--fs);
  line-height: 22px;
  font-weight: 700;
  color: var(--white);
}

.about-highlights {
  padding: 10px;
}

.about-highlights p {
  font-size: var(--fs);
  line-height: 22px;
  font-weight: 700;
  color: var(--white);
}

.about-highlights a {
  color: var(--white);
  text-decoration: underline;
}

.about-contacts {
  padding: 10px;
  display: flex;
  flex-direction: column;
}

.about-contacts a {
  color: var(--white);
  text-decoration: none;
  font-size: var(--fs);
  line-height: 22px;
  font-weight: 700;
  display: block;
}

.about-contacts a:hover { opacity: .4; }

.about-label {
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 11px;
  text-transform: uppercase;
  color: var(--white);
  font-weight: 400;
  display: block;
  margin-bottom: 20px;
  padding: 0;
}

/* ══════════════════════════════════════════
 PROJECT PAGES
══════════════════════════════════════════ */
.proj {
  background: transparent;
  color: var(--black);
}

.proj .over {
  background: transparent;
}

.proj .sticky-slot {
  background: var(--black);
}

.proj .row {
  background: transparent;
}

.proj .row-vh {
  background: transparent;
}

.proj .sticky-text p {
  color: var(--white);
}

.proj-spacer {
  height: none;
  background: var(--grey);
}

/* ══════════════════════════════════════════
 MENU MOBILE — nascosto su desktop
══════════════════════════════════════════ */
.n-menu {
  display: none;
}

#mobile-menu {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 300;
  background: var(--black);
  flex-direction: column;
  padding: 10px; /* same as nav mobile padding */
}

#mobile-menu.open {
  display: flex;
}

.menu-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-end; /* match nav align-items */
  margin-bottom: 48px;
  font-size: 15px; /* match nav font-size */
  font-weight: 700;
  color: var(--white);
  cursor: pointer;
}

.menu-close {
  cursor: pointer;
}

.menu-close:hover {
  opacity: .5;
}

.menu-links {
  display: flex;
  flex-direction: column;
  gap: 0;
  flex: 1;
}

.menu-links a {
  font-size: 80px;
  font-weight: 700;
  line-height: 1;
  color: var(--white);
  cursor: pointer;
}

.menu-links a:hover {
  opacity: .5;
}

.mobile-only {
  display: none !important;
}

/* ══════════════════════════════════════════
 MOBILE ≤ 768px
══════════════════════════════════════════ */
@media (max-width: 768px) {
  .mobile-only {
    display: block !important;
  }

  .desktop-only {
    display: none !important;
  }

  :root {
    --fs: 17px;
    --nav-h: 52px;
  }

  /* nav */
  #fixed-ui nav {
    padding: 10px;
    height: auto;
  }

  .nav-inner {
    display: flex;
    align-items: flex-end;
    font-size: 15px;
    line-height: 15px;
  }

  /* nav: nascondo works e about, mostro menu */
  .n-mid {
    display: none;
  }

  .n-right {
    display: none;
  }

  .n-menu {
    display: block;
    margin-left: auto;
    cursor: pointer;
  }

  .n-menu:hover {
    opacity: .5;
  }

  /* menu mobile links */
  .menu-links span {
    font-size: 90px;
    line-height: 90px;
  }

  /* back-btn */
  #back-btn {
    font-size: 15px;
    bottom: 17px;
    left: 0;
    right: 0;
    width: 100%;
    text-align: center;
    transform: none;
  }

  /* sticky-text mobile: single column */
  .sticky-text {
    display: flex;
    flex-direction: column;
    padding: calc(var(--nav-h) + 10px) 0 0;
    height: auto;
  }

  .st-about, .st-tags, .st-links {
    padding: 10px;
  }

  .proj .st-links {
    display: none;
  }

  .sticky-text p,
  .sticky-text .st-about p,
  .sticky-text .st-tags p,
  .st-links a {
    font-size: 18px;
    line-height: 21px;
    padding: 0;
  }

  .st-label {
    font-size: 10px;
    line-height: 11px;
    padding: 0;
    margin-bottom: 20px;
  }

  /* video overlay */
  .video-link-overlay {
    left: 0;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    text-align: center;
    width: 100%;
  }

  /* row: mantieni proporzione originale ma scala a schermo intero */
  .row {
    aspect-ratio: 16/10;
  }

  /* row-vh: stack verticale su mobile */
  .row-vh {
    flex-direction: column;
    height: auto;
  }

  .row-vh .col {
    flex: none;
    width: 100%;
    aspect-ratio: 9/16;
  }

  /* row-vertical: stack verticale su mobile */
  .row-vertical {
    height: auto;
  }

  .row-vertical video,
  .row-vertical img {
    width: 100%;
    height: auto;
    aspect-ratio: 9/16;
  }

  .mobile-hide {
    display: none !important;
  }

  .pad-img {
    padding: 0 !important;
  }

  #hero-vid-wrap {
    left: 20px;
    bottom: 0px;
    width: calc(100% - 40px);
    height: 20vh;
  }

  /* All .over items display as individual 100vh vertical boxes with full margins */
  .page .over,
  .proj .over {
    height: auto;
    gap: 0;
    padding: 0;
  }

  .page .over>.row,
  .page .over>.row-vertical,
  .page .over>.row-yt,
  .proj .over>.row,
  .proj .over>.row-vertical,
  .proj .over>.row-yt,
  .page .row-vh>.col,
  .proj .row-vh>.col {
    height: 100vh !important;
    padding: 20px;
    flex: none;
    aspect-ratio: auto !important;
  }

  .page .over>.row-vh,
  .proj .over>.row-vh {
    height: auto !important;
    padding: 0 !important;
    gap: 0;
  }

  #page-home .over-grey>* {
    height: calc(200vh / 3) !important;
  }

  .page .over>.row>video,
  .page .over>.row>img,
  .page .over>.row-vertical>video,
  .page .over>.row-vertical>img,
  .page .row-vh>.col>video,
  .page .row-vh>.col>img,
  .proj .over>.row>video,
  .proj .over>.row>img,
  .proj .over>.row-vertical>video,
  .proj .over>.row-vertical>img,
  .proj .row-vh>.col>video,
  .proj .row-vh>.col>img {
    width: 100% !important;
    height: 100% !important;
    aspect-ratio: auto !important;
    object-fit: contain !important;
  }

  .page .over>.row-yt>iframe,
  .proj .over>.row-yt>iframe {
    width: 100% !important;
    height: 100% !important;
    aspect-ratio: auto !important;
  }

  .page .over>*>.cover-mobile,
  .proj .over>*>.cover-mobile {
    object-fit: cover !important;
  }

  /* ── WORKS mobile ── */
  .works-inner {
    padding-top: var(--nav-h);
  }

  .works-filter {
    display: none;
  }

  .works-header { display: none; }

  .work-item {
    display: grid;
    grid-template-columns: 3fr 2fr;
    border-top: 1px solid rgba(255,255,255,0.15);
  }

  .w-type { display: none; }

  .w-cell {
    font-size: 15px;
    line-height: 18px;
    padding: 10px;
  }

  /* ── ABOUT mobile ── */
  .about-inner {
    display: flex;
    flex-direction: column;
    padding: calc(var(--nav-h) + 10px) 0 80px;
  }

  .about-bio, .about-highlights, .about-contacts {
    padding: 10px;
  }

  .about-bio p, .about-highlights p {
    font-size: 18px;
    line-height: 21px;
    padding: 0;
  }

  .about-contacts a {
    font-size: 18px;
    line-height: 21px;
    padding: 0;
  }

  .about-label {
    font-size: 10px;
    line-height: 11px;
    padding: 0;
    margin-bottom: 20px;
  }

  /* ── proj-text mobile ── */
  .proj-text {
    padding: 60px 20px;
  }
}

.proj .sticky-text + .over {
  margin-top: -25vh;
  padding-top: 0;
  position: relative;
  z-index: 10;
  background: transparent;
}

.proj .over > *:first-child {
  margin-left: 40px;
  margin-right: 40px;
  margin-top: 0 !important;
  padding-top: 0 !important;
  width: auto !important;
  border-radius: 4px;
  transform: translateY(0);
  transition: none;
}

@media (max-width: 768px) {
  .proj .sticky-text + .over {
    margin-top: -20vh;
  }
  .proj .over > *:first-child {
    margin-left: 20px;
    margin-right: 20px;
  }
}

/* ── FOOTER ── */
.site-footer {
  position: relative;
  z-index: 2;
  background: var(--black);
  padding-bottom: 0;
}

.footer-projects {
  padding: 10px;
}

.footer-mono {
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 11px;
  text-transform: uppercase;
  font-weight: 400;
  display: block;
  padding: 10px 10px 0;
  margin-bottom: 20px;
  color: var(--white);
}

.footer-headline {
  font-size: 36px;
  line-height: 36px;
  font-weight: 700;
  padding: 10px;
  color: var(--white);
}

.footer-headline a {
  color: var(--white);
  text-decoration: underline;
  cursor: pointer;
}

.footer-3col {
  display: grid;
  grid-template-columns: 3fr 2fr 2fr;
  padding: 10px;
  margin-top: 10px;
  margin-bottom: 360px;
}

.f-col {
  padding: 10px;
  display: flex;
  flex-direction: column;
}

.f-mono {
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 11px;
  text-transform: uppercase;
  font-weight: 400;
  display: block;
  margin-bottom: 20px;
  color: var(--white);
}

.f-body {
  font-size: var(--fs);
  line-height: 22px;
  font-weight: 700;
  color: var(--white);
}

.f-body a {
  color: var(--white);
  text-decoration: underline;
  cursor: pointer;
}

.f-col > a {
  display: block;
  font-size: var(--fs);
  line-height: 22px;
  font-weight: 700;
  color: var(--white);
  text-decoration: none;
}

.f-col > a:hover { opacity: 0.5; }

.footer-bar {
  display: flex;
  justify-content: space-between;
  padding: 10px;
  margin-top: 0;
}

.footer-bar span {
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 11px;
  text-transform: uppercase;
  font-weight: 400;
  color: var(--white);
}

@media (max-width: 768px) {
  .site-footer {
    margin-top: 0;
  }

  .footer-3col {
    display: flex;
    flex-direction: column;
    margin-bottom: 0;
  }

  .f-col {
  }

  .footer-headline {
    font-size: 24px;
    line-height: 26px;
  }

  .f-body,
  .f-col > a {
    font-size: 18px;
    line-height: 21px;
  }

  .footer-3col .f-col:first-child {
    display: none;
  }
}

/* ══════════════════════════════════════════
 ENTRANCE ANIMATION
══════════════════════════════════════════ */
.reveal-item {
  opacity: 0;
  transform: translateY(14px);
}

.reveal-item.reveal-opacity-only {
  transform: none;
  /* override: don't shift elements that have JS-controlled position */
}

.reveal-item.revealed {
  animation: reveal-up 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.no-reveal-anim .reveal-item.revealed {
  animation: none;
  opacity: 1;
  transform: none;
}

.reveal-item.reveal-opacity-only.revealed {
  animation: reveal-fade 0.8s ease forwards;
}

.no-reveal-anim .reveal-item.reveal-opacity-only.revealed {
  animation: none;
  opacity: 1;
}

@keyframes reveal-up {
  from {
    opacity: 0;
    transform: translateY(14px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes reveal-fade {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* ══════════════════════════════════════════
 LOADING SCREEN
══════════════════════════════════════════ */
#loading-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  animation: loading-fade 2s ease forwards;
}

#loading-screen span {
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 11px;
  font-weight: 400;
  color: #fff;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  animation: loading-text-fade 2s ease forwards;
}

@keyframes loading-fade {
  0% {
    opacity: 1;
  }

  60% {
    opacity: 1;
  }

  100% {
    opacity: 0;
  }
}

@keyframes loading-text-fade {
  0% {
    opacity: 0;
    transform: translateY(6px);
  }

  25% {
    opacity: 1;
    transform: translateY(0);
  }

  70% {
    opacity: 1;
    transform: translateY(0);
  }

  100% {
    opacity: 0;
    transform: translateY(-4px);
  }
}
