/* Standalone Space: the original Deushima canvas without the homepage chrome. */
html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: #030303;
}

body.is-space-page .site-shell {
  width: 100%;
  min-height: 100svh;
  height: 100svh;
  overflow: hidden;
}

body.is-space-page .hero.hero--node-canvas {
  width: 100%;
  height: 100svh;
  min-height: 100svh;
  overflow: hidden;
  background: #030303;
}

/* Leave the real draggable brand mark, original five nodes, ports,
   connections, grid and context menu. No footer, copy, stars or floating UI. */
body.is-space-page .hero-camera-zoom,
body.is-space-page .deu-chat-launcher,
body.is-space-page .page-transition {
  display: none !important;
}

.space-loading {
  position: fixed;
  inset: 0;
  z-index: 20000;
  display: grid;
  place-items: center;
  background: #030303;
  opacity: 1;
  visibility: visible;
  transition: opacity 500ms ease, visibility 500ms ease;
}

.space-loading.is-complete {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Six circles match the original studio-loader motif; no text or Enter step. */
.space-loading__orbit {
  position: relative;
  width: clamp(5rem, 6vw, 6.75rem);
  aspect-ratio: 1;
  animation: space-loading-orbit 2.4s linear infinite;
}

.space-loading__orbit span {
  position: absolute;
  left: 50%;
  top: 50%;
  width: clamp(1.1rem, 1.5vw, 1.65rem);
  aspect-ratio: 1;
  border-radius: 50%;
  background: #f5f5f3;
  box-shadow: 0 0 0 1px rgba(255,255,255,.68), 0 0 1.35rem rgba(255,255,255,.08);
  transform: translate(-50%, -50%) rotate(calc(var(--i) * 60deg)) translateY(-2.2rem);
}

@keyframes space-loading-orbit { to { transform: rotate(360deg); } }

@media (max-width: 760px) {
  .space-loading__orbit { width: 3.2rem; }
  .space-loading__orbit span {
    width: .72rem;
    transform: translate(-50%, -50%) rotate(calc(var(--i) * 60deg)) translateY(-1.35rem);
    box-shadow: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .space-loading__orbit { animation: none; }
  .space-loading { transition-duration: 1ms; }
}

/* One desktop canvas at every viewport size. Camera zoom is the only scale;
   explicit world dimensions also keep shared nodes aligned between devices. */
body.is-space-page .hero-node-camera {
  width: 1440px;
  height: 900px;
}

body.is-space-page .hero--node-canvas .hero-node-stage {
  left: 144px;
  right: auto;
  top: 144px;
  width: 1152px;
  height: 512px;
  max-width: none;
  transform: none;
  overflow: visible;
}

/* The canvas keeps keyboard focus for paste/commands, without painting a
   browser focus rectangle around the original node stage. */
body.is-space-page .hero--node-canvas .hero-node-stage:focus {
  outline: 0;
}

body.is-space-page .hero--node-canvas .hero-node {
  width: 219px;
  min-height: 90px;
  padding: 17.92px 19.52px 16.32px;
  border-radius: 24px;
}
body.is-space-page .hero--node-canvas .hero-node__copy {
  display: grid;
  min-height: 0;
  gap: 5.12px;
  padding-top: 14.4px;
}
body.is-space-page .hero--node-canvas .hero-node strong {
  font-size: 18px;
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: -.025em;
}
body.is-space-page .hero--node-canvas .hero-node small {
  max-width: none;
  margin-top: .96px;
  font-size: 12.384px;
  line-height: 1.32;
  white-space: normal;
}
body.is-space-page .hero-node--chat { --node-x: 26.5%; --node-y: 25%; }
body.is-space-page .hero-node--works { --node-x: 21.5%; --node-y: 75%; }
body.is-space-page .hero-node--launcher { --node-x: 50%; --node-y: 50%; }
body.is-space-page .hero-node--contact { --node-x: 73.5%; --node-y: 25%; }
body.is-space-page .hero-node--about { --node-x: 78.5%; --node-y: 75%; }

body.is-space-page .hero--node-canvas .hero-node__port {
  top: 50%;
  bottom: auto;
  width: 10px;
  height: 10px;
  transform: translateY(-50%);
}
body.is-space-page .hero--node-canvas .hero-node__port--in { left: -5px; right: auto; }
body.is-space-page .hero--node-canvas .hero-node__port--out { left: auto; right: -5px; }

/* Custom cards retain their desktop metrics, including user-resized cards. */
body.is-space-page .hero-custom-node {
  width: 259.2px;
  min-width: 180px;
  max-width: 320px;
  min-height: 96px;
  padding: 13.12px 14.72px 14.08px;
  border-radius: var(--node-radius);
}
body.is-space-page .hero-custom-node__editor { min-height: 55.2px; font-size: 15px; }
body.is-space-page .hero-custom-node--link { width: 288px; }
body.is-space-page .hero-custom-node--media {
  width: min(var(--custom-media-width, 300px), 420px);
  min-width: 220px;
  max-width: 420px;
  padding: 12.16px 12.48px 11.2px;
}
body.is-space-page .hero-custom-node--instagram,
body.is-space-page .hero-custom-node--youtube {
  width: 320px;
  min-width: 240px;
  max-width: 380px;
  padding: 12.16px 12.48px 11.2px;
}
body.is-space-page .hero-custom-node--sketchfab { width: 350px; min-width: 240px; max-width: 380px; padding: 12px; }

.space-zoom {
  position: fixed;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 10900;
  display: flex;
  align-items: center;
  padding: 4px;
  border: 1px solid #ffffff20;
  border-radius: 13px;
  background: #1b1b1b;
  box-shadow: 0 6px 24px #0005;
}
.space-zoom button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #dedede;
  font: 400 22px/1 Inter, sans-serif;
  cursor: pointer !important;
  touch-action: manipulation;
  transition: background .16s ease;
}
.space-zoom button[data-space-zoom="fit"] {
  width: 62px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.space-zoom button:hover { background: #ffffff0d; }
.space-zoom button:focus-visible { outline: 2px solid #c0d1fa; outline-offset: 1px; }
.space-zoom button:disabled { opacity: .3; cursor: default !important; }
body.is-space-page:is(.is-content-panel-open, .is-design-viewer-open, .deu-chat-open) .space-zoom { visibility: hidden; }
