.godo {
  --menu-item-font-size: 14px;
  --menu-item-height: calc( var(--menu-item-font-size) * 2);
  --django-syntax-color: #f4facc;
}

.godo--editor {
  min-height: 10em;
  white-space: pre-wrap;
}

.godo--editor > :first-child {
  margin-top: 0;
}

/*
 * Menus
 */

.menuicons {
  font-size: var(--menu-item-font-size);
  position: relative;
  min-width: 2em;
  display: inline-flex;
}
.menuicon, .menuicon:hover {
  --border-width: 0px;
  padding: calc( var(--menu-item-height) / 4 - var(--border-width) ) .33em;
  color:  inherit;
  background-color: #fff;
  min-width: var(--menu-item-height);
  border: var(--border-width) none;
  color: inherit;
  font-family: sans-serif;
  line-height: 1;
}
.menuicon {
  font-weight: 500;
}
.menuicon:hover {
  color:  black;
}
.menuicon.active, .menuicon:active, .menuicon:disabled {
  color: #386EDE;
  background-color: #eee;
}

/* Blocks menu */
.godo-blocks-menu {
  position: sticky;
  top:  0;
  background-color: white;
}
.godo-blocks-menu .menuicon {
  --border-width: 1px;
  color: #555;
  background-color: white;
  border: var(--border-width) solid #eee;
}
.godo-blocks-menu .menuicon:hover {
  color:  black;
  border-color: #555;
}
.godo-blocks-menu .menuicon:disabled {
  background-color: #eee;
  color:  #aaa;
  opacity: 0.8;
}
.godo-blocks-menu .menuicon.active,
.godo-blocks-menu .menuicon:active {
  color: #386EDE;
  border-color: #386EDE;
}
.godo-blocks-menu .menuicon-djTag,
.godo-blocks-menu .menuicon-djNode {
  background-color: var(--django-syntax-color);
}

/* Marks menu */
.godo-marks-menu {
  position: fixed;
  top: 0;
  left: 0;
}
.godo-marks-menu.fade {
  display: none;
}
.godo-marks-menu > .menuicons {
  padding-top: 14px;
  margin-left: -50%;
  display: inline-flex;
  border-color: #555;
}
.godo-marks-menu > .menuicons:before {
  content: "";
  display: block;
  position: absolute;
  margin: 0 auto;
  top: 0;
  bottom: auto;
  right: 0;
  left: 0;
  width: 0;
  height: 0;
  border: 7px solid transparent;
  border-bottom-color: #888;
}
.godo-marks-menu .menuicon {
  background-color: #3C3C33;
  color: white;
  border: 2px solid #888;
  border-radius: 0;
  text-transform: none;
}
.godo-marks-menu .menuicon:first-child {
  border-radius: 3px 0 0 3px;
}
.godo-marks-menu .menuicon:last-child {
  border-radius: 0 3px 3px 0;
}
.godo-marks-menu  .menuicon.active {
  background-color: #386EDE;
}
.godo-marks-menu  .menuicon:disabled {
  display: none;
}

.menuicon-b {
  font-weight: 900;
}
.menuicon-i {
  font-weight: 600;
  font-style: italic;
}
.menuicon-hh {
  font-variant: small-caps;
  font-weight: 900;
}
.menuicon-a {
  text-decoration: underline !important;
}


/*
 * Menu dialog
 */

/* dialog normalizer for polyfill */
.godo-dialog {
  position: fixed;
  left: 0; right: 0;
  width: -moz-fit-content;
  width: -webkit-fit-content;
  width: fit-content;
  height: -moz-fit-content;
  height: -webkit-fit-content;
  height: fit-content;
  margin: auto;
  border: solid;
  padding: 1em;
  background: white;
  color: black;
  display: block;
}
.godo-dialog:not([open]) {
  display: none;
}
.godo-dialog::backdrop,
.godo-dialog + .backdrop {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  background: rgba(0,0,0,0.3);
}
._dialog_overlay {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
}

.godo-dialog--menu {
  list-style: none;
  display: flex;
  flex-wrap:  wrap;
  justify-content: end;
  margin: 0;
  padding: 0;
}
.godo-dialog--menu button {
  text-transform: capitalize;
}
.godo-dialog--form p {
  margin-bottom: 1em;
}
.godo-dialog--form label {
  display:  block;
}
.godo-dialog--form label > * {
  width: 0;
  min-width: 100%;
  max-width: 100%;
}
.godo-dialog--menuitem:not(:last-child) {
  margin-right: 0.5em;
  margin-bottom: 0.5em;
}


/*
 * Editor elements
 */

div.godo .ProseMirror.godo--editor ul li p {
  margin: 0;
}
div.godo .ProseMirror.godo--editor a {
  text-decoration: underline;
  text-underline-offset: 0.3em;
}
.godo--editor djnode {
  display: block;
  margin-top: 1em;
  margin-bottom: 1em;
}

.godo--editor djtag,
.godo--editor djvar {
  display: inline-block;
  padding: 1px 2px;
  margin-right: 0.1em;
  margin-left: 0.1em;
  text-decoration: inherit;
  border: 1px solid hsla(0, 0%, 0%, 0.2);
  font-family: monospace;
  background-color: var(--django-syntax-color);
}


/*
 * Editor is form widget
 */

.is-form-widget .godo--editor {
  border: 1px solid gray;
  background-color: white;
  padding: 1em;
  padding-bottom: 3em;
}

[django-syntax] .godo--editor {
  padding-left: 2em;
}

[django-syntax] .godo--editor djnode {
  margin-left: -1em;
}

/*
 * Editor for HTML Element
 */

.html-edition {
  position: relative;
}
.html-edition .godo--editor {
  outline: none;
}
.html-edition.is-editable {
  --background-color: hsla(0, 0%, 100%, 0.5);
  --padding: 1em;
  outline: 1px solid;
  background-color: var(--background-color);
  margin: calc( -1 * var(--padding) );
  margin-top: calc( -1 * var(--menu-item-height) - var(--padding) );
  margin-bottom: 0;
  padding: var(--padding);
  padding-top: 0;
}
.html-edition.is-editable .godo--editor {
  padding-top: var(--padding);
}
.html-edition.is-editable .godo-blocks-menu {
  background-color: transparent;
}
