/* Frontend deterrence only. No changes to layout, readable DOM or indexing.
   The JS class avoids applying these rules in an editor or with JS disabled. */

/* Replace older hook-based selection rules, which also covered NEWS bodies. */
html.sg-work-content-guard :where([data-sg-protect-text], img[data-sg-protect-image]) {
  -webkit-user-select: auto;
  user-select: auto;
}

/* Only the observed short-story prose and lyric-note body wrappers. */
html.sg-work-content-guard :where(
  .sg-short-story .sg-story-prose,
  .sg-short-story .sg-story-prose *,
  .sg-note-detail > .sg-reading-prose,
  .sg-note-detail > .sg-reading-prose *
) {
  -webkit-user-select: none;
  user-select: none;
}

/* Keep links, sharing, inquiry fields and embedded controls usable, including
   any protected wrapper accidentally placed inside an editable control. */
html.sg-work-content-guard :is(
  a, area, [role~="link"], input, textarea, select, option, optgroup, button, form,
  label, [contenteditable], [role~="textbox"], [role~="searchbox"],
  [role~="combobox"], [role~="button"], [role~="checkbox"], [role~="radio"],
  [role~="listbox"], [role~="option"], [role~="slider"], [role~="spinbutton"],
  [role~="switch"], iframe, embed, object, audio, video, summary, #wpadminbar
),
html.sg-work-content-guard :is(
  a, area, [role~="link"], input, textarea, select, option, optgroup, button, form,
  label, [contenteditable], [role~="textbox"], [role~="searchbox"],
  [role~="combobox"], [role~="button"], [role~="checkbox"], [role~="radio"],
  [role~="listbox"], [role~="option"], [role~="slider"], [role~="spinbutton"],
  [role~="switch"], iframe, embed, object, audio, video, summary, #wpadminbar
) * {
  -webkit-user-select: text;
  user-select: text;
}

html.sg-work-content-guard img {
  -webkit-user-drag: none;
}

html.sg-work-content-guard :is(
  input, textarea, select, option, optgroup, button, form, label, [contenteditable],
  [role~="textbox"], [role~="searchbox"], [role~="combobox"], [role~="button"],
  [role~="checkbox"], [role~="radio"], [role~="listbox"], [role~="option"],
  [role~="slider"], [role~="spinbutton"], [role~="switch"], iframe, embed, object,
  audio, video, summary, #wpadminbar
),
html.sg-work-content-guard :is(
  input, textarea, select, option, optgroup, button, form, label, [contenteditable],
  [role~="textbox"], [role~="searchbox"], [role~="combobox"], [role~="button"],
  [role~="checkbox"], [role~="radio"], [role~="listbox"], [role~="option"],
  [role~="slider"], [role~="spinbutton"], [role~="switch"], iframe, embed, object,
  audio, video, summary, #wpadminbar
) img {
  -webkit-user-drag: auto;
}

/* Defensive fail-open if an editor shell is mounted after frontend startup. */
html.sg-work-content-guard:is(.wp-admin, .block-editor-page, .editor-styles-wrapper) *,
html.sg-work-content-guard :is(.wp-admin, .block-editor-page, .editor-styles-wrapper),
html.sg-work-content-guard :is(.wp-admin, .block-editor-page, .editor-styles-wrapper) * {
  -webkit-user-select: auto;
  user-select: auto;
  -webkit-user-drag: auto;
}
