/* Demo-only: the welcome dialog and its info button. */

.demo {
  --banner-h: 88px;
  --figure-h: 128px;
  --figure-w: calc(var(--figure-h) * 0.8);
  width: min(34rem, calc(100% - 2 * var(--gutter)));
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  overflow: visible;
}
.demo::backdrop { background: rgb(10 20 30 / 0.4); }
[data-theme="dark"] .demo::backdrop { background: rgb(0 0 0 / 0.6); }
.demo:focus-visible { outline: none; }
body:has(.demo[open]) { overflow: hidden; }

.demo-card {
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: clamp(22px, 5vw, 32px);
  background: var(--board);
  border-radius: 24px;
  box-shadow: 0 24px 60px rgb(0 0 0 / 0.22);
}

.demo-kicker { color: var(--ink-soft); font-weight: 650; }
.demo-title { font-size: clamp(var(--step-2), 6.4vw, var(--step-3)); margin-top: 6px; }
.demo-count {
  margin-top: 18px;
  text-align: right;
  color: var(--ink-soft); font-size: 0.9375rem; font-weight: 650;
}

.demo-banners { list-style: none; display: grid; gap: 10px; margin-top: 8px; }

.demo-banner {
  container-type: inline-size;
  position: relative;
  height: var(--banner-h);
  display: flex; align-items: center;
  border-radius: 16px;
  /* Characters stand in front of the banner and break out over its top edge, never below it. */
  clip-path: inset(calc(var(--banner-h) - var(--figure-h) - 8px) 0 0 0 round 0 0 16px 16px);
}
.demo-banner img {
  position: absolute; bottom: calc(var(--figure-h) * -0.12);
  width: var(--figure-w); height: auto;
  pointer-events: none;
}
.demo-banner.is-left img { left: 10px; }
.demo-banner.is-right img { right: 10px; }
.demo-banner span {
  font-size: min(2.3rem, 10cqi);
  line-height: 0.95;
  text-wrap: balance;
}
.demo-banner.is-left span { padding: 0 18px 0 calc(var(--figure-w) + 22px); }
.demo-banner.is-right span { padding: 0 calc(var(--figure-w) + 22px) 0 22px; }

[data-theme="dark"] .demo-banner img {
  filter: drop-shadow(1.5px 0 0 #fff) drop-shadow(-1.5px 0 0 #fff) drop-shadow(0 1.5px 0 #fff) drop-shadow(0 -1.5px 0 #fff);
}

.demo-copy { margin-top: 20px; color: var(--ink-soft); max-width: 60ch; }

.demo-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
[data-theme="dark"] .demo .btn-primary { background: var(--ink); color: var(--board); }
[data-theme="dark"] .demo .btn-primary:hover { background: #fff; }

@media (prefers-reduced-motion: no-preference) {
  .demo[open] { animation: demo-in 0.45s var(--spring); }
  .demo[open]::backdrop { animation: demo-fade 0.3s; }
  .demo[open] .demo-banner img {
    animation: demo-pop 0.75s var(--spring) both;
    animation-delay: calc(0.15s + var(--i) * 0.09s);
  }
}
@keyframes demo-in { from { opacity: 0; scale: 0.96; translate: 0 12px; } }
@keyframes demo-fade { from { opacity: 0; } }
@keyframes demo-pop { from { translate: 0 100%; } }

/* One more top-bar icon than upstream plans for: narrow the icons so they clear the centred nav. */
@container topbar (max-width: 520px) {
  .topbar-end { gap: 0; }
  .topbar-end .icon-btn { width: 36px; }
}
@container topbar (max-width: 345px) {
  .topbar-end .icon-btn { width: 32px; }
}
@container topbar (max-width: 300px) {
  .topbar-end .icon-btn { width: 30px; }
}

@media (max-width: 480px) {
  .demo { --banner-h: 76px; --figure-h: 100px; }
  .demo-banners { gap: 8px; }
  .demo-actions .btn { flex: 1; }
}
