/* Popover entry and exit — HTML popover + CSS only.
   @starting-style gives the popover a "before" state to transition from when it
   opens. transition-behavior: allow-discrete keeps it on screen (display, overlay)
   while it animates out. Opening is slower with the enter curve; closing is
   quicker with the exit curve: things should leave faster than they arrive. */

.po {
  /* closed state — also where the exit animation goes to */
  opacity: 0;
  transform: translateY(12px) scale(0.96);
  transition:
    opacity var(--duration-fast) var(--ease-exit),
    transform var(--duration-fast) var(--ease-exit),
    overlay var(--duration-fast) allow-discrete,
    display var(--duration-fast) allow-discrete;
}

.po:popover-open {
  opacity: 1;
  transform: none;
  transition:
    opacity var(--duration-base) var(--ease-standard),
    transform var(--duration-slow) var(--ease-enter),
    overlay var(--duration-slow) allow-discrete,
    display var(--duration-slow) allow-discrete;
}

/* where the entry animation starts from */
@starting-style {
  .po:popover-open {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
  }
}

/* the backdrop dims with the same timing (opacity, not colour) */
.po::backdrop {
  background: rgb(0 0 0 / 0.45);
  opacity: 0;
  transition:
    opacity var(--duration-fast) var(--ease-exit),
    overlay var(--duration-fast) allow-discrete,
    display var(--duration-fast) allow-discrete;
}
.po:popover-open::backdrop { opacity: 1; transition-duration: var(--duration-base); }
@starting-style {
  .po:popover-open::backdrop { opacity: 0; }
}

/* Reduced motion: no movement, only a short fade. */
@media (prefers-reduced-motion: reduce) {
  .po,
  .po:popover-open { transform: none; }
  @starting-style {
    .po:popover-open { transform: none; }
  }
}

/* demo layout */
.po-stage { min-height: 100svh; display: grid; align-content: center; justify-items: start; gap: 24px; max-width: 980px; margin: 0 auto; padding: 96px 28px; }
.po-stage h1 { margin: 0; font: 700 clamp(44px, 7vw, 96px)/1 var(--font-display, system-ui, sans-serif); letter-spacing: -0.035em; }
.po-trigger, .po__close {
  border: 0;
  border-radius: 999px;
  padding: 14px 24px;
  background: var(--accent, #ff6a3d);
  color: var(--accent-ink, #160d08);
  font: 600 16px var(--font-ui, system-ui, sans-serif);
  cursor: pointer;
}
.po {
  width: min(360px, calc(100vw - 32px));
  padding: 22px;
  border: 1px solid #2d2924;
  border-radius: 20px;
  background: #171512;
  color: var(--text, #f0ebe2);
  box-shadow: 0 30px 80px rgb(0 0 0 / 0.5);
}
.po__title { margin: 0 0 12px; font: 600 18px var(--font-display, system-ui, sans-serif); }
.po__list { margin: 0 0 16px; padding: 0; list-style: none; display: grid; gap: 4px; }
.po__list button { width: 100%; text-align: start; border: 0; border-radius: 10px; padding: 12px; background: transparent; color: inherit; font: 500 15px var(--font-ui, system-ui, sans-serif); cursor: pointer; }
.po__list button:hover { background: #1f1c18; }
.po__close { padding: 10px 18px; font-size: 14px; background: #2d2924; color: var(--text, #f0ebe2); }
