:root {
  --paper: #fafafa;
  --ink: #111111;
  --muted: #9a9a9a;
  --line: rgba(0, 0, 0, 0.12);
  --panel: rgba(255, 255, 255, 0.68);
  --shadow: rgba(20, 20, 20, 0.18);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family:
    Arial,
    "PingFang SC",
    "Microsoft YaHei",
    sans-serif;
  letter-spacing: 0;
}

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

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 20;
  width: min(100%, 28rem);
  padding: 0.25rem;
}

.top-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.25rem;
}

.nav-button,
.bottom-switch,
.index-panel,
.detail-panel {
  position: relative;
  border: 0;
  background: transparent;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

.nav-button::before,
.bottom-switch::before,
.index-panel::before,
.detail-panel::before {
  position: absolute;
  inset: 0;
  border: 1px solid currentColor;
  border-radius: inherit;
  content: "";
  opacity: 0.13;
  pointer-events: none;
}

.nav-button::after,
.bottom-switch::after,
.index-panel::after,
.detail-panel::after {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background-color: currentColor;
  content: "";
  opacity: 0.03;
  pointer-events: none;
}

.nav-button {
  display: flex;
  min-height: 3.15rem;
  align-items: flex-end;
  gap: 0.125rem;
  padding: 0.55rem 0.65rem;
  border-radius: 0.375rem;
  color: rgba(0, 0, 0, 0.35);
  font-size: 0.68rem;
  line-height: 1;
  text-transform: uppercase;
  transition:
    color 180ms ease,
    border-color 180ms ease,
    background 180ms ease;
}

.nav-button:hover,
.nav-button.active {
  color: var(--ink);
}

.nav-button small {
  transform: translateY(-0.18rem);
  font-size: 0.6rem;
}

.nav-button span,
.nav-button small,
.switch-button,
.index-panel a {
  position: relative;
  z-index: 1;
}

.wide-label {
  display: inline-flex;
  margin-left: 0.2rem;
}

.portfolio-shell {
  position: relative;
  min-height: 100vh;
}

.stage-section {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 0;
}

.stage {
  position: relative;
  width: 100vw;
  height: 100svh;
  pointer-events: auto;
}

.site-header,
.bottom-switch,
.index-panel,
.three-canvas,
.three-vignette {
  transition:
    opacity 900ms ease,
    filter 900ms ease;
}

body.intro-active .site-header,
body.intro-active .bottom-switch,
body.intro-active .index-panel,
body.intro-active .three-canvas,
body.intro-active .three-vignette {
  opacity: 0;
  filter: blur(10px);
  pointer-events: none;
}

.three-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  display: block;
  width: 100vw;
  height: 100svh;
  background: transparent;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.three-canvas:active {
  cursor: grabbing;
}

.three-vignette {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(
    45deg,
    #fafafa,
    #fafafa 1%,
    transparent 25%,
    transparent 75%,
    #fafafa
  );
  opacity: 0.75;
}

.intro-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: rgba(250, 250, 250, 0.92);
  color: var(--ink);
  pointer-events: none;
  transition:
    opacity 1200ms ease,
    filter 1200ms ease;
}

.intro-overlay.is-fading {
  opacity: 0;
  filter: blur(28px);
}

.intro-overlay.is-hidden {
  display: none;
}

.intro-word {
  position: absolute;
  margin: 0;
  opacity: 0;
  transform: translateY(0.35rem) scale(0.98);
  font-family:
    Arial,
    "PingFang SC",
    "Microsoft YaHei",
    sans-serif;
  font-size: clamp(1.35rem, 4vw, 3.4rem);
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1;
  text-transform: lowercase;
  transition:
    opacity 520ms ease,
    transform 520ms cubic-bezier(0.215, 0.61, 0.355, 1),
    filter 520ms ease;
}

.intro-word.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.intro-word.is-leaving {
  opacity: 0;
  filter: blur(10px);
  transform: translateY(-0.35rem) scale(1.02);
}

