:root {
  --black: #030303;
  --surface: #080808;
  --line: #202020;
  --muted: #747474;
  --soft: #a7a7a7;
  --white: #e8e8e4;
  --font-geist-sans: Arial, Helvetica, sans-serif;
  --font-geist-mono: "Courier New", Courier, monospace;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--black);
  color-scheme: dark;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--black);
  color: var(--white);
  font-family: var(--font-geist-sans), Arial, Helvetica, sans-serif;
  text-rendering: optimizeLegibility;
}

body::selection {
  background: var(--white);
  color: var(--black);
}

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

.threshold {
  position: relative;
  display: grid;
  min-height: 100svh;
  overflow: hidden;
  place-items: center;
  background:
    radial-gradient(circle at 50% 42%, rgb(255 255 255 / 4%), transparent 29%),
    linear-gradient(180deg, #030303 0%, #050505 61%, #030303 100%);
  isolation: isolate;
}

.threshold::before,
.threshold::after {
  position: absolute;
  z-index: -1;
  width: min(64vw, 48rem);
  aspect-ratio: 1;
  border: 1px solid rgb(255 255 255 / 5%);
  border-radius: 50%;
  content: "";
}

.threshold::before {
  animation: drift 28s linear infinite;
  box-shadow:
    0 0 8rem rgb(255 255 255 / 2%),
    inset 0 0 7rem rgb(255 255 255 / 1.5%);
}

.threshold::after {
  width: min(34vw, 26rem);
  border-color: rgb(255 255 255 / 3%);
  animation: drift 19s linear infinite reverse;
}

.residue {
  position: absolute;
  z-index: -1;
  inset: -9%;
  opacity: 0.34;
  background-image:
    linear-gradient(180deg, rgb(3 3 3 / 45%), rgb(3 3 3 / 78%)),
    url("nae0-field-wide.png");
  background-position: center;
  background-size: cover;
  filter: grayscale(0.46) contrast(1.02) brightness(1.12);
  mask-image: radial-gradient(circle at 53% 45%, black 8%, rgb(0 0 0 / 88%) 56%, transparent 94%);
  animation: grain-universe 38s cubic-bezier(0.42, 0, 0.58, 1) infinite alternate;
  transform-origin: 52% 46%;
  will-change: transform, opacity;
}

.residue::after {
  position: absolute;
  inset: 6%;
  opacity: 0.28;
  background: url("nae0-field-square.png") center / cover no-repeat;
  content: "";
  filter: grayscale(0.62) contrast(1.04) brightness(1.08);
  mix-blend-mode: screen;
  animation: grain-depth 26s ease-in-out infinite alternate;
}

.threshold-copy {
  display: flex;
  align-items: center;
  flex-direction: column;
  gap: 2rem;
  padding: 2rem;
  text-align: center;
}

.threshold h1 {
  margin: 0;
  font-size: clamp(2.6rem, 7.5vw, 7.3rem);
  font-weight: 350;
  letter-spacing: -0.055em;
  line-height: 0.92;
}

.threshold p {
  margin: 0;
  color: var(--soft);
  font-family: var(--font-geist-mono), monospace;
  font-size: clamp(0.65rem, 1.2vw, 0.82rem);
  letter-spacing: 0.12em;
}

.enter {
  position: absolute;
  bottom: clamp(2.4rem, 7vh, 5rem);
  display: flex;
  align-items: center;
  flex-direction: column;
  gap: 1rem;
  color: var(--muted);
  font-family: var(--font-geist-mono), monospace;
  font-size: 0.62rem;
  letter-spacing: 0.34em;
  transition: color 300ms ease;
}

.enter:hover,
.enter:focus-visible {
  color: var(--white);
}

.enter-line {
  display: block;
  width: 1px;
  height: 2.4rem;
  overflow: hidden;
  background: var(--line);
}

.enter-line::after {
  display: block;
  width: 100%;
  height: 42%;
  animation: descend 2.8s ease-in-out infinite;
  background: var(--soft);
  content: "";
}

.section-shell {
  width: min(100%, 100rem);
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 5vw, 6rem);
}

.sound {
  position: relative;
  z-index: 0;
  overflow: hidden;
  padding-top: clamp(8rem, 19vw, 18rem);
  padding-bottom: clamp(8rem, 16vw, 16rem);
  isolation: isolate;
}

