/* 히어로 쇼케이스 장면: 바깥 테마와 무관하게 항상 어두운 잉크 배경 위에서 그려집니다. */
.showcase-scene {
  --sc-text: #eef8ff;
  --sc-muted: rgba(206, 226, 255, 0.68);
  --sc-cyan: #3ee6ff;
  --sc-mint: #5cffc6;
  --sc-indigo: #7a6cff;
  --sc-edge: rgba(150, 220, 255, 0.17);
  --sc-glass: rgba(8, 14, 30, 0.72);
  --stage-h: 590px;
  --ry: 155px;
  --app-w: 108px;
  --app-img: 46px;
  --orb: 340px;
  --center-num: 84px;
  --px: 0;
  --py: 0;
  container: scene / inline-size;
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "stage"
    "controls"
    "dock";
  width: 100%;
  max-width: 650px;
  margin-inline: auto;
  overflow: hidden;
  border: 1px solid rgba(140, 210, 255, 0.13);
  border-radius: 28px;
  color: var(--sc-text);
  color-scheme: dark;
  background:
    radial-gradient(
      58% 48% at 50% 47%,
      rgba(36, 120, 255, 0.2),
      transparent 72%
    ),
    radial-gradient(
      38% 32% at 26% 24%,
      rgba(92, 255, 198, 0.08),
      transparent 70%
    ),
    radial-gradient(
      44% 38% at 76% 74%,
      rgba(122, 108, 255, 0.17),
      transparent 70%
    ),
    radial-gradient(
      120% 92% at 50% 50%,
      transparent 38%,
      rgba(3, 5, 12, 0.9) 100%
    ),
    linear-gradient(rgba(140, 210, 255, 0.045) 1px, transparent 1px) 0 0 / 36px
      36px,
    linear-gradient(90deg, rgba(140, 210, 255, 0.045) 1px, transparent 1px) 0
      0 / 36px 36px,
    linear-gradient(180deg, #070b19, #04060d);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 0 90px -24px rgba(62, 230, 255, 0.22),
    0 34px 90px -36px rgba(0, 0, 0, 0.75);
  -webkit-tap-highlight-color: transparent;
}

#showcase-canvas {
  grid-area: stage;
  display: block;
  width: 100%;
  height: var(--stage-h);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.9s ease;
}
.showcase-scene[data-scene-ready="webgl"] #showcase-canvas,
.showcase-scene[data-scene-ready="canvas"] #showcase-canvas {
  opacity: 1;
}

