/* === Admin UI overrides === */
/* Scope: any element inside a parent with apos- class, when admin is logged in.
   :where() caps specificity at element-only level — admin's apos- class styles always win. */

/* UL/LI — remove main.css padding that indents admin list items */
:where(body[data-apos-generated]) :where([class*="apos-"]) ul {
  padding: 0;
}
:where(body[data-apos-generated]) :where([class*="apos-"]) ul li {
  padding: 0;
}

/* OL — revert counter reset injected by main.css */
:where(body[data-apos-generated]) :where([class*="apos-"]) ol {
  list-style: revert;
  counter-reset: revert;
}

/* Li — restore list-style overridden by main.css */
:where(body[data-apos-generated]) :where([class*="apos-"]) li {
  list-style: revert;
}

/* Remove orange dots injected by main.css ul li::before */
:where(body[data-apos-generated]) :where([class*="apos-"]) ul li::before {
  content: none;
  background: none;
  width: auto;
  height: auto;
  position: static;
  left: auto;
  top: auto;
  border-radius: 0;
}

/* Remove numbered counters injected by main.css ol li::before */
:where(body[data-apos-generated]) :where([class*="apos-"]) ol li::before {
  content: none;
  counter-increment: none;
}

/* Form controls — restore appearance stripped by main.css */
:where(body[data-apos-generated]) :where([class*="apos-"]) button,
:where(body[data-apos-generated]) :where([class*="apos-"]) input,
:where(body[data-apos-generated]) :where([class*="apos-"]) textarea,
:where(body[data-apos-generated]) :where([class*="apos-"]) select {
  -webkit-appearance: revert;
  -moz-appearance: revert;
  appearance: revert;
  border: revert;
  border-radius: revert;
  background: revert;
  box-shadow: revert;
}

/* Headings — restore font/color/padding */
:where(body[data-apos-generated]) :where([class*="apos-"]) h1,
:where(body[data-apos-generated]) :where([class*="apos-"]) h2,
:where(body[data-apos-generated]) :where([class*="apos-"]) h3,
:where(body[data-apos-generated]) :where([class*="apos-"]) h4,
:where(body[data-apos-generated]) :where([class*="apos-"]) h5,
:where(body[data-apos-generated]) :where([class*="apos-"]) h6 {
  padding: revert;
  font: revert;
  color: revert;
}

/* Images — restore default margins */
:where(body[data-apos-generated]) :where([class*="apos-"]) img {
  margin: revert;
  user-select: revert;
}

/* Links — restore default color */
:where(body[data-apos-generated]) :where([class*="apos-"]) a {
  color: revert;
  transition: revert;
}

/* Paragraphs — restore default spacing */
:where(body[data-apos-generated]) :where([class*="apos-"]) p {
  padding: revert;
}

/* Tables — restore default margin */
:where(body[data-apos-generated]) :where([class*="apos-"]) table {
  margin: revert;
}

/* Blockquotes — restore default styling */
:where(body[data-apos-generated]) :where([class*="apos-"]) blockquote {
  margin: revert;
  padding: revert;
  background: revert;
  box-shadow: revert;
  border-radius: revert;
}

/* Breadcrumbs — fix numbered list injected by main.css */
ol.apos-area-widget__breadcrumbs {
  list-style-type: none !important;
  padding-left: 0;
  margin: 0;
}

/* Decorative side illustrations (DefaultPage & co) are lazy-loaded via
   main.js, which does not run in the admin in-context editor: the <img>
   stays a transparent 1x1 GIF but keeps its 273x384 absolutely-positioned
   box. That box sits above the rich-text toolbar (the tippy popper's
   z-index is trapped inside .inner-content__main's z-index:1 stacking
   context, and the z-index:1 images come later in DOM order) and swallows
   clicks on toolbar tools that overflow the editor column. Decorations
   have no interactions — disable hit-testing in edit mode. */
body[data-apos-generated] .side-element {
  pointer-events: none;
}

/* === Inline editor (in-context) content: WYSIWYG site typography === */
/* Scope: only the ProseMirror content, never the toolbar/admin UI.
   Specificity (0,3,1) beats both the admin bundle's scoped editor rules
   ([data-v] .apos-rich-text-editor__editor .ProseMirror, (0,3,0) /
   [data-v] .ProseMirror > * + *, (0,2,0)) and the :where() reverts above
   ((0,0,1)). */

/* Neutralize editor defaults: .ProseMirror > * + * { margin-top: .75em }
   and .ProseMirror { padding: 10px 0 } (AposRichTextWidgetEditor.vue) */
