/* ==================== RESET & BASE ==================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'PPMori', sans-serif;
  user-select: none;
  -webkit-user-select: none;
}
 
body {
  background-color: #ffffff;
  color: #333;
  overflow-x: hidden;
  font-size: 16px;
}
 
/* ==================== SCATTER STAGE ==================== */
.scatter-stage {
  position: relative;
  width: 100%;
  min-height: 100vh;
  overflow: hidden;
}
 
/* ==================== RECTANGLE ITEMS ==================== */
.rect-item {
  position: absolute;
  border: none;
  overflow: hidden;
  cursor: pointer;
  background: transparent;
}
 
/* Depth is fixed by DOM/build order so hovering never re-stacks items. */
 
/* Invisível por defeito, fade-out lento */
.rect-item img,
.rect-item video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  display: block;
  transition: none;
}
 
/* Touch (mobile): quick fade-in */
.rect-item.touched img,
.rect-item.touched video {
  opacity: 1;
  transition: opacity 0.2s ease;
}
 
/* Estado de desaparecimento */
.rect-item.fading img,
.rect-item.fading video {
  opacity: 0;
  transition: opacity 1.5s ease 2s;
}
 
/* ==================== MOBILE HINT ==================== */
.mobile-hint {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 20;
  pointer-events: none;
  text-align: center;
  font-family: 'ABCDiatypeMono', monospace;
  font-size: 0.875em;
  color: #333;
  letter-spacing: 0.05em;
}
 
.cursor-blink {
  animation: blink 0.8s step-end infinite;
}
 
@keyframes blink {
  50% { opacity: 0; }
}
 
/* ==================== FOOTER ==================== */
footer {
  position: relative;
  min-height: 15.625em;
  padding: 1.75em 2.5em;
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  padding-bottom: 1.875em;
  overflow: visible;
}
 
.interactive-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  width: 100%;
  position: relative;
  overflow: visible;
}
 
.footer-left p {
  color: #333;
  font-size: 0.875em;
  font-weight: normal;
  margin: 0;
  font-family: 'ABCDiatypeMono', monospace;
}
 
.footer-right {
  display: flex;
  gap: 1.5em;
}
 
.footer-right a {
  color: #333;
  text-decoration: none;
  font-size: 0.875em;
  font-weight: normal;
  transition: opacity 0.2s ease;
  font-family: 'ABCDiatypeMono', monospace;
}
 
.footer-right a:hover { opacity: 0.7; }
 
.footer-center {
  position: absolute;
  left: 50%;
  transform: translate(-50%, -50%);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9375em;
  text-decoration: none;
  color: inherit;
  padding: 1.25em 0;
}
 
.footer-line {
  width: 31.25em;
  height: 0.3125em;
  background-color: #333;
  transition: all 0.2s ease;
}
 
.get-in-text-top,
.get-in-text-bottom {
  font-size: 4em;
  font-weight: normal;
  color: #333;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
  line-height: 1.2;
  font-family: 'PPNeueMontreal', sans-serif;
  padding: 0.3125em 0;
}
 
.footer-center:hover .get-in-text-top,
.footer-center:hover .get-in-text-bottom { opacity: 1; }
.footer-center:hover .footer-line { width: 32.5em; }
 
.footer-center-mobile {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 0.9375em;
  width: 100%;
  margin-bottom: 1.875em;
  text-decoration: none;
  color: #333;
}
 
.footer-line-mobile {
  width: 15.625em;
  height: 0.1875em;
  background-color: #333;
}
 
.get-in-text-top-mobile,
.get-in-text-bottom-mobile {
  font-size: 1.25em;
  font-weight: normal;
  color: #333;
  line-height: 1.2;
  font-family: 'PPNeueMontreal', sans-serif;
  padding: 0.3125em 0;
}
 
/* ==================== DESKTOP ==================== */
@media (min-width: 769px) {
  /* Single-viewport layout: no page scroll on desktop */
  html, body {
    height: 100%;
    overflow: hidden;
  }
  /* Override the base 100vh so the JS-set height (viewport - header - footer) wins */
  .scatter-stage {
    min-height: 0;
  }
  /* Hide the centered "get in touch" link on desktop (kept in the HTML) */
  .footer-center {
    display: none;
  }
  /* With the centered link hidden, collapse the footer to its content height so
     there's no tall empty band between the bottom images and the footer text. */
  footer {
    min-height: 0;
    align-items: flex-end;
    padding-top: 1.25em;
    padding-bottom: 1.25em;
  }
  /* Hover snaps to full opacity instantly, no matter how fast the cursor moves */
  .rect-item:hover img,
  .rect-item:hover video,
  .rect-item.hovered img,
  .rect-item.hovered video {
    opacity: 1;
    transition: none;
  }
}

/* ==================== MOBILE ==================== */
@media (max-width: 768px) {
  /* No page scroll: the board is sized by JS to fit between header and footer */
  html, body {
    height: 100%;
    overflow: hidden;
  }
  .scatter-stage {
    min-height: 0; /* let the JS fit-height win over the base 100vh */
  }
  .mobile-hint { display: block; }

  /* Continuous fade-out on mobile (no desktop hold/delay) */
  .rect-item.fading img,
  .rect-item.fading video {
    transition: opacity 3s ease;
  }

  /* Footer stacked vertically: "get in / touch", then copyright, then links */
  footer {
    display: block;
    position: absolute; 
    bottom: 0; 
    left: 0; 
    right: 0;
    min-height: 0;
    padding: 1.5em 1.5em 1.875em;
    overflow: visible;
  }
  .interactive-footer {
    flex-direction: column;
    align-items: center;
    gap: 1.25em;
  }
  .footer-center { display: none; }            /* desktop "get in touch" hidden */
  .footer-center-mobile { display: none; }     /* "get in touch" removed on mobile */
  .footer-left { order: 2; }
  .footer-left p { text-align: center; }
  .footer-right {
    order: 3;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1.25em;
  }
}
 
/* ==================== PAGE FALL TRANSITION ==================== */
@keyframes pageFall {
  0%   { transform: translateY(0)      scale(1)    rotate(0deg);   opacity: 1; }
  8%   { transform: translateY(-40px)  scale(1.03) rotate(-0.4deg); opacity: 1; }
  100% { transform: translateY(130vh)  scale(0.92) rotate(1.8deg);  opacity: 0; }
}
 
body.page-falling {
  animation: pageFall 0.5s cubic-bezier(0.7, 0, 1, 1) forwards;
  pointer-events: none;
  transform-origin: center 60%;
}