.detail-panel {
  display: none;
}

.panel-index,
.panel-kicker {
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.3;
  text-transform: uppercase;
}

.detail-panel h1 {
  margin: 0.8rem 0 0;
  font-size: clamp(1.45rem, 3vw, 2.6rem);
  font-weight: 400;
  line-height: 1;
}

.detail-panel p:not(.panel-index, .panel-kicker) {
  margin: 0.7rem 0 0;
  max-width: 18rem;
  color: rgba(0, 0, 0, 0.52);
  font-size: 0.78rem;
  line-height: 1.55;
}

.panel-link {
  display: inline-flex;
  margin-top: 0.9rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.28);
  color: rgba(0, 0, 0, 0.74);
  font-size: 0.82rem;
  line-height: 1.4;
}

.bottom-switch {
  position: fixed;
  right: 0.25rem;
  bottom: 0.25rem;
  z-index: 30;
  display: flex;
  min-height: 2.2rem;
  gap: 0.85rem;
  align-items: center;
  padding: 0 0.75rem;
  border-radius: 0.375rem;
}

.switch-button {
  appearance: none;
  border: 0;
  background: transparent;
  color: rgba(0, 0, 0, 0.34);
  cursor: pointer;
  font: inherit;
  font-size: 0.68rem;
  line-height: 1;
  text-transform: uppercase;
}

.switch-button.active {
  color: var(--ink);
}

.index-panel {
  position: fixed;
  right: 0.25rem;
  bottom: 2.8rem;
  z-index: 28;
  display: grid;
  width: min(18rem, calc(100vw - 0.5rem));
  border-radius: 0.375rem;
  opacity: 0;
  transform: translateY(0.75rem);
  pointer-events: none;
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.index-panel.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.index-panel a {
  display: grid;
  grid-template-columns: 2.5rem 1fr;
  gap: 0.75rem;
  align-items: center;
  min-height: 2.45rem;
  padding: 0 0.8rem;
  border-bottom: 1px solid var(--line);
}

.index-panel a:last-child {
  border-bottom: 0;
}

.index-panel span {
  color: var(--muted);
  font-size: 0.66rem;
}

.index-panel strong {
  font-size: 0.78rem;
  font-weight: 400;
}

@media (max-width: 920px) {
  body {
    overflow: hidden;
  }

  .site-header {
    width: min(100%, 28rem);
  }

  .top-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .nav-button {
    min-height: 3rem;
    padding: 0.5rem 0.55rem;
    font-size: 0.64rem;
  }

  .wide-label,
  .nav-button small {
    display: none;
  }

  .portfolio-shell {
    min-height: 100vh;
  }

  .stage-section {
    position: fixed;
    min-height: 100vh;
    padding-top: 0;
    overflow: hidden;
  }

  .stage {
    width: 100vw;
    height: 100vh;
  }

  .detail-panel {
    display: none;
  }
}

@media (max-width: 560px) {
  .top-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .nav-button {
    min-height: 2.8rem;
  }

  .stage-section {
    min-height: 100vh;
    padding-top: 0;
  }

  .stage {
    width: 100vw;
    height: 100vh;
  }

  .photo-plane {
    width: 14.5rem;
  }

  .plane-intro {
    --plane-x: -9rem;
    --plane-y: 11rem;
    --plane-z: 180px;
  }

  .plane-writing {
    --plane-x: -4.5rem;
    --plane-y: 5.5rem;
    --plane-z: 90px;
  }

  .plane-copywriting {
    --plane-x: 0rem;
    --plane-y: 0rem;
    --plane-z: 0px;
  }

  .plane-media {
    --plane-x: 4.5rem;
    --plane-y: -5.5rem;
    --plane-z: -90px;
  }

  .plane-film {
    --plane-x: 9rem;
    --plane-y: -11rem;
    --plane-z: -180px;
  }

  .bottom-switch {
    left: auto;
    right: 0.25rem;
    justify-content: center;
  }
}

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