:root {
  --stage-ratio: 2.0005;
  --stage-width: min(100vw, calc(100vh * var(--stage-ratio)));
  --stage-height: min(100vh, calc(100vw / var(--stage-ratio)));
  --ink: #050505;
  --paper: #ffffff;
  --focus: rgba(255, 255, 255, 0.72);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: "Dream Han Sans CN", "Noto Sans SC", "Microsoft YaHei", Arial, sans-serif;
}

body {
  overflow: hidden;
}

[hidden] {
  display: none !important;
}

button {
  border: 0;
  padding: 0;
  font: inherit;
}

.portfolio-page,
.blank-page {
  width: 100vw;
  height: 100vh;
  min-height: 100svh;
  display: grid;
  place-items: center;
  background: var(--ink);
}

.stage {
  position: relative;
  width: var(--stage-width);
  height: var(--stage-height);
  overflow: hidden;
  background: var(--ink);
  isolation: isolate;
}

.stage-art {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  object-fit: contain;
  opacity: 0;
  transform: scale(1.025);
  transform-origin: 50% 50%;
  will-change: transform, opacity;
}

.stage-frame {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: var(--ink);
}

.stage.is-ready .stage-art {
  opacity: 1;
  transform: scale(1);
}

html:not(.gsap-active) .stage-art {
  animation: fallback-art 0.8s ease-out 2.2s forwards;
}

.intro-curtain {
  position: absolute;
  inset: 0;
  z-index: 10;
  background: var(--ink);
  transform-origin: 100% 50%;
  will-change: transform, opacity;
  pointer-events: none;
}

html:not(.gsap-active) .intro-curtain {
  animation: fallback-curtain 0.82s ease-in-out 2.35s forwards;
}

.text-mask {
  position: absolute;
  z-index: 3;
  display: block;
  background: var(--ink);
  transform-origin: 100% 50%;
  will-change: transform, opacity;
  pointer-events: none;
}

html:not(.gsap-active) .text-mask {
  animation: fallback-mask 0.56s ease-out 2.95s forwards;
}

.text-mask-small-title {
  left: 7.6%;
  top: 3.8%;
  width: 19.3%;
  height: 3.3%;
}

.text-mask-title {
  left: 71.2%;
  top: 10.4%;
  width: 25.2%;
  height: 5.6%;
}

.text-mask-about {
  left: 7.4%;
  top: 86.1%;
  width: 18.2%;
  height: 5.4%;
}

.text-mask-works {
  left: 82%;
  top: 86.1%;
  width: 13.7%;
  height: 5.4%;
}

.text-mask-about,
.text-mask-works {
  display: none;
}

.text-target {
  position: absolute;
  z-index: 5;
  display: block;
  background: transparent;
}

.text-target-small-title {
  left: 7.5%;
  top: 2.8%;
  width: 13.4%;
  height: 5%;
}

.text-target-main-title {
  left: 6.8%;
  top: 9.2%;
  width: 86%;
  height: 26.8%;
}

.text-target-header-title {
  left: 72%;
  top: 10.7%;
  width: 21.7%;
  height: 6%;
}

.text-target::after,
.hotspot::after {
  content: none;
}

.text-target.is-crosshair-target::after,
.hotspot.is-crosshair-target::after {
  opacity: 0;
}

.music-toggle {
  position: absolute;
  z-index: 6;
  left: 89.678752%;
  top: 3.125%;
  width: 3.722116%;
  height: 3.477344%;
  display: block;
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 0;
  background: transparent;
  color: transparent;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: none;
  transform-origin: 50% 50%;
  box-shadow: none;
  container-type: size;
  overflow: visible;
  will-change: transform, opacity;
  -webkit-tap-highlight-color: transparent;
}

.stage.is-ready .music-toggle {
  pointer-events: auto;
}

.music-toggle::before {
  content: "";
  position: absolute;
  inset: -92% -140%;
}

.music-toggle::after {
  content: "\266A";
  position: absolute;
  top: 4%;
  right: 2.4%;
  display: grid;
  place-items: center;
  width: auto;
  height: 92%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  font-size: 80%;
  line-height: 1;
  opacity: 0;
  transform-origin: 50% 50%;
}

html.no-gsap .stage.is-ready .music-toggle {
  opacity: 1;
  visibility: visible;
}

.music-toggle:focus-visible,
.hotspot:focus-visible {
  outline: none;
}

.music-note {
  display: none;
  place-items: center;
  position: absolute;
  z-index: 1;
  top: 4%;
  right: 2.4%;
  width: auto;
  height: 92%;
  aspect-ratio: 1;
  margin: 0;
  border-radius: 50%;
  background: var(--ink);
  color: transparent;
  font-size: clamp(10px, 70%, 18px);
  line-height: 1;
  transform-origin: 50% 50%;
  will-change: transform;
}

.music-note::before {
  content: none;
}

.music-note-glyph {
  display: block;
  width: 74%;
  height: 74%;
  overflow: visible;
  fill: var(--paper);
  pointer-events: none;
  transform-origin: center;
}

@supports (width: 1cqh) {
  .music-toggle::after {
    width: 92cqh;
    height: 92cqh;
    font-size: 72cqh;
  }
}

.music-toggle.is-playing::after {
  opacity: 1;
  animation: music-spin 1.2s linear infinite;
}

.hotspot {
  position: absolute;
  z-index: 5;
  background: transparent;
  cursor: pointer;
}

.hotspot-about {
  left: 6.2%;
  bottom: 2.2%;
  width: 23.5%;
  height: 16.5%;
}

.hotspot-works {
  right: 6.1%;
  bottom: 2.2%;
  width: 23.8%;
  height: 16.5%;
}

