@font-face {
  font-family: "pixel";
  src: url("assets/fonts/reppixel.ttf") format("truetype");
}

:root {
  --color-background: #121212;
  --color-text: #ffffff;
  --font-display: "pixel", monospace;
  --section-gap: clamp(4rem, 10vw, 8rem);
  --section-padding-inline: 10%;
}

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

body {
  background-color: var(--color-background);
  color: var(--color-text);
  font-family: var(--font-display);
  font-weight: normal;
  line-height: 1.7;
  text-transform: uppercase;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: url("assets/bg.png") center / cover no-repeat;
  image-rendering: pixelated;
  opacity: 0.9;
}

button {
  font: inherit;
}

img {
  display: block;
}

.hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: min(750px, 100vh);
  min-height: min(750px, 100svh);
  padding: 0 7.5%;
}

.hero-inner {
  position: relative;
  width: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.hero-title {
  font-size: clamp(2rem, 6vw, 4rem);
  text-align: center;
}

.hero-title span {
  display: block;
  animation: pop-in 0.4s steps(5) both;
}

.hero-title span:nth-child(2) {
  animation-delay: 0.15s;
}

.hero-title span:nth-child(3) {
  animation-delay: 0.3s;
}

.contract-address {
  background: none;
  border: 0;
  color: inherit;
  font-size: clamp(0.6rem, 1vw, 0.8rem);
  text-align: center;
  cursor: pointer;
  animation: rise-in 0.45s steps(6) 0.4s both;
  transition:
    transform 0.1s steps(2),
    opacity 0.15s steps(3);
}

.contract-address:active {
  transform: scale(0.96);
}

.contract-address:hover {
  opacity: 0.8;
}

.socials {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.hero .socials {
  animation: rise-in 0.45s steps(6) 0.55s both;
}

.social-link {
  width: 170px;
  height: 60px;
  padding: 0 0.75rem;
  cursor: pointer;
  transition:
    transform 0.15s steps(3),
    opacity 0.15s steps(3);
}

.social-link:hover {
  opacity: 0.8;
  transform: translateY(-4px);
}

.social-link img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  box-shadow: 0 0 10px 10px rgb(0 0 0 / 2.5%);
}

.hero-image {
  position: relative;
  width: 50%;
  max-width: 750px;
  image-rendering: pixelated;
  animation: bob 1.6s steps(2) infinite;
}

main {
  display: flex;
  flex-direction: column;
  gap: var(--section-gap);
  padding-block: var(--section-gap);
}

.section {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-inline: var(--section-padding-inline);
}

.section-title {
  font-size: clamp(1.5rem, 4vw, 3rem);
  text-align: center;
}

.lore-text {
  width: 100%;
  max-width: 1000px;
  font-size: clamp(0.8rem, 2vw, 1rem);
  text-align: justify;
}

.type-cursor {
  display: inline-block;
  width: 0.55em;
  height: 1em;
  margin-left: 0.2em;
  background-color: var(--color-text);
  animation: blink 0.9s steps(1) infinite;
}

.gallery {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(1rem, 2vw, 1.5rem);
}

.gallery-item {
  aspect-ratio: 1;
  border: 2px solid var(--color-text);
  overflow: hidden;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.85) contrast(0.95);
  transition:
    transform 0.15s steps(3),
    filter 0.15s steps(3);
}

.gallery-item:hover img {
  transform: scale(1.08);
  filter: saturate(1.1) contrast(1.05);
}

.steps {
  width: 100%;
  max-width: 1000px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.step {
  font-size: clamp(0.8rem, 2vw, 1rem);
  text-align: start;
}

.footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3rem;
  padding: calc(var(--section-gap) / 2) var(--section-padding-inline);
}

.source-link {
  display: inline-block;
  max-width: 100%;
  padding: 0.75rem 1.5rem;
  border: 2px solid var(--color-text);
  color: var(--color-text);
  text-decoration: none;
  text-align: center;
  overflow-wrap: anywhere;
  font-size: clamp(0.6rem, 1.8vw, 1.1rem);
  transition:
    background-color 0.15s steps(3),
    color 0.15s steps(3),
    transform 0.15s steps(3);
}

.source-link:hover {
  background-color: var(--color-text);
  color: var(--color-background);
  transform: translateY(-3px);
}

.source-link:active {
  transform: scale(0.97);
}

.source-link-label {
  animation: glow-pulse 1.6s steps(1) infinite;
}

.source-link-compact {
  display: none;
}

.source-link:hover .source-link-label {
  animation: none;
}

.terminal-art {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: clamp(0.28rem, 1.4vw, 0.75rem);
  line-height: 1.15;
  color: var(--color-text);
  text-shadow: 0 0 8px rgb(255 255 255 / 30%);
}

.footer-note {
  font-size: 0.6rem;
  opacity: 0.7;
}

.loader {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background-color: var(--color-background);
  animation: fade-out 0.5s steps(8) 2s forwards;
  z-index: 9999;
}

.loader img {
  width: min(300px, 80vw);
  image-rendering: pixelated;
  animation: blink 0.8s steps(1) infinite;
}

@keyframes fade-out {
  to {
    opacity: 0;
    visibility: hidden;
  }
}

.js .reveal {
  opacity: 0;
}

.js .reveal.revealed {
  animation: rise-in 0.5s steps(8) both;
}

.js .terminal-art.revealed {
  animation: none;
  opacity: 1;
}

.js .terminal-art .art-line {
  display: block;
  opacity: 0;
}

.js .terminal-art.revealed .art-line {
  animation: art-line-in 0.18s steps(4) both;
}

.blink {
  animation: blink 1.1s steps(1) infinite;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9000;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent 3px,
      rgb(0 0 0 / 15%) 3px,
      rgb(0 0 0 / 15%) 4px
    ),
    radial-gradient(ellipse at center, transparent 55%, rgb(0 0 0 / 30%) 100%);
}

@keyframes pop-in {
  0% {
    opacity: 0;
    transform: translateY(1rem) scale(0.7);
  }
  60% {
    opacity: 1;
    transform: translateY(-0.3rem) scale(1.06);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(2rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes bob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

@keyframes art-line-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes glow-pulse {
  0%,
  100% {
    text-shadow: 0 0 5px rgb(255 255 255 / 35%);
  }
  50% {
    text-shadow:
      0 0 12px rgb(255 255 255 / 100%),
      0 0 22px rgb(255 255 255 / 55%);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media (max-width: 900px) {
  .hero {
    flex-direction: column;
    padding: 6rem 7.5%;
  }

  .hero-inner,
  .hero-image {
    width: 90%;
  }

  .gallery {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .hero {
    padding: 3rem 7.5%;
  }

  .socials {
    width: 100%;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-top: 1rem;
  }

  .social-link {
    width: 130px;
    max-width: 50%;
    flex-grow: 1;
    padding: 0 1rem;
    background-color: var(--color-background);
  }

  .section {
    padding-inline: 5%;
  }

  .source-link {
    padding: 0.75rem 1rem;
  }

  .source-link-full {
    display: none;
  }

  .source-link-compact {
    display: inline;
  }
}