body .apos-rich-text-editor__editor .ProseMirror.tiptap {
  padding: 0;
}
body .apos-rich-text-editor__editor .ProseMirror.tiptap > * + * {
  margin-top: 0;
}

/* Paragraphs (.rich-text-widget values from main.css) */
body .apos-rich-text-editor__editor .ProseMirror.tiptap p {
  margin: 0 0 1em;
}
body .apos-rich-text-editor__editor .ProseMirror.tiptap p:last-child {
  margin-bottom: 0;
}
body .apos-rich-text-editor__editor .ProseMirror.tiptap li > p {
  margin: 0 0 0.5em;
}
body .apos-rich-text-editor__editor .ProseMirror.tiptap li > p:last-child {
  margin-bottom: 0;
}

/* Headings (global h1–h6 from main.css) */
body .apos-rich-text-editor__editor .ProseMirror.tiptap h1 {
  font: 600 3.125rem/1 "Accia Sans", sans-serif;
  color: #000;
}
body .apos-rich-text-editor__editor .ProseMirror.tiptap h2 {
  font: 600 2rem/1 "Accia Sans", sans-serif;
  color: #000;
}
body .apos-rich-text-editor__editor .ProseMirror.tiptap h3 {
  font: 600 1.3125rem/1 "Accia Sans", sans-serif;
  color: #000;
}
body .apos-rich-text-editor__editor .ProseMirror.tiptap h4 {
  font: 600 1.1875rem/1.1071 "Accia Sans", sans-serif;
  color: #000;
}
body .apos-rich-text-editor__editor .ProseMirror.tiptap h5 {
  font: 600 1.125rem/1.1818 "Accia Sans", sans-serif;
  color: #000;
}
body .apos-rich-text-editor__editor .ProseMirror.tiptap h6 {
  font: 500 1rem/1.6875 "Accia Sans", sans-serif;
  color: #000;
}

/* Heading rhythm (.rich-text-widget values from main.css) */
body .apos-rich-text-editor__editor .ProseMirror.tiptap h1,
body .apos-rich-text-editor__editor .ProseMirror.tiptap h2 {
  margin: 1.5em 0 0.75em;
}
body .apos-rich-text-editor__editor .ProseMirror.tiptap h3 {
  margin: 1.25em 0 0.625em;
}
body .apos-rich-text-editor__editor .ProseMirror.tiptap h4,
body .apos-rich-text-editor__editor .ProseMirror.tiptap h5,
body .apos-rich-text-editor__editor .ProseMirror.tiptap h6 {
  margin: 1em 0 0.5em;
}
body .apos-rich-text-editor__editor .ProseMirror.tiptap h1:first-child,
body .apos-rich-text-editor__editor .ProseMirror.tiptap h2:first-child,
body .apos-rich-text-editor__editor .ProseMirror.tiptap h3:first-child,
body .apos-rich-text-editor__editor .ProseMirror.tiptap h4:first-child,
body .apos-rich-text-editor__editor .ProseMirror.tiptap h5:first-child,
body .apos-rich-text-editor__editor .ProseMirror.tiptap h6:first-child {
  margin-top: 0;
}

/* Lists (global main.css + .rich-text-widget overrides) */
body .apos-rich-text-editor__editor .ProseMirror.tiptap ul,
body .apos-rich-text-editor__editor .ProseMirror.tiptap ol {
  margin: 0 0 1em;
  padding: 0;
  list-style: none;
}
body .apos-rich-text-editor__editor .ProseMirror.tiptap ol {
  counter-reset: item;
}
body .apos-rich-text-editor__editor .ProseMirror.tiptap ul li,
body .apos-rich-text-editor__editor .ProseMirror.tiptap ol li {
  padding: 0 0 0 40px;
  position: relative;
}
body .apos-rich-text-editor__editor .ProseMirror.tiptap ul li:before {
  content: "";
  width: 4px;
  height: 4px;
  position: absolute;
  left: 20px;
  top: 11px;
  background: #ff6231;
  border-radius: 50%;
}
body .apos-rich-text-editor__editor .ProseMirror.tiptap ol li:before {
  content: counter(item, decimal) ".";
  counter-increment: item;
  position: absolute;
  left: 20px;
  top: 0;
  transform: translateX(-50%);
}

/* Images */
body .apos-rich-text-editor__editor .ProseMirror.tiptap img {
  display: block;
  margin: 0 0 30px;
  user-select: none;
}

/* Links */
body .apos-rich-text-editor__editor .ProseMirror.tiptap a {
  color: #000;
  text-decoration: none;
  transition: 0.3s ease-out;
}
