:root {
  --ink: #f6f0df;
  --muted: rgba(246, 240, 223, 0.68);
  --glass: rgba(12, 18, 14, 0.46);
  --line: rgba(246, 240, 223, 0.2);
  font-family: "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  background: #060907;
}

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

button {
  color: inherit;
  font: inherit;
}

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

img {
  display: block;
  max-width: 100%;
}

.stage {
  min-height: 100svh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 12%, rgba(236, 220, 172, 0.16), transparent 26%),
    linear-gradient(140deg, #141915, #050706 68%);
}

.viewport {
  position: relative;
  width: min(100vw, 430px);
  height: min(100svh, 932px);
  overflow: hidden;
  isolation: isolate;
  cursor: grab;
  touch-action: none;
  user-select: none;
  background: #0a110d;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.5);
}

.viewport.is-dragging {
  cursor: grabbing;
}

.world,
.light-wash,
.dust-veil,
.detail {
  position: absolute;
  inset: 0;
}

.world {
  z-index: 0;
  overflow: hidden;
}

.world canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.viewport::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    radial-gradient(ellipse at 50% 48%, transparent 42%, rgba(0, 0, 0, 0.08) 86%),
    linear-gradient(90deg, rgba(0, 0, 0, 0.12), transparent 22%, transparent 78%, rgba(0, 0, 0, 0.12));
  pointer-events: none;
}

.light-wash {
  z-index: 2;
  opacity: 0.58;
  background:
    linear-gradient(116deg, transparent 0 34%, rgba(255, 238, 184, 0.18) 40%, transparent 52%),
    linear-gradient(108deg, transparent 0 42%, rgba(255, 248, 218, 0.12) 48%, transparent 60%),
    radial-gradient(ellipse at 54% 28%, rgba(255, 248, 220, 0.16), transparent 24%);
  mix-blend-mode: screen;
  pointer-events: none;
  animation: light-breathe 6s ease-in-out infinite;
}

.dust-veil {
  z-index: 3;
  opacity: 0.12;
  background:
    radial-gradient(circle at 18% 22%, rgba(255, 248, 222, 0.18) 0 0.08rem, transparent 0.11rem),
    radial-gradient(circle at 72% 38%, rgba(255, 248, 222, 0.13) 0 0.06rem, transparent 0.1rem),
    radial-gradient(circle at 42% 76%, rgba(255, 248, 222, 0.16) 0 0.07rem, transparent 0.12rem),
    radial-gradient(ellipse at 50% 42%, rgba(235, 226, 198, 0.12), transparent 42%);
  background-size: 8.2rem 9.4rem, 11.3rem 10.6rem, 9.5rem 12.4rem, 100% 100%;
  mix-blend-mode: screen;
  pointer-events: none;
  filter: blur(0.35px);
  animation: dust-drift 11s ease-in-out infinite;
}

.chrome {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 4;
  pointer-events: none;
}

@keyframes light-breathe {
  0%,
  100% {
    opacity: 0.48;
    filter: blur(0);
  }

  50% {
    opacity: 0.68;
    filter: blur(0.4px);
  }
}

@keyframes dust-drift {
  0%,
  100% {
    opacity: 0.08;
    background-position: 0 0, 0 0, 0 0, center;
    transform: translate3d(0, 0, 0);
  }

  37% {
    opacity: 0.13;
    background-position: 0.7rem -0.4rem, -0.5rem 0.65rem, 0.25rem 0.85rem, center;
    transform: translate3d(0.18rem, -0.12rem, 0);
  }

  71% {
    opacity: 0.1;
    background-position: -0.45rem 0.55rem, 0.85rem -0.35rem, -0.65rem 0.15rem, center;
    transform: translate3d(-0.12rem, 0.16rem, 0);
  }
}

.chrome--top {
  top: 0;
  height: calc(5.8rem + env(safe-area-inset-top));
  background: linear-gradient(180deg, rgba(4, 7, 5, 0.34), rgba(4, 7, 5, 0.16) 58%, transparent);
}

.chrome--bottom {
  bottom: 0;
  height: calc(6.4rem + env(safe-area-inset-bottom));
  background: linear-gradient(0deg, rgba(4, 7, 5, 0.38), rgba(4, 7, 5, 0.16) 62%, transparent);
}

.hud {
  position: absolute;
  z-index: 7;
  pointer-events: none;
}

.hud > * {
  pointer-events: auto;
}

.hud--top {
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: calc(0.9rem + env(safe-area-inset-top)) 0.9rem 0.65rem;
}

.brand {
  margin: 0;
  text-align: center;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.7);
}

.brand span,
.brand small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand span {
  font-size: 0.98rem;
  letter-spacing: 0.08em;
}

.hud-button,
.hud--bottom a,
.detail__close {
  border: 1px solid var(--line);
  background: var(--glass);
  color: var(--ink);
  backdrop-filter: blur(14px);
}

.hud-button {
  width: 2.7rem;
  height: 2.7rem;
  display: grid;
  place-items: center;
  border-radius: 999px;
}

.hud-button[aria-pressed="true"] {
  background: rgba(231, 213, 161, 0.22);
}

