.g-root .yfm:not(.yfm_only-light) {
  --yfm-file-icon-color: var(--g-color-text-primary);
}

.g-root {
  --yfm-color-text-gray: var(--g-color-text-secondary);
  --yfm-color-text-yellow: var(--g-color-private-yellow-600-solid);
  --yfm-color-text-orange: var(--g-color-private-orange-500-solid);
  --yfm-color-text-red: var(--g-color-text-danger);
  --yfm-color-text-green: var(--g-color-text-positive);
  --yfm-color-text-blue: var(--g-color-text-info);
  --yfm-color-text-violet: var(--g-color-text-utility);
}

.g-root {
  --yfm-colorify-black: var(--g-color-text-primary);
  --yfm-colorify-gray: var(--yfm-color-text-gray);
  --yfm-colorify-yellow: var(--yfm-color-text-yellow);
  --yfm-colorify-orange: var(--yfm-color-text-orange);
  --yfm-colorify-red: var(--yfm-color-text-red);
  --yfm-colorify-green: var(--yfm-color-text-green);
  --yfm-colorify-blue: var(--yfm-color-text-blue);
  --yfm-colorify-violet: var(--yfm-color-text-violet);
}

.yfm {
  --yfm-color-base: var(--g-color-base-background);
  --yfm-color-text: var(--g-color-text-primary);
  --yfm-color-link: var(--g-color-text-link);
  --yfm-color-link-hover: var(--g-color-text-link-hover);
  --yfm-color-border: var(--g-color-line-generic);
  --yfm-color-accent: var(--g-color-line-brand);
  --yfm-color-inline-code: var(--g-color-text-misc);
  --yfm-color-inline-code-background: var(--g-color-base-misc-light);
  --yfm-color-code-background: var(--g-color-base-misc-light);
  --yfm-color-note-tip: var(--g-color-text-positive);
  --yfm-color-note-tip-background: var(--g-color-base-positive-light);
  --yfm-color-note-warning: var(--g-color-text-warning);
  --yfm-color-note-warning-background: var(--g-color-base-warning-light);
  --yfm-color-note-important: var(--g-color-text-danger);
  --yfm-color-note-important-background: var(--g-color-base-danger-light);
  --yfm-color-note-info: var(--g-color-text-info);
  --yfm-color-note-info-background: var(--g-color-base-info-light);
  --yfm-color-term-title: var(--g-color-text-brand);
  --yfm-color-term-title-hover: var(--g-color-text-brand-heavy);
  --yfm-color-term-dfn-background: var(--g-color-base-float);
  --yfm-color-term-dfn-shadow: var(--g-color-sfx-shadow);
  --yfm-color-term-dfn-pseudo-shadow: var(--g-color-line-generic);
  --yfm-color-modal-content: var(--g-color-base-modal);
  --yfm-color-modal-actions-hover: var(--g-color-base-simple-hover);
  --yfm-color-modal-wide-content: var(--g-color-text-primary);
  --yfm-color-modal-wide-content-overlay: var(--g-color-sfx-veil);
  --yfm-color-table: var(--g-color-text-primary);
  --yfm-color-table-row-background: var(--g-color-base-generic);
  --yfm-color-table-border: var(--g-color-line-generic);
  --yfm-color-table-background: var(--g-color-base-background);
  --yfm-color-table-head-background: var(--g-color-base-generic);
  --yfm-color-table-stripe-row-background: var(--g-color-base-generic);
}