.sound::before {
  position: absolute;
  z-index: -1;
  inset: -3%;
  opacity: 0.09;
  background:
    url("nae0-field-square.png") center top / min(92rem, 125vw) auto repeat-y,
    url("nae0-field-wide.png") center / cover no-repeat;
  content: "";
  filter: grayscale(0.7) contrast(1.02);
  animation: sound-grain 52s ease-in-out infinite alternate;
  will-change: transform, opacity;
}

.section-heading {
  display: grid;
  align-items: baseline;
  grid-template-columns: 4rem 1fr auto;
  padding-bottom: 1.8rem;
  border-bottom: 1px solid var(--line);
}

.section-heading p,
.section-heading h2 {
  margin: 0;
}

.section-number,
.section-state {
  color: var(--muted);
  font-family: var(--font-geist-mono), monospace;
  font-size: 0.58rem;
  letter-spacing: 0.18em;
}

.section-heading h2 {
  font-size: clamp(1rem, 1.8vw, 1.35rem);
  font-weight: 450;
  letter-spacing: 0.14em;
}

.pieces {
  display: grid;
  gap: clamp(7rem, 14vw, 13rem);
  margin-top: clamp(5rem, 10vw, 9rem);
}

.piece {
  display: grid;
  grid-template-columns: 4rem minmax(0, 1fr);
}

.piece:nth-child(even) {
  width: 84%;
  margin-left: auto;
}

.piece-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-direction: column;
  padding: 0.2rem 1.2rem 0.2rem 0;
  color: #646464;
  font-family: var(--font-geist-mono), monospace;
  font-size: 0.56rem;
  letter-spacing: 0.15em;
  writing-mode: vertical-rl;
}

.video-frame {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: var(--surface);
  box-shadow: 0 0 0 1px rgb(255 255 255 / 3%);
}

.video-frame::after {
  position: absolute;
  inset: 0;
  border: 1px solid rgb(255 255 255 / 6%);
  content: "";
  pointer-events: none;
}

.video-frame iframe {
  width: 100%;
  height: 100%;
  border: 0;
  filter: grayscale(0.15) contrast(1.04) brightness(0.83);
}

.piece-caption {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  grid-column: 2;
  gap: 2rem;
  padding-top: 1.25rem;
}

.piece-caption h3 {
  max-width: 38rem;
  margin: 0;
  font-size: clamp(0.78rem, 1.4vw, 1rem);
  font-weight: 400;
  letter-spacing: 0.02em;
}

.piece-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.75rem 1.5rem;
}

.piece-actions a,
.follow-actions a,
.site-footer a {
  position: relative;
  color: var(--muted);
  font-family: var(--font-geist-mono), monospace;
  font-size: 0.56rem;
  letter-spacing: 0.12em;
  transition: color 220ms ease;
}

.piece-actions a::after,
.follow-actions a::after,
.site-footer a::after {
  position: absolute;
  right: 0;
  bottom: -0.35rem;
  left: 0;
  height: 1px;
  transform: scaleX(0);
  transform-origin: right;
  background: currentColor;
  content: "";
  transition: transform 260ms ease;
}

.piece-actions a:hover,
.piece-actions a:focus-visible,
.follow-actions a:hover,
.follow-actions a:focus-visible,
.site-footer a:hover,
.site-footer a:focus-visible {
  color: var(--white);
}

.piece-actions a:hover::after,
.piece-actions a:focus-visible::after,
.follow-actions a:hover::after,
.follow-actions a:focus-visible::after,
.site-footer a:hover::after,
.site-footer a:focus-visible::after {
  transform: scaleX(1);
  transform-origin: left;
}

.follow-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 1.5rem 2.5rem;
  margin-top: clamp(7rem, 15vw, 14rem);
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}

.archive {
  position: relative;
  z-index: 0;
  min-height: 100svh;
  overflow: hidden;
  padding-top: clamp(7rem, 14vw, 13rem);
  padding-bottom: clamp(8rem, 17vw, 16rem);
  background: linear-gradient(180deg, transparent, rgb(255 255 255 / 0.6%) 40%, transparent);
  isolation: isolate;
}

.archive::before,
.archive::after {
  position: absolute;
  z-index: -1;
  content: "";
  pointer-events: none;
}

