@font-face {
  font-family: 'gerstner';
  src: url('Gerstner-ProgrammRegular.otf') format('opentype');
}

:root {
  --transition-speed: 0.5s; /* Global transition duration */
  --hover-delay: 100ms; /* Configure hover delay in one place */
}

/* =========================
   Base Styles
   ==================== ===== */

body {
  margin: 0;
  font-family: 'Gerstner';
  display: flex;
  height: 100vh;
  color: rgba(0, 0, 0, 0.8);
  font-size: 18px;
  line-height: 1.5;
  scroll-behavior: smooth;
  background-color: rgba(255, 255, 255, 0.95);
}

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

a:hover {
  cursor: pointer;
}

span {
  white-space: nowrap;
}

.datetime {
  font-variant-numeric: tabular-nums;
}

/* =========================
   Sidebar
   ========================= */

.sidebar {
  display: flex;
  width: fit-content;
  flex-shrink: 0;
  flex-direction: column;
  justify-content: space-between;
  padding: 36px;
  padding-right: 60px;
  box-sizing: border-box;
  position: sticky;
  top: 0;
  height: 100vh;
  opacity: 0;
  animation: fadeIn 0.15s ease forwards;
}

.sidebar p {
  max-width: 400px;
}

.sidebar-top {
  display: flex;
  flex-direction: column;
  overflow-y: scroll;
  min-height: 0;
  font-variant-numeric: tabular-nums;
  gap: 36px;
  flex: 1;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
}

.sidebar-top::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
  width: 0; /* Prevent layout shift */
}

.sidebar .project-item {
  display: flex;
  flex-direction: row;
  gap: 24px;
  align-items: center;
  color: rgba(0,0,0,0.25);
}

.sidebar li .name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.number {
  font-variant-numeric: tabular-nums;
  letter-spacing: 1.5px;
}

.sidebar ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.contact {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0 15px;
  margin-bottom: 0;
  align-items: start;
  flex-shrink: 0;
  padding: 6px 0;
  position: relative;
  background: white;
}

.contact::before {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  height: 120px;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.5) 40%, white);
  pointer-events: none;
}

.contact-label-column {
  display: flex;
  flex-direction: column;
}

.contact-label-values {
  display: flex;
  flex-direction: column;
}

.contact-label-values a {
  transition: opacity 0.2s;
  cursor: pointer;
}

.contact-label-values a:hover {
  opacity: 0.25;
}

.contact-label {
  cursor: default;
}

.zeroes {
  display: flex;
  flex-direction: column;
  font-variant-numeric: tabular-nums;
  letter-spacing: 1.5px;
  line-height: 1;
  gap: 1.5px;
  width: max-content;
}

.zeroes:hover {
  cursor: pointer;
}

.zeroes-top {
  display: flex;
  flex-direction: row;
}

/* =========================
   Content Grid
   ========================= */

