:root {
  --ink: #070707;
  --ash: #121212;
  --steel: #7a7a7a;
  --fog: #a8a8a8;
  --snow: #ececec;
  --ease-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-soft: cubic-bezier(0.4, 0, 0.2, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  min-height: 100%;
  height: 100%;
}

body {
  overflow: hidden;
  background:
    radial-gradient(90% 70% at 58% 42%, #1c1c1c 0%, #0d0d0d 42%, var(--ink) 78%, #000 100%),
    linear-gradient(135deg, #101010 0%, #050505 100%);
  color: var(--snow);
  font-family: "IBM Plex Sans", sans-serif;
  cursor: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img {
  display: block;
  max-width: 100%;
  user-select: none;
  -webkit-user-drag: none;
}

.noise,
#grain,
.vignette,
.scanlines,
.spotlight,
.boot,
.atmosphere,
.portrait__blend {
  pointer-events: none;
}

.noise {
  position: fixed;
  inset: 0;
  z-index: 40;
  opacity: 0.04;
  mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px 180px;
  animation: noise-shift 0.35s steps(2) infinite;
}

@keyframes noise-shift {
  0% {
    transform: translate(0, 0);
  }
  25% {
    transform: translate(-1.5%, 1%);
  }
  50% {
    transform: translate(1%, -1.5%);
  }
  75% {
    transform: translate(-1%, -0.5%);
  }
  100% {
    transform: translate(0.5%, 1.5%);
  }
}

#grain {
  position: fixed;
  inset: 0;
  z-index: 39;
  width: 100%;
  height: 100%;
  opacity: 0.1;
  mix-blend-mode: overlay;
}

.vignette {
  position: fixed;
  inset: 0;
  z-index: 30;
  background:
    radial-gradient(ellipse 78% 68% at 55% 45%, transparent 28%, rgba(0, 0, 0, 0.28) 68%, rgba(0, 0, 0, 0.78) 100%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.42) 0%, transparent 18%, transparent 72%, rgba(0, 0, 0, 0.5) 100%);
}

.scanlines {
  position: fixed;
  inset: 0;
  z-index: 31;
  opacity: 0.03;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.08) 0,
    rgba(255, 255, 255, 0.08) 1px,
    transparent 1px,
    transparent 3px
  );
}

.cursor {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
  mix-blend-mode: difference;
}

body.is-ready .cursor {
  opacity: 1;
}

.cursor__ring,
.cursor__dot {
  position: absolute;
  inset: 0;
  border-radius: 50%;
}

.cursor__ring {
  border: 1px solid rgba(236, 236, 236, 0.7);
  transform: scale(1);
  transition: transform 0.35s var(--ease-expo);
}

.cursor__dot {
  inset: 9px;
  background: var(--snow);
}

body.is-hovering-brand .cursor__ring {
  transform: scale(1.55);
}

.boot {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  background: #000;
  transition: opacity 0.9s var(--ease-soft), visibility 0.9s;
}

body.is-ready .boot {
  opacity: 0;
  visibility: hidden;
}

.boot__line {
  width: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--fog), transparent);
  box-shadow: 0 0 18px rgba(255, 255, 255, 0.2);
  animation: boot-line 1.1s var(--ease-expo) forwards;
}

.boot__flash {
  position: absolute;
  inset: 0;
  background: var(--snow);
  opacity: 0;
}

body.is-booting-flash .boot__flash {
  animation: boot-flash 0.45s var(--ease-soft) forwards;
}

@keyframes boot-line {
  0% {
    width: 0;
    opacity: 0;
  }
  20% {
    opacity: 1;
  }
  100% {
    width: min(28vw, 220px);
    opacity: 1;
  }
}

@keyframes boot-flash {
  0% {
    opacity: 0;
  }
  35% {
    opacity: 0.35;
  }
  100% {
    opacity: 0;
  }
}

.stage {
  position: relative;
  width: 100%;
  height: 100svh;
  overflow: hidden;
  isolation: isolate;
}

.atmosphere {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(48% 52% at 56% 44%, rgba(90, 90, 90, 0.18) 0%, transparent 70%),
    radial-gradient(30% 28% at 20% 18%, rgba(255, 255, 255, 0.03) 0%, transparent 70%);
}

