:root {
  --bar-height: 20px;
  --line: #f7f7f3;
  --ink: #111;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  overscroll-behavior: none;
}

body {
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  color: var(--ink);
  background: #111;
  font-family: 'Times New Roman', Times, serif;
}

.portfolio {
  position: relative;
  height: 100svh;
  isolation: isolate;
  overscroll-behavior: none;
  background: var(--line);
}

.image-panel {
  position: absolute;
  left: 0;
  width: 100%;
  overflow: hidden;
  transition: transform 900ms ease;
}

.intro-overlay {
  position: fixed;
  z-index: 3;
  left: 0;
  width: 100%;
  background: var(--line);
  pointer-events: none;
  opacity: 1;
}

.intro-overlay-top {
  top: 0;
  height: 50%;
}

.intro-overlay-bottom {
  bottom: 0;
  height: 50%;
}

.portfolio.intro-ready .intro-overlay-top,
.portfolio.intro-ready .intro-overlay-bottom {
  opacity: 0;
}

@keyframes intro-fade {
  to { opacity: 1; }
}

.top-panel {
  top: 0;
  height: calc(50% - 10px);
  transform: translateY(-100%);
}

.bottom-panel {
  bottom: 0;
  height: calc(50% - 10px);
  transform: translateY(100%);
}

.portfolio.intro-ready .top-panel,
.portfolio.intro-ready .bottom-panel {
  transform: translateY(0);
}

.info-view {
  position: absolute;
  z-index: 4;
  inset: 0;
  display: grid;
  grid-template-rows: calc(50% - 10px) calc(50% - 10px);
  gap: 20px;
  overflow: auto;
  color: var(--ink);
  background: var(--line);
}

.info-view[hidden] {
  display: none;
}

.info-top,
.info-bottom {
  min-height: 0;
  min-width: 0;
  overflow: hidden auto;
  padding: 20px;
}

.info-kicker {
  margin: 0 0 4px;
  font-size: 13px;
  line-height: 1;
}

.info-columns {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 26px;
  min-width: 0;
}

