/*
 * One close button for the whole site (2026-11-12).
 *
 * Close buttons were drawn some forty ways: text "×" glyphs that sit high and
 * to the right of their circle, icon fonts at different sizes, square and
 * round, bordered and bare. This sheet gives every close control the same
 * quiet glass circle and a drawn X that is centred by layout, not by a font.
 *
 * Loaded after styles.min.css on every page (public/includes/header.php).
 * Position stays with each component; this sheet owns size, shape and glyph.
 * Display uses :where() so a component that hides its close button at some
 * width (display: none) still can; centring is forced so flex and grid both work.
 */

:root {
  --eg-close-size: 40px;
  --eg-close-size-sm: 32px;
  --eg-close-x: 14px;
  --eg-close-x-sm: 11px;
  --eg-close-ring: #d9b85f;
  --eg-close-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 5l14 14M19 5L5 19' stroke='%23000' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E");
}

/* Default display for buttons whose component does not set one. */
:where(
  .eg-modal-close, .chat-settings-close, .chat-profile-close, .museum-modal-close, .posts-modal-close,
  .gx-viewer-close, .tea-sheet-close, .eg-sheet-close, .ms-rail-sheet-close, .council-help-close,
  .archive-view-close, .cando-close, .pet-share-close, .rds-x, .pps-x, .uac-who-close, .uac-sheet-close,
  .we-drawer-close, [id="weInspectorClose"], .blog-image-panel-close, [id="scenarioCheckpointClose"],
  [data-eg-lightbox-close], .persona-share-card-icon-btn[data-share-card-close],
  button[data-persona-ask-report-close]:not(.btn), .bv-icon[data-idea-close], .wr-icon-btn[data-dialog-close],
  .ra-icon[data-ra-contents-close], .rs-icon[data-close], .rch-icon[data-close], .sc-icon-btn[data-close],
  .sc-icon-btn[data-close-drawer], button[data-academic-history-close="ask"],
  .studio-owner-bar-close, .persona-home-starter-dismiss, .free-trial-banner-close, .eg-locale-notice-close,
  .pw-chat-card-x, .pw-peek-x, .chat-limit-card__close, .academic-map-detail-close, .st-invite-close,
  .atlas-mini-close, [id="chatOnboardingDismiss"]
):where(:not([hidden])) {
  display: inline-grid;
}

/* The shared shape. */
:is(
  .eg-modal-close, .chat-settings-close, .chat-profile-close, .museum-modal-close, .posts-modal-close,
  .gx-viewer-close, .tea-sheet-close, .eg-sheet-close, .ms-rail-sheet-close, .council-help-close,
  .archive-view-close, .cando-close, .pet-share-close, .rds-x, .pps-x, .uac-who-close, .uac-sheet-close,
  .we-drawer-close, [id="weInspectorClose"], .blog-image-panel-close, [id="scenarioCheckpointClose"],
  [data-eg-lightbox-close], .persona-share-card-icon-btn[data-share-card-close],
  button[data-persona-ask-report-close]:not(.btn), .bv-icon[data-idea-close], .wr-icon-btn[data-dialog-close],
  .ra-icon[data-ra-contents-close], .rs-icon[data-close], .rch-icon[data-close], .sc-icon-btn[data-close],
  .sc-icon-btn[data-close-drawer], button[data-academic-history-close="ask"],
  .studio-owner-bar-close, .persona-home-starter-dismiss, .free-trial-banner-close, .eg-locale-notice-close,
  .pw-chat-card-x, .pw-peek-x, .chat-limit-card__close, .academic-map-detail-close, .st-invite-close,
  .atlas-mini-close, [id="chatOnboardingDismiss"]
) {
  --eg-close-s: var(--eg-close-size);
  --eg-close-g: var(--eg-close-x);
  box-sizing: border-box !important;
  width: var(--eg-close-s) !important;
  height: var(--eg-close-s) !important;
  min-width: 0 !important;
  min-height: 0 !important;
  max-width: none !important;
  padding: 0 !important;
  flex: 0 0 auto;
  place-items: center !important;
  place-content: center !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 50% !important;
  border: 1px solid color-mix(in srgb, currentColor 22%, transparent) !important;
  background: color-mix(in srgb, currentColor 7%, transparent) !important;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: none !important;
  font-size: 0 !important;
  line-height: 0 !important;
  letter-spacing: 0 !important;
  text-decoration: none !important;
  cursor: pointer;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  transition: background-color .2s ease, border-color .2s ease, color .2s ease, opacity .2s ease;
}