.portrait {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  opacity: 0;
  transform: scale(1.04);
  will-change: transform, opacity;
}

body.is-ready .portrait {
  animation: portrait-reveal 2.2s var(--ease-expo) 0.05s forwards;
}

@keyframes portrait-reveal {
  0% {
    opacity: 0;
    transform: scale(1.06);
    filter: blur(14px) brightness(0.7);
  }
  55% {
    opacity: 0.85;
    filter: blur(2px) brightness(0.9);
  }
  100% {
    opacity: 1;
    transform: scale(1);
    filter: blur(0) brightness(1);
  }
}

.portrait__field {
  position: relative;
  width: min(78vw, 760px);
  height: min(92svh, 980px);
  display: grid;
  place-items: center;
  -webkit-mask-image: radial-gradient(
    ellipse 74% 80% at 50% 42%,
    #000 22%,
    rgba(0, 0, 0, 0.88) 48%,
    rgba(0, 0, 0, 0.35) 68%,
    transparent 82%
  );
  mask-image: radial-gradient(
    ellipse 74% 80% at 50% 42%,
    #000 22%,
    rgba(0, 0, 0, 0.88) 48%,
    rgba(0, 0, 0, 0.35) 68%,
    transparent 82%
  );
}

.portrait__img,
.portrait__glitch img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 16%;
}

.portrait__img {
  position: relative;
  z-index: 2;
  opacity: 0.9;
  filter: contrast(1.04) brightness(0.94) saturate(0);
  animation: portrait-breathe 10s ease-in-out 2.4s infinite;
}

@keyframes portrait-breathe {
  0%,
  100% {
    transform: scale(1) translate3d(0, 0, 0);
  }
  50% {
    transform: scale(1.018) translate3d(0, -0.4%, 0);
  }
}

.portrait__glow {
  position: absolute;
  width: 78%;
  height: 70%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(180, 180, 180, 0.14) 0%, transparent 68%);
  filter: blur(28px);
  z-index: 1;
  transform: translate3d(0, -4%, 0);
  animation: glow-pulse 6.5s ease-in-out 2s infinite;
}

@keyframes glow-pulse {
  0%,
  100% {
    opacity: 0.35;
    transform: translate3d(0, -4%, 0) scale(0.98);
  }
  50% {
    opacity: 0.7;
    transform: translate3d(0, -6%, 0) scale(1.04);
  }
}

.portrait__blend {
  position: absolute;
  inset: 0;
  z-index: 4;
  background:
    radial-gradient(ellipse 55% 60% at 54% 42%, transparent 35%, rgba(7, 7, 7, 0.35) 72%, rgba(7, 7, 7, 0.88) 100%),
    linear-gradient(90deg, rgba(7, 7, 7, 0.55) 0%, transparent 28%, transparent 72%, rgba(7, 7, 7, 0.55) 100%),
    linear-gradient(180deg, rgba(7, 7, 7, 0.5) 0%, transparent 22%, transparent 68%, rgba(7, 7, 7, 0.72) 100%);
}

.portrait__glitch {
  position: absolute;
  inset: 0;
  z-index: 2;
  opacity: 0;
}

.portrait__glitch img {
  position: absolute;
  inset: 0;
  mix-blend-mode: screen;
  opacity: 0.45;
}

.portrait__glitch img:first-child {
  transform: translate3d(-4px, 0, 0);
  filter: brightness(1.15) contrast(1.2);
  clip-path: inset(16% 0 56% 0);
}

.portrait__glitch img:last-child {
  transform: translate3d(4px, 0, 0);
  filter: brightness(0.85) contrast(1.3);
  clip-path: inset(50% 0 20% 0);
}

body.is-glitching .portrait__glitch {
  opacity: 1;
  animation: glitch-jitter 0.28s steps(2) infinite;
}

body.is-glitching .portrait__img {
  filter: contrast(1.18) brightness(1.02) saturate(0);
}

@keyframes glitch-jitter {
  0% {
    transform: translate(0, 0);
  }
  25% {
    transform: translate(-2px, 1px);
  }
  50% {
    transform: translate(3px, -1px);
  }
  75% {
    transform: translate(-1px, 2px);
  }
  100% {
    transform: translate(1px, -1px);
  }
}

