/* One dismiss control: transparent 52px hit target, 36px circle, 20px cross.
   Hosts keep display/positioning and existing close/focus handlers. */
:root {
  --outlo-close-size: 52px;
  --outlo-close-icon-size: 20px;
  --outlo-close-background: #e2e4e9;
  --outlo-close-hover: #d5d9e1;
  --outlo-close-pressed: #cbd0da;
  --outlo-close-foreground: #343741;
  --outlo-close-blur: none;
}
/* Zero specificity preserves absolute positioning owned by floating hosts. */
:where(button.outlo-close) { position: relative; }
body button.outlo-close {
  box-sizing: border-box !important;
  isolation: isolate;
  flex: 0 0 var(--outlo-close-size) !important;
  width: var(--outlo-close-size) !important;
  min-width: var(--outlo-close-size) !important;
  max-width: var(--outlo-close-size) !important;
  height: var(--outlo-close-size) !important;
  min-height: var(--outlo-close-size) !important;
  max-height: var(--outlo-close-size) !important;
  padding: 16px !important;
  gap: 0 !important;
  align-items: center !important;
  justify-content: center !important;
  place-items: center !important;
  border: 0 !important;
  border-radius: 50% !important;
  background: transparent !important;
  color: var(--outlo-close-foreground) !important;
  box-shadow: none !important;
  font-size: 0 !important;
  line-height: 0 !important;
  text-shadow: none !important;
  transform: none !important;
  overflow: visible !important;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
/* Only artwork/photo viewers need the dark treatment. */
body :is(#closeDetail, #posterLightboxClose, .notification-lightbox .notification-dialog-close).outlo-close {
  --outlo-close-background: rgb(24 24 27 / 72%);
  --outlo-close-hover: rgb(24 24 27 / 88%);
  --outlo-close-pressed: rgb(24 24 27 / 96%);
  --outlo-close-foreground: #fff;
  --outlo-close-blur: blur(6px);
}
/* Keep nodes/listeners while replacing font signs and older SVG sets.
   The drawing fills more of its canvas so the cross stays clear at small sizes. */
body button.outlo-close > * { display: none !important; }
body button.outlo-close::before {
  content: "" !important;
  position: relative !important;
  z-index: 1;
  display: block !important;
  flex: none;
  width: var(--outlo-close-icon-size) !important;
  height: var(--outlo-close-icon-size) !important;
  inset: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: currentColor !important;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m4 4 16 16M20 4 4 20' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m4 4 16 16M20 4 4 20' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
  transform: none !important;
  pointer-events: none;
}
/* Reset legacy tooltip geometry so ::after remains the circle. */
body button.outlo-close::after {
  content: "" !important;
  position: absolute !important;
  z-index: 0 !important;
  display: block !important;
  inset: 8px !important;
  width: auto !important;
  min-width: 0 !important;
  height: auto !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 50% !important;
  background: var(--outlo-close-background) !important;
  box-shadow: none !important;
  backdrop-filter: var(--outlo-close-blur);
  opacity: 1 !important;
  visibility: visible !important;
  transform: none !important;
  pointer-events: none !important;
  transition: background-color 140ms ease !important;
}
body button.outlo-close[hidden] { display: none !important; }
body button.outlo-close:focus-visible {
  outline: 2px solid var(--outlo-brand-accent, #4f46e5) !important;
  outline-offset: 0 !important;
}
@media (hover: hover) {
  body button.outlo-close:hover:not(:disabled):not([aria-disabled=true])::after {
    background: var(--outlo-close-hover) !important;
  }
}
body button.outlo-close:active:not(:disabled):not([aria-disabled=true])::after {
  background: var(--outlo-close-pressed) !important;
}
body button.outlo-close:is(:disabled, [aria-disabled=true]) { opacity: .45 !important; cursor: not-allowed; }

/* The actual button owns the hit area, with the visible circle 12px inset. */
body.map-page #detailPanel .detail-sticky-controls { padding: 4px; }
body.map-page #detailPanel > .detail-sticky-header #closeDetail.outlo-close { position: relative; inset: auto; margin: 0; }
#eventPeopleDialog .event-people-close.outlo-close { top: 4px; right: 4px; }

/* Reserve space in compact headers; hosts still control mobile visibility
   and the distinct field-clearing state of the search button. */
.outlo-consent .outlo-consent__close.outlo-close { margin: 0 0 0 auto; }
.notification-news-dialog .notification-dialog-close.outlo-close { margin-right: 0; }
.discovery-location-nudge .discovery-location-nudge-heading { grid-template-columns: 28px minmax(0, 1fr) var(--outlo-close-size); }
.outlo-editor-backup .outlo-editor-backup__header { min-height: 44px; padding-right: 52px; }
.outlo-editor-backup .outlo-editor-backup__close.outlo-close { inset: 4px 4px auto auto; }
.pi-editor .pi-dialog .pi-close.outlo-close { margin: -8px -8px 0 0; }
#eventCreateGuideDialog .create-guide__close.outlo-close,
#organizerWelcomeDialog.rules-dialog #organizerRulesClose.outlo-close { top: 4px; right: 4px; }
#eventCreateGuideDialog .create-guide__header { padding-right: 68px; }
#organizerWelcomeDialog.rules-dialog .rules-dialog-head:has(#organizerRulesClose:not([hidden])) { padding-right: 68px; }
#topbarSearchForm .mobile-search-close.outlo-close { top: calc(50% - 26px) !important; }
.map-page #mapFilterPopoverClose.outlo-close { top: -8px; right: -8px; }
.map-page #mapFilterPopoverChips > .map-filter-popover-group:first-child:not([data-filter-group="saved"]) > .map-filter-popover-group-title,
.map-page #mapFilterPopoverChips > [data-filter-group="saved"]:first-child > .map-filter-popover-options { min-height: 44px; padding-right: 52px; }
@media (prefers-reduced-motion: reduce) { body button.outlo-close::after { transition: none !important; } }
@media (forced-colors: active) {
  body button.outlo-close { color: ButtonText !important; }
  body button.outlo-close::after { background: Canvas !important; border: 1px solid ButtonText !important; }
  body button.outlo-close:focus-visible { outline-color: Highlight !important; }
  body button.outlo-close::before { forced-color-adjust: none; }
}