.yfm {
  --yfm-color-base: var(--g-color-base-background);
  --yfm-color-text: var(--g-color-text-primary);
  --yfm-color-link: var(--g-color-text-link);
  --yfm-color-link-hover: var(--g-color-text-link-hover);
  --yfm-color-border: var(--g-color-line-generic);
  --yfm-color-accent: var(--g-color-line-brand);
  --yfm-color-inline-code: var(--g-color-text-misc);
  --yfm-color-inline-code-background: var(--g-color-base-misc-light);
  --yfm-color-code-background: var(--g-color-base-misc-light);
  --yfm-color-note-tip: var(--g-color-text-positive);
  --yfm-color-note-tip-background: var(--g-color-base-positive-light);
  --yfm-color-note-warning: var(--g-color-text-warning);
  --yfm-color-note-warning-background: var(--g-color-base-warning-light);
  --yfm-color-note-important: var(--g-color-text-danger);
  --yfm-color-note-important-background: var(--g-color-base-danger-light);
  --yfm-color-note-info: var(--g-color-text-info);
  --yfm-color-note-info-background: var(--g-color-base-info-light);
  --yfm-color-term-title: var(--g-color-text-brand);
  --yfm-color-term-title-hover: var(--g-color-text-brand-heavy);
  --yfm-color-term-dfn-background: var(--g-color-base-float);
  --yfm-color-term-dfn-shadow: var(--g-color-sfx-shadow);
  --yfm-color-term-dfn-pseudo-shadow: var(--g-color-line-generic);
  --yfm-color-modal-content: var(--g-color-base-modal);
  --yfm-color-modal-actions-hover: var(--g-color-base-simple-hover);
  --yfm-color-modal-wide-content: var(--g-color-text-primary);
  --yfm-color-modal-wide-content-overlay: var(--g-color-sfx-veil);
  --yfm-color-table: var(--g-color-text-primary);
  --yfm-color-table-row-background: var(--g-color-base-generic);
  --yfm-color-table-border: var(--g-color-line-generic);
  --yfm-color-table-background: var(--g-color-base-background);
  --yfm-color-table-head-background: var(--g-color-base-generic);
  --yfm-color-table-stripe-row-background: var(--g-color-base-generic);
}

.yfm {
  --yfm-color-base: var(--g-color-base-background);
  --yfm-color-text: var(--g-color-text-primary);
  --yfm-color-link: var(--g-color-text-link);
  --yfm-color-link-hover: var(--g-color-text-link-hover);
  --yfm-color-border: var(--g-color-line-generic);
  --yfm-color-accent: var(--g-color-line-brand);
  --yfm-color-inline-code: var(--g-color-text-misc);
  --yfm-color-inline-code-background: var(--g-color-base-misc-light);
  --yfm-color-code-background: var(--g-color-base-misc-light);
  --yfm-color-note-tip: var(--g-color-text-positive);
  --yfm-color-note-tip-background: var(--g-color-base-positive-light);
  --yfm-color-note-warning: var(--g-color-text-warning);
  --yfm-color-note-warning-background: var(--g-color-base-warning-light);
  --yfm-color-note-important: var(--g-color-text-danger);
  --yfm-color-note-important-background: var(--g-color-base-danger-light);
  --yfm-color-note-info: var(--g-color-text-info);
  --yfm-color-note-info-background: var(--g-color-base-info-light);
  --yfm-color-term-title: var(--g-color-text-brand);
  --yfm-color-term-title-hover: var(--g-color-text-brand-heavy);
  --yfm-color-term-dfn-background: var(--g-color-base-float);
  --yfm-color-term-dfn-shadow: var(--g-color-sfx-shadow);
  --yfm-color-term-dfn-pseudo-shadow: var(--g-color-line-generic);
  --yfm-color-modal-content: var(--g-color-base-modal);
  --yfm-color-modal-actions-hover: var(--g-color-base-simple-hover);
  --yfm-color-modal-wide-content: var(--g-color-text-primary);
  --yfm-color-modal-wide-content-overlay: var(--g-color-sfx-veil);
  --yfm-color-table: var(--g-color-text-primary);
  --yfm-color-table-row-background: var(--g-color-base-generic);
  --yfm-color-table-border: var(--g-color-line-generic);
  --yfm-color-table-background: var(--g-color-base-background);
  --yfm-color-table-head-background: var(--g-color-base-generic);
  --yfm-color-table-stripe-row-background: var(--g-color-base-generic);
}