.info-column {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.info-columns p,
.about-copy {
  margin: 0;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 10pt;
  font-weight: 500;
  line-height: 1.08;
}

.cv-heading {
  font-family: 'Times New Roman', Times, serif;
  font-weight: normal;
}

.info-columns p.cv-heading {
  font-family: 'Times New Roman', Times, serif;
}

.info-bottom {
  border-top: 0;
}

.about-copy {
  width: calc((100% - 78px) / 2 + 26px);
  margin-left: calc((100% - 78px) / 4 + 26px);
}

.project-view {
  position: absolute;
  z-index: 4;
  inset: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  color: var(--ink);
  background: var(--line);
}

.project-view::-webkit-scrollbar {
  display: none;
}

.project-scroll-hint {
  position: fixed;
  z-index: 7;
  right: 20px;
  bottom: 20px;
  color: var(--ink);
  font-family: 'Times New Roman', Times, serif;
  font-size: 18px;
  line-height: 1;
  pointer-events: none;
}

.project-view[hidden] {
  display: none;
}

.project-view-media {
  height: calc(100svh - var(--bar-height) - var(--project-detail-height, var(--bar-height)));
  order: 1;
  flex: 0 0 auto;
  min-width: 0;
  min-height: 0;
  background-position: center;
  background-size: cover;
  scroll-snap-align: start;
}

.project-view-media img,
.project-view-media video {
  display: block;
  width: auto;
  height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

.project-view-media.is-color-slide {
  width: calc(100vw - 359px);
}

.project-view-content {
  display: flex;
  align-items: flex-start;
  gap: 0;
  width: max-content;
  min-height: 100%;
  padding: 0;
  scroll-snap-type: x mandatory;
}

.project-view.is-bottom-project .project-view-content {
  padding-top: var(--bar-height);
}

.project-view-content::after {
  content: '';
  order: 3;
  display: none;
}

.project-detail-text {
  position: fixed;
  z-index: 6;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  align-content: start;
  gap: 26px;
  min-height: 28svh;
  margin: 0;
  padding: 0 20px 20px;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 10pt;
  font-weight: 500;
  line-height: 1.08;
  background: var(--line);
  opacity: 0;
  pointer-events: none;
  transform: translateY(100%);
  transition: height 420ms ease, min-height 420ms ease, padding 420ms ease;
}

.project-detail-toggle,
.project-detail-copy {
  margin: 0;
}

.project-detail-toggle {
  height: 20px;
  border: 0;
  padding: 0;
  color: inherit;
  background: transparent;
  font: inherit;
  font-family: 'Times New Roman', Times, serif;
  line-height: 20px;
  text-align: left;
  cursor: pointer;
}

.project-detail-body {
  grid-column: 2 / 5;
}

.project-detail-kicker {
  margin: 0;
  font-family: 'Times New Roman', Times, serif;
  font-size: 13px;
  line-height: 1;
}

.project-detail-text.is-visible,
.project-detail-text.is-collapsed {
  opacity: 1 !important;
  pointer-events: auto;
  transform: translateY(0) !important;
}

.project-detail-text.is-visible {
  animation: reveal-project-detail 420ms ease both;
}

.project-detail-text.is-collapsed {
  display: block;
  min-height: 20px !important;
  height: 20px !important;
  max-height: 20px;
  overflow: hidden;
  padding: 0 20px;
  animation: none;
}

.project-detail-text.is-collapsed .project-detail-copy,
.project-detail-text.is-collapsed .project-detail-kicker {
  display: none;
}

.project-view:not(.is-bottom-project) .project-detail-text {
  bottom: var(--bar-height);
}

.project-gallery {
  display: flex;
  gap: 0;
  order: 2;
}

.project-gallery > * {
  width: auto;
  height: calc(100svh - var(--bar-height) - var(--project-detail-height, var(--bar-height)));
  flex: 0 0 auto;
  min-width: 0;
  min-height: 0;
  scroll-snap-align: start;
}

.project-view-media.is-condensed,
.project-gallery > *.is-condensed {
  height: calc(100svh - var(--bar-height) - var(--project-detail-height, var(--bar-height)));
}

.project-gallery .color-slide {
  width: calc(100vw - 359px);
}

.project-gallery img,
.project-gallery video,
.project-gallery .color-slide {
  display: block;
  object-fit: contain;
  background: var(--line);
  user-select: none;
  -webkit-user-drag: none;
}

@keyframes reveal-project-detail {
  from {
    opacity: 0;
    transform: translateY(100%);
  }

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

.project-meta.project-view-meta {
  position: fixed;
  top: 20px;
}

.project-view.is-bottom-project .project-view-meta {
  top: 40px;
}

.project-view.is-bottom-project .project-view-media,
.project-view.is-bottom-project .project-gallery > * {
  height: calc(100svh - var(--bar-height) - var(--project-detail-height, var(--bar-height)));
}

.project-open .image-panel {
  visibility: hidden;
}

.image-window,
.image-track {
  height: 100%;
}

.image-track {
  display: flex;
  width: max-content;
  will-change: transform;
  cursor: grab;
}

.portfolio.is-slider-dragging .image-track {
  cursor: grabbing;
}

.top-track {
  transform: translateX(-50%);
}

.bottom-track {
  transform: translateX(0);
}

.image-track img,
.image-track video,
.color-slide {
  display: block;
  width: calc(100vw - 359px);
  height: 100%;
  flex: 0 0 calc(100vw - 359px);
  object-fit: cover;
  object-position: center center;
  user-select: none;
  -webkit-user-drag: none;
}

.top-track .color-slide:nth-child(12n + 1) { background: #b8e9f4; }
.top-track .color-slide:nth-child(12n + 2) { background: #a6dff0; }
.top-track .color-slide:nth-child(12n + 3) { background: #8dcaed; }
.top-track .color-slide:nth-child(12n + 4) { background: #73b7e8; }
.top-track .color-slide:nth-child(12n + 5) { background: #609ee0; }
.top-track .color-slide:nth-child(12n + 6) { background: #5987d5; }
.top-track .color-slide:nth-child(12n + 7) { background: #6878d0; }
.top-track .color-slide:nth-child(12n + 8) { background: #766cc9; }
.top-track .color-slide:nth-child(12n + 9) { background: #825fc2; }
.top-track .color-slide:nth-child(12n + 10) { background: #8d54b8; }
.top-track .color-slide:nth-child(12n + 11) { background: #974baa; }
.top-track .color-slide:nth-child(12n + 12) { background: #a03f9e; }


.project-meta {
  position: absolute;
  z-index: 1;
  top: 20px;
  left: 20px;
  right: 20px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  color: white;
  font-size: 13px;
  line-height: 1;
  pointer-events: none;
  mix-blend-mode: difference;
}

.project-meta span:first-child {
  grid-column: 1;
}

/* aligned to the 2nd column of the 4-column info text block */
.project-meta span:nth-child(2) {
  position: absolute;
  top: 0;
  left: calc(26px + (100vw - 118px) / 4);
  transform: translateX(-50%);
  text-align: center;
}

.project-meta span:last-child {
  grid-column: 3;
  text-align: right;
}

.divider {
  position: absolute;
  z-index: 5;
  top: calc(50% - 10px);
  left: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  width: 100%;
  height: var(--bar-height);
  background: var(--line);
  cursor: ns-resize;
  touch-action: none;
  user-select: none;
  opacity: 0;
  animation: intro-fade 350ms ease 250ms forwards;
}

/* prevents images/text from becoming selectable/highlighted while the navbar is being dragged */
.portfolio.is-divider-dragging,
.portfolio.is-divider-dragging * {
  -webkit-user-select: none;
  user-select: none;
}

.direction-button,
.contact-name-button,
.email-button {
  height: var(--bar-height);
  border: 0;
  padding: 0 20px;
  color: var(--ink);
  background: transparent;
  font: inherit;
  font-size: 13px;
  line-height: var(--bar-height);
  white-space: nowrap;
}

.direction-button {
  width: max-content;
  cursor: pointer;
  text-align: left;
}

.label-short {
  display: none;
}

.direction-button:last-child {
  justify-self: end;
  text-align: right;
}

.contact-controls {
  display: flex;
  align-items: center;
  gap: 2rem;
  justify-content: center;
  font-size: 13px;
  line-height: var(--bar-height);
}

.contact-name-button,
.email-button {
  display: block;
  width: max-content;
  padding: 0;
}

.contact-name-button {
  cursor: pointer;
}

.contact-name-button strong {
  font-weight: normal;
}

.email-button {
  color: inherit;
  text-decoration: none;
}

.direction-button:hover,
.contact-name-button:hover,
.email-button:hover,
.project-detail-toggle:hover {
  color: #8a8a8a;
}

.info-open .image-panel {
  visibility: hidden;
}

.info-open .divider {
  cursor: default;
}

.info-open .direction-button,
.info-open .contact-name-button,
.info-open .email-button,
.info-open .contact-controls {
  height: var(--bar-height);
  line-height: var(--bar-height);
}

@media (max-width: 700px) {
  .project-meta {
    left: 12px;
    right: 12px;
    font-size: 12px;
  }

  .direction-button,
  .contact-name-button,
  .email-button {
    padding: 0 12px;
  }

  .contact-controls {
    gap: 8px;
  }

  .contact-controls > span {
    display: none;
  }

  .image-track img,
  .color-slide {
    width: 100vw;
    flex-basis: 100vw;
  }

  .direction-button {
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .direction-button .label-full {
    display: none;
  }

  .direction-button .label-short {
    display: inline;
  }

  .project-meta span:nth-child(2) {
    left: calc(50vw - 12px);
  }

  .info-top,
  .info-bottom {
    overflow: hidden auto;
  }

  .info-columns {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .info-top,
  .info-bottom {
    padding: 20px 12px;
  }

  .about-copy {
    width: auto;
    max-width: none;
    margin-left: 0;
  }

  .project-view-content {
    gap: 0;
    padding: 0;
  }

  .project-view-media {
    height: calc(100svh - var(--bar-height) - var(--project-detail-height, var(--bar-height)));
  }

  .project-detail-text {
    display: block;
    min-height: 34svh;
    padding: 0 12px 20px;
  }

  .project-detail-toggle {
    margin-bottom: 12px;
  }

  .project-detail-text.is-collapsed {
    height: 20px !important;
    min-height: 20px !important;
    max-height: 20px;
    padding: 0 12px;
  }

  .project-gallery > * {
    height: calc(100svh - var(--bar-height) - var(--project-detail-height, var(--bar-height)));
  }

  .project-view.is-bottom-project .project-view-media,
  .project-view.is-bottom-project .project-gallery > * {
    height: calc(100svh - var(--bar-height) - var(--project-detail-height, var(--bar-height)));
  }

  .project-view-media.is-condensed,
  .project-gallery > *.is-condensed {
    height: calc(100svh - var(--bar-height) - var(--project-detail-height, var(--bar-height)));
  }
}
