/* ============================================
   VICENZO DEVITO — PERSONAL SITE
   Modernist / Swiss / Black & White
   ============================================ */

@font-face {
  font-family: 'Inter';
  src: url('fonts/InterVariable.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Inter';
  src: url('fonts/InterVariable-Italic.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}

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

::selection {
  background: #fff;
  color: #000;
}

/* ---- Base ---- */
html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: 'Inter', sans-serif;
  font-weight: 300;
  color: #fff;
  background: #000;
  -webkit-font-smoothing: antialiased;
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='17' height='17' shape-rendering='crispEdges'%3E%3Cpath d='M8 0h1v17h-1zM0 8h17v1h-17z' fill='%23ffffff'/%3E%3C/svg%3E") 8 8, crosshair;
}

/* ---- Page: horizontal split ---- */
.page {
  display: flex;
  height: 100%;
}

/* ---- Left half ---- */
.left {
  width: 50%;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  padding: 2rem 3rem;
}

#name-dither {
  display: block;
  width: 100%;
  flex-shrink: 0;
  transition: opacity 0.4s ease;
}

#flow-field {
  display: block;
  width: 100%;
  flex: 1;
  min-height: 0;
  transition: opacity 0.4s ease;
}

.left.has-content #name-dither,
.left.has-content #flow-field {
  opacity: 0;
  pointer-events: none;
}

/* ---- Left content panel (shown on cell click) ---- */
.left-content {
  position: absolute;
  inset: 0;
  padding: 2rem 3rem;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.left.has-content .left-content {
  opacity: 1;
  pointer-events: auto;
}

.left-content-title {
  font-family: 'Inter', sans-serif;
  font-weight: 400;
  font-size: clamp(2rem, 5vw, 4rem);
  letter-spacing: -0.03em;
  text-transform: uppercase;
  line-height: 0.95;
  color: #fff;
  margin-bottom: 1.5rem;
  margin-left: -0.04em;
  flex-shrink: 0;
}

.left-content-desc {
  font-family: 'Inter', sans-serif;
  font-weight: 400;
  font-size: 0.85rem;
  letter-spacing: 0;
  line-height: 1.4;
  color: #fff;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  display: flex;
  gap: 2.5rem;
  text-align: justify;
  hyphens: auto;
  -webkit-hyphens: auto;
  word-break: break-word;
}

.left-content-desc p {
  flex: 1;
  margin: 0;
}

/* ---- Wellread project panel ---- */
.wellread-panel {
  display: flex;
  gap: 2.5rem;
  align-items: center;
  align-self: flex-start;
}

.wr-logo {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 6px;
  width: 72px;
  height: 72px;
  flex-shrink: 0;
}

.wr-dot {
  border-radius: 50%;
  width: 100%;
  height: 100%;
  aspect-ratio: 1;
}

.wr-info {
  flex: 1;
}

.wr-info p {
  margin: 0 0 0.75rem 0;
}

.wr-name {
  font-weight: 500;
  font-size: 0.85rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 0.5rem !important;
}

.wr-link {
  opacity: 0.5;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

.wr-info a {
  color: #fff;
  text-decoration: none;
}

.wr-info a:hover {
  opacity: 0.6;
}

.left-content-anim {
  flex: 1;
  width: 100%;
  display: block;
  min-height: 0;
}

/* ---- Center divider ---- */
.divider {
  width: 1px;
  background: #fff;
  flex-shrink: 0;
}

/* ---- Right half: Grid ---- */
.right {
  flex: 1;
  display: flex;
}

.grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 1px;
  background: #fff;
}

/* ---- Grid cells ---- */
.cell {
  background: #000;
  position: relative;
  cursor: inherit;
  overflow: hidden;
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
}

.cell.empty {
  cursor: default;
}


.cell-label {
  font-size: 0.85rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #fff;
  transition: opacity 0.3s ease;
  text-align: left;
  line-height: 1.4;
  padding: 0.75rem;
}

.cell:hover .cell-label {
  opacity: 0.4;
}

/* ---- Nav cells (bottom row) ---- */
.cell.nav-cell {
  align-items: flex-start;
  justify-content: flex-start;
}

/* ---- Active cell (selected, content showing on left) ---- */
.cell.active {
  background: #111;
}

.cell.active .cell-label {
  opacity: 1;
}

/* ---- Dither gallery cell ---- */
.cell.dither-gallery {
  cursor: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.dither-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0.85;
  transition: opacity 0.3s ease;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.cell.dither-gallery:hover .dither-img {
  opacity: 1;
}

/* ---- Globe cell ---- */
.cell.globe-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: default;
}

#globe-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
  .left h1 {
    font-size: 5rem;
  }

  .left {
    padding: 1.5rem 2rem 2rem;
  }
}

@media (max-width: 768px) {
  html, body {
    overflow: auto;
    height: auto;
  }

  .page {
    flex-direction: column;
    height: auto;
  }

  .left {
    width: 100%;
    padding: 2rem;
    gap: 3rem;
  }

  .left h1 {
    font-size: 3.5rem;
  }

  .divider {
    width: 100%;
    height: 1px;
  }

  .right {
    min-height: 60vh;
  }
}

@media (max-width: 480px) {
  nav {
    gap: 1.5rem;
  }

  .left {
    padding: 1.25rem;
    gap: 2rem;
  }

  .left h1 {
    font-size: 2.5rem;
  }

  .right {
    min-height: 50vh;
  }
}