.mobile-nav {
  display: none;
}

.mobile-cover {
  display: none;
}

.mobile-stage-art {
  display: none;
}

body[data-view="works"] .stage-art,
body[data-view="works"] .text-mask,
body[data-view="works"] .text-target,
body[data-view="works"] .hotspot,
body[data-view="works"] .intro-curtain,
body[data-view="works"] .crosshair {
  display: none;
}

body[data-view="works"] .music-toggle {
  display: block;
}

.crosshair {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: none;
  pointer-events: none;
  color: var(--paper);
}

.crosshair-filter {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.crosshair-line {
  position: absolute;
  display: block;
  background: currentColor;
  opacity: 0;
  pointer-events: none;
  mix-blend-mode: difference;
  will-change: transform, opacity, filter;
}

.crosshair-line-horizontal {
  left: 0;
  top: 0;
  width: 100%;
  height: 1px;
}

.crosshair-line-vertical {
  left: 0;
  top: 0;
  width: 1px;
  height: 100%;
}

.crosshair-core {
  position: absolute;
  left: 0;
  top: 0;
  width: 13px;
  aspect-ratio: 1;
  border: 1px solid currentColor;
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  mix-blend-mode: difference;
  transform: translate(-50%, -50%);
  will-change: transform, opacity;
}

.crosshair.is-targeting .crosshair-line {
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.45);
}

.crosshair.is-targeting .crosshair-core {
  box-shadow: 0 0 18px rgba(255, 255, 255, 0.5);
}

@media (hover: hover) and (pointer: fine) {
  .stage,
  .stage button,
  .text-target {
    cursor: none;
  }

  .crosshair {
    display: block;
  }
}

.blank-page {
  position: relative;
}

.works-page::before,
.works-page::after {
  content: none;
}

.works-art {
  display: block;
  width: var(--stage-width);
  height: var(--stage-height);
  object-fit: contain;
}

.inline-page {
  position: fixed;
  inset: 0;
  z-index: 20;
}

.blank-page::before,
.blank-page::after {
  content: "";
  position: fixed;
  width: 24px;
  aspect-ratio: 1;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  pointer-events: none;
}

.blank-page::before {
  left: 2.5rem;
  top: 2.5rem;
}

.blank-page::after {
  right: 2.5rem;
  bottom: 2.5rem;
}

@keyframes music-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes fallback-art {
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes fallback-curtain {
  to {
    transform: scaleX(0);
  }
}

@keyframes fallback-mask {
  to {
    transform: scaleX(0);
  }
}

@keyframes fallback-button {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.92);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .stage-art,
  .intro-curtain,
  .music-toggle {
    transition: none;
    animation-duration: 0.001ms;
    animation-iteration-count: 1;
  }

  .music-toggle.is-playing::after {
    animation-duration: 0.001ms;
    animation-iteration-count: 1;
  }
}

@media (max-width: 700px), (max-aspect-ratio: 3/4) {
  :root {
    --mobile-pad: clamp(18px, 5.2vw, 28px);
    --mobile-stage-ratio: 0.464455;
    --mobile-stage-width: min(100vw, calc(100svh * var(--mobile-stage-ratio)));
    --mobile-stage-height: min(100svh, calc(100vw / var(--mobile-stage-ratio)));
  }

  html,
  body {
    height: 100%;
    min-height: 100%;
    overflow-x: hidden;
  }

  body {
    overflow-y: hidden;
  }

  .portfolio-page {
    display: grid;
    place-items: start center;
    width: 100%;
    min-height: 100svh;
    height: 100svh;
  }

  .stage {
    width: var(--mobile-stage-width);
    height: var(--mobile-stage-height);
    min-height: 0;
    margin: 0 auto;
    overflow: hidden;
  }

  .stage-art {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: contain;
    object-position: center;
    transform: scale(1);
  }

  .mobile-stage-art {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: block;
    width: 100%;
    height: 100%;
    overflow: hidden;
  }

  .mobile-stage-art svg {
    display: block;
    width: 100%;
    height: 100%;
  }

  .stage.has-mobile-svg > picture {
    display: none;
  }

  .stage.is-ready .stage-art {
    transform: scale(1);
  }

  .hotspot,
  .text-target {
    display: none;
  }

  .text-mask {
    display: none;
  }

  .music-toggle {
    position: absolute;
    z-index: 20;
    left: 87.289796%;
    right: auto;
    top: 1.001896%;
    width: 10.669388%;
    height: 2.313744%;
    min-width: 0;
    min-height: 0;
    background: transparent;
    color: transparent;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto;
    transform: none;
    animation: none !important;
  }

  .music-toggle::before {
    inset: -92% -140%;
  }

  .music-note {
    display: none !important;
    top: 0;
    right: 0;
    width: auto;
    height: 100%;
    aspect-ratio: 1;
    border-radius: 50%;
    background: var(--ink);
    color: transparent;
    transform-origin: 50% 50%;
  }

  .music-note::before {
    content: none;
  }

  .mobile-nav {
    position: absolute;
    z-index: 11;
    inset: 0;
    display: block;
    pointer-events: none;
  }

  .mobile-nav-link {
    position: absolute;
    display: block;
    min-height: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: transparent;
    font-size: 0;
    line-height: 1;
    text-decoration: none;
    box-shadow: none;
    pointer-events: auto;
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-nav-link:first-child {
    left: 2%;
    top: 85.18%;
    width: 36.73%;
    height: 8.12%;
  }

  .mobile-nav-link:last-child {
    left: 61.23%;
    top: 85.18%;
    width: 36.73%;
    height: 8.12%;
  }

  .mobile-nav-link::after {
    content: none;
  }

  .crosshair {
    display: none;
  }
}