.hud--bottom {
  left: 50%;
  bottom: calc(1rem + env(safe-area-inset-bottom));
  display: flex;
  gap: 0.45rem;
  transform: translateX(-50%);
}

.hud--bottom a {
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  border-radius: 999px;
  font-family: system-ui, sans-serif;
  font-size: 0.78rem;
}

.detail {
  z-index: 10;
  display: block;
  padding: calc(3.8rem + env(safe-area-inset-top)) 0.8rem calc(2.85rem + env(safe-area-inset-bottom));
  background:
    radial-gradient(circle at 50% 22%, rgba(245, 231, 184, 0.18), transparent 34%),
    rgba(4, 7, 5, 0.82);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  backdrop-filter: blur(12px);
  transition: opacity 220ms ease, visibility 220ms ease;
}

.detail.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.detail__close {
  position: absolute;
  right: 0.9rem;
  top: calc(0.9rem + env(safe-area-inset-top));
  width: 2.7rem;
  height: 2.7rem;
  border-radius: 999px;
  font-size: 1.25rem;
}

.detail__kicker {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.detail h1 {
  margin: 0;
  font-size: clamp(1.7rem, 8vw, 2.4rem);
  font-weight: 500;
  line-height: 1.08;
}

.detail__header {
  position: relative;
  z-index: 2;
  max-width: 18rem;
  transition: opacity 180ms ease, transform 180ms ease;
}

.detail.is-focused .detail__header {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-0.4rem);
}

.photo-scatter {
  position: absolute;
  inset: calc(5.6rem + env(safe-area-inset-top)) 0.35rem calc(2.3rem + env(safe-area-inset-bottom));
  z-index: 1;
  transition: opacity 220ms ease, filter 220ms ease, transform 220ms ease;
}

.detail.is-focused .photo-scatter {
  opacity: 0.22;
  filter: blur(3px);
  transform: scale(0.98);
}

.photo-card {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--w);
  padding: 0.18rem 0.18rem 0.5rem;
  border: 0;
  border-radius: 0.18rem;
  background: #efe8d7;
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.36);
  transform: translate(-50%, -50%) rotate(var(--r)) scale(var(--s));
  transform-origin: center center;
  cursor: pointer;
  animation:
    photo-land 1850ms cubic-bezier(0.18, 0.72, 0.16, 1) both,
    photo-float var(--float-duration) ease-in-out infinite;
  animation-delay: var(--delay);
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    opacity 180ms ease;
}

.photo-card:active,
.photo-card:focus-visible {
  transform: translate(-50%, -50%) rotate(var(--r)) scale(calc(var(--s) + 0.05));
  box-shadow: 0 22px 44px rgba(0, 0, 0, 0.44);
  outline: none;
}

.photo-card img {
  width: 100%;
  aspect-ratio: var(--ratio);
  object-fit: cover;
  background: rgba(23, 19, 14, 0.14);
}

.photo-card span {
  position: absolute;
  left: 0.28rem;
  right: 0.28rem;
  bottom: 0.13rem;
  overflow: hidden;
  color: rgba(31, 28, 24, 0.72);
  font-size: 0.42rem;
  letter-spacing: 0.08em;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.photo-card--book {
  padding: 0.26rem 0.22rem 0.76rem;
  border-radius: 0.12rem 0.26rem 0.26rem 0.12rem;
  background:
    linear-gradient(90deg, rgba(40, 30, 24, 0.28), transparent 13%),
    #efe7d4;
  box-shadow:
    inset 0.22rem 0 0 rgba(44, 35, 29, 0.28),
    inset 0.3rem 0 0 rgba(255, 255, 255, 0.18),
    0 18px 34px rgba(0, 0, 0, 0.36);
}

.photo-card--book::after {
  content: "";
  position: absolute;
  top: 0.28rem;
  right: -0.18rem;
  bottom: 0.28rem;
  width: 0.2rem;
  border-radius: 0 0.14rem 0.14rem 0;
  background: rgba(238, 229, 204, 0.72);
}

.photo-card--book span {
  color: rgba(32, 25, 20, 0.82);
  font-size: 0.48rem;
  letter-spacing: 0.06em;
}

.photo-focus {
  position: absolute;
  z-index: 4;
  left: 50%;
  top: 50%;
  width: min(88%, 23rem);
  max-height: calc(100% - 7.2rem);
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 0.42rem;
  padding: 0.65rem;
  border: 1px solid rgba(246, 240, 223, 0.2);
  border-radius: 0.48rem;
  background: rgba(13, 17, 14, 0.78);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.54);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate(-50%, -46%) scale(0.86);
  transition:
    opacity 220ms ease,
    visibility 220ms ease,
    transform 240ms cubic-bezier(0.22, 0.72, 0.18, 1);
}

.detail.is-focused .photo-focus {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.photo-focus img {
  min-height: 0;
  width: 100%;
  height: 100%;
  max-height: 58vh;
  object-fit: contain;
  border-radius: 0.28rem;
  background: rgba(241, 229, 199, 0.06);
}

.youtube-panel {
  display: grid;
  gap: 0.5rem;
}

.youtube-panel[hidden] {
  display: none;
}

.youtube-panel iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: 0.28rem;
  background: rgba(241, 229, 199, 0.06);
}

