:root {
  color-scheme: dark;
  --black: #030506;
  --white: #f4f7f7;
  --cyan: #59d9e8;
  --mono: "SFMono-Regular", "Cascadia Mono", "Liberation Mono", Menlo, Consolas, monospace;
  --sans: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --jp-sans: "Noto Sans JP", "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --ion-ignition: 910ms;
  --ion-contact: 1000ms;
  --ion-impact: 1820ms;
  --ion-load-duration: 820ms;
  --copy-in: 1900ms;
  --japanese-in: 2080ms;
  --cta-in: 2380ms;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --load-ease: cubic-bezier(0.65, 0, 0.35, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--black);
  color: var(--white);
}

body {
  min-width: 20rem;
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  -webkit-tap-highlight-color: transparent;
}

:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 4px;
}

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

.world {
  position: relative;
  isolation: isolate;
  width: 100%;
  height: 100dvh;
  min-height: 28rem;
  overflow: hidden;
  background: var(--black);
}

.world-canvas,
.text-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.world-canvas {
  z-index: 0;
  background: var(--black);
}

.text-canvas {
  z-index: 1;
  background: transparent;
}

.center-stage {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: max(var(--space-4), env(safe-area-inset-top)) max(var(--space-5), env(safe-area-inset-right)) max(var(--space-4), env(safe-area-inset-bottom)) max(var(--space-5), env(safe-area-inset-left));
  pointer-events: none;
}

.identity {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.signature {
  display: grid;
  width: max-content;
  justify-items: center;
}

.threshold-mark {
  position: relative;
  isolation: isolate;
  width: 4.5rem;
  height: 6.75rem;
  opacity: 0;
  transform: translateY(var(--space-2));
  animation: threshold-in 420ms var(--ion-ignition) var(--ease-out) forwards;
}

.threshold-mark::before {
  position: absolute;
  inset: -1.75rem -2.5rem -2.25rem;
  z-index: -1;
  background: radial-gradient(
    ellipse at 50% 62%,
    rgb(89 217 232 / 16%) 0%,
    rgb(89 217 232 / 6%) 34%,
    rgb(89 217 232 / 0%) 72%
  );
  content: "";
  opacity: 0;
  transform: scale(0.94);
  animation: cyan-afterglow 560ms var(--ion-impact) var(--ease-out) forwards;
}

.threshold-frame,
.threshold-door {
  position: absolute;
  display: block;
}

.threshold-frame {
  z-index: 2;
  display: none;
}

.threshold-frame-1 {
  inset: 0.05rem 0 0;
  display: block;
  border: 1px solid rgb(89 217 232 / 58%);
  border-bottom: 0;
}

.threshold-door {
  inset: 1.55rem 1.5rem 0;
  z-index: 1;
  background: var(--white);
  clip-path: inset(100% 0 0);
  filter: drop-shadow(0 0 0 rgb(244 247 247 / 0%));
  transform-origin: bottom;
  animation: cursor-load var(--ion-load-duration) var(--ion-contact) var(--load-ease) forwards;
}

.threshold-bar {
  display: block;
  height: 1px;
  justify-self: stretch;
  margin-bottom: var(--space-3);
  background: linear-gradient(90deg, transparent, rgb(244 247 247 / 45%) 12%, rgb(244 247 247 / 82%) 50%, rgb(244 247 247 / 45%) 88%, transparent);
  box-shadow: 0 0 0.6rem rgb(244 247 247 / 14%);
  transform: scaleX(0);
  transform-origin: center;
  animation: horizon-grow 420ms var(--ion-impact) var(--ease-out) forwards;
}

.identity h1,
.tagline,
.japanese-line {
  opacity: 0;
  transform: translateY(var(--space-2));
}

.identity h1 {
  margin: 0;
  color: var(--white);
  font-family: var(--mono);
  font-size: clamp(1.5rem, 2.5vw, 2rem);
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.125em;
  text-indent: 0.125em;
  white-space: nowrap;
  animation: identity-in 620ms var(--copy-in) var(--ease-out) forwards;
}

.tagline {
  margin: var(--space-2) 0 0;
  color: rgb(244 247 247 / 62%);
  font-family: var(--mono);
  font-size: 0.875rem;
  line-height: 1;
  letter-spacing: 0.125em;
  text-transform: uppercase;
  animation: identity-in 620ms var(--copy-in) var(--ease-out) forwards;
}

.japanese-line {
  margin: var(--space-3) 0 0;
  color: var(--cyan);
  font-family: var(--jp-sans);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: 0;
  animation: identity-in 620ms var(--japanese-in) var(--ease-out) forwards;
}

.github-link {
  display: inline-flex;
  min-height: 2.75rem;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  margin-top: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border: 1px solid rgb(244 247 247 / 26%);
  border-radius: var(--space-1);
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: var(--black);
  color: var(--white);
  font-family: var(--sans);
  font-size: 0.875rem;
  font-weight: 620;
  line-height: 1;
  text-decoration: none;
  pointer-events: auto;
  opacity: 0;
  transform: translateY(var(--space-2));
  animation: identity-in 620ms var(--cta-in) var(--ease-out) forwards;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 120ms ease;
}

.github-link::before {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--white);
  content: "";
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 720ms var(--ease-out);
}

.github-mark {
  width: 1.05rem;
  height: 1.05rem;
  flex: 0 0 auto;
}

.github-link:active {
  transform: scale(0.975);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.no-script {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  background: var(--black);
  color: var(--white);
}

.no-script pre {
  font-family: var(--mono);
  line-height: 1.5;
}

@keyframes threshold-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes identity-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes cursor-load {
  0% {
    clip-path: inset(100% 0 0);
    filter: drop-shadow(0 0 0 rgb(244 247 247 / 0%));
  }
  70% {
    filter: drop-shadow(0 0 0.62rem rgb(244 247 247 / 58%));
  }
  100% {
    clip-path: inset(0);
    filter: drop-shadow(0 0 0.32rem rgb(244 247 247 / 20%));
  }
}

@keyframes cyan-afterglow {
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes horizon-grow {
  to { transform: scaleX(1); }
}

@media (hover: hover) and (pointer: fine) {
  .github-link:hover {
    border-color: var(--white);
    color: var(--black);
  }

  .github-link:hover::before {
    transform: scaleX(1);
  }
}

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