/* Inline dismissals: banners, cards, chips. */
:is(
  .studio-owner-bar-close, .persona-home-starter-dismiss, .free-trial-banner-close, .eg-locale-notice-close,
  .pw-chat-card-x, .pw-peek-x, .chat-limit-card__close, .academic-map-detail-close, .st-invite-close,
  .atlas-mini-close, [id="chatOnboardingDismiss"]
) {
  --eg-close-s: var(--eg-close-size-sm);
  --eg-close-g: var(--eg-close-x-sm);
}

/* The old glyph (a font icon or a "×" character) gives way to the drawn X. */
:is(
  .eg-modal-close, .chat-settings-close, .chat-profile-close, .museum-modal-close, .posts-modal-close,
  .gx-viewer-close, .tea-sheet-close, .eg-sheet-close, .ms-rail-sheet-close, .council-help-close,
  .archive-view-close, .cando-close, .pet-share-close, .rds-x, .pps-x, .uac-who-close, .uac-sheet-close,
  .we-drawer-close, [id="weInspectorClose"], .blog-image-panel-close, [id="scenarioCheckpointClose"],
  [data-eg-lightbox-close], .persona-share-card-icon-btn[data-share-card-close],
  button[data-persona-ask-report-close]:not(.btn), .bv-icon[data-idea-close], .wr-icon-btn[data-dialog-close],
  .ra-icon[data-ra-contents-close], .rs-icon[data-close], .rch-icon[data-close], .sc-icon-btn[data-close],
  .sc-icon-btn[data-close-drawer], button[data-academic-history-close="ask"],
  .studio-owner-bar-close, .persona-home-starter-dismiss, .free-trial-banner-close, .eg-locale-notice-close,
  .pw-chat-card-x, .pw-peek-x, .chat-limit-card__close, .academic-map-detail-close, .st-invite-close,
  .atlas-mini-close, [id="chatOnboardingDismiss"]
) > * {
  display: none !important;
}

:is(
  .eg-modal-close, .chat-settings-close, .chat-profile-close, .museum-modal-close, .posts-modal-close,
  .gx-viewer-close, .tea-sheet-close, .eg-sheet-close, .ms-rail-sheet-close, .council-help-close,
  .archive-view-close, .cando-close, .pet-share-close, .rds-x, .pps-x, .uac-who-close, .uac-sheet-close,
  .we-drawer-close, [id="weInspectorClose"], .blog-image-panel-close, [id="scenarioCheckpointClose"],
  [data-eg-lightbox-close], .persona-share-card-icon-btn[data-share-card-close],
  button[data-persona-ask-report-close]:not(.btn), .bv-icon[data-idea-close], .wr-icon-btn[data-dialog-close],
  .ra-icon[data-ra-contents-close], .rs-icon[data-close], .rch-icon[data-close], .sc-icon-btn[data-close],
  .sc-icon-btn[data-close-drawer], button[data-academic-history-close="ask"],
  .studio-owner-bar-close, .persona-home-starter-dismiss, .free-trial-banner-close, .eg-locale-notice-close,
  .pw-chat-card-x, .pw-peek-x, .chat-limit-card__close, .academic-map-detail-close, .st-invite-close,
  .atlas-mini-close, [id="chatOnboardingDismiss"]
)::before {
  content: "" !important;
  display: block !important;
  position: static !important;
  width: var(--eg-close-g) !important;
  height: var(--eg-close-g) !important;
  margin: auto !important;
  background: currentColor !important;
  -webkit-mask: var(--eg-close-mask) center / contain no-repeat;
  mask: var(--eg-close-mask) center / contain no-repeat;
  transition: transform .35s cubic-bezier(.2, .8, .2, 1);
}