.archive::before {
  inset: 0;
  opacity: 0.07;
  background: url("nae0-field-square.png") center / min(100vw, 70rem) auto no-repeat;
  filter: grayscale(0.85);
  animation: archive-grain 44s ease-in-out infinite alternate;
  will-change: transform;
}

.archive::after {
  right: clamp(1.5rem, 6vw, 7rem);
  bottom: clamp(4rem, 8vw, 8rem);
  width: clamp(7rem, 15vw, 13rem);
  aspect-ratio: 1;
  opacity: 0.055;
  background: url("nae0-mark.png") center / contain no-repeat;
  filter: grayscale(1) contrast(1.15);
}

.archive-list {
  margin-top: clamp(7rem, 16vw, 15rem);
  border-top: 1px solid var(--line);
}

.archive-row {
  display: grid;
  align-items: center;
  grid-template-columns: 4rem 1fr auto;
  min-height: clamp(5.5rem, 10vw, 8.5rem);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  transition: color 350ms ease, padding 350ms ease;
}

.archive-row:hover {
  padding-inline: 0.75rem;
  color: var(--white);
}

.archive-row span {
  font-family: var(--font-geist-mono), monospace;
  font-size: 0.55rem;
  letter-spacing: 0.14em;
}

.archive-row p {
  margin: 0;
  font-size: clamp(0.85rem, 2vw, 1.3rem);
  font-weight: 350;
  letter-spacing: 0.12em;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 16rem;
  border-top: 1px solid var(--line);
  color: #555;
}

.site-footer nav {
  display: flex;
  gap: 2rem;
}

.site-footer p {
  margin: 0;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
}

@keyframes drift {
  0% {
    transform: rotate(0deg) scale(1);
  }
  50% {
    transform: rotate(180deg) scale(1.025);
  }
  100% {
    transform: rotate(360deg) scale(1);
  }
}

@keyframes descend {
  0% {
    transform: translateY(-110%);
  }
  55%,
  100% {
    transform: translateY(250%);
  }
}

@keyframes grain-universe {
  0% {
    opacity: 0.28;
    transform: translate3d(-1.8%, -1%, 0) scale(1.025) rotate(-0.25deg);
  }
  48% {
    opacity: 0.42;
    transform: translate3d(0.6%, 1.2%, 0) scale(1.075) rotate(0.2deg);
  }
  100% {
    opacity: 0.34;
    transform: translate3d(1.5%, -0.4%, 0) scale(1.045) rotate(-0.1deg);
  }
}

@keyframes grain-depth {
  0% {
    opacity: 0.18;
    transform: translate3d(1%, 0.5%, 0) scale(1.06);
  }
  100% {
    opacity: 0.36;
    transform: translate3d(-1.5%, -1%, 0) scale(1.14);
  }
}

@keyframes archive-grain {
  0% {
    transform: translate3d(-2%, 0, 0) scale(1.04);
  }
  100% {
    transform: translate3d(2%, -1%, 0) scale(1.1);
  }
}

@keyframes sound-grain {
  0% {
    opacity: 0.065;
    transform: translate3d(-1%, -0.4%, 0) scale(1.015);
  }
  55% {
    opacity: 0.105;
    transform: translate3d(1%, 0.5%, 0) scale(1.035);
  }
  100% {
    opacity: 0.08;
    transform: translate3d(-0.4%, 0.8%, 0) scale(1.025);
  }
}

@media (max-width: 700px) {
  .threshold h1 {
    font-size: clamp(2.4rem, 14vw, 4.6rem);
  }

  .section-heading {
    grid-template-columns: 2.2rem 1fr;
    row-gap: 0.8rem;
  }

  .section-state {
    grid-column: 2;
  }

  .piece,
  .piece:nth-child(even) {
    width: 100%;
    margin-left: 0;
    grid-template-columns: 2.2rem minmax(0, 1fr);
  }

  .piece-meta {
    padding-right: 0.65rem;
  }

  .piece-caption {
    flex-direction: column;
    gap: 1.2rem;
  }

  .piece-actions {
    justify-content: flex-start;
  }

  .follow-actions {
    justify-content: flex-start;
  }

  .archive-row {
    grid-template-columns: 2.2rem 1fr auto;
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    gap: 3rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