/* ---------- 중앙 타이틀 + JS 이전/정적 대체용 조형 ---------- */
.scene-center {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 28px 34px;
  border-radius: 50%;
  translate: -50% -50%;
  transform: translate3d(calc(var(--px) * -7px), calc(var(--py) * -7px), 0);
  background: radial-gradient(
    closest-side,
    rgba(4, 7, 16, 0.66),
    rgba(4, 7, 16, 0.34) 62%,
    transparent
  );
  text-align: center;
  pointer-events: none;
  isolation: isolate;
}
.scene-center::before,
.scene-center::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: -1;
  translate: -50% -50%;
  border-radius: 50%;
  transition: opacity 0.9s ease;
}
.scene-center::before {
  width: var(--orb);
  height: var(--orb);
  background:
    radial-gradient(
      circle at 36% 30%,
      rgba(190, 250, 255, 0.3),
      transparent 42%
    ),
    radial-gradient(
      circle,
      transparent 60%,
      rgba(62, 230, 255, 0.28) 69%,
      transparent 71%
    ),
    radial-gradient(circle, rgba(150, 240, 255, 0.8) 0 1px, transparent 1.6px) 0
      0 / 11px 11px,
    radial-gradient(
      circle at 60% 70%,
      rgba(122, 108, 255, 0.4),
      transparent 60%
    );
  -webkit-mask-image: radial-gradient(circle, #000 46%, transparent 71%);
  mask-image: radial-gradient(circle, #000 46%, transparent 71%);
}
.scene-center::after {
  width: calc(var(--orb) * 1.62);
  height: calc(var(--orb) * 0.46);
  border: 1px solid rgba(62, 230, 255, 0.36);
  box-shadow:
    0 0 26px -6px rgba(62, 230, 255, 0.45),
    inset 0 0 22px -10px rgba(122, 108, 255, 0.6);
  rotate: -17deg;
}
.showcase-scene[data-scene-ready="webgl"] .scene-center::before,
.showcase-scene[data-scene-ready="webgl"] .scene-center::after,
.showcase-scene[data-scene-ready="canvas"] .scene-center::before,
.showcase-scene[data-scene-ready="canvas"] .scene-center::after {
  opacity: 0;
}

.scene-center > span {
  color: var(--sc-mint);
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  white-space: nowrap;
  text-shadow: 0 0 14px rgba(92, 255, 198, 0.45);
}
.scene-center strong {
  display: flex;
  align-items: flex-start;
  margin: 2px 0 0;
  font-size: var(--center-num);
  font-weight: 800;
  line-height: 0.92;
  letter-spacing: -0.05em;
  color: transparent;
  background: linear-gradient(180deg, #ffffff 8%, #b2f6ff 52%, #8b80ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  filter: drop-shadow(0 0 26px rgba(62, 230, 255, 0.35));
}
.scene-center strong span {
  margin: 0.62em 0 0 0.3em;
  color: rgba(214, 244, 255, 0.86);
  -webkit-text-fill-color: rgba(214, 244, 255, 0.86);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.22em;
}
.scene-center p {
  margin: 4px 0 0;
  color: var(--sc-muted);
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

/* ---------- 앱 노드 ---------- */
.scene-nodes {
  --scene-layout: ring;
  position: absolute;
  inset: 0;
  z-index: 3;
  margin: 0;
  padding: 0;
  pointer-events: none;
  transform: perspective(1200px) rotateX(calc(var(--py) * -3deg))
    rotateY(calc(var(--px) * 4deg));
}

.scene-app {
  --cx: 0;
  --cy: 0;
  --d: 10;
  position: absolute;
  top: calc(50% + var(--cy) * var(--ry));
  left: calc(50% + var(--cx) * (50% - var(--app-w) / 2 - 12px));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  width: var(--app-w);
  margin: 0;
  padding: 10px 8px 9px;
  border: 1px solid var(--sc-edge);
  border-radius: 18px;
  translate: -50% -50%;
  transform: translate3d(
    calc(var(--px) * var(--d) * 1px),
    calc(var(--py) * var(--d) * 1px),
    0
  );
  background: linear-gradient(180deg, rgba(20, 34, 64, 0.74), var(--sc-glass));
  -webkit-backdrop-filter: blur(10px) saturate(140%);
  backdrop-filter: blur(10px) saturate(140%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    0 12px 30px -14px rgba(0, 0, 0, 0.8);
  color: var(--sc-text);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  cursor: pointer;
  pointer-events: auto;
  transition:
    border-color 0.25s ease,
    box-shadow 0.25s ease,
    background-color 0.25s ease,
    scale 0.25s ease;
}
.scene-app:nth-child(1) {
  --cx: -0.8;
  --cy: -1;
  --d: 10;
}
.scene-app:nth-child(2) {
  --cx: 0.8;
  --cy: -1;
  --d: 10;
}
.scene-app:nth-child(3) {
  --cx: -1;
  --cy: 0;
  --d: 15;
}
.scene-app:nth-child(4) {
  --cx: 1;
  --cy: 0;
  --d: 15;
}
.scene-app:nth-child(5) {
  --cx: -0.8;
  --cy: 1;
  --d: 8;
}
.scene-app:nth-child(6) {
  --cx: 0.8;
  --cy: 1;
  --d: 8;
}

.scene-app img {
  display: block;
  flex: none;
  width: var(--app-img);
  height: var(--app-img);
  border-radius: 28%;
  object-fit: cover;
  background: linear-gradient(135deg, #133452, #1d1b4f);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.09),
    0 8px 18px -8px rgba(0, 0, 0, 0.85);
}
.scene-app span {
  display: -webkit-box;
  max-width: 100%;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.scene-app:hover,
.scene-app:focus-visible {
  scale: 1.04;
  border-color: rgba(62, 230, 255, 0.58);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 0 0 1px rgba(62, 230, 255, 0.22),
    0 0 30px -4px rgba(62, 230, 255, 0.45);
}
.scene-app:focus-visible {
  outline: 2px solid var(--sc-cyan);
  outline-offset: 3px;
}
.scene-app[aria-pressed="true"],
.scene-app[aria-current="true"],
.scene-app[aria-expanded="true"],
.scene-app.is-active {
  border-color: rgba(92, 255, 198, 0.7);
  background: linear-gradient(180deg, rgba(22, 60, 70, 0.8), var(--sc-glass));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 0 32px -6px rgba(92, 255, 198, 0.5);
}

/* ---------- 안내 문구 / 렌더러 라벨 ---------- */
.scene-hint {
  position: absolute;
  top: 20px;
  left: 22px;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--sc-muted);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
}
.scene-hint::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--sc-mint);
  box-shadow: 0 0 10px var(--sc-mint);
  animation: scene-blink 2.4s ease-in-out infinite;
}

.scene-renderer {
  position: absolute;
  top: 18px;
  right: 20px;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 9px;
  border: 1px solid rgba(150, 220, 255, 0.12);
  border-radius: 999px;
  background: rgba(5, 10, 22, 0.55);
  color: rgba(204, 230, 255, 0.6);
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 10.5px;
  letter-spacing: 0.03em;
  white-space: nowrap;
  pointer-events: none;
}
.scene-renderer:empty {
  display: none;
}
.scene-renderer::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--sc-indigo);
}
.showcase-scene[data-scene-ready="webgl"] .scene-renderer::before {
  background: var(--sc-mint);
  box-shadow: 0 0 8px var(--sc-mint);
}
.showcase-scene[data-scene-ready="canvas"] .scene-renderer::before {
  background: var(--sc-cyan);
  box-shadow: 0 0 8px var(--sc-cyan);
}

/* ---------- 컨트롤 ---------- */
.scene-controls {
  position: absolute;
  bottom: 20px;
  left: 50%;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--sc-edge);
  border-radius: 999px;
  translate: -50% 0;
  background: rgba(6, 12, 26, 0.7);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: 0 14px 34px -18px rgba(0, 0, 0, 0.9);
  white-space: nowrap;
}
.showcase-scene:not([data-scene-ready]) .scene-controls {
  opacity: 0.6;
}
.scene-modes {
  display: flex;
  gap: 2px;
}
.scene-modes button,
#scene-pause {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 32px;
  margin: 0;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--sc-muted);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition:
    color 0.2s ease,
    background-color 0.2s ease,
    box-shadow 0.2s ease;
}
.scene-modes button:hover,
#scene-pause:hover:not(:disabled) {
  color: var(--sc-text);
  background: rgba(150, 220, 255, 0.08);
}
.scene-modes button[aria-pressed="true"] {
  color: #fff;
  background: linear-gradient(
    135deg,
    rgba(62, 230, 255, 0.24),
    rgba(122, 108, 255, 0.26)
  );
  box-shadow: inset 0 0 0 1px rgba(62, 230, 255, 0.42);
}
#scene-pause {
  position: relative;
  margin-left: 2px;
}
#scene-pause::after {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: -3px;
  width: 1px;
  background: var(--sc-edge);
}
#scene-pause::before {
  content: "";
  box-sizing: border-box;
  width: 8px;
  height: 10px;
  border-right: 2.5px solid currentColor;
  border-left: 2.5px solid currentColor;
}
#scene-pause[data-paused="true"] {
  color: var(--sc-mint);
}
#scene-pause[data-paused="true"]::before {
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 5px 0 5px 8px;
  border-color: transparent transparent transparent currentColor;
}
#scene-pause:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}
.scene-modes button:focus-visible,
#scene-pause:focus-visible {
  outline: 2px solid var(--sc-cyan);
  outline-offset: 2px;
}

