.showcase {
  --float-period: 7.6s;
  --attention-lift: 0px;
  --attention-light: .52;
  --glass-brightness: 1;
  grid-area: art;
  position: relative;
  isolation: isolate;
  min-height: 36rem;
}

.bell-stage {
  position: absolute;
  inset: 0;
  display: grid;
  align-items: center;
  justify-items: center;
  perspective: 850px;
}

/* The stage keeps its full logical size throughout the journey. The single
   canvas and its raster alternative use the same travel coordinates. */
[data-bell-flight] .showcase { z-index: 2; pointer-events: none; }
[data-bell-flight] .showcase[data-flight="home"],
[data-bell-flight] .bell-sprite { pointer-events: auto; }
[data-bell-flight] .showcase:is([data-flight="flying"], [data-flight="perched"]) .bell-sprite {
  pointer-events: none;
}
[data-bell-flight] .showcase[data-flight="flying"] .bell-stage { will-change: transform; }
[data-bell-flight] .bell-light { opacity: calc(var(--attention-light) * var(--flight-room, 1)); }
[data-bell-flight] .bell-shadow { opacity: calc(var(--shadow-strength) * var(--flight-room, 1)); }

/* Field focus cues the traveling shadow independently of the studio lights. */
[data-bell-flight] .bell-stage::before {
  content: "";
  position: absolute;
  z-index: -2;
  inset: 32% 17% 22%;
  pointer-events: none;
  background: radial-gradient(ellipse, #170c08a8, #160b075b 34%, transparent 73%);
  opacity: 0;
  transition: opacity 780ms ease-in-out;
}

[data-bell-flight] .showcase[data-dock] .bell-stage::before {
  opacity: .66;
  transition-duration: 440ms;
}

.bell-light, .bell-shadow, .bell-ripple { position: absolute; pointer-events: none; }

/* Separate the pool of light and the shadow so the floating glass has depth. */
.bell-light {
  inset: 0;
  opacity: var(--attention-light);
  background: radial-gradient(ellipse 57% 52% at 50% 43%, #a144235e, transparent);
  background-size: 118% 118%;
  background-position: center;
  transition: opacity 750ms ease;
}

.bell-light::after, .bell-shadow {
  bottom: 23%;
  width: 51%;
  height: 8%;
  border-radius: 50%;
  transform: translateX(var(--follow-x, 0px));
  transition: transform 680ms cubic-bezier(.16, .72, .28, 1);
}

.bell-light::after {
  content: "";
  position: absolute;
  left: 24.5%;
  height: 12%;
  background: radial-gradient(ellipse, #df6a2a73, transparent 73%);
}

.bell-shadow {
  --shadow-strength: .62;
  opacity: var(--shadow-strength);
  background: radial-gradient(ellipse, #070403 0%, #0e0705 38%, transparent 73%);
  transition: transform 680ms cubic-bezier(.16, .72, .28, 1), opacity 750ms ease;
}

.bell-ripple {
  top: 50%;
  left: 50%;
  width: min(67%, 35rem);
  aspect-ratio: 1;
  border: 1px solid #ffb27475;
  border-radius: 50%;
  opacity: 0;
  transform: translate(-50%, -50%) scale(.66);
}

.bell-sprite {
  width: min(77%, 38rem);
  position: relative;
  display: block;
  margin-block-end: 3%;
  padding: 0;
  border: 0;
  border-radius: .8rem;
  background: transparent;
  color: inherit;
  transform:
    translate3d(var(--follow-x, 0px), calc(var(--follow-y, 0px) + var(--attention-lift)), 0)
    rotateX(var(--tilt-x, 0deg)) rotateY(var(--tilt-y, 0deg));
  transition: transform 680ms cubic-bezier(.16, .72, .28, 1);
}

.bell-sprite:disabled { cursor: default; }

.bell-hover, .bell-swing { display: block; }

.bell-swing {
  position: relative;
  aspect-ratio: 1400 / 933;
  transform-origin: center 27%;
}

/* Only browsers that need the raster fallback request its image. */
.showcase[data-renderer="raster"] .bell-swing {
  background: url("/welcome-bell-sprite.webp") center / contain no-repeat;
  filter: brightness(var(--glass-brightness)) drop-shadow(0 .45rem 1.8rem #ab481f43);
  transition: filter 620ms ease;
}

.bell-stage > .bell-model {
  z-index: -1;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  filter: brightness(var(--glass-brightness));
  transition: filter 620ms ease;
}

.showcase:not([data-renderer="raster"]) :is(.bell-light, .bell-shadow) { visibility: hidden; }
.showcase[data-orbit] .bell-sprite { cursor: grab; touch-action: none; }
.showcase[data-orbit] .bell-sprite:active { cursor: grabbing; }

.showcase[data-motion="playing"]:not([data-renderer="webgl"]) .bell-hover {
  animation: bell-hover var(--float-period) ease-in-out infinite;
}

.showcase[data-motion="playing"]:not([data-renderer="webgl"]) .bell-shadow,
.showcase[data-motion="playing"]:not([data-renderer="webgl"]) .bell-light::after {
  animation: fallback-light var(--float-period) ease-in-out infinite;
}

.showcase[data-motion="playing"]:not([data-renderer="webgl"]) .bell-light {
  animation: background-drift 24s ease-in-out infinite;
}

.showcase[data-motion="playing"][data-ring] .bell-swing {
  animation: bell-ring 920ms cubic-bezier(.25, .72, .35, 1);
}

.showcase[data-renderer="webgl"][data-ring] .bell-swing { animation: none; }

.showcase[data-motion="playing"][data-ring] .bell-ripple {
  animation: bell-ripple 920ms ease-out;
}

.showcase[data-focused="email"] { --attention-lift: -6px; --attention-light: .78; --glass-brightness: 1.03; }
.showcase[data-focused="password"] { --attention-lift: 4px; --attention-light: .35; --glass-brightness: .88; }
[data-bell-flight] .showcase[data-dock="password"] { --glass-brightness: 1; }
.showcase[data-focused="code"] { --attention-lift: -5px; --attention-light: .85; --glass-brightness: 1.08; }
.showcase[data-typing] { --attention-light: .94; }
.showcase[data-ring], .showcase[data-submit] { --attention-light: 1; --glass-brightness: 1.14; }
.showcase[data-ring] .bell-shadow { --shadow-strength: .38; }

@keyframes bell-hover {
  0%, 100% { transform: translateY(0) rotate(0); }
  50% { transform: translateY(-10px) rotate(.7deg); }
}

@keyframes fallback-light {
  0%, 100% { scale: 1; filter: brightness(1); }
  50% { scale: 1.08 1.03; filter: brightness(.82); }
}

@keyframes background-drift {
  0%, 100% { background-position: center; }
  50% { background-position: 61% 44%; }
}

@keyframes bell-ring {
  0%, 100% { transform: rotate(0) scale(1); }
  21% { transform: rotate(-4deg) scale(1.035); }
  43% { transform: rotate(2.5deg) scale(1.015); }
  70% { transform: rotate(-.9deg) scale(1); }
  86% { transform: rotate(.35deg); }
}

@keyframes bell-ripple {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.66); }
  24% { opacity: .52; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.18); }
}

.showcase :focus-visible { outline: 2px solid #ffc094; outline-offset: 4px; }

@media (max-width: 760px) {
  .showcase { min-height: var(--account-bell-height); }
  [data-bell-flight] .showcase { height: var(--account-bell-height); min-height: 0; }
  [data-bell-flight] .bell-stage { bottom: auto; height: var(--account-bell-height); }
  [data-account-field] .showcase { height: .8rem; }
  .bell-sprite { width: min(72%, 20rem); margin-block-end: 0; }
  .bell-light::after, .bell-shadow { bottom: 15%; }
  .bell-ripple { width: 45%; }
}

@media (max-width: 760px) and (hover: none) and (pointer: coarse) {
  [data-account-field] .showcase { height: var(--account-bell-height); }
}

/* Stop motion when the scene is hidden or the visitor uses reduced motion. */
.showcase[data-motion="still"] .bell-sprite { transform: none; transition: none; }
[data-bell-flight] .showcase[data-motion="still"] .bell-stage { transition: none; }
.showcase[data-motion="still"] :is(.bell-swing, .bell-model, .bell-light, .bell-shadow),
.showcase[data-motion="still"] .bell-light::after,
.showcase[data-motion="still"] .bell-stage::before { transition: none; }

@media (prefers-reduced-motion: reduce) {
  [data-bell-flight] .bell-stage, [data-bell-flight] .bell-stage::before,
  [data-bell-flight] .showcase::before { transition: none; }
  .bell-sprite, .bell-swing, .bell-model, .bell-light, .bell-light::after, .bell-shadow { transition: none; }
  .bell-sprite { transform: none; }
  .bell-hover, .bell-swing, .bell-ripple, .bell-light, .bell-light::after, .bell-shadow { animation: none !important; }
}