.brand {
  position: absolute;
  top: clamp(1.25rem, 3.2vh, 2.1rem);
  left: clamp(1.25rem, 3.2vw, 2.4rem);
  z-index: 20;
  margin: 0;
  font-weight: 300;
  font-size: clamp(0.82rem, 1.35vw, 1.95rem);
  letter-spacing: 0.18em;
  line-height: 1;
  text-transform: lowercase;
  color: rgba(210, 210, 210, 0.72);
}

.brand__track {
  display: inline-flex;
  align-items: baseline;
  gap: 0;
}

.brand__char,
.brand__dot {
  display: inline-block;
  position: relative;
  opacity: 0;
  transform: translate3d(0, 0.35em, 0);
  will-change: transform, opacity;
}

body.is-ready .brand__char,
body.is-ready .brand__dot {
  animation: char-in 0.9s var(--ease-expo) forwards;
}

body.is-ready .brand__char:nth-child(1) { animation-delay: 0.85s; }
body.is-ready .brand__char:nth-child(2) { animation-delay: 0.9s; }
body.is-ready .brand__char:nth-child(3) { animation-delay: 0.95s; }
body.is-ready .brand__char:nth-child(4) { animation-delay: 1s; }
body.is-ready .brand__char:nth-child(5) { animation-delay: 1.05s; }
body.is-ready .brand__char:nth-child(6) { animation-delay: 1.1s; }
body.is-ready .brand__char:nth-child(7) { animation-delay: 1.15s; }
body.is-ready .brand__char:nth-child(8) { animation-delay: 1.2s; }
body.is-ready .brand__char:nth-child(9) { animation-delay: 1.25s; }
body.is-ready .brand__char:nth-child(10) { animation-delay: 1.3s; }
body.is-ready .brand__dot { animation-delay: 1.35s; }
body.is-ready .brand__char:nth-child(12) { animation-delay: 1.4s; }
body.is-ready .brand__char:nth-child(13) { animation-delay: 1.45s; }

@keyframes char-in {
  0% {
    opacity: 0;
    transform: translate3d(0, 0.35em, 0);
    filter: blur(4px);
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0);
    filter: blur(0);
  }
}

.brand__dot {
  color: rgba(160, 160, 160, 0.55);
}

.brand:hover {
  color: rgba(236, 236, 236, 0.9);
}

.spotlight {
  position: absolute;
  inset: 0;
  z-index: 10;
  background: radial-gradient(
    360px 360px at var(--mx, 55%) var(--my, 42%),
    rgba(255, 255, 255, 0.07) 0%,
    rgba(255, 255, 255, 0.02) 30%,
    transparent 62%
  );
  opacity: 0;
  transition: opacity 0.8s ease;
  mix-blend-mode: soft-light;
}

body.is-ready .spotlight {
  opacity: 1;
}

@media (hover: none), (pointer: coarse) {
  .cursor {
    display: none;
  }

  body {
    cursor: auto;
  }

  .spotlight {
    background: radial-gradient(
      52% 48% at 54% 40%,
      rgba(255, 255, 255, 0.06) 0%,
      transparent 70%
    );
  }
}

@media (max-width: 700px) {
  .portrait__field {
    width: min(96vw, 520px);
    height: min(86svh, 820px);
    -webkit-mask-image: radial-gradient(
      ellipse 82% 76% at 50% 40%,
      #000 26%,
      rgba(0, 0, 0, 0.85) 52%,
      rgba(0, 0, 0, 0.3) 70%,
      transparent 84%
    );
    mask-image: radial-gradient(
      ellipse 82% 76% at 50% 40%,
      #000 26%,
      rgba(0, 0, 0, 0.85) 52%,
      rgba(0, 0, 0, 0.3) 70%,
      transparent 84%
    );
  }

  .portrait__img,
  .portrait__glitch img {
    object-position: center 12%;
  }

  .brand {
    top: 1.1rem;
    left: 1.1rem;
    letter-spacing: 0.16em;
  }
}

@media (prefers-reduced-motion: reduce) {
  .noise,
  .portrait__img,
  .portrait__glow,
  .boot__line {
    animation: none !important;
  }

  .portrait,
  .brand__char,
  .brand__dot {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
  }

  body.is-ready .boot {
    display: none;
  }
}
