/* Match the nAI header in both themes. */
:root {
  --pmcb-nai-header-fill: var(--gold, #dfa924);
  scrollbar-color: var(--pmcb-nai-header-fill) transparent;
}

:root[data-theme="light"] {
  --pmcb-nai-header-fill: var(--action-fill, var(--b, #855015));
  --pmcb-nai-header-ink: var(--action-ink, white);
}

:root, :root * {
  scrollbar-width: thin;
}

#concept-dialog, #pmcb-fees-guide {
  scrollbar-color: inherit;
}

@supports not (scrollbar-color: red transparent) {
  :root, :root *, #concept-dialog, #pmcb-fees-guide {
    scrollbar-width: auto;
  }

  ::-webkit-scrollbar, .screen::-webkit-scrollbar {
    display: block;
    width: 7px;
    height: 7px;
  }

  ::-webkit-scrollbar-track, ::-webkit-scrollbar-corner {
    background: transparent;
  }

  ::-webkit-scrollbar-thumb {
    background: var(--pmcb-nai-header-fill);
    border-radius: 8px;
  }
}

@media (forced-colors: active) {
  :root {
    scrollbar-color: auto;
  }
}

nai-presenter[data-obscured] { visibility: hidden; }

/* Start as soon as showModal() moves the dialog into the top layer.
   Only the visual entrance is delayed. Focus and dismissal stay native. */
:root :is(dialog, #finder, #concept-dialog, #pmcb-fees-guide)[open] {
  animation: pmcb-dialog-enter 286ms cubic-bezier(.2, .7, .3, 1) 65ms backwards;
}

:root :is(dialog, #finder, #concept-dialog, #pmcb-fees-guide)[open]::backdrop {
  animation: pmcb-backdrop-enter 234ms ease-out backwards;
}

@keyframes pmcb-dialog-enter {
  from { opacity: 0; translate: 0 6px; }
  to { opacity: 1; translate: 0 0; }
}

@keyframes pmcb-backdrop-enter {
  from { opacity: 0; }
  to { opacity: 1; }
}

:root :is(dialog, #finder, #concept-dialog, #pmcb-fees-guide)[open][data-closing] {
  pointer-events: none;
  animation: pmcb-dialog-exit 200ms ease-in-out both;
}

:root :is(dialog, #finder, #concept-dialog, #pmcb-fees-guide)[open][data-closing]::backdrop {
  animation: pmcb-backdrop-exit 200ms ease-in-out both;
}

@keyframes pmcb-dialog-exit {
  from { opacity: var(--pmcb-exit-opacity, 1); translate: var(--pmcb-exit-translate, none); }
  to { opacity: 0; translate: var(--pmcb-exit-translate, none); }
}

@keyframes pmcb-backdrop-exit {
  from { opacity: var(--pmcb-backdrop-opacity, 1); }
  to { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  :root :is(dialog, #finder, #concept-dialog, #pmcb-fees-guide)[open][data-closing],
  :root :is(dialog, #finder, #concept-dialog, #pmcb-fees-guide)[open][data-closing]::backdrop,
  :root :is(dialog, #finder, #concept-dialog, #pmcb-fees-guide)[open],
  :root :is(dialog, #finder, #concept-dialog, #pmcb-fees-guide)[open]::backdrop {
    animation: none;
  }
}