.yfm {
  --yfm-color-base: var(--g-color-base-background);
  --yfm-color-text: var(--g-color-text-primary);
  --yfm-color-link: var(--g-color-text-link);
  --yfm-color-link-hover: var(--g-color-text-link-hover);
  --yfm-color-border: var(--g-color-line-generic);
  --yfm-color-accent: var(--g-color-line-brand);
  --yfm-color-inline-code: var(--g-color-text-misc);
  --yfm-color-inline-code-background: var(--g-color-base-misc-light);
  --yfm-color-code-background: var(--g-color-base-misc-light);
  --yfm-color-note-tip: var(--g-color-text-positive);
  --yfm-color-note-tip-background: var(--g-color-base-positive-light);
  --yfm-color-note-warning: var(--g-color-text-warning);
  --yfm-color-note-warning-background: var(--g-color-base-warning-light);
  --yfm-color-note-important: var(--g-color-text-danger);
  --yfm-color-note-important-background: var(--g-color-base-danger-light);
  --yfm-color-note-info: var(--g-color-text-info);
  --yfm-color-note-info-background: var(--g-color-base-info-light);
  --yfm-color-term-title: var(--g-color-text-brand);
  --yfm-color-term-title-hover: var(--g-color-text-brand-heavy);
  --yfm-color-term-dfn-background: var(--g-color-base-float);
  --yfm-color-term-dfn-shadow: var(--g-color-sfx-shadow);
  --yfm-color-term-dfn-pseudo-shadow: var(--g-color-line-generic);
  --yfm-color-modal-content: var(--g-color-base-modal);
  --yfm-color-modal-actions-hover: var(--g-color-base-simple-hover);
  --yfm-color-modal-wide-content: var(--g-color-text-primary);
  --yfm-color-modal-wide-content-overlay: var(--g-color-sfx-veil);
  --yfm-color-table: var(--g-color-text-primary);
  --yfm-color-table-row-background: var(--g-color-base-generic);
  --yfm-color-table-border: var(--g-color-line-generic);
  --yfm-color-table-background: var(--g-color-base-background);
  --yfm-color-table-head-background: var(--g-color-base-generic);
  --yfm-color-table-stripe-row-background: var(--g-color-base-generic);
}

.g-root_theme_light .yfm {
  --yfm-color-base: var(--g-color-base-background);
  --yfm-color-text: var(--g-color-text-primary);
  --yfm-color-link: var(--g-color-text-link);
  --yfm-color-link-hover: var(--g-color-text-link-hover);
  --yfm-color-border: var(--g-color-line-generic);
  --yfm-color-accent: var(--g-color-line-brand);
  --yfm-color-inline-code: var(--g-color-text-misc);
  --yfm-color-inline-code-background: var(--g-color-base-misc-light);
  --yfm-color-code-background: var(--g-color-base-misc-light);
  --yfm-color-note-tip: var(--g-color-text-positive);
  --yfm-color-note-tip-background: var(--g-color-base-positive-light);
  --yfm-color-note-warning: var(--g-color-text-warning);
  --yfm-color-note-warning-background: var(--g-color-base-warning-light);
  --yfm-color-note-important: var(--g-color-text-danger);
  --yfm-color-note-important-background: var(--g-color-base-danger-light);
  --yfm-color-note-info: var(--g-color-text-info);
  --yfm-color-note-info-background: var(--g-color-base-info-light);
  --yfm-color-term-title: var(--g-color-text-brand);
  --yfm-color-term-title-hover: var(--g-color-text-brand-heavy);
  --yfm-color-term-dfn-background: var(--g-color-base-float);
  --yfm-color-term-dfn-shadow: var(--g-color-sfx-shadow);
  --yfm-color-term-dfn-pseudo-shadow: var(--g-color-line-generic);
  --yfm-color-modal-content: var(--g-color-base-modal);
  --yfm-color-modal-actions-hover: var(--g-color-base-simple-hover);
  --yfm-color-modal-wide-content: var(--g-color-text-primary);
  --yfm-color-modal-wide-content-overlay: var(--g-color-sfx-veil);
  --yfm-color-table: var(--g-color-text-primary);
  --yfm-color-table-row-background: var(--g-color-base-generic);
  --yfm-color-table-border: var(--g-color-line-generic);
  --yfm-color-table-background: var(--g-color-base-background);
  --yfm-color-table-head-background: var(--g-color-base-generic);
  --yfm-color-table-stripe-row-background: var(--g-color-base-generic);
}