:is(
  .eg-modal-close, .chat-settings-close, .chat-profile-close, .museum-modal-close, .posts-modal-close,
  .gx-viewer-close, .tea-sheet-close, .eg-sheet-close, .ms-rail-sheet-close, .council-help-close,
  .archive-view-close, .cando-close, .pet-share-close, .rds-x, .pps-x, .uac-who-close, .uac-sheet-close,
  .we-drawer-close, [id="weInspectorClose"], .blog-image-panel-close, [id="scenarioCheckpointClose"],
  [data-eg-lightbox-close], .persona-share-card-icon-btn[data-share-card-close],
  button[data-persona-ask-report-close]:not(.btn), .bv-icon[data-idea-close], .wr-icon-btn[data-dialog-close],
  .ra-icon[data-ra-contents-close], .rs-icon[data-close], .rch-icon[data-close], .sc-icon-btn[data-close],
  .sc-icon-btn[data-close-drawer], button[data-academic-history-close="ask"],
  .studio-owner-bar-close, .persona-home-starter-dismiss, .free-trial-banner-close, .eg-locale-notice-close,
  .pw-chat-card-x, .pw-peek-x, .chat-limit-card__close, .academic-map-detail-close, .st-invite-close,
  .atlas-mini-close, [id="chatOnboardingDismiss"]
):is(:hover, :focus-visible) {
  background: color-mix(in srgb, currentColor 14%, transparent) !important;
  border-color: color-mix(in srgb, currentColor 40%, transparent) !important;
}

:is(
  .eg-modal-close, .chat-settings-close, .chat-profile-close, .museum-modal-close, .posts-modal-close,
  .gx-viewer-close, .tea-sheet-close, .eg-sheet-close, .ms-rail-sheet-close, .council-help-close,
  .archive-view-close, .cando-close, .pet-share-close, .rds-x, .pps-x, .uac-who-close, .uac-sheet-close,
  .we-drawer-close, [id="weInspectorClose"], .blog-image-panel-close, [id="scenarioCheckpointClose"],
  [data-eg-lightbox-close], .persona-share-card-icon-btn[data-share-card-close],
  button[data-persona-ask-report-close]:not(.btn), .bv-icon[data-idea-close], .wr-icon-btn[data-dialog-close],
  .ra-icon[data-ra-contents-close], .rs-icon[data-close], .rch-icon[data-close], .sc-icon-btn[data-close],
  .sc-icon-btn[data-close-drawer], button[data-academic-history-close="ask"],
  .studio-owner-bar-close, .persona-home-starter-dismiss, .free-trial-banner-close, .eg-locale-notice-close,
  .pw-chat-card-x, .pw-peek-x, .chat-limit-card__close, .academic-map-detail-close, .st-invite-close,
  .atlas-mini-close, [id="chatOnboardingDismiss"]
):hover::before {
  transform: rotate(90deg);
}

:is(
  .eg-modal-close, .chat-settings-close, .chat-profile-close, .museum-modal-close, .posts-modal-close,
  .gx-viewer-close, .tea-sheet-close, .eg-sheet-close, .ms-rail-sheet-close, .council-help-close,
  .archive-view-close, .cando-close, .pet-share-close, .rds-x, .pps-x, .uac-who-close, .uac-sheet-close,
  .we-drawer-close, [id="weInspectorClose"], .blog-image-panel-close, [id="scenarioCheckpointClose"],
  [data-eg-lightbox-close], .persona-share-card-icon-btn[data-share-card-close],
  button[data-persona-ask-report-close]:not(.btn), .bv-icon[data-idea-close], .wr-icon-btn[data-dialog-close],
  .ra-icon[data-ra-contents-close], .rs-icon[data-close], .rch-icon[data-close], .sc-icon-btn[data-close],
  .sc-icon-btn[data-close-drawer], button[data-academic-history-close="ask"],
  .studio-owner-bar-close, .persona-home-starter-dismiss, .free-trial-banner-close, .eg-locale-notice-close,
  .pw-chat-card-x, .pw-peek-x, .chat-limit-card__close, .academic-map-detail-close, .st-invite-close,
  .atlas-mini-close, [id="chatOnboardingDismiss"]
):active::before {
  transform: rotate(90deg) scale(.86);
}