@keyframes scene-blink {
  50% {
    opacity: 0.35;
  }
}

/* ---------- 태블릿 ---------- */
@media (max-width: 1024px) {
  .showcase-scene {
    --stage-h: 450px;
    --ry: 118px;
    --app-w: 96px;
    --app-img: 40px;
    --orb: 270px;
    --center-num: 68px;
  }
  .scene-app {
    padding: 9px 7px 8px;
    gap: 6px;
    font-size: 12px;
  }
  .scene-hint {
    top: 16px;
    left: 18px;
  }
  .scene-renderer {
    top: 14px;
    right: 16px;
  }
  .scene-controls {
    bottom: 14px;
  }
  .scene-modes button,
  #scene-pause {
    height: 30px;
    padding: 0 12px;
  }
}

/* ---------- 좁은 폭: 조형 아래 3×2 앱 독 ---------- */
@container scene (max-width: 519px) {
  #showcase-canvas {
    height: 266px;
  }
  .scene-center {
    grid-area: stage;
    --orb: 196px;
    --center-num: 46px;
    gap: 4px;
    padding: 18px 22px;
  }
  .scene-center > span {
    font-size: 9px;
    letter-spacing: 0.24em;
  }
  .scene-center strong span {
    font-size: 10px;
  }
  .scene-center p {
    font-size: 12px;
  }
  .scene-hint {
    grid-area: stage;
    top: auto;
    bottom: 10px;
    left: 50%;
    translate: -50% 0;
    font-size: 11px;
  }
  .scene-renderer {
    grid-area: stage;
    top: 12px;
    right: 12px;
    font-size: 10px;
  }
  .scene-controls {
    position: relative;
    bottom: auto;
    left: auto;
    grid-area: controls;
    justify-self: center;
    margin-top: 4px;
    translate: none;
  }
  .scene-modes button,
  #scene-pause {
    height: 30px;
    padding: 0 10px;
    font-size: 11.5px;
  }
  .scene-nodes {
    --scene-layout: dock;
    position: static;
    grid-area: dock;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    padding: 12px 12px 14px;
    transform: none;
  }
  .scene-app {
    --app-img: 30px;
    position: relative;
    top: auto;
    left: auto;
    width: auto;
    min-width: 0;
    gap: 5px;
    padding: 8px 5px 7px;
    border-radius: 14px;
    translate: none;
    transform: none;
    font-size: 11px;
  }
}

/* ---------- 모션 끔 ---------- */
html[data-motion="off"] .scene-nodes,
html[data-motion="off"] .scene-app,
html[data-motion="off"] .scene-center {
  transform: none;
}
html[data-motion="off"] .scene-hint::before {
  animation: none;
}
@media (prefers-reduced-motion: reduce) {
  .scene-nodes,
  .scene-app,
  .scene-center {
    transform: none;
  }
  .scene-hint::before {
    animation: none;
  }
  #showcase-canvas,
  .scene-center::before,
  .scene-center::after,
  .scene-app {
    transition: none;
  }
}

.scene-modes button,
#scene-pause {
  min-height: 44px;
}
.scene-center strong span {
  line-height: 1.4;
}
