/* The native selection still owns text color, ranges, and copying. */
:root {
  --selection-solid: #ffd400;
}

html::selection,
html ::selection {
  background-color: var(--selection-solid);
  color: var(--okto-ink);
  -webkit-text-fill-color: var(--okto-ink);
  text-shadow: none;
}

html[data-okto-selection-active]::selection,
html[data-okto-selection-active] ::selection {
  background-color: #fff;
}

/* Selections in native controls and overlays keep the solid highlight. */
html[data-okto-selection-active] :is(.site-header, [role="dialog"], input, textarea, select, [contenteditable], dialog[open], [popover])::selection,
html[data-okto-selection-active] :is(.site-header, [role="dialog"], input, textarea, select, [contenteditable], dialog[open], [popover]) ::selection {
  background-color: var(--selection-solid);
}

.okto-selection-overlay {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  user-select: none;
  mix-blend-mode: multiply;
  opacity: .5;
  overflow: hidden;
}

.okto-selection-overlay[hidden] {
  display: none;
}

.okto-selection-rect {
  position: absolute;
  background-image: var(--okto-brand);
  background-repeat: no-repeat;
}

@media (forced-colors: active), (prefers-contrast: more) {
  html::selection,
  html ::selection,
  html[data-okto-selection-active]::selection,
  html[data-okto-selection-active] ::selection {
    background-color: Highlight !important;
    color: HighlightText !important;
    -webkit-text-fill-color: HighlightText !important;
  }

  .okto-selection-overlay {
    display: none !important;
  }
}

@media print {
  .okto-selection-overlay {
    display: none;
  }
}
