.wrapper {
  border-radius: $input-corner;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  overflow: hidden;

  &.bound {
    background-color: var(--input-bg);
    height: 350px; // Temporary
  }

  & > div {
    display: flex;
    flex-grow: 1;
    overflow: hidden;
  }

  .editor {
    -webkit-font-smoothing: antialiased;
    box-sizing: border-box;
    color: var(--text-primary);
    display: block;
    flex-grow: 1;
    font-size: $font-regular;
    line-height: 1.4;
    overflow-y: auto;
    overflow-x: hidden;
    padding: $unit * 1.5 $unit-2x;
    white-space: pre-wrap;
    width: 100%;

    &:focus {
      // border: 2px solid $blue;
      outline: none;
    }

    p.empty:first-child::before {
      color: var(--text-tertiary);
      content: attr(data-placeholder);
      float: left;
      height: 0;
      pointer-events: none;
    }

    &.bound {
      background-color: var(--input-bound-bg);

      &:hover {
        background-color: var(--input-bound-bg-hover);
      }
    }

    &.editParty {
      border-bottom-left-radius: $input-corner;
      border-bottom-right-radius: $input-corner;
    }

    a:hover {
      cursor: pointer;
    }

    strong {
      font-weight: $bold;
    }

    em {
      font-style: italic;
    }

    ul {
      padding: 0 $unit-2x;
      list-style-type: disc;
    }

    ol {
      padding: 0 $unit-2x;
      list-style-type: decimal;
    }

    h1 {
      font-size: $font-xlarge;
      font-weight: $medium;
      margin: $unit-2x 0;
      text-align: left;
    }

    h2 {
      font-size: $font-large;
      font-weight: $medium;
      margin: $unit-2x 0;
      text-align: left;
    }

    h3 {
      font-size: $font-regular;
      font-weight: $medium;
      margin: $unit-2x 0;
      text-align: left;
    }

    mark {
      border-radius: $item-corner-small;
      background: var(--highlight-bg);
      color: var(--highlight-text);
      font-weight: $normal;
      padding: 1px $unit-fourth;
    }

    iframe {
      background: var(--input-bound-bg);
      border-radius: $card-corner;
      min-width: 200px;
      min-height: 200px;
      display: block;
      outline: 0px solid transparent;
      margin: $unit 0;

      &:hover {
        background: var(--input-bound-bg-hover);
      }
    }

    .mention {
      border-radius: $item-corner-small;
      box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25),
        0 1px 0px var(--null-shadow);
      background: var(--null-bg);
      color: var(--text-primary);
      font-weight: $medium;
      font-size: 15px;
      padding: 1px $unit-half;
      transition: all 0.1s ease-out;

      &:hover {
        background: var(--null-bg-hover);
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25),
          0 1px 0px var(--null-shadow-hover);
        text-decoration: none;
        cursor: pointer;
      }

      &[data-element='fire'] {
        background: var(--fire-bg);
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25),
          0 1px 0px var(--fire-shadow);
        color: var(--fire-text-contrast);

        &:hover {
          background: var(--fire-bg-hover);
          box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25),
            0 1px 0px var(--fire-shadow-hover);
          color: var(--fire-text-hover);
        }
      }

      &[data-element='water'] {
        background: var(--water-bg);
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25),
          0 1px 0px var(--water-shadow);
        color: var(--water-text-contrast);

        &:hover {
          background: var(--water-bg-hover);
          box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25),
            0 1px 0px var(--water-shadow-hover);
          color: var(--water-text-hover);
        }
      }

      &[data-element='earth'] {
        background: var(--earth-bg);
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25),
          0 1px 0px var(--earth-shadow);
        color: var(--earth-text-contrast);

        &:hover {
          background: var(--earth-bg-hover);
          box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25),
            0 1px 0px var(--earth-shadow-hover);
          color: var(--earth-text-hover);
        }
      }

      &[data-element='wind'] {
        background: var(--wind-bg);
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25),
          0 1px 0px var(--wind-shadow);
        color: var(--wind-text-contrast);

        &:hover {
          box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25),
            0 1px 0px var(--wind-shadow-hover);
          color: var(--wind-text-hover);
        }
      }

      &[data-element='dark'] {
        background: var(--dark-bg);
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25),
          0 1px 0px var(--dark-shadow);
        color: var(--dark-text-contrast);

        &:hover {
          background: var(--dark-bg-hover);
          box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25),
            0 1px 0px var(--dark-shadow-hover);
          color: var(--dark-text-hover);
        }
      }

      &[data-element='light'] {
        background: var(--light-bg);
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25),
          0 1px 0px var(--light-shadow);
        color: var(--light-text-contrast);

        &:hover {
          background: var(--light-bg-hover);
          box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25),
            0 1px 0px var(--light-shadow-hover);
          color: var(--light-text-hover);
        }
      }
    }
  }

  .toolbar {
    background: var(--toolbar-bg);
    position: sticky;
    align-items: center;
    display: flex;
    gap: $unit-half;
    padding: $unit;
    z-index: 10;

    .divider {
      background: var(--toolbar-divider-bg);
      border-radius: $full-corner;
      height: calc($unit-2x + $unit-half);
      width: $unit-fourth;
    }
  }
}

.menu {
  background: var(--formatting-menu-bg);
  border-radius: $bubble-menu-corner;
  padding: $unit-half;

  button {
    background: var(--formatting-menu-item-bg);
    border-radius: $bubble-menu-item-corner;
    color: var(--formatting-menu-item-text);
    font-weight: $medium;
    font-size: $font-small;

    &:hover {
      background: var(--formatting-menu-item-bg-hover);
      color: var(--formatting-menu-item-text-hover);
    }

    &:active {
      background: var(--formatting-menu-item-bg-active);
      color: var(--formatting-menu-item-text-active);
    }
  }
}
