/* ema Mini Demo – teaser widget and full-window overlay.
   Selectors are prefixed with .ema-demo so theme / Elementor kit styles for h3, p and button don't leak in. */

.ema-demo {
  --ema-accent: #00929b;
  --ema-navy: #143852;
  --ema-text: #484848;
  position: relative;
  height: 540px;
  overflow: hidden;
  isolation: isolate;
  container-type: inline-size; /* the layout follows the widget's width, not the window's */
  cursor: pointer;
  background: radial-gradient(ellipse 70% 80% at 68% 48%, #ffffff 0%, #eef1f3 55%, #dfe5e9 100%);
}

.ema-demo__stage { position: absolute; inset: 0; }
.ema-demo__stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0;
  transform: scale(1.04);
  transition: opacity 0.9s ease, transform 1.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.ema-demo.is-ready .ema-demo__stage canvas { opacity: 1; transform: none; }
.ema-demo.is-ready:hover .ema-demo__stage canvas { transform: scale(1.015); }

/* Keeps the text readable over the scene. */
.ema-demo__shade {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(246, 246, 246, 0.96) 0%, rgba(246, 246, 246, 0.8) 28%, rgba(246, 246, 246, 0) 52%);
}

.ema-demo .ema-demo__content {
  position: absolute;
  z-index: 2;
  left: clamp(20px, 5%, 64px);
  top: 50%;
  transform: translateY(-50%);
  width: min(440px, 42%);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
}

.ema-demo .ema-demo__badge {
  display: inline-block;
  padding: 6px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ema-navy);
  background: #ffffff;
  box-shadow: 0 4px 14px rgba(20, 56, 82, 0.12);
}
.ema-demo .ema-demo__title {
  margin: 0;
  padding: 0;
  font-size: clamp(1.45rem, 2.3vw, 2.1rem);
  line-height: 1.2;
  color: var(--ema-navy);
}
.ema-demo .ema-demo__text {
  margin: 0;
  padding: 0;
  font-size: 1rem;
  line-height: 1.55;
  color: var(--ema-text);
}

.ema-demo .ema-demo__button {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin: 6px 0 0;
  padding: 16px 30px;
  font-family: inherit;
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  text-transform: none;
  color: #ffffff;
  background: var(--ema-accent);
  border: 2px solid var(--ema-accent);
  border-radius: 0;
  box-shadow: 0 10px 28px rgba(0, 146, 155, 0.35);
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, transform 0.15s, box-shadow 0.15s;
  animation: ema-demo-pulse 2.4s ease-in-out infinite;
}
.ema-demo .ema-demo__button svg { width: 18px; height: 18px; flex: none; fill: currentColor; }
.ema-demo:hover .ema-demo__button,
.ema-demo .ema-demo__button:focus-visible {
  color: #ffffff;
  background: var(--ema-navy);
  border-color: var(--ema-navy);
  transform: translateY(-1px);
  animation-play-state: paused;
}
.ema-demo .ema-demo__button:focus-visible { outline: 3px solid var(--ema-accent); outline-offset: 3px; }
@keyframes ema-demo-pulse {
  0%, 100% { box-shadow: 0 10px 28px rgba(0, 146, 155, 0.35), 0 0 0 0 rgba(0, 146, 155, 0.35); }
  50% { box-shadow: 0 10px 28px rgba(0, 146, 155, 0.35), 0 0 0 12px rgba(0, 146, 155, 0); }
}

.ema-demo .ema-demo__meta { font-size: 0.85rem; line-height: 1.3; color: #7a7a7a; }

/* Small spinner while the 3D scene loads (the teaser is fully usable before that). */
.ema-demo__loader {
  position: absolute;
  z-index: 2;
  right: 20px;
  bottom: 20px;
  width: 22px;
  height: 22px;
  border: 2px solid rgba(0, 146, 155, 0.25);
  border-top-color: var(--ema-accent);
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.3s;
  animation: ema-demo-spin 0.8s linear infinite;
}
.ema-demo.is-loading .ema-demo__loader { opacity: 1; }
@keyframes ema-demo-spin { to { transform: rotate(360deg); } }

/* Narrow widget (same 700 px as WIDE in teaser.js): text at the bottom, scene above it. */
@container (max-width: 699px) {
  .ema-demo__shade { background: linear-gradient(0deg, rgba(246, 246, 246, 0.97) 0%, rgba(246, 246, 246, 0.85) 38%, rgba(246, 246, 246, 0) 62%); }
  .ema-demo .ema-demo__content {
    top: auto;
    bottom: 22px;
    left: 20px;
    right: 20px;
    width: auto;
    transform: none;
    gap: 12px;
  }
  .ema-demo .ema-demo__text { font-size: 0.95rem; }
  .ema-demo .ema-demo__button { padding: 14px 24px; font-size: 1rem; }
  .ema-demo__loader { top: 16px; bottom: auto; right: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .ema-demo .ema-demo__button { animation: none; }
  .ema-demo__stage canvas { transition: opacity 0.3s; transform: none; }
}

/* ---------------------------------------------------------------- overlay */
html.ema-demo-open, html.ema-demo-open body { overflow: hidden !important; }

.ema-demo-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  background: #143852;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.ema-demo-overlay.is-open { opacity: 1; }
.ema-demo-overlay iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.ema-demo-overlay.is-loaded iframe { opacity: 1; }
.ema-demo-overlay__spinner {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  border: 3px solid rgba(255, 255, 255, 0.25);
  border-top-color: #77cacf;
  border-radius: 50%;
  animation: ema-demo-spin 0.8s linear infinite;
}
