/* The same silhouettes frame inline worlds and their standalone pages. */
:is(.case-surface[data-shape], body > .demo-root:has(> :is(
  .form-store, .bf-site, .signal-site, .pulse-site, .art-site, .coffee-site, .gaming-site
))) {
  overflow: clip;
  border-radius: var(--case-radius, 0);
}

:is(.case-surface[data-shape="shop"], body > .demo-root:has(> .form-store)) {
  --case-radius: calc(44px * var(--case-corner-scale, 1));
}

:is(.case-surface[data-shape="architecture"], body > .demo-root:has(> .bf-site)) {
  --case-radius: 4px calc(64px * var(--case-corner-scale, 1)) 4px 4px;
}

:is(.case-surface[data-shape="media"], body > .demo-root:has(> .signal-site)) {
  --case-radius: calc(24px * var(--case-corner-scale, 1));
  background: var(--case-background, #101622);
}

:is(.case-surface[data-shape="fintech"], body > .demo-root:has(> .pulse-site)) {
  --case-radius: calc(18px * var(--case-corner-scale, 1));
  position: relative;
}

:is(.case-surface[data-shape="fintech"], body > .demo-root:has(> .pulse-site))::after {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 0 0 auto;
  block-size: var(--case-radius);
  border-radius: var(--case-radius) var(--case-radius) 0 0;
  background: radial-gradient(ellipse 50% 135% at 56% -22%, #b4defa26, #a1eeff0b 51%, transparent 86%);
  pointer-events: none;
}

:is(.case-surface[data-shape="art"], body > .demo-root:has(> .art-site)) {
  --case-radius: calc(50px * var(--case-corner-scale, 1));
}

:is(.case-surface[data-shape="coffee"], body > .demo-root:has(> .coffee-site)) {
  --case-radius: calc(56px * var(--case-corner-scale, 1)) calc(56px * var(--case-corner-scale, 1))
    calc(40px * var(--case-corner-scale, 1)) calc(40px * var(--case-corner-scale, 1));
}

:is(.case-surface[data-shape="gaming"], body > .demo-root:has(> .gaming-site)) {
  --case-bevel: calc(32px * var(--case-corner-scale, 1));
  --case-bevel-large: calc(50px * var(--case-corner-scale, 1));
  clip-path: polygon(
    0 var(--case-bevel), var(--case-bevel) 0,
    calc(100% - var(--case-bevel-large)) 0, 100% var(--case-bevel-large),
    100% calc(100% - var(--case-bevel)), calc(100% - var(--case-bevel)) 100%,
    var(--case-bevel) 100%, 0 calc(100% - var(--case-bevel))
  );
}

/* Match the visible scene surfaces at the rounded corners, not their mid-transition palette. */
.flow-stop:has(> .case-surface[data-shape="shop"]), body:has(> .demo-root > .form-store) { --case-edge-top: #f6f6ee; }
.flow-stop:has(> .case-surface[data-shape="architecture"]), body:has(> .demo-root > .bf-site) { --case-edge-top: #f2f4f7; }
.flow-stop:has(> .case-surface[data-shape="media"]), body:has(> .demo-root > .signal-site) { --case-edge-top: #101622; }
.flow-stop:has(> .case-surface[data-shape="fintech"]), body:has(> .demo-root > .pulse-site) { --case-edge-top: #151626; }
.flow-stop:has(> .case-surface[data-shape="art"]), body:has(> .demo-root > .art-site) {
  --case-edge-top: #fa4c32;
  --case-edge-bottom: #1d1324;
}
.flow-stop:has(> .case-surface[data-shape="coffee"]), body:has(> .demo-root > .coffee-site) {
  --case-edge-top: #f7ecdd;
  --case-edge-bottom: #324a39;
}
.flow-stop:has(> .case-surface[data-shape="gaming"]), body:has(> .demo-root > .gaming-site) {
  --case-edge-top: #0f1b27;
  --case-edge-bottom: #09121a;
}

.flow-stop:has(> .case-surface[data-shape]),
body:has(> .demo-root > :is(.form-store, .bf-site, .signal-site, .pulse-site, .art-site, .coffee-site, .gaming-site)) {
  background: linear-gradient(180deg,
    var(--case-edge-top) 0 calc(100% - 9rem),
    var(--case-edge-bottom, var(--case-edge-top)) calc(100% - 4.75rem));
}

@media (max-width: 767px) {
  :is(.case-surface[data-shape], body > .demo-root) { --case-corner-scale: .7; }
}

@media (max-width: 479px) {
  :is(.case-surface[data-shape], body > .demo-root) { --case-corner-scale: .52; }
}
