@font-face {
  font-family: Unbounded;
  src: url('assets/unbounded-cyr.woff2') format('woff2');
  font-weight: 650;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: Unbounded;
  src: url('assets/unbounded-latin.woff2') format('woff2');
  font-weight: 650;
  font-display: swap;
  unicode-range: U+0000-00FF, U+2000-206F;
}

.assembly * { box-sizing: border-box; }

.assembly-preview {
  margin: 0;
  color: #f4f4f2;
  background: #191919;
  font: 500 0.83rem/1.3 Manrope, system-ui, sans-serif;
}

.assembly { height: calc(390svh + 100dvh); }
.assembly--portfolio { color: #f4f4f2; }

.scene {
  --progress: 0;
  --light: 0;
  --focus: 0;
  --accent: #f4f4f2;
  --inset: clamp(18px, 3.7vw, 90px);
  --stage-center: calc(65% - 15% * var(--focus));
  position: sticky;
  top: 0;
  height: 100dvh;
  overflow: clip;
  isolation: isolate;
  background: #191919;
}

.scene::before {
  position: absolute;
  inset: 0;
  pointer-events: none;
  content: '';
  background: radial-gradient(ellipse at var(--stage-center) 52%, #f4f4f216, transparent 47%);
  opacity: var(--light);
}

.scene::after {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  content: '';
  background: url('assets/white-grain.png') repeat;
  opacity: 0.1;
}

.assembly--portfolio .scene {
  --inset: var(--pad);
  background: var(--ink);
  font: 500 0.83rem/1.3 Manrope, system-ui, sans-serif;
}

.assembly--portfolio .scene::after { content: none; }

.assembly.is-unavailable { height: auto; }
.assembly.is-unavailable .scene {
  position: relative;
  height: auto;
  padding: var(--head) var(--pad);
}
.assembly.is-unavailable .scene__copy {
  position: static;
  width: auto;
  transform: none;
}
.assembly.is-unavailable .scene__skills { gap: 2rem; }
.assembly.is-unavailable .scene__skill {
  grid-area: auto;
  visibility: visible;
  opacity: 1;
}
.assembly.is-unavailable :is(canvas, .scene__status, .scene__floor) { display: none; }

.scene__copy {
  position: absolute;
  inset: 50% auto auto var(--inset);
  z-index: 3;
  width: min(29vw, 33rem);
  transform: translateY(-50%) translateX(calc(-1.5rem * var(--focus)));
  opacity: clamp(0, calc(1 - 1.85 * var(--focus)), 1);
  pointer-events: none;
}

.scene__skill :is(h1, h2, h3) {
  margin: 0 0 clamp(12px, 2.3svh, 24px);
  padding-bottom: clamp(12px, 2.3svh, 24px);
  border-bottom: 1px solid #ffffff36;
  font: 650 clamp(1.65rem, min(3.05vw, 8svh), 4.25rem)/1.02 Unbounded, Manrope, system-ui, sans-serif;
  letter-spacing: -0.07em;
  text-transform: uppercase;
}

.scene__skills {
  display: grid;
  max-width: 29rem;
}

.scene__skill {
  grid-area: 1 / 1;
  visibility: hidden;
  opacity: 0;
}

.scene__skill.is-current {
  visibility: visible;
  opacity: 1;
}

body:not(.still) .scene.is-ready:not(.is-presented.is-copy-ready) .scene__copy { opacity: 0; }

.scene.is-presented.is-copy-ready .scene__skill.is-current {
  animation: skill-reveal 620ms cubic-bezier(0.17, 0.78, 0.2, 1) both;
}

.scene__skill p {
  margin: 0;
  font-size: clamp(0.93rem, 1.3vw, 1.45rem);
  line-height: 1.45;
  letter-spacing: -0.018em;
  text-wrap: pretty;
}

.scene__skill p + p { margin-top: 0.45em; }

@keyframes skill-reveal {
  0% { opacity: 0; color: #8b8b8b; transform: translateY(9px); }
  28% { opacity: 1; color: #9d9d9d; }
  100% { opacity: 1; color: #f4f4f2; transform: translateY(0); }
}

.scene__floor {
  position: absolute;
  inset: 44% -8% -26%;
  background:
    repeating-radial-gradient(ellipse at var(--stage-center) 37%, transparent 0 48px, #f4f4f220 49px, transparent 50px 59px);
  mask-image: radial-gradient(ellipse at var(--stage-center) 35%, transparent 3%, black 29%, transparent 63%);
  transform: perspective(400px) rotateX(51deg);
  opacity: calc(0.32 + var(--light) * 0.22);
}

.scene__shadow {
  position: absolute;
  width: min(63vw, 1420px);
  height: 14%;
  left: var(--stage-center);
  top: 62%;
  transform: translateX(-50%) rotate(2deg);
  opacity: calc(0.46 + var(--progress) * 0.27);
  background: radial-gradient(ellipse, #070707c0 0%, #07070763 34%, transparent 73%);
}

.scene canvas {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: pan-y pinch-zoom;
}

.scene.is-inspect canvas { cursor: grab; }
.scene.is-dragging canvas { cursor: grabbing; }
.scene canvas:focus-visible { outline: 1px solid var(--accent); outline-offset: -5px; }

@media (pointer: coarse) {
  .assembly--portfolio { height: calc(344svh + 100dvh); }
  body:not(.still) .assembly--portfolio .scene.is-ready { touch-action: pinch-zoom; }
  body:not(.still) .assembly--portfolio .scene.is-scroll-free { touch-action: pan-y pinch-zoom; }
}

@property --assembly-radius {
  syntax: '<percentage>';
  inherits: false;
  initial-value: -1%;
}

.scene__status {
  position: absolute;
  z-index: 4;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 16px;
  margin: 0;
  background: #151515;
  text-align: center;
  pointer-events: none;
}

.scene__status::before {
  content: '';
  width: 54px;
  aspect-ratio: 1;
  margin-inline: auto;
  border: 1px solid #ffffff30;
  border-top-color: #f4f4f2;
  border-radius: 50%;
}

.scene__status[hidden], .scene__status.is-error::before { display: none; }

body:not(.still) .scene__status::before { animation: assembly-orbit 1.15s linear infinite; }

body:not(.still) .scene.is-ready .scene__status {
  mask-image: radial-gradient(circle farthest-corner, transparent var(--assembly-radius), #000 calc(var(--assembly-radius) + 1%));
  animation: assembly-open 780ms cubic-bezier(.32,.02,.16,1) both;
}

@keyframes assembly-orbit { to { transform: rotate(1turn); } }
@keyframes assembly-open { to { --assembly-radius: 101%; } }

.scene__cue,
.scene__phase {
  position: absolute;
  z-index: 3;
  bottom: calc(var(--inset) + 17px);
  margin: 0;
  pointer-events: none;
  color: #e4e4e4;
}

.scene__cue {
  left: var(--inset);
  display: flex;
  min-height: 22px;
  align-items: center;
  gap: 10px;
}

.scene__phase {
  right: var(--inset);
  min-height: 22px;
  display: flex;
  align-items: center;
  gap: 9px;
  font-variant-numeric: tabular-nums;
}

.scene__phase::before {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  content: '';
}

.scene__scroll-icon {
  position: relative;
  width: 12px;
  height: 22px;
  border: 1px solid #f4f4f27a;
  border-radius: 999px;
}

.scene__scroll-icon::before {
  position: absolute;
  width: 4px;
  height: 4px;
  top: 4px;
  left: 3px;
  content: '';
  border-radius: 50%;
  background: var(--accent);
  animation: scroll-cue 1.65s ease-in-out infinite;
}

.scene__orbit-icon {
  position: relative;
  display: none;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  border: 1px solid #f4f4f255;
  background: radial-gradient(circle, var(--accent) 0 2px, transparent 3px);
  animation: orbit-pulse 1.85s ease-in-out infinite;
}

.scene__orbit-icon::before {
  position: absolute;
  inset: 14px 6px;
  border: 1px solid currentColor;
  border-radius: 50%;
  transform: rotate(-24deg);
  content: '';
}

.scene__orbit-icon::after {
  position: absolute;
  top: 14px;
  right: 7px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  content: '';
}

.scene.is-inspect .scene__cue {
  left: 50%;
  transform: translateX(-50%);
}

.scene.is-inspect .scene__phase,
.scene.is-inspect .scene__cue span,
.scene.is-inspect .scene__scroll-icon { display: none; }
.scene.is-inspect .scene__orbit-icon { display: block; }
.scene.is-dragging .scene__orbit-icon { animation-play-state: paused; }

@keyframes scroll-cue {
  0%, 100% { opacity: 0.45; transform: translateY(0); }
  65% { opacity: 1; transform: translateY(7px); }
}

@keyframes orbit-pulse {
  0%, 100% { opacity: 0.5; transform: scale(0.94); }
  55% { opacity: 1; transform: scale(1); }
}

.scene:not(.is-ready) :is(.scene__cue, .scene__phase, .scene__shadow) { visibility: hidden; }

@media (max-aspect-ratio: 5/4) {
  .scene { --stage-center: 50%; }
  .scene__copy {
    inset: auto var(--inset) calc(var(--inset) + clamp(50px, 11svh, 120px));
    width: auto;
    transform: translateY(calc(14px * var(--focus)));
  }
  .scene__skill :is(h1, h2, h3) {
    font-size: clamp(1.65rem, min(7.25vw, 6svh), 4.25rem);
  }
  .scene__skills { max-width: 28rem; }
  .scene.is-inspect .scene__cue { bottom: 19svh; }
  .scene__floor { inset: 38% -45% -10%; }
  .scene__shadow { width: 94vw; top: 47%; }
}

@media (max-height: 460px) {
  .scene { --inset: 18px; }
  .scene__orbit-icon { width: 36px; height: 36px; }
  .scene__orbit-icon::before { inset: 11px 5px; }
  .scene__orbit-icon::after { top: 11px; right: 6px; }
}