.youtube-panel a {
  justify-self: start;
  padding: 0.42rem 0.72rem;
  border: 1px solid rgba(246, 240, 223, 0.22);
  border-radius: 999px;
  background: rgba(246, 240, 223, 0.08);
  color: var(--ink);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
}

.product-link {
  justify-self: start;
  padding: 0.38rem 0.68rem;
  border: 1px solid rgba(246, 240, 223, 0.2);
  border-radius: 999px;
  background: rgba(246, 240, 223, 0.08);
  color: var(--ink);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-decoration: none;
}

.product-link[hidden] {
  display: none;
}

.contact-form {
  position: absolute;
  z-index: 3;
  left: 50%;
  top: 50%;
  width: min(88%, 22rem);
  display: grid;
  gap: 0.78rem;
  padding: 1rem;
  border: 1px solid rgba(246, 240, 223, 0.2);
  border-radius: 0.52rem;
  background: rgba(13, 17, 14, 0.78);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.54);
  transform: translate(-50%, -50%);
}

.contact-form[hidden] {
  display: none;
}

.contact-form label {
  display: grid;
  gap: 0.32rem;
}

.contact-form span {
  color: var(--muted);
  font-size: 0.66rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  border: 1px solid rgba(246, 240, 223, 0.18);
  border-radius: 0.24rem;
  padding: 0.62rem 0.66rem;
  background: rgba(246, 240, 223, 0.08);
  color: var(--ink);
  font: inherit;
  resize: vertical;
}

.contact-form button {
  justify-self: start;
  padding: 0.58rem 0.9rem;
  border-radius: 999px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.contact-form p {
  min-height: 1em;
  margin: 0;
  color: var(--muted);
  font-size: 0.66rem;
  letter-spacing: 0.1em;
}

.photo-focus__body {
  display: grid;
  gap: 0.5rem;
}

.photo-focus__body p {
  margin: 0;
}

.photo-focus__body p {
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

@media (min-width: 560px) {
  .viewport {
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 2rem;
  }
}

@media (max-height: 700px) {
  .detail {
    padding: calc(3.25rem + env(safe-area-inset-top)) 0.85rem calc(2.2rem + env(safe-area-inset-bottom));
  }

  .detail__close {
    top: calc(0.55rem + env(safe-area-inset-top));
    right: 0.65rem;
    width: 2.35rem;
    height: 2.35rem;
  }

  .detail h1 {
    font-size: 1.68rem;
  }

  .photo-scatter {
    inset: calc(5.2rem + env(safe-area-inset-top)) 0.3rem calc(2rem + env(safe-area-inset-bottom));
  }

  .photo-focus {
    width: min(90%, 21rem);
    max-height: calc(100% - 5.5rem);
  }

  .photo-focus img {
    max-height: 46vh;
  }
}

@keyframes photo-land {
  0% {
    opacity: 0;
    filter: blur(22px) saturate(0.64) brightness(1.28);
    transform:
      translate(-50%, -50%)
      translate3d(var(--float-x), var(--float-y), 0)
      rotate(calc(var(--r) + var(--wobble) * -1))
      scale(calc(var(--s) * 2.35));
  }

  32% {
    opacity: 0.28;
    filter: blur(20px) saturate(0.68) brightness(1.26);
    transform:
      translate(-50%, -50%)
      translate3d(calc(var(--float-x) * -1.2), calc(var(--float-y) * 1.2), 0)
      rotate(calc(var(--r) + var(--wobble) * 0.7))
      scale(calc(var(--s) * 2.05));
  }

  58% {
    opacity: 0.68;
    filter: blur(11px) saturate(0.82) brightness(1.16);
    transform:
      translate(-50%, -50%)
      translate3d(calc(var(--float-x) * -0.8), calc(var(--float-y) * 0.8), 0)
      rotate(calc(var(--r) + var(--wobble)))
      scale(calc(var(--s) * 1.42));
  }

  84% {
    opacity: 1;
    filter: blur(2.2px) saturate(0.94) brightness(1.06);
    transform:
      translate(-50%, -50%)
      translate3d(var(--float-x), 0.5rem, 0)
      rotate(calc(var(--r) + var(--wobble)))
      scale(calc(var(--s) * 0.94));
  }

  100% {
    opacity: 1;
    filter: blur(0) saturate(1) brightness(1);
    transform:
      translate(-50%, -50%)
      translate3d(0, 0, 0)
      rotate(var(--r))
      scale(var(--s));
  }
}

@keyframes photo-float {
  0%,
  100% {
    transform:
      translate(-50%, -50%)
      translate3d(0, 0, 0)
      rotate(var(--r))
      scale(var(--s));
  }

  50% {
    transform:
      translate(-50%, -50%)
      translate3d(var(--float-x), var(--float-y), 0)
      rotate(calc(var(--r) + var(--wobble)))
      scale(var(--s));
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 1ms !important;
  }
}
