/* The canonical 480 x 320 outline lives in the design-system card and is
   supplied once by each authored SVG in markup. This file owns presentation. */
.ghost-whisper {
  --ghost-whisper-surface: rgba(27, 28, 31, 0.78);
  --ghost-whisper-rim: rgba(255, 255, 252, 0.78);
  --ghost-whisper-text: #ffffff;
  --ghost-whisper-shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
  --ghost-whisper-blur: 18px;
  --ghost-whisper-enter: 240ms;
  --ghost-whisper-exit: 200ms;
  --ghost-whisper-period: #ff6b00;
  --ghost-whisper-width: 30rem;
  --ghost-whisper-desktop-inline: 62%;
  --ghost-whisper-desktop-block-end: 74%;
  --ghost-whisper-narrow-inline: 50%;
  --ghost-whisper-narrow-block-end: calc(100% + 1rem);
  --ghost-whisper-placement-inline: var(--ghost-whisper-desktop-inline);
  --ghost-whisper-placement-block-end: var(--ghost-whisper-desktop-block-end);
  --ghost-whisper-placement-shift: -50%;

  position: absolute;
  z-index: 3;
  inset-inline-start: var(--ghost-whisper-placement-inline);
  inset-block-end: var(--ghost-whisper-placement-block-end);
  inline-size: var(--ghost-whisper-width);
  aspect-ratio: 480 / 320;
  translate: var(--ghost-whisper-placement-shift) 0;
  color: var(--ghost-whisper-text);
  opacity: 0;
  filter: blur(8px);
  transform: scale(0.96);
  transform-origin: 50% 72%;
  transition-property: opacity, filter, transform;
  transition-duration: var(--ghost-whisper-enter);
  transition-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
  contain: layout;
  isolation: isolate;
  will-change: opacity, filter, transform;
}

.ghost-whisper[data-placement="top-right"] {
  --ghost-whisper-placement-inline: var(--ghost-whisper-desktop-inline);
  --ghost-whisper-placement-block-end: var(--ghost-whisper-desktop-block-end);
}

.ghost-whisper[data-placement="top-center"] {
  --ghost-whisper-placement-inline: var(--ghost-whisper-narrow-inline);
  --ghost-whisper-placement-block-end: var(--ghost-whisper-narrow-block-end);
}

.ghost-whisper__shape {
  position: absolute;
  inset: 0;
  display: block;
  inline-size: 100%;
  block-size: 100%;
  overflow: visible;
  filter: drop-shadow(var(--ghost-whisper-shadow));
}

.ghost-whisper__surface {
  fill: var(--ghost-whisper-surface);
  opacity: 1;
}

/* Task 4 must give every instance a unique --ghost-whisper-clip value whose
   URL targets a clipPath containing the one canonical outline. */
.ghost-whisper__haze-clip {
  clip-path: var(--ghost-whisper-clip, inset(50%));
}

.ghost-whisper__haze {
  fill: rgba(255, 255, 252, 0.18);
  opacity: 0.45;
  filter: blur(var(--ghost-whisper-blur));
  transform: translateY(-7%) scale(0.78, 0.48);
  transform-box: fill-box;
  transform-origin: 50% 34%;
}

.ghost-whisper__rim {
  fill: none;
  stroke: var(--ghost-whisper-rim);
  stroke-width: 1.15;
  opacity: 0.82;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 0 1.2px rgba(255, 255, 252, 0.28));
}

.ghost-whisper__message {
  position: absolute;
  inset-block-start: 39%;
  inset-inline-start: 50%;
  inline-size: 72%;
  max-block-size: 2.5em;
  translate: -50% -50%;
  overflow: hidden;
  color: var(--ghost-whisper-text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: clamp(1.0625rem, 2vw, 1.375rem);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.025em;
  text-align: center;
  text-wrap: balance;
  text-shadow: 0 1px 18px rgba(0, 0, 0, 0.38);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.ghost-whisper__copy,
.ghost-whisper__period {
  display: inline;
}

.ghost-whisper__copy {
  color: var(--ghost-whisper-text);
  text-align: center;
}

.ghost-whisper__period {
  color: var(--ghost-whisper-period);
}

/* Task 4 mounts this full-square layer beside the canonical raster inside the
   mascot float, so both follow the same ancestor transforms. These percentages
   are measured from the 1024-square asset; Task 5 owns final live tuning. */
.ghost-blink-layer {
  position: absolute;
  z-index: 4;
  inset: 0;
  inline-size: 100%;
  block-size: 100%;
  opacity: 0;
  pointer-events: none;
}

.ghost-blink-layer__eye {
  position: absolute;
  overflow: hidden;
  border-radius: 50%;
  background: #05090b;
  transform: translate(-50%, -50%);
}

.ghost-blink-layer__eye--left {
  inset-inline-start: 57.3%;
  inset-block-start: 41%;
  inline-size: 3.9%;
  block-size: 7.8%;
}

.ghost-blink-layer__eye--right {
  inset-inline-start: 66.4%;
  inset-block-start: 41.5%;
  inline-size: 3.6%;
  block-size: 7.2%;
}

.ghost-blink-layer__eye::after {
  content: "";
  position: absolute;
  inset-inline: 18%;
  inset-block-start: 50%;
  block-size: 6%;
  border-radius: 999px;
  background: rgb(86 224 241 / 0.95);
  translate: 0 -50%;
}

.ghost-blink-layer.is-blinking {
  opacity: 1;
}

.ghost-whisper[data-state="hidden"] {
  visibility: hidden;
  opacity: 0;
  filter: blur(8px);
  transform: scale(0.96);
}

.ghost-whisper[data-state="entering"],
.ghost-whisper[data-state="visible"] {
  visibility: visible;
  opacity: 1;
  filter: blur(0);
  transform: scale(1);
}

.ghost-whisper[data-state="exiting"] {
  visibility: visible;
  opacity: 0;
  filter: blur(8px);
  transform: scale(0.96);
  transition-duration: var(--ghost-whisper-exit);
  transition-timing-function: ease-in;
}

@starting-style {
  .ghost-whisper[data-state="entering"] {
    opacity: 0;
    filter: blur(8px);
    transform: scale(0.96);
  }
}

@media (max-width: 47.5rem) {
  .ghost-whisper,
  .ghost-whisper[data-placement="top-right"],
  .ghost-whisper[data-placement="top-center"] {
    --ghost-whisper-width: min(20rem, calc(100vw - 2rem));
    --ghost-whisper-placement-inline: var(--ghost-whisper-narrow-inline);
    --ghost-whisper-placement-block-end: var(--ghost-whisper-narrow-block-end);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ghost-blink-layer,
  .ghost-blink-layer.is-blinking {
    opacity: 0 !important;
  }

  .ghost-whisper {
    transition: none !important;
    will-change: auto;
  }

  .ghost-whisper[data-state="entering"],
  .ghost-whisper[data-state="visible"] {
    visibility: visible;
    opacity: 1;
    filter: blur(0);
    transform: scale(1);
  }

  .ghost-whisper[data-state="hidden"],
  .ghost-whisper[data-state="exiting"] {
    visibility: hidden;
    opacity: 0;
    filter: blur(0);
    transform: scale(1);
  }
}
