/* ─────────────────────────────────────────────────────────────────────────
   Airo demo kit — the stage every product animation plays on.

   A demo is authored at a FIXED logical size in px (so cursor paths and
   layouts are exact) and the whole stage is scaled to fit its container.
   Two build modes: "wide" (phone + a companion panel beside it) and
   "narrow" (phone only; companions slide over the phone). The kit picks
   the mode from the container width and rebuilds on a breakpoint change.
   ───────────────────────────────────────────────────────────────────── */

.demo {
  --demo-scale: 1;
  --demo-accent: #1B7F55;
  position: relative;
  width: 100%;
  font-family: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Aspect box — height follows the logical stage, no JS needed for that. */
.demo__viewport {
  position: relative;
  width: 100%;
  aspect-ratio: var(--demo-w, 1040) / var(--demo-h, 800);
  overflow: hidden;
  border-radius: 20px;
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(255,255,255,.9), rgba(255,255,255,0) 60%),
    var(--demo-ground, #EEF3F0);
  isolation: isolate;
}
.demo__stage {
  position: absolute;
  left: 0; top: 0;
  width: calc(var(--demo-w, 1040) * 1px);
  height: calc(var(--demo-h, 800) * 1px);
  transform-origin: 0 0;
  transform: scale(var(--demo-scale));
  color: #111827;
  font-size: 14px;
  line-height: 1.43;
}
.demo__stage *, .demo__stage *::before, .demo__stage *::after { box-sizing: border-box; }

/* ── Control bar ───────────────────────────────────────────────────────── */
.demo__bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding-inline: 4px;
}
.demo__btn {
  appearance: none;
  border: 1px solid #DCE4DF;
  background: #fff;
  color: #38443D;
  width: 32px; height: 32px;
  border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color .15s ease, border-color .15s ease, transform .1s ease;
}
.demo__btn:hover { background: #F4F7F5; border-color: #C9D4CD; }
.demo__btn:active { transform: scale(.96); }
.demo__btn:focus-visible { outline: 2px solid #34B67E; outline-offset: 2px; }
.demo__btn svg { width: 14px; height: 14px; display: block; }
.demo__btn .i-play { display: none; }
.demo.is-paused .demo__btn .i-play { display: block; }
.demo.is-paused .demo__btn .i-pause { display: none; }

.demo__progress {
  position: relative;
  flex: 1;
  height: 16px;
  cursor: pointer;
  display: flex; align-items: center;
}
.demo__progress::before {
  content: '';
  position: absolute; left: 0; right: 0; height: 3px; border-radius: 3px;
  background: #DCE4DF;
}
.demo__progress-fill {
  position: relative;
  height: 3px; border-radius: 3px;
  width: 100%;
  transform-origin: 0 50%;
  transform: scaleX(0);
  background: var(--demo-accent);
}
.demo__time {
  font: 500 11px/1 'DM Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  font-variant-numeric: tabular-nums;
  color: #7A857F;
  min-width: 64px;
  text-align: right;
}

/* ── Phone frame ───────────────────────────────────────────────────────── */
.af-phone {
  position: absolute;
  width: 376px; height: 764px;
  border-radius: 54px;
  background: #0C1210;
  padding: 11px;
  box-shadow:
    0 0 0 1.5px #2A332E inset,
    0 1px 0 1px rgba(255,255,255,.08) inset,
    0 40px 70px -30px rgba(16, 40, 29, .45),
    0 18px 30px -18px rgba(16, 40, 29, .35);
}
.af-phone__screen {
  position: relative;
  width: 100%; height: 100%;
  border-radius: 43px;
  overflow: hidden;
  background: #FAFAF9;
  clip-path: inset(0 round 43px);      /* hard clip: composited, animating children can escape border-radius alone */
  isolation: isolate;
}
.af-phone__island {
  position: absolute; z-index: 60;
  top: 11px; left: 50%;
  width: 104px; height: 30px; margin-left: -52px;
  border-radius: 20px; background: #0C1210;
}
.af-status {
  position: absolute; z-index: 55; top: 0; left: 0; right: 0;
  height: 50px;
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 17px 30px 0 34px;
  font: 600 15px/1 -apple-system, 'SF Pro Text', 'DM Sans', system-ui, sans-serif;
  letter-spacing: -.01em;
  color: #111827;
  pointer-events: none;
}
.af-status.is-light { color: #fff; }
.af-status__icons { display: flex; align-items: center; gap: 5px; }
.af-status__icons svg { display: block; height: 12px; width: auto; }
.af-home {
  position: absolute; z-index: 58; bottom: 7px; left: 50%;
  width: 124px; height: 5px; margin-left: -62px; border-radius: 3px;
  background: #111827; opacity: .9;
}
.af-home.is-light { background: #fff; }

/* ── Companion panel (wide: beside the phone · narrow: slides over it) ─── */
.af-companion { position: absolute; }

/* ── Touch cursor ──────────────────────────────────────────────────────── */
.af-touch {
  position: absolute; z-index: 90; left: 0; top: 0;
  width: 44px; height: 44px; margin: -22px 0 0 -22px;
  border-radius: 50%;
  background: rgba(17, 24, 39, .16);
  border: 1.5px solid rgba(255,255,255,.85);
  box-shadow: 0 2px 10px rgba(17,24,39,.18);
  pointer-events: none;
  opacity: 0;
  will-change: transform, opacity;
}
.af-touch__ring {
  position: absolute; inset: -1.5px; border-radius: 50%;
  border: 2px solid rgba(17,24,39,.35);
  opacity: 0;
}
/* Desktop pointer variant */
.af-pointer {
  position: absolute; z-index: 90; left: 0; top: 0;
  width: 22px; height: 22px; margin: -2px 0 0 -3px;
  pointer-events: none; opacity: 0;
  filter: drop-shadow(0 2px 3px rgba(17,24,39,.3));
  will-change: transform, opacity;
}

/* Pressed feedback a demo can put on any tappable thing */
.is-pressed { filter: brightness(.94); transform: scale(.98); }

/* ── Reduced motion: no autoplay; the kit shows the poster frame ──────── */
.demo__poster-play {
  position: absolute; z-index: 5; inset: 0;
  display: none; align-items: center; justify-content: center;
  background: rgba(238,243,240,.35);
  border: 0; cursor: pointer;
}
.demo.is-static .demo__poster-play { display: flex; }
.demo__poster-play span {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-radius: 999px;
  background: #142F23; color: #fff;
  font: 600 13px/1 'DM Sans', system-ui, sans-serif;
  box-shadow: 0 10px 24px -10px rgba(20,47,35,.6);
}
.demo__poster-play svg { width: 12px; height: 12px; }
