:root {
  --bg: #ffffff;
  --text: rgb(18, 18, 18);
  --riser: #fff;
  --tread: hsl(0, 0%, 95%);
  --side: hsl(0, 0%, 92%);
  --back: hsl(0, 0%, 92%);
  --bottom: hsl(0, 0%, 85%);
  --step-height: 15svh;
}

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

body {
  font-family: "Times New Roman", serif;
  height: 240rem;
  background: var(--bg);
  touch-action: pan-y;
}

main {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 110vw;
  perspective-origin: 50% 30%;
  background: var(--bg);
}

#bg {
  position: absolute;
  inset: -1px;
  z-index: -1;
}

.bg-layer {
  position: absolute;
  inset: 0;
  opacity: 0;
  background-image: var(--piece-img, none);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transition: opacity 400ms;
  will-change: opacity;
}

.bg-layer.connect,
.bg-layer.afterimages {
  background-color: #ffffff;
}

.bg-layer.singing-light {
  background-color: #74394a;
}

.bg-layer.cursor-park {
  background-color: #d2e3c1;
}

.bg-layer.banner-highway {
  background-color: #030303;
}

.bg-layer.tell-umma {
  background-color: #e2dcc2;
}

.bg-layer.from-mine-to-yours {
  background-image:
    linear-gradient(-90deg, #cfd5ff, 1px, transparent 1px),
    linear-gradient(#cfd5ff, 1px, transparent 1px);
  background-color: #f2f2f2;
  background-size:
    8px 8px,
    8px 8px;
  background-repeat: repeat;
}

.bg-layer.from-mine-to-yours img {
  object-fit: cover;
  height: 100%;
  width: 100%;
}

.bg-layer.milkfish {
  background-color: #cbcbcb;
  background-size: contain;
  background-position: left bottom;
}

.bg-layer.consumables {
  background-color: #ffffff;
  background-size: contain;
}

.bg-layer.kpojo {
  background-color: #ffffff;
  background-size: 12vw 12vw;
  background-repeat: repeat;
  filter: invert(1);
}

.bg-layer.photographic-memory {
  background-color: #f8f8f8;
  background-size: contain;
  background-position: left center;
}

.bg-layer.angel-in-latency {
  background-color: #1a1a1a;
  background-size: contain;
  background-position: top center;
}

.bg-layer.carecore {
  background-image: var(--piece-img), radial-gradient(#150d08, #1f160b);
  background-size: contain, cover;
  background-position:
    20% 0,
    center;
  background-repeat: no-repeat, no-repeat;
}

.bg-layer pre {
  text-shadow: 0 0 2px;
  color: hsl(0, 0%, 62%);
  overflow: hidden;
  font-family: monospace;
  font-size: 0.75rem;
  line-height: 1.4;
  white-space: pre;
  padding: 2rem;
  pointer-events: none;
}

body.banner-highway header,
body.carecore header {
  mix-blend-mode: color-dodge;
}

body.photographic-memory header,
body.singing-light header,
body.afterimages header,
body.from-mine-to-yours header {
  mix-blend-mode: difference;
}

header {
  position: fixed;
  z-index: 100;
  top: 4svh;
  right: 2.75%;
  mix-blend-mode: exclusion;
}

header * {
  color: #e6e6e6;
}

header a:hover {
  color: #59d0ff;
}

h1 {
  font-size: 5.5vw;
  line-height: 100%;
  font-weight: 400;
}

h1 a {
  text-decoration: none;
}

h2 {
  text-align: right;
  font-family: sans-serif;
  font-weight: 400;
  font-size: 1.5vw;
}

h2 a {
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 0.2em;
  text-decoration-thickness: 1px;
}

h2 a:hover {
  text-decoration-color: inherit;
}

#staircase {
  -webkit-transform-style: preserve-3d;
  transform-style: preserve-3d;
  position: relative;
  width: 0;
  height: 0;
  left: -7%;
  top: 12svh;
  will-change: transform;
}

.step {
  position: absolute;
  width: 42vw;
  left: 0;
  transform-origin: 0 50%;
  -webkit-transform-style: preserve-3d;
  transform-style: preserve-3d;
  text-decoration: none;
  color: var(--text);
  cursor: pointer;
  contain: layout style;
  transform: translateY(
      calc(
        var(--i) * var(--step-height) + var(--i) * 0.5px - 17 *
          var(--step-height)
      )
    )
    rotateY(calc(var(--i) * -22deg + 181deg));
}

.step:first-child .outer-end,
.step:first-child .inner-end {
  background: var(--side);
}

.step:hover .step-title {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

#staircase.fading .step > * {
  transition: opacity 400ms;
  opacity: 0;
}

.step:hover .step-author,
.step:hover .step-type {
  color: transparent;
  background: transparent;
}

.step:hover .desc * {
  opacity: 1;
}

p {
  font-size: 0.9375rem;
}

.desc {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.75rem;
  transform: translateZ(-1px);
  padding-left: calc(33% + 1rem);
  background: var(--riser);
  text-wrap: pretty;
}

.desc * {
  transition: opacity 300ms;
  opacity: 0;
}

.riser,
.desc,
.outer-end,
.inner-end,
.back {
  height: var(--step-height);
}

.bottom {
  top: var(--step-height);
}

.riser {
  position: absolute;
  inset: 0;
  padding: 0 0.75rem;
  display: grid;
  grid-template-columns: 2rem 1fr;
  align-items: center;
  border: 1px solid var(--tread);
}

.riser p {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: 1rem;
}

.tread {
  position: absolute;
  width: 100%;
  height: 24vw;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  transform: rotateX(-90.25deg);
  background: var(--tread);
  pointer-events: none;
}

.outer-end,
.inner-end {
  position: absolute;
  height: 100%;
  width: 24vw;
  top: 0;
  left: 100%;
  transform-origin: 0 0;
  transform: rotateY(90deg);
  background: var(--side);
  height: var(--step-height);
  pointer-events: none;
}

.back,
.inner-end {
  left: 0;
  background: linear-gradient(-3deg, var(--side) 70%, var(--bottom));
}

.back {
  position: absolute;
  width: 100%;
  top: 0;
  left: 0;
  transform: translateZ(-24vw);
  pointer-events: none;
}

.bottom {
  position: absolute;
  width: 100%;
  height: 24vw;
  left: 0;
  transform-origin: 0 0;
  transform: rotateX(-90.25deg);
  background: var(--bottom);
  pointer-events: none;
}

.step-num {
  font-variant-numeric: tabular-nums;
  font-family: sans-serif;
  font-size: 0.75rem;
}

.step-title {
  max-width: calc(33% - 2rem);
  font-weight: 600;
  text-wrap: pretty;
}

.step-type {
  font-style: italic;
  text-align: center;
}

.step-author {
  text-align: right;
}

@media screen and (max-width: 1200px) {
  main {
    perspective: 1000px;
  }

  #staircase {
    left: -38%;
  }
  .step {
    width: 80vw;
  }
  .step:hover .step-author,
  .step:hover .step-type {
    background-color: var(--bg);
    color: var(--text);
  }
  .step:hover .desc * {
    opacity: 0;
  }

  .tread,
  .bottom {
    height: 20rem;
  }

  .outer-end,
  .inner-end {
    width: 20rem;
  }

  .back {
    transform: translateZ(-20rem);
  }
}

@media screen and (max-width: 767px) {
  :root {
    --step-height: 120px;
  }

  body {
    height: 274rem;
  }

  h1 {
    font-size: 2.25rem;
  }

  h2 {
    font-size: 0.9375rem;
  }

  .hide-mobile {
    display: none;
  }

  .step {
    padding: 0 0.375rem;
  }

  .riser {
    grid-template-columns: 1.5rem 1fr;
    background: var(--bg);
  }

  .desc {
    display: none;
  }

  .riser p {
    font-size: 0.75rem;
    gap: 0.625rem;
  }

  .step-num {
    font-size: 0.625rem;
  }

  .tread,
  .bottom {
    height: 14rem;
  }

  .outer-end,
  .inner-end {
    width: 14rem;
  }

  .step-title {
    max-width: 38%;
  }

  .back,
  .bottom {
    display: none;
  }

  .bg-layer {
    display: none;
  }

  header {
    mix-blend-mode: normal !important;
  }

  header * {
    color: var(--text);
  }

  header a:hover {
    color: blue;
  }
}

@media screen and (min-width: 1800px) and (min-height: 1000px) {
  .step p {
    font-size: 1.5rem;
  }
  .step-num {
    font-size: 1.125rem;
  }
  .riser {
    grid-template-columns: 3rem 1fr;
    padding: 0 1.5rem;
  }
}