.g-root_theme_light-hc .yfm {
  --yfm-color-base: var(--g-color-base-background);
  --yfm-color-text: var(--g-color-text-primary);
  --yfm-color-link: var(--g-color-text-link);
  --yfm-color-link-hover: var(--g-color-text-link-hover);
  --yfm-color-border: var(--g-color-line-generic);
  --yfm-color-accent: var(--g-color-line-brand);
  --yfm-color-inline-code: var(--g-color-text-misc);
  --yfm-color-inline-code-background: var(--g-color-base-misc-light);
  --yfm-color-code-background: var(--g-color-base-misc-light);
  --yfm-color-note-tip: var(--g-color-text-positive);
  --yfm-color-note-tip-background: var(--g-color-base-positive-light);
  --yfm-color-note-warning: var(--g-color-text-warning);
  --yfm-color-note-warning-background: var(--g-color-base-warning-light);
  --yfm-color-note-important: var(--g-color-text-danger);
  --yfm-color-note-important-background: var(--g-color-base-danger-light);
  --yfm-color-note-info: var(--g-color-text-info);
  --yfm-color-note-info-background: var(--g-color-base-info-light);
  --yfm-color-term-title: var(--g-color-text-brand);
  --yfm-color-term-title-hover: var(--g-color-text-brand-heavy);
  --yfm-color-term-dfn-background: var(--g-color-base-float);
  --yfm-color-term-dfn-shadow: var(--g-color-sfx-shadow);
  --yfm-color-term-dfn-pseudo-shadow: var(--g-color-line-generic);
  --yfm-color-modal-content: var(--g-color-base-modal);
  --yfm-color-modal-actions-hover: var(--g-color-base-simple-hover);
  --yfm-color-modal-wide-content: var(--g-color-text-primary);
  --yfm-color-modal-wide-content-overlay: var(--g-color-sfx-veil);
  --yfm-color-table: var(--g-color-text-primary);
  --yfm-color-table-row-background: var(--g-color-base-generic);
  --yfm-color-table-border: var(--g-color-line-generic);
  --yfm-color-table-background: var(--g-color-base-background);
  --yfm-color-table-head-background: var(--g-color-base-generic);
  --yfm-color-table-stripe-row-background: var(--g-color-base-generic);
}

.g-root_theme_dark .yfm {
  --yfm-color-base: var(--g-color-base-background);
  --yfm-color-text: var(--g-color-text-primary);
  --yfm-color-link: var(--g-color-text-link);
  --yfm-color-link-hover: var(--g-color-text-link-hover);
  --yfm-color-border: var(--g-color-line-generic);
  --yfm-color-accent: var(--g-color-line-brand);
  --yfm-color-inline-code: var(--g-color-text-misc);
  --yfm-color-inline-code-background: var(--g-color-base-misc-light);
  --yfm-color-code-background: var(--g-color-base-misc-light);
  --yfm-color-note-tip: var(--g-color-text-positive);
  --yfm-color-note-tip-background: var(--g-color-base-positive-light);
  --yfm-color-note-warning: var(--g-color-text-warning);
  --yfm-color-note-warning-background: var(--g-color-base-warning-light);
  --yfm-color-note-important: var(--g-color-text-danger);
  --yfm-color-note-important-background: var(--g-color-base-danger-light);
  --yfm-color-note-info: var(--g-color-text-info);
  --yfm-color-note-info-background: var(--g-color-base-info-light);
  --yfm-color-term-title: var(--g-color-text-brand);
  --yfm-color-term-title-hover: var(--g-color-text-brand-heavy);
  --yfm-color-term-dfn-background: var(--g-color-base-float);
  --yfm-color-term-dfn-shadow: var(--g-color-sfx-shadow);
  --yfm-color-term-dfn-pseudo-shadow: var(--g-color-line-generic);
  --yfm-color-modal-content: var(--g-color-base-modal);
  --yfm-color-modal-actions-hover: var(--g-color-base-simple-hover);
  --yfm-color-modal-wide-content: var(--g-color-text-primary);
  --yfm-color-modal-wide-content-overlay: var(--g-color-sfx-veil);
  --yfm-color-table: var(--g-color-text-primary);
  --yfm-color-table-row-background: var(--g-color-base-generic);
  --yfm-color-table-border: var(--g-color-line-generic);
  --yfm-color-table-background: var(--g-color-base-background);
  --yfm-color-table-head-background: var(--g-color-base-generic);
  --yfm-color-table-stripe-row-background: var(--g-color-base-generic);
}
.g-root_theme_dark .yfm table[sticky-header] th::before {
  background: var(--yfm-color-base);
}
.g-root_theme_dark .yfm .yfm-cut-title:before {
  background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxNiAxNiI+PHBhdGggc3Ryb2tlPSJyZ2JhKDI1NSwgMjU1LCAyNTUsIDAuNykiIGZpbGw9Im5vbmUiIGQ9Ik0zIDZsNSA1IDUtNSI+PC9wYXRoPjwvc3ZnPg==");
}
.g-root_theme_dark .yfm .yfm-tabs-accordion .yfm-tab:after {
  background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxNiAxNiI+PHBhdGggc3Ryb2tlPSJyZ2JhKDI1NSwgMjU1LCAyNTUsIDAuNykiIGZpbGw9Im5vbmUiIGQ9Ik0zIDZsNSA1IDUtNSI+PC9wYXRoPjwvc3ZnPg==");
}