.content {
  display: grid;
  flex: 1 1 auto;
  min-height: 0;
  height: 100vh;
  overflow-y: auto;
  grid-template-columns: repeat(3, 1fr);
  scroll-behavior: smooth;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.content::-webkit-scrollbar {
  display: none;
}

.cell {
  padding: 18px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: width 0.3s ease, height 0.3s ease;
}

.cell img,
.cell video {
  object-fit: contain;
  display: block;
  transition: filter 0.15s ease, max-width 0.3s ease, max-height 0.3s ease;
}

.cell img.pdf-thumbnail {
  cursor: pointer;
}

/* Mobile: all images/videos are clickable - consolidated in media queries section below */

.cell video::-webkit-media-controls,
.cell video::-webkit-media-controls-enclosure {
  display: none !important;
}

/* Hover swap transition */
.hover-swap {
  transition: opacity 0.15s ease;
}

/* Blur all other images/videos when hovering over one, except same project */
.content:has(.cell img:hover) .cell img:not(:hover):not(.same-project),
.content:has(.cell img:hover) .cell video:not(:hover):not(.same-project),
.content:has(.cell video:hover) .cell img:not(:hover):not(.same-project),
.content:has(.cell video:hover) .cell video:not(:hover):not(.same-project) {
  filter: blur(12px);
  transition-delay: var(--hover-delay);
}

/* =========================
   Overlay
   ========================= */

.project-overlay {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  background-color: rgba(255,255,255,0.9);
  z-index: 100000;
  color: black;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.15s ease, visibility 0.15s ease;
}

/* Mobile */

.project-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: none;
  animation: fadeIn 0.15s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.project-content {
  position: relative;
  z-index: 10001;
  pointer-events: none;
  box-sizing: border-box;
  color: rgba(0, 0, 0, 0.8);
  display: flex;
  height: 100vh;
}


.project-content p {
  margin: 0;
  max-width: 400px;
  text-wrap: pretty;
}

.project-description {
  max-width: 400px;
}

.project-content .project-description p + p {
  margin-top: 1.5em;
}

.project-content-left ul {
  list-style: none;
  padding: 0;
  line-height: 1;
  margin: 0;
}

.project-header {
  display: flex;
  flex-direction: column;
  gap: 56px;
  line-height: 1.5;
}

.project-header-000 {
  display: flex;
  flex-direction: column;
  gap: 36px;
  line-height: 1.5;
}

.project-content-left .project-item {
  display: flex;
  flex-direction: row;
  gap: 24px;
}

.project-content-left {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow-y: scroll;
  width: 100%;
  padding: 36px 36px;
  height: 100vh;
  box-sizing: border-box;
  transition: opacity 0.15s ease;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
}

.project-content-left::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

.close-project-overlay {
  display: none;
}

/* Mobile: show close button - consolidated in media queries section below */

/* =========================
   Image Viewer Overlay
   ========================= */
.image-viewer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.95);
  z-index: 200000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.15s ease, visibility 0.15s ease;
  cursor: pointer;
}

.image-viewer-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

#image-viewer-content {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 90vw;
  height: 90vh;
}

#image-viewer-content img,
#image-viewer-content video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  cursor: default;
}

.close-image-viewer {
  position: fixed;
  top: 36px;
  right: 36px;
  background: none;
  border: none;
  color: rgba(0, 0, 0, 0.5);
  cursor: pointer;
  transition: opacity 0.2s;
  z-index: 200001;
  padding: 0;
}

.close-image-viewer:hover {
  opacity: 0.25;
}

/* =========================
   Media Queries
   ========================= */

@media screen and (min-width: 1500px) {
  .content {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media screen and (max-width:1074px) {
  .content {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media screen and (max-width:800px) {
  .content {
    grid-template-columns: repeat(1, 1fr);
  }
}


@media screen and (max-width:571px) {
  .contact {
    grid-template-columns: 1fr;
    height: 108px;
  }

  .contact-label-values {
    display: none;
  }

  .contact-label {
    cursor: pointer;
    transition: opacity 0.2s;
  }

  .contact-label:hover {
    opacity: 0.25;
  }

  .name {
    display: none;
  }
}

/* Mobile/Touch Devices */
@media (hover: none) and (pointer: coarse) and (max-width: 768px) {
  /* Sidebar padding */
  .sidebar {
    padding-right: 18px;
  }

  /* All images/videos are clickable */
  .cell img,
  .cell video {
    cursor: pointer;
  }

  /* Full-screen overlay */
  .project-overlay {
    width: 100vw;
  }

  .project-overlay.active {
    pointer-events: auto;
  }

  /* Show close button */
  .close-project-overlay {
    display: block;
    position: fixed;
    top: 36px;
    right: 36px;
    background: none;
    border: none;
    color: rgba(0, 0, 0, 0.5);
    cursor: pointer;
    transition: opacity 0.2s;
    z-index: 100001;
    padding: 0;
    pointer-events: auto;
  }

  .close-project-overlay:hover {
    opacity: 0.25;
  }

  .project-content-left {
    pointer-events: auto;
    padding-top: 0;
  }
}