:is(
  .eg-modal-close, .chat-settings-close, .chat-profile-close, .museum-modal-close, .posts-modal-close,
  .gx-viewer-close, .tea-sheet-close, .eg-sheet-close, .ms-rail-sheet-close, .council-help-close,
  .archive-view-close, .cando-close, .pet-share-close, .rds-x, .pps-x, .uac-who-close, .uac-sheet-close,
  .we-drawer-close, [id="weInspectorClose"], .blog-image-panel-close, [id="scenarioCheckpointClose"],
  [data-eg-lightbox-close], .persona-share-card-icon-btn[data-share-card-close],
  button[data-persona-ask-report-close]:not(.btn), .bv-icon[data-idea-close], .wr-icon-btn[data-dialog-close],
  .ra-icon[data-ra-contents-close], .rs-icon[data-close], .rch-icon[data-close], .sc-icon-btn[data-close],
  .sc-icon-btn[data-close-drawer], button[data-academic-history-close="ask"],
  .studio-owner-bar-close, .persona-home-starter-dismiss, .free-trial-banner-close, .eg-locale-notice-close,
  .pw-chat-card-x, .pw-peek-x, .chat-limit-card__close, .academic-map-detail-close, .st-invite-close,
  .atlas-mini-close, [id="chatOnboardingDismiss"]
):focus-visible {
  outline: 2px solid var(--eg-close-ring) !important;
  outline-offset: 2px !important;
}

/* Over photographs and video the circle needs its own dark glass to stay legible. */
html body :is([data-eg-lightbox-close], .activation-next-hero .eg-modal-close) {
  color: #fff !important;
  background: rgba(14, 13, 17, 0.55) !important;
  border-color: rgba(255, 255, 255, 0.24) !important;
}
html body :is([data-eg-lightbox-close], .activation-next-hero .eg-modal-close):is(:hover, :focus-visible) {
  background: rgba(14, 13, 17, 0.75) !important;
  border-color: rgba(255, 255, 255, 0.5) !important;
}

/* Fingers need a larger target. */
@media (pointer: coarse) {
  :root {
    --eg-close-size: 44px;
    --eg-close-size-sm: 38px;
  }
}

@media (prefers-reduced-motion: reduce) {
  :is(
    .eg-modal-close, .chat-settings-close, .chat-profile-close, .museum-modal-close, .posts-modal-close,
    .gx-viewer-close, .tea-sheet-close, .eg-sheet-close, .ms-rail-sheet-close, .council-help-close,
    .archive-view-close, .cando-close, .pet-share-close, .rds-x, .pps-x, .uac-who-close, .uac-sheet-close,
    .we-drawer-close, [id="weInspectorClose"], .blog-image-panel-close, [id="scenarioCheckpointClose"],
    [data-eg-lightbox-close], .persona-share-card-icon-btn[data-share-card-close],
    button[data-persona-ask-report-close]:not(.btn), .bv-icon[data-idea-close], .wr-icon-btn[data-dialog-close],
    .ra-icon[data-ra-contents-close], .rs-icon[data-close], .rch-icon[data-close], .sc-icon-btn[data-close],
    .sc-icon-btn[data-close-drawer], button[data-academic-history-close="ask"],
    .studio-owner-bar-close, .persona-home-starter-dismiss, .free-trial-banner-close, .eg-locale-notice-close,
    .pw-chat-card-x, .pw-peek-x, .chat-limit-card__close, .academic-map-detail-close, .st-invite-close,
    .atlas-mini-close, [id="chatOnboardingDismiss"]
  )::before {
    transition: none;
  }
}