.g-root_theme_dark-hc .yfm {
  --yfm-color-base: var(--g-color-base-background);
  --yfm-color-text: var(--g-color-text-primary);
  --yfm-color-link: var(--g-color-text-link);
  --yfm-color-link-hover: var(--g-color-text-link-hover);
  --yfm-color-border: var(--g-color-line-generic);
  --yfm-color-accent: var(--g-color-line-brand);
  --yfm-color-inline-code: var(--g-color-text-misc);
  --yfm-color-inline-code-background: var(--g-color-base-misc-light);
  --yfm-color-code-background: var(--g-color-base-misc-light);
  --yfm-color-note-tip: var(--g-color-text-positive);
  --yfm-color-note-tip-background: var(--g-color-base-positive-light);
  --yfm-color-note-warning: var(--g-color-text-warning);
  --yfm-color-note-warning-background: var(--g-color-base-warning-light);
  --yfm-color-note-important: var(--g-color-text-danger);
  --yfm-color-note-important-background: var(--g-color-base-danger-light);
  --yfm-color-note-info: var(--g-color-text-info);
  --yfm-color-note-info-background: var(--g-color-base-info-light);
  --yfm-color-term-title: var(--g-color-text-brand);
  --yfm-color-term-title-hover: var(--g-color-text-brand-heavy);
  --yfm-color-term-dfn-background: var(--g-color-base-float);
  --yfm-color-term-dfn-shadow: var(--g-color-sfx-shadow);
  --yfm-color-term-dfn-pseudo-shadow: var(--g-color-line-generic);
  --yfm-color-modal-content: var(--g-color-base-modal);
  --yfm-color-modal-actions-hover: var(--g-color-base-simple-hover);
  --yfm-color-modal-wide-content: var(--g-color-text-primary);
  --yfm-color-modal-wide-content-overlay: var(--g-color-sfx-veil);
  --yfm-color-table: var(--g-color-text-primary);
  --yfm-color-table-row-background: var(--g-color-base-generic);
  --yfm-color-table-border: var(--g-color-line-generic);
  --yfm-color-table-background: var(--g-color-base-background);
  --yfm-color-table-head-background: var(--g-color-base-generic);
  --yfm-color-table-stripe-row-background: var(--g-color-base-generic);
}

/*
 TDOD: delete it after https://github.com/diplodoc-platform/transform/pull/708
 fix spacing for last paragraph and empty paragraphs with cursor (override YFM style)
 */
@supports selector(:has(br)) {
  .yfm li > p:only-of-type:has(br),
  .yfm li > blockquote:only-of-type:has(br) {
    margin-block: 0;
  }
}
.yfm li > p:last-child {
  margin-block: var(--yfm-list-text-only-margin-block, 0);
}

.yfm {
  --yfm-hr-height: 4px;
  --yfm-hr-margin: 24px 0;